]> source.dussan.org Git - vaadin-framework.git/commitdiff
absolutelayout now updates relative component sizes properly on size changes
authorMatti Tahvonen <matti.tahvonen@itmill.com>
Thu, 16 Apr 2009 12:12:54 +0000 (12:12 +0000)
committerMatti Tahvonen <matti.tahvonen@itmill.com>
Thu, 16 Apr 2009 12:12:54 +0000 (12:12 +0000)
svn changeset:7438/svn branch:6.0

src/com/itmill/toolkit/terminal/gwt/client/ui/IAbsoluteLayout.java

index 2b2def0e7fff31f565196efd6c6785ec722af660..8b108549597289c83d2bc97e698691b3d962135b 100644 (file)
@@ -179,8 +179,20 @@ public class IAbsoluteLayout extends ComplexPanel implements Container {
         // inside marginals)
         canvas.getStyle().setProperty("width", width);
 
-        if (!rendering && BrowserInfo.get().isIE6()) {
-            relayoutWrappersForIe6();
+        if (!rendering) {
+            if (BrowserInfo.get().isIE6()) {
+                relayoutWrappersForIe6();
+            }
+            relayoutRelativeChildren();
+        }
+    }
+
+    private void relayoutRelativeChildren() {
+        for (Widget widget : getChildren()) {
+            if (widget instanceof Paintable) {
+                Paintable new_name = (Paintable) widget;
+                client.handleComponentRelativeSize(widget);
+            }
         }
     }
 
@@ -191,8 +203,11 @@ public class IAbsoluteLayout extends ComplexPanel implements Container {
         // inside marginals)
         canvas.getStyle().setProperty("height", height);
 
-        if (!rendering && BrowserInfo.get().isIE6()) {
-            relayoutWrappersForIe6();
+        if (!rendering) {
+            if (BrowserInfo.get().isIE6()) {
+                relayoutWrappersForIe6();
+            }
+            relayoutRelativeChildren();
         }
     }
 
@@ -227,7 +242,14 @@ public class IAbsoluteLayout extends ComplexPanel implements Container {
             if (getWidget() != paintable) {
                 setWidget((Widget) paintable);
             }
-            paintable.updateFromUIDL(componentUIDL.getChildUIDL(0), client);
+            UIDL childUIDL = componentUIDL.getChildUIDL(0);
+            paintable.updateFromUIDL(childUIDL, client);
+            if (childUIDL.hasAttribute("cached")) {
+                // child may need relative size adjustment if wrapper details
+                // have changed this could be optimized (check if wrapper size
+                // has changed)
+                client.handleComponentRelativeSize((Widget) paintable);
+            }
         }
 
         public void setPosition(String stringAttribute) {