summaryrefslogtreecommitdiffstats
path: root/client
diff options
context:
space:
mode:
Diffstat (limited to 'client')
-rw-r--r--client/src/com/vaadin/client/ComponentLocator.java5
-rw-r--r--client/src/com/vaadin/client/ui/absolutelayout/VAbsoluteLayout.java34
2 files changed, 39 insertions, 0 deletions
diff --git a/client/src/com/vaadin/client/ComponentLocator.java b/client/src/com/vaadin/client/ComponentLocator.java
index e69c55d445..47fb29777c 100644
--- a/client/src/com/vaadin/client/ComponentLocator.java
+++ b/client/src/com/vaadin/client/ComponentLocator.java
@@ -332,6 +332,11 @@ public class ComponentLocator {
} catch (Exception e) {
return null;
}
+
+ if (element == null) {
+ return null;
+ }
+
}
}
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();