com.vaadin.ui
Class UI

java.lang.Object
  extended by com.vaadin.server.AbstractClientConnector
      extended by com.vaadin.ui.AbstractComponent
          extended by com.vaadin.ui.AbstractComponentContainer
              extended by com.vaadin.ui.UI
All Implemented Interfaces:
Action.Container, Action.Notifier, MethodEventSource, ClientConnector, LegacyComponent, RpcTarget, Sizeable, VariableOwner, com.vaadin.shared.Connector, Component, ComponentContainer, HasComponents, java.io.Serializable, java.lang.Iterable<Component>, java.util.EventListener
Direct Known Subclasses:
UI.LegacyWindow

public abstract class UI
extends AbstractComponentContainer
implements Action.Container, Action.Notifier, LegacyComponent

The topmost component in any component hierarchy. There is one UI for every Vaadin instance in a browser window. A UI may either represent an entire browser window (or tab) or some part of a html page where a Vaadin application is embedded.

The UI is the server side entry point for various client side features that are not represented as components added to a layout, e.g notifications, sub windows, and executing javascript in the browser.

When a new UI instance is needed, typically because the user opens a URL in a browser window which points to e.g. VaadinServlet, all UIProviders registered to the current VaadinServiceSession are queried for the UI class that should be used. The selection is by defaylt based on the parameter from web.xml.

After a UI has been created by the application, it is initialized using init(VaadinRequest). This method is intended to be overridden by the developer to add components to the user interface and initialize non-component functionality. The component hierarchy is initialized by passing a ComponentContainer with the main layout of the view to setContent(ComponentContainer).

Since:
7.0
See Also:
init(VaadinRequest), UIProvider, Serialized Form

Nested Class Summary
static class UI.CleanupEvent
          Event fired when a UI is removed from the application.
static interface UI.CleanupListener
          Interface for listening UI cleanup events.
static class UI.LegacyWindow
          Deprecated. 
 
Nested classes/interfaces inherited from class com.vaadin.ui.AbstractComponent
AbstractComponent.ComponentErrorEvent, AbstractComponent.ComponentErrorHandler
 
Nested classes/interfaces inherited from interface com.vaadin.server.VariableOwner
VariableOwner.ErrorEvent
 
Nested classes/interfaces inherited from interface com.vaadin.ui.Component
Component.ErrorEvent, Component.ErrorListener, Component.Event, Component.Focusable, Component.Listener
 
Nested classes/interfaces inherited from interface com.vaadin.server.Sizeable
Sizeable.Unit
 
Nested classes/interfaces inherited from interface com.vaadin.ui.ComponentContainer
ComponentContainer.ComponentAttachEvent, ComponentContainer.ComponentAttachListener, ComponentContainer.ComponentDetachEvent, ComponentContainer.ComponentDetachListener
 
Field Summary
protected  ActionManager actionManager
          Keeps track of the Actions added to this component, and manages the painting and handling as well.
 
Fields inherited from interface com.vaadin.server.Sizeable
SIZE_UNDEFINED, UNITS_CM, UNITS_EM, UNITS_EX, UNITS_INCH, UNITS_MM, UNITS_PERCENTAGE, UNITS_PICAS, UNITS_PIXELS, UNITS_POINTS
 
Constructor Summary
UI()
          Creates a new empty UI without a caption.
UI(ComponentContainer content)
          Creates a new UI with the given component container as its content.
 
Method Summary
<T extends Action & Action.Listener>
void
addAction(T action)
           
 void addActionHandler(Action.Handler actionHandler)
          Registers a new action handler for this container
 void addCleanupListener(UI.CleanupListener listener)
          Adds a cleanup listener to the UI.
 void addClickListener(MouseEvents.ClickListener listener)
          Add a click listener to the UI.
 void addComponent(Component component)
          Adds a component to this UI.
 void addListener(MouseEvents.ClickListener listener)
          Deprecated. Since 7.0, replaced by #addClickListener(ClickListener)
 void addWindow(Window window)
          Adds a window as a subwindow inside this UI.
 void changeVariables(java.lang.Object source, java.util.Map<java.lang.String,java.lang.Object> variables)
          Called when one or more variables handled by the implementing class are changed.
 void doInit(VaadinRequest request, int uiId)
          Internal initialization method, should not be overridden.
 void fireCleanupEvent()
          For internal use only.
 void focus()
          Sets the focus for this component if the component is Focusable.
