From 0a2cf2c429fca3be697dcf37d386a4607d4bdbc3 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Johannes=20Dahlstr=C3=B6m?= Date: Thu, 7 Nov 2013 19:55:32 +0200 Subject: [PATCH] Prevent showing "Session Expired" notification if navigating away (#12298) 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 | 3 --- .../com/vaadin/client/ui/ui/UIConnector.java | 22 ++++++++++--------- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/client/src/com/vaadin/client/ui/VUI.java b/client/src/com/vaadin/client/ui/VUI.java index 4817bf9304..ba3495743d 100644 --- a/client/src/com/vaadin/client/ui/VUI.java +++ b/client/src/com/vaadin/client/ui/VUI.java @@ -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; diff --git a/client/src/com/vaadin/client/ui/ui/UIConnector.java b/client/src/com/vaadin/client/ui/ui/UIConnector.java index 8813d70609..149d99de17 100644 --- a/client/src/com/vaadin/client/ui/ui/UIConnector.java +++ b/client/src/com/vaadin/client/ui/ui/UIConnector.java @@ -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; } /** -- 2.39.5