Author: ilya_shaikovsky
Date: 2010-05-31 09:50:23 -0400 (Mon, 31 May 2010)
New Revision: 17410
Added:
root/examples/richfaces-showcase/trunk/src/main/webapp/richfaces/componentControl/
root/examples/richfaces-showcase/trunk/src/main/webapp/richfaces/componentControl/tableFilteringAPI.xhtml
root/examples/richfaces-showcase/trunk/src/main/webapp/richfaces/repeat/
root/examples/richfaces-showcase/trunk/src/main/webapp/richfaces/repeat/simpleGrid.xhtml
Removed:
root/examples/richfaces-showcase/trunk/src/main/webapp/richfaces/dataTable/tableFilteringAPI.xhtml
Modified:
root/examples/richfaces-showcase/trunk/src/main/java/org/richfaces/demo/tables/CarsBean.java
root/examples/richfaces-showcase/trunk/src/main/resources/org/richfaces/demo/data/common/navigation.xml
root/examples/richfaces-showcase/trunk/src/main/webapp/richfaces/dataTable/tableFiltering.xhtml
Log:
table filtering/sorting + componentControl
Modified:
root/examples/richfaces-showcase/trunk/src/main/java/org/richfaces/demo/tables/CarsBean.java
===================================================================
---
root/examples/richfaces-showcase/trunk/src/main/java/org/richfaces/demo/tables/CarsBean.java 2010-05-31
13:43:16 UTC (rev 17409)
+++
root/examples/richfaces-showcase/trunk/src/main/java/org/richfaces/demo/tables/CarsBean.java 2010-05-31
13:50:23 UTC (rev 17410)
@@ -13,7 +13,6 @@
import java.util.List;
import javax.faces.bean.ManagedBean;
-import javax.faces.bean.ManagedProperty;
import javax.faces.bean.SessionScoped;
import javax.faces.model.SelectItem;
@@ -33,8 +32,6 @@
private static final int ROUNDING_MODE = BigDecimal.ROUND_HALF_UP;
private List<InventoryItem> allInventoryItems = null;
private List<InventoryVendorList> inventoryVendorLists = null;
- @ManagedProperty("#{carsFilteringBean}")
- private CarsFilteringBean filteringBean;
public List<SelectItem> getVendorOptions() {
List<SelectItem> result = new ArrayList<SelectItem>();
@@ -61,10 +58,7 @@
Collections.sort(inventoryItems, new Comparator<InventoryItem>() {
public int compare(InventoryItem o1, InventoryItem o2) {
- if (o1.getVendor().equals(o2.getVendor())) {
- return 0;
- }
- return 1;
+ return o1.getVendor().compareTo(o2.getVendor());
}
});
Iterator<InventoryItem> iterator = inventoryItems.iterator();
@@ -199,8 +193,4 @@
return iiList;
}
-
- public void setFilteringBean(CarsFilteringBean filteringBean) {
- this.filteringBean = filteringBean;
- }
}
Modified:
root/examples/richfaces-showcase/trunk/src/main/resources/org/richfaces/demo/data/common/navigation.xml
===================================================================
---
root/examples/richfaces-showcase/trunk/src/main/resources/org/richfaces/demo/data/common/navigation.xml 2010-05-31
13:43:16 UTC (rev 17409)
+++
root/examples/richfaces-showcase/trunk/src/main/resources/org/richfaces/demo/data/common/navigation.xml 2010-05-31
13:50:23 UTC (rev 17410)
@@ -192,6 +192,16 @@
<name>Data Iteration</name>
<demos>
<demo>
+ <id>repeat</id>
+ <name>a4j:repeat</name>
+ <samples>
+ <sample>
+ <id>simpleGrid</id>
+ <name>Simple Grid Creation</name>
+ </sample>
+ </samples>
+ </demo>
+ <demo>
<id>dataTable</id>
<name>rich:dataTable</name>
<samples>
@@ -222,10 +232,6 @@
<id>tableFiltering</id>
<name>Data Table Filtering</name>
</sample>
- <sample>
- <id>tableFilteringAPI</id>
- <name>Data Table Filtering API usage</name>
- </sample>
</samples>
</demo>
<demo>
@@ -287,6 +293,16 @@
</sample>
</samples>
</demo>
+ <demo>
+ <id>componentControl</id>
+ <name>rich:componentControl</name>
+ <samples>
+ <sample>
+ <id>tableFilteringAPI</id>
+ <name>Table Filtering using componentControl and API</name>
+ </sample>
+ </samples>
+ </demo>
</demos>
</group>
</root>
Copied:
root/examples/richfaces-showcase/trunk/src/main/webapp/richfaces/componentControl/tableFilteringAPI.xhtml
(from rev 17400,
root/examples/richfaces-showcase/trunk/src/main/webapp/richfaces/dataTable/tableFilteringAPI.xhtml)
===================================================================
---
root/examples/richfaces-showcase/trunk/src/main/webapp/richfaces/componentControl/tableFilteringAPI.xhtml
(rev 0)
+++
root/examples/richfaces-showcase/trunk/src/main/webapp/richfaces/componentControl/tableFilteringAPI.xhtml 2010-05-31
13:50:23 UTC (rev 17410)
@@ -0,0 +1,85 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html
xmlns="http://www.w3.org/1999/xhtml"
+
xmlns:h="http://java.sun.com/jsf/html"
+
xmlns:f="http://java.sun.com/jsf/core"
+
xmlns:ui="http://java.sun.com/jsf/facelets"
+
xmlns:a4j="http://richfaces.org/a4j"
+
xmlns:it="http://richfaces.org/iteration"
+
xmlns:fn="http://java.sun.com/jsp/jstl/functions"
+
xmlns:rich="http://java.sun.com/jsf/composite/rich"
+
xmlns:rfn="http://richfaces.org/misc">
+
+<ui:composition>
+ <h:form id="form">
+ <h:panelGrid columns="2">
+ <rich:panel>
+ <f:facet name="header">
+ <h:outputText value="Quick Filter Panel" />
+ </f:facet>
+ <fieldset><legend>Filter By Vendor</legend>
+ <ul>
+ <a4j:repeat value="#{carsBean.allVendors}" var="vendor">
+ <li><h:outputLink value="#">#{vendor}
+ <rfn:componentControl target="table" operation="filter"
event="click">
+ <f:param value="vendor"/>
+ <f:param value="#{vendor}"/>
+ </rfn:componentControl>
+ </h:outputLink>
+ </li>
+ </a4j:repeat>
+ </ul>
+ </fieldset>
+ </rich:panel>
+ <it:dataTable value="#{carsBean.allInventoryItems}" var="car"
+ id="table" rows="20">
+ <it:column id="vendor"
filterValue="#{carsFilteringBean.vendorFilter}"
+ filterExpression="#{carsFilteringBean.vendorFilter == '' or
carsFilteringBean.vendorFilter == null or carsFilteringBean.vendorFilter ==
car.vendor}">
+ <f:facet name="header">
+ <h:panelGroup>
+ <h:outputText value="Vendor" />
+ </h:panelGroup>
+ </f:facet>
+ <h:outputText value="#{car.vendor}" />
+ </it:column>
+ <it:column>
+ <f:facet name="header">
+ <h:outputText value="Model" />
+ </f:facet>
+ <h:outputText value="#{car.model}" />
+ </it:column>
+ <it:column>
+ <f:facet name="header">
+ <h:outputText value="Price" />
+ </f:facet>
+ <h:outputText value="#{car.price}" />
+ </it:column>
+ <it:column>
+ <f:facet name="header">
+ <h:panelGroup>
+ <h:outputText value="Mileage" />
+ </h:panelGroup>
+ </f:facet>
+ <h:outputText value="#{car.mileage}" />
+ </it:column>
+ <it:column>
+ <f:facet name="header">
+ <h:panelGroup>
+ <h:outputText value="Days Live" />
+ </h:panelGroup>
+ </f:facet>
+ <h:outputText value="#{car.daysLive}" />
+ </it:column>
+ <it:column>
+ <f:facet name="header">
+ <h:panelGroup>
+ <h:outputText value="VIN " />
+ </h:panelGroup>
+ </f:facet>
+ <h:outputText value="#{car.vin}" />
+ </it:column>
+ </it:dataTable>
+ </h:panelGrid>
+
+ </h:form>
+</ui:composition>
+</html>
\ No newline at end of file
Modified:
root/examples/richfaces-showcase/trunk/src/main/webapp/richfaces/dataTable/tableFiltering.xhtml
===================================================================
---
root/examples/richfaces-showcase/trunk/src/main/webapp/richfaces/dataTable/tableFiltering.xhtml 2010-05-31
13:43:16 UTC (rev 17409)
+++
root/examples/richfaces-showcase/trunk/src/main/webapp/richfaces/dataTable/tableFiltering.xhtml 2010-05-31
13:50:23 UTC (rev 17410)
@@ -5,19 +5,24 @@
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:a4j="http://richfaces.org/a4j"
xmlns:it="http://richfaces.org/iteration"
-
xmlns:fn="http://java.sun.com/jsp/jstl/functions">
+
xmlns:fn="http://java.sun.com/jsp/jstl/functions"
+
xmlns:rich="http://java.sun.com/jsf/composite/rich">
<ui:composition>
<h:form id="form">
- <it:dataTable value="#{carsBean.allInventoryItems}" var="car"
- id="table" rows="20">
- <it:column accept="#{carsFiteringBean.acceptVendor}">
- <f:facet name="header">
+ <rich:messages/>
+ <it:dataTable value="#{carsBean.allInventoryItems}" var="car"
+ id="table" rows="30">
+ <f:facet name="noData">
+ Nothing found
+ </f:facet>
+ <it:column filterValue="#{carsFilteringBean.vendorFilter}"
filterExpression="#{fn:containsIgnoreCase(car.vendor,
carsFilteringBean.vendorFilter)}">
+ <f:facet name="header">
<h:panelGroup>
<h:outputText value="Vendor " />
<h:selectOneMenu value="#{carsFilteringBean.vendorFilter}">
<f:selectItems value="#{carsBean.vendorOptions}" />
- <a4j:ajax render="form:table" execute="@this"
event="change"/>
+ <a4j:ajax render="table" execute="@this"
event="change"/>
</h:selectOneMenu>
</h:panelGroup>
</f:facet>
@@ -48,13 +53,13 @@
</f:facet>
<h:outputText value="#{car.mileage}" />
</it:column>
- <it:column
- filterExpression="#{fn:containsIgnoreCase(car.vin,carFilteringBean.vinFilter)}">
+ <it:column filterValue="#{carsFilteringBean.vinFilter}"
+ filterExpression="#{fn:containsIgnoreCase(car.vin,carsFilteringBean.vinFilter)}">
<f:facet name="header">
<h:panelGroup>
<h:outputText value="VIN " />
- <h:inputText value="#{carFilteringBean.vinFilter}">
- <a4j:ajax event="blur" render="form:table"
execute="@this" />
+ <h:inputText value="#{carsFilteringBean.vinFilter}">
+ <a4j:ajax event="blur" render="table"
execute="@this" />
</h:inputText>
</h:panelGroup>
</f:facet>
Deleted:
root/examples/richfaces-showcase/trunk/src/main/webapp/richfaces/dataTable/tableFilteringAPI.xhtml
===================================================================
---
root/examples/richfaces-showcase/trunk/src/main/webapp/richfaces/dataTable/tableFilteringAPI.xhtml 2010-05-31
13:43:16 UTC (rev 17409)
+++
root/examples/richfaces-showcase/trunk/src/main/webapp/richfaces/dataTable/tableFilteringAPI.xhtml 2010-05-31
13:50:23 UTC (rev 17410)
@@ -1,80 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html
xmlns="http://www.w3.org/1999/xhtml"
-
xmlns:h="http://java.sun.com/jsf/html"
-
xmlns:f="http://java.sun.com/jsf/core"
-
xmlns:ui="http://java.sun.com/jsf/facelets"
-
xmlns:a4j="http://richfaces.org/a4j"
-
xmlns:it="http://richfaces.org/iteration"
-
xmlns:fn="http://java.sun.com/jsp/jstl/functions"
-
xmlns:rich="http://java.sun.com/jsf/composite/rich">
-
-<ui:composition>
- <h:form id="form">
- <h:panelGrid columns="2">
- <rich:panel>
- <f:facet name="header">
- <h:outputText value="Quick Filter Panel" />
- </f:facet>
- <fieldset><legend>Filter By Vendor</legend>
- <ul>
- <a4j:repeat value="#{carsBean.allVendors}" var="vendor">
- <li><h:outputLink
- value="javascript:document.getElementById('form:table').richfaces.component.filter('vendor',
'#{vendor}')">#{vendor}</h:outputLink>
- </li>
- </a4j:repeat>
- </ul>
- </fieldset>
- </rich:panel>
- <it:dataTable value="#{carsBean.allInventoryItems}" var="car"
- id="table" rows="20">
- <it:column id="vendor"
- filterExpression="#{carsFilteringBean.vendorFilter == '' or
carsFilteringBean.vendorFilter == null or carsFilteringBean.vendorFilter ==
car.vendor}">
- <f:facet name="header">
- <h:panelGroup>
- <h:outputText value="Vendor" />
- </h:panelGroup>
- </f:facet>
- <h:outputText value="#{car.vendor}" />
- </it:column>
- <it:column>
- <f:facet name="header">
- <h:outputText value="Model" />
- </f:facet>
- <h:outputText value="#{car.model}" />
- </it:column>
- <it:column>
- <f:facet name="header">
- <h:outputText value="Price" />
- </f:facet>
- <h:outputText value="#{car.price}" />
- </it:column>
- <it:column>
- <f:facet name="header">
- <h:panelGroup>
- <h:outputText value="Mileage" />
- </h:panelGroup>
- </f:facet>
- <h:outputText value="#{car.mileage}" />
- </it:column>
- <it:column>
- <f:facet name="header">
- <h:panelGroup>
- <h:outputText value="Days Live" />
- </h:panelGroup>
- </f:facet>
- <h:outputText value="#{car.daysLive}" />
- </it:column>
- <it:column>
- <f:facet name="header">
- <h:panelGroup>
- <h:outputText value="VIN " />
- </h:panelGroup>
- </f:facet>
- <h:outputText value="#{car.vin}" />
- </it:column>
- </it:dataTable>
- </h:panelGrid>
-
- </h:form>
-</ui:composition>
-</html>
\ No newline at end of file
Added:
root/examples/richfaces-showcase/trunk/src/main/webapp/richfaces/repeat/simpleGrid.xhtml
===================================================================
---
root/examples/richfaces-showcase/trunk/src/main/webapp/richfaces/repeat/simpleGrid.xhtml
(rev 0)
+++
root/examples/richfaces-showcase/trunk/src/main/webapp/richfaces/repeat/simpleGrid.xhtml 2010-05-31
13:50:23 UTC (rev 17410)
@@ -0,0 +1,35 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html
xmlns="http://www.w3.org/1999/xhtml"
+
xmlns:h="http://java.sun.com/jsf/html"
+
xmlns:f="http://java.sun.com/jsf/core"
+
xmlns:ui="http://java.sun.com/jsf/facelets"
+
xmlns:a4j="http://richfaces.org/a4j"
+
xmlns:rich="http://java.sun.com/jsf/composite/rich"
+
xmlns:it="http://richfaces.org/iteration">
+
+<ui:composition>
+<p>a4j:repeat is a base iteration component of RichFaces. It allows to create any
markups based
+on iterative data. This sample shows simple grid from capitals list.</p>
+ <h:form>
+ <a4j:outputPanel id="panel">
+ <a4j:repeat value="#{capitalsBean.capitals}" var="cap"
rows="20" id="repeat">
+ <rich:panel style="float:left; width:200px; padding:5px;">
+ <f:facet name="header">
+ <h:panelGroup>
+ <h:graphicImage value="#{cap.stateFlag}" />
+ <h:outputText value="#{cap.state}" style="font-weight:bold"
/>
+ </h:panelGroup>
+ </f:facet>
+ <h:panelGrid columns="2">
+ <h:outputText value="State Capital" style="font-weight:bold"
/>
+ <h:outputText value="#{cap.name}" />
+ <h:outputText value="State TimeZone"
style="font-weight:bold" />
+ <h:outputText value="#{cap.timeZone}" />
+ </h:panelGrid>
+ </rich:panel>
+ </a4j:repeat>
+ </a4j:outputPanel>
+ <it:dataScroller for="repeat" render="panel" />
+ </h:form>
+</ui:composition>
+</html>
\ No newline at end of file