diff options
author | Henri Sara <hesara@vaadin.com> | 2012-11-13 18:08:29 +0200 |
---|---|---|
committer | Artur Signell <artur@vaadin.com> | 2012-11-13 18:18:40 +0200 |
commit | 391884746fda1781c55b13bc200dd75373f69141 (patch) | |
tree | 0d5a8dcd9d13c5c39813d81252506e12d72741af /client | |
parent | 4628bcc3062ef19ed9d561f79fe3bfb3696d6e04 (diff) | |
download | vaadin-framework-391884746fda1781c55b13bc200dd75373f69141.tar.gz vaadin-framework-391884746fda1781c55b13bc200dd75373f69141.zip |
UI based on AbstractBasicComponentContainer (#2924)
Change-Id: I1614a3464b8e7a0e9ecdd8c3a76335cdb85bdf87
Diffstat (limited to 'client')
-rw-r--r-- | client/src/com/vaadin/client/ui/ui/UIConnector.java | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/client/src/com/vaadin/client/ui/ui/UIConnector.java b/client/src/com/vaadin/client/ui/ui/UIConnector.java index c1083a2bb4..a0898b3281 100644 --- a/client/src/com/vaadin/client/ui/ui/UIConnector.java +++ b/client/src/com/vaadin/client/ui/ui/UIConnector.java @@ -337,11 +337,19 @@ public class UIConnector extends AbstractComponentContainerConnector implements } protected ComponentConnector getContent() { - return (ComponentConnector) getState().content; + List<ComponentConnector> children = getChildComponents(); + if (children.isEmpty()) { + return null; + } else { + return children.get(0); + } } protected void onChildSizeChange() { ComponentConnector child = getContent(); + if (child == null) { + return; + } Style childStyle = child.getWidget().getElement().getStyle(); /* * Must set absolute position if the child has relative height and @@ -408,12 +416,16 @@ public class UIConnector extends AbstractComponentContainerConnector implements childStateChangeHandlerRegistration.removeHandler(); childStateChangeHandlerRegistration = null; } - getWidget().setWidget(newChild.getWidget()); - childStateChangeHandlerRegistration = newChild - .addStateChangeHandler(childStateChangeHandler); - // Must handle new child here as state change events are already - // fired - onChildSizeChange(); + if (newChild != null) { + getWidget().setWidget(newChild.getWidget()); + childStateChangeHandlerRegistration = newChild + .addStateChangeHandler(childStateChangeHandler); + // Must handle new child here as state change events are already + // fired + onChildSizeChange(); + } else { + getWidget().setWidget(null); + } } for (ComponentConnector c : getChildComponents()) { |