]> source.dussan.org Git - vaadin-framework.git/commitdiff
A few improvements to shared state debug console (#8422)
authorJohannes Dahlström <johannesd@vaadin.com>
Wed, 8 Aug 2012 13:18:03 +0000 (16:18 +0300)
committerJohannes Dahlström <johannesd@vaadin.com>
Fri, 10 Aug 2012 11:39:42 +0000 (14:39 +0300)
src/com/vaadin/terminal/gwt/client/ApplicationConnection.java
src/com/vaadin/terminal/gwt/client/VUIDLBrowser.java

index ce8683ce909a6901e8f8910b28bf0c94890f7981..d757bf89a289c1e12a6cd8d9a5986620c9ec1297 100644 (file)
@@ -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<StateChangeEvent> 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");
index 5b8ba59c791092c3dc66af2df8c1bc8db7e179f1..f7d43a1a12923cae79c985ce64f27a9db77cb4f0 100644 (file)
@@ -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);
         }