]> source.dussan.org Git - vaadin-framework.git/commitdiff
Fix for #6216 "refreshing page causes size-full components grow out of containing...
authorJouni Koivuviita <jouni.koivuviita@itmill.com>
Wed, 18 May 2011 06:42:14 +0000 (06:42 +0000)
committerJouni Koivuviita <jouni.koivuviita@itmill.com>
Wed, 18 May 2011 06:42:14 +0000 (06:42 +0000)
Updating of caption is done before calling client.updateComponent (and hence before possible sizing and size measurements).

svn changeset:18872/svn branch:6.6

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

index aae6cf0049a7c8e6201ab7dba1044b2d4e361e1e..98ebf73b77967c21705c819de228bdbd8f1e97b4 100644 (file)
@@ -14,13 +14,13 @@ import com.google.gwt.core.client.Scheduler;
 import com.google.gwt.core.client.Scheduler.ScheduledCommand;
 import com.google.gwt.event.dom.client.BlurEvent;
 import com.google.gwt.event.dom.client.BlurHandler;
-import com.google.gwt.event.dom.client.DomEvent.Type;
 import com.google.gwt.event.dom.client.FocusEvent;
 import com.google.gwt.event.dom.client.FocusHandler;
 import com.google.gwt.event.dom.client.KeyDownEvent;
 import com.google.gwt.event.dom.client.KeyDownHandler;
 import com.google.gwt.event.dom.client.ScrollEvent;
 import com.google.gwt.event.dom.client.ScrollHandler;
+import com.google.gwt.event.dom.client.DomEvent.Type;
 import com.google.gwt.event.shared.EventHandler;
 import com.google.gwt.event.shared.HandlerRegistration;
 import com.google.gwt.user.client.Command;
@@ -258,7 +258,9 @@ public class VWindow extends VOverlay implements Container,
         footer = DOM.createDiv();
         DOM.setElementProperty(footer, "className", CLASSNAME + "-footer");
         resizeBox = DOM.createDiv();
-        DOM.setElementProperty(resizeBox, "className", CLASSNAME + "-resizebox");
+        DOM
+                .setElementProperty(resizeBox, "className", CLASSNAME
+                        + "-resizebox");
         closeBox = DOM.createDiv();
         DOM.setElementProperty(closeBox, "className", CLASSNAME + "-closebox");
         DOM.appendChild(footer, resizeBox);
@@ -313,6 +315,11 @@ public class VWindow extends VOverlay implements Container,
             setDraggable(!uidl.hasAttribute("fixedposition"));
         }
 
+        if (uidl.hasAttribute("caption")) {
+            setCaption(uidl.getStringAttribute("caption"), uidl
+                    .getStringAttribute("icon"));
+        }
+
         visibilityChangesDisabled = true;
         if (client.updateComponent(this, uidl, false)) {
             return;
@@ -338,11 +345,6 @@ public class VWindow extends VOverlay implements Container,
             setPopupPosition(positionx, positiony);
         }
 
-        if (uidl.hasAttribute("caption")) {
-            setCaption(uidl.getStringAttribute("caption"),
-                    uidl.getStringAttribute("icon"));
-        }
-
         boolean showingUrl = false;
         int childIndex = 0;
         UIDL childUidl = uidl.getChildUIDL(childIndex++);
@@ -456,7 +458,8 @@ public class VWindow extends VOverlay implements Container,
                         }
 
                         final String style = notification.hasAttribute("style") ? notification
-                                .getStringAttribute("style") : null;
+                                .getStringAttribute("style")
+                                : null;
                         final int position = notification
                                 .getIntAttribute("position");
                         final int delay = notification.getIntAttribute("delay");
@@ -676,8 +679,7 @@ public class VWindow extends VOverlay implements Container,
      * Sets the closable state of the window. Additionally hides/shows the close
      * button according to the new state.
      * 
-     * @param closable
-     *            true if the window can be closed by the user
+     * @param closable true if the window can be closed by the user
      */
     protected void setClosable(boolean closable) {
         if (this.closable == closable) {
@@ -775,15 +777,14 @@ public class VWindow extends VOverlay implements Container,
 
     private void showModalityCurtain() {
         if (BrowserInfo.get().isFF2()) {
-            DOM.setStyleAttribute(
-                    getModalityCurtain(),
-                    "height",
-                    DOM.getElementPropertyInt(RootPanel.getBodyElement(),
-                            "offsetHeight") + "px");
+            DOM.setStyleAttribute(getModalityCurtain(), "height", DOM
+                    .getElementPropertyInt(RootPanel.getBodyElement(),
+                            "offsetHeight")
+                    + "px");
             DOM.setStyleAttribute(getModalityCurtain(), "position", "absolute");
         }
-        DOM.setStyleAttribute(getModalityCurtain(), "zIndex",
-                "" + (windowOrder.indexOf(this) + Z_INDEX));
+        DOM.setStyleAttribute(getModalityCurtain(), "zIndex", ""
+                + (windowOrder.indexOf(this) + Z_INDEX));
         if (isShowing()) {
             RootPanel.getBodyElement().insertBefore(getModalityCurtain(),
                     getElement());
@@ -986,8 +987,7 @@ public class VWindow extends VOverlay implements Container,
      * Checks if the cursor was inside the browser content area when the event
      * happened.
      * 
-     * @param event
-     *            The event to be checked
+     * @param event The event to be checked
      * @return true, if the cursor is inside the browser content area
      * 
      *         false, otherwise
@@ -1075,8 +1075,8 @@ public class VWindow extends VOverlay implements Container,
                 rootPixelWidth = getElement().getOffsetWidth();
                 width = rootPixelWidth + "px";
             } else {
-                rootPixelWidth = Integer.parseInt(width.substring(0,
-                        width.indexOf("px")));
+                rootPixelWidth = Integer.parseInt(width.substring(0, width
+                        .indexOf("px")));
             }
 
             // "width" now contains the new width in pixels
@@ -1305,15 +1305,15 @@ public class VWindow extends VOverlay implements Container,
     public void onScroll(ScrollEvent event) {
         client.updateVariable(id, "scrollTop",
                 contentPanel.getScrollPosition(), false);
-        client.updateVariable(id, "scrollLeft",
-                contentPanel.getHorizontalScrollPosition(), false);
+        client.updateVariable(id, "scrollLeft", contentPanel
+                .getHorizontalScrollPosition(), false);
 
     }
 
     public void onKeyDown(KeyDownEvent event) {
         if (shortcutHandler != null) {
-            shortcutHandler
-                    .handleKeyboardEvent(Event.as(event.getNativeEvent()));
+            shortcutHandler.handleKeyboardEvent(Event
+                    .as(event.getNativeEvent()));
             return;
         }
     }