From 2bb642c779cb6dba9856882de92fec772590135f Mon Sep 17 00:00:00 2001 From: =?utf8?q?Johannes=20Dahlstr=C3=B6m?= Date: Wed, 8 Aug 2012 16:18:03 +0300 Subject: [PATCH] A few improvements to shared state debug console (#8422) --- .../gwt/client/ApplicationConnection.java | 22 ++++++++--------- .../terminal/gwt/client/VUIDLBrowser.java | 24 +++++++------------ 2 files changed, 18 insertions(+), 28 deletions(-) diff --git a/src/com/vaadin/terminal/gwt/client/ApplicationConnection.java b/src/com/vaadin/terminal/gwt/client/ApplicationConnection.java index ce8683ce90..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"; @@ -1162,16 +1160,6 @@ 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 pendingStateChangeEvents = updateConnectorState(json); @@ -1238,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/VUIDLBrowser.java b/src/com/vaadin/terminal/gwt/client/VUIDLBrowser.java index 5b8ba59c79..f7d43a1a12 100644 --- a/src/com/vaadin/terminal/gwt/client/VUIDLBrowser.java +++ b/src/com/vaadin/terminal/gwt/client/VUIDLBrowser.java @@ -56,11 +56,11 @@ public class VUIDLBrowser extends SimpleTree { 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,16 +75,9 @@ public class VUIDLBrowser extends SimpleTree { } } else if (key.equals("meta")) { - } else if (key.equals("hierarchy")) { - ValueMap hierJSON = u.getValueMap(key); - SimpleTree hierarchy = new SimpleTree("Hierarchy"); - for (String hierKey : hierJSON.getKeySet()) { - hierarchy.addItem(hierKey + ": " - + hierJSON.getAsString(hierKey)); - } - add(hierarchy); } else { - // TODO consider pretty printing other request data + // TODO consider pretty printing other request data such as + // hierarchy changes // addItem(key + " : " + u.getAsString(key)); } } @@ -146,10 +139,9 @@ public class VUIDLBrowser extends SimpleTree { this.connectorId = connectorId; ComponentConnector connector = getConnector(); if (connector != null) { - setText(connectorId + " " + connector.getState().getDebugId() - + " " + connector.getClass()); + setText(Util.getConnectorString(connector)); } else { - setText(connectorId + " unknown"); + setText("Unknown connector " + connectorId); } dir(new JSONObject(stateChanges), this); } -- 2.39.5