diff options
author | Artur Signell <artur@vaadin.com> | 2013-01-21 17:24:46 +0000 |
---|---|---|
committer | Vaadin Code Review <review@vaadin.com> | 2013-01-21 17:24:46 +0000 |
commit | 42230440620e69e1f249607770bd0d4cb974bd59 (patch) | |
tree | 8ea0833be96e346d35944fe78fcdfd2ed57174a1 | |
parent | 84b0df6f6b731d055a5451be07bb76f73accdef9 (diff) | |
parent | b396e4779bb8e423af065e7a25640fa404142f2f (diff) | |
download | vaadin-framework-42230440620e69e1f249607770bd0d4cb974bd59.tar.gz vaadin-framework-42230440620e69e1f249607770bd0d4cb974bd59.zip |
Merge "Reimplement zero size component checking for analyze layouts (#10792)"
-rw-r--r-- | client/src/com/vaadin/client/ApplicationConnection.java | 34 |
1 files changed, 26 insertions, 8 deletions
diff --git a/client/src/com/vaadin/client/ApplicationConnection.java b/client/src/com/vaadin/client/ApplicationConnection.java index 4a3215bb21..bc260a2bbc 100644 --- a/client/src/com/vaadin/client/ApplicationConnection.java +++ b/client/src/com/vaadin/client/ApplicationConnection.java @@ -220,10 +220,6 @@ public class ApplicationConnection { private boolean validatingLayouts = false; - private Set<ComponentConnector> zeroWidthComponents = null; - - private Set<ComponentConnector> zeroHeightComponents = null; - private final LayoutManager layoutManager; private final RpcManager rpcManager; @@ -1408,8 +1404,6 @@ public class ApplicationConnection { getConnectorMap().clear(); if (meta.containsKey("invalidLayouts")) { validatingLayouts = true; - zeroWidthComponents = new HashSet<ComponentConnector>(); - zeroHeightComponents = new HashSet<ComponentConnector>(); } } if (meta.containsKey("timedRedirect")) { @@ -1540,11 +1534,13 @@ public class ApplicationConnection { applicationRunning = false; } if (validatingLayouts) { + Set<ComponentConnector> zeroHeightComponents = new HashSet<ComponentConnector>(); + Set<ComponentConnector> zeroWidthComponents = new HashSet<ComponentConnector>(); + findZeroSizeComponents(zeroHeightComponents, + zeroWidthComponents, getUIConnector()); VConsole.printLayoutProblems(meta, ApplicationConnection.this, zeroHeightComponents, zeroWidthComponents); - zeroHeightComponents = null; - zeroWidthComponents = null; validatingLayouts = false; } @@ -2201,6 +2197,28 @@ public class ApplicationConnection { ApplicationConfiguration.runWhenDependenciesLoaded(c); } + private void findZeroSizeComponents( + Set<ComponentConnector> zeroHeightComponents, + Set<ComponentConnector> zeroWidthComponents, + ComponentConnector connector) { + Widget widget = connector.getWidget(); + ComputedStyle computedStyle = new ComputedStyle(widget.getElement()); + if (computedStyle.getIntProperty("height") == 0) { + zeroHeightComponents.add(connector); + } + if (computedStyle.getIntProperty("width") == 0) { + zeroWidthComponents.add(connector); + } + List<ServerConnector> children = connector.getChildren(); + for (ServerConnector serverConnector : children) { + if (serverConnector instanceof ComponentConnector) { + findZeroSizeComponents(zeroHeightComponents, + zeroWidthComponents, + (ComponentConnector) serverConnector); + } + } + } + private void loadStyleDependencies(JsArrayString dependencies) { // Assuming no reason to interpret in a defined order ResourceLoadListener resourceLoadListener = new ResourceLoadListener() { |