Author: sergeyhalipov
Date: 2007-11-06 09:46:48 -0500 (Tue, 06 Nov 2007)
New Revision: 3796
Modified:
trunk/sandbox/samples/orderingListDemo/src/main/java/org/richfaces/Bean.java
trunk/sandbox/samples/orderingListDemo/src/main/java/org/richfaces/OptionItem.java
trunk/sandbox/samples/orderingListDemo/src/main/java/org/richfaces/OrderingListDemoBean.java
trunk/sandbox/samples/orderingListDemo/src/main/webapp/pages/index.jsp
Log:
Demo application for ordering list component. (
http://jira.jboss.com/jira/browse/RF-1191
).
Modified: trunk/sandbox/samples/orderingListDemo/src/main/java/org/richfaces/Bean.java
===================================================================
---
trunk/sandbox/samples/orderingListDemo/src/main/java/org/richfaces/Bean.java 2007-11-06
13:56:22 UTC (rev 3795)
+++
trunk/sandbox/samples/orderingListDemo/src/main/java/org/richfaces/Bean.java 2007-11-06
14:46:48 UTC (rev 3796)
@@ -20,10 +20,39 @@
*/
package org.richfaces;
+
+import java.util.ArrayList;
+import java.util.List;
+
/**
* @author $Autor$
*
*/
public class Bean {
+ private List<OrderingListDemoBean> lists = new
ArrayList<OrderingListDemoBean>();
+ private String [] simpleItems = new String [] {
+ "First", "Second", "Third", "Fourth"
+ };
+ public Bean() {
+ for (int i = 0; i < 3; i++) {
+ lists.add(new OrderingListDemoBean());
+ }
+ }
+
+ public List<OrderingListDemoBean> getLists() {
+ return lists;
+ }
+
+ public void setLists(List<OrderingListDemoBean> lists) {
+ this.lists = lists;
+ }
+
+ public String[] getSimpleItems() {
+ return simpleItems;
+ }
+
+ public void setSimpleItems(String[] simpleItems) {
+ this.simpleItems = simpleItems;
+ }
}
\ No newline at end of file
Modified:
trunk/sandbox/samples/orderingListDemo/src/main/java/org/richfaces/OptionItem.java
===================================================================
---
trunk/sandbox/samples/orderingListDemo/src/main/java/org/richfaces/OptionItem.java 2007-11-06
13:56:22 UTC (rev 3795)
+++
trunk/sandbox/samples/orderingListDemo/src/main/java/org/richfaces/OptionItem.java 2007-11-06
14:46:48 UTC (rev 3796)
@@ -15,6 +15,10 @@
public String getName() {
return name;
}
+
+ public void setName(String name) {
+ this.name = name;
+ }
public int getPrice() {
return price;
@@ -32,4 +36,5 @@
public String toString() {
return this.getClass().getSimpleName() + " [" + name + "] by " +
price;
}
+
}
Modified:
trunk/sandbox/samples/orderingListDemo/src/main/java/org/richfaces/OrderingListDemoBean.java
===================================================================
---
trunk/sandbox/samples/orderingListDemo/src/main/java/org/richfaces/OrderingListDemoBean.java 2007-11-06
13:56:22 UTC (rev 3795)
+++
trunk/sandbox/samples/orderingListDemo/src/main/java/org/richfaces/OrderingListDemoBean.java 2007-11-06
14:46:48 UTC (rev 3796)
@@ -9,9 +9,6 @@
public class OrderingListDemoBean {
private List<OptionItem> items = new ArrayList<OptionItem>();
- private String [] items2 = new String [] {
- "First", "Second", "Third", "Fourth"
- };
private String controlsType = "button";
private String controlsHorizontalAlign = "right";
@@ -23,7 +20,7 @@
public OrderingListDemoBean() {
for (int i = 0; i < 10; i++) {
- items.add(new OptionItem("Item " + i, new Random().nextInt(200)));
+ items.add(new OptionItem("Item " + i, new Random().nextInt(2000)));
}
}
@@ -35,14 +32,6 @@
return items;
}
- public String[] getItems2() {
- return items2;
- }
-
- public void setItems2(String[] items2) {
- this.items2 = items2;
- }
-
public String getControlsType() {
return controlsType;
}
Modified: trunk/sandbox/samples/orderingListDemo/src/main/webapp/pages/index.jsp
===================================================================
--- trunk/sandbox/samples/orderingListDemo/src/main/webapp/pages/index.jsp 2007-11-06
13:56:22 UTC (rev 3795)
+++ trunk/sandbox/samples/orderingListDemo/src/main/webapp/pages/index.jsp 2007-11-06
14:46:48 UTC (rev 3796)
@@ -1,3 +1,5 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
<%@ taglib
uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib
uri="http://java.sun.com/jsf/core" prefix="f"%>
<%@ taglib
uri="http://labs.jboss.com/jbossrichfaces/ui/ui/orderingList"
prefix="ol" %>
@@ -17,7 +19,10 @@
<h:form>
<h:selectOneRadio binding="#{skinBean.component}" />
<h:commandLink action="#{skinBean.change}" value="set skin"
/>
-
+ <br />
+ <a4j:status startText="START" startStyle="color: red;"
+ stopText="STOP" stopStyle="color: green;" />
+ <br />
<h:panelGrid columns="2" columnClasses="columnClass">
<h:panelGroup>
<ol:orderingList id="orderingList1"
@@ -106,13 +111,50 @@
</h:panelGrid>
</h:panelGroup>
<h:panelGroup>
- <ol:orderingList value="#{demoBean.items2}" var="item" >
+ <ol:orderingList value="#{bean.simpleItems}" var="item"
>
<h:column>
+ <f:facet name="header">
+ <h:outputText value="Name" />
+ </f:facet>
<h:outputText value="#{item}" />
</h:column>
</ol:orderingList>
</h:panelGroup>
</h:panelGrid>
+ <h3>Ordering lists within a4j:repeat</h3>
+ <a4j:commandButton reRender="repeat" value="Rerender
a4j:repeat" />
+ <h:panelGrid columns="3" >
+ <a4j:repeat value="#{bean.lists}" var="list"
id="repeat">
+ <%--ol:orderingList value="#{list.items}" var="item" >
+ <h:column>
+ <f:facet name="header">
+ <h:outputText value="Name" />
+ </f:facet>
+ <h:inputText value="#{item.name}" />
+ </h:column>
+ <h:column>
+ <f:facet name="header">
+ <h:outputText value="Price" />
+ </f:facet>
+ <h:outputText value="#{item.price}" />
+ </h:column>
+ <h:column>
+ <f:facet name="header">
+ <h:outputText value="Ajax Action" />
+ </f:facet>
+ <a4j:commandButton value="Ajax Action"
reRender="actionResult"
+ action="#{item.action}" />
+ </h:column>
+ <h:column>
+ <f:facet name="header">
+ <h:outputText value="Server Action" />
+ </f:facet>
+ <h:commandLink value="Server Action"
action="#{item.action}" />
+ </h:column>
+ </ol:orderingList--%>
+ </a4j:repeat>
+ </h:panelGrid>
+ <a4j:log popup="false" />
</h:form>
</f:view>
</body>