changeset 1430:a0ca6475993a

RT-23225: Pagination incorrect behavior when page count is less than 0.
author Kinsley Wong
date Tue, 10 Jul 2012 13:56:27 -0700
parents 153fdd6ebb3d
children 302ba4698b33
files javafx-ui-controls/src/com/sun/javafx/scene/control/skin/PaginationSkin.java
diffstat 1 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/PaginationSkin.java	Tue Jul 10 13:55:11 2012 -0700
+++ b/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/PaginationSkin.java	Tue Jul 10 13:56:27 2012 -0700
@@ -350,7 +350,13 @@
                     animate = false;
                 }
 
-                pagination.setCurrentPageIndex(previousIndex);
+                if (pagination.getPageFactory().call(previousIndex) != null) {
+                    pagination.setCurrentPageIndex(previousIndex);
+                } else {
+                    // Set the page index to 0 because both the current,
+                    // and the previous pages have no content.
+                    pagination.setCurrentPageIndex(0);
+                }
 
                 if (isAnimate) {
                     animate = true;