]> source.dussan.org Git - vaadin-framework.git/commitdiff
fixes #5124, VWindows now hidden until first time render is completed to center phase
authorMatti Tahvonen <matti.tahvonen@itmill.com>
Thu, 24 Jun 2010 15:40:59 +0000 (15:40 +0000)
committerMatti Tahvonen <matti.tahvonen@itmill.com>
Thu, 24 Jun 2010 15:40:59 +0000 (15:40 +0000)
svn changeset:13923/svn branch:6.4

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

index 82589f22c92442a771c846f57735e716955e3fe2..288f2fe32ce506d807d812389771e4f5ed422659 100644 (file)
@@ -148,6 +148,8 @@ public class VWindow extends VOverlay implements Container, ScrollListener {
 
     private Element wrapper, wrapper2;
 
+    private boolean visibilityChangesDisabled;
+
     public VWindow() {
         super(false, false, true); // no autohide, not modal, shadow
         // Different style of shadow for windows
@@ -260,6 +262,7 @@ public class VWindow extends VOverlay implements Container, ScrollListener {
                 setVaadinModality(!vaadinModality);
             }
             if (!isAttached()) {
+                setVisible(false); // hide until possible centering
                 show();
             }
             if (uidl.getBooleanAttribute("resizable") != resizable) {
@@ -269,9 +272,11 @@ public class VWindow extends VOverlay implements Container, ScrollListener {
             setDraggable(!uidl.hasAttribute("fixedposition"));
         }
 
+        visibilityChangesDisabled = true;
         if (client.updateComponent(this, uidl, false)) {
             return;
         }
+        visibilityChangesDisabled = false;
 
         immediate = uidl.hasAttribute("immediate");
 
@@ -349,17 +354,6 @@ public class VWindow extends VOverlay implements Container, ScrollListener {
             setNaturalWidth();
         }
 
-        if (!dynamicWidth && !dynamicHeight
-                && uidl.getBooleanAttribute("center")) {
-            /*
-             * Iff size is specified we can center the window at this point. By
-             * doing it early we can avoid some flickering in some browsers. see
-             * #5124
-             */
-            centered = true;
-            center();
-        }
-
         layout.updateFromUIDL(childUidl, client);
         if (!dynamicHeight && layoutRelativeWidth) {
             /*
@@ -447,8 +441,8 @@ public class VWindow extends VOverlay implements Container, ScrollListener {
             // don't try to center the window anymore
             centered = false;
         }
-
         updateShadowSizeAndPosition();
+        setVisible(true);
 
         boolean sizeReduced = false;
         // ensure window is not larger than browser window
@@ -488,6 +482,19 @@ public class VWindow extends VOverlay implements Container, ScrollListener {
 
     }
 
+    @Override
+    public void setVisible(boolean visible) {
+        /*
+         * Visibility with VWindow works differently than with other Paintables
+         * in Vaadin. Invisible VWindows are not attached to DOM at all. Flag is
+         * used to avoid visibility call from
+         * ApplicationConnection.updateComponent();
+         */
+        if (!visibilityChangesDisabled) {
+            super.setVisible(visible);
+        }
+    }
+
     private void setDraggable(boolean draggable) {
         if (this.draggable == draggable) {
             return;