summaryrefslogtreecommitdiffstats
path: root/src/com/vaadin/terminal/gwt
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/vaadin/terminal/gwt')
-rw-r--r--src/com/vaadin/terminal/gwt/client/ApplicationConnection.java20
-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.java74
-rw-r--r--src/com/vaadin/terminal/gwt/client/extensions/AbstractExtensionConnector.java13
-rw-r--r--src/com/vaadin/terminal/gwt/server/BootstrapHandler.java2
8 files changed, 62 insertions, 59 deletions
diff --git a/src/com/vaadin/terminal/gwt/client/ApplicationConnection.java b/src/com/vaadin/terminal/gwt/client/ApplicationConnection.java
index fb7af1404c..d757bf89a2 100644
--- a/src/com/vaadin/terminal/gwt/client/ApplicationConnection.java
+++ b/src/com/vaadin/terminal/gwt/client/ApplicationConnection.java
@@ -147,8 +147,6 @@ public class ApplicationConnection {
*/
public static final String UIDL_REFRESH_TOKEN = "Vaadin-Refresh";
- private final boolean debugLogging = true || false;
-
// will hold the UIDL security key (for XSS protection) once received
private String uidlSecurityKey = "init";
@@ -1106,14 +1104,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
@@ -1236,6 +1226,16 @@ public class ApplicationConnection {
updateDuration
.logDuration(" * Layout processing completed", 10);
+ if (ApplicationConfiguration.isDebugMode()) {
+ VConsole.log(" * Dumping state changes to the console");
+ VConsole.dirUIDL(json, ApplicationConnection.this);
+
+ updateDuration
+ .logDuration(
+ " * Dumping state changes to the console completed",
+ 10);
+ }
+
if (meta != null) {
if (meta.containsKey("appError")) {
ValueMap error = meta.getValueMap("appError");
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..f7d43a1a12 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,13 +55,12 @@ 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");
+ SimpleTree stateChanges = new SimpleTree("shared state");
- for (String stateKey : stateJson.getKeySet()) {
- stateChanges.add(new SharedStateItem(stateKey, stateJson
- .getValueMap(stateKey)));
+ for (String connectorId : stateJson.getKeySet()) {
+ stateChanges.add(new SharedStateItem(connectorId, stateJson
+ .getValueMap(connectorId)));
}
add(stateChanges);
@@ -75,14 +69,15 @@ 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);
}
} else if (key.equals("meta")) {
} else {
- // TODO consider pretty printing other request data
+ // TODO consider pretty printing other request data such as
+ // hierarchy changes
// addItem(key + " : " + u.getAsString(key));
}
}
@@ -120,19 +115,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 +137,12 @@ public class VUIDLBrowser extends SimpleTree {
SharedStateItem(String connectorId, ValueMap stateChanges) {
this.connectorId = connectorId;
- setText(connectorId);
+ ComponentConnector connector = getConnector();
+ if (connector != null) {
+ setText(Util.getConnectorString(connector));
+ } else {
+ setText("Unknown connector " + connectorId);
+ }
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());
}
diff --git a/src/com/vaadin/terminal/gwt/client/extensions/AbstractExtensionConnector.java b/src/com/vaadin/terminal/gwt/client/extensions/AbstractExtensionConnector.java
index bcefcf05cb..408f03f6cb 100644
--- a/src/com/vaadin/terminal/gwt/client/extensions/AbstractExtensionConnector.java
+++ b/src/com/vaadin/terminal/gwt/client/extensions/AbstractExtensionConnector.java
@@ -8,17 +8,26 @@ import com.vaadin.terminal.gwt.client.ServerConnector;
import com.vaadin.terminal.gwt.client.ui.AbstractConnector;
public abstract class AbstractExtensionConnector extends AbstractConnector {
+ boolean hasBeenAttached = false;
+
@Override
public void setParent(ServerConnector parent) {
ServerConnector oldParent = getParent();
- if (oldParent != null && oldParent != parent) {
+ if (oldParent == parent) {
+ // Nothing to do
+ return;
+ }
+ if (hasBeenAttached && parent != null) {
throw new IllegalStateException(
"An extension can not be moved from one parent to another.");
}
super.setParent(parent);
- extend(parent);
+ if (parent != null) {
+ extend(parent);
+ hasBeenAttached = true;
+ }
}
protected void extend(ServerConnector target) {
diff --git a/src/com/vaadin/terminal/gwt/server/BootstrapHandler.java b/src/com/vaadin/terminal/gwt/server/BootstrapHandler.java
index d025e93072..64d0e0bf4b 100644
--- a/src/com/vaadin/terminal/gwt/server/BootstrapHandler.java
+++ b/src/com/vaadin/terminal/gwt/server/BootstrapHandler.java
@@ -560,7 +560,7 @@ public abstract class BootstrapHandler implements RequestHandler {
// + "DTD/xhtml1-transitional.dtd\">\n");
Document document = context.getBootstrapResponse().getDocument();
DocumentType doctype = new DocumentType("html",
- "//W3C//DTD XHTML 1.0 Transitional//EN",
+ "-//W3C//DTD XHTML 1.0 Transitional//EN",
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd",
document.baseUri());
document.child(0).before(doctype);