protected  ActionManager getActionManager()
          Gets the ActionManager used to manage the ShortcutListeners added to this Field.
 int getComponentCount()
          Gets the number of children this ComponentContainer has.
 java.util.Iterator<Component> getComponentIterator()
          Gets an iterator to the collection of contained components.
 ConnectorTracker getConnectorTracker()
           
 ComponentContainer getContent()
          Gets the content of this UI.
static UI getCurrent()
          Gets the currently used UI.
 long getLastHeartbeatTime()
          Returns the timestamp (milliseconds since the epoch) of the last received heartbeat for this UI.
 long getLastUidlRequestTime()
          Returns the timestamp (milliseconds since the epoch) of the last received UIDL request for this UI.
 Navigator getNavigator()
          Returns the navigator attached to this UI or null if there is no navigator.
 Page getPage()
           
 VaadinServiceSession getSession()
          Gets the application object to which the component is attached.
protected  com.vaadin.shared.ui.ui.UIState getState()
          Returns the shared state bean with information to be sent from the server to the client.
 java.lang.Class<? extends com.vaadin.shared.ui.ui.UIState> getStateType()
          Returns the type of the shared state for this connector
 java.lang.String getTheme()
          Gets the theme that was used when the UI was initialized.
 UI getUI()
          Overridden to return a value instead of referring to the parent.
 int getUIId()
          Gets the id of the UI, used to identify this UI within its application when processing requests.
 java.util.Collection<Window> getWindows()
          Gets all the windows added to this UI.
protected abstract  void init(VaadinRequest request)
          Initializes this UI.
 boolean isConnectorEnabled()
          Checks if the communicator is enabled.
 boolean isResizeLazy()
          Checks whether lazy resize is enabled.
 void paintContent(PaintTarget target)
           Paints the Paintable into a UIDL stream.
<T extends Action & Action.Listener>
void
removeAction(T action)
           
 void removeActionHandler(Action.Handler actionHandler)
          Removes a previously registered action handler for the contents of this container.
 void removeAllComponents()
          This implementation removes the components from the content container ( getContent()) instead of from the actual UI.
 void removeCleanupListener(UI.CleanupListener listener)
          Removes a cleanup listener from the UI, if previously added with addCleanupListener(CleanupListener).
 void removeClickListener(MouseEvents.ClickListener listener)
          Remove a click listener from the UI.
 void removeComponent(Component component)
          This implementation removes the component from the content container ( getContent()) instead of from the actual UI.
 void removeListener(MouseEvents.ClickListener listener)
          Deprecated. Since 7.0, replaced by #removeClickListener(ClickListener)
 boolean removeWindow(Window window)
          Remove the given subwindow from this UI.
 void replaceComponent(Component oldComponent, Component newComponent)
          This implementation replaces a component in the content container ( getContent()) instead of in the actual UI.
 void scrollIntoView(Component component)
          Scrolls any component between the component and UI to a suitable position so the component is visible to the user.
 void setCaption(java.lang.String caption)
          Deprecated. as of 7.0.0, use Page.setTitle(String)
 void setContent(ComponentContainer content)
          Sets the content of this UI.
static void setCurrent(UI ui)
          Sets the thread local for the current UI.
 void setFocusedComponent(Component.Focusable focusable)
          This method is used by Component.Focusable objects to request focus to themselves.
 void setLastHeartbeatTime(long lastHeartbeat)
          Sets the last heartbeat request timestamp for this UI.
 void setLastUidlRequestTime(long lastUidlRequest)
          Sets the last UIDL request timestamp for this UI.
 void setNavigator(Navigator navigator)
          For internal use only.
 void setResizeLazy(boolean resizeLazy)
          Should resize operations be lazy, i.e.
 void setScrollTop(int scrollTop)
           
 void setSession(VaadinServiceSession session)
          Sets the application to which this UI is assigned.
 void showNotification(Notification notification)
          Deprecated. As of 7.0, use Notification.show instead
 void showNotification(java.lang.String caption)
          Deprecated. As of 7.0, use Notification.show instead but be aware that Notification.show does not allow HTML.
 void showNotification(java.lang.String caption, Notification.Type type)
          Deprecated. As of 7.0, use Notification.show instead but be aware that Notification.show does not allow HTML.
 void showNotification(java.lang.String caption, java.lang.String description)
          Deprecated. As of 7.0, use new Notification(...).show(Page) instead but be aware that HTML by default not allowed.
 void showNotification(java.lang.String caption, java.lang.String description, Notification.Type type)
          Deprecated. As of 7.0, use new Notification(...).show(Page) instead but be aware that HTML by default not allowed.
 void showNotification(java.lang.String caption, java.lang.String description, Notification.Type type, boolean htmlContentAllowed)
          Deprecated. As of 7.0, use new Notification(...).show(Page).
 
