diff options
author | Henri Sara <henri.sara@gmail.com> | 2017-08-23 13:11:24 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-08-23 13:11:24 +0300 |
commit | 139c4cf40b6e914df65ec474d5a8523849489e24 (patch) | |
tree | 34e755ef259e205306caf1da0042f0a95574dd85 /client/src | |
parent | 5b13a397d86a20686d0052cfdec9d39696477655 (diff) | |
download | vaadin-framework-139c4cf40b6e914df65ec474d5a8523849489e24.tar.gz vaadin-framework-139c4cf40b6e914df65ec474d5a8523849489e24.zip |
Avoid detaching CssLayout children unnecessarily (#9861)
When child components are removed from a CssLayout, do not remove other
children from the DOM if no other hierarchy changes are made.
Fixes #7712
Diffstat (limited to 'client/src')
-rw-r--r-- | client/src/main/java/com/vaadin/client/ui/csslayout/CssLayoutConnector.java | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/client/src/main/java/com/vaadin/client/ui/csslayout/CssLayoutConnector.java b/client/src/main/java/com/vaadin/client/ui/csslayout/CssLayoutConnector.java index 40e473c8d8..8b90fffeb6 100644 --- a/client/src/main/java/com/vaadin/client/ui/csslayout/CssLayoutConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/csslayout/CssLayoutConnector.java @@ -114,19 +114,6 @@ public class CssLayoutConnector extends AbstractLayoutConnector { public void onConnectorHierarchyChange( ConnectorHierarchyChangeEvent event) { Profiler.enter("CssLayoutConnector.onConnectorHierarchyChange"); - Profiler.enter( - "CssLayoutConnector.onConnectorHierarchyChange add children"); - int index = 0; - for (ComponentConnector child : getChildComponents()) { - VCaption childCaption = childIdToCaption - .get(child.getConnectorId()); - if (childCaption != null) { - getWidget().addOrMove(childCaption, index++); - } - getWidget().addOrMove(child.getWidget(), index++); - } - Profiler.leave( - "CssLayoutConnector.onConnectorHierarchyChange add children"); // Detach old child widgets and possibly their caption Profiler.enter( @@ -145,6 +132,21 @@ public class CssLayoutConnector extends AbstractLayoutConnector { } Profiler.leave( "CssLayoutConnector.onConnectorHierarchyChange remove old children"); + + Profiler.enter( + "CssLayoutConnector.onConnectorHierarchyChange add children"); + int index = 0; + for (ComponentConnector child : getChildComponents()) { + VCaption childCaption = childIdToCaption + .get(child.getConnectorId()); + if (childCaption != null) { + getWidget().addOrMove(childCaption, index++); + } + getWidget().addOrMove(child.getWidget(), index++); + } + Profiler.leave( + "CssLayoutConnector.onConnectorHierarchyChange add children"); + Profiler.leave("CssLayoutConnector.onConnectorHierarchyChange"); } |