summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohannes Dahlström <johannesd@vaadin.com>2012-07-23 14:40:00 +0300
committerJohannes Dahlström <johannesd@vaadin.com>2012-08-10 14:39:42 +0300
commit6fa6a21224e71a2e8ab52ee7066d87a8876d23d5 (patch)
tree75361ef16b57ccc967ad40b0247bebd2f9b9568a
parentfc94542099faad5bc4f7bb00bd468f69cacc6a14 (diff)
downloadvaadin-framework-6fa6a21224e71a2e8ab52ee7066d87a8876d23d5.tar.gz
vaadin-framework-6fa6a21224e71a2e8ab52ee7066d87a8876d23d5.zip
Pass ApplicationConnection, not ApplicationConfiguration, to VUIDLBrowser
-rw-r--r--src/com/vaadin/terminal/gwt/client/ApplicationConnection.java18
-rw-r--r--src/com/vaadin/terminal/gwt/client/Console.java2
-rw-r--r--src/com/vaadin/terminal/gwt/client/NullConsole.java2
-rw-r--r--src/com/vaadin/terminal/gwt/client/VConsole.java4
-rw-r--r--src/com/vaadin/terminal/gwt/client/VDebugConsole.java4
-rw-r--r--src/com/vaadin/terminal/gwt/client/VUIDLBrowser.java64
6 files changed, 45 insertions, 49 deletions
diff --git a/src/com/vaadin/terminal/gwt/client/ApplicationConnection.java b/src/com/vaadin/terminal/gwt/client/ApplicationConnection.java
index fb7af1404c..ce8683ce90 100644
--- a/src/com/vaadin/terminal/gwt/client/ApplicationConnection.java
+++ b/src/com/vaadin/terminal/gwt/client/ApplicationConnection.java
@@ -1106,14 +1106,6 @@ public class ApplicationConnection {
MultiStepDuration updateDuration = new MultiStepDuration();
- if (debugLogging) {
- VConsole.log(" * Dumping UIDL to the console");
- VConsole.dirUIDL(json, configuration);
-
- updateDuration.logDuration(
- " * Dumping UIDL to the console completed", 10);
- }
-
if (json.containsKey("locales")) {
VConsole.log(" * Handling locales");
// Store locale data
@@ -1170,6 +1162,16 @@ public class ApplicationConnection {
updateDuration.logDuration(" * Creating connectors completed",
10);
+ if (debugLogging) {
+ VConsole.log(" * Dumping state changes to the console");
+ VConsole.dirUIDL(json, ApplicationConnection.this);
+
+ updateDuration
+ .logDuration(
+ " * Dumping state changes to the console completed",
+ 10);
+ }
+
// Update states, do not fire events
Collection<StateChangeEvent> pendingStateChangeEvents = updateConnectorState(json);
diff --git a/src/com/vaadin/terminal/gwt/client/Console.java b/src/com/vaadin/terminal/gwt/client/Console.java
index 8db145342a..64b2646201 100644
--- a/src/com/vaadin/terminal/gwt/client/Console.java
+++ b/src/com/vaadin/terminal/gwt/client/Console.java
@@ -18,7 +18,7 @@ public interface Console {
public abstract void printObject(Object msg);
- public abstract void dirUIDL(ValueMap u, ApplicationConfiguration cnf);
+ public abstract void dirUIDL(ValueMap u, ApplicationConnection client);
public abstract void printLayoutProblems(ValueMap meta,
ApplicationConnection applicationConnection,
diff --git a/src/com/vaadin/terminal/gwt/client/NullConsole.java b/src/com/vaadin/terminal/gwt/client/NullConsole.java
index 7db513ca82..aba301d18d 100644
--- a/src/com/vaadin/terminal/gwt/client/NullConsole.java
+++ b/src/com/vaadin/terminal/gwt/client/NullConsole.java
@@ -16,7 +16,7 @@ import com.google.gwt.core.client.GWT;
public class NullConsole implements Console {
@Override
- public void dirUIDL(ValueMap u, ApplicationConfiguration cnf) {
+ public void dirUIDL(ValueMap u, ApplicationConnection conn) {
}
@Override
diff --git a/src/com/vaadin/terminal/gwt/client/VConsole.java b/src/com/vaadin/terminal/gwt/client/VConsole.java
index a221b42d67..02fc61626d 100644
--- a/src/com/vaadin/terminal/gwt/client/VConsole.java
+++ b/src/com/vaadin/terminal/gwt/client/VConsole.java
@@ -86,9 +86,9 @@ public class VConsole {
}
}
- public static void dirUIDL(ValueMap u, ApplicationConfiguration cnf) {
+ public static void dirUIDL(ValueMap u, ApplicationConnection client) {
if (impl != null) {
- impl.dirUIDL(u, cnf);
+ impl.dirUIDL(u, client);
}
}
diff --git a/src/com/vaadin/terminal/gwt/client/VDebugConsole.java b/src/com/vaadin/terminal/gwt/client/VDebugConsole.java
index a7bd943912..5753e032d4 100644
--- a/src/com/vaadin/terminal/gwt/client/VDebugConsole.java
+++ b/src/com/vaadin/terminal/gwt/client/VDebugConsole.java
@@ -492,9 +492,9 @@ public class VDebugConsole extends VOverlay implements Console {
* .terminal.gwt.client.UIDL)
*/
@Override
- public void dirUIDL(ValueMap u, ApplicationConfiguration conf) {
+ public void dirUIDL(ValueMap u, ApplicationConnection client) {
if (panel.isAttached()) {
- VUIDLBrowser vuidlBrowser = new VUIDLBrowser(u, conf);
+ VUIDLBrowser vuidlBrowser = new VUIDLBrowser(u, client);
vuidlBrowser.setText("Response:");
panel.add(vuidlBrowser);
}
diff --git a/src/com/vaadin/terminal/gwt/client/VUIDLBrowser.java b/src/com/vaadin/terminal/gwt/client/VUIDLBrowser.java
index 745d66c444..2d853a7a0c 100644
--- a/src/com/vaadin/terminal/gwt/client/VUIDLBrowser.java
+++ b/src/com/vaadin/terminal/gwt/client/VUIDLBrowser.java
@@ -7,7 +7,6 @@
package com.vaadin.terminal.gwt.client;
import java.util.Iterator;
-import java.util.List;
import java.util.Set;
import com.google.gwt.core.client.JsArray;
@@ -25,9 +24,9 @@ import com.google.gwt.event.dom.client.MouseOutHandler;
import com.google.gwt.json.client.JSONArray;
import com.google.gwt.json.client.JSONObject;
import com.google.gwt.json.client.JSONValue;
-import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.user.client.ui.Widget;
+import com.vaadin.shared.Connector;
import com.vaadin.terminal.gwt.client.ui.UnknownComponentConnector;
import com.vaadin.terminal.gwt.client.ui.window.VWindow;
@@ -38,21 +37,17 @@ public class VUIDLBrowser extends SimpleTree {
private static final String HELP = "Shift click handle to open recursively. "
+ " Click components to highlight them on client side."
+ " Shift click components to highlight them also on the server side.";
- private ApplicationConfiguration conf;
+ private ApplicationConnection client;
private String highlightedPid;
- /**
- * TODO Should probably take ApplicationConnection instead of
- * ApplicationConfiguration
- */
- public VUIDLBrowser(final UIDL uidl, ApplicationConfiguration conf) {
- this.conf = conf;
- final UIDLItem root = new UIDLItem(uidl, conf);
+ public VUIDLBrowser(final UIDL uidl, ApplicationConnection client) {
+ this.client = client;
+ final UIDLItem root = new UIDLItem(uidl);
add(root);
}
- public VUIDLBrowser(ValueMap u, ApplicationConfiguration conf) {
- this.conf = conf;
+ public VUIDLBrowser(ValueMap u, ApplicationConnection client) {
+ this.client = client;
ValueMap valueMap = u.getValueMap("meta");
if (valueMap.containsKey("hl")) {
highlightedPid = valueMap.getString("hl");
@@ -60,7 +55,6 @@ public class VUIDLBrowser extends SimpleTree {
Set<String> keySet = u.getKeySet();
for (String key : keySet) {
if (key.equals("state")) {
-
ValueMap stateJson = u.getValueMap(key);
SimpleTree stateChanges = new SimpleTree("Shared state");
@@ -75,7 +69,7 @@ public class VUIDLBrowser extends SimpleTree {
.cast();
for (int i = 0; i < jsValueMapArray.length(); i++) {
UIDL uidl = jsValueMapArray.get(i);
- UIDLItem change = new UIDLItem(uidl, conf);
+ UIDLItem change = new UIDLItem(uidl);
change.setTitle("change " + i);
add(change);
}
@@ -120,19 +114,14 @@ public class VUIDLBrowser extends SimpleTree {
* Returns the Connector associated with this state change.
*/
protected ComponentConnector getConnector() {
- List<ApplicationConnection> runningApplications = ApplicationConfiguration
- .getRunningApplications();
-
- // TODO this does not work properly with multiple application on
- // same host page
- for (ApplicationConnection applicationConnection : runningApplications) {
- ServerConnector connector = ConnectorMap.get(
- applicationConnection).getConnector(getConnectorId());
- if (connector instanceof ComponentConnector) {
- return (ComponentConnector) connector;
- }
+ Connector connector = client.getConnectorMap().getConnector(
+ getConnectorId());
+
+ if (connector instanceof ComponentConnector) {
+ return (ComponentConnector) connector;
+ } else {
+ return null;
}
- return new UnknownComponentConnector();
}
protected abstract String getConnectorId();
@@ -147,7 +136,13 @@ public class VUIDLBrowser extends SimpleTree {
SharedStateItem(String connectorId, ValueMap stateChanges) {
this.connectorId = connectorId;
- setText(connectorId);
+ ComponentConnector connector = getConnector();
+ if (connector != null) {
+ setText(connectorId + " " + connector.getState().getDebugId()
+ + " " + connector.getClass());
+ } else {
+ setText(connectorId + " unknown");
+ }
dir(new JSONObject(stateChanges), this);
}
@@ -166,7 +161,7 @@ public class VUIDLBrowser extends SimpleTree {
dir(value.isArray(), subtree);
tree.add(subtree);
} else {
- tree.add(new HTML(key + "=" + value));
+ tree.addItem(key + "=" + value);
}
}
@@ -190,12 +185,13 @@ public class VUIDLBrowser extends SimpleTree {
private UIDL uidl;
- UIDLItem(UIDL uidl, ApplicationConfiguration conf) {
+ UIDLItem(UIDL uidl) {
this.uidl = uidl;
try {
String name = uidl.getTag();
try {
- name = getNodeName(uidl, conf, Integer.parseInt(name));
+ name = getNodeName(uidl, client.getConfiguration(),
+ Integer.parseInt(name));
} catch (Exception e) {
// NOP
}
@@ -238,7 +234,8 @@ public class VUIDLBrowser extends SimpleTree {
String nodeName = uidl.getTag();
try {
- nodeName = getNodeName(uidl, conf, Integer.parseInt(nodeName));
+ nodeName = getNodeName(uidl, client.getConfiguration(),
+ Integer.parseInt(nodeName));
} catch (Exception e) {
// NOP
}
@@ -302,10 +299,7 @@ public class VUIDLBrowser extends SimpleTree {
while (i.hasNext()) {
final Object child = i.next();
try {
- final UIDL c = (UIDL) child;
- final UIDLItem childItem = new UIDLItem(c, conf);
- add(childItem);
-
+ add(new UIDLItem((UIDL) child));
} catch (final Exception e) {
addItem(child.toString());
}