]> source.dussan.org Git - vaadin-framework.git/commitdiff
DebugWindow now remembers open tab/section, InfoSection fixed to support being opened...
authorMarc Englund <marc@vaadin.com>
Thu, 13 Jun 2013 13:23:13 +0000 (16:23 +0300)
committerVaadin Code Review <review@vaadin.com>
Thu, 13 Jun 2013 15:59:15 +0000 (15:59 +0000)
Change-Id: I5aea59d747d7a94303b691271035e7510b0afc21

client/src/com/vaadin/client/debug/internal/InfoSection.java
client/src/com/vaadin/client/debug/internal/VDebugWindow.java

index 05908c88345e70273350bc63925fb517dc1b4518..865cfac4ff8fce4f1accba5fbbdfa59b5ca81f96 100644 (file)
 
 package com.vaadin.client.debug.internal;
 
+import java.util.List;
 import java.util.logging.Level;
 
 import com.google.gwt.core.client.GWT;
 import com.google.gwt.dom.client.Element;
 import com.google.gwt.user.client.DOM;
-import com.google.gwt.user.client.ui.FlowPanel;
+import com.google.gwt.user.client.Timer;
 import com.google.gwt.user.client.ui.HTML;
 import com.google.gwt.user.client.ui.RootPanel;
 import com.google.gwt.user.client.ui.Widget;
@@ -44,8 +45,16 @@ public class InfoSection implements Section {
             + "-info";
     private static final String ERROR_STYLE = Level.SEVERE.getName();
     private final HTML content = new HTML();
-    private DebugButton tabButton = new DebugButton(Icon.INFO);
-    private FlowPanel controls = new FlowPanel();
+    private DebugButton tabButton = new DebugButton(Icon.INFO,
+            "General information about the application(s)");
+    private HTML controls = new HTML(tabButton.getTitle());
+
+    private Timer refresher = new Timer() {
+        @Override
+        public void run() {
+            refresh();
+        }
+    };
 
     /**
      * 
@@ -73,7 +82,12 @@ public class InfoSection implements Section {
             row.addClassName(className);
         }
         Element span = DOM.createSpan();
-        span.setInnerText(parameter + ": " + value);
+        span.setClassName("caption");
+        span.setInnerText(parameter);
+        row.appendChild(span);
+        span = DOM.createSpan();
+        span.setClassName("value");
+        span.setInnerText(value);
         row.appendChild(span);
         content.getElement().appendChild(row);
 
@@ -126,9 +140,15 @@ public class InfoSection implements Section {
      */
     private void refresh() {
         clear();
-        for (ApplicationConnection application : ApplicationConfiguration
-                .getRunningApplications()) {
-            refresh(application);
+        List<ApplicationConnection> apps = ApplicationConfiguration
+                .getRunningApplications();
+        if (apps.size() == 0) {
+            // try again in a while
+            refresher.schedule(1000);
+        } else {
+            for (ApplicationConnection application : apps) {
+                refresh(application);
+            }
         }
     }
 
@@ -263,7 +283,7 @@ public class InfoSection implements Section {
      */
     @Override
     public void hide() {
-
+        refresher.cancel();
     }
 
     /*
@@ -274,6 +294,7 @@ public class InfoSection implements Section {
      */
     @Override
     public void meta(ApplicationConnection ac, ValueMap meta) {
+
     }
 
     /*
index 48d7b9974aad4f4f37f8b42493d8cad230669fb9..5e146ffda8cb3af1458297c4529a7e53d01007c8 100644 (file)
@@ -324,9 +324,9 @@ public final class VDebugWindow extends VOverlay {
         writeState(storage, STORAGE_MIN_Y, minY);
         writeState(storage, STORAGE_FONT_SIZE, fontSize);
 
-        if (activeSection != null) {
-            writeState(storage, STORAGE_ACTIVE_SECTION,
-                    activeSection.getTabButton());
+        int activeIdx = getActiveSection();
+        if (activeIdx >= 0) {
+            writeState(storage, STORAGE_ACTIVE_SECTION, activeIdx);
         }
 
         writeState(storage, STORAGE_IS_MINIMIZED, minimized);
@@ -581,6 +581,10 @@ public final class VDebugWindow extends VOverlay {
         }
     }
 
+    int getActiveSection() {
+        return sections.indexOf(activeSection);
+    }
+
     /**
      * Toggles the window between minimized and full states.
      */