public static class Navigator.UriFragmentManager extends Object implements NavigationStateManager, Page.UriFragmentChangedListener
NavigationStateManager using hashbang fragments in the Page
location URI to track views and enable listening to view changes.
A hashbang URI is one where the optional fragment or "hash" part - the part following a # sign - is used to encode navigation state in a web application. The advantage of this is that the fragment can be dynamically manipulated by javascript without causing page reloads.
This class is mostly for internal use by Navigator, and is only public and static to enable testing.
| Constructor and Description |
|---|
UriFragmentManager(Page page)
Creates a new URIFragmentManager and attach it to listen to URI
fragment changes of a
Page. |
| Modifier and Type | Method and Description |
|---|---|
protected String |
getFragment()
Returns the current URI fragment tracked by this UriFragentManager.
|
String |
getState()
Returns the current navigation state including view name and any optional
parameters.
|
protected void |
setFragment(String fragment)
Sets the URI fragment to the given string.
|
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.
|
void |
uriFragmentChanged(Page.UriFragmentChangedEvent event)
Event handler method invoked when the URI fragment of the page
changes.
|
public void setNavigator(Navigator navigator)
NavigationStateManagernavigator.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 NavigationStateManagerpublic String getState()
NavigationStateManagergetState in interface NavigationStateManagerpublic void setState(String state)
NavigationStateManagerThis method should be only called by a Navigator.
setState in interface NavigationStateManagerpublic void uriFragmentChanged(Page.UriFragmentChangedEvent event)
Page.UriFragmentChangedListenerUI.init(VaadinRequest).uriFragmentChanged in interface Page.UriFragmentChangedListenerevent - the URI fragment changed eventPage.addUriFragmentChangedListener(UriFragmentChangedListener)protected String getFragment()
protected void setFragment(String fragment)
fragment - The new URI fragment.Copyright © 2016 Vaadin Ltd. All rights reserved.