com.vaadin.server
Class AbstractUIProvider

java.lang.Object
  extended by com.vaadin.server.AbstractUIProvider
All Implemented Interfaces:
UIProvider
Direct Known Subclasses:
DefaultUIProvider, LegacyApplication

public abstract class AbstractUIProvider
extends java.lang.Object
implements UIProvider


Constructor Summary
AbstractUIProvider()
           
 
Method Summary
 UI createInstance(WrappedRequest request, java.lang.Class<? extends UI> type)
           
protected static
<T extends java.lang.annotation.Annotation>
T
getAnnotationFor(java.lang.Class<?> type, java.lang.Class<T> annotationType)
          Helper to get an annotation for a class.
 UI getExistingUI(WrappedRequest request)
          Finds an existing UI for a request.
 java.lang.String getPageTitle(WrappedRequest request, java.lang.Class<? extends UI> uiClass)
           
 java.lang.String getTheme(WrappedRequest request, java.lang.Class<? extends UI> uiClass)
          Finds the theme to use for a specific UI.
 java.lang.String getWidgetset(WrappedRequest request, java.lang.Class<? extends UI> uiClass)
          Finds the widgetset to use for a specific UI.
 boolean isPreservedOnRefresh(WrappedRequest request, java.lang.Class<? extends UI> uiClass)
          Checks whether the same UI state should be reused if the framework can detect that the application is opened in a browser window where it has previously been open.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.vaadin.server.UIProvider
getUIClass
 

Constructor Detail

AbstractUIProvider

public AbstractUIProvider()
Method Detail

createInstance

public UI createInstance(WrappedRequest request,
                         java.lang.Class<? extends UI> type)
Specified by:
createInstance in interface UIProvider

getAnnotationFor

protected static <T extends java.lang.annotation.Annotation> T getAnnotationFor(java.lang.Class<?> type,
                                                                                java.lang.Class<T> annotationType)
Helper to get an annotation for a class. If the annotation is not present on the target class, it's superclasses and implemented interfaces are also searched for the annotation.

Parameters:
type - the target class from which the annotation should be found
annotationType - the annotation type to look for
Returns:
an annotation of the given type, or null if the annotation is not present on the class

getTheme

public java.lang.String getTheme(WrappedRequest request,
                                 java.lang.Class<? extends UI> uiClass)
Description copied from interface: UIProvider
Finds the theme to use for a specific UI. If no specific theme is required, null is returned. TODO Tell what the default implementation does once it does something.

Specified by:
getTheme in interface UIProvider
Returns:
the name of the theme, or null if the default theme should be used

getWidgetset

public java.lang.String getWidgetset(WrappedRequest request,
                                     java.lang.Class<? extends UI> uiClass)
Description copied from interface: UIProvider
Finds the widgetset to use for a specific UI. If no specific widgetset is required, null is returned.

The default implementation uses the @Widgetset annotation if it's defined for the UI class.

Specified by:
getWidgetset in interface UIProvider
Parameters:
request - the wrapped request for which to get a widgetset
uiClass - the UI class to get a widgetset for
Returns:
the name of the widgetset, or null if the default widgetset should be used

isPreservedOnRefresh

public boolean isPreservedOnRefresh(WrappedRequest request,
                                    java.lang.Class<? extends UI> uiClass)
Description copied from interface: UIProvider
Checks whether the same UI state should be reused if the framework can detect that the application is opened in a browser window where it has previously been open. The framework attempts to discover this by checking the value of window.name in the browser.

Specified by:
isPreservedOnRefresh in interface UIProvider
Returns:
trueif the same UI instance should be reused e.g. when the browser window is refreshed.

getPageTitle

public java.lang.String getPageTitle(WrappedRequest request,
                                     java.lang.Class<? extends UI> uiClass)
Specified by:
getPageTitle in interface UIProvider

getExistingUI

public UI getExistingUI(WrappedRequest request)
Description copied from interface: UIProvider
Finds an existing UI for a request.

Implementations should take care to not return an UI instance that might be used in some other browser as that might cause synchronization issues when changes from one browser window are not present in the other.

If no UI provider returns an existing UI, the framework does also check the window.name for an existing instance with UIProvider.isPreservedOnRefresh(WrappedRequest, Class) before falling back to bootstrapping and creating a new UI instance.

Specified by:
getExistingUI in interface UIProvider
Parameters:
request - the request for which a UI is desired
Returns:
a UI belonging to the request, or null if this UI provider doesn't have an existing UI for the request.


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