Author: ilya_shaikovsky
Date: 2010-05-31 08:43:31 -0400 (Mon, 31 May 2010)
New Revision: 17404
Added:
root/examples/richfaces-showcase/trunk/src/main/java/org/richfaces/demo/tables/CapitalsSortingBean.java
root/examples/richfaces-showcase/trunk/src/main/webapp/richfaces/subTableToggleControl/
root/examples/richfaces-showcase/trunk/src/main/webapp/richfaces/subTableToggleControl/subTableToggleControl.xhtml
Removed:
root/examples/richfaces-showcase/trunk/src/main/webapp/richfaces/subTableToggleControl/tableToggleControl.xhtml
root/examples/richfaces-showcase/trunk/src/main/webapp/richfaces/tableToggleControl/
Modified:
root/examples/richfaces-showcase/trunk/src/main/java/org/richfaces/demo/common/navigation/DemoNavigator.java
root/examples/richfaces-showcase/trunk/src/main/java/org/richfaces/demo/tables/CapitalsBean.java
root/examples/richfaces-showcase/trunk/src/main/java/org/richfaces/demo/tables/model/cars/InventoryItem.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/dataScroller/dataScrollerAPI.xhtml
root/examples/richfaces-showcase/trunk/src/main/webapp/richfaces/dataScroller/simpleScrolling.xhtml
root/examples/richfaces-showcase/trunk/src/main/webapp/richfaces/dataTable/tableSorting.xhtml
root/examples/richfaces-showcase/trunk/src/main/webapp/richfaces/dataTable/tableStyling.xhtml
root/examples/richfaces-showcase/trunk/src/main/webapp/richfaces/extendedDataTable/simpleTable.xhtml
root/examples/richfaces-showcase/trunk/src/main/webapp/richfaces/functions/functions.xhtml
Log:
tables Sorting
+ some refactoring
+ some minor styling
Modified:
root/examples/richfaces-showcase/trunk/src/main/java/org/richfaces/demo/common/navigation/DemoNavigator.java
===================================================================
---
root/examples/richfaces-showcase/trunk/src/main/java/org/richfaces/demo/common/navigation/DemoNavigator.java 2010-05-31
12:11:11 UTC (rev 17403)
+++
root/examples/richfaces-showcase/trunk/src/main/java/org/richfaces/demo/common/navigation/DemoNavigator.java 2010-05-31
12:43:31 UTC (rev 17404)
@@ -4,6 +4,7 @@
import java.util.Iterator;
import java.util.List;
+import javax.annotation.PostConstruct;
import javax.faces.application.ConfigurableNavigationHandler;
import javax.faces.application.NavigationCase;
import javax.faces.application.NavigationHandler;
@@ -14,7 +15,7 @@
@ManagedBean
@SessionScoped
-public class DemoNavigator implements Serializable{
+public class DemoNavigator implements Serializable {
/**
*
*/
@@ -22,29 +23,35 @@
private static final String DEMO_VIEW_PARAMETER = "demo";
private static final String SAMPLE_VIEW_PARAMETER = "sample";
private static final String SEPARATOR = "/";
-
+
@ManagedProperty(value = "#{navigationParser.groupsList}")
private List<GroupDescriptor> groups;
- private DemoDescriptor currentDemo = null;
- private SampleDescriptor currentSample = null;
+ private DemoDescriptor currentDemo;
+ private SampleDescriptor currentSample;
private String sample;
private String demo;
-
+
+ @PostConstruct
+ public void init() {
+ currentDemo =null;
+ currentSample = null;
+ }
+
public DemoDescriptor getCurrentDemo() {
String id = getViewParameter(DEMO_VIEW_PARAMETER);
if (currentDemo == null || !currentDemo.getId().equals(id)) {
if (id != null) {
currentDemo = findDemoById(id);
- currentSample=null;
+ currentSample = null;
}
if (currentDemo == null) {
currentDemo = groups.get(0).getDemos().get(0);
- currentSample=null;
+ currentSample = null;
}
}
return currentDemo;
}
-
+
public SampleDescriptor getCurrentSample() {
String id = getViewParameter(SAMPLE_VIEW_PARAMETER);
if (currentSample == null || !currentSample.getId().equals(id)) {
@@ -53,11 +60,11 @@
}
if (currentSample == null) {
currentSample = getCurrentDemo().getSamples().get(0);
- }
+ }
}
return currentSample;
}
-
+
private String getViewParameter(String name) {
FacesContext fc = FacesContext.getCurrentInstance();
String param = (String)
fc.getExternalContext().getRequestParameterMap().get(name);
@@ -92,9 +99,8 @@
if (handler instanceof ConfigurableNavigationHandler) {
ConfigurableNavigationHandler navigationHandler =
(ConfigurableNavigationHandler) handler;
- NavigationCase navCase = navigationHandler.getNavigationCase(context, null,
getCurrentDemo().getId()
- + SEPARATOR
- + getCurrentSample().getId());
+ NavigationCase navCase = navigationHandler.getNavigationCase(context, null,
getCurrentDemo().getId()
+ + SEPARATOR + getCurrentSample().getId());
return navCase.getToViewId(context);
}
Modified:
root/examples/richfaces-showcase/trunk/src/main/java/org/richfaces/demo/tables/CapitalsBean.java
===================================================================
---
root/examples/richfaces-showcase/trunk/src/main/java/org/richfaces/demo/tables/CapitalsBean.java 2010-05-31
12:11:11 UTC (rev 17403)
+++
root/examples/richfaces-showcase/trunk/src/main/java/org/richfaces/demo/tables/CapitalsBean.java 2010-05-31
12:43:31 UTC (rev 17404)
@@ -1,5 +1,6 @@
package org.richfaces.demo.tables;
+import java.io.Serializable;
import java.util.List;
import javax.faces.bean.ManagedBean;
@@ -10,11 +11,14 @@
@ManagedBean
@SessionScoped
-public class CapitalsBean {
-
+public class CapitalsBean implements Serializable{
+ /**
+ *
+ */
+ private static final long serialVersionUID = -1509108399715814302L;
@ManagedProperty(value = "#{capitalsParser.capitalsList}")
private List<Capital> capitals;
-
+
public CapitalsBean() {
// TODO Auto-generated constructor stub
}
@@ -26,6 +30,5 @@
public void setCapitals(List<Capital> capitals) {
this.capitals = capitals;
}
-
-
+
}
Added:
root/examples/richfaces-showcase/trunk/src/main/java/org/richfaces/demo/tables/CapitalsSortingBean.java
===================================================================
---
root/examples/richfaces-showcase/trunk/src/main/java/org/richfaces/demo/tables/CapitalsSortingBean.java
(rev 0)
+++
root/examples/richfaces-showcase/trunk/src/main/java/org/richfaces/demo/tables/CapitalsSortingBean.java 2010-05-31
12:43:31 UTC (rev 17404)
@@ -0,0 +1,97 @@
+package org.richfaces.demo.tables;
+
+import java.io.Serializable;
+import java.util.Comparator;
+
+import javax.faces.bean.ManagedBean;
+import javax.faces.bean.ViewScoped;
+import javax.swing.SortOrder;
+
+import org.richfaces.demo.tables.model.capitals.Capital;
+
+@ManagedBean
+@ViewScoped
+public class CapitalsSortingBean implements Serializable {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = -6237417487105926855L;
+ private static final String TIMEZONE_GMT_SEPARATOR = "-";
+ private SortOrder capitalsOrder = SortOrder.UNSORTED;
+ private SortOrder statesOrder = SortOrder.UNSORTED;
+ private SortOrder timeZonesOrder = SortOrder.UNSORTED;
+
+ public void sortByCapitals() {
+ statesOrder = SortOrder.UNSORTED;
+ timeZonesOrder = SortOrder.UNSORTED;
+ if (capitalsOrder.equals(SortOrder.ASCENDING)) {
+ setCapitalsOrder(SortOrder.DESCENDING);
+ } else {
+ setCapitalsOrder(SortOrder.ASCENDING);
+ }
+ }
+
+ public void sortByStates() {
+ capitalsOrder = SortOrder.UNSORTED;
+ timeZonesOrder = SortOrder.UNSORTED;
+ if (statesOrder.equals(SortOrder.ASCENDING)) {
+ setStatesOrder(SortOrder.DESCENDING);
+ } else {
+ setStatesOrder(SortOrder.ASCENDING);
+ }
+ }
+
+ public void sortByTimeZones() {
+ statesOrder = SortOrder.UNSORTED;
+ capitalsOrder = SortOrder.UNSORTED;
+ if (timeZonesOrder.equals(SortOrder.ASCENDING)) {
+ setTimeZonesOrder(SortOrder.DESCENDING);
+ } else {
+ setTimeZonesOrder(SortOrder.ASCENDING);
+ }
+ }
+
+ public Comparator<Capital> getTimeZoneComparator() {
+ return new Comparator<Capital>() {
+
+ public int compare(Capital o1, Capital o2) {
+ int tz1Int =
Integer.valueOf(o1.getTimeZone().split(TIMEZONE_GMT_SEPARATOR)[1]);
+ int tz2Int =
Integer.valueOf(o2.getTimeZone().split(TIMEZONE_GMT_SEPARATOR)[1]);
+ if (tz1Int == tz2Int) {
+ return 0;
+ }
+ if (tz1Int > tz2Int) {
+ return -1;
+ } else {
+ return 1;
+ }
+ }
+ };
+ }
+
+ public SortOrder getCapitalsOrder() {
+ return capitalsOrder;
+ }
+
+ public void setCapitalsOrder(SortOrder capitalsOrder) {
+ this.capitalsOrder = capitalsOrder;
+ }
+
+ public SortOrder getStatesOrder() {
+ return statesOrder;
+ }
+
+ public void setStatesOrder(SortOrder statesOrder) {
+ this.statesOrder = statesOrder;
+ }
+
+ public SortOrder getTimeZonesOrder() {
+ return timeZonesOrder;
+ }
+
+ public void setTimeZonesOrder(SortOrder timeZonesOrder) {
+ this.timeZonesOrder = timeZonesOrder;
+ }
+
+}
Modified:
root/examples/richfaces-showcase/trunk/src/main/java/org/richfaces/demo/tables/model/cars/InventoryItem.java
===================================================================
---
root/examples/richfaces-showcase/trunk/src/main/java/org/richfaces/demo/tables/model/cars/InventoryItem.java 2010-05-31
12:11:11 UTC (rev 17403)
+++
root/examples/richfaces-showcase/trunk/src/main/java/org/richfaces/demo/tables/model/cars/InventoryItem.java 2010-05-31
12:43:31 UTC (rev 17404)
@@ -1,6 +1,12 @@
package org.richfaces.demo.tables.model.cars;
-public class InventoryItem extends InventoryVendorItem {
+import java.io.Serializable;
+
+public class InventoryItem extends InventoryVendorItem implements Serializable{
+ /**
+ *
+ */
+ private static final long serialVersionUID = 2052446469750935597L;
private String vendor;
public String getVendor() {
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
12:11:11 UTC (rev 17403)
+++
root/examples/richfaces-showcase/trunk/src/main/resources/org/richfaces/demo/data/common/navigation.xml 2010-05-31
12:43:31 UTC (rev 17404)
@@ -239,12 +239,12 @@
</samples>
</demo>
<demo>
- <id>tableToggleControl</id>
- <name>rich:tableToggleControl</name>
+ <id>subTableToggleControl</id>
+ <name>rich:subTableToggleControl</name>
<samples>
<sample>
- <id>tableToggleControl</id>
- <name>Table Basic Usage</name>
+ <id>subTableToggleControl</id>
+ <name>rich:subTableToggleControl Basic Usage</name>
</sample>
</samples>
</demo>
Modified:
root/examples/richfaces-showcase/trunk/src/main/webapp/richfaces/dataScroller/dataScrollerAPI.xhtml
===================================================================
---
root/examples/richfaces-showcase/trunk/src/main/webapp/richfaces/dataScroller/dataScrollerAPI.xhtml 2010-05-31
12:11:11 UTC (rev 17403)
+++
root/examples/richfaces-showcase/trunk/src/main/webapp/richfaces/dataScroller/dataScrollerAPI.xhtml 2010-05-31
12:43:31 UTC (rev 17404)
@@ -4,7 +4,8 @@
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:it="http://richfaces.org/iteration"
+
xmlns:fn="http://richfaces.org/misc">
<ui:composition>
<style>
@@ -25,13 +26,13 @@
<h:panelGrid columns="1" rowClasses="calign">
<h:panelGrid columns="3" id="repeat">
<h:graphicImage value="/images/icons/scroller/arr_left.png"
- onclick="document.getElementById('form:ds').richfaces.component.previous()"
/>
+ onclick="#{fn:component('ds')}.previous()" />
<a4j:repeat rows="3" value="#{slidesBean.pictures}"
var="pic"
id="pics">
<h:graphicImage value="#{pic.uri}" style="padding:5px;"/>
</a4j:repeat>
<h:graphicImage value="/images/icons/scroller/arr_right.png"
- onclick="document.getElementById('form:ds').richfaces.component.next()"
/>
+ onclick="#{fn:component('ds')}.next()" />
</h:panelGrid>
<it:dataScroller for="pics" id="ds" render="repeat"
stepControls="false" boundaryControls="false"
fastControls="false" maxPages="10"/>
</h:panelGrid>
Modified:
root/examples/richfaces-showcase/trunk/src/main/webapp/richfaces/dataScroller/simpleScrolling.xhtml
===================================================================
---
root/examples/richfaces-showcase/trunk/src/main/webapp/richfaces/dataScroller/simpleScrolling.xhtml 2010-05-31
12:11:11 UTC (rev 17403)
+++
root/examples/richfaces-showcase/trunk/src/main/webapp/richfaces/dataScroller/simpleScrolling.xhtml 2010-05-31
12:43:31 UTC (rev 17404)
@@ -8,8 +8,11 @@
<ui:composition>
+<p>dataScroller component provided in order to implement Ajax pagination for data
iteration components.</p>
+<p>Starting from 4.x version - no more additional updated should be defined by
end-developer in order to
+synchronize different dataScrollers attached to the same table as in example
below.</p>
<h:form id="form">
- <it:dataScroller for="table"/>
+ <it:dataScroller for="table" maxPages="6"/>
<it:dataTable value="#{carsBean.allInventoryItems}" var="car"
id="table" rows="10">
<it:column accept="#{carsFiteringBean.acceptVendor}">
@@ -43,7 +46,7 @@
<h:outputText value="#{car.vin}" />
</it:column>
</it:dataTable>
- <it:dataScroller for="table"/>
+ <it:dataScroller for="table" maxPages="6"/>
</h:form>
</ui:composition>
Modified:
root/examples/richfaces-showcase/trunk/src/main/webapp/richfaces/dataTable/tableSorting.xhtml
===================================================================
---
root/examples/richfaces-showcase/trunk/src/main/webapp/richfaces/dataTable/tableSorting.xhtml 2010-05-31
12:11:11 UTC (rev 17403)
+++
root/examples/richfaces-showcase/trunk/src/main/webapp/richfaces/dataTable/tableSorting.xhtml 2010-05-31
12:43:31 UTC (rev 17404)
@@ -1,41 +1,47 @@
<!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: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://richfaces.org/misc">
- <ui:composition>
- <h:form>
- <it:dataTable value="#{carsBean.allCars}" var="car"
id="table">
- <it:column>
- <f:facet name="header">
- <h:outputText value="Make" />
- </f:facet>
- <h:outputText value="#{car.make}"/>
- </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:outputText value="Actions" />
- </f:facet>
- <a4j:commandLink value="Edit" action="#{carsBean.edit}"
render="table"/>
- <h:outputText value=" " />
- <a4j:commandLink value="Remove" action="#{carsBean.remove}"
render="table"/>
- </it:column>
- </it:dataTable>
- </h:form>
- </ui:composition>
+<ui:composition>
+<p>
+Here is simple example of sorting feature of RichFaces Table component.
+</p>
+ <h:form>
+ <it:dataTable value="#{capitalsBean.capitals}" var="cap"
id="table">
+ <it:column>
+ <f:facet name="header">
+ State Flag
+ </f:facet>
+ <h:graphicImage value="#{cap.stateFlag}" />
+ </it:column>
+ <it:column sortBy="#{cap.name}" id="name"
+ sortOrder="#{capitalsSortingBean.capitalsOrder}">
+ <f:facet name="header">
+ <a4j:commandLink value="Sort by Capital Name" render="table"
action="#{capitalsSortingBean.sortByCapitals}"/>
+ </f:facet>
+ <h:outputText value="#{cap.name}" />
+ </it:column>
+ <it:column sortBy="#{cap.state}" id="state"
+ sortOrder="#{capitalsSortingBean.statesOrder}">
+ <f:facet name="header">
+ <a4j:commandLink value="Sort by State Name" render="table"
action="#{capitalsSortingBean.sortByStates}"/>
+ </f:facet>
+ <h:outputText value="#{cap.state}" />
+ </it:column>
+ <it:column sortBy="#{cap.timeZone}" id="timeZone"
+ comparator="#{capitalsSortingBean.timeZoneComparator}"
+ sortOrder="#{capitalsSortingBean.timeZonesOrder}">
+ <f:facet name="header">
+ <a4j:commandLink value="Sort by Time Zone" render="table"
action="#{capitalsSortingBean.sortByTimeZones}"/>
+ </f:facet>
+ <h:outputText value="#{cap.timeZone}" />
+ </it:column>
+ </it:dataTable>
+ </h:form>
+</ui:composition>
</html>
\ No newline at end of file
Modified:
root/examples/richfaces-showcase/trunk/src/main/webapp/richfaces/dataTable/tableStyling.xhtml
===================================================================
---
root/examples/richfaces-showcase/trunk/src/main/webapp/richfaces/dataTable/tableStyling.xhtml 2010-05-31
12:11:11 UTC (rev 17403)
+++
root/examples/richfaces-showcase/trunk/src/main/webapp/richfaces/dataTable/tableStyling.xhtml 2010-05-31
12:43:31 UTC (rev 17404)
@@ -52,15 +52,9 @@
</f:facet>
<h:outputText value="#{car.mileage}" />
</it:column>
- <it:column
- filterExpression="#{fn:containsIgnoreCase(car.vin,carFilteringBean.vinFilter)}">
+ <it:column>
<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>
- </h:panelGroup>
</f:facet>
<h:outputText value="#{car.vin}" />
</it:column>
Modified:
root/examples/richfaces-showcase/trunk/src/main/webapp/richfaces/extendedDataTable/simpleTable.xhtml
===================================================================
---
root/examples/richfaces-showcase/trunk/src/main/webapp/richfaces/extendedDataTable/simpleTable.xhtml 2010-05-31
12:11:11 UTC (rev 17403)
+++
root/examples/richfaces-showcase/trunk/src/main/webapp/richfaces/extendedDataTable/simpleTable.xhtml 2010-05-31
12:43:31 UTC (rev 17404)
@@ -4,58 +4,58 @@
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:a4j="http://richfaces.org/a4j"
-
xmlns:tbl="http://richfaces.org/rich">
+
xmlns:it="http://richfaces.org/iteration">
<ui:composition>
<h:form>
- <tbl:extendedDataTable value="#{carsBean.allInventoryItems}"
var="car"
+ <it:extendedDataTable value="#{carsBean.allInventoryItems}"
var="car"
id="table" frozenColumns="2" style="height:300px;
width:500px;" rowClasses="qwe, qe">
<f:facet name="header">
<h:outputText value="Cars marketplace" />
</f:facet>
- <tbl:column>
+ <it:column>
<f:facet name="header">
<h:outputText value="vendor" />
</f:facet>
<h:outputText value="#{car.vendor}" />
- </tbl:column>
- <tbl:column>
+ </it:column>
+ <it:column>
<f:facet name="header">
<h:outputText value="Model" />
</f:facet>
<h:outputText value="#{car.model}" />
- </tbl:column>
- <tbl:column>
+ </it:column>
+ <it:column>
<f:facet name="header">
<h:outputText value="Price" />
</f:facet>
<h:outputText value="#{car.price}" />
- </tbl:column>
- <tbl:column>
+ </it:column>
+ <it:column>
<f:facet name="header">
<h:outputText value="Mileage" />
</f:facet>
<h:outputText value="#{car.mileage}" />
- </tbl:column>
- <tbl:column>
+ </it:column>
+ <it:column>
<f:facet name="header">
<h:outputText value="VIN Code" />
</f:facet>
<h:outputText value="#{car.vin}" />
- </tbl:column>
- <tbl:column>
+ </it:column>
+ <it:column>
<f:facet name="header">
<h:outputText value="Items stock" />
</f:facet>
<h:outputText value="#{car.stock}" />
- </tbl:column>
- <tbl:column>
+ </it:column>
+ <it:column>
<f:facet name="header">
<h:outputText value="Days Live" />
</f:facet>
<h:outputText value="#{car.daysLive}" />
- </tbl:column>
- </tbl:extendedDataTable>
+ </it:column>
+ </it:extendedDataTable>
<a4j:commandButton value="render" render="table" />
</h:form>
</ui:composition>
Modified:
root/examples/richfaces-showcase/trunk/src/main/webapp/richfaces/functions/functions.xhtml
===================================================================
---
root/examples/richfaces-showcase/trunk/src/main/webapp/richfaces/functions/functions.xhtml 2010-05-31
12:11:11 UTC (rev 17403)
+++
root/examples/richfaces-showcase/trunk/src/main/webapp/richfaces/functions/functions.xhtml 2010-05-31
12:43:31 UTC (rev 17404)
@@ -14,11 +14,11 @@
Here is the current list:
</p>
<ul>
- <li>fn:clientId(id) - returns client Id for component by it's short
id.</li>
- <li>fn:element(id) - returns DOM element for the passed short id</li>
- <li>fn:component(id) - returns richfaces client component instance to call some
API method.</li>
- <li>fn:isUserInRole(role) - returns is the user has specified role.</li>
- <li>fn:findComponent(id) - returns component instance for given short
id</li>
+ <li><b>fn:clientId(id)</b> - returns client Id for component by
it's short id.</li>
+ <li><b>fn:element(id)</b> - returns DOM element for the passed short
id</li>
+ <li><b>fn:component(id)</b> - returns richfaces client component
instance to call some API method.</li>
+ <li><b>fn:isUserInRole(role)</b> - returns is the user has specified
role.</li>
+ <li><b>fn:findComponent(id)</b> - returns component instance for given
short id</li>
</ul>
<p>For example the result of #{fn:element('input')} expression will be -
document.getElementById('formId:input').</p>
<p>And here is one more simple example. There is no need in Bean creation in order
to store the value. It's picked from component instance by using rich:findComponent
call.</p>
Copied:
root/examples/richfaces-showcase/trunk/src/main/webapp/richfaces/subTableToggleControl
(from rev 17400,
root/examples/richfaces-showcase/trunk/src/main/webapp/richfaces/tableToggleControl)
Copied:
root/examples/richfaces-showcase/trunk/src/main/webapp/richfaces/subTableToggleControl/subTableToggleControl.xhtml
(from rev 17400,
root/examples/richfaces-showcase/trunk/src/main/webapp/richfaces/tableToggleControl/tableToggleControl.xhtml)
===================================================================
---
root/examples/richfaces-showcase/trunk/src/main/webapp/richfaces/subTableToggleControl/subTableToggleControl.xhtml
(rev 0)
+++
root/examples/richfaces-showcase/trunk/src/main/webapp/richfaces/subTableToggleControl/subTableToggleControl.xhtml 2010-05-31
12:43:31 UTC (rev 17404)
@@ -0,0 +1,76 @@
+<!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">
+
+<ui:composition>
+<p>This sample shows simple master-detail table implemented using<b>
rich:dataTable</b> and<b> rich:subtable</b> components</p>
+<p>There is one feature which is completely new for 4.x - subtables now could be
collapsed/expanded by using
+new component <b>rich:tableToggleControl</b></p>
+<p>Switching customization:</p>
+<ul>
+<li>subTable's could be collapsed/expanded in different modes defined via
subTable expandMode attribute
+- "<i>client</i>", "<i>ajax</i>" and
"<i>server</i>"</li>
+<li>The developer could get control on current states of subTables using its
<b>expanded</b> attribute.</li>
+</ul>
+ <h:form>
+ <it:dataTable value="#{carsBean.inventoryVendorLists}"
var="list">
+ <f:facet name="header">
+ <it:columnGroup>
+ <it:column colspan="6">
+ <h:outputText value="Cars marketplace" />
+ </it:column>
+ <it:column breakRowBefore="true">
+ <h:outputText value="Model" />
+ </it:column>
+ <it:column>
+ <h:outputText value="Price" />
+ </it:column>
+ <it:column>
+ <h:outputText value="Mileage" />
+ </it:column>
+ <it:column>
+ <h:outputText value="VIN Code" />
+ </it:column>
+ <it:column>
+ <h:outputText value="Items stock" />
+ </it:column>
+ <it:column>
+ <h:outputText value="Days Live" />
+ </it:column>
+ </it:columnGroup>
+ </f:facet>
+ <it:column colspan="6">
+ <it:subTableToggleControl for="sbtbl"/>
+ <h:outputText value="#{list.vendor}" />
+ </it:column>
+ <it:subTable value="#{list.vendorItems}" var="item"
id="sbtbl" expandMode="client">
+ <it:column>
+ <h:outputText value="#{item.model}" />
+ </it:column>
+ <it:column>
+ <h:outputText value="#{item.price}" />
+ </it:column>
+ <it:column>
+ <h:outputText value="#{item.mileage}" />
+ </it:column>
+ <it:column>
+ <h:outputText value="#{item.vin}" />
+ </it:column>
+ <it:column>
+ <h:outputText value="#{item.stock}" />
+ </it:column>
+ <it:column>
+ <h:outputText value="#{item.daysLive}" />
+ </it:column>
+ <f:facet name="footer">
+ <h:outputText value="Total of #{list.vendor} Cars: #{list.count}"
/>
+ </f:facet>
+ </it:subTable>
+ </it:dataTable>
+ </h:form>
+</ui:composition>
+</html>
\ No newline at end of file
Deleted:
root/examples/richfaces-showcase/trunk/src/main/webapp/richfaces/subTableToggleControl/tableToggleControl.xhtml
===================================================================
---
root/examples/richfaces-showcase/trunk/src/main/webapp/richfaces/tableToggleControl/tableToggleControl.xhtml 2010-05-30
14:01:03 UTC (rev 17400)
+++
root/examples/richfaces-showcase/trunk/src/main/webapp/richfaces/subTableToggleControl/tableToggleControl.xhtml 2010-05-31
12:43:31 UTC (rev 17404)
@@ -1,83 +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">
-
-<ui:composition>
-<p>This sample shows simple master-detail table implemented using<b>
rich:dataTable</b> and<b> rich:subtable</b> components</p>
-<p>There is one feature which is completely new for 4.x - subtables now could be
collapsed/expanded by using
-new component <b>rich:tableToggleControl</b></p>
-<p>Switching customization:</p>
-<ul>
-<li>subTable's could be collapsed/expanded in different modes defined via
subTable expandMode attribute
-- "<i>client</i>", "<i>ajax</i>" and
"<i>server</i>"</li>
-<li>The developer could get control on current states of subTables using its
<b>expanded</b> attribute.</li>
-</ul>
- <h:form>
- <it:dataTable value="#{carsBean.inventoryVendorLists}"
var="list">
- <f:facet name="header">
- <it:columnGroup>
- <it:column colspan="6">
- <h:outputText value="Cars marketplace" />
- </it:column>
- <it:column breakRowBefore="true">
- <h:outputText value="Model" />
- </it:column>
- <it:column>
- <h:outputText value="Price" />
- </it:column>
- <it:column>
- <h:outputText value="Mileage" />
- </it:column>
- <it:column>
- <h:outputText value="VIN Code" />
- </it:column>
- <it:column>
- <h:outputText value="Items stock" />
- </it:column>
- <it:column>
- <h:outputText value="Days Live" />
- </it:column>
- </it:columnGroup>
- </f:facet>
- <it:column colspan="6">
- <h:outputText value="#{list.vendor}" />
- <it:subTableToggleControl for="sbtbl">
- <f:facet name="expand">
- <a href="#">(show details)</a>
- </f:facet>
- <f:facet name="collapse">
- <a href="#">(hide details)</a>
- </f:facet>
- </it:subTableToggleControl>
- </it:column>
- <it:subTable value="#{list.vendorItems}" var="item"
id="sbtbl" expandMode="client">
- <it:column>
- <h:outputText value="#{item.model}" />
- </it:column>
- <it:column>
- <h:outputText value="#{item.price}" />
- </it:column>
- <it:column>
- <h:outputText value="#{item.mileage}" />
- </it:column>
- <it:column>
- <h:outputText value="#{item.vin}" />
- </it:column>
- <it:column>
- <h:outputText value="#{item.stock}" />
- </it:column>
- <it:column>
- <h:outputText value="#{item.daysLive}" />
- </it:column>
- <f:facet name="footer">
- <h:outputText value="Total of #{list.vendor} Cars: #{list.count}"
/>
- </f:facet>
- </it:subTable>
- </it:dataTable>
- </h:form>
-</ui:composition>
-</html>
\ No newline at end of file