]> source.dussan.org Git - vaadin-framework.git/commitdiff
client now don't make requests if expired or crashed application
authorMatti Tahvonen <matti.tahvonen@itmill.com>
Tue, 18 Dec 2007 11:11:57 +0000 (11:11 +0000)
committerMatti Tahvonen <matti.tahvonen@itmill.com>
Tue, 18 Dec 2007 11:11:57 +0000 (11:11 +0000)
svn changeset:3255/svn branch:trunk

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

index 5499924f023af47140cfcbe3f23067334ae8c657..26809b4a15ca23e12e214b09f35eebae6f96a45c 100755 (executable)
@@ -58,6 +58,8 @@ public class ApplicationConnection {
 
     private final IView view;
 
+    private boolean applicationRunning = false;
+
     /**
      * True if each Paintable objects id is injected to DOM. Used for Testing
      * Tools.
@@ -82,6 +84,7 @@ public class ApplicationConnection {
         }
 
         makeUidlRequest("repaintAll=1");
+        applicationRunning = true;
 
         // TODO remove hardcoded id name
         view = new IView("itmill-ajax-window");
@@ -329,6 +332,7 @@ public class ApplicationConnection {
                 String html = "<h1>" + caption + "</h1><p>" + message + "</p>";
                 new Notification(Notification.DELAY_FOREVER).show(html,
                         Notification.CENTERED, "error");
+                applicationRunning = false;
             }
         }
 
@@ -400,18 +404,20 @@ public class ApplicationConnection {
     }
 
     public void sendPendingVariableChanges() {
-        final StringBuffer req = new StringBuffer();
+        if (applicationRunning) {
+            final StringBuffer req = new StringBuffer();
 
-        req.append("changes=");
-        for (int i = 0; i < pendingVariables.size(); i++) {
-            if (i > 0) {
-                req.append("\u0001");
+            req.append("changes=");
+            for (int i = 0; i < pendingVariables.size(); i++) {
+                if (i > 0) {
+                    req.append("\u0001");
+                }
+                req.append(pendingVariables.get(i));
             }
-            req.append(pendingVariables.get(i));
-        }
 
-        pendingVariables.clear();
-        makeUidlRequest(req.toString());
+            pendingVariables.clear();
+            makeUidlRequest(req.toString());
+        }
     }
 
     private static native String escapeString(String value)