From da8382d442e82a72f873876329aa2e1dd69b3104 Mon Sep 17 00:00:00 2001 From: Marc Englund Date: Thu, 13 Jun 2013 16:23:13 +0300 Subject: [PATCH] DebugWindow now remembers open tab/section, InfoSection fixed to support being opened at once, for #12058 Change-Id: I5aea59d747d7a94303b691271035e7510b0afc21 --- .../client/debug/internal/InfoSection.java | 37 +++++++++++++++---- .../client/debug/internal/VDebugWindow.java | 10 +++-- 2 files changed, 36 insertions(+), 11 deletions(-) diff --git a/client/src/com/vaadin/client/debug/internal/InfoSection.java b/client/src/com/vaadin/client/debug/internal/InfoSection.java index 05908c8834..865cfac4ff 100644 --- a/client/src/com/vaadin/client/debug/internal/InfoSection.java +++ b/client/src/com/vaadin/client/debug/internal/InfoSection.java @@ -16,12 +16,13 @@ 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 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) { + } /* diff --git a/client/src/com/vaadin/client/debug/internal/VDebugWindow.java b/client/src/com/vaadin/client/debug/internal/VDebugWindow.java index 48d7b9974a..5e146ffda8 100644 --- a/client/src/com/vaadin/client/debug/internal/VDebugWindow.java +++ b/client/src/com/vaadin/client/debug/internal/VDebugWindow.java @@ -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. */ -- 2.39.5