com.vaadin
Class Application.LegacyApplication

java.lang.Object
  extended by com.vaadin.Application
      extended by com.vaadin.Application.LegacyApplication
All Implemented Interfaces:
Terminal.ErrorListener, Serializable
Enclosing class:
Application

Deprecated. This class is only intended to ease migration and should not be used for new projects.

@Deprecated
public static class Application.LegacyApplication
extends Application

A special application designed to help migrating applications from Vaadin 6 to Vaadin 7. The legacy application supports setting a main window, adding additional browser level windows and defining the theme for the entire application.

Since:
7.0
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class com.vaadin.Application
Application.ApplicationError, Application.ApplicationStartEvent, Application.CustomizedSystemMessages, Application.LegacyApplication, Application.SystemMessages, Application.UserChangeEvent, Application.UserChangeListener, Application.WindowAttachEvent, Application.WindowAttachListener, Application.WindowDetachEvent, Application.WindowDetachListener
 
Field Summary
 
Fields inherited from class com.vaadin.Application
ROOT_PARAMETER
 
Constructor Summary
Application.LegacyApplication()
          Deprecated.  
 
Method Summary
 void addWindow(Root.LegacyWindow root)
          Deprecated. Adds a new browser level window to this application.
 Root.LegacyWindow getMainWindow()
          Deprecated. Gets the mainWindow of the application.
 Root.LegacyWindow getRoot(WrappedRequest request)
          Deprecated. This implementation simulates the way of finding a window for a request by extracting a window name from the requested path and passes that name to getWindow(String).
 String getTheme()
          Deprecated. Gets the application's theme.
 String getThemeForRoot(Root root)
          Deprecated. This implementation returns the theme that has been set using setTheme(String)
 Root.LegacyWindow getWindow(String name)
          Deprecated.  Gets a root by name.
 Collection<Root.LegacyWindow> getWindows()
          Deprecated. Gets the set of windows contained by the application.
 void removeWindow(Root.LegacyWindow root)
          Deprecated. Removes the specified window from the application.
 void setMainWindow(Root.LegacyWindow mainWindow)
          Deprecated. Sets the main window of this application.
 void setTheme(String theme)
          Deprecated. Sets the application's theme.
 
Methods inherited from class com.vaadin.Application
addListener, addRequestHandler, addResource, close, createConnectorId, getContext, getConverterFactory, getCurrent, getErrorHandler, getLocale, getLogoutURL, getProperty, getPropertyNames, getRelativeLocation, getRequestHandlers, getResource, getRootById, getRootClassName, getRootForRequest, getRoots, getSystemMessages, getURL, getUser, getVersion, getWidgetsetForRoot, handleRequest, init, isProductionMode, isRootInitPending, isRootPreserved, isRunning, removeListener, removeRequestHandler, removeResource, setConverterFactory, setCurrent, setErrorHandler, setLocale, setLogoutURL, setRootPreserved, setUser, start, terminalError
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Application.LegacyApplication

public Application.LegacyApplication()
Deprecated. 
Method Detail

setMainWindow

public void setMainWindow(Root.LegacyWindow mainWindow)
Deprecated. 
Sets the main window of this application. Setting window as a main window of this application also adds the window to this application.

Parameters:
mainWindow - the root to set as the default window

getMainWindow

public Root.LegacyWindow getMainWindow()
Deprecated. 
Gets the mainWindow of the application.

The main window is the window attached to the application URL ( Application.getURL()) and thus which is show by default to the user.

Note that each application must have at least one main window.

Returns:
the root used as the default window

getRoot

public Root.LegacyWindow getRoot(WrappedRequest request)
Deprecated. 
This implementation simulates the way of finding a window for a request by extracting a window name from the requested path and passes that name to getWindow(String). Gets a root for a request for which no root is already known. This method is called when the framework processes a request that does not originate from an existing root instance. This typically happens when a host page is requested.

Subclasses of Application may override this method to provide custom logic for choosing how to create a suitable root or for picking an already created root. If an existing root is picked, care should be taken to avoid keeping the same root open in multiple browser windows, as that will cause the states to go out of sync.

If WrappedRequest.BrowserDetails are required to create a Root, the implementation can throw a RootRequiresMoreInformationException exception. In this case, the framework will instruct the browser to send the additional details, whereupon this method is invoked again with the browser details present in the wrapped request. Throwing the exception if the browser details are already available is not supported.

The default implementation in Application.LegacyApplication creates a new instance of the Root class returned by Application.getRootClassName(WrappedRequest), which in turn uses the "root" parameter from web.xml. If DeploymentConfiguration.getClassLoader() for the request returns a ClassLoader, it is used for loading the Root class. Otherwise the ClassLoader used to load this class is used.

Overrides:
getRoot in class Application
Parameters:
request - the wrapped request for which a root is needed
Returns:
a root instance to use for the request
See Also:
getWindow(String), Application.getRoot(WrappedRequest)

setTheme

public void setTheme(String theme)
Deprecated. 
Sets the application's theme.

Note that this theme can be overridden for a specific root with Application.getThemeForRoot(Root). Setting theme to be null selects the default theme. For the available theme names, see the contents of the VAADIN/themes directory.

Parameters:
theme - the new theme for this application.

getTheme

public String getTheme()
Deprecated. 
Gets the application's theme. The application's theme is the default theme used by all the roots for which a theme is not explicitly defined. If the application theme is not explicitly set, null is returned.

Returns:
the name of the application's theme.

getThemeForRoot

public String getThemeForRoot(Root root)
Deprecated. 
This implementation returns the theme that has been set using setTheme(String)

Finds the theme to use for a specific root. If no specific theme is required, null is returned. TODO Tell what the default implementation does once it does something.

Overrides:
getThemeForRoot in class Application
Parameters:
root - the root to get a theme for
Returns:
the name of the theme, or null if the default theme should be used

getWindow

public Root.LegacyWindow getWindow(String name)
Deprecated. 

Gets a root by name. Returns null if the application is not running or it does not contain a window corresponding to the name.

Parameters:
name - the name of the requested window
Returns:
a root corresponding to the name, or null to use the default window

addWindow

public void addWindow(Root.LegacyWindow root)
Deprecated. 
Adds a new browser level window to this application. Please note that Root doesn't have a name that is used in the URL - to add a named window you should instead use #addWindow(Root, String)

Parameters:
root - the root window to add to the application
See Also:
#addWindow(Root, String)

removeWindow

public void removeWindow(Root.LegacyWindow root)
Deprecated. 
Removes the specified window from the application. This also removes all name mappings for the window (see and #getWindowName(Root).

Note that removing window from the application does not close the browser window - the window is only removed from the server-side.

Parameters:
root - the root to remove

getWindows

public Collection<Root.LegacyWindow> getWindows()
Deprecated. 
Gets the set of windows contained by the application.

Note that the returned set of windows can not be modified.

Returns:
the unmodifiable collection of windows.


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