]> source.dussan.org Git - vaadin-framework.git/commitdiff
Rewrote "criticalError"
authorMatti Tahvonen <matti.tahvonen@itmill.com>
Mon, 10 Dec 2007 10:09:10 +0000 (10:09 +0000)
committerMatti Tahvonen <matti.tahvonen@itmill.com>
Mon, 10 Dec 2007 10:09:10 +0000 (10:09 +0000)
svn changeset:3194/svn branch:trunk

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

index f7e72d13625f4f5bb5a2cf5fe0247caab6bacd1c..e04ddc6ae94905565213b15e626f1955caa1b26d 100755 (executable)
@@ -28,6 +28,7 @@ import com.google.gwt.user.client.ui.HasWidgets;
 import com.google.gwt.user.client.ui.Widget;
 import com.itmill.toolkit.terminal.gwt.client.ui.ContextMenu;
 import com.itmill.toolkit.terminal.gwt.client.ui.IView;
+import com.itmill.toolkit.terminal.gwt.client.ui.Notification;
 
 /**
  * Entry point classes define <code>onModuleLoad()</code>.
@@ -278,6 +279,14 @@ public class ApplicationConnection {
                     toBeFocusedWidget.setFocus(true);
                 }
             }
+            if (meta.containsKey("appError")) {
+                JSONObject error = meta.get("appError").isObject();
+                String caption = error.get("caption").isString().stringValue();
+                String message = error.get("message").isString().stringValue();
+                String html = "<h1>" + caption + "</h1><p>" + message + "</p>";
+                new Notification(Notification.DELAY_FOREVER).show(html,
+                        Notification.CENTERED, "error");
+            }
         }
 
         final long prosessingTime = (new Date().getTime()) - start.getTime();
index a01d3819edb0452cea8a7c3581d8870954c91afe..c3dea9111cdf13b5ff3c6650806b83d8143ddf2c 100644 (file)
@@ -314,7 +314,6 @@ public class ApplicationServlet extends HttpServlet {
         Application application = null;
         boolean UIDLrequest = false;
         try {
-
             // handle file upload if multipart request
             if (ServletFileUpload.isMultipartContent(request)) {
                 application = getExistingApplication(request, response);
@@ -535,23 +534,15 @@ public class ApplicationServlet extends HttpServlet {
         final ServletOutputStream out = response.getOutputStream();
         final PrintWriter outWriter = new PrintWriter(new BufferedWriter(
                 new OutputStreamWriter(out, "UTF-8")));
-        // TODO review: assuming that required widgets exists and using
-        // hardcoded: PID0, name: 0
-        outWriter.print(")/*{\"changes\":[[\"change\",{\"format\": \"uidl\""
-                + ",\"pid\": \"PID0\"},[\"window\",{\"id\": \"PID0\","
-                + "\"caption\": \"Session expired\",\"name\": \"0\","
-                + "\"theme\": \"\",\"main\":true,\"v\":{\"scrollleft\":0"
-                + ",\"scrolldown\":0,\"positionx\":-1,\"positiony\":-1,"
-                + "\"scrolltop\":0,\"scrollleft\":0,\"close\":false,"
-                + "\"focused\":\"\"}},[\"orderedlayout\",{\"id\": "
-                + "\"PID1\",\"cached\":true}],[\"notifications\",{},"
-                + "[\"notification\",{\"caption\": \"" + caption
-                + "\",\"message\": \"<br />Please click " + "<a href=\\\""
-                + appUrl + "\\\">here</a> to restart your application.<br />"
-                + "You can also click your browser's"
-                + " refresh button.<br />\","
-                + "\"position\":1,\"delay\":-1,\"style\": \"error\"}]]]]],"
-                + " \"meta\" : {}, \"resources\": {}, \"locales\":[]");
+        outWriter
+                .print(")/*{\"changes\":[], \"meta\" : {"
+                        + "\"appError\": {"
+                        + "\"caption\":\""
+                        + caption
+                        + "\","
+                        + "\"message\" : \"Please click <a href=\\\"\\\" onclick=\\\"Javascript: window.location.reload()\\\" >here</a> to restart your application.<br />"
+                        + "You can also click your browser's refresh button.\""
+                        + "}}, \"resources\": {}, \"locales\":[]");
         outWriter.flush();
         outWriter.close();
         out.flush();