Author: andrei_exadel
Date: 2008-10-09 06:06:22 -0400 (Thu, 09 Oct 2008)
New Revision: 10702
Modified:
trunk/samples/columnsDemo/src/main/java/org/richfaces/samples/Bean.java
trunk/samples/columnsDemo/src/main/webapp/pages/index.jsp
trunk/samples/columnsDemo/src/main/webapp/pages/index.xhtml
Log:
Add filerMethod test
Modified: trunk/samples/columnsDemo/src/main/java/org/richfaces/samples/Bean.java
===================================================================
--- trunk/samples/columnsDemo/src/main/java/org/richfaces/samples/Bean.java 2008-10-09
09:18:31 UTC (rev 10701)
+++ trunk/samples/columnsDemo/src/main/java/org/richfaces/samples/Bean.java 2008-10-09
10:06:22 UTC (rev 10702)
@@ -8,6 +8,7 @@
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.List;
import javax.faces.event.ActionEvent;
@@ -31,12 +32,14 @@
Boolean description;
+ Integer maxValue;
public Bean() {
rowsCount = 5;
name = true;
type = true;
description = true;
+ maxValue = 15;
init();
}
@@ -91,6 +94,22 @@
return list;
}
+ public List<Integer[]> getInrementData() {
+ List<Integer[]> list = new ArrayList<Integer[]>();
+ for (int i = 0; i < 15; i++) {
+ list.add(new Integer[] {i});
+ }
+ return list;
+ }
+
+ public boolean filterMethod(Object o) {
+ Integer [] i = (Integer [])o;
+ if (i[0] > maxValue) {
+ return false;
+ }
+ return true;
+ }
+
public List<Column> getColumns() {
return columns;
}
@@ -131,4 +150,12 @@
this.rowsCount = rowsCount;
}
+ public Integer getMaxValue() {
+ return maxValue;
+ }
+
+ public void setMaxValue(Integer maxValue) {
+ this.maxValue = maxValue;
+ }
+
}
Modified: trunk/samples/columnsDemo/src/main/webapp/pages/index.jsp
===================================================================
--- trunk/samples/columnsDemo/src/main/webapp/pages/index.jsp 2008-10-09 09:18:31 UTC (rev
10701)
+++ trunk/samples/columnsDemo/src/main/webapp/pages/index.jsp 2008-10-09 10:06:22 UTC (rev
10702)
@@ -9,9 +9,10 @@
<html>
+
<body>
<f:view>
- <h3>Test Facelets</h3>
+ <h3>Test Jsp</h3>
<br/><br/>
<h:form id="_form">
<table>
@@ -70,9 +71,32 @@
</dt:dataTable>
<br/>
<a4j:commandLink value="Ajax Submit"
reRender="_data"></a4j:commandLink><br/>
- <h:commandLink value="Form Submit"
action="xhtml"></h:commandLink>
+ <h:commandLink value="Form Submit"
action="jsp"></h:commandLink>
</h:form>
+ <br/>
+ <h:form>
+ <b>Filter Method Test:</b>
+ <table>
+ <tr>
+ <td>Max Value:</td>
+ <td>
+ <h:inputText value="#{bean.maxValue}">
+ <a4j:support event="onchange"
reRender="_data"></a4j:support>
+ </h:inputText>
+ </td>
+ </tr>
+ </table>
+ <dt:dataTable id="_data" value="#{bean.inrementData}"
var="row">
+ <columns:columns value="Integer" index="index"
var="col"
+ filterMethod="#{bean.filterMethod}">
+ <f:facet name="header">
+ <h:outputText value="#{col}"></h:outputText>
+ </f:facet>
+ <h:outputText value="#{row[index]}"></h:outputText>
+ </columns:columns>
+ </dt:dataTable>
+ </h:form>
</f:view>
</body>
Modified: trunk/samples/columnsDemo/src/main/webapp/pages/index.xhtml
===================================================================
--- trunk/samples/columnsDemo/src/main/webapp/pages/index.xhtml 2008-10-09 09:18:31 UTC
(rev 10701)
+++ trunk/samples/columnsDemo/src/main/webapp/pages/index.xhtml 2008-10-09 10:06:22 UTC
(rev 10702)
@@ -7,6 +7,8 @@
xmlns:jstl="http://java.sun.com/jstl/core"
xmlns:dt="http://labs.jboss.com/jbossrichfaces/ui/dataTable"
xmlns:columns="http://labs.jboss.com/jbossrichfaces/ui/columns"...
+
+ <body>
<f:view>
<h3>Test Facelets</h3>
<br/><br/>
@@ -69,6 +71,30 @@
<a4j:commandLink value="Ajax Submit"
reRender="_data"></a4j:commandLink><br/>
<h:commandLink value="Form Submit"
action="xhtml"></h:commandLink>
- </h:form>
+ </h:form>
+ <br/>
+ <h:form>
+ <b>Filter Method Test:</b>
+ <table>
+ <tr>
+ <td>Max Value:</td>
+ <td>
+ <h:inputText value="#{bean.maxValue}">
+ <a4j:support event="onchange"
reRender="_data"></a4j:support>
+ </h:inputText>
+ </td>
+ </tr>
+ </table>
+ <dt:dataTable id="_data" value="#{bean.inrementData}"
var="row">
+ <columns:columns value="Integer" index="index"
var="col"
+ filterMethod="#{bean.filterMethod}">
+ <f:facet name="header">
+ <h:outputText value="#{col}"></h:outputText>
+ </f:facet>
+ <h:outputText value="#{row[index]}"></h:outputText>
+ </columns:columns>
+ </dt:dataTable>
+ </h:form>
</f:view>
+ </body>
</html>
\ No newline at end of file