public static class Navigator.PushStateManager extends Object implements NavigationStateManager
NavigationStateManager
using path info, HTML5 push state and
Page.PopStateEvent
s to track views and enable listening to view
changes. This manager can be enabled with UI annotation
PushStateNavigation
.
The part of path after UI's "root path" (UI's path without view
identifier) is used as View
s identifier. The rest of the path
after the view name can be used by the developer for extra parameters for
the View.
This class is mostly for internal use by Navigator, and is only public and static to enable testing.
Constructor and Description |
---|
PushStateManager(UI ui)
Creates a new PushStateManager.
|
Modifier and Type | Method and Description |
---|---|
String |
getState()
Returns the current navigation state including view name and any optional
parameters.
|
void |
setNavigator(Navigator navigator)
Sets the Navigator used with this state manager.
|
void |
setState(String state)
Sets the current navigation state in the location URI or similar
location, including view name and any optional parameters.
|
public PushStateManager(UI ui)
ui
- the UI where the Navigator is attached topublic void setNavigator(Navigator navigator)
NavigationStateManager
navigator.navigateTo(getState())
.
navigator
parameter value could be null if previously set
navigator is destroyed.
This method should only be called by a Navigator.
setNavigator
in interface NavigationStateManager
public String getState()
NavigationStateManager
getState
in interface NavigationStateManager
public void setState(String state)
NavigationStateManager
This method should be only called by a Navigator.
setState
in interface NavigationStateManager
state
- new view and parameter string, not nullCopyright © 2019 Vaadin Ltd. All rights reserved.