Methods inherited from class com.vaadin.ui.AbstractComponentContainer
addComponentAttachListener, addComponentDetachListener, addListener, addListener, fireComponentAttachEvent, fireComponentDetachEvent, isComponentVisible, iterator, moveComponentsFrom, removeComponentAttachListener, removeComponentDetachListener, removeListener, removeListener, setHeight, setVisible, setWidth
 
Methods inherited from class com.vaadin.ui.AbstractComponent
addListener, addListener, addListener, addListener, addShortcutListener, addStyleName, attach, beforeClientResponse, detach, findAncestor, fireComponentErrorEvent, fireComponentEvent, fireEvent, getCaption, getComponentError, getData, getDebugId, getDescription, getErrorHandler, getErrorMessage, getHeight, getHeightUnits, getIcon, getId, getListeners, getLocale, getParent, getPrimaryStyleName, getStyleName, getWidth, getWidthUnits, handleError, hasListeners, isEnabled, isImmediate, isReadOnly, isVisible, removeListener, removeListener, removeListener, removeListener, removeListener, removeShortcutListener, removeStyleName, setComponentError, setData, setDebugId, setDescription, setEnabled, setErrorHandler, setHeight, setIcon, setId, setImmediate, setLocale, setParent, setPrimaryStyleName, setReadOnly, setSizeFull, setSizeUndefined, setStyleName, setWidth
 
Methods inherited from class com.vaadin.server.AbstractClientConnector
addExtension, addMethodInvocationToQueue, createState, encodeState, getAllChildrenIterable, getConnectorId, getExtensions, getResource, getRpcManager, getRpcProxy, handleConnectorRequest, markAsDirty, markAsDirtyRecursive, registerRpc, registerRpc, removeExtension, requestRepaint, requestRepaintAll, retrievePendingRpcCalls, setResource
 
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.LegacyComponent
markAsDirty
 
Methods inherited from interface com.vaadin.server.VariableOwner
isEnabled, isImmediate
 
Methods inherited from interface com.vaadin.ui.Component
addListener, addStyleName, attach, getCaption, getIcon, getId, getLocale, getParent, getPrimaryStyleName, getStyleName, isEnabled, isReadOnly, isVisible, removeListener, removeStyleName, setEnabled, setIcon, setId, setPrimaryStyleName, setReadOnly, setStyleName, setVisible
 
Methods inherited from interface com.vaadin.server.ClientConnector
beforeClientResponse, detach, encodeState, getExtensions, handleConnectorRequest, markAsDirtyRecursive, removeExtension, requestRepaint, requestRepaintAll, retrievePendingRpcCalls, setParent
 
Methods inherited from interface com.vaadin.shared.Connector
getConnectorId
 
Methods inherited from interface com.vaadin.server.RpcTarget
getRpcManager
 
Methods inherited from interface com.vaadin.server.Sizeable
getHeight, getHeightUnits, getWidth, getWidthUnits, setHeight, setHeight, setSizeFull, setSizeUndefined, setWidth, setWidth
 

Field Detail

actionManager

protected ActionManager actionManager
Keeps track of the Actions added to this component, and manages the painting and handling as well.

Constructor Detail

UI

public UI()
Creates a new empty UI without a caption. This UI will have a VerticalLayout with margins enabled as its content.


UI

public UI(ComponentContainer content)
Creates a new UI with the given component container as its content.

