|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.vaadin.server.AbstractClientConnector
com.vaadin.ui.AbstractComponent
com.vaadin.ui.AbstractSingleComponentContainer
com.vaadin.ui.Panel
com.vaadin.ui.Window
public class Window
A component that represents a floating popup window that can be added to a
UI. A window is added to a UI using
UI.addWindow(Window).
The contents of a window is set using AbstractSingleComponentContainer.setContent(Component) or by
using the Window(String, Component) constructor.
A window can be positioned on the screen using absolute coordinates (pixels)
or set to be centered using center()
The caption is displayed in the window header.
In Vaadin versions prior to 7.0.0, Window was also used as application level
windows. This function is now covered by the UI class.
| Nested Class Summary | |
|---|---|
static class |
Window.CloseEvent
|
static interface |
Window.CloseListener
An interface used for listening to Window close events. |
static class |
Window.CloseShortcut
A ShortcutListener specifically made to define a keyboard
shortcut that closes the window. |
static class |
Window.ResizeEvent
Resize events are fired whenever the client-side fires a resize-event (e.g. |
static interface |
Window.ResizeListener
Listener for window resize events. |
static class |
Window.WindowModeChangeEvent
Event which is fired when the mode of the Window changes. |
static interface |
Window.WindowModeChangeListener
An interface used for listening to Window maximize / restore events. |
| Nested classes/interfaces inherited from interface com.vaadin.ui.Component |
|---|
Component.ErrorEvent, Component.Event, Component.Focusable, Component.Listener |
| Nested classes/interfaces inherited from interface com.vaadin.server.ClientConnector |
|---|
ClientConnector.AttachEvent, ClientConnector.AttachListener, ClientConnector.ConnectorErrorEvent, ClientConnector.DetachEvent, ClientConnector.DetachListener |
| Nested classes/interfaces inherited from interface com.vaadin.server.Sizeable |
|---|
Sizeable.Unit |
| Nested classes/interfaces inherited from interface com.vaadin.ui.HasComponents |
|---|
HasComponents.ComponentAttachDetachNotifier, HasComponents.ComponentAttachEvent, HasComponents.ComponentAttachListener, HasComponents.ComponentDetachEvent, HasComponents.ComponentDetachListener |
| Field Summary | |
|---|---|
protected Window.CloseShortcut |
closeShortcut
|
| Fields inherited from class com.vaadin.ui.Panel |
|---|
actionManager |
| 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 | |
|---|---|
Window()
Creates a new, empty sub window |
|
Window(java.lang.String caption)
Creates a new, empty sub window with a given title. |
|
Window(java.lang.String caption,
Component content)
Creates a new, empty sub window with the given content and title. |
|
| Method Summary | |
|---|---|
void |
addBlurListener(FieldEvents.BlurListener listener)
Note, that focus/blur listeners in Window class are only supported by sub windows. |
void |
addCloseListener(Window.CloseListener listener)
Adds a CloseListener to the window. |
void |
addFocusListener(FieldEvents.FocusListener listener)
Note, that focus/blur listeners in Window class are only supported by sub windows. |
void |
addListener(FieldEvents.BlurListener listener)
Deprecated. As of 7.0, replaced by #addBlurListener(BlurListener) |
void |
addListener(FieldEvents.FocusListener listener)
Deprecated. As of 7.0, replaced by #addFocusListener(FocusListener) |
void |
addListener(Window.CloseListener listener)
Deprecated. As of 7.0, replaced by addCloseListener(CloseListener) |
void |
addListener(Window.ResizeListener listener)
Deprecated. As of 7.0, replaced by addResizeListener(ResizeListener) |
void |
addResizeListener(Window.ResizeListener listener)
Add a resize listener. |
void |
addWindowModeChangeListener(Window.WindowModeChangeListener listener)
Adds a WindowModeChangeListener to the window. |
void |
bringToFront()
If there are currently several windows visible, calling this method makes this window topmost. |
void |
center()
Sets this window to be centered relative to its parent window. |
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 |
close()
Method that handles window closing (from UI). |
protected void |
fireClose()
|
protected void |
fireResize()
Fire the resize event. |
protected void |
fireWindowWindowModeChange()
|
void |
focus()
Moves keyboard focus to the component. |
int |
getPositionX()
Gets the distance of Window left border in pixels from left border of the containing (main window) when the window is in WindowMode.NORMAL. |
int |
getPositionY()
Gets the distance of Window top border in pixels from top border of the containing (main window) when the window is in WindowMode.NORMAL
state, or when next set to that state. |
protected com.vaadin.shared.ui.window.WindowState |
getState()
Returns the shared state bean with information to be sent from the server to the client. |
protected com.vaadin.shared.ui.window.WindowState |
getState(boolean markAsDirty)
Returns the shared state for this connector. |
com.vaadin.shared.ui.window.WindowMode |
getWindowMode()
Gets the current mode of the window. |
boolean |
isClosable()
Returns the closable status of the sub window. |
boolean |
isDraggable()
Indicates whether a sub window can be dragged or not. |
boolean |
isModal()
|
boolean |
isResizable()
|
boolean |
isResizeLazy()
|
void |
paintContent(PaintTarget target)
Paints the Paintable into a UIDL stream. |
void |
removeBlurListener(FieldEvents.BlurListener listener)
Removes a BlurListener from the Component. |
void |
removeCloseListener(Window.CloseListener listener)
Removes the CloseListener from the window. |
void |
removeCloseShortcut()
Removes the keyboard shortcut previously set with setCloseShortcut(int, int...). |
void |
removeFocusListener(FieldEvents.FocusListener listener)
Removes a FocusListener from the Component. |
void |
removeListener(FieldEvents.BlurListener listener)
Deprecated. As of 7.0, replaced by #removeBlurListener(BlurListener) |
void |
removeListener(FieldEvents.FocusListener listener)
Deprecated. As of 7.0, replaced by #removeFocusListener(FocusListener) |
void |
removeListener(Window.CloseListener listener)
Deprecated. As of 7.0, replaced by removeCloseListener(CloseListener) |
void |
removeListener(Window.ResizeListener listener)
Deprecated. As of 7.0, replaced by removeResizeListener(ResizeListener) |
void |
removeResizeListener(Window.ResizeListener listener)
Remove a resize listener. |
void |
removeWindowModeChangeListener(Window.WindowModeChangeListener listener)
Removes the WindowModeChangeListener from the window. |
void |
setClosable(boolean closable)
Sets the closable status for the sub window. |
void |
setCloseShortcut(int keyCode,
int... modifiers)
Makes is possible to close the window by pressing the given ShortcutAction.KeyCode and (optional) ShortcutAction.ModifierKeys.Note that this shortcut only reacts while the window has focus, closing itself - if you want to close a subwindow from a parent window, use Panel.addAction(com.vaadin.event.Action) of the parent window instead. |
void |
setDraggable(boolean draggable)
Enables or disables that a sub window can be dragged (moved) by the user. |
void |
setModal(boolean modal)
Sets sub-window modal, so that widgets behind it cannot be accessed. |
void |
setParent(HasComponents parent)
Sets the parent connector of the component. |
void |
setPositionX(int positionX)
Sets the distance of Window left border in pixels from left border of the containing (main window). |
void |
setPositionY(int positionY)
Sets the distance of Window top border in pixels from top border of the containing (main window). |
void |
setResizable(boolean resizable)
Sets sub-window resizable. |
void |
setResizeLazy(boolean resizeLazy)
Should resize operations be lazy, i.e. |
void |
setWindowMode(com.vaadin.shared.ui.window.WindowMode windowMode)
Sets the mode for the window |
| Methods inherited from class com.vaadin.ui.Panel |
|---|
addAction, addActionHandler, addClickListener, addListener, getActionManager, getScrollLeft, getScrollTop, getTabIndex, removeAction, removeActionHandler, removeAllActionHandlers, removeClickListener, removeListener, setCaption, setScrollLeft, setScrollTop, setTabIndex |
| Methods inherited from class com.vaadin.ui.AbstractSingleComponentContainer |
|---|
addComponentAttachListener, addComponentDetachListener, fireComponentAttachEvent, fireComponentDetachEvent, getComponentCount, getContent, iterator, removeComponentAttachListener, removeComponentDetachListener, removeFromParent, setContent, setHeight, setWidth |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface com.vaadin.ui.LegacyComponent |
|---|
markAsDirty |
| Methods inherited from interface com.vaadin.server.VariableOwner |
|---|
isEnabled, isImmediate |
| Methods inherited from interface com.vaadin.ui.Component |
|---|
addListener, addStyleName, attach, getCaption, getDescription, getIcon, getId, getLocale, getParent, getPrimaryStyleName, getStyleName, getUI, isEnabled, isReadOnly, isVisible, removeListener, removeStyleName, setCaption, setEnabled, setIcon, setId, setPrimaryStyleName, setReadOnly, setStyleName, setVisible |
| Methods inherited from interface com.vaadin.server.ClientConnector |
|---|
addAttachListener, addDetachListener, beforeClientResponse, detach, encodeState, getErrorHandler, getExtensions, getRpcManager, getStateType, handleConnectorRequest, isAttached, isConnectorEnabled, markAsDirtyRecursive, removeAttachListener, removeDetachListener, removeExtension, requestRepaint, requestRepaintAll, retrievePendingRpcCalls, setErrorHandler |
| Methods inherited from interface com.vaadin.shared.Connector |
|---|
getConnectorId |
| Methods inherited from interface com.vaadin.server.Sizeable |
|---|
getHeight, getHeightUnits, getWidth, getWidthUnits, setHeight, setHeight, setSizeFull, setSizeUndefined, setWidth, setWidth |
| Field Detail |
|---|
protected Window.CloseShortcut closeShortcut
| Constructor Detail |
|---|
public Window()
public Window(java.lang.String caption)
caption - the title of the window.
public Window(java.lang.String caption,
Component content)
caption - the title of the window.content - the contents of the window| Method Detail |
|---|
public void paintContent(PaintTarget target)
throws PaintException
LegacyComponentPaints 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.
paintContent in interface LegacyComponentpaintContent in class Paneltarget - the target UIDL stream where the component should paint itself
to.
PaintException - if the paint operation failed.public void setParent(HasComponents parent)
Component
This method automatically calls Component.attach() if the component
becomes attached to the session, regardless of whether it was attached
previously. Conversely, if the component currently is attached to the
session, ClientConnector.detach() is called for the connector before attaching
it to a new parent.
This method is rarely called directly.
ComponentContainer.addComponent(Component) or a
HasComponents specific method is normally used for adding
components to a parent and the used method will call this method
implicitly.
setParent in interface ComponentsetParent in class AbstractComponentparent - the parent connector
public void changeVariables(java.lang.Object source,
java.util.Map<java.lang.String,java.lang.Object> variables)
Panel
changeVariables in interface VariableOwnerchangeVariables in class Panelsource - 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.VariableOwner.changeVariables(Object, Map)public void close()
By default, sub-windows are removed from their respective parent windows and thus visually closed on browser-side. Browser-level windows also closed on the client-side, but they are not implicitly removed from the application.
To explicitly close a sub-window, use #removeWindow(Window). To
react to a window being closed (after it is closed), register a
Window.CloseListener.
public int getPositionX()
WindowMode.NORMAL.
public void setPositionX(int positionX)
WindowMode.NORMAL
mode.
positionX - the Distance of Window left border in pixels from left border
of the containing (main window). or -1 if unspecified.public int getPositionY()
WindowMode.NORMAL
state, or when next set to that state.
public void setPositionY(int positionY)
WindowMode.NORMAL
mode.
positionY - the Distance of Window top border in pixels from top border of
the containing (main window). or -1 if unspecifiedpublic void addCloseListener(Window.CloseListener listener)
Since Vaadin 6.5, removing windows using #removeWindow(Window)
does fire the CloseListener.
listener - the CloseListener to add.@Deprecated public void addListener(Window.CloseListener listener)
addCloseListener(CloseListener)
public void removeCloseListener(Window.CloseListener listener)
For more information on CloseListeners see Window.CloseListener.
listener - the CloseListener to remove.@Deprecated public void removeListener(Window.CloseListener listener)
removeCloseListener(CloseListener)
protected void fireClose()
public void addWindowModeChangeListener(Window.WindowModeChangeListener listener)
setWindowMode(WindowMode).
listener - the WindowModeChangeListener to add.public void removeWindowModeChangeListener(Window.WindowModeChangeListener listener)
listener - the WindowModeChangeListener to remove.protected void fireWindowWindowModeChange()
public void addResizeListener(Window.ResizeListener listener)
listener - @Deprecated public void addListener(Window.ResizeListener listener)
addResizeListener(ResizeListener)
public void removeResizeListener(Window.ResizeListener listener)
listener - @Deprecated public void removeListener(Window.ResizeListener listener)
removeResizeListener(ResizeListener)
protected void fireResize()
public void bringToFront()
This method can only be called if this window connected a UI. Else an illegal state exception is thrown. Also if there are modal windows and this window is not modal, and illegal state exception is thrown.
public void setModal(boolean modal)
modal - true if modality is to be turned onpublic boolean isModal()
public void setResizable(boolean resizable)
resizable - true if resizability is to be turned onpublic boolean isResizable()
public boolean isResizeLazy()
public void setResizeLazy(boolean resizeLazy)
resizeLazy - true to use a delay before recalculating sizes, false to
calculate immediately.public void center()
NOTE: This method has several issues as currently implemented. Please refer to http://dev.vaadin.com/ticket/8971 for details.
public boolean isClosable()
public void setClosable(boolean closable)
closable - determines if the sub window can be closed by the user.public boolean isDraggable()
draggable - true if the sub window can be dragged by the userpublic void setDraggable(boolean draggable)
draggable - true if the sub window can be dragged by the userpublic com.vaadin.shared.ui.window.WindowMode getWindowMode()
WindowModepublic void setWindowMode(com.vaadin.shared.ui.window.WindowMode windowMode)
windowMode - The new modeWindowMode
public void setCloseShortcut(int keyCode,
int... modifiers)
ShortcutAction.KeyCode and (optional) ShortcutAction.ModifierKeys.Panel.addAction(com.vaadin.event.Action) of the parent window instead.
keyCode - the keycode for invoking the shortcutmodifiers - the (optional) modifiers for invoking the shortcut, null for
nonepublic void removeCloseShortcut()
setCloseShortcut(int, int...).
public void addFocusListener(FieldEvents.FocusListener listener)
addFocusListener in interface FieldEvents.FocusNotifierFieldEvents.FocusNotifier.addListener(com.vaadin.event.FieldEvents.FocusListener)@Deprecated public void addListener(FieldEvents.FocusListener listener)
#addFocusListener(FocusListener)
addListener in interface FieldEvents.FocusNotifierpublic void removeFocusListener(FieldEvents.FocusListener listener)
FieldEvents.FocusNotifierFocusListener from the Component.
removeFocusListener in interface FieldEvents.FocusNotifierFieldEvents.FocusListener@Deprecated public void removeListener(FieldEvents.FocusListener listener)
#removeFocusListener(FocusListener)
removeListener in interface FieldEvents.FocusNotifierpublic void addBlurListener(FieldEvents.BlurListener listener)
addBlurListener in interface FieldEvents.BlurNotifierFieldEvents.BlurNotifier.addListener(com.vaadin.event.FieldEvents.BlurListener)@Deprecated public void addListener(FieldEvents.BlurListener listener)
#addBlurListener(BlurListener)
addListener in interface FieldEvents.BlurNotifierpublic void removeBlurListener(FieldEvents.BlurListener listener)
FieldEvents.BlurNotifierBlurListener from the Component.
removeBlurListener in interface FieldEvents.BlurNotifierFieldEvents.BlurListener@Deprecated public void removeListener(FieldEvents.BlurListener listener)
#removeBlurListener(BlurListener)
removeListener in interface FieldEvents.BlurNotifierpublic void focus()
Component.Focusable.focus()
If the window is a sub-window focusing will cause the sub-window to be
brought on top of other sub-windows on gain keyboard focus.
focus in interface Component.Focusablefocus in class PanelFieldEvents,
FieldEvents.FocusEvent,
FieldEvents.FocusListener,
FieldEvents.BlurEvent,
FieldEvents.BlurListenerprotected com.vaadin.shared.ui.window.WindowState getState()
AbstractComponent
getState in class Panelprotected com.vaadin.shared.ui.window.WindowState getState(boolean markAsDirty)
AbstractClientConnector
getState in class AbstractComponentmarkAsDirty - true if the connector should automatically be marked dirty,
false otherwise
AbstractClientConnector.getState()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||