summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJohannes Dahlström <johannesd@vaadin.com>2012-07-18 18:41:14 +0300
committerJohannes Dahlström <johannesd@vaadin.com>2012-07-18 18:41:14 +0300
commite814541d8cf5647ab47cc9f8495c84f5ddef2aa1 (patch)
treeef63837e9c4e7cd3873ac3db7623417cfee18d15 /src
parent25f664f993a1eb936cb516f1b748773b9b4d5239 (diff)
downloadvaadin-framework-e814541d8cf5647ab47cc9f8495c84f5ddef2aa1.tar.gz
vaadin-framework-e814541d8cf5647ab47cc9f8495c84f5ddef2aa1.zip
Initial support for showing state changes in the debug console (#8422)
Diffstat (limited to 'src')
-rw-r--r--src/com/vaadin/terminal/gwt/client/ApplicationConnection.java12
-rw-r--r--src/com/vaadin/terminal/gwt/client/VUIDLBrowser.java20
2 files changed, 29 insertions, 3 deletions
diff --git a/src/com/vaadin/terminal/gwt/client/ApplicationConnection.java b/src/com/vaadin/terminal/gwt/client/ApplicationConnection.java
index 52b83a6e67..5db7221bdb 100644
--- a/src/com/vaadin/terminal/gwt/client/ApplicationConnection.java
+++ b/src/com/vaadin/terminal/gwt/client/ApplicationConnection.java
@@ -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);
}
diff --git a/src/com/vaadin/terminal/gwt/client/VUIDLBrowser.java b/src/com/vaadin/terminal/gwt/client/VUIDLBrowser.java
index 4230eda298..5aceb15bfa 100644
--- a/src/com/vaadin/terminal/gwt/client/VUIDLBrowser.java
+++ b/src/com/vaadin/terminal/gwt/client/VUIDLBrowser.java
@@ -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();
}