diff options
author | Leif Åstrand <leif@vaadin.com> | 2013-04-24 11:29:36 +0300 |
---|---|---|
committer | Leif Åstrand <leif@vaadin.com> | 2013-04-24 11:29:36 +0300 |
commit | cb7b02d4e50e91b9377410e79c3578587a900d94 (patch) | |
tree | b74f004f34f4626bfeaa1846e697ef1ed3b61eb5 /client | |
parent | 7900166360dac2d2ae8885e0151f46cad472805f (diff) | |
download | vaadin-framework-cb7b02d4e50e91b9377410e79c3578587a900d94.tar.gz vaadin-framework-cb7b02d4e50e91b9377410e79c3578587a900d94.zip |
Assert that connector needing layout is attached (#11698)
Change-Id: Ie2d1ec330b857497c7673f3805e35b452f409f3c
Diffstat (limited to 'client')
-rw-r--r-- | client/src/com/vaadin/client/LayoutManager.java | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/client/src/com/vaadin/client/LayoutManager.java b/client/src/com/vaadin/client/LayoutManager.java index 14b155c92f..381aff5afa 100644 --- a/client/src/com/vaadin/client/LayoutManager.java +++ b/client/src/com/vaadin/client/LayoutManager.java @@ -827,6 +827,7 @@ public class LayoutManager { * the managed layout that should be layouted */ public final void setNeedsHorizontalLayout(ManagedLayout layout) { + assert isAttached(layout); needsHorizontalLayout.add(layout.getConnectorId()); } @@ -842,9 +843,21 @@ public class LayoutManager { * the managed layout that should be layouted */ public final void setNeedsVerticalLayout(ManagedLayout layout) { + assert isAttached(layout); needsVerticalLayout.add(layout.getConnectorId()); } + private boolean isAttached(ServerConnector connector) { + while (connector != null) { + connector = connector.getParent(); + if (connector == connection.getUIConnector()) { + return true; + } + } + // Reaching null parent before reaching UI connector -> not attached + return false; + } + /** * Gets the outer height (including margins, paddings and borders) of the * given element, provided that it has been measured. These elements are |