diff options
author | Leif Åstrand <leif@vaadin.com> | 2012-10-24 12:36:49 +0000 |
---|---|---|
committer | Vaadin Code Review <review@vaadin.com> | 2012-10-24 12:36:49 +0000 |
commit | 1622ae59a84d4cf44601b45f56346f45921a1bf9 (patch) | |
tree | d09922bc153d5dab3b9a873dee396de8c831f50a /client | |
parent | ebe89817d7318eb9451e97f4e216645507bb9797 (diff) | |
parent | 0bbd4c528a22bfab211e46330d1019712adb658e (diff) | |
download | vaadin-framework-1622ae59a84d4cf44601b45f56346f45921a1bf9.tar.gz vaadin-framework-1622ae59a84d4cf44601b45f56346f45921a1bf9.zip |
Merge "Properly support extension connectors in debug console (#8422, #9999) * Clicking an ExtensionConnector entry highlights their ancestor ComponentConnector if any * Shift-clicking also works, change server side highlighting to support arbitrary ClientConnectors"
Diffstat (limited to 'client')
-rw-r--r-- | client/src/com/vaadin/client/ApplicationConnection.java | 11 | ||||
-rw-r--r-- | client/src/com/vaadin/client/VDebugConsole.java | 2 | ||||
-rw-r--r-- | client/src/com/vaadin/client/VUIDLBrowser.java | 36 |
3 files changed, 27 insertions, 22 deletions
diff --git a/client/src/com/vaadin/client/ApplicationConnection.java b/client/src/com/vaadin/client/ApplicationConnection.java index 05ee63a7d5..9442198772 100644 --- a/client/src/com/vaadin/client/ApplicationConnection.java +++ b/client/src/com/vaadin/client/ApplicationConnection.java @@ -579,13 +579,14 @@ public class ApplicationConnection { /** * Sends a request to the server to print details to console that will help - * developer to locate component in the source code. + * the developer to locate the corresponding server-side connector in the + * source code. * - * @param componentConnector + * @param serverConnector */ - void highlightComponent(ComponentConnector componentConnector) { - String params = getRepaintAllParameters() + "&highlightComponent=" - + componentConnector.getConnectorId(); + void highlightConnector(ServerConnector serverConnector) { + String params = getRepaintAllParameters() + "&highlightConnector=" + + serverConnector.getConnectorId(); makeUidlRequest("", params, false); } diff --git a/client/src/com/vaadin/client/VDebugConsole.java b/client/src/com/vaadin/client/VDebugConsole.java index 331073cd90..0d1c6d89f6 100644 --- a/client/src/com/vaadin/client/VDebugConsole.java +++ b/client/src/com/vaadin/client/VDebugConsole.java @@ -153,7 +153,7 @@ public class VDebugConsole extends VOverlay implements Console { } if (paintable != null) { - a.highlightComponent(paintable); + a.highlightConnector(paintable); return; } } diff --git a/client/src/com/vaadin/client/VUIDLBrowser.java b/client/src/com/vaadin/client/VUIDLBrowser.java index 4f165d6233..6f393b0bb0 100644 --- a/client/src/com/vaadin/client/VUIDLBrowser.java +++ b/client/src/com/vaadin/client/VUIDLBrowser.java @@ -40,7 +40,6 @@ import com.google.gwt.user.client.ui.RootPanel; import com.google.gwt.user.client.ui.Widget; import com.vaadin.client.ui.UnknownComponentConnector; import com.vaadin.client.ui.window.VWindow; -import com.vaadin.shared.Connector; /** * TODO Rename to something more Vaadin7-ish? @@ -115,10 +114,22 @@ public class VUIDLBrowser extends SimpleTree { @Override protected void select(ClickEvent event) { - ComponentConnector connector = getConnector(); - highlight(connector); - if (event != null && event.getNativeEvent().getShiftKey()) { - connector.getConnection().highlightComponent(connector); + ServerConnector connector = getConnector(); + + if (connector != null && event != null + && event.getNativeEvent().getShiftKey()) { + connector.getConnection().highlightConnector(connector); + } + + // For connectors that do not have a widget, highlight the widget of + // their ancestor component connector if any + while (connector != null + && !(connector instanceof ComponentConnector)) { + connector = connector.getParent(); + } + if (connector != null) { + ComponentConnector cc = (ComponentConnector) connector; + highlight(cc); } super.select(event); } @@ -126,15 +137,8 @@ public class VUIDLBrowser extends SimpleTree { /** * Returns the Connector associated with this state change. */ - protected ComponentConnector getConnector() { - Connector connector = client.getConnectorMap().getConnector( - getConnectorId()); - - if (connector instanceof ComponentConnector) { - return (ComponentConnector) connector; - } else { - return null; - } + protected ServerConnector getConnector() { + return client.getConnectorMap().getConnector(getConnectorId()); } protected abstract String getConnectorId(); @@ -149,11 +153,11 @@ public class VUIDLBrowser extends SimpleTree { SharedStateItem(String connectorId, ValueMap stateChanges) { this.connectorId = connectorId; - ComponentConnector connector = getConnector(); + ServerConnector connector = getConnector(); if (connector != null) { setText(Util.getConnectorString(connector)); } else { - setText("Unknown connector " + connectorId); + setText("Unknown connector (" + connectorId + ")"); } dir(new JSONObject(stateChanges), this); } |