com.vaadin.navigator.
Class Navigator.ClassBasedViewProvider
- java.lang.Object
-
- com.vaadin.navigator.Navigator.ClassBasedViewProvider
-
All Implemented Interfaces:
Enclosing class:
public static class Navigator.ClassBasedViewProvider extends Object implements ViewProvider
A ViewProvider which maps a single view name to a class to instantiate for the view.
Note that the view class must be accessible by the class loader used by the provider. This may require its visibility to be public.
This class is primarily for internal use by
Navigator
.See Also:
-
-
Constructor Summary
Constructors Constructor Description ClassBasedViewProvider(String viewName, Class<? extends View> viewClass)
Create a new view provider which creates new view instances based on a view class.
-
Method Summary
All Methods Modifier and Type Method Description View
getView(String viewName)
Create or return a pre-created instance of a view.
Class<? extends View>
getViewClass()
Get the view class for this provider.
String
getViewName()
Get the view name for this provider.
String
getViewName(String navigationState)
Extract the view name from a combined view name and parameter string.
-
-
-
Constructor Detail
-
ClassBasedViewProvider
public ClassBasedViewProvider(String viewName, Class<? extends View> viewClass)
Create a new view provider which creates new view instances based on a view class.
Parameters:
viewName
- name of the views to create (not null)viewClass
- class to instantiate when a view is requested (not null)
-
-
Method Detail
-
getViewName
public String getViewName(String navigationState)
Description copied from interface:
ViewProvider
Extract 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:
getViewName
in interfaceViewProvider
Parameters:
navigationState
- string with view name and its fragment parameters (if given), not nullReturns:
view name if the view is handled by this provider, null otherwise
-
getView
public View getView(String viewName)
Description copied from interface:
ViewProvider
Create 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:
getView
in interfaceViewProvider
Parameters:
viewName
- name of the view, not nullReturns:
newly created view (null if none available for the view name)
-
getViewName
public String getViewName()
Get the view name for this provider.
Returns:
view name for this provider
-
-