Author: abelevich
Date: 2011-01-11 13:32:03 -0500 (Tue, 11 Jan 2011)
New Revision: 20953
Modified:
trunk/examples/iteration-demo/src/main/java/org/richfaces/demo/DataBean.java
trunk/examples/iteration-demo/src/main/webapp/dataTable.xhtml
trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractDataScroller.java
trunk/ui/iteration/ui/src/main/templates/datascroller.template.xml
Log:
RF-9780: 'renderIfSinglePage' attribute is added for dataScroller.
Modified: trunk/examples/iteration-demo/src/main/java/org/richfaces/demo/DataBean.java
===================================================================
---
trunk/examples/iteration-demo/src/main/java/org/richfaces/demo/DataBean.java 2011-01-11
17:33:06 UTC (rev 20952)
+++
trunk/examples/iteration-demo/src/main/java/org/richfaces/demo/DataBean.java 2011-01-11
18:32:03 UTC (rev 20953)
@@ -34,7 +34,7 @@
private String operation = "operation";
private boolean rendered = true;
-
+ private boolean renderIfSinglePage = true;
private List<Employee> employeeList;
private boolean state = true;
@@ -152,4 +152,12 @@
public Collection<Object> getSelectedRowKeys() {
return selectedRowKeys;
}
+
+ public boolean isRenderIfSinglePage() {
+ return renderIfSinglePage;
+ }
+
+ public void setRenderIfSinglePage(boolean renderIfSinglePage) {
+ this.renderIfSinglePage = renderIfSinglePage;
+ }
}
Modified: trunk/examples/iteration-demo/src/main/webapp/dataTable.xhtml
===================================================================
--- trunk/examples/iteration-demo/src/main/webapp/dataTable.xhtml 2011-01-11 17:33:06 UTC
(rev 20952)
+++ trunk/examples/iteration-demo/src/main/webapp/dataTable.xhtml 2011-01-11 18:32:03 UTC
(rev 20953)
@@ -1,139 +1,154 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<!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:it="http://richfaces.org/iteration"
-
xmlns:misc="http://richfaces.org/misc">
-<f:view contentType="text/html" />
+
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:it="http://richfaces.org/iteration"
+
xmlns:misc="http://richfaces.org/misc"
+
xmlns:a4j="http://richfaces.org/a4j">
+<f:view contentType="text/html"/>
<h:head>
- <title>Richfaces Tables</title>
+ <title>Richfaces Tables</title>
</h:head>
<h:body>
- <h:form id="form1">
- <it:dataScroller id="scroller1" for="richTable"
page="#{dataBean.page}" maxPages="7"></it:dataScroller>
-
- <it:dataTable keepSaved="true" id="richTable"
var="record" rowKeyVar="rowKey"
value="#{dataBean.employeeList}" rows="20"
sortMode="single">
- <f:facet name="caption">
- <h:outputText id="captioFacet1" value="Caption Facet" />
- </f:facet>
+ <h:form id="form1">
+ <it:dataScroller id="scroller1" for="richTable"
page="#{dataBean.page}" maxPages="7"></it:dataScroller>
- <f:facet name="header">
- <h:outputText value="header"/>
- </f:facet>
+ <it:dataTable keepSaved="true" id="richTable"
var="record" rowKeyVar="rowKey"
value="#{dataBean.employeeList}"
+ rows="20" sortMode="single">
+ <f:facet name="caption">
+ <h:outputText id="captioFacet1" value="Caption
Facet"/>
+ </f:facet>
- <it:column id="column_name" sortBy="#{record.name}"
- sortIconAsc="resources/images/asc.gif"
- sortIconDesc="resources/images/desc.gif"
- sortIconUnsort="resources/images/unsort.gif">
- <f:facet name="header">
- <h:outputText id="columnHeader1" value="Column Header Facet"
/>
- </f:facet>
+ <f:facet name="header">
+ <h:outputText value="header"/>
+ </f:facet>
- <it:collapsibleSubTableToggler for="collapsibleSubTable">
- </it:collapsibleSubTableToggler>
+ <it:column id="column_name" sortBy="#{record.name}"
+ sortIconAsc="resources/images/asc.gif"
+ sortIconDesc="resources/images/desc.gif"
+ sortIconUnsort="resources/images/unsort.gif">
+ <f:facet name="header">
+ <h:outputText id="columnHeader1" value="Column
Header Facet"/>
+ </f:facet>
- <h:outputText value="#{record.name}" />
- <f:facet name="footer">
- <h:outputText id="columnFooter1" value="Column Footer Facet
1" />
- </f:facet>
- </it:column>
+ <it:collapsibleSubTableToggler
for="collapsibleSubTable">
+ </it:collapsibleSubTableToggler>
- <it:column id="column_title" sortBy="#{record.title}"
- sortIconAsc="resources/images/asc.gif"
- sortIconDesc="resources/images/desc.gif"
- sortIconUnsort="resources/images/unsort.gif">
- <f:facet name="header">
- <h:outputText id="columnHeader2" value="Column Header Facet
2" />
- </f:facet>
- <h:outputText value="#{record.title}" />
- </it:column>
+ <h:outputText value="#{record.name}"/>
+ <f:facet name="footer">
+ <h:outputText id="columnFooter1" value="Column
Footer Facet 1"/>
+ </f:facet>
+ </it:column>
- <it:column id="column_email">
- <h:outputText value="#{record.EMail}" />
- </it:column>
+ <it:column id="column_title" sortBy="#{record.title}"
+ sortIconAsc="resources/images/asc.gif"
+ sortIconDesc="resources/images/desc.gif"
+ sortIconUnsort="resources/images/unsort.gif">
+ <f:facet name="header">
+ <h:outputText id="columnHeader2" value="Column
Header Facet 2"/>
+ </f:facet>
+ <h:outputText value="#{record.title}"/>
+ </it:column>
- <it:collapsibleSubTable id="collapsibleSubTable" var="company"
- value="#{record.companies}" rows="1" switchType="ajax"
- expanded="true">
- <f:facet name="header">
- <it:dataScroller id="subscroller" for="collapsibleSubTable"
- maxPages="3"></it:dataScroller>
- </f:facet>
+ <it:column id="column_email">
+ <h:outputText value="#{record.EMail}"/>
+ </it:column>
- <f:facet name="footer">
- <h:outputText value="footer" />
- </f:facet>
+ <it:collapsibleSubTable id="collapsibleSubTable"
var="company"
+ value="#{record.companies}"
rows="1" switchType="ajax"
+ expanded="true">
+ <f:facet name="header">
+ <it:dataScroller id="subscroller"
for="collapsibleSubTable"
+ maxPages="3"></it:dataScroller>
+ </f:facet>
- <it:column id="column_company_name">
- <h:outputText value="#{company.name}" />
- </it:column>
+ <f:facet name="footer">
+ <h:outputText value="footer"/>
+ </f:facet>
- <it:column id="column_company_state">
- <h:outputText value="#{company.state}" />
- </it:column>
+ <it:column id="column_company_name">
+ <h:outputText value="#{company.name}"/>
+ </it:column>
- <it:column id="column_company_phone">
- <h:outputText value="#{company.phone}" />
- </it:column>
- </it:collapsibleSubTable>
+ <it:column id="column_company_state">
+ <h:outputText value="#{company.state}"/>
+ </it:column>
- <f:facet name="footer">
- <it:dataScroller id="scroller3" for="richTable"
page="#{dataBean.page}" maxPages="7"></it:dataScroller>
- </f:facet>
+ <it:column id="column_company_phone">
+ <h:outputText value="#{company.phone}"/>
+ </it:column>
+ </it:collapsibleSubTable>
- </it:dataTable>
-
-
+ <f:facet name="footer">
+ <it:dataScroller id="scroller3" for="richTable"
page="#{dataBean.page}" maxPages="7"></it:dataScroller>
+ </f:facet>
- <br />
+ </it:dataTable>
- <!-- cc:componentControl event="click"
target="#{dataBean.target}" operation="#{dataBean.operation}">
- <f:param name="event" value="event"/>
- <cc:hashParam>
- <f:param name="key1" value="value1"/>
- <f:param name="key2" value="value2"/>
- <f:param name="key3" value="value3"/>
- <cc:hashParam name="nested1">
- <f:param name="key11" value="value11"/>
- </cc:hashParam>
- </cc:hashParam>
- <cc:hashParameter name="hashkey1">
- <f:param name="keyhash1" value="value1"/>
- <f:param name="keyhash2" value="value2"/>
- </cc:hashParameter>
- <h:commandButton value="richfaces1"/>
- <h:commandButton value="richfaces2"/>
- </cc:componentControl -->
+ <br/>
- <h:commandButton value="next">
- <misc:componentControl event="click" target="form1:scroller1"
- operation="switchToPage">
- <f:param value="fastforward" />
- </misc:componentControl>
- </h:commandButton>
+ <!-- cc:componentControl event="click"
target="#{dataBean.target}" operation="#{dataBean.operation}">
+ <f:param name="event" value="event"/>
+ <cc:hashParam>
+ <f:param name="key1"
value="value1"/>
+ <f:param name="key2"
value="value2"/>
+ <f:param name="key3"
value="value3"/>
+ <cc:hashParam name="nested1">
+ <f:param name="key11"
value="value11"/>
+ </cc:hashParam>
+ </cc:hashParam>
+ <cc:hashParameter name="hashkey1">
+ <f:param name="keyhash1"
value="value1"/>
+ <f:param name="keyhash2"
value="value2"/>
+ </cc:hashParameter>
+ <h:commandButton value="richfaces1"/>
+ <h:commandButton value="richfaces2"/>
+ </cc:componentControl -->
- <h:commandButton value="previous">
- <misc:componentControl event="click" target="form1:scroller1"
- operation="previous" />
- </h:commandButton>
- <h:commandButton value="sort">
- <misc:componentControl event="click" target="form1:richTable"
- operation="sort">
- <f:param value="column_title" />
- </misc:componentControl>
- </h:commandButton>
+ <h:commandButton value="next">
+ <misc:componentControl event="click"
target="form1:scroller1"
+ operation="switchToPage">
+ <f:param value="fastforward"/>
+ </misc:componentControl>
+ </h:commandButton>
- <h:commandButton value="unsort">
- <misc:componentControl event="click" target="form1:richTable"
- operation="sort">
- </misc:componentControl>
- </h:commandButton>
+ <h:commandButton value="previous">
+ <misc:componentControl event="click"
target="form1:scroller1"
+ operation="previous"/>
+ </h:commandButton>
- </h:form>
+ <h:commandButton value="sort">
+ <misc:componentControl event="click"
target="form1:richTable"
+ operation="sort">
+ <f:param value="column_title"/>
+ </misc:componentControl>
+ </h:commandButton>
+
+ <h:commandButton value="unsort">
+ <misc:componentControl event="click"
target="form1:richTable"
+ operation="sort">
+ </misc:componentControl>
+ </h:commandButton>
+
+ </h:form>
+ <br />
+ <h:form id="renderIfSinglePage_form">
+ <h:outputText value="DataScroller: attribute 'renderIfSinglePage'
with empty table"/>
+ <br />
+ <it:dataScroller id="scroller2" for="richTable2"
page="#{dataBean.page}"
+
renderIfSinglePage="#{dataBean.renderIfSinglePage}"/>
+ <it:dataTable id="richTable2" />
+ <h:selectOneRadio layout="pagedirection"
value="#{dataBean.renderIfSinglePage}">
+ <f:selectItem itemValue="true" itemLabel="Set
renderIfSinglePage 'true'"/>
+ <f:selectItem itemValue="false" itemLabel="Set
renderIfSinglePage 'false'"/>
+ <a4j:ajax render="renderIfSinglePage_form" />
+ </h:selectOneRadio>
+ </h:form>
</h:body>
</html>
Modified:
trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractDataScroller.java
===================================================================
---
trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractDataScroller.java 2011-01-11
17:33:06 UTC (rev 20952)
+++
trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractDataScroller.java 2011-01-11
18:32:03 UTC (rev 20953)
@@ -88,6 +88,9 @@
private Integer page;
+ @Attribute(defaultValue = "true")
+ public abstract boolean isRenderIfSinglePage();
+
@Attribute
public abstract String getLastPageMode();
@@ -127,7 +130,7 @@
public String getFor() {
return (String)getStateHelper().eval("for");
}
-
+
public void setFor(String forId) {
getStateHelper().put("for", forId);
}
Modified: trunk/ui/iteration/ui/src/main/templates/datascroller.template.xml
===================================================================
--- trunk/ui/iteration/ui/src/main/templates/datascroller.template.xml 2011-01-11 17:33:06
UTC (rev 20952)
+++ trunk/ui/iteration/ui/src/main/templates/datascroller.template.xml 2011-01-11 18:32:03
UTC (rev 20953)
@@ -37,78 +37,80 @@
<cc:implementation>
- <cdk:object type="org.richfaces.renderkit.ControlsState"
name="controlsState"
value="#{getControlsState(facesContext,component)}" />
-
- <span id="#{clientId}" class="rf-ds"><!-- Now decor is
disabled !!! -->
-
- <c:if test="#{controlsState.firstRendered}">
- <cdk:object type="boolean" name="isEnabled"
value="#{controlsState.firstEnabled}"/>
- <cdk:object type="UIComponent" name="facet"
value="#{component.getFacet('first')}"/>
- <cdk:object type="String" name="enabledStyles"
value="rf-ds-btn rf-ds-btn-first"/>
- <cdk:object type="String" name="disabledStyles"
value="rf-ds-btn rf-ds-btn-first rf-ds-dis"/>
- <cdk:object type="String" name="id"
value="#{clientId}_ds_f"/>
- <cdk:object type="String" name="defaultText"
value="««««"/>
- <xi:include xpointer="xpointer(/*)"
href="buttons.template.include" />
- </c:if>
-
- <c:if test="#{controlsState.fastRewindRendered}">
- <cdk:object type="boolean" name="isEnabled"
value="#{controlsState.fastRewindEnabled}"/>
- <cdk:object type="UIComponent" name="facet"
value="#{component.getFacet('fastRewind')}"/>
- <cdk:object type="java.lang.String" name="enabledStyles"
value="rf-ds-btn rf-ds-btn-fastrwd"/>
- <cdk:object type="java.lang.String" name="disabledStyles"
value="rf-ds-btn rf-ds-btn-fastrwd rf-ds-dis"/>
- <cdk:object type="java.lang.String" name="id"
value="#{clientId}_ds_fr"/>
- <cdk:object type="java.lang.String" name="defaultText"
value="««"/>
- <xi:include xpointer="xpointer(/*)"
href="buttons.template.include" />
- </c:if>
-
- <c:if test="#{controlsState.previousRendered}">
- <cdk:object name="isEnabled"
value="#{controlsState.previousEnabled}"/>
- <cdk:object name="facet"
value="#{component.getFacet('previous')}"/>
- <cdk:object type="java.lang.String" name="enabledStyles"
value="rf-ds-btn rf-ds-btn-prev"/>
- <cdk:object type="java.lang.String" name="disabledStyles"
value="rf-ds-btn rf-ds-btn-prev rf-ds-dis"/>
- <cdk:object name="id" value="#{clientId}_ds_prev"/>
- <cdk:object name="defaultText" value="«"/>
- <xi:include xpointer="xpointer(/*)"
href="buttons.template.include" />
- </c:if>
-
- <cdk:object type="java.util.Map" name="digitals"
value="#{renderPager(responseWriter, facesContext, component)}" />
-
- <c:if test="#{controlsState.nextRendered}">
- <cdk:object name="isEnabled"
value="#{controlsState.nextEnabled}"/>
- <cdk:object name="facet"
value="#{component.getFacet('next')}"/>
- <cdk:object type="java.lang.String" name="enabledStyles"
value="rf-ds-btn rf-ds-btn-next"/>
- <cdk:object type="java.lang.String" name="disabledStyles"
value="rf-ds-btn rf-ds-btn-next rf-ds-dis"/>
- <cdk:object name="id" value="#{clientId}_ds_next"/>
- <cdk:object name="defaultText" value="»"/>
- <xi:include xpointer="xpointer(/*)"
href="buttons.template.include" />
- </c:if>
-
- <c:if test="#{controlsState.fastForwardRendered}">
- <cdk:object name="isEnabled"
value="#{controlsState.fastForwardEnabled}"/>
- <cdk:object name="facet"
value="#{component.getFacet('fastForward')}"/>
- <cdk:object type="java.lang.String" name="enabledStyles"
value="rf-ds-btn rf-ds-btn-fastfwd"/>
- <cdk:object type="java.lang.String" name="disabledStyles"
value="rf-ds-btn rf-ds-btn-fastfwd rf-ds-dis"/>
- <cdk:object name="id" value="#{clientId}_ds_ff"/>
- <cdk:object name="defaultText"
value="»»"/>
- <xi:include xpointer="xpointer(/*)"
href="buttons.template.include" />
- </c:if>
-
- <c:if test="#{controlsState.lastRendered}">
- <cdk:object name="isEnabled"
value="#{controlsState.lastEnabled}"/>
- <cdk:object name="facet"
value="#{component.getFacet('last')}"/>
- <cdk:object type="java.lang.String" name="enabledStyles"
value="rf-ds-btn rf-ds-btn-last"/>
- <cdk:object type="java.lang.String" name="disabledStyles"
value="rf-ds-btn rf-ds-btn-last rf-ds-dis"/>
- <cdk:object name="id" value="#{clientId}_ds_l"/>
- <cdk:object name="defaultText"
value="»»»»"/>
- <xi:include xpointer="xpointer(/*)"
href="buttons.template.include" />
- </c:if>
-
- <cdk:object type="java.util.Map" name="buttons"
value="#{getControls(facesContext, component, controlsState)}" />
+ <cdk:object type="org.richfaces.renderkit.ControlsState"
name="controlsState"
value="#{getControlsState(facesContext,component)}" />
- <script type="text/javascript">
- <cdk:call expression="buildScript(responseWriter, facesContext, component,
buttons, digitals);"/>
- </script>
- </span>
+ <c:if
test="#{component.attributes['renderIfSinglePage']}">
+ <span id="#{clientId}" class="rf-ds"><!-- Now
decor is disabled !!! -->
+
+ <c:if test="#{controlsState.firstRendered}">
+ <cdk:object type="boolean" name="isEnabled"
value="#{controlsState.firstEnabled}"/>
+ <cdk:object type="UIComponent" name="facet"
value="#{component.getFacet('first')}"/>
+ <cdk:object type="String" name="enabledStyles"
value="rf-ds-btn rf-ds-btn-first"/>
+ <cdk:object type="String"
name="disabledStyles" value="rf-ds-btn rf-ds-btn-first
rf-ds-dis"/>
+ <cdk:object type="String" name="id"
value="#{clientId}_ds_f"/>
+ <cdk:object type="String" name="defaultText"
value="««««"/>
+ <xi:include xpointer="xpointer(/*)"
href="buttons.template.include" />
+ </c:if>
+
+ <c:if test="#{controlsState.fastRewindRendered}">
+ <cdk:object type="boolean" name="isEnabled"
value="#{controlsState.fastRewindEnabled}"/>
+ <cdk:object type="UIComponent" name="facet"
value="#{component.getFacet('fastRewind')}"/>
+ <cdk:object type="java.lang.String"
name="enabledStyles" value="rf-ds-btn rf-ds-btn-fastrwd"/>
+ <cdk:object type="java.lang.String"
name="disabledStyles" value="rf-ds-btn rf-ds-btn-fastrwd
rf-ds-dis"/>
+ <cdk:object type="java.lang.String" name="id"
value="#{clientId}_ds_fr"/>
+ <cdk:object type="java.lang.String"
name="defaultText" value="««"/>
+ <xi:include xpointer="xpointer(/*)"
href="buttons.template.include" />
+ </c:if>
+
+ <c:if test="#{controlsState.previousRendered}">
+ <cdk:object name="isEnabled"
value="#{controlsState.previousEnabled}"/>
+ <cdk:object name="facet"
value="#{component.getFacet('previous')}"/>
+ <cdk:object type="java.lang.String"
name="enabledStyles" value="rf-ds-btn rf-ds-btn-prev"/>
+ <cdk:object type="java.lang.String"
name="disabledStyles" value="rf-ds-btn rf-ds-btn-prev rf-ds-dis"/>
+ <cdk:object name="id"
value="#{clientId}_ds_prev"/>
+ <cdk:object name="defaultText"
value="«"/>
+ <xi:include xpointer="xpointer(/*)"
href="buttons.template.include" />
+ </c:if>
+
+ <cdk:object type="java.util.Map" name="digitals"
value="#{renderPager(responseWriter, facesContext, component)}" />
+
+ <c:if test="#{controlsState.nextRendered}">
+ <cdk:object name="isEnabled"
value="#{controlsState.nextEnabled}"/>
+ <cdk:object name="facet"
value="#{component.getFacet('next')}"/>
+ <cdk:object type="java.lang.String"
name="enabledStyles" value="rf-ds-btn rf-ds-btn-next"/>
+ <cdk:object type="java.lang.String"
name="disabledStyles" value="rf-ds-btn rf-ds-btn-next rf-ds-dis"/>
+ <cdk:object name="id"
value="#{clientId}_ds_next"/>
+ <cdk:object name="defaultText"
value="»"/>
+ <xi:include xpointer="xpointer(/*)"
href="buttons.template.include" />
+ </c:if>
+
+ <c:if test="#{controlsState.fastForwardRendered}">
+ <cdk:object name="isEnabled"
value="#{controlsState.fastForwardEnabled}"/>
+ <cdk:object name="facet"
value="#{component.getFacet('fastForward')}"/>
+ <cdk:object type="java.lang.String"
name="enabledStyles" value="rf-ds-btn rf-ds-btn-fastfwd"/>
+ <cdk:object type="java.lang.String"
name="disabledStyles" value="rf-ds-btn rf-ds-btn-fastfwd
rf-ds-dis"/>
+ <cdk:object name="id"
value="#{clientId}_ds_ff"/>
+ <cdk:object name="defaultText"
value="»»"/>
+ <xi:include xpointer="xpointer(/*)"
href="buttons.template.include" />
+ </c:if>
+
+ <c:if test="#{controlsState.lastRendered}">
+ <cdk:object name="isEnabled"
value="#{controlsState.lastEnabled}"/>
+ <cdk:object name="facet"
value="#{component.getFacet('last')}"/>
+ <cdk:object type="java.lang.String"
name="enabledStyles" value="rf-ds-btn rf-ds-btn-last"/>
+ <cdk:object type="java.lang.String"
name="disabledStyles" value="rf-ds-btn rf-ds-btn-last rf-ds-dis"/>
+ <cdk:object name="id"
value="#{clientId}_ds_l"/>
+ <cdk:object name="defaultText"
value="»»»»"/>
+ <xi:include xpointer="xpointer(/*)"
href="buttons.template.include" />
+ </c:if>
+
+ <cdk:object type="java.util.Map" name="buttons"
value="#{getControls(facesContext, component, controlsState)}" />
+
+ <script type="text/javascript">
+ <cdk:call expression="buildScript(responseWriter,
facesContext, component, buttons, digitals);"/>
+ </script>
+ </span>
+ </c:if>
</cc:implementation>
</cdk:root>
\ No newline at end of file