Author: a.izobov
Date: 2007-06-25 04:03:54 -0400 (Mon, 25 Jun 2007)
New Revision: 1285
Modified:
trunk/richfaces/datascroller/src/main/config/component/datascroller.xml
trunk/richfaces/datascroller/src/main/java/org/richfaces/renderkit/html/DataScrollerRenderer.java
trunk/richfaces/datascroller/src/main/templates/org/richfaces/htmlDatascroller.jspx
Log:
http://jira.jboss.com/jira/browse/RF-16 fixed
Modified: trunk/richfaces/datascroller/src/main/config/component/datascroller.xml
===================================================================
--- trunk/richfaces/datascroller/src/main/config/component/datascroller.xml 2007-06-25
07:30:31 UTC (rev 1284)
+++ trunk/richfaces/datascroller/src/main/config/component/datascroller.xml 2007-06-25
08:03:54 UTC (rev 1285)
@@ -258,6 +258,18 @@
<classname>java.lang.String</classname>
</property>
+ <property>
+ <name>pageIndexVar</name>
+ <classname>java.lang.String</classname>
+ <description>Name of variable in request scope containing index of active
page</description>
+ </property>
+
+ <property>
+ <name>pagesVar</name>
+ <classname>java.lang.String</classname>
+ <description>Name of variable in request scope containing number of
pages</description>
+ </property>
+
</component>
&listeners;
</components>
Modified:
trunk/richfaces/datascroller/src/main/java/org/richfaces/renderkit/html/DataScrollerRenderer.java
===================================================================
---
trunk/richfaces/datascroller/src/main/java/org/richfaces/renderkit/html/DataScrollerRenderer.java 2007-06-25
07:30:31 UTC (rev 1284)
+++
trunk/richfaces/datascroller/src/main/java/org/richfaces/renderkit/html/DataScrollerRenderer.java 2007-06-25
08:03:54 UTC (rev 1285)
@@ -237,6 +237,28 @@
}
+ public void renderPages(FacesContext context, UIComponent component) throws IOException
{
+ ComponentVariables variables = ComponentsVariableResolver.getVariables(this,
component);
+ UIData data = (UIData) variables.getVariable("dataTable");
+
+ ResponseWriter out = context.getResponseWriter();
+ UIDatascroller scroller = (UIDatascroller) component;
+ int currentPage = scroller.getPageIndex(data);
+
+ int pageCount = scroller.getPageCount(data);
+ if (pageCount <= 1) {
+ pageCount = 1;
+ }
+ String varName = (String)scroller.getAttributes().get("pageIndexVar");
+ if (varName != null && varName.length()>0)
+ context.getExternalContext()
+ .getRequestMap().put(varName, new Integer(currentPage));
+ varName = (String)scroller.getAttributes().get("pagesVar");
+ if (varName != null && varName.length()>0)
+ context.getExternalContext()
+ .getRequestMap().put(varName, new Integer(pageCount));
+ }
+
private Map getParamMap(FacesContext context) {
return context.getExternalContext().getRequestParameterMap();
}
Modified:
trunk/richfaces/datascroller/src/main/templates/org/richfaces/htmlDatascroller.jspx
===================================================================
---
trunk/richfaces/datascroller/src/main/templates/org/richfaces/htmlDatascroller.jspx 2007-06-25
07:30:31 UTC (rev 1284)
+++
trunk/richfaces/datascroller/src/main/templates/org/richfaces/htmlDatascroller.jspx 2007-06-25
08:03:54 UTC (rev 1285)
@@ -150,7 +150,21 @@
}
]]></jsp:scriptlet>
- <f:call name="renderPager"/>
+ <jsp:scriptlet><![CDATA[
+ UIComponent pagesFacet = component.getFacet("pages");
+ if (pagesFacet !=null && pagesFacet.isRendered()) {
+ renderPages(context,component);
+ ]]></jsp:scriptlet>
+ <td>
+ <jsp:scriptlet><![CDATA[
+ renderChild(context, pagesFacet);
+ ]]></jsp:scriptlet>
+ </td>
+ <jsp:scriptlet><![CDATA[
+ } else {
+ renderPager(context,component);
+ }
+ ]]></jsp:scriptlet>
<jsp:scriptlet><![CDATA[
if (controlsState.isNextRendered()){