diff options
author | Leif Åstrand <leif@vaadin.com> | 2013-07-08 14:48:52 +0300 |
---|---|---|
committer | Vaadin Code Review <review@vaadin.com> | 2013-07-31 11:54:18 +0000 |
commit | 6a6952749924d4aaa12c6f1354ed94d388b85e64 (patch) | |
tree | 4ebd2e71cf780799c97f80d0a627d4f0d7cdb367 | |
parent | 47f4c612a935ae2d5b9a6ee8626faa41a6451153 (diff) | |
download | vaadin-framework-6a6952749924d4aaa12c6f1354ed94d388b85e64.tar.gz vaadin-framework-6a6952749924d4aaa12c6f1354ed94d388b85e64.zip |
Add LayoutManager.setNeedsMeasureRecursively (#12180)
Change-Id: Iddedc74b471cc8a2743cdeab78e877654fce9609
-rw-r--r-- | client/src/com/vaadin/client/LayoutManager.java | 40 |
1 files changed, 36 insertions, 4 deletions
diff --git a/client/src/com/vaadin/client/LayoutManager.java b/client/src/com/vaadin/client/LayoutManager.java index 14b155c92f..1f9884de67 100644 --- a/client/src/com/vaadin/client/LayoutManager.java +++ b/client/src/com/vaadin/client/LayoutManager.java @@ -1437,10 +1437,15 @@ public class LayoutManager { /** * Informs this LayoutManager that the size of a component might have - * changed. If there is no upcoming layout phase, a new layout phase is - * scheduled. This method should be used whenever a size might have changed - * from outside of Vaadin's normal update phase, e.g. when an icon has been - * loaded or when the user resizes some part of the UI using the mouse. + * changed. This method should be used whenever the size of an individual + * component might have changed from outside of Vaadin's normal update + * phase, e.g. when an icon has been loaded or when the user resizes some + * part of the UI using the mouse. + * <p> + * To set an entire component hierarchy to be measured, use + * {@link #setNeedsMeasureRecursively(ComponentConnector)} instead. + * <p> + * If there is no upcoming layout phase, a new layout phase is scheduled. * * @param component * the component whose size might have changed. @@ -1454,6 +1459,33 @@ public class LayoutManager { } } + /** + * Informs this LayoutManager that some sizes in a component hierarchy might + * have changed. This method should be used whenever the size of any child + * component might have changed from outside of Vaadin's normal update + * phase, e.g. when a CSS class name related to sizing has been changed. + * <p> + * To set a single component to be measured, use + * {@link #setNeedsMeasure(ComponentConnector)} instead. + * <p> + * If there is no upcoming layout phase, a new layout phase is scheduled. + * + * @since 7.2 + * @param component + * the component at the root of the component hierarchy to + * measure + */ + public void setNeedsMeasureRecursively(ComponentConnector component) { + setNeedsMeasure(component); + + if (component instanceof HasComponentsConnector) { + HasComponentsConnector hasComponents = (HasComponentsConnector) component; + for (ComponentConnector child : hasComponents.getChildComponents()) { + setNeedsMeasureRecursively(child); + } + } + } + public void setEverythingNeedsMeasure() { everythingNeedsMeasure = true; } |