|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.vaadin.ui.AbstractComponent
com.vaadin.ui.AbstractComponentContainer
com.vaadin.ui.Panel
com.vaadin.ui.Window
public class Window
A component that represents an application (browser native) window or a sub window.
If the window is a application window or a sub window depends on how it is
added to the application. Adding a Window to a Window using
Window#addWindow(Window) makes it a sub window and adding a
Window to the Application using
Application#addWindow(Window) makes it an application window.
An application window is the base of any view in a Vaadin application. All
applications contain a main application window (set using
Application#setMainWindow(Window) which is what is initially shown to
the user. The contents of a window is set using
Panel.setContent(ComponentContainer). The contents can in turn contain
other components. For multi-tab applications there is one window instance per
opened tab.
A sub window is floating popup style window that can be added to an
application window. Like the application window its content is set using
Panel.setContent(ComponentContainer). A sub window can be positioned on
the screen using absolute coordinates (pixels). The default content of the
Window is set to be suitable for application windows. For sub windows it
might be necessary to set the size of the content to work as expected.
Window caption is displayed in the browser title bar for application level windows and in the window header for sub windows.
Certain methods in this class are only meaningful for sub windows and other parts only for application windows. These are marked using Sub window only and Application window only respectively in the javadoc.
Sub window is to be split into a separate component in Vaadin 7.
| Nested Class Summary | |
|---|---|
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. |
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. |
| Nested classes/interfaces inherited from class com.vaadin.ui.AbstractComponent |
|---|
AbstractComponent.ComponentErrorEvent, AbstractComponent.ComponentErrorHandler |
| Nested classes/interfaces inherited from interface com.vaadin.terminal.VariableOwner |
|---|
VariableOwner.ErrorEvent |
| Nested classes/interfaces inherited from interface com.vaadin.ui.Component |
|---|
Component.ErrorEvent, Component.ErrorListener, Component.Event, Component.Focusable, Component.Listener, Component.RepaintRequestEvent, Component.RepaintRequestListener |
| Nested classes/interfaces inherited from interface com.vaadin.terminal.Sizeable |
|---|
Sizeable.Unit |
| Nested classes/interfaces inherited from interface com.vaadin.ui.ComponentContainer |
|---|
ComponentContainer.ComponentAttachEvent, ComponentContainer.ComponentAttachListener, ComponentContainer.ComponentDetachEvent, ComponentContainer.ComponentDetachListener |
| Field Summary | |
|---|---|
protected Window.CloseShortcut |
closeShortcut
|
| Fields inherited from class com.vaadin.ui.Panel |
|---|
actionManager |
| Fields inherited from interface com.vaadin.terminal.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 unnamed window with a default layout. |
|
Window(String caption)
Creates a new unnamed window with a default layout and given title. |
|
Window(String caption,
ComponentContainer content)
Creates a new unnamed window with the given content and title. |
|
| Method Summary | |
|---|---|
void |
addComponent(Component c)
Adds the component into this container. |
void |
addListener(FieldEvents.BlurListener listener)
Note, that focus/blur listeners in Window class are only supported by sub windows. |
void |
addListener(FieldEvents.FocusListener listener)
Note, that focus/blur listeners in Window class are only supported by sub windows. |
void |
addListener(Window.CloseListener listener)
Adds a CloseListener to the window. |
void |
addListener(Window.ResizeListener listener)
Add a resize listener. |
void |
bringToFront()
If there are currently several windows visible, calling this method makes this window topmost. |
void |
center()
Request to center this window on the screen. |
void |
changeVariables(Object source,
Map<String,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. |
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). |
int |
getPositionY()
Gets the distance of Window top border in pixels from top border of the containing (main window). |
WindowState |
getState()
Returns the shared state bean with information to be sent from the server to the client. |
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 |
removeCloseShortcut()
Removes the keyboard shortcut previously set with setCloseShortcut(int, int...). |
void |
removeListener(FieldEvents.BlurListener listener)
Removes a BlurListener from the Component. |
void |
removeListener(FieldEvents.FocusListener listener)
Removes a FocusListener from the Component. |
void |
removeListener(Window.CloseListener listener)
Removes the CloseListener from the window. |
void |
removeListener(Window.ResizeListener listener)
Remove a resize listener. |
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 |
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. |
| Methods inherited from class com.vaadin.ui.AbstractComponentContainer |
|---|
addListener, addListener, fireComponentAttachEvent, fireComponentDetachEvent, isComponentVisible, iterator, moveComponentsFrom, removeListener, removeListener, requestRepaintAll, setHeight, setVisible, 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.terminal.VariableOwner |
|---|
isEnabled, isImmediate |
| Methods inherited from interface com.vaadin.ui.Component |
|---|
addListener, addListener, addStyleName, attach, detach, getApplication, getCaption, getDebugId, getIcon, getLocale, getParent, getRoot, getStyleName, isEnabled, isReadOnly, isVisible, removeListener, removeListener, removeStyleName, requestRepaint, setCaption, setDebugId, setEnabled, setIcon, setParent, setReadOnly, setStyleName, setVisible, updateState |
| Methods inherited from interface com.vaadin.terminal.gwt.server.ClientConnector |
|---|
isConnectorEnabled, retrievePendingRpcCalls |
| Methods inherited from interface com.vaadin.terminal.gwt.client.Connector |
|---|
getConnectorId |
| Methods inherited from interface com.vaadin.terminal.gwt.server.RpcTarget |
|---|
getRpcManager |
| Methods inherited from interface com.vaadin.terminal.Sizeable |
|---|
getHeight, getHeightUnits, getWidth, getWidthUnits, setHeight, setHeight, setSizeFull, setSizeUndefined, setWidth, setWidth |
| Field Detail |
|---|
protected Window.CloseShortcut closeShortcut
| Constructor Detail |
|---|
public Window()
public Window(String caption)
caption - the title of the window.
public Window(String caption,
ComponentContainer content)
caption - the title of the window.content - the contents of the window| Method Detail |
|---|
public void addComponent(Component c)
Panel
addComponent in interface ComponentContaineraddComponent in class Panelc - the component to be added.AbstractComponentContainer.addComponent(com.vaadin.ui.Component)
public void paintContent(PaintTarget target)
throws PaintException
Vaadin6ComponentPaints 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 Vaadin6ComponentpaintContent in class Paneltarget - the target UIDL stream where the component should paint itself
to.
PaintException - if the paint operation failed.
public void changeVariables(Object source,
Map<String,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()
public void setPositionX(int positionX)
positionX - the Distance of Window left border in pixels from left border
of the containing (main window). or -1 if unspecified.public int getPositionY()
public void setPositionY(int positionY)
positionY - the Distance of Window top border in pixels from top border of
the containing (main window). or -1 if unspecifiedpublic void addListener(Window.CloseListener listener)
Since Vaadin 6.5, removing windows using #removeWindow(Window)
does fire the CloseListener.
listener - the CloseListener to add.public void removeListener(Window.CloseListener listener)
For more information on CloseListeners see Window.CloseListener.
listener - the CloseListener to remove.protected void fireClose()
public void addListener(Window.ResizeListener listener)
listener - public void removeListener(Window.ResizeListener listener)
listener - protected void fireResize()
public void bringToFront()
This method can only be called if this window connected a root. 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()
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 user
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 addListener(FieldEvents.FocusListener listener)
addListener in interface FieldEvents.FocusNotifierFieldEvents.FocusNotifier.addListener(com.vaadin.event.FieldEvents.FocusListener)public void removeListener(FieldEvents.FocusListener listener)
FieldEvents.FocusNotifierFocusListener from the Component.
removeListener in interface FieldEvents.FocusNotifierFieldEvents.FocusListenerpublic void addListener(FieldEvents.BlurListener listener)
addListener in interface FieldEvents.BlurNotifierFieldEvents.BlurNotifier.addListener(com.vaadin.event.FieldEvents.BlurListener)public void removeListener(FieldEvents.BlurListener listener)
FieldEvents.BlurNotifierBlurListener from the Component.
removeListener in interface FieldEvents.BlurNotifierFieldEvents.BlurListenerpublic 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.BlurListenerpublic WindowState getState()
AbstractComponent
getState in interface ConnectorgetState in interface ComponentgetState in class Panel
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||