]> source.dussan.org Git - vaadin-framework.git/commitdiff
Mainwindow (and theoretically other windows) can now be changed; fixes #1450
authorMarc Englund <marc.englund@itmill.com>
Fri, 7 Mar 2008 14:03:56 +0000 (14:03 +0000)
committerMarc Englund <marc.englund@itmill.com>
Fri, 7 Mar 2008 14:03:56 +0000 (14:03 +0000)
svn changeset:4003/svn branch:trunk

src/com/itmill/toolkit/terminal/gwt/client/ApplicationConnection.java
src/com/itmill/toolkit/terminal/gwt/server/CommunicationManager.java

index 6e00355d6e5d8c996c7eeffd8e6dfcd0d0493ef1..0b15fb6036a5f2cb00d9abf04621237ccf952fb1 100755 (executable)
@@ -378,6 +378,16 @@ public class ApplicationConnection {
             }
         }
 
+        JSONObject meta = null;
+        if (((JSONObject) json).containsKey("meta")) {
+            meta = ((JSONObject) json).get("meta").isObject();
+            if (meta.containsKey("repaintAll")) {
+                view.clear();
+                idToPaintable.clear();
+                paintableToId.clear();
+            }
+        }
+
         // Process changes
         final JSONArray changes = (JSONArray) ((JSONObject) json)
                 .get("changes");
@@ -411,8 +421,7 @@ public class ApplicationConnection {
             }
         }
 
-        if (((JSONObject) json).containsKey("meta")) {
-            final JSONObject meta = ((JSONObject) json).get("meta").isObject();
+        if (meta != null) {
             if (meta.containsKey("focus")) {
                 final String focusPid = meta.get("focus").isString()
                         .stringValue();
index 6c90cd24fc8ecaeb5205f8cdf003e0e905470e53..70e85f0e280f66a5c7609b3aba72c08caa2174d3 100644 (file)
@@ -256,6 +256,13 @@ public class CommunicationManager implements Paintable.RepaintRequestListener {
 
                 outWriter.print("\"changes\":[");
 
+                // re-get mainwindow - may have been changed
+                Window newWindow = getApplicationWindow(request, application);
+                if (newWindow != window) {
+                    window = newWindow;
+                    repaintAll = true;
+                }
+
                 JsonPaintTarget paintTarget = new JsonPaintTarget(this,
                         outWriter, !repaintAll);
 
@@ -347,7 +354,12 @@ public class CommunicationManager implements Paintable.RepaintRequestListener {
                 outWriter.print("]"); // close changes
 
                 outWriter.print(", \"meta\" : {");
-                final boolean metaOpen = false;
+                boolean metaOpen = false;
+
+                if (repaintAll) {
+                    metaOpen = true;
+                    outWriter.write("\"repaintAll\":true");
+                }
 
                 // add meta instruction for client to set focus if it is set
                 final Paintable f = (Paintable) application.consumeFocus();