com.vaadin.navigator
Class Navigator.StaticViewProvider

java.lang.Object
  extended by com.vaadin.navigator.Navigator.StaticViewProvider
All Implemented Interfaces:
ViewProvider, Serializable
Enclosing class:
Navigator

public static class Navigator.StaticViewProvider
extends Object
implements ViewProvider

View provider 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
Navigator.StaticViewProvider(String viewName, View view)
          Create a new view provider which returns a pre-created view instance.
 
Method Summary
 View getView(String viewName)
          Create or return a pre-created instance of a view.
 String getViewName()
          Get the view name for this provider.
 String getViewName(String viewAndParameters)
          Extract the view name from a combined view name and parameter string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Navigator.StaticViewProvider

public Navigator.StaticViewProvider(String viewName,
                                    View view)
Create 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 String getViewName(String viewAndParameters)
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 interface ViewProvider
Parameters:
viewAndParameters - 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(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 interface ViewProvider
Parameters:
viewName - name of the view, not null
Returns:
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


Copyright © 2000-2011 Vaadin Ltd. All Rights Reserved.