changeset 5480:e971b9ac99d8

Backed out changeset df88ad5d6621 due to test failures.
author Martin Sladecek <martin.sladecek@oracle.com>
date Tue, 22 Oct 2013 11:00:37 +0200
parents df88ad5d6621
children 1369bb06dabe
files modules/controls/src/main/java/com/sun/javafx/scene/control/skin/VirtualFlow.java
diffstat 1 files changed, 23 insertions(+), 30 deletions(-) [+]
line wrap: on
line diff
--- a/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/VirtualFlow.java	Tue Oct 22 09:33:16 2013 +0200
+++ b/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/VirtualFlow.java	Tue Oct 22 11:00:37 2013 +0200
@@ -881,13 +881,10 @@
             lastWidth = -1;
             lastHeight = -1;
         }
-
-        boolean recreatedOrRebuilt = needsRebuildCells || needsRecreateCells || sizeChanged;
        
         needsRecreateCells = false;
         needsReconfigureCells = false;
         needsRebuildCells = false;
-        sizeChanged = false;
         
         if (needsCellsLayout) {
             for (int i = 0, max = cells.size(); i < max; i++) {
@@ -1050,7 +1047,7 @@
         }
 
         updateViewport();
-        updateScrollBarsAndCells(recreatedOrRebuilt);
+        updateScrollBarsAndCells();  
 
         // Get the index of the "current" cell
         int currentIndex = computeCurrentIndex();
@@ -1100,7 +1097,7 @@
         }
 
         updateViewport(); 
-        updateScrollBarsAndCells(false);
+        updateScrollBarsAndCells();
 
         lastWidth = getWidth();
         lastHeight = getHeight();
@@ -1342,7 +1339,6 @@
     @Override protected void setWidth(double value) {
         if (value != lastWidth) {
             super.setWidth(value);
-            sizeChanged = true;
             setNeedsLayout(true);
             requestLayout();
         }
@@ -1351,13 +1347,12 @@
     @Override protected void setHeight(double value) {
         if (value != lastHeight) {
             super.setHeight(value);
-            sizeChanged = true;
             setNeedsLayout(true);
             requestLayout();
         }
     }
 
-    private void updateScrollBarsAndCells(boolean recreate) {
+    private void updateScrollBarsAndCells() {
         // Assign the hbar and vbar to the breadthBar and lengthBar so as
         // to make some subsequent calculations easier.
         final boolean isVertical = isVertical();
@@ -1473,30 +1468,29 @@
         if (lengthBar.isVisible()) {
             // determine how many cells there are on screen so that the scrollbar
             // thumb can be appropriately sized
-            if (recreate) {
-                int numCellsVisibleOnScreen = 0;
-                for (int i = 0, max = cells.size(); i < max; i++) {
-                    T cell = cells.get(i);
-                    if (cell != null && ! cell.isEmpty()) {
-                        sumCellLength += (isVertical ? cell.getHeight() : cell.getWidth());
-                        if (sumCellLength > flowLength) {
-                            break;
-                        }
+            int numCellsVisibleOnScreen = 0;
+            for (int i = 0, max = cells.size(); i < max; i++) {
+                T cell = cells.get(i);
+                if (cell != null && ! cell.isEmpty()) {
+                    sumCellLength += (isVertical ? cell.getHeight() : cell.getWidth());
+                    if (sumCellLength > flowLength) {
+                        break;
+                    }
 
-                        numCellsVisibleOnScreen++;
-                    }
-                }
-
-                lengthBar.setMax(1);
-                if (numCellsVisibleOnScreen == 0 && cellCount == 1) {
-                    // special case to help resolve RT-17701 and the case where we have
-                    // only a single row and it is bigger than the viewport
-                    lengthBar.setVisibleAmount(flowLength / sumCellLength);
-                } else {
-                    lengthBar.setVisibleAmount(numCellsVisibleOnScreen / (float) cellCount);
+                    numCellsVisibleOnScreen++;
                 }
             }
 
+            lengthBar.setMax(1);
+            if (numCellsVisibleOnScreen == 0 && cellCount == 1) {
+                // special case to help resolve RT-17701 and the case where we have
+                // only a single row and it is bigger than the viewport
+                lengthBar.setVisibleAmount(flowLength / sumCellLength);
+            } else {
+                lengthBar.setVisibleAmount(numCellsVisibleOnScreen / (float) cellCount);
+            }
+            
+
             // Fix for RT-11873. If this isn't here, we can have a situation where
             // the scrollbar scrolls endlessly. This is possible when the cell
             // count grows as the user hits the maximal position on the scrollbar
@@ -2175,7 +2169,7 @@
         cull();
 
         // Finally, update the scroll bars
-        updateScrollBarsAndCells(false);
+        updateScrollBarsAndCells();
         lastPosition = getPosition();
 
         // notify
@@ -2186,7 +2180,6 @@
     private boolean needsRecreateCells = false; // when cell factory changed
     private boolean needsRebuildCells = false; // when cell contents have changed
     private boolean needsCellsLayout = false;
-    private boolean sizeChanged = false;
     
     public void reconfigureCells() {
         needsReconfigureCells = true;