diff options
author | Artur Signell <artur@vaadin.com> | 2013-06-04 23:13:29 +0300 |
---|---|---|
committer | Vaadin Code Review <review@vaadin.com> | 2013-06-05 09:19:26 +0000 |
commit | 6d4582eea9e19518c7341ec65357b1d04a1a37c6 (patch) | |
tree | bfa7fb5609d488880e9bfd8a2d47e2465d12f832 /client | |
parent | aa99259eac14854e1e9a33fbbd429d0c5ffa9c52 (diff) | |
download | vaadin-framework-6d4582eea9e19518c7341ec65357b1d04a1a37c6.tar.gz vaadin-framework-6d4582eea9e19518c7341ec65357b1d04a1a37c6.zip |
Change analyze layouts to use RPC (#11536)
Change-Id: I80d39e4ce4e0576b98ad095efce03740291d3de5
Diffstat (limited to 'client')
-rw-r--r-- | client/src/com/vaadin/client/ApplicationConnection.java | 45 | ||||
-rw-r--r-- | client/src/com/vaadin/client/VConsole.java | 5 | ||||
-rw-r--r-- | client/src/com/vaadin/client/ui/ui/UIConnector.java | 24 |
3 files changed, 29 insertions, 45 deletions
diff --git a/client/src/com/vaadin/client/ApplicationConnection.java b/client/src/com/vaadin/client/ApplicationConnection.java index 4dd68cc24f..a3279e5631 100644 --- a/client/src/com/vaadin/client/ApplicationConnection.java +++ b/client/src/com/vaadin/client/ApplicationConnection.java @@ -221,8 +221,6 @@ public class ApplicationConnection { private Date requestStartTime; - private boolean validatingLayouts = false; - private final LayoutManager layoutManager; private final RpcManager rpcManager; @@ -678,11 +676,12 @@ public class ApplicationConnection { /** * Requests an analyze of layouts, to find inconsistencies. Exclusively used * for debugging during development. + * + * @deprecated as of 7.1. Replaced by {@link UIConnector#analyzeLayouts()} */ + @Deprecated public void analyzeLayouts() { - String params = getRepaintAllParameters() + "&" - + ApplicationConstants.PARAM_ANALYZE_LAYOUTS + "=1"; - makeUidlRequest("", params); + getUIConnector().analyzeLayouts(); } /** @@ -1358,9 +1357,6 @@ public class ApplicationConnection { meta = json.getValueMap("meta"); if (meta.containsKey("repaintAll")) { prepareRepaintAll(); - if (meta.containsKey("invalidLayouts")) { - validatingLayouts = true; - } } if (meta.containsKey("timedRedirect")) { final ValueMap timedRedirect = meta @@ -1461,17 +1457,6 @@ 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); - validatingLayouts = false; - - } Profiler.leave("Error handling"); } @@ -2226,28 +2211,6 @@ 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() { diff --git a/client/src/com/vaadin/client/VConsole.java b/client/src/com/vaadin/client/VConsole.java index f7a7554e34..37ed8e6370 100644 --- a/client/src/com/vaadin/client/VConsole.java +++ b/client/src/com/vaadin/client/VConsole.java @@ -15,7 +15,6 @@ */ package com.vaadin.client; -import java.util.Set; import java.util.logging.Level; import java.util.logging.Logger; @@ -81,9 +80,7 @@ public class VConsole { } public static void printLayoutProblems(ValueMap meta, - ApplicationConnection applicationConnection, - Set<ComponentConnector> zeroHeightComponents, - Set<ComponentConnector> zeroWidthComponents) { + ApplicationConnection applicationConnection) { if (impl != null) { impl.meta(applicationConnection, meta); } diff --git a/client/src/com/vaadin/client/ui/ui/UIConnector.java b/client/src/com/vaadin/client/ui/ui/UIConnector.java index 38c26a77e6..1c2c6ddeb8 100644 --- a/client/src/com/vaadin/client/ui/ui/UIConnector.java +++ b/client/src/com/vaadin/client/ui/ui/UIConnector.java @@ -53,6 +53,7 @@ import com.vaadin.client.Paintable; import com.vaadin.client.ServerConnector; import com.vaadin.client.UIDL; import com.vaadin.client.VConsole; +import com.vaadin.client.ValueMap; import com.vaadin.client.communication.StateChangeEvent; import com.vaadin.client.communication.StateChangeEvent.StateChangeHandler; import com.vaadin.client.ui.AbstractSingleComponentContainerConnector; @@ -69,6 +70,7 @@ import com.vaadin.shared.communication.MethodInvocation; import com.vaadin.shared.ui.ComponentStateUtil; import com.vaadin.shared.ui.Connect; import com.vaadin.shared.ui.Connect.LoadStyle; +import com.vaadin.shared.ui.ui.DebugWindowClientRpc; import com.vaadin.shared.ui.ui.DebugWindowServerRpc; import com.vaadin.shared.ui.ui.PageClientRpc; import com.vaadin.shared.ui.ui.PageState; @@ -136,6 +138,19 @@ public class UIConnector extends AbstractSingleComponentContainerConnector }); } }); + registerRpc(DebugWindowClientRpc.class, new DebugWindowClientRpc() { + + @Override + public void reportLayoutProblems(String json) { + VConsole.printLayoutProblems(getValueMap(json), getConnection()); + } + + private native ValueMap getValueMap(String json) + /*-{ + return JSON.parse(json); + }-*/; + }); + getWidget().addResizeHandler(new ResizeHandler() { @Override public void onResize(ResizeEvent event) { @@ -663,6 +678,15 @@ public class UIConnector extends AbstractSingleComponentContainerConnector } /** + * Invokes the layout analyzer on the server + * + * @since 7.1 + */ + public void analyzeLayouts() { + getRpcProxy(DebugWindowServerRpc.class).analyzeLayouts(); + } + + /** * Sends a request to the server to print details to console that will help * the developer to locate the corresponding server-side connector in the * source code. |