From dbc84877a5af0e2298087bedbe91e55d68fab3da Mon Sep 17 00:00:00 2001 From: Matti Tahvonen Date: Tue, 28 Oct 2008 10:06:19 +0000 Subject: [PATCH] custom component not propagates width change svn changeset:5749/svn branch:trunk --- .../gwt/client/ui/ICustomComponent.java | 35 +++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) diff --git a/src/com/itmill/toolkit/terminal/gwt/client/ui/ICustomComponent.java b/src/com/itmill/toolkit/terminal/gwt/client/ui/ICustomComponent.java index 2907a5e82f..b0124809fc 100644 --- a/src/com/itmill/toolkit/terminal/gwt/client/ui/ICustomComponent.java +++ b/src/com/itmill/toolkit/terminal/gwt/client/ui/ICustomComponent.java @@ -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 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); + } + } + } + } -- 2.39.5