diff options
author | John Ahlroos <john@vaadin.com> | 2012-10-23 13:26:52 +0300 |
---|---|---|
committer | John Ahlroos <john@vaadin.com> | 2012-10-23 13:26:52 +0300 |
commit | 1baeeab1dbbb0f774c249bedc98b403bb5cd1c1f (patch) | |
tree | a6bc6934ce872b969759c20fdb33f94476c1fd1c /client | |
parent | 7ec5bade7299a0989f7596ac346b8f0ec698d3cb (diff) | |
download | vaadin-framework-1baeeab1dbbb0f774c249bedc98b403bb5cd1c1f.tar.gz vaadin-framework-1baeeab1dbbb0f774c249bedc98b403bb5cd1c1f.zip |
Fixed moving components from an outer AbsoluteLayout into an inner layout #10034
Change-Id: Ib635a02e2a4b2dd70623c221da4289b0ee7bed27
Diffstat (limited to 'client')
-rw-r--r-- | client/src/com/vaadin/client/ui/absolutelayout/VAbsoluteLayout.java | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/client/src/com/vaadin/client/ui/absolutelayout/VAbsoluteLayout.java b/client/src/com/vaadin/client/ui/absolutelayout/VAbsoluteLayout.java index 04acb06c40..fbf534a5b5 100644 --- a/client/src/com/vaadin/client/ui/absolutelayout/VAbsoluteLayout.java +++ b/client/src/com/vaadin/client/ui/absolutelayout/VAbsoluteLayout.java @@ -305,6 +305,23 @@ public class VAbsoluteLayout extends ComplexPanel { for (Widget widget : getChildren()) { if (widget instanceof AbsoluteWrapper) { AbsoluteWrapper wrapper = (AbsoluteWrapper) widget; + + /* + * Cleanup old wrappers which have been left empty by other + * inner layouts moving the widget from the wrapper into their + * own hierarchy. This usually happens when a call to + * setWidget(widget) is done in an inner layout which + * automatically detaches the widget from the parent, in this + * case the wrapper, and re-attaches it somewhere else. This has + * to be done in the layout phase since the order of the + * hierarchy events are not defined. + */ + if (wrapper.getWidget() == null) { + wrapper.destroy(); + super.remove(wrapper); + continue; + } + Style wrapperStyle = wrapper.getElement().getStyle(); Style widgetStyle = wrapper.getWidget().getElement().getStyle(); if (widgetStyle.getHeight() != null @@ -341,6 +358,23 @@ public class VAbsoluteLayout extends ComplexPanel { for (Widget widget : getChildren()) { if (widget instanceof AbsoluteWrapper) { AbsoluteWrapper wrapper = (AbsoluteWrapper) widget; + + /* + * Cleanup old wrappers which have been left empty by other + * inner layouts moving the widget from the wrapper into their + * own hierarchy. This usually happens when a call to + * setWidget(widget) is done in an inner layout which + * automatically detaches the widget from the parent, in this + * case the wrapper, and re-attaches it somewhere else. This has + * to be done in the layout phase since the order of the + * hierarchy events are not defined. + */ + if (wrapper.getWidget() == null) { + wrapper.destroy(); + super.remove(wrapper); + continue; + } + Style wrapperStyle = wrapper.getElement().getStyle(); Style widgetStyle = wrapper.getWidget().getElement().getStyle(); |