Author: konstantin.mishin
Date: 2008-02-29 08:59:55 -0500 (Fri, 29 Feb 2008)
New Revision: 6452
Added:
trunk/sandbox/samples/sortingFilteringDemo/src/main/java/org/richfaces/sandbox/Bean.java
Modified:
trunk/sandbox/samples/sortingFilteringDemo/src/main/webapp/WEB-INF/faces-config.xml
trunk/sandbox/samples/sortingFilteringDemo/src/main/webapp/WEB-INF/web.xml
trunk/sandbox/samples/sortingFilteringDemo/src/main/webapp/pages/index.jsp
Log:
update demo
Added:
trunk/sandbox/samples/sortingFilteringDemo/src/main/java/org/richfaces/sandbox/Bean.java
===================================================================
---
trunk/sandbox/samples/sortingFilteringDemo/src/main/java/org/richfaces/sandbox/Bean.java
(rev 0)
+++
trunk/sandbox/samples/sortingFilteringDemo/src/main/java/org/richfaces/sandbox/Bean.java 2008-02-29
13:59:55 UTC (rev 6452)
@@ -0,0 +1,61 @@
+/**
+ *
+ */
+package org.richfaces.sandbox;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import org.richfaces.model.Ordering;
+
+/**
+ * @author Konstantin Mishin
+ *
+ */
+public class Bean {
+
+ private String sortMode;
+ private Ordering[] sortOrder;
+ private Collection<String> sortPriority;
+
+ public Bean() {
+ sortOrder = new Ordering[4];
+ clearSortOrder();
+ sortPriority = new ArrayList<String>();
+ }
+
+ private void clearSortOrder() {
+ for (int i = 0; i < sortOrder.length; i++) {
+ sortOrder[i] = Ordering.UNSORTED;
+ }
+ }
+
+ public String getSortMode() {
+ return sortMode;
+ }
+
+ public void setSortMode(String sortMode) {
+ this.sortMode = sortMode;
+ }
+
+ public Collection<String> getSortPriority() {
+ return sortPriority;
+ }
+
+ public void setSortPriority(Collection<String> sortPriority) {
+ this.sortPriority = sortPriority;
+ }
+
+ public void clearSortPriority() {
+ sortPriority.clear();
+ clearSortOrder();
+ }
+
+ public Ordering[] getSortOrder() {
+ return sortOrder;
+ }
+
+ public void setSortOrder(Ordering[] sortOrder) {
+ this.sortOrder = sortOrder;
+ }
+}
Modified:
trunk/sandbox/samples/sortingFilteringDemo/src/main/webapp/WEB-INF/faces-config.xml
===================================================================
---
trunk/sandbox/samples/sortingFilteringDemo/src/main/webapp/WEB-INF/faces-config.xml 2008-02-29
13:51:32 UTC (rev 6451)
+++
trunk/sandbox/samples/sortingFilteringDemo/src/main/webapp/WEB-INF/faces-config.xml 2008-02-29
13:59:55 UTC (rev 6452)
@@ -8,6 +8,11 @@
<managed-bean-scope>application</managed-bean-scope>
</managed-bean>
<managed-bean>
+ <managed-bean-name>bean</managed-bean-name>
+ <managed-bean-class>org.richfaces.sandbox.Bean</managed-bean-class>
+ <managed-bean-scope>session</managed-bean-scope>
+ </managed-bean>
+ <managed-bean>
<managed-bean-name>userComparator</managed-bean-name>
<managed-bean-class>org.richfaces.sandbox.UserComparator</managed-bean-class>
<managed-bean-scope>application</managed-bean-scope>
Modified: trunk/sandbox/samples/sortingFilteringDemo/src/main/webapp/WEB-INF/web.xml
===================================================================
--- trunk/sandbox/samples/sortingFilteringDemo/src/main/webapp/WEB-INF/web.xml 2008-02-29
13:51:32 UTC (rev 6451)
+++ trunk/sandbox/samples/sortingFilteringDemo/src/main/webapp/WEB-INF/web.xml 2008-02-29
13:59:55 UTC (rev 6452)
@@ -11,10 +11,6 @@
<param-value>server</param-value>
</context-param>
<context-param>
- <param-name>org.ajax4jsf.xmlparser.ORDER</param-name>
- <param-value>NEKO</param-value>
- </context-param>
- <context-param>
<param-name>org.richfaces.demo.MAX_ISSUES</param-name>
<param-value>100</param-value>
</context-param>
Modified: trunk/sandbox/samples/sortingFilteringDemo/src/main/webapp/pages/index.jsp
===================================================================
--- trunk/sandbox/samples/sortingFilteringDemo/src/main/webapp/pages/index.jsp 2008-02-29
13:51:32 UTC (rev 6451)
+++ trunk/sandbox/samples/sortingFilteringDemo/src/main/webapp/pages/index.jsp 2008-02-29
13:59:55 UTC (rev 6452)
@@ -9,26 +9,35 @@
<body>
<f:view>
<h:form>
- <dt:dataTable value="#{jiraService.channel.issues}"
var="issue">
- <dt:column filterBy="#{issue.key.value}" filterValue="CH-"
sortBy="#{issue.key}" width="60px">
+ <h:outputText value="SortMode:"></h:outputText>
+ <h:selectOneRadio value="#{bean.sortMode}">
+ <f:selectItem itemLabel="single" itemValue="single"/>
+ <f:selectItem itemLabel="multi" itemValue="multi"/>
+ <a4j:support event="onchange" reRender="dataTable"
action="#{bean.clearSortPriority}"></a4j:support>
+ </h:selectOneRadio>
+ <dt:dataTable id="dataTable"
value="#{jiraService.channel.issues}" var="issue"
sortMode="#{bean.sortMode}" sortPriority="#{bean.sortPriority}">
+ <dt:column filterBy="#{issue.key.value}" filterValue="CH-"
sortBy="#{issue.key}" width="60px"
+ sortOrder="#{bean.sortOrder[0]}">
<f:facet name="header">
<h:outputText value="Key"></h:outputText>
</f:facet>
<h:outputText value="#{issue.key.value}"></h:outputText>
</dt:column>
- <dt:column sortBy="#{issue.summary}" width="400px">
+ <dt:column sortBy="#{issue.summary}" width="400px"
sortOrder="#{bean.sortOrder[1]}">
<f:facet name="header">
<h:outputText value="Summary"></h:outputText>
</f:facet>
<h:outputText value="#{issue.summary}"></h:outputText>
</dt:column>
- <dt:column width="150px" filterBy="#{issue.assignee.name}"
comparator="#{comparators.assigneeComparator}">
+ <dt:column width="150px" filterBy="#{issue.assignee.name}"
comparator="#{comparators.assigneeComparator}"
+ sortOrder="#{bean.sortOrder[2]}">
<f:facet name="header">
<h:outputText value="Assignee"></h:outputText>
</f:facet>
<h:outputText value="#{issue.assignee.name}"></h:outputText>
</dt:column>
- <dt:column filterBy="#{issue.reporter.name}" width="150px"
comparator="#{comparators.reporterComparator}">
+ <dt:column filterBy="#{issue.reporter.name}" width="150px"
comparator="#{comparators.reporterComparator}"
+ sortOrder="#{bean.sortOrder[3]}">
<f:facet name="header">
<h:outputText value="Reporter"></h:outputText>
</f:facet>
Show replies by date