Author: mvitenkov
Date: 2008-06-24 10:34:38 -0400 (Tue, 24 Jun 2008)
New Revision: 9194
Modified:
trunk/test-applications/facelets/src/main/java/dataScroller/DataScroller.java
trunk/test-applications/facelets/src/main/webapp/DataScroller/DataScroller.xhtml
trunk/test-applications/facelets/src/main/webapp/DataScroller/DataScrollerProperty.xhtml
Log:
dataScroller with dataTable supported sorting & filtering features
Modified: trunk/test-applications/facelets/src/main/java/dataScroller/DataScroller.java
===================================================================
---
trunk/test-applications/facelets/src/main/java/dataScroller/DataScroller.java 2008-06-24
14:24:45 UTC (rev 9193)
+++
trunk/test-applications/facelets/src/main/java/dataScroller/DataScroller.java 2008-06-24
14:34:38 UTC (rev 9194)
@@ -5,6 +5,7 @@
import javax.faces.event.ActionEvent;
import org.richfaces.event.DataScrollerEvent;
+import org.richfaces.model.Ordering;
public class DataScroller {
@@ -19,8 +20,56 @@
public int maxPages;
private String action;
private String actionListener;
+ private String sortMode;
+ private boolean selfSorted;
+ private Ordering sortOrder;
+ private String filterValue;
+ private String currentSortOrder;
- public String act() {
+ public String getSortMode() {
+ return sortMode;
+ }
+
+ public void setSortMode(String sortMode) {
+ this.sortMode = sortMode;
+ }
+
+ public boolean isSelfSorted() {
+ return selfSorted;
+ }
+
+ public void setSelfSorted(boolean selfSorted) {
+ this.selfSorted = selfSorted;
+ }
+
+ public Ordering getSortOrder() {
+ return sortOrder;
+ }
+
+ public void setSortOrder(Ordering sortOrder) {
+ this.sortOrder = sortOrder;
+ }
+
+ public String getFilterValue() {
+ return filterValue;
+ }
+
+ public void setFilterValue(String filterValue) {
+ this.filterValue = filterValue;
+ }
+
+ public String getCurrentSortOrder() {
+ return currentSortOrder;
+ }
+
+ public void setCurrentSortOrder(String currentSortOrder) {
+ if("DESCENDING".equals(currentSortOrder)) this.sortOrder =
Ordering.DESCENDING;
+ else if("UNSORTED".equals(currentSortOrder)) this.sortOrder =
Ordering.UNSORTED;
+ else if("ASCENDING".equals(currentSortOrder)) this.sortOrder =
Ordering.ASCENDING;
+ this.currentSortOrder = currentSortOrder;
+ }
+
+ public String act() {
action = "action work!";
return null;
}
@@ -71,8 +120,10 @@
align = "left";
maxPages = 20;
limitToList = false;
-
-
+ filterValue = "";
+ selfSorted = true;
+ sortOrder = Ordering.ASCENDING;
+ sortMode = "single";
dataTable = new ArrayList();
for(int i=0;i<1000;i++)
Modified:
trunk/test-applications/facelets/src/main/webapp/DataScroller/DataScroller.xhtml
===================================================================
---
trunk/test-applications/facelets/src/main/webapp/DataScroller/DataScroller.xhtml 2008-06-24
14:24:45 UTC (rev 9193)
+++
trunk/test-applications/facelets/src/main/webapp/DataScroller/DataScroller.xhtml 2008-06-24
14:34:38 UTC (rev 9194)
@@ -1,9 +1,11 @@
<f:subview
xmlns:ui="http://java.sun.com/jsf/facelets"
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="DataScrollerSubviewID">
- <rich:dataTable id="dataTableId"
value="#{dataScroller.dataTable}"
+ <rich:dataTable id="dataTableId"
value="#{dataScroller.dataTable}" sortMode="#{dataScroller.sortMode}"
var="dT" cellpadding="5px" rows="5"
border="1">
<f:facet name="header">
- <rich:datascroller inactiveStyle="#{style.inactiveStyle}"
inactiveStyleClass="#{style.inactiveStyleClass}"
selectedStyle="#{style.selectedStyle}"
selectedStyleClass="#{style.selectedStyleClass}"
style="#{style.style}" styleClass="#{style.styleClass}"
tableStyle="#{style.tableStyle}"
tableStyleClass="#{style.tableStyleClass}"
+ <rich:datascroller inactiveStyle="#{style.inactiveStyle}"
inactiveStyleClass="#{style.inactiveStyleClass}"
+ selectedStyle="#{style.selectedStyle}"
selectedStyleClass="#{style.selectedStyleClass}"
style="#{style.style}"
+ styleClass="#{style.styleClass}" tableStyle="#{style.tableStyle}"
tableStyleClass="#{style.tableStyleClass}"
fastControls="#{dataScroller.fastControls}"
action="#{dataScroller.act}"
actionListener="#{dataScroller.actListener}"
align="#{dataScroller.align}" rendered="#{dataScroller.render}"
limitToList="#{dataScroller.limitToList}"
@@ -15,14 +17,17 @@
onkeypress="#{event.onkeypress}" onkeyup="#{event.onkeyup}"
onmousedown="#{event.onmousedown}"
onmousemove="#{event.onmousemove}"
onmouseout="#{event.onmouseout}"
- onmouseover="#{event.onmouseover}"
onmouseup="#{event.onmouseup}"/>
+ onmouseover="#{event.onmouseover}"
onmouseup="#{event.onmouseup}">
+ </rich:datascroller>
</f:facet>
- <h:column>
+ <rich:column sortBy="#{dT.data0}" filterBy="#{dT.data0}"
filterEvent="onchange"
+ selfSorted="#{dataScroller.selfSorted}"
sortOrder="#{dataScroller.sortOrder}"
filterValue="#{dataScroller.filterValue}">
<h:outputText value="#{dT.data0}" />
- </h:column>
- <h:column>
- <h:outputText value="#{dT.data1} " /> <h:outputLink
value="http://www.jboss.com/"><f:verbatim>Link</f:v...
- </h:column>
+ </rich:column>
+ <rich:column sortBy="#{dT.data1}" filterBy="#{dT.data1}"
filterEvent="onchange"
+ sortOrder="#{dataScroller.sortOrder}">
+ <h:outputText value="#{dT.data1} " />
+ </rich:column>
</rich:dataTable>
<h:panelGrid id="dataScrollerActionID" columns="1">
<a4j:commandButton value="Show action"
reRender="dataScrollerActionID" style=" width :
95px;"></a4j:commandButton>
Modified:
trunk/test-applications/facelets/src/main/webapp/DataScroller/DataScrollerProperty.xhtml
===================================================================
---
trunk/test-applications/facelets/src/main/webapp/DataScroller/DataScrollerProperty.xhtml 2008-06-24
14:24:45 UTC (rev 9193)
+++
trunk/test-applications/facelets/src/main/webapp/DataScroller/DataScrollerProperty.xhtml 2008-06-24
14:34:38 UTC (rev 9194)
@@ -38,5 +38,25 @@
<f:selectItem itemLabel="center" itemValue="center" />
<a4j:support event="onclick"
reRender="dataTableId"></a4j:support>
</h:selectOneRadio>
+
+ <h:outputText value="sortMode"></h:outputText>
+ <h:selectOneRadio value="#{dataScroller.sortMode}">
+ <f:selectItem itemLabel="single" itemValue="single"/>
+ <f:selectItem itemLabel="multi" itemValue="multi"/>
+ <a4j:support event="onchange"
reRender="dataTableId,dsID"></a4j:support>
+ </h:selectOneRadio>
+
+ <h:outputText value="sortOrder"></h:outputText>
+ <h:selectOneRadio value="#{dataScroller.currentSortOrder}">
+ <f:selectItem itemLabel="ASCENDING"
itemValue="ASCENDING"/>
+ <f:selectItem itemLabel="DESCENDING"
itemValue="DESCENDING"/>
+ <f:selectItem itemLabel="UNSORTED" itemValue="UNSORTED"/>
+ <a4j:support event="onchange"
reRender="dataTableId,dsID"></a4j:support>
+ </h:selectOneRadio>
+
+ <h:outputText value="selfSorted(1st)"></h:outputText>
+ <h:selectBooleanCheckbox value="#{dataScroller.selfSorted}">
+ <a4j:support event="onchange"
reRender="dataTableId,dsID"></a4j:support>
+ </h:selectBooleanCheckbox>
</h:panelGrid>
</f:subview>
\ No newline at end of file