]> source.dussan.org Git - vaadin-framework.git/commitdiff
custom component not propagates width change
authorMatti Tahvonen <matti.tahvonen@itmill.com>
Tue, 28 Oct 2008 10:06:19 +0000 (10:06 +0000)
committerMatti Tahvonen <matti.tahvonen@itmill.com>
Tue, 28 Oct 2008 10:06:19 +0000 (10:06 +0000)
svn changeset:5749/svn branch:trunk

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

index 2907a5e82f3c7582eefcddbb76d26ffa72a2032f..b0124809fc92d25ec7b81d9c4ddcdc3a1ae72fa8 100644 (file)
@@ -17,6 +17,11 @@ import com.itmill.toolkit.terminal.gwt.client.UIDL;
 public class ICustomComponent extends SimplePanel implements Container {
 
     private static final String CLASSNAME = "i-customcomponent";
+    private String height;
+    private ApplicationConnection client;
+    private Paintable component;
+    private boolean rendering;
+    private String width;
 
     public ICustomComponent() {
         super();
@@ -24,9 +29,12 @@ public class ICustomComponent extends SimplePanel implements Container {
     }
 
     public void updateFromUIDL(UIDL uidl, ApplicationConnection client) {
+        rendering = true;
         if (client.updateComponent(this, uidl, true)) {
+            rendering = false;
             return;
         }
+        this.client = client;
 
         final UIDL child = uidl.getChildUIDL(0);
         if (child != null) {
@@ -37,10 +45,11 @@ public class ICustomComponent extends SimplePanel implements Container {
                     clear();
                 }
                 setWidget((Widget) p);
+                component = p;
             }
             p.updateFromUIDL(child, client);
         }
-
+        rendering = false;
     }
 
     public boolean hasChildComponent(Widget component) {
@@ -61,7 +70,7 @@ public class ICustomComponent extends SimplePanel implements Container {
     }
 
     public void updateCaption(Paintable component, UIDL uidl) {
-        // TODO custom component could handle its composition roots caption
+        // NOP, custom component dont render composition roots caption
     }
 
     public boolean requestLayout(Set<Paintable> child) {
@@ -74,4 +83,26 @@ public class ICustomComponent extends SimplePanel implements Container {
                 .getOffsetHeight());
     }
 
+    @Override
+    public void setHeight(String height) {
+        super.setHeight(height);
+        if (!height.equals(this.height)) {
+            this.height = height;
+            if (!rendering) {
+                client.runDescendentsLayout(this);
+            }
+        }
+    }
+
+    @Override
+    public void setWidth(String width) {
+        super.setWidth(width);
+        if (!width.equals(this.width)) {
+            this.width = width;
+            if (!rendering) {
+                client.runDescendentsLayout(this);
+            }
+        }
+    }
+
 }