modules/controls/src/main/java/com/sun/javafx/scene/control/skin/VirtualFlow.java

Print this page
rev 8393 : RT-39035: [TableView] TableView vertical mouse wheel scrolling does not go to the bottom (screen at a time or fast wheel setting)

@@ -1234,10 +1234,15 @@
         // offset is our indication of whether we can lay out additional
         // cells. If the offset is ever < 0, except in the case of the very
         // first cell, then we must quit.
         T cell = null;
 
+        // special case for the position == 1.0, skip adding last invisible cell
+        if (index == cellCount && offset == getViewportLength()) {
+            index--;
+            first = false;
+        }
         while (index >= 0 && (offset > 0 || first)) {
             cell = getAvailableCell(index);
             setCellIndex(cell, index);
             resizeCellSize(cell); // resize must be after config
             cells.addFirst(cell);

@@ -1700,11 +1705,11 @@
         for (int i = cells.size() - 1; i >= 0; i--) {
             T cell = cells.get(i);
             double cellSize = getCellLength(cell);
             double cellStart = getCellPosition(cell);
             double cellEnd = cellStart + cellSize;
-            if (cellStart > viewportLength || cellEnd < 0) {
+            if (cellStart >= viewportLength || cellEnd < 0) {
                 addToPile(cells.remove(i));
             }
         }
     }
 

@@ -2337,10 +2342,12 @@
                 }
 
                 layoutY += getCellLength(cell);
             }
             // end of fix for RT-32908
+            cull();
+            firstCell = cells.getFirst();
 
             // Add any necessary leading cells
             if (firstCell != null) {
                 int firstIndex = getCellIndex(firstCell);
                 double prevIndexSize = getCellLength(firstIndex - 1);

@@ -2378,10 +2385,15 @@
                     for (int i = 0; i < cells.size(); i++) {
                         T cell = cells.get(i);
                         positionCell(cell, getCellPosition(cell) + emptySize);
                     }
                     setPosition(1.0f);
+                    // fill the leading empty space
+                    firstCell = cells.getFirst();
+                    int firstIndex = getCellIndex(firstCell);
+                    double prevIndexSize = getCellLength(firstIndex - 1);
+                    addLeadingCells(firstIndex - 1, getCellPosition(firstCell) - prevIndexSize);
                 }
             }
         }
 
         // Now throw away any cells that don't fit