From: Matti Tahvonen Date: Tue, 18 Sep 2007 11:36:18 +0000 (+0000) Subject: added custom component class X-Git-Tag: 6.7.0.beta1~6007 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=53c3889875d9c8024d3d3d49929af037a3e0a078;p=vaadin-framework.git added custom component class svn changeset:2311/svn branch:trunk --- diff --git a/src/com/itmill/toolkit/terminal/gwt/client/ui/ICustomComponent.java b/src/com/itmill/toolkit/terminal/gwt/client/ui/ICustomComponent.java new file mode 100644 index 0000000000..322b9359bc --- /dev/null +++ b/src/com/itmill/toolkit/terminal/gwt/client/ui/ICustomComponent.java @@ -0,0 +1,35 @@ +package com.itmill.toolkit.terminal.gwt.client.ui; + +import com.google.gwt.user.client.ui.SimplePanel; +import com.google.gwt.user.client.ui.Widget; +import com.itmill.toolkit.terminal.gwt.client.ApplicationConnection; +import com.itmill.toolkit.terminal.gwt.client.Paintable; +import com.itmill.toolkit.terminal.gwt.client.UIDL; + +public class ICustomComponent extends SimplePanel implements Paintable { + + private static final String CLASSNAME = "i-customcomponent"; + + public ICustomComponent() { + super(); + setStyleName(CLASSNAME); + } + + public void updateFromUIDL(UIDL uidl, ApplicationConnection client) { + + UIDL child = uidl.getChildUIDL(0); + if(child != null) { + Paintable p = (Paintable) client.getWidget(child); + if(p != getWidget()) { + if(getWidget() != null) { + client.unregisterPaintable((Paintable) getWidget()); + clear(); + } + setWidget((Widget) p); + } + p.updateFromUIDL(child, client); + } + + } + +}