summaryrefslogtreecommitdiffstats
path: root/server/src
diff options
context:
space:
mode:
Diffstat (limited to 'server/src')
-rw-r--r--server/src/com/vaadin/navigator/NavigationStateManager.java2
-rw-r--r--server/src/com/vaadin/navigator/Navigator.java15
2 files changed, 16 insertions, 1 deletions
diff --git a/server/src/com/vaadin/navigator/NavigationStateManager.java b/server/src/com/vaadin/navigator/NavigationStateManager.java
index d454d044cb..3e9c54c961 100644
--- a/server/src/com/vaadin/navigator/NavigationStateManager.java
+++ b/server/src/com/vaadin/navigator/NavigationStateManager.java
@@ -56,6 +56,8 @@ public interface NavigationStateManager extends Serializable {
* Sets the Navigator used with this state manager. The state manager should
* notify the provided navigator of user-triggered navigation state changes
* by invoking <code>navigator.navigateTo(getState())</code>.
+ * {@code navigator} parameter value could be null if previously set
+ * navigator is destroyed.
* <p>
* This method should only be called by a Navigator.
*/
diff --git a/server/src/com/vaadin/navigator/Navigator.java b/server/src/com/vaadin/navigator/Navigator.java
index fa587a2eaa..82e8de920a 100644
--- a/server/src/com/vaadin/navigator/Navigator.java
+++ b/server/src/com/vaadin/navigator/Navigator.java
@@ -113,11 +113,15 @@ public class Navigator implements Serializable {
*/
public UriFragmentManager(Page page) {
this.page = page;
- page.addUriFragmentChangedListener(this);
}
@Override
public void setNavigator(Navigator navigator) {
+ if (this.navigator == null && navigator != null) {
+ page.addUriFragmentChangedListener(this);
+ } else if (this.navigator != null && navigator == null) {
+ page.removeUriFragmentChangedListener(this);
+ }
this.navigator = navigator;
}
@@ -980,4 +984,13 @@ public class Navigator implements Serializable {
public void removeViewChangeListener(ViewChangeListener listener) {
listeners.remove(listener);
}
+
+ /**
+ * Destroys the navigator and cleans it up. The method detaches the
+ * navigator from UI and removes all view change listeners.
+ */
+ public void destroy() {
+ stateManager.setNavigator(null);
+ ui.setNavigator(null);
+ }
}