[richfaces-svn-commits] JBoss Rich Faces SVN: r9018 - in branches/3.1.x/test-applications/facelets/src/main: webapp/DataOrderedList and 1 other directory.

richfaces-svn-commits at lists.jboss.org richfaces-svn-commits at lists.jboss.org
Thu Jun 12 08:40:57 EDT 2008


Author: adubovsky
Date: 2008-06-12 08:40:57 -0400 (Thu, 12 Jun 2008)
New Revision: 9018

Modified:
   branches/3.1.x/test-applications/facelets/src/main/java/dataOrderedList/DataOrderedList.java
   branches/3.1.x/test-applications/facelets/src/main/webapp/DataOrderedList/DataOrderedList.xhtml
   branches/3.1.x/test-applications/facelets/src/main/webapp/DataOrderedList/DataOrderedListProperty.xhtml
Log:
Add binding and change used data for DataOrderedList

Modified: branches/3.1.x/test-applications/facelets/src/main/java/dataOrderedList/DataOrderedList.java
===================================================================
--- branches/3.1.x/test-applications/facelets/src/main/java/dataOrderedList/DataOrderedList.java	2008-06-12 12:26:53 UTC (rev 9017)
+++ branches/3.1.x/test-applications/facelets/src/main/java/dataOrderedList/DataOrderedList.java	2008-06-12 12:40:57 UTC (rev 9018)
@@ -1,7 +1,13 @@
 package dataOrderedList;
 
 import java.util.ArrayList;
+import java.util.Random;
 
+import javax.faces.context.FacesContext;
+import javax.faces.event.ActionEvent;
+
+import org.richfaces.component.html.HtmlDataOrderedList;
+
 import util.data.Data;
 
 public class DataOrderedList
@@ -14,7 +20,33 @@
 	private String type;
 	private String dir;
 	private int mSize;
+	private HtmlDataOrderedList myDataOrderedList;
+	private String bindLabel;
 	
+	public void bindingCheck(ActionEvent actionEvent){
+		FacesContext faces = FacesContext.getCurrentInstance();
+		bindLabel = myDataOrderedList.getBaseClientId(faces);
+		System.out.println("============LS Binding Check===========");
+		System.out.println(myDataOrderedList.getBaseClientId(faces));
+		System.out.println("============LS Binding Check===========");
+	}
+	
+	public String getBindLabel() {
+		return bindLabel;
+	}
+
+	public void setBindLabel(String bindLabel) {
+		this.bindLabel = bindLabel;
+	}
+	
+	public HtmlDataOrderedList getMyDataOrderedList() {
+		return myDataOrderedList;
+	}
+
+	public void setMyDataOrderedList(HtmlDataOrderedList myDataOrderedList) {
+		this.myDataOrderedList = myDataOrderedList;
+	}
+		
 	public String getDir() {
 		return dir;
 	}
@@ -44,8 +76,10 @@
 		rendered = true;
 		title = "title";
 		type = "1";
