Author: adubovsky
Date: 2008-05-28 09:33:31 -0400 (Wed, 28 May 2008)
New Revision: 8802
Modified:
trunk/test-applications/facelets/src/main/java/columns/Columns.java
trunk/test-applications/facelets/src/main/webapp/Columns/Columns.xhtml
Log:
sorting & filtering features for rich:columns component was added
Modified: trunk/test-applications/facelets/src/main/java/columns/Columns.java
===================================================================
--- trunk/test-applications/facelets/src/main/java/columns/Columns.java 2008-05-28
11:29:12 UTC (rev 8801)
+++ trunk/test-applications/facelets/src/main/java/columns/Columns.java 2008-05-28
13:33:31 UTC (rev 8802)
@@ -1,10 +1,13 @@
package columns;
import java.util.ArrayList;
+import java.util.Comparator;
+import org.richfaces.model.Ordering;
+
import util.data.Data;
-public class Columns {
+public class Columns implements Comparator{
private String[] statusIcon = { "/pics/error.gif",
"/pics/fatal.gif",
"/pics/info.gif", "/pics/passed.gif", "/pics/warn.gif"
};
private ArrayList<Data> data1;
@@ -19,8 +22,26 @@
private int colspan;
private int rowspan;
private boolean breakBefore;
+ private Ordering[] orderings = new Ordering[100];
private boolean sortable;
private boolean dataTableRendered;
+ private Ordering sortOrder;
+ private String[] filterValue;
+ public String[] getFilterValue() {
+ return filterValue;
+ }
+
+ public void setFilterValue(String[] filterValue) {
+ this.filterValue = filterValue;
+ }
+ public Ordering getSortOrder() {
+ return sortOrder;
+ }
+
+ public void setSortOrder(Ordering sortOrder) {
+ this.sortOrder = sortOrder;
+ }
+
public Columns() {
this.columns = "3";
this.begin = "0";
@@ -36,6 +57,8 @@
this.length2 = 5;
this.data1 = new ArrayList<Data>();
this.data2 = new ArrayList<Data>();
+ this.filterValue = new String[length2];
+ this.sortOrder = Ordering.ASCENDING;
for (int i = 0; i < length1; i++) {
data1.add(new Data(i, "data 1 [" + i + "]", "Button " +
i, "Link " + i, "select" + (i % 5)));
data2.add(new Data(i, "data 2 [" + i + "]", "Button " +
i, "Link " + i, statusIcon[i % 5]));
@@ -175,4 +198,17 @@
public void setDataTableRendered(boolean dataTableRendered) {
this.dataTableRendered = dataTableRendered;
}
+
+ public Ordering[] getOrderings() {
+ return orderings;
+ }
+
+ public void setOrderings(Ordering[] orderings) {
+ this.orderings = orderings;
+ }
+
+ public int compare(Object arg0, Object arg1) {
+ // TODO Auto-generated method stub
+ return 0;
+ }
}
Modified: trunk/test-applications/facelets/src/main/webapp/Columns/Columns.xhtml
===================================================================
--- trunk/test-applications/facelets/src/main/webapp/Columns/Columns.xhtml 2008-05-28
11:29:12 UTC (rev 8801)
+++ trunk/test-applications/facelets/src/main/webapp/Columns/Columns.xhtml 2008-05-28
13:33:31 UTC (rev 8802)
@@ -29,8 +29,10 @@
</rich:column>
<rich:columns value="#{columns.data2}" var="d2"
footerClass="#{style.footerClass}" headerClass="#{style.headerClass}"
breakBefore="#{columns.breakBefore}" colspan="#{columns.colspan}"
- columns="#{columns.columns}" index="index"
rowspan="#{columns.rowspan}" sortable="#{columns.sortable}"
- begin="#{columns.begin}" end="#{columns.end}"
width="#{columns.width}" style="#{style.style}"
styleClass="#{style.styleClass}">
+ columns="#{columns.columns}" index="index"
rowspan="#{columns.rowspan}" begin="#{columns.begin}"
end="#{columns.end}" width="#{columns.width}"
style="#{style.style}" styleClass="#{style.styleClass}"
+ sortOrder="#{columns.orderings[index]}" sortBy="#{d1.str0}"
+ filterBy="#{d1.str0}"
+ filterValue="#{columns.filterValue[index]}">
<f:facet name="header">
<h:outputText value="header #{d2.int0}"></h:outputText>
</f:facet>
Show replies by date