]> source.dussan.org Git - vaadin-framework.git/commitdiff
Manual merge from 6.7 to 6.8 for #8799 timer unregistration.
authorHenri Sara <henri.sara@itmill.com>
Thu, 24 May 2012 13:16:02 +0000 (13:16 +0000)
committerHenri Sara <henri.sara@itmill.com>
Thu, 24 May 2012 13:16:02 +0000 (13:16 +0000)
svn changeset:23825/svn branch:6.8

src/com/vaadin/terminal/gwt/client/ui/VView.java

index 350c4b206bb328aa35fd9417c9efdd699e4afa61..6fdacc96079f1d00e52ca140b5034d855ed2cc6a 100644 (file)
@@ -136,7 +136,14 @@ public class VView extends SimplePanel implements Container, ResizeHandler,
         // should not be in the document focus flow
         getElement().setTabIndex(-1);
         TouchScrollDelegate.enableTouchScrolling(this, getElement());
+    }
 
+    /**
+     * Start to periodically monitor for parent element resizes if embedded
+     * application (e.g. portlet).
+     */
+    protected void onLoad() {
+        super.onLoad();
         if (isMonitoringParentSize()) {
             resizeTimer = new Timer() {
                 @Override
@@ -151,6 +158,18 @@ public class VView extends SimplePanel implements Container, ResizeHandler,
         }
     }
 
+    /**
+     * Stop monitoring for parent element resizes.
+     */
+    @Override
+    protected void onUnload() {
+        if (resizeTimer != null) {
+            resizeTimer.cancel();
+            resizeTimer = null;
+        }
+        super.onUnload();
+    }
+
     /**
      * Called when the window or parent div might have been resized.
      *