]> source.dussan.org Git - vaadin-framework.git/commitdiff
Window-close XHR moved to onbeforeunload, AbstractApplicationServlet and Communicatio...
authorMarc Englund <marc.englund@itmill.com>
Fri, 28 Aug 2009 14:04:38 +0000 (14:04 +0000)
committerMarc Englund <marc.englund@itmill.com>
Fri, 28 Aug 2009 14:04:38 +0000 (14:04 +0000)
svn changeset:8581/svn branch:6.1

src/com/vaadin/terminal/gwt/client/ui/VView.java
src/com/vaadin/terminal/gwt/server/AbstractApplicationServlet.java
src/com/vaadin/terminal/gwt/server/CommunicationManager.java

index 98b64f7c722f56b28827d5d2aae707d78ddc5ee6..a76f559c3e8dd6e7383449120d6070b8bc999a19 100644 (file)
@@ -461,6 +461,10 @@ public class VView extends SimplePanel implements Container,
      }-*/;
 
     public void onWindowClosed() {
+
+    }
+
+    public String onWindowClosing() {
         // Change focus on this window in order to ensure that all state is
         // collected from textfields
         VTextField.flushChangesFromFocusedTextField();
@@ -468,9 +472,7 @@ public class VView extends SimplePanel implements Container,
         // Send the closing state to server
         connection.updateVariable(id, "close", true, false);
         connection.sendPendingVariableChangesSync();
-    }
 
-    public String onWindowClosing() {
         return null;
     }
 
index 0e1566ad0e2e2fc7f443493dc9694079e3869408..0640477e5c80d47861f23a1a213c759b73016290 100644 (file)
@@ -433,7 +433,8 @@ public abstract class AbstractApplicationServlet extends HttpServlet {
             }
 
             // Finds the window within the application
-            Window window = getApplicationWindow(request, application);
+            Window window = getApplicationWindow(request, applicationManager,
+                    application);
             if (window == null) {
                 throw new ServletException(ERROR_NO_WINDOW_FOUND);
             }
@@ -1803,18 +1804,16 @@ public abstract class AbstractApplicationServlet extends HttpServlet {
      *             servlet's normal operation.
      */
     private Window getApplicationWindow(HttpServletRequest request,
-            Application application) throws ServletException {
-
-        Window window = null;
+            CommunicationManager applicationManager, Application application)
+            throws ServletException {
 
         // Finds the window where the request is handled
+        Window assumedWindow = null;
         String path = getRequestPathInfo(request);
 
         // Main window as the URI is empty
-        if (path == null || path.length() == 0 || path.equals("/")
-                || path.startsWith("/APP/")) {
-            window = application.getMainWindow();
-        } else {
+        if (!(path == null || path.length() == 0 || path.equals("/") || path
+                .startsWith("/APP/"))) {
             String windowName = null;
             if (path.charAt(0) == '/') {
                 path = path.substring(1);
@@ -1825,23 +1824,13 @@ public abstract class AbstractApplicationServlet extends HttpServlet {
                 path = "";
             } else {
                 windowName = path.substring(0, index);
-                path = path.substring(index + 1);
             }
-            window = application.getWindow(windowName);
-
-            if (window == null) {
-                // By default, we use main window
-                window = application.getMainWindow();
-            } else if (!window.isVisible()) {
-                // Implicitly painting without actually invoking paint()
-                window.requestRepaintRequests();
+            assumedWindow = application.getWindow(windowName);
 
-                // If the window is invisible send a blank page
-                return null;
-            }
         }
 
-        return window;
+        return applicationManager.getApplicationWindow(request, this,
+                application, assumedWindow);
     }
 
     String getRequestPathInfo(HttpServletRequest request) {
index 75be657ef07ab86fc02a853899110e48da1036fd..4971db4b8b40450d9facd5353ad87a3be244eef2 100644 (file)
@@ -456,7 +456,7 @@ public class CommunicationManager implements Paintable.RepaintRequestListener,
                         invalidComponentRelativeSizes = ComponentSizeValidator
                                 .validateComponentRelativeSizes(w.getContent(),
                                         null, null);
-                                        
+
                         // Also check any existing subwindows
                         if (w.getChildWindows() != null) {
                             for (Window subWindow : (Set<Window>) w
@@ -1036,7 +1036,7 @@ public class CommunicationManager implements Paintable.RepaintRequestListener,
      *             if an exception has occurred that interferes with the
      *             servlet's normal operation.
      */
-    private Window getApplicationWindow(HttpServletRequest request,
+    Window getApplicationWindow(HttpServletRequest request,
             AbstractApplicationServlet applicationServlet,
             Application application, Window assumedWindow)
             throws ServletException {
@@ -1061,7 +1061,9 @@ public class CommunicationManager implements Paintable.RepaintRequestListener,
 
             // Get the path from URL
             String path = applicationServlet.getRequestPathInfo(request);
-            path = path.substring("/UIDL".length());
+            if (path.startsWith("/UIDL")) {
+                path = path.substring("/UIDL".length());
+            }
 
             // If the path is specified, create name from it
             if (path != null && path.length() > 0 && !path.equals("/")) {