Author: nbelaevski
Date: 2009-03-31 12:12:10 -0400 (Tue, 31 Mar 2009)
New Revision: 13320
Modified:
trunk/ui/datascroller/src/main/config/component/datascroller.xml
trunk/ui/datascroller/src/main/java/org/richfaces/component/UIDatascroller.java
Log:
https://jira.jboss.org/jira/browse/RF-6637
Modified: trunk/ui/datascroller/src/main/config/component/datascroller.xml
===================================================================
--- trunk/ui/datascroller/src/main/config/component/datascroller.xml 2009-03-31 16:04:25
UTC (rev 13319)
+++ trunk/ui/datascroller/src/main/config/component/datascroller.xml 2009-03-31 16:12:10
UTC (rev 13320)
@@ -322,9 +322,8 @@
</property>
<property>
- <name>showShortLastPage</name>
- <classname>boolean</classname>
- <defaultvalue>true</defaultvalue>
+ <name>lastPageMode</name>
+ <classname>java.lang.String</classname>
</property>
<property hidden="true" existintag="false"
exist="false" >
Modified: trunk/ui/datascroller/src/main/java/org/richfaces/component/UIDatascroller.java
===================================================================
---
trunk/ui/datascroller/src/main/java/org/richfaces/component/UIDatascroller.java 2009-03-31
16:04:25 UTC (rev 13319)
+++
trunk/ui/datascroller/src/main/java/org/richfaces/component/UIDatascroller.java 2009-03-31
16:12:10 UTC (rev 13320)
@@ -56,6 +56,10 @@
public abstract class UIDatascroller extends AjaxActionComponent
implements DataScrollerSource, ActionSource {
+ public static final String LAST_PAGE_MODE_FULL = "full";
+
+ public static final String LAST_PAGE_MODE_SHORT = "short";
+
private static final Log log = LogFactory.getLog(UIDatascroller.class);
private Integer page;
@@ -207,8 +211,8 @@
public abstract void setInactiveStyle(String inactiveStyle);
- public abstract boolean isShowShortLastPage();
- public abstract void setShowShortLastPage(boolean showShortLastPage);
+ public abstract String getLastPageMode();
+ public abstract void setLastPageMode(String lastPageMode);
/**
* Finds the dataTable which id is mapped to the "for" property
@@ -472,8 +476,17 @@
if (isRendered(dataTable)) {
int first;
-
- if (page != pageCount || isShowShortLastPage()) {
+
+ String lastPageMode = getLastPageMode();
+ if (lastPageMode == null) {
+ lastPageMode = LAST_PAGE_MODE_SHORT;
+ } else if (!LAST_PAGE_MODE_SHORT.equals(lastPageMode) &&
+ !LAST_PAGE_MODE_FULL.equals(lastPageMode)) {
+
+ throw new IllegalArgumentException("Illegal value of 'lastPageMode'
attribute: '" + lastPageMode + "'");
+ }
+
+ if (page != pageCount || LAST_PAGE_MODE_SHORT.equals(lastPageMode)) {
first = (page - 1) * rows;
} else {
first = rowCount - rows;