summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Ahlroos <john@vaadin.com>2013-12-12 14:48:46 +0200
committerVaadin Code Review <review@vaadin.com>2013-12-12 12:54:00 +0000
commitd89f7a9947ebd1e8e7b40917540b06ac3c16364b (patch)
tree7b0dc9f889063212e0ca70240af72949df34e2fd
parent39064d707c9d839b08a296e809c649795850c21d (diff)
downloadvaadin-framework-d89f7a9947ebd1e8e7b40917540b06ac3c16364b.tar.gz
vaadin-framework-d89f7a9947ebd1e8e7b40917540b06ac3c16364b.zip
Fixed escalator attach/detach logic #12645
Change-Id: If1ba80802010e31362d555023b2b5e5850d2962b
-rw-r--r--client/src/com/vaadin/client/ui/grid/Escalator.java69
1 files changed, 30 insertions, 39 deletions
diff --git a/client/src/com/vaadin/client/ui/grid/Escalator.java b/client/src/com/vaadin/client/ui/grid/Escalator.java
index 548d79192a..20a187e1a5 100644
--- a/client/src/com/vaadin/client/ui/grid/Escalator.java
+++ b/client/src/com/vaadin/client/ui/grid/Escalator.java
@@ -35,7 +35,6 @@ import com.google.gwt.dom.client.NodeList;
import com.google.gwt.dom.client.Style;
import com.google.gwt.dom.client.Style.Display;
import com.google.gwt.dom.client.Style.Unit;
-import com.google.gwt.event.logical.shared.AttachEvent;
import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.Element;
import com.google.gwt.user.client.Window;
@@ -3037,49 +3036,41 @@ public class Escalator extends Widget {
setStylePrimaryName("v-escalator");
- /*
- * Size calculations work only after the Escalator has been attached to
- * the DOM. It doesn't matter if the table is populated or not by this
- * point, there's a lot of other stuff to calculate also. All sizes
- * start working once the first sizes have been initialized.
- */
- addAttachHandler(new AttachEvent.Handler() {
- @Override
- public void onAttachOrDetach(final AttachEvent event) {
- if (event.isAttached()) {
-
- /*
- * this specific order of method calls matters: header and
- * footer get defined heights, the body assumes to get the
- * rest.
- */
- header.paintInsertRows(0, header.getRowCount());
- footer.paintInsertRows(0, footer.getRowCount());
- recalculateElementSizes();
- body.paintInsertRows(0, body.getRowCount());
-
- scroller.attachScrollListener(verticalScrollbar
- .getElement());
- scroller.attachScrollListener(horizontalScrollbar
- .getElement());
- scroller.attachMousewheelListener(getElement());
- scroller.attachTouchListeners(getElement());
- } else {
- scroller.detachScrollListener(verticalScrollbar
- .getElement());
- scroller.detachScrollListener(horizontalScrollbar
- .getElement());
- scroller.detachMousewheelListener(getElement());
- scroller.detachTouchListeners(getElement());
- }
- }
- });
-
// init default dimensions
setHeight(null);
setWidth(null);
}
+ @Override
+ protected void onLoad() {
+ super.onLoad();
+
+ header.paintInsertRows(0, header.getRowCount());
+ footer.paintInsertRows(0, footer.getRowCount());
+ recalculateElementSizes();
+ body.paintInsertRows(0, body.getRowCount());
+
+ scroller.attachScrollListener(verticalScrollbar.getElement());
+ scroller.attachScrollListener(horizontalScrollbar.getElement());
+ scroller.attachMousewheelListener(getElement());
+ scroller.attachTouchListeners(getElement());
+ }
+
+ @Override
+ protected void onUnload() {
+
+ scroller.detachScrollListener(verticalScrollbar.getElement());
+ scroller.detachScrollListener(horizontalScrollbar.getElement());
+ scroller.detachMousewheelListener(getElement());
+ scroller.detachTouchListeners(getElement());
+
+ header.paintRemoveRows(0, header.getRowCount());
+ footer.paintRemoveRows(0, footer.getRowCount());
+ body.paintRemoveRows(0, body.getRowCount());
+
+ super.onUnload();
+ }
+
private void detectAndApplyPositionFunction() {
/*
* firefox has a bug in its translate operation, showing white space