]> source.dussan.org Git - vaadin-framework.git/commitdiff
Prevent showing "Session Expired" notification if navigating away (#12298)
authorJohannes Dahlström <johannesd@vaadin.com>
Thu, 7 Nov 2013 17:55:32 +0000 (19:55 +0200)
committerVaadin Code Review <review@vaadin.com>
Fri, 8 Nov 2013 13:59:22 +0000 (13:59 +0000)
Currently only works if navigation initiated via Page.open(url, "_self").
Page.setLocation should be changed in 7.2 to use "_self" as well (#12925)

Change-Id: I56ad66ffbbd1a83b64999307d23028cbd84bb508

client/src/com/vaadin/client/ui/VUI.java
client/src/com/vaadin/client/ui/ui/UIConnector.java

index 4817bf9304067dd261adb5dad7c64066276df198..ba3495743d1fc4c6add4ea753b33ddd946aea983 100644 (file)
@@ -100,9 +100,6 @@ public class VUI extends SimplePanel implements ResizeHandler,
     /** stored height of parent for embedded application auto-resize */
     private int parentHeight;
 
-    /** For internal use only. May be removed or replaced in the future. */
-    public boolean rendering;
-
     /** For internal use only. May be removed or replaced in the future. */
     public boolean immediate;
 
index 8813d7060921b8a110c00584c45c1993d894b677..149d99de17dc5e60ef55ddbbfd9ee45e0fd8491a 100644 (file)
@@ -130,11 +130,16 @@ public class UIConnector extends AbstractSingleComponentContainerConnector
                 Scheduler.get().scheduleDeferred(new ScheduledCommand() {
                     @Override
                     public void execute() {
-                        if (sessionExpired) {
-                            getConnection().showSessionExpiredError(null);
-                        } else {
-                            getState().enabled = false;
-                            updateEnabledState(getState().enabled);
+                        // Only notify user if we're still running and not eg.
+                        // navigating away (#12298)
+                        if (getConnection().isApplicationRunning()) {
+                            if (sessionExpired) {
+                                getConnection().showSessionExpiredError(null);
+                            } else {
+                                getState().enabled = false;
+                                updateEnabledState(getState().enabled);
+                            }
+                            getConnection().setApplicationRunning(false);
                         }
                     }
                 });
@@ -192,7 +197,6 @@ public class UIConnector extends AbstractSingleComponentContainerConnector
     @Override
     public void updateFromUIDL(final UIDL uidl, ApplicationConnection client) {
         ConnectorMap paintableMap = ConnectorMap.get(getConnection());
-        getWidget().rendering = true;
         getWidget().id = getConnectorId();
         boolean firstPaint = getWidget().connection == null;
         getWidget().connection = client;
@@ -285,9 +289,8 @@ public class UIConnector extends AbstractSingleComponentContainerConnector
             childIndex++;
         }
         if (isClosed) {
-            // don't render the content, something else will be opened to this
-            // browser view
-            getWidget().rendering = false;
+            // We're navigating away, so stop the application.
+            client.setApplicationRunning(false);
             return;
         }
 
@@ -397,7 +400,6 @@ public class UIConnector extends AbstractSingleComponentContainerConnector
                 }
             });
         }
-        getWidget().rendering = false;
     }
 
     /**