Package com.vaadin.navigator
Class Navigator.StaticViewProvider
- java.lang.Object
-
- com.vaadin.navigator.Navigator.StaticViewProvider
-
- All Implemented Interfaces:
ViewProvider,java.io.Serializable
- Enclosing class:
- Navigator
public static class Navigator.StaticViewProvider extends java.lang.Object implements ViewProvider
A ViewProvider which supports mapping a single view name to a single pre-initialized view instance. For most cases, ClassBasedViewProvider should be used instead of this.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description StaticViewProvider(java.lang.String viewName, View view)Creates a new view provider which returns a pre-created view instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ViewgetView(java.lang.String viewName)Create or return a pre-created instance of a view.java.lang.StringgetViewName()Get the view name for this provider.java.lang.StringgetViewName(java.lang.String navigationState)Extract the view name from a combined view name and parameter string.
-
-
-
Constructor Detail
-
StaticViewProvider
public StaticViewProvider(java.lang.String viewName, View view)Creates a new view provider which returns a pre-created view instance.- Parameters:
viewName- name of the view (not null)view- view instance to return (not null), reused on every request
-
-
Method Detail
-
getViewName
public java.lang.String getViewName(java.lang.String navigationState)
Description copied from interface:ViewProviderExtract the view name from a combined view name and parameter string. This method should return a view name if and only if this provider handles creation of such views.- Specified by:
getViewNamein interfaceViewProvider- Parameters:
navigationState- string with view name and its fragment parameters (if given), not null- Returns:
- view name if the view is handled by this provider, null otherwise
-
getView
public View getView(java.lang.String viewName)
Description copied from interface:ViewProviderCreate or return a pre-created instance of a view. The parameters for the view are set separately by the navigator when the view is activated.- Specified by:
getViewin interfaceViewProvider- Parameters:
viewName- name of the view, not null- Returns:
- newly created view (null if none available for the view name)
-
getViewName
public java.lang.String getViewName()
Get the view name for this provider.- Returns:
- view name for this provider
-
-