com.vaadin.spring.navigator
Class SpringViewProvider

java.lang.Object
  extended by com.vaadin.spring.navigator.SpringViewProvider
All Implemented Interfaces:
com.vaadin.navigator.ViewProvider, Serializable

public class SpringViewProvider
extends Object
implements com.vaadin.navigator.ViewProvider

A Vaadin ViewProvider that fetches the views from the Spring application context. The views must implement the View interface and be annotated with the SpringView annotation.

Use like this:

 @SpringUI
 public class MyUI extends UI {

     @Autowired
     SpringViewProvider viewProvider;

     protected void init(VaadinRequest vaadinRequest) {
         Navigator navigator = new Navigator(this, this);
         navigator.addProvider(viewProvider);
         setNavigator(navigator);
         // ...
     }
 }
 
View-based security can be provided by creating a Spring bean that implements the interface ViewAccessControl (for view bean name and annotation based security) or ViewInstanceAccessControl (if view instance specific contextual data is needed). It is also possible to set an 'Access Denied' view by using setAccessDeniedViewClass(Class).

Author:
Petter Holmström (petter@vaadin.com), Henri Sara (hesara@vaadin.com)
See Also:
SpringView, Serialized Form

Constructor Summary
SpringViewProvider(org.springframework.context.ApplicationContext applicationContext, org.springframework.beans.factory.support.BeanDefinitionRegistry beanDefinitionRegistry)
           
 
Method Summary
 Class<? extends com.vaadin.navigator.View> getAccessDeniedViewClass()
          Returns the class of the access denied view.
 com.vaadin.navigator.View getView(String viewName)
           
 String getViewName(String viewAndParameters)
           
protected  String getViewNameFromAnnotation(Class<?> beanClass, SpringView annotation)
           
 void setAccessDeniedViewClass(Class<? extends com.vaadin.navigator.View> accessDeniedViewClass)
          Sets the class of the access denied view.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SpringViewProvider

@Autowired
public SpringViewProvider(org.springframework.context.ApplicationContext applicationContext,
                                    org.springframework.beans.factory.support.BeanDefinitionRegistry beanDefinitionRegistry)
Method Detail

getAccessDeniedViewClass

public Class<? extends com.vaadin.navigator.View> getAccessDeniedViewClass()
Returns the class of the access denied view. If set, a bean of this type will be fetched from the application context and showed to the user when a ViewAccessControl or a ViewInstanceAccessControl denies access to a view.

Returns:
the access denied view class, or null if not set.

setAccessDeniedViewClass

public void setAccessDeniedViewClass(Class<? extends com.vaadin.navigator.View> accessDeniedViewClass)
Sets the class of the access denied view. If set, a bean of this type will be fetched from the application context and showed to the user when a ViewAccessControl or a ViewInstanceAccessControl denies access to a view.

Parameters:
accessDeniedViewClass - the access denied view class, may be null.

getViewNameFromAnnotation

protected String getViewNameFromAnnotation(Class<?> beanClass,
                                           SpringView annotation)

getViewName

public String getViewName(String viewAndParameters)
Specified by:
getViewName in interface com.vaadin.navigator.ViewProvider

getView

public com.vaadin.navigator.View getView(String viewName)
Specified by:
getView in interface com.vaadin.navigator.ViewProvider


Copyright © 2015 Vaadin Ltd. All Rights Reserved.