public class XdevNavigator extends Navigator
The view switching can be based e.g. on URI fragments containing the view name and parameters to the view. There are two types of parameters for views: an optional parameter string that is included in the fragment (may be bookmarkable).
Views can be explicitly registered or dynamically generated and listening to view changes is possible.
Note that XdevNavigator
is not a component itself but uses a
ViewDisplay
to update contents based on the state.
Navigator.ClassBasedViewProvider, Navigator.ComponentContainerViewDisplay, Navigator.EmptyView, Navigator.SingleComponentContainerViewDisplay, Navigator.StaticViewProvider, Navigator.UriFragmentManager
Constructor and Description |
---|
XdevNavigator(UI ui,
ComponentContainer container)
Creates a navigator that is tracking the active view using URI fragments
of the
Page containing the given UI and replacing the contents of
a ComponentContainer with the active view. |
XdevNavigator(UI ui,
NavigationStateManager stateManager,
ViewDisplay display)
Creates a navigator.
|
XdevNavigator(UI ui,
SingleComponentContainer container)
Creates a navigator that is tracking the active view using URI fragments
of the
Page containing the given UI and replacing the contents of
a SingleComponentContainer with the active view. |
XdevNavigator(UI ui,
ViewDisplay display)
Creates a navigator that is tracking the active view using URI fragments
of the
Page containing the given UI. |
Modifier and Type | Method and Description |
---|---|
void |
navigateTo(String navigationState) |
addProvider, addView, addView, addViewChangeListener, destroy, getCurrentView, getDisplay, getState, getUI, removeProvider, removeView, removeViewChangeListener, setErrorProvider, setErrorView, setErrorView
public XdevNavigator(UI ui, ComponentContainer container)
Page
containing the given UI and replacing the contents of
a ComponentContainer
with the active view.
All components of the container are removed each time before adding the
active View
. Views must implement Component
when using
this constructor.
Navigation is automatically initiated after UI.init()
 if a
navigator was created. If at a later point changes are made to the
navigator, navigator.navigateTo(navigator.getState())
may need to
be explicitly called to ensure the current view matches the navigation
state.
ui
- The UI to which this Navigator is attached.container
- The ComponentContainer whose contents should be replaced with
the active view on view changepublic XdevNavigator(UI ui, NavigationStateManager stateManager, ViewDisplay display)
When a custom navigation state manager is not needed, use one of the other constructors which use a URI fragment based state manager.
Navigation is automatically initiated after UI.init()
 if a
navigator was created. If at a later point changes are made to the
navigator, navigator.navigateTo(navigator.getState())
may need to
be explicitly called to ensure the current view matches the navigation
state.
ui
- The UI to which this Navigator is attached.stateManager
- The NavigationStateManager keeping track of the active view
and enabling bookmarking and direct navigationdisplay
- The ViewDisplay used to display the views handled by this
navigatorpublic XdevNavigator(UI ui, SingleComponentContainer container)
Page
containing the given UI and replacing the contents of
a SingleComponentContainer
with the active view.
Views must implement Component
when using this constructor.
Navigation is automatically initiated after UI.init()
 if a
navigator was created. If at a later point changes are made to the
navigator, navigator.navigateTo(navigator.getState())
may need to
be explicitly called to ensure the current view matches the navigation
state.
ui
- The UI to which this Navigator is attached.container
- The SingleComponentContainer whose contents should be replaced
with the active view on view changepublic XdevNavigator(UI ui, ViewDisplay display)
Page
containing the given UI.
Navigation is automatically initiated after UI.init()
 if a
navigator was created. If at a later point changes are made to the
navigator, navigator.navigateTo(navigator.getState())
may need to
be explicitly called to ensure the current view matches the navigation
state.
ui
- The UI to which this Navigator is attached.display
- The ViewDisplay used to display the views.public void navigateTo(String navigationState)
navigateTo
in class Navigator