Author: lfryc(a)redhat.com
Date: 2011-01-11 11:13:37 -0500 (Tue, 11 Jan 2011)
New Revision: 20949
Added:
modules/tests/metamer/trunk/application/src/main/resources/org/richfaces/tests/metamer/bean/RichCollapsibleSubTableBean.properties
Removed:
modules/tests/metamer/trunk/application/src/main/webapp/components/richCollapsibleSubTable/sorting-using-component-control.xhtml
Modified:
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichCollapsibleSubTableBean.java
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichTooltipBean.java
modules/tests/metamer/trunk/application/src/main/resources/org/richfaces/tests/metamer/bean/RichTooltipBean.properties
modules/tests/metamer/trunk/application/src/main/webapp/components/richCollapsibleSubTable/filtering.xhtml
modules/tests/metamer/trunk/application/src/main/webapp/components/richCollapsibleSubTable/list.xhtml
modules/tests/metamer/trunk/application/src/main/webapp/components/richCollapsibleSubTable/sorting-using-column.xhtml
Log:
rich:collapsibleSubTable - sample completion (RFPL-731)
Modified:
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichCollapsibleSubTableBean.java
===================================================================
---
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichCollapsibleSubTableBean.java 2011-01-11
12:21:10 UTC (rev 20948)
+++
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichCollapsibleSubTableBean.java 2011-01-11
16:13:37 UTC (rev 20949)
@@ -33,7 +33,9 @@
import javax.faces.bean.ViewScoped;
import org.richfaces.component.UICollapsibleSubTable;
+import org.richfaces.component.UIDataTableBase;
import org.richfaces.tests.metamer.Attributes;
+import org.richfaces.tests.metamer.ColumnSortingMap;
import org.richfaces.tests.metamer.model.Employee;
import org.richfaces.tests.metamer.model.Employee.Sex;
import org.slf4j.Logger;
@@ -45,7 +47,7 @@
* @author <a href="mailto:ppitonak@redhat.com">Pavol Pitonak</a>
* @version $Revision$
*/
-@ManagedBean(name="richSubTableBean")
+@ManagedBean(name = "richSubTableBean")
@ViewScoped
public class RichCollapsibleSubTableBean implements Serializable {
@@ -55,12 +57,29 @@
@ManagedProperty(value = "#{model.employees}")
private List<Employee> employees;
private List<List<Employee>> lists;
+ private UICollapsibleSubTable binding;
// true = model, false = empty table
private boolean state;
// facets
private Map<String, String> facets = new HashMap<String, String>();
+ // sorting
+ private ColumnSortingMap sorting = new ColumnSortingMap() {
+ private static final long serialVersionUID = 1L;
+
+ protected UIDataTableBase getBinding() {
+ return binding;
+ }
+
+ protected Attributes getAttributes() {
+ return attributes;
+ }
+ };
+
+ // filtering
+ private Map<String, Object> filtering = new HashMap<String, Object>();
+
/**
* Initializes the managed bean.
*/
@@ -68,15 +87,15 @@
public void init() {
logger = LoggerFactory.getLogger(getClass());
logger.debug("initializing bean " + getClass().getName());
-
+
attributes =
Attributes.getComponentAttributesFromFacesConfig(UICollapsibleSubTable.class,
getClass());
- attributes.setAttribute("expandMode", "client");
attributes.setAttribute("expanded", true);
attributes.setAttribute("rendered", true);
attributes.setAttribute("rows", 5);
// TODO these attributes have to be tested in another way
+ attributes.remove("selection");
attributes.remove("filterVar");
attributes.remove("keepSaved");
attributes.remove("iterationStatusVar");
@@ -139,5 +158,20 @@
public Map<String, String> getFacets() {
return facets;
}
-
+
+ public UICollapsibleSubTable getBinding() {
+ return binding;
+ }
+
+ public void setBinding(UICollapsibleSubTable binding) {
+ this.binding = binding;
+ }
+
+ public ColumnSortingMap getSorting() {
+ return sorting;
+ }
+
+ public Map<String, Object> getFiltering() {
+ return filtering;
+ }
}
Modified:
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichTooltipBean.java
===================================================================
---
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichTooltipBean.java 2011-01-11
12:21:10 UTC (rev 20948)
+++
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichTooltipBean.java 2011-01-11
16:13:37 UTC (rev 20949)
@@ -67,20 +67,16 @@
attributes.setAttribute("followMouse", true);
attributes.setAttribute("disabled", false);
attributes.setAttribute("layout", "inline");
- attributes.setAttribute("direction", "bottomRight");
attributes.setAttribute("mode", "client");
attributes.setAttribute("showEvent", "mouseenter");
attributes.setAttribute("hideEvent", "mouseleave");
attributes.setAttribute("target", "form:panel");
- // intentionally hidden attributes
- attributes.remove("bypassUpdates");
+ // attributes that needs to be tested in other way
attributes.remove("converter");
- attributes.remove("data");
- attributes.remove("execute");
- attributes.remove("limitToList");
+
+ // intentionally hidden attributes
attributes.remove("localValue");
- attributes.remove("render");
attributes.remove("value");
}
Added:
modules/tests/metamer/trunk/application/src/main/resources/org/richfaces/tests/metamer/bean/RichCollapsibleSubTableBean.properties
===================================================================
---
modules/tests/metamer/trunk/application/src/main/resources/org/richfaces/tests/metamer/bean/RichCollapsibleSubTableBean.properties
(rev 0)
+++
modules/tests/metamer/trunk/application/src/main/resources/org/richfaces/tests/metamer/bean/RichCollapsibleSubTableBean.properties 2011-01-11
16:13:37 UTC (rev 20949)
@@ -0,0 +1,6 @@
+attr.expandMode.server=server
+attr.expandMode.ajax=ajax
+attr.expandMode.client=client
+attr.expandMode.null=
+attr.sortMode.single=single
+attr.sortMode.multi=multi
\ No newline at end of file
Modified:
modules/tests/metamer/trunk/application/src/main/resources/org/richfaces/tests/metamer/bean/RichTooltipBean.properties
===================================================================
---
modules/tests/metamer/trunk/application/src/main/resources/org/richfaces/tests/metamer/bean/RichTooltipBean.properties 2011-01-11
12:21:10 UTC (rev 20948)
+++
modules/tests/metamer/trunk/application/src/main/resources/org/richfaces/tests/metamer/bean/RichTooltipBean.properties 2011-01-11
16:13:37 UTC (rev 20949)
@@ -1,9 +1,22 @@
attr.layout.inline=inline
attr.layout.block=block
-attr.direction.topRight=topRight
+attr.direction.auto=auto
attr.direction.topLeft=topLeft
+attr.direction.bottomLeft=bottomLeft
attr.direction.bottomRight=bottomRight
-attr.direction.bottomLeft=bottomLeft
-attr.direction.auto=auto
+attr.direction.autoLeft=autoLeft
+attr.direction.autoRight=autoRight
+attr.direction.topAuto=topAuto
+attr.direction.bottomAuto=bottomAuto
+attr.direction.null=
attr.mode.client=client
-attr.mode.ajax=ajax
\ No newline at end of file
+attr.mode.ajax=ajax
+attr.jointPoint.auto=auto
+attr.jointPoint.topLeft=topLeft
+attr.jointPoint.bottomLeft=bottomLeft
+attr.jointPoint.bottomRight=bottomRight
+attr.jointPoint.autoLeft=autoLeft
+attr.jointPoint.autoRight=autoRight
+attr.jointPoint.topAuto=topAuto
+attr.jointPoint.bottomAuto=bottomAuto
+attr.jointPoint.null=
\ No newline at end of file
Modified:
modules/tests/metamer/trunk/application/src/main/webapp/components/richCollapsibleSubTable/filtering.xhtml
===================================================================
---
modules/tests/metamer/trunk/application/src/main/webapp/components/richCollapsibleSubTable/filtering.xhtml 2011-01-11
12:21:10 UTC (rev 20948)
+++
modules/tests/metamer/trunk/application/src/main/webapp/components/richCollapsibleSubTable/filtering.xhtml 2011-01-11
16:13:37 UTC (rev 20949)
@@ -2,7 +2,8 @@
<!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:metamer="http://java.sun.com/jsf/composite/metamer"
-
xmlns:rich="http://richfaces.org/rich"
xmlns:a4j="http://richfaces.org/a4j">
+
xmlns:rich="http://richfaces.org/rich"
xmlns:a4j="http://richfaces.org/a4j"
+
xmlns:fn="http://java.sun.com/jsp/jstl/functions">
<!--
JBoss, Home of Professional Open Source
@@ -55,9 +56,21 @@
</rich:column>
<rich:column id="columnHeaderName"
breakRowBefore="true">
<h:outputText id="columnHeaderNameText"
value="Name" />
+ <br/>
+ <h:outputText id="columnHeaderNameType"
value="(expression contains ignore case)" />
+ <br/>
+ <h:inputText id="columnHeaderNameInput"
value="#{richSubTableBean.filtering['name']}">
+ <a4j:ajax render="commonGrid"
event="change"/>
+ </h:inputText>
</rich:column>
<rich:column id="columnHeaderTitle">
<h:outputText id="columnHeaderTitleText"
value="Title" />
+ <br/>
+ <h:outputText id="columnHeaderTitleType"
value="(expression equals)" />
+ <br/>
+ <h:inputText id="columnHeaderTitleInput"
value="#{richSubTableBean.filtering['title']}">
+ <a4j:ajax render="commonGrid"
event="change"/>
+ </h:inputText>
</rich:column>
<rich:column id="columnHeaderBirthdate">
<h:outputText id="columnHeaderBirthdateText"
value="Birthdate" />
@@ -102,18 +115,10 @@
value="#{richSubTableBean.state ? list :
null}"
var="item">
- <f:facet name="header">
- header facet
- </f:facet>
-
- <f:facet name="noData">
- no data facet
- </f:facet>
-
- <rich:column id="columnName">
+ <rich:column id="columnName"
filterExpression="#{fn:containsIgnoreCase(item.name,
richSubTableBean.filtering['name'])}">
<h:outputText id="name"
value="#{item.name}" />
</rich:column>
- <rich:column id="columnTitle">
+ <rich:column id="columnTitle"
filterExpression="#{richSubTableBean.filtering['title'] == null ||
richSubTableBean.filtering['title'] == '' || item.title ==
richSubTableBean.filtering['title']}">
<h:outputText id="title"
value="#{item.title}" />
</rich:column>
<rich:column id="columnBirthdate">
@@ -122,10 +127,6 @@
</h:outputText>
</rich:column>
- <f:facet name="footer">
- footer facet
- </f:facet>
-
</rich:collapsibleSubTable>
</rich:dataTable>
Modified:
modules/tests/metamer/trunk/application/src/main/webapp/components/richCollapsibleSubTable/list.xhtml
===================================================================
---
modules/tests/metamer/trunk/application/src/main/webapp/components/richCollapsibleSubTable/list.xhtml 2011-01-11
12:21:10 UTC (rev 20948)
+++
modules/tests/metamer/trunk/application/src/main/webapp/components/richCollapsibleSubTable/list.xhtml 2011-01-11
16:13:37 UTC (rev 20949)
@@ -52,10 +52,6 @@
Page that contains a table with two
<b>rich:collapsibleSubTable</b>s (with model containing employees) and input
boxes for all its attributes.
<span style="color: red">TODO will be used with various
types of input and command components as soon as available</span>
</metamer:testPageLink>
-
- <metamer:testPageLink id="sorting-using-component-control"
outcome="sorting-using-component-control" value="Table Sorting - Component
Control">
- <b>rich:collapsibleSubTable</b> (with model containing
employees) sortable by <b>rich:componentControl</b>.
- </metamer:testPageLink>
<metamer:testPageLink id="sorting-using-column"
outcome="sorting-using-column" value="Table Sorting - Column
based">
<b>rich:collapsibleSubTable</b> (with model containing
employees) with custom sorting by <b>rich:column</b>'s attribute @sortBy,
@sortOrder.
Modified:
modules/tests/metamer/trunk/application/src/main/webapp/components/richCollapsibleSubTable/sorting-using-column.xhtml
===================================================================
---
modules/tests/metamer/trunk/application/src/main/webapp/components/richCollapsibleSubTable/sorting-using-column.xhtml 2011-01-11
12:21:10 UTC (rev 20948)
+++
modules/tests/metamer/trunk/application/src/main/webapp/components/richCollapsibleSubTable/sorting-using-column.xhtml 2011-01-11
16:13:37 UTC (rev 20949)
@@ -54,13 +54,13 @@
<h:outputText id="columnHeaderEmployeesText"
value="Employees" />
</rich:column>
<rich:column id="columnHeaderName"
breakRowBefore="true">
- <h:outputText id="columnHeaderNameText"
value="Name" />
+ <a4j:commandLink id="sortByName"
value="Name" render="richDataTable"
action="#{richSubTableBean.sorting['columnName'].reverseOrder}" />
</rich:column>
<rich:column id="columnHeaderTitle">
- <h:outputText id="columnHeaderTitleText"
value="Title" />
+ <a4j:commandLink id="sortByTitle"
value="Title" render="richDataTable"
action="#{richSubTableBean.sorting['columnTitle'].reverseOrder}" />
</rich:column>
<rich:column id="columnHeaderBirthdate">
- <h:outputText id="columnHeaderBirthdateText"
value="Birthdate" />
+ <a4j:commandLink id="sortByBirthdate"
value="Birthdate" render="richDataTable"
action="#{richSubTableBean.sorting['columnBirthdate'].reverseOrder}"
/>
</rich:column>
</rich:columnGroup>
</f:facet>
@@ -71,6 +71,7 @@
</rich:column>
<rich:collapsibleSubTable id="richSubTable"
+ binding="#{richSubTableBean.binding}"
breakBefore="#{richSubTableBean.attributes['breakBefore'].value}"
expandMode="#{richSubTableBean.attributes['expandMode'].value}"
expanded="#{richSubTableBean.attributes['expanded'].value}"
@@ -102,30 +103,18 @@
value="#{richSubTableBean.state ? list :
null}"
var="item">
- <f:facet name="header">
- header facet
- </f:facet>
-
- <f:facet name="noData">
- no data facet
- </f:facet>
-
- <rich:column id="columnName">
+ <rich:column id="columnName"
sortBy="#{item.name}"
sortOrder="#{richSubTableBean.sorting['columnName'].order}">
<h:outputText id="name"
value="#{item.name}" />
</rich:column>
- <rich:column id="columnTitle">
+ <rich:column id="columnTitle"
sortBy="#{item.title}"
sortOrder="#{richSubTableBean.sorting['columnTitle'].order}">
<h:outputText id="title"
value="#{item.title}" />
</rich:column>
- <rich:column id="columnBirthdate">
+ <rich:column id="columnBirthdate"
sortBy="#{item.birthdate}"
sortOrder="#{richSubTableBean.sorting['columnBirthdate'].order}">
<h:outputText id="birthdate"
value="#{item.birthdate}">
<f:convertDateTime pattern="d MMM yyyy"/>
</h:outputText>
</rich:column>
-
- <f:facet name="footer">
- footer facet
- </f:facet>
-
+
</rich:collapsibleSubTable>
</rich:dataTable>
Deleted:
modules/tests/metamer/trunk/application/src/main/webapp/components/richCollapsibleSubTable/sorting-using-component-control.xhtml
===================================================================
---
modules/tests/metamer/trunk/application/src/main/webapp/components/richCollapsibleSubTable/sorting-using-component-control.xhtml 2011-01-11
12:21:10 UTC (rev 20948)
+++
modules/tests/metamer/trunk/application/src/main/webapp/components/richCollapsibleSubTable/sorting-using-component-control.xhtml 2011-01-11
16:13:37 UTC (rev 20949)
@@ -1,143 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<!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:metamer="http://java.sun.com/jsf/composite/metamer"
-
xmlns:rich="http://richfaces.org/rich"
xmlns:a4j="http://richfaces.org/a4j">
-
- <!--
-JBoss, Home of Professional Open Source
-Copyright 2010, Red Hat, Inc. and individual contributors
-by the @authors tag. See the copyright.txt in the distribution for a
-full listing of individual contributors.
-
-This is free software; you can redistribute it and/or modify it
-under the terms of the GNU Lesser General Public License as
-published by the Free Software Foundation; either version 2.1 of
-the License, or (at your option) any later version.
-
-This software is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this software; if not, write to the Free
-Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- -->
-
- <ui:composition template="/templates/template.xhtml">
-
- <ui:define name="head">
- <f:metadata>
- <f:viewParam name="templates"
value="#{templateBean.templates}">
- <f:converter converterId="templatesListConverter" />
- </f:viewParam>
- </f:metadata>
- </ui:define>
-
- <ui:define name="outOfTemplateBefore">
- <br/>
- <h:outputText value="Show data in table: " />
- <h:selectBooleanCheckbox id="noDataCheckbox"
value="#{richSubTableBean.state}">
- <a4j:ajax render="richDataTable"/>
- </h:selectBooleanCheckbox>
- <br/><br/>
- </ui:define>
-
- <ui:define name="component">
-
- <rich:dataTable id="richDataTable"
value="#{richSubTableBean.lists}" var="list">
- <f:facet name="header">
- <rich:columnGroup id="columnGroup">
- <rich:column id="columnHeaderEmployees"
colspan="3">
- <h:outputText id="columnHeaderEmployeesText"
value="Employees" />
- </rich:column>
- <rich:column id="columnHeaderName"
breakRowBefore="true">
- <h:commandLink id="sortNames"
value="Name">
- <rich:componentControl event="click"
target="richSubTable" operation="sort">
- <f:param value="columnName" />
- </rich:componentControl>
- </h:commandLink>
- </rich:column>
- <rich:column id="columnHeaderTitle">
- <h:outputText id="columnHeaderTitleText"
value="Title" />
- </rich:column>
- <rich:column id="columnHeaderBirthdate">
- <h:outputText id="columnHeaderBirthdateText"
value="Birthdate" />
- </rich:column>
- </rich:columnGroup>
- </f:facet>
-
- <rich:column id="columnSubTable" colspan="3">
- <rich:collapsibleSubTableToggler id="subTableTC"
for="richSubTable"/>
- <h:outputText value="#{list[0].sex == 'MALE' ?
'Men' : 'Women'}" />
- </rich:column>
-
- <rich:collapsibleSubTable id="richSubTable"
-
breakBefore="#{richSubTableBean.attributes['breakBefore'].value}"
-
expandMode="#{richSubTableBean.attributes['expandMode'].value}"
-
expanded="#{richSubTableBean.attributes['expanded'].value}"
-
filterVar="#{richSubTableBean.attributes['filterVar'].value}"
-
filteringListeners="#{richSubTableBean.attributes['filteringListeners'].value}"
-
first="#{richSubTableBean.attributes['first'].value}"
-
footer="#{richSubTableBean.attributes['footer'].value}"
-
header="#{richSubTableBean.attributes['header'].value}"
-
iterationState="#{richSubTableBean.attributes['iterationState'].value}"
-
iterationStatusVar="#{richSubTableBean.attributes['iterationStatusVar'].value}"
-
keepSaved="#{richSubTableBean.attributes['keepSaved'].value}"
-
noData="#{richSubTableBean.attributes['noData'].value}"
-
noDataLabel="#{richSubTableBean.attributes['noDataLabel'].value}"
-
relativeRowIndex="#{richSubTableBean.attributes['relativeRowIndex'].value}"
-
rendered="#{richSubTableBean.attributes['rendered'].value}"
-
rowAvailable="#{richSubTableBean.attributes['rowAvailable'].value}"
-
rowCount="#{richSubTableBean.attributes['rowCount'].value}"
-
rowData="#{richSubTableBean.attributes['rowData'].value}"
-
rowIndex="#{richSubTableBean.attributes['rowIndex'].value}"
-
rowKey="#{richSubTableBean.attributes['rowKey'].value}"
-
rowKeyConverter="#{richSubTableBean.attributes['rowKeyConverter'].value}"
-
rows="#{richSubTableBean.attributes['rows'].value}"
-
selection="#{richSubTableBean.attributes['selection'].value}"
-
sortExpression="#{richSubTableBean.attributes['sortExpression'].value}"
-
sortMode="#{richSubTableBean.attributes['sortMode'].value}"
-
sortPriority="#{richSubTableBean.attributes['sortPriority'].value}"
-
sortingListeners="#{richSubTableBean.attributes['sortingListeners'].value}"
-
toggleListeners="#{richSubTableBean.attributes['toggleListeners'].value}"
- value="#{richSubTableBean.state ? list :
null}"
- var="item">
-
- <f:facet name="header">
- header facet
- </f:facet>
-
- <f:facet name="noData">
- no data facet
- </f:facet>
-
- <rich:column id="columnName">
- <h:outputText id="name"
value="#{item.name}" />
- </rich:column>
- <rich:column id="columnTitle">
- <h:outputText id="title"
value="#{item.title}" />
- </rich:column>
- <rich:column id="columnBirthdate">
- <h:outputText id="birthdate"
value="#{item.birthdate}">
- <f:convertDateTime pattern="d MMM yyyy"/>
- </h:outputText>
- </rich:column>
-
- <f:facet name="footer">
- footer facet
- </f:facet>
-
- </rich:collapsibleSubTable>
- </rich:dataTable>
-
- </ui:define>
-
- <ui:define name="outOfTemplateAfter">
- <metamer:attributes value="#{richSubTableBean.attributes}"
id="attributes" />
- </ui:define>
-
- </ui:composition>
-</html>
\ No newline at end of file