changeset 1238:d82a7c6d2cac

RT-22098: [Pagination] current page is not updated, when page count is reduced.
author Kinsley Wong <kinsley.wong@oracle.com>
date Wed, 06 Jun 2012 11:20:49 -0700
parents 1f9d7d6bb729
children c0039fe78883
files javafx-ui-controls/src/com/sun/javafx/scene/control/skin/PaginationSkin.java
diffstat 1 files changed, 5 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/PaginationSkin.java	Wed Jun 06 10:19:14 2012 -0700
+++ b/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/PaginationSkin.java	Wed Jun 06 11:20:49 2012 -0700
@@ -325,6 +325,10 @@
             animate = false;
         }
 
+        // Remove the children in the pane before we create a new page.
+        currentStackPane.getChildren().clear();
+        nextStackPane.getChildren().clear();
+        
         pagination.setCurrentPageIndex(currentIndex);
         createPage(currentStackPane, currentIndex);
 
@@ -635,9 +639,6 @@
                 timeline.setOnFinished(new EventHandler<ActionEvent>() {
                     @Override
                     public void handle(ActionEvent arg0) {
-                        // Create a new page by removing the children.
-                        currentStackPane.getChildren().clear();
-                        nextStackPane.getChildren().clear();
                         resetIndexes(false);
                         navigation.initializePageIndicators();
                         navigation.updatePageIndicators();
@@ -645,13 +646,10 @@
                 });
                 return;
             }
-            // Create a new page by removing the children.
-            currentStackPane.getChildren().clear();
-            nextStackPane.getChildren().clear();
             resetIndexes(false);
             navigation.initializePageIndicators();
             navigation.updatePageIndicators();
-        } else if (p == "PAGE_COUNT") {
+        } else if (p == "PAGE_COUNT") {          
             resetIndexes(false);
             navigation.initializePageIndicators();
             navigation.updatePageIndicators();