[richfaces-svn-commits] JBoss Rich Faces SVN: r2664 - in trunk/samples/richfaces-demo/src/main: webapp/richfaces/repeat and 1 other directories.
richfaces-svn-commits at lists.jboss.org
richfaces-svn-commits at lists.jboss.org
Fri Aug 31 11:43:09 EDT 2007
Author: ilya_shaikovsky
Date: 2007-08-31 11:43:09 -0400 (Fri, 31 Aug 2007)
New Revision: 2664
Added:
trunk/samples/richfaces-demo/src/main/webapp/richfaces/repeat/examples/UpdateBean.java
Modified:
trunk/samples/richfaces-demo/src/main/java/org/richfaces/datatable/UpdateBean.java
trunk/samples/richfaces-demo/src/main/webapp/richfaces/repeat/examples/repeater.xhtml
trunk/samples/richfaces-demo/src/main/webapp/richfaces/repeat/usage.xhtml
Log:
Modified: trunk/samples/richfaces-demo/src/main/java/org/richfaces/datatable/UpdateBean.java
===================================================================
--- trunk/samples/richfaces-demo/src/main/java/org/richfaces/datatable/UpdateBean.java 2007-08-31 14:57:14 UTC (rev 2663)
+++ trunk/samples/richfaces-demo/src/main/java/org/richfaces/datatable/UpdateBean.java 2007-08-31 15:43:09 UTC (rev 2664)
@@ -2,10 +2,38 @@
import javax.faces.component.html.HtmlInputText;
import javax.faces.context.FacesContext;
+import org.ajax4jsf.component.UIRepeat;
+import java.util.HashSet;
+import java.util.Set;
public class UpdateBean {
+
HtmlInputText priceRef;
+ private UIRepeat repeater;
+ private Set<Integer> keys = null;
+
+ /**
+ * @return the keys
+ */
+ public Set getKeys() {
+ return keys;
+ }
+ /**
+ * @param keys the keys to set
+ */
+ public void setKeys(Set keys) {
+ this.keys = keys;
+ }
+
+ public void setRepeater(UIRepeat repeater) {
+ this.repeater = repeater;
+ }
+
+ public UIRepeat getRepeater() {
+ return repeater;
+ }
+
public HtmlInputText getPriceRef() {
return priceRef;
}
@@ -15,6 +43,11 @@
}
public String change(){
+
+ HashSet keys = new HashSet<Integer>();
+ int rowKey = getRepeater().getRowIndex();
+ keys.add(rowKey);
+ setKeys(keys);
priceRef.processValidators(FacesContext.getCurrentInstance());
priceRef.processUpdates(FacesContext.getCurrentInstance());
return null;
Added: trunk/samples/richfaces-demo/src/main/webapp/richfaces/repeat/examples/UpdateBean.java
===================================================================
--- trunk/samples/richfaces-demo/src/main/webapp/richfaces/repeat/examples/UpdateBean.java (rev 0)
+++ trunk/samples/richfaces-demo/src/main/webapp/richfaces/repeat/examples/UpdateBean.java 2007-08-31 15:43:09 UTC (rev 2664)
@@ -0,0 +1,55 @@
+package org.richfaces.datatable;
+
+import javax.faces.component.html.HtmlInputText;
+import javax.faces.context.FacesContext;
+import org.ajax4jsf.component.UIRepeat;
+import java.util.HashSet;
+import java.util.Set;
+
+public class UpdateBean {
+
+ HtmlInputText priceRef;
+ private UIRepeat repeater;
+ private Set<Integer> keys = null;
+
+ /**
+ * @return the keys
+ */
+ public Set getKeys() {
+ return keys;
+ }
+
+ /**
+ * @param keys the keys to set
+ */
+ public void setKeys(Set keys) {
+ this.keys = keys;
+ }
+
+ public void setRepeater(UIRepeat repeater) {
+ this.repeater = repeater;
+ }
+
+ public UIRepeat getRepeater() {
+ return repeater;
+ }
+
+ public HtmlInputText getPriceRef() {
+ return priceRef;
+ }
+
+ public void setPriceRef(HtmlInputText priceRef) {
+ this.priceRef = priceRef;
+ }
+
+ public String change(){
+
+ HashSet keys = new HashSet<Integer>();
+ int rowKey = getRepeater().getRowIndex();
+ keys.add(rowKey);
+ setKeys(keys);
+ priceRef.processValidators(FacesContext.getCurrentInstance());
+ priceRef.processUpdates(FacesContext.getCurrentInstance());
+ return null;
+ }
+}
Property changes on: trunk/samples/richfaces-demo/src/main/webapp/richfaces/repeat/examples/UpdateBean.java
___________________________________________________________________
Name: svn:executable
+ *
Modified: trunk/samples/richfaces-demo/src/main/webapp/richfaces/repeat/examples/repeater.xhtml
===================================================================
--- trunk/samples/richfaces-demo/src/main/webapp/richfaces/repeat/examples/repeater.xhtml 2007-08-31 14:57:14 UTC (rev 2663)
+++ trunk/samples/richfaces-demo/src/main/webapp/richfaces/repeat/examples/repeater.xhtml 2007-08-31 15:43:09 UTC (rev 2664)
@@ -17,7 +17,7 @@
<th style="width: 150px"><h:outputText value="Reason" /></th>
<th><h:outputText value="Proposed Gross Margin" /></th>
</tr>
- <a4j:repeat value="#{salesReport.items}" var="item">
+ <a4j:repeat value="#{salesReport.items}" var="item" binding="#{updateBean.repeater}">
<tr>
<td align="center">
<h:outputText value="#{item.productCode}" />
@@ -26,7 +26,7 @@
<h:inputText binding="#{updateBean.priceRef}"
immediate="false" value="#{item.proposedPrice}" size="7">
<a4j:support immediate="true" action="#{updateBean.change}"
- event="onchange" reRender="margin,reason,table" />
+ event="onchange" reRender="reason,margin" />
</h:inputText>
</td>
<td>
Modified: trunk/samples/richfaces-demo/src/main/webapp/richfaces/repeat/usage.xhtml
===================================================================
--- trunk/samples/richfaces-demo/src/main/webapp/richfaces/repeat/usage.xhtml 2007-08-31 14:57:14 UTC (rev 2663)
+++ trunk/samples/richfaces-demo/src/main/webapp/richfaces/repeat/usage.xhtml 2007-08-31 15:43:09 UTC (rev 2664)
@@ -15,7 +15,9 @@
Additionally to facelets <ui:repeat> component it allows to update
a set of its children instead of the whole using AJAX reuqests.
<br />
- The folowing example shows the repeat component in use:
+ The folowing example shows the repeat component in use.
+ There you could explore how to make updatable the only two concrete
+ cells of the table using Ajax Keys.
</p>
@@ -25,6 +27,11 @@
<ui:include src="/templates/include/sourceview.xhtml">
<ui:param name="sourcepath" value="/richfaces/repeat/examples/repeater.xhtml"/>
</ui:include>
+ <ui:include src="/templates/include/sourceview.xhtml">
+ <ui:param name="sourcepath" value="/richfaces/repeat/examples/UpdateBean.java"/>
+ <ui:param name="openlabel" value="View UpdateBean.java Source" />
+ <ui:param name="sourcetype" value="java" />
+ </ui:include>
</div>
</ui:define>
More information about the richfaces-svn-commits
mailing list