Author: SergeySmirnov
Date: 2007-04-27 21:59:03 -0400 (Fri, 27 Apr 2007)
New Revision: 592
Added:
trunk/richfaces-samples/richfaces-art-datatable/src/main/java/org/rf/datatable/UpdateBean.java
trunk/richfaces-samples/richfaces-art-datatable/src/main/webapp/WEB-INF/faces-config.xml.l4t
Modified:
trunk/richfaces-samples/richfaces-art-datatable/src/main/java/org/rf/datatable/SalesItem.java
trunk/richfaces-samples/richfaces-art-datatable/src/main/webapp/WEB-INF/faces-config.xml
trunk/richfaces-samples/richfaces-art-datatable/src/main/webapp/pages/example10.jsp
Log:
added drop-down to the row at example #10
Modified:
trunk/richfaces-samples/richfaces-art-datatable/src/main/java/org/rf/datatable/SalesItem.java
===================================================================
---
trunk/richfaces-samples/richfaces-art-datatable/src/main/java/org/rf/datatable/SalesItem.java 2007-04-27
20:29:14 UTC (rev 591)
+++
trunk/richfaces-samples/richfaces-art-datatable/src/main/java/org/rf/datatable/SalesItem.java 2007-04-28
01:59:03 UTC (rev 592)
@@ -1,10 +1,42 @@
package org.rf.datatable;
+import java.util.ArrayList;
+
+import javax.faces.model.SelectItem;
+
public class SalesItem {
private int productCode;
private double proposedPrice;
private double ProposedGrossMargin;
private double salesCost;
+ private String reason;
+ private ArrayList reasons;
+ public ArrayList getReasons() {
+ reasons = new ArrayList();
+ if (proposedPrice != 0.0) {
+ if (proposedPrice <= salesCost) {
+ reasons.add(new SelectItem("Nobody Needs it"));
+ reasons.add(new SelectItem("Bad Quality"));
+ reasons.add(new SelectItem("Partly Broken"));
+ } else {
+ reasons.add(new SelectItem("Just Good"));
+ reasons.add(new SelectItem("Everybody Asks for it"));
+ }
+ } else {
+ //reasons.add(new SelectItem("Enter the Price"));
+ }
+ return reasons;
+ }
+ public void setReasons(ArrayList reasons) {
+ this.reasons = reasons;
+ }
+ public String getReason() {
+ return reason;
+ }
+ public void setReason(String reason) {
+ this.reason = reason;
+ }
+
public SalesItem(int productCode, double salesCost) {
super();
this.productCode = productCode;
Added:
trunk/richfaces-samples/richfaces-art-datatable/src/main/java/org/rf/datatable/UpdateBean.java
===================================================================
---
trunk/richfaces-samples/richfaces-art-datatable/src/main/java/org/rf/datatable/UpdateBean.java
(rev 0)
+++
trunk/richfaces-samples/richfaces-art-datatable/src/main/java/org/rf/datatable/UpdateBean.java 2007-04-28
01:59:03 UTC (rev 592)
@@ -0,0 +1,22 @@
+package org.rf.datatable;
+
+import javax.faces.component.html.HtmlInputText;
+import javax.faces.context.FacesContext;
+
+public class UpdateBean {
+ HtmlInputText priceRef;
+
+ public HtmlInputText getPriceRef() {
+ return priceRef;
+ }
+
+ public void setPriceRef(HtmlInputText priceRef) {
+ this.priceRef = priceRef;
+ }
+
+ public String change(){
+ priceRef.processValidators(FacesContext.getCurrentInstance());
+ priceRef.processUpdates(FacesContext.getCurrentInstance());
+ return null;
+ }
+}
Modified:
trunk/richfaces-samples/richfaces-art-datatable/src/main/webapp/WEB-INF/faces-config.xml
===================================================================
---
trunk/richfaces-samples/richfaces-art-datatable/src/main/webapp/WEB-INF/faces-config.xml 2007-04-27
20:29:14 UTC (rev 591)
+++
trunk/richfaces-samples/richfaces-art-datatable/src/main/webapp/WEB-INF/faces-config.xml 2007-04-28
01:59:03 UTC (rev 592)
@@ -8,6 +8,11 @@
<managed-bean-scope>session</managed-bean-scope>
</managed-bean>
<managed-bean>
+ <managed-bean-name>updateBean</managed-bean-name>
+ <managed-bean-class>org.rf.datatable.UpdateBean</managed-bean-class>
+ <managed-bean-scope>request</managed-bean-scope>
+ </managed-bean>
+ <managed-bean>
<managed-bean-name>skinBean</managed-bean-name>
<managed-bean-class>org.rf.skin.SkinBean</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
Added:
trunk/richfaces-samples/richfaces-art-datatable/src/main/webapp/WEB-INF/faces-config.xml.l4t
===================================================================
---
trunk/richfaces-samples/richfaces-art-datatable/src/main/webapp/WEB-INF/faces-config.xml.l4t
(rev 0)
+++
trunk/richfaces-samples/richfaces-art-datatable/src/main/webapp/WEB-INF/faces-config.xml.l4t 2007-04-28
01:59:03 UTC (rev 592)
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<PROCESS ENTITY="JSFProcess">
+ <PROCESS-ITEM ENTITY="JSFProcessGroup"
NAME="rules:#pages#main.jsp"
+ PATH="/pages/main.jsp" SHAPE="240,33,0,0">
+ <PROCESS-ITEM ENTITY="JSFProcessItem"
ID="rules:#pages#main.jsp:0"
+ NAME="item" PATH="/pages/main.jsp">
+ <PROCESS-ITEM-OUTPUT ENTITY="JSFProcessItemOutput"
+ ID="example1::#pages#example1.jsp" NAME="output"
+ PATH="/pages/example1.jsp" TARGET="rules:#pages#example1.jsp"
TITLE="example1"/>
+ <PROCESS-ITEM-OUTPUT ENTITY="JSFProcessItemOutput"
+ ID="example2::#pages#example2.jsp" NAME="output1"
+ PATH="/pages/example2.jsp" TARGET="rules:#pages#example2.jsp"
TITLE="example2"/>
+ <PROCESS-ITEM-OUTPUT ENTITY="JSFProcessItemOutput"
+ ID="example3::#pages#example3.jsp" NAME="output2"
+ PATH="/pages/example3.jsp" TARGET="rules:#pages#example3.jsp"
TITLE="example3"/>
+ <PROCESS-ITEM-OUTPUT ENTITY="JSFProcessItemOutput"
+ ID="example4::#pages#example4.jsp" NAME="output3"
+ PATH="/pages/example4.jsp" TARGET="rules:#pages#example4.jsp"
TITLE="example4"/>
+ <PROCESS-ITEM-OUTPUT ENTITY="JSFProcessItemOutput"
+ ID="example10::#pages#example10.jsp" NAME="output4"
+ PATH="/pages/example10.jsp" TARGET="rules:#pages#example10.jsp"
TITLE="example10"/>
+ </PROCESS-ITEM>
+ </PROCESS-ITEM>
+ <PROCESS-ITEM ENTITY="JSFProcessGroup" NAME="rules:*"
PATH="*" SHAPE="32,17,0,0">
+ <PROCESS-ITEM ENTITY="JSFProcessItem" ID="rules:*:0"
NAME="item" PATH="*">
+ <PROCESS-ITEM-OUTPUT ENTITY="JSFProcessItemOutput"
+ ID="main::#pages#main.jsp" NAME="output"
PATH="/pages/main.jsp"
+ TARGET="rules:#pages#main.jsp" TITLE="main"/>
+ </PROCESS-ITEM>
+ </PROCESS-ITEM>
+ <PROCESS-ITEM ENTITY="JSFProcessGroup"
+ NAME="rules:#pages#example10.jsp" PATH="/pages/example10.jsp"
SHAPE="512,593,0,0"/>
+ <PROCESS-ITEM ENTITY="JSFProcessGroup"
NAME="rules:#pages#example3.jsp"
+ PATH="/pages/example3.jsp" SHAPE="512,369,0,0"/>
+ <PROCESS-ITEM ENTITY="JSFProcessGroup"
NAME="rules:#pages#example2.jsp"
+ PATH="/pages/example2.jsp" SHAPE="512,257,0,0"/>
+ <PROCESS-ITEM ENTITY="JSFProcessGroup"
NAME="rules:#pages#example4.jsp"
+ PATH="/pages/example4.jsp" SHAPE="512,481,0,0"/>
+ <PROCESS-ITEM ENTITY="JSFProcessGroup"
NAME="rules:#pages#example1.jsp"
+ PATH="/pages/example1.jsp" SHAPE="512,17,0,0"/>
+</PROCESS>
Modified:
trunk/richfaces-samples/richfaces-art-datatable/src/main/webapp/pages/example10.jsp
===================================================================
---
trunk/richfaces-samples/richfaces-art-datatable/src/main/webapp/pages/example10.jsp 2007-04-27
20:29:14 UTC (rev 591)
+++
trunk/richfaces-samples/richfaces-art-datatable/src/main/webapp/pages/example10.jsp 2007-04-28
01:59:03 UTC (rev 592)
@@ -27,6 +27,9 @@
<h:column>
<h:outputText value="Sales Cost" />
</h:column>
+ <rich:column style="width:150px">
+ <h:outputText value="Reason" />
+ </rich:column>
<h:column>
<h:outputText value="Proposed Gross Margin" />
</h:column>
@@ -36,15 +39,19 @@
<h:outputText value="#{item.productCode}" />
</h:column>
<h:column>
- <h:inputText value="#{item.proposedPrice}" size="7">
- <a4j:support event="onchange" reRender="margin" />
+ <h:inputText binding="#{updateBean.priceRef}"
immediate="false" value="#{item.proposedPrice}"
size="7">
+ <a4j:support immediate="true" action="#{updateBean.change}"
event="onchange" reRender="margin,reason" />
</h:inputText>
-
</h:column>
<h:column>
<h:outputText value="#{item.salesCost}" />
</h:column>
<h:column>
+ <h:selectOneMenu id="reason" required="true"
value="#{item.reason}">
+ <f:selectItems value="#{item.reasons}" />
+ </h:selectOneMenu>
+ </h:column>
+ <h:column>
<h:outputText id="margin"
value="#{item.proposedGrossMargin}">
<f:convertNumber pattern="$###0.000" />
</h:outputText>
Show replies by date