-		for(int i = 1; i < Data.cityAfrica.length; i++)
-			arr.add(new Data(Data.cityAfrica[i]));
+		Random randomGenerator = new Random();
+		for(int i = 0; i < Data.cars.length; i++)
+			arr.add(new Data(Data.cars[i], randomGenerator.nextInt(1000000), randomGenerator.nextInt(1000000)));
+		this.bindLabel = "Not checked";
 	}
 
 	public int getFirst() {

Modified: branches/3.1.x/test-applications/facelets/src/main/webapp/DataOrderedList/DataOrderedList.xhtml
===================================================================
--- branches/3.1.x/test-applications/facelets/src/main/webapp/DataOrderedList/DataOrderedList.xhtml	2008-06-12 12:26:53 UTC (rev 9017)
+++ branches/3.1.x/test-applications/facelets/src/main/webapp/DataOrderedList/DataOrderedList.xhtml	2008-06-12 12:40:57 UTC (rev 9018)
@@ -1,14 +1,20 @@
 
 <f:subview xmlns:f="http://java.sun.com/jsf/core" xmlns:a4j="http://richfaces.org/a4j" xmlns:h="http://java.sun.com/jsf/html" xmlns:rich="http://richfaces.org/rich" id="dataOrderedListSubviewID">
-		<rich:dataOrderedList id="doListID" value="#{dataOrderedList.arr}" var="arr" first="#{dataOrderedList.first}"
-			rendered="#{dataOrderedList.rendered}" title="#{dataOrderedList.title}" type="#{dataOrderedList.type}" dir="#{dataOrderedList.dir}"
-			rows="#{dataOrderedList.rows}">
-			<f:facet name="header">
-				<h:outputText value="Africa(header):" />
-			</f:facet>
-			<h:outputText value="#{arr.str0}" />
-			<f:facet name="footer">
-				<h:outputText value="Africa(footer);" />
-			</f:facet>
+		<rich:dataOrderedList id="dataOrderedListID" 
+			value="#{dataOrderedList.arr}" var="arr" 
+			first="#{dataOrderedList.first}"
+			rendered="#{dataOrderedList.rendered}" 
+			title="#{dataOrderedList.title}" 
+			type="#{dataOrderedList.type}" 
+			dir="#{dataOrderedList.dir}"
+			rows="#{dataOrderedList.rows}"
+			binding="#{dataOrderedList.myDataOrderedList}">
+			
+            <h:outputText value="#{arr.str0} " /><f:verbatim><br /></f:verbatim>
+			<h:outputText value="Price:  $" styleClass="label"></h:outputText>
+            <h:outputText value="#{arr.int0} " /><f:verbatim><br /></f:verbatim>
+            <h:outputText value="Mileage:  " styleClass="label"></h:outputText>
+            <h:outputText value="#{arr.int1} " />
+            <h:outputText value=" Miles" />
 		</rich:dataOrderedList>
 </f:subview>

Modified: branches/3.1.x/test-applications/facelets/src/main/webapp/DataOrderedList/DataOrderedListProperty.xhtml
===================================================================
--- branches/3.1.x/test-applications/facelets/src/main/webapp/DataOrderedList/DataOrderedListProperty.xhtml	2008-06-12 12:26:53 UTC (rev 9017)
+++ branches/3.1.x/test-applications/facelets/src/main/webapp/DataOrderedList/DataOrderedListProperty.xhtml	2008-06-12 12:40:57 UTC (rev 9018)
@@ -1,26 +1,31 @@
 
 <f:subview xmlns:f="http://java.sun.com/jsf/core" xmlns:a4j="http://richfaces.org/a4j" xmlns:h="http://java.sun.com/jsf/html" xmlns:rich="http://richfaces.org/rich" id="dataOrderedListPropertySubviewID">
 		<h:panelGrid columns="2">
+			<a4j:commandButton reRender="outBindingCheck" 
+			actionListener="#{dataOrderedList.bindingCheck}"
+			value="binding Check" />
+			<h:outputText id="outBindingCheck" value="#{dataOrderedList.bindLabel}" />
+			
 			<h:outputText value="title" />
 			<h:inputText value="#{dataOrderedList.title}" >
-				<a4j:support event="onchange" reRender="doListID"></a4j:support>
+				<a4j:support event="onchange" reRender="dataOrderedListID"></a4j:support>
 			</h:inputText>
 			
 			<h:outputText value="first" />
 			<h:inputText value="#{dataOrderedList.first}" >
-				<a4j:support event="onchange" reRender="doListID"></a4j:support>
+				<a4j:support event="onchange" reRender="dataOrderedListID"></a4j:support>
 			</h:inputText>
 			
 			<h:outputText value="rows" />
 			<h:inputText value="#{dataOrderedList.rows}" >
-				<a4j:support event="onchange" reRender="doListID"></a4j:support>
+				<a4j:support event="onchange" reRender="dataOrderedListID"></a4j:support>
 			</h:inputText>
 			
 			<h:outputText value="dir" />
 			<h:selectOneRadio value="#{dataOrderedList.dir}">
 				<f:selectItem itemValue="LTR" itemLabel="LTR"/>
 				<f:selectItem itemValue="RTL" itemLabel="RTL"/>
-				<a4j:support event="onchange" reRender="doListID"></a4j:support>
+				<a4j:support event="onchange" reRender="dataOrderedListID"></a4j:support>
 			</h:selectOneRadio>
 			
 			<h:outputText value="type" />
@@ -33,7 +38,7 @@
 				<f:selectItem itemValue="disc" itemLabel="disc"/>
 				<f:selectItem itemValue="circle" itemLabel="circle"/>
 				<f:selectItem itemValue="square" itemLabel="square"/>
-				<a4j:support event="onchange" reRender="doListID"></a4j:support>
+				<a4j:support event="onchange" reRender="dataOrderedListID"></a4j:support>
 			</h:selectOneMenu>
 
 			<h:outputText value="rendered" />




More information about the richfaces-svn-commits mailing list