Parameters:
content - the content container to use as this UIs content.
See Also:
setContent(ComponentContainer)
Method Detail

getState

protected com.vaadin.shared.ui.ui.UIState getState()
Description copied from class: AbstractComponent
Returns the shared state bean with information to be sent from the server to the client. Subclasses should override this method and set any relevant fields of the state returned by super.getState().

Overrides:
getState in class AbstractComponent
Returns:
updated component shared state

getStateType

public java.lang.Class<? extends com.vaadin.shared.ui.ui.UIState> getStateType()
Description copied from interface: ClientConnector
Returns the type of the shared state for this connector

Specified by:
getStateType in interface ClientConnector
Overrides:
getStateType in class AbstractClientConnector
Returns:
The type of the state. Must never return null.

getUI

public UI getUI()
Overridden to return a value instead of referring to the parent.

Specified by:
getUI in interface ClientConnector
Specified by:
getUI in interface Component
Overrides:
getUI in class AbstractClientConnector
Returns:
this UI
See Also:
AbstractClientConnector.getUI()

replaceComponent

public void replaceComponent(Component oldComponent,
                             Component newComponent)
This implementation replaces a component in the content container ( getContent()) instead of in the actual UI.

Specified by:
replaceComponent in interface ComponentContainer
Parameters:
oldComponent - the old component that will be replaced.
newComponent - the new component to be replaced.

getSession

public VaadinServiceSession getSession()
Gets the application object to which the component is attached.

The method will return null if the component is not currently attached to an application.

Getting a null value is often a problem in constructors of regular components and in the initializers of custom composite components. A standard workaround is to use VaadinServiceSession.getCurrent() to retrieve the application instance that the current request relates to. Another way is to move the problematic initialization to AbstractComponent.attach(), as described in the documentation of the method.

Overrides:
getSession in class AbstractClientConnector
Returns:
the parent application of the component or null.
See Also:
AbstractComponent.attach()

paintContent

public void paintContent(PaintTarget target)
                  throws PaintException
Description copied from interface: LegacyComponent

Paints the Paintable into a UIDL stream. This method creates the UIDL sequence describing it and outputs it to the given UIDL stream.

It is called when the contents of the component should be painted in response to the component first being shown or having been altered so that its visual representation is changed.

Specified by:
paintContent in interface LegacyComponent
Parameters:
target - the target UIDL stream where the component should paint itself to.
Throws:
PaintException - if the paint operation failed.

fireCleanupEvent

public void fireCleanupEvent()
For internal use only.


changeVariables

public void changeVariables(java.lang.Object source,
                            java.util.Map<java.lang.String,java.lang.Object> variables)
Description copied from interface: VariableOwner
Called when one or more variables handled by the implementing class are changed.

Specified by:
changeVariables in interface VariableOwner
Parameters:
source - the Source of the variable change. This is the origin of the event. For example in Web Adapter this is the request.
variables - the Mapping from variable names to new variable values.

getComponentIterator

public java.util.Iterator<Component> getComponentIterator()
Description copied from interface: ComponentContainer
Gets an iterator to the collection of contained components. Using this iterator it is possible to step through all components contained in this container.

Specified by:
getComponentIterator in interface ComponentContainer
Returns:
the component iterator.

getComponentCount

public int getComponentCount()
Description copied from interface: ComponentContainer
Gets the number of children this ComponentContainer has. This must be symmetric with what ComponentContainer.getComponentIterator() returns.

Specified by:
getComponentCount in interface ComponentContainer
Returns:
The number of child components this container has.

setSession

public void setSession(VaadinServiceSession session)
Sets the application to which this UI is assigned. It is not legal to change the application once it has been set nor to set a null application.

This method is mainly intended for internal use by the framework.

Parameters:
session - the application to set
Throws:
java.lang.IllegalStateException - if the application has already been set
See Also:
getSession()

getUIId

public int getUIId()
Gets the id of the UI, used to identify this UI within its application when processing requests. The UI id should be present in every request to the server that originates from this UI. VaadinService.findUI(VaadinRequest) uses this id to find the route to which the request belongs.

Returns:

addWindow

public void addWindow(Window window)
               throws java.lang.IllegalArgumentException,
                      java.lang.NullPointerException
Adds a window as a subwindow inside this UI. To open a new browser window or tab, you should instead use a UIProvider.

Parameters:
window -
Throws:
java.lang.IllegalArgumentException - if the window is already added to an application
java.lang.NullPointerException - if the given Window is null.

removeWindow

public boolean removeWindow(Window window)
Remove the given subwindow from this UI. Since Vaadin 6.5, Window.CloseListeners are called also when explicitly removing a window by calling this method. Since Vaadin 6.5, returns a boolean indicating if the window was removed or not.

Parameters:
window - Window to be removed.
Returns:
true if the subwindow was removed, false otherwise

getWindows

public java.util.Collection<Window> getWindows()
Gets all the windows added to this UI.

Returns:
an unmodifiable collection of windows

focus

public void focus()
Description copied from class: AbstractComponent
Sets the focus for this component if the component is Focusable.

Overrides:
focus in class AbstractComponent

setFocusedComponent

public void setFocusedComponent(Component.Focusable focusable)
This method is used by Component.Focusable objects to request focus to themselves. Focus renders must be handled at window level (instead of Component.Focusable) due we want the last focused component to be focused in client too. Not the one that is rendered last (the case we'd get if implemented in Focusable only). To focus component from Vaadin application, use Focusable.focus(). See Focusable.

Parameters:
focusable - to be focused on next paint

scrollIntoView

public void scrollIntoView(Component component)
                    throws java.lang.IllegalArgumentException
Scrolls any component between the component and UI to a suitable position so the component is visible to the user. The given component must belong to this UI.

Parameters:
component - the component to be scrolled into view
Throws:
java.lang.IllegalArgumentException - if component does not belong to this UI

getContent

public ComponentContainer getContent()
Gets the content of this UI. The content is a component container that serves as the outermost item of the visual contents of this UI.

Returns:
a component container to use as content
See Also:
setContent(ComponentContainer), createDefaultLayout()

setContent

public void setContent(ComponentContainer content)
Sets the content of this UI. The content is a component container that serves as the outermost item of the visual contents of this UI. If no content has been set, a VerticalLayout with margins enabled will be used by default - see createDefaultLayout(). The content can also be set in a constructor.

See Also:
UI(ComponentContainer), createDefaultLayout()

addComponent

public void addComponent(Component component)
Adds a component to this UI. The component is not added directly to the UI, but instead to the content container (getContent()).

Specified by:
addComponent in interface ComponentContainer
Overrides:
addComponent in class AbstractComponentContainer
Parameters:
component - the component to add to this UI
See Also:
getContent()

removeComponent

public void removeComponent(Component component)
This implementation removes the component from the content container ( getContent()) instead of from the actual UI.

Specified by:
removeComponent in interface ComponentContainer
Overrides:
removeComponent in class AbstractComponentContainer
Parameters:
component - the component to be removed.
See Also:
ComponentContainer.removeComponent(Component)

removeAllComponents

public void removeAllComponents()
This implementation removes the components from the content container ( getContent()) instead of from the actual UI.

Specified by:
removeAllComponents in interface ComponentContainer
Overrides:
removeAllComponents in class AbstractComponentContainer

doInit

public void doInit(VaadinRequest request,
                   int uiId)
Internal initialization method, should not be overridden. This method is not declared as final because that would break compatibility with e.g. CDI.

Parameters:
request - the initialization request
uiId - the id of the new ui

init

protected abstract void init(VaadinRequest request)
Initializes this UI. This method is intended to be overridden by subclasses to build the view and configure non-component functionality. Performing the initialization in a constructor is not suggested as the state of the UI is not properly set up when the constructor is invoked.

The VaadinRequest can be used to get information about the request that caused this UI to be created.

Parameters:
request - the Vaadin request that caused this UI to be created

setCurrent

public static void setCurrent(UI ui)
Sets the thread local for the current UI. This method is used by the framework to set the current application whenever a new request is processed and it is cleared when the request has been processed.

The application developer can also use this method to define the current UI outside the normal request handling, e.g. when initiating custom background threads.

Parameters:
uI - the UI to register as the current UI
See Also:
getCurrent(), ThreadLocal

getCurrent

public static UI getCurrent()
Gets the currently used UI. The current UI is automatically defined when processing requests to the server. In other cases, (e.g. from background threads), the current UI is not automatically defined.

Returns:
the current UI instance if available, otherwise null
See Also:
setCurrent(UI)

setScrollTop

public void setScrollTop(int scrollTop)

getActionManager

protected ActionManager getActionManager()
Description copied from class: AbstractComponent
Gets the ActionManager used to manage the ShortcutListeners added to this Field.

Overrides:
getActionManager in class AbstractComponent
Returns:
the ActionManager in use

addAction

public <T extends Action & Action.Listener> void addAction(T action)
Specified by:
addAction in interface Action.Notifier

removeAction

public <T extends Action & Action.Listener> void removeAction(T action)
Specified by:
removeAction in interface Action.Notifier

addActionHandler

public void addActionHandler(Action.Handler actionHandler)
Description copied from interface: Action.Container
Registers a new action handler for this container

Specified by:
addActionHandler in interface Action.Container
Parameters:
actionHandler - the new handler to be added.

removeActionHandler

public void removeActionHandler(Action.Handler actionHandler)
Description copied from interface: Action.Container
Removes a previously registered action handler for the contents of this container.

Specified by:
removeActionHandler in interface Action.Container
Parameters:
actionHandler - the handler to be removed.

setResizeLazy

public void setResizeLazy(boolean resizeLazy)
Should resize operations be lazy, i.e. should there be a delay before layout sizes are recalculated. Speeds up resize operations in slow UIs with the penalty of slightly decreased usability.

Default value: false

Parameters:
resizeLazy - true to use a delay before recalculating sizes, false to calculate immediately.

isResizeLazy

public boolean isResizeLazy()
Checks whether lazy resize is enabled.

Returns:
true if lazy resize is enabled, false if lazy resize is not enabled

addClickListener

public void addClickListener(MouseEvents.ClickListener listener)
Add a click listener to the UI. The listener is called whenever the user clicks inside the UI. Also when the click targets a component inside the UI, provided the targeted component does not prevent the click event from propagating. Use #removeListener(ClickListener) to remove the listener.

Parameters:
listener - The listener to add

addCleanupListener

public void addCleanupListener(UI.CleanupListener listener)
Adds a cleanup listener to the UI. Cleanup listeners are invoked when the UI is removed from the session due to UI or session expiration.

Parameters:
listener - The CleanupListener that should be added.

addListener

@Deprecated
public void addListener(MouseEvents.ClickListener listener)
Deprecated. Since 7.0, replaced by #addClickListener(ClickListener)


removeClickListener

public void removeClickListener(MouseEvents.ClickListener listener)
Remove a click listener from the UI. The listener should earlier have been added using #addListener(ClickListener).

Parameters:
listener - The listener to remove

removeCleanupListener

public void removeCleanupListener(UI.CleanupListener listener)
Removes a cleanup listener from the UI, if previously added with addCleanupListener(CleanupListener).

Parameters:
listener - The CleanupListener that should be removed

removeListener

@Deprecated
public void removeListener(MouseEvents.ClickListener listener)
Deprecated. Since 7.0, replaced by #removeClickListener(ClickListener)


isConnectorEnabled

public boolean isConnectorEnabled()
Description copied from interface: ClientConnector
Checks if the communicator is enabled. An enabled communicator is allowed to receive messages from its counter-part.

Specified by:
isConnectorEnabled in interface ClientConnector
Overrides:
isConnectorEnabled in class AbstractComponent
Returns:
true if the connector can receive messages, false otherwise

getConnectorTracker

public ConnectorTracker getConnectorTracker()

getPage

public Page getPage()

getNavigator

public Navigator getNavigator()
Returns the navigator attached to this UI or null if there is no navigator.

Returns:

setNavigator

public void setNavigator(Navigator navigator)
For internal use only.

Parameters:
navigator -

setCaption

@Deprecated
public void setCaption(java.lang.String caption)
Deprecated. as of 7.0.0, use Page.setTitle(String)

Setting the caption of a UI is not supported. To set the title of the HTML page, use Page.setTitle

Specified by:
setCaption in interface Component
Overrides:
setCaption in class AbstractComponent
Parameters:
caption - the new caption String for the component.

showNotification

@Deprecated
public void showNotification(java.lang.String caption)
Deprecated. As of 7.0, use Notification.show instead but be aware that Notification.show does not allow HTML.

Shows a notification message on the middle of the UI. The message automatically disappears ("humanized message"). Care should be taken to to avoid XSS vulnerabilities as the caption is rendered as html.

Parameters:
caption - The message
See Also:
showNotification(Notification), Notification

showNotification

@Deprecated
public void showNotification(java.lang.String caption,
                                        Notification.Type type)
Deprecated. As of 7.0, use Notification.show instead but be aware that Notification.show does not allow HTML.

Shows a notification message the UI. The position and behavior of the message depends on the type, which is one of the basic types defined in Notification, for instance Notification.TYPE_WARNING_MESSAGE. Care should be taken to to avoid XSS vulnerabilities as the caption is rendered as html.

Parameters:
caption - The message
type - The message type
See Also:
showNotification(Notification), Notification

showNotification

@Deprecated
public void showNotification(java.lang.String caption,
                                        java.lang.String description)
Deprecated. As of 7.0, use new Notification(...).show(Page) instead but be aware that HTML by default not allowed.

Shows a notification consisting of a bigger caption and a smaller description on the middle of the UI. The message automatically disappears ("humanized message"). Care should be taken to to avoid XSS vulnerabilities as the caption and description are rendered as html.

Parameters:
caption - The caption of the message
description - The message description
See Also:
showNotification(Notification), Notification

showNotification

@Deprecated
public void showNotification(java.lang.String caption,
                                        java.lang.String description,
                                        Notification.Type type)
Deprecated. As of 7.0, use new Notification(...).show(Page) instead but be aware that HTML by default not allowed.

Shows a notification consisting of a bigger caption and a smaller description. The position and behavior of the message depends on the type, which is one of the basic types defined in Notification , for instance Notification.TYPE_WARNING_MESSAGE. Care should be taken to to avoid XSS vulnerabilities as the caption and description are rendered as html.

Parameters:
caption - The caption of the message
description - The message description
type - The message type
See Also:
showNotification(Notification), Notification

showNotification

@Deprecated
public void showNotification(java.lang.String caption,
                                        java.lang.String description,
                                        Notification.Type type,
                                        boolean htmlContentAllowed)
Deprecated. As of 7.0, use new Notification(...).show(Page).

Shows a notification consisting of a bigger caption and a smaller description. The position and behavior of the message depends on the type, which is one of the basic types defined in Notification , for instance Notification.TYPE_WARNING_MESSAGE. Care should be taken to avoid XSS vulnerabilities if html content is allowed.

Parameters:
caption - The message caption
description - The message description
type - The type of message
htmlContentAllowed - Whether html in the caption and description should be displayed as html or as plain text
See Also:
showNotification(Notification), Notification

showNotification

@Deprecated
public void showNotification(Notification notification)
Deprecated. As of 7.0, use Notification.show instead

Shows a notification message.

Parameters:
notification - The notification message to show
See Also:
Notification, showNotification(String), #showNotification(String, int), showNotification(String, String), #showNotification(String, String, int)

getLastHeartbeatTime

public long getLastHeartbeatTime()
Returns the timestamp (milliseconds since the epoch) of the last received heartbeat for this UI.

Returns:
The time the last heartbeat request occurred.
See Also:
#heartbeat(), VaadinServiceSession.cleanupInactiveUIs()

getLastUidlRequestTime

public long getLastUidlRequestTime()
Returns the timestamp (milliseconds since the epoch) of the last received UIDL request for this UI.

Returns:

setLastHeartbeatTime

public void setLastHeartbeatTime(long lastHeartbeat)
Sets the last heartbeat request timestamp for this UI. Called by the framework whenever the application receives a valid heartbeat request for this UI.


setLastUidlRequestTime

public void setLastUidlRequestTime(long lastUidlRequest)
Sets the last UIDL request timestamp for this UI. Called by the framework whenever the application receives a valid UIDL request for this UI.


getTheme

public java.lang.String getTheme()
Gets the theme that was used when the UI was initialized.

Returns:
the theme name


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