]> source.dussan.org Git - vaadin-framework.git/commitdiff
Initial support for showing state changes in the debug console (#8422)
authorJohannes Dahlström <johannesd@vaadin.com>
Wed, 18 Jul 2012 15:41:14 +0000 (18:41 +0300)
committerJohannes Dahlström <johannesd@vaadin.com>
Wed, 18 Jul 2012 15:41:14 +0000 (18:41 +0300)
src/com/vaadin/terminal/gwt/client/ApplicationConnection.java
src/com/vaadin/terminal/gwt/client/VUIDLBrowser.java

index 52b83a6e6769f9c99ed00ecdaadc750286022b8c..5db7221bdbea13e5a1cc239f4ab38bf9fcd8af06 100644 (file)
@@ -136,7 +136,7 @@ public class ApplicationConnection {
      */
     public static final String UIDL_REFRESH_TOKEN = "Vaadin-Refresh";
 
-    private final boolean debugLogging = false;
+    private final boolean debugLogging = true || false;
 
     // will hold the UIDL security key (for XSS protection) once received
     private String uidlSecurityKey = "init";
@@ -543,11 +543,13 @@ public class ApplicationConnection {
             final boolean synchronous) {
         if (!synchronous) {
             RequestCallback requestCallback = new RequestCallback() {
+                @Override
                 public void onError(Request request, Throwable exception) {
                     showCommunicationError(exception.getMessage(), -1);
                     endRequest();
                 }
 
+                @Override
                 public void onResponseReceived(Request request,
                         Response response) {
                     VConsole.log("Server visit took "
@@ -873,6 +875,7 @@ public class ApplicationConnection {
         }
         // deferring to avoid flickering
         Scheduler.get().scheduleDeferred(new Command() {
+            @Override
             public void execute() {
                 if (!hasActiveRequest()) {
                     hideLoadingIndicator();
@@ -1090,6 +1093,7 @@ public class ApplicationConnection {
         }
 
         Command c = new Command() {
+            @Override
             public void execute() {
                 handleUIDLDuration.logDuration(" * Loading widgets completed",
                         10);
@@ -1627,10 +1631,12 @@ public class ApplicationConnection {
     private void loadStyleDependencies(JsArrayString dependencies) {
         // Assuming no reason to interpret in a defined order
         ResourceLoadListener resourceLoadListener = new ResourceLoadListener() {
+            @Override
             public void onLoad(ResourceLoadEvent event) {
                 ApplicationConfiguration.endDependencyLoading();
             }
 
+            @Override
             public void onError(ResourceLoadEvent event) {
                 VConsole.error(event.getResourceUrl()
                         + " could not be loaded, or the load detection failed because the stylesheet is empty.");
@@ -1653,6 +1659,7 @@ public class ApplicationConnection {
 
         // Listener that loads the next when one is completed
         ResourceLoadListener resourceLoadListener = new ResourceLoadListener() {
+            @Override
             public void onLoad(ResourceLoadEvent event) {
                 if (dependencies.length() != 0) {
                     String url = translateVaadinUri(dependencies.shift());
@@ -1664,6 +1671,7 @@ public class ApplicationConnection {
                 ApplicationConfiguration.endDependencyLoading();
             }
 
+            @Override
             public void onError(ResourceLoadEvent event) {
                 VConsole.error(event.getResourceUrl() + " could not be loaded.");
                 // The show must go on
@@ -1743,6 +1751,7 @@ public class ApplicationConnection {
     }
 
     private final ScheduledCommand sendPendingCommand = new ScheduledCommand() {
+        @Override
         public void execute() {
             deferedSendPending = false;
             doSendPendingVariableChanges();
@@ -2322,6 +2331,7 @@ public class ApplicationConnection {
             this.url = url;
         }
 
+        @Override
         public void notificationHidden(HideEvent event) {
             redirect(url);
         }
index 4230eda2982fab14300a2776177496daea5978e3..5aceb15bfad85ae9bcdf08ab477b9962fd871352 100644 (file)
@@ -22,6 +22,7 @@ import com.google.gwt.dom.client.Style.Unit;
 import com.google.gwt.event.dom.client.ClickEvent;
 import com.google.gwt.event.dom.client.MouseOutEvent;
 import com.google.gwt.event.dom.client.MouseOutHandler;
+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.terminal.gwt.client.ui.UnknownComponentConnector;
@@ -47,9 +48,22 @@ public class VUIDLBrowser extends SimpleTree {
         Set<String> keySet = u.getKeySet();
         for (String key : keySet) {
             if (key.equals("state")) {
-                // TODO print updated shared states
+
+                ValueMap stateJson = u.getValueMap(key);
+
+                for (String stateKey : stateJson.getKeySet()) {
+                    ValueMap valuesJson = stateJson.getValueMap(stateKey);
+
+                    SimpleTree values = new SimpleTree("state pid=" + stateKey);
+                    for (String valueKey : valuesJson.getKeySet()) {
+                        values.add(new HTML(valueKey + "="
+                                + valuesJson.getAsString(valueKey)));
+                    }
+                    add(values);
+                }
+
             } else if (key.equals("changes")) {
-                JsArray<UIDL> jsValueMapArray = u.getJSValueMapArray("changes")
+                JsArray<UIDL> jsValueMapArray = u.getJSValueMapArray(key)
                         .cast();
                 for (int i = 0; i < jsValueMapArray.length(); i++) {
                     UIDL uidl = jsValueMapArray.get(i);
@@ -89,6 +103,7 @@ public class VUIDLBrowser extends SimpleTree {
             }
 
             addDomHandler(new MouseOutHandler() {
+                @Override
                 public void onMouseOut(MouseOutEvent event) {
                     deHiglight();
                 }
@@ -218,6 +233,7 @@ public class VUIDLBrowser extends SimpleTree {
             if (highlightedPid != null && highlightedPid.equals(uidl.getId())) {
                 getElement().getStyle().setBackgroundColor("#fdd");
                 Scheduler.get().scheduleDeferred(new ScheduledCommand() {
+                    @Override
                     public void execute() {
                         getElement().scrollIntoView();
                     }