summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenrik Paul <henrik@vaadin.com>2013-12-18 14:31:12 +0200
committerHenrik Paul <henrik@vaadin.com>2013-12-18 14:31:15 +0200
commitbf116b3c254e442d023eef82da5071a39552e31e (patch)
tree153e12411ffffbba1b16cb25e9215dcafbe68940
parent55e4f6b28c45915d3a63b37c383f78c7cfde44eb (diff)
downloadvaadin-framework-bf116b3c254e442d023eef82da5071a39552e31e.tar.gz
vaadin-framework-bf116b3c254e442d023eef82da5071a39552e31e.zip
Fixes a duplication issue in Escalator.onLoad (#12645)
Forgot about the side-effect of recalculateElementSizes(), that it already inserts escalator rows if needed. Therefore, there's no need to explicitly add rows into the body upon attach. Change-Id: Id984756257c7527ca0745dcbe1d50e03a4e0ead6
-rw-r--r--client/src/com/vaadin/client/ui/grid/Escalator.java23
1 files changed, 22 insertions, 1 deletions
diff --git a/client/src/com/vaadin/client/ui/grid/Escalator.java b/client/src/com/vaadin/client/ui/grid/Escalator.java
index 97c7df2fea..f306166a74 100644
--- a/client/src/com/vaadin/client/ui/grid/Escalator.java
+++ b/client/src/com/vaadin/client/ui/grid/Escalator.java
@@ -3114,7 +3114,18 @@ public class Escalator extends Widget {
header.paintInsertRows(0, header.getRowCount());
footer.paintInsertRows(0, footer.getRowCount());
recalculateElementSizes();
- body.paintInsertRows(0, body.getRowCount());
+ /*
+ * Note: There's no need to explicitly insert rows into the body.
+ *
+ * recalculateElementSizes will recalculate the height of the body. This
+ * has the side-effect that as the body's size grows bigger (i.e. from 0
+ * to its actual height), more escalator rows are populated. Those
+ * escalator rows are then immediately rendered. This, in effect, is the
+ * same thing as inserting those rows.
+ *
+ * In fact, having an extra paintInsertRows here would lead to duplicate
+ * rows.
+ */
scroller.attachScrollListener(verticalScrollbar.getElement());
scroller.attachScrollListener(horizontalScrollbar.getElement());
@@ -3431,6 +3442,16 @@ public class Escalator extends Widget {
}
}
+ /**
+ * Recalculates the dimensions for all elements that require manual
+ * calculations. Also updates the dimension caches.
+ * <p>
+ * <em>Note:</em> This method has the <strong>side-effect</strong>
+ * automatically makes sure that an appropriate amount of escalator rows are
+ * present. So, if the body area grows, more <strong>escalator rows might be
+ * inserted</strong>. Conversely, if the body area shrinks,
+ * <strong>escalator rows might be removed</strong>.
+ */
private void recalculateElementSizes() {
if (!isAttached()) {
return;