public class DefaultViewNavigator extends com.vaadin.navigator.Navigator implements ViewNavigatorAdapter
ViewNavigator implementation extending Vaadin default Navigator| Modifier and Type | Class and Description |
|---|---|
static class |
DefaultViewNavigator.ViewNavigatorBuilder
Builder implementation for fluent-style ViewNavigator creation |
com.vaadin.navigator.Navigator.ClassBasedViewProvider, com.vaadin.navigator.Navigator.ComponentContainerViewDisplay, com.vaadin.navigator.Navigator.EmptyView, com.vaadin.navigator.Navigator.PushStateManager, com.vaadin.navigator.Navigator.SingleComponentContainerViewDisplay, com.vaadin.navigator.Navigator.StaticViewProvider, com.vaadin.navigator.Navigator.UriFragmentManagerViewNavigator.Builder, ViewNavigator.NavigationBuilder, ViewNavigator.NavigatorBuilder<B extends ViewNavigator.NavigatorBuilder<B>>, ViewNavigator.ViewNavigationException, ViewNavigator.ViewNavigatorChangeEventCONTEXT_KEY, VIEW_URI_SCHEME| Constructor and Description |
|---|
DefaultViewNavigator()
Default construtor.
|
DefaultViewNavigator(com.vaadin.ui.UI ui,
com.vaadin.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. |
DefaultViewNavigator(com.vaadin.ui.UI ui,
com.vaadin.navigator.NavigationStateManager stateManager,
com.vaadin.navigator.ViewDisplay display)
Creates a navigator.
|
DefaultViewNavigator(com.vaadin.ui.UI ui,
com.vaadin.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. |
DefaultViewNavigator(com.vaadin.ui.UI ui,
com.vaadin.navigator.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 |
addProvider(com.vaadin.navigator.ViewProvider provider) |
NavigatorActuator<?> |
getActuator()
Get the NavigatorActuator associated to this adapter
|
String |
getCurrentViewName()
Get current (active) view name in navigator
|
String |
getDefaultViewName()
Get default view name
|
ViewConfiguration |
getViewConfiguration(Class<? extends com.vaadin.navigator.View> viewClass)
Get
ViewConfiguration associated to given view class |
boolean |
navigateBack()
Navigates back to previous
View, if any. |
com.vaadin.ui.Window |
navigateInWindow(String viewName,
Consumer<ViewWindowConfigurator> windowConfiguration,
Map<String,Object> parameters)
Navigate to the
View identified by given viewName using the same behaviour of
ViewNavigator.navigateTo(String, Map) but rendering the View contents in an application Window, using optional
windowConfiguration to setup Window features. |
void |
navigateTo(String navigationState)
Navigates to the
View identified by given viewName. |
void |
navigateTo(String viewName,
Map<String,Object> parameters)
Navigates to the
View identified by given viewName using given parameters, if
any, and linking them to View fields using ViewParameter annotated view class fields. |
void |
navigateToDefault()
Navigates to the default View
|
void |
navigateToState(String navigationState)
Navigates to a view and initialize the view with given parameters.
|
void |
navigateToView(com.vaadin.navigator.View view,
String viewName,
String parameters)
Navigate to given View
|
void |
removeProvider(com.vaadin.navigator.ViewProvider provider) |
void |
setDefaultViewName(String defaultViewName)
Set the default view name.
|
void |
setup(com.vaadin.ui.UI ui,
com.vaadin.navigator.NavigationStateManager stateManager,
com.vaadin.navigator.ViewDisplay display)
Init navigator.
|
void |
setViewClassProvider(com.vaadin.navigator.ViewProvider provider,
ViewClassProvider viewClassProvider)
Set the
ViewClassProvider bound to given ViewProvider. |
void |
updateCurrentNavigationState(com.vaadin.navigator.ViewChangeListener.ViewChangeEvent event)
Update current navigation state relying in given View change event
|
addView, addView, addViewChangeListener, destroy, getCurrentNavigationState, getCurrentView, getDisplay, getState, getStateParameterMap, getStateParameterMap, getUI, removeView, removeViewChangeListener, runAfterLeaveConfirmation, setErrorProvider, setErrorView, setErrorViewequals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitaddViewChangeListener, builder, getCurrent, getCurrentView, navigateInWindow, navigateInWindow, navigateInWindow, require, runAfterLeaveConfirmation, toViewpublic DefaultViewNavigator(com.vaadin.ui.UI ui,
com.vaadin.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.
ui - The UI to which this Navigator is attached.container - The ComponentContainer whose contents should be replaced with the active view on view changepublic DefaultViewNavigator(com.vaadin.ui.UI ui,
com.vaadin.ui.SingleComponentContainer container)
Page containing the given
UI and replacing the contents of a SingleComponentContainer with the active view.ui - The UI to which this Navigator is attached.container - The SingleComponentContainer whose contents should be replaced with the active view on view
changepublic DefaultViewNavigator(com.vaadin.ui.UI ui,
com.vaadin.navigator.ViewDisplay display)
Page containing the given
UI.ui - The UI to which this Navigator is attached.display - The ViewDisplay used to display the views.public DefaultViewNavigator(com.vaadin.ui.UI ui,
com.vaadin.navigator.NavigationStateManager stateManager,
com.vaadin.navigator.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.
ui - The UI to which this Navigator is attached.stateManager - The NavigationStateManager keeping track of the active view and enabling bookmarking and
direct navigation or null to use the default implementationdisplay - The ViewDisplay used to display the views handled by this navigatorpublic DefaultViewNavigator()
With this constructor, init(UI, NavigationStateManager, ViewDisplay) method is not called, since
navigator initialization is delegated to subclasses.
public NavigatorActuator<?> getActuator()
ViewNavigatorAdaptergetActuator in interface ViewNavigatorAdapterpublic void setup(com.vaadin.ui.UI ui,
com.vaadin.navigator.NavigationStateManager stateManager,
com.vaadin.navigator.ViewDisplay display)
ViewNavigatorAdaptersetup in interface ViewNavigatorAdapterui - UIstateManager - NavigationStateManagerdisplay - View displaypublic void updateCurrentNavigationState(com.vaadin.navigator.ViewChangeListener.ViewChangeEvent event)
ViewNavigatorAdapterupdateCurrentNavigationState in interface ViewNavigatorAdapterevent - View change eventpublic void navigateToState(String navigationState)
ViewNavigator
The navigationState string consists of a view name optionally followed by a slash and a parameters
part that is passed as-is to the view. ViewProviders are used to find and create the correct type of view.
If multiple providers return a matching view, the view with the longest name is selected. This way, e.g. hierarchies of subviews can be registered like "admin/", "admin/users", "admin/settings" and the longest match is used.
If the view being deactivated indicates it wants a confirmation for the navigation operation, the user is asked for the confirmation.
Registered ViewChangeListeners are called upon successful view change.
navigateToState in interface ViewNavigatornavigationState - View name and parameterspublic void navigateToView(com.vaadin.navigator.View view,
String viewName,
String parameters)
ViewNavigatorAdapternavigateToView in interface ViewNavigatorAdapterview - View instanceviewName - View nameparameters - View parameterspublic void addProvider(com.vaadin.navigator.ViewProvider provider)
addProvider in class com.vaadin.navigator.Navigatorpublic void removeProvider(com.vaadin.navigator.ViewProvider provider)
removeProvider in class com.vaadin.navigator.Navigatorpublic void setViewClassProvider(com.vaadin.navigator.ViewProvider provider,
ViewClassProvider viewClassProvider)
ViewNavigatorAdapterViewClassProvider bound to given ViewProvider.setViewClassProvider in interface ViewNavigatorAdapterprovider - View provider (not null)viewClassProvider - View class providerpublic void navigateTo(String navigationState)
ViewNavigatorView identified by given viewName.
If the view being deactivated indicates it wants a confirmation for the navigation operation, the user is asked for the confirmation.
Registered ViewChangeListeners are called upon successful view change.
navigateTo in interface ViewNavigatornavigateTo in class com.vaadin.navigator.NavigatornavigationState - View namepublic void navigateTo(String viewName, Map<String,Object> parameters) throws ViewNavigator.ViewNavigationException
ViewNavigatorView identified by given viewName using given parameters, if
any, and linking them to View fields using ViewParameter annotated view class fields.
If the view being deactivated indicates it wants a confirmation for the navigation operation, the user is asked for the confirmation.
Registered ViewChangeListeners are called upon successful view change.
navigateTo in interface ViewNavigatorviewName - View nameparameters - Optional view parametersViewNavigator.ViewNavigationException - View with given name cannot be found or other view handling errorpublic com.vaadin.ui.Window navigateInWindow(String viewName, Consumer<ViewWindowConfigurator> windowConfiguration, Map<String,Object> parameters) throws ViewNavigator.ViewNavigationException
ViewNavigatorView identified by given viewName using the same behaviour of
ViewNavigator.navigateTo(String, Map) but rendering the View contents in an application Window, using optional
windowConfiguration to setup Window features.navigateInWindow in interface ViewNavigatorviewName - View namewindowConfiguration - View window configurator to setup the view Windowparameters - Optional view parametersViewNavigator.ViewNavigationException - View with given name cannot be found or other view handling errorpublic boolean navigateBack()
throws ViewNavigator.ViewNavigationException
ViewNavigatorView, if any. In no previous View is available and a default view is defined,
navigator will navigate to the default view.navigateBack in interface ViewNavigatortrue if a previous view in navigation history, or the default view, was available and back
navigation succeededViewNavigator.ViewNavigationException - View handling errorpublic void navigateToDefault()
throws ViewNavigator.ViewNavigationException
ViewNavigatornavigateToDefault in interface ViewNavigatorViewNavigator.ViewNavigationException - If no default View is available or other view handling errorpublic String getDefaultViewName()
ViewNavigatorgetDefaultViewName in interface ViewNavigatornull if not definedpublic void setDefaultViewName(String defaultViewName)
View with given defaultViewName is valid and provided by
registered ViewProviders, it is used as target of ViewNavigator.navigateToDefault() method and as a
fallback by ViewNavigator.navigateBack() method if no other View is available in history.defaultViewName - the default view name to setpublic String getCurrentViewName()
ViewNavigatorgetCurrentViewName in interface ViewNavigatornull if no view is currently active in navigatorpublic ViewConfiguration getViewConfiguration(Class<? extends com.vaadin.navigator.View> viewClass)
ViewConfiguration.ViewConfigurationProviderViewConfiguration associated to given view class
This method is intended for internal use only.
getViewConfiguration in interface ViewConfiguration.ViewConfigurationProviderviewClass - View classnull if not availableCopyright © 2019 The Holon Platform. All rights reserved.