]> source.dussan.org Git - vaadin-framework.git/commitdiff
Adds support for spacers near the bottom of Escalator (#16644)
authorHenrik Paul <henrik@vaadin.com>
Mon, 2 Mar 2015 09:55:35 +0000 (11:55 +0200)
committerPekka Hyvönen <pekka@vaadin.com>
Tue, 3 Mar 2015 07:11:42 +0000 (07:11 +0000)
Change-Id: Idca22ecbe9a2db4dbfb26481694255c3a8791b67

client/src/com/vaadin/client/widgets/Escalator.java
uitest/src/com/vaadin/tests/widgetset/client/grid/EscalatorBasicClientFeaturesWidget.java

index 0f7ac891a9a3f1b01852946b303e9bb827c48403..b36b94c8f322086128dd33afeae34ff0cba8f1a1 100644 (file)
@@ -2421,13 +2421,6 @@ public class Escalator extends Widget implements RequiresResize,
                 return;
             }
 
-            /*
-             * TODO This will break the logical index calculation, as it will
-             * try to search for non-
-             */
-            getLogger().warning(
-                    "[[spacers]] scrolling and spacers near the bottom");
-
             boolean rowsWereMoved = false;
 
             final double topElementPosition;
@@ -2527,6 +2520,13 @@ public class Escalator extends Widget implements RequiresResize,
                     aRowWasLeftBehind = true;
                 }
 
+                /*
+                 * Make sure we don't scroll beyond the row content. This can
+                 * happen if we have spacers for the last rows.
+                 */
+                rowsToMove = Math.max(0,
+                        Math.min(rowsToMove, getRowCount() - logicalRowIndex));
+
                 moveAndUpdateEscalatorRows(Range.between(0, rowsToMove),
                         targetVisualIndex, logicalRowIndex);
 
index 37c0865e359f6186a2fdf2051a077ca7678cd19e..538f7a21a1a8f0ed180cee88292d8501df07b82a 100644 (file)
@@ -647,6 +647,7 @@ public class EscalatorBasicClientFeaturesWidget extends
 
         createSpacersMenuForRow(1, menupath);
         createSpacersMenuForRow(50, menupath);
+        createSpacersMenuForRow(99, menupath);
     }
 
     private void createSpacersMenuForRow(final int rowIndex, String[] menupath) {