Author: nbelaevski
Date: 2008-03-18 17:05:32 -0400 (Tue, 18 Mar 2008)
New Revision: 6934
Modified:
trunk/ui/datascroller/src/main/java/org/richfaces/component/UIDatascroller.java
Log:
http://jira.jboss.com/jira/browse/RF-2182
Modified: trunk/ui/datascroller/src/main/java/org/richfaces/component/UIDatascroller.java
===================================================================
---
trunk/ui/datascroller/src/main/java/org/richfaces/component/UIDatascroller.java 2008-03-18
21:05:25 UTC (rev 6933)
+++
trunk/ui/datascroller/src/main/java/org/richfaces/component/UIDatascroller.java 2008-03-18
21:05:32 UTC (rev 6934)
@@ -34,6 +34,7 @@
import javax.faces.event.AbortProcessingException;
import javax.faces.event.FacesEvent;
+import org.ajax4jsf.Messages;
import org.ajax4jsf.component.AjaxActionComponent;
import org.ajax4jsf.renderkit.AjaxRendererUtils;
import org.ajax4jsf.renderkit.RendererUtils;
@@ -412,14 +413,25 @@
Integer pageCount = getPageCount(dataTable);
int page = getPage();
+ int newPage = -1;
if (page < 1) {
- page = 1;
- setPage(page);
+ newPage = 1;
} else if (page > pageCount) {
- page = pageCount != 0 ? pageCount : 1;
+ newPage = (pageCount != 0 ? pageCount : 1);
+ }
+
+ if (newPage != -1) {
+ FacesContext context = getFacesContext();
+ Object label = MessageUtil.getLabel(context, this);
+ String formattedMessage = Messages.getMessage(Messages.DATASCROLLER_PAGE_MISSING,
+ new Object[] {label, page, pageCount, newPage});
+
+ context.addMessage(this.getClientId(context), new FacesMessage(formattedMessage));
+
+ page = newPage;
setPage(page);
}
-
+
if (dataTable.isRendered()) {
dataTable.setFirst((page - 1) * getRows(dataTable));
}