public class SubWindow
extends com.vaadin.ui.Panel
implements com.vaadin.event.FieldEvents.FocusNotifier, com.vaadin.event.FieldEvents.BlurNotifier
WindowsDesktopArea. A subwindow is added to a
WindowsDesktopArea using WindowsDesktopArea.addSubWindow(SubWindow).
The subwindow component is build on the window component and have all it behaviors. The contents of a subwindow is set using
AbstractSingleComponentContainer.setContent(Component) or by using the SubWindow(String, Component) constructor.
A subwindow can be positioned on the screen using relative coordinates (pixels) or set to be centered using center()
The caption is displayed in the window header.
| Modifier and Type | Class and Description |
|---|---|
static class |
SubWindow.CloseEvent |
static interface |
SubWindow.CloseListener
An interface used for listening to Window close events.
|
static class |
SubWindow.CloseShortcut
A
ShortcutListener specifically made to define a keyboard shortcut that closes the subwindow. |
static class |
SubWindow.MinimizeEvent |
static interface |
SubWindow.MinimizeListener |
static class |
SubWindow.ResizeEvent
Resize events are fired whenever the client-side fires a resize-event (e.g. the browser subwindow is resized).
|
static interface |
SubWindow.ResizeListener
Listener for subwindow resize events.
|
static class |
SubWindow.WindowModeChangeEvent
Event which is fired when the mode of the Window changes.
|
static interface |
SubWindow.WindowModeChangeListener
An interface used for listening to Window maximize / restore events.
|
static class |
SubWindow.WindowOrderChangeEvent
Event which is fired when the subwindow order position is changed.
|
static interface |
SubWindow.WindowOrderChangeListener
An interface used for listening to Window order change events.
|
com.vaadin.ui.Component.ErrorEvent, com.vaadin.ui.Component.Event, com.vaadin.ui.Component.Focusable, com.vaadin.ui.Component.Listenercom.vaadin.server.ClientConnector.AttachEvent, com.vaadin.server.ClientConnector.AttachListener, com.vaadin.server.ClientConnector.ConnectorErrorEvent, com.vaadin.server.ClientConnector.DetachEvent, com.vaadin.server.ClientConnector.DetachListenercom.vaadin.server.Sizeable.Unitcom.vaadin.ui.HasComponents.ComponentAttachDetachNotifier, com.vaadin.ui.HasComponents.ComponentAttachEvent, com.vaadin.ui.HasComponents.ComponentAttachListener, com.vaadin.ui.HasComponents.ComponentDetachEvent, com.vaadin.ui.HasComponents.ComponentDetachListener| Constructor and Description |
|---|
SubWindow()
Creates a new, empty subwindow.
|
SubWindow(String caption)
Creates a new, empty subwindow with a given title.
|
SubWindow(String caption,
com.vaadin.ui.Component content)
Creates a new, empty subwindow with the given content and title.
|
| Modifier and Type | Method and Description |
|---|---|
com.vaadin.shared.Registration |
addBlurListener(com.vaadin.event.FieldEvents.BlurListener listener) |
com.vaadin.shared.Registration |
addCloseListener(SubWindow.CloseListener listener)
Adds a CloseListener to the subwindow.
|
void |
addCloseShortcut(int keyCode,
int... modifiers)
Adds a close shortcut - pressing this key while holding down all (if any) modifiers specified while this Window is in focus will close the
Window.
|
com.vaadin.shared.Registration |
addFocusListener(com.vaadin.event.FieldEvents.FocusListener listener) |
com.vaadin.shared.Registration |
addMinimizeListener(SubWindow.MinimizeListener listener)
Adds a MinimizeListener to the subwindow.
|
com.vaadin.shared.Registration |
addResizeListener(SubWindow.ResizeListener listener)
Add a resize listener.
|
com.vaadin.shared.Registration |
addWindowModeChangeListener(SubWindow.WindowModeChangeListener listener)
Adds a WindowModeChangeListener to the subwindow.
|
com.vaadin.shared.Registration |
addWindowOrderChangeListener(SubWindow.WindowOrderChangeListener listener)
Adds a WindowOrderChangeListener to the subwindow.
|
void |
bringToFront()
If there are currently several subwindows visible, calling this method makes this subwindow topmost.
|
void |
center()
Sets this subwindow to be centered relative to its parent subwindow.
|
void |
changeVariables(Object source,
Map<String,Object> variables) |
void |
close()
Method that handles subwindow closing (from UI).
|
protected void |
fireClose() |
protected void |
fireMinimize() |
protected void |
fireResize()
Fire the resize event.
|
protected void |
fireWindowOrderChange(Integer order) |
protected void |
fireWindowWindowModeChange() |
void |
focus()
Cause the subwindow to be brought on top of other subwindows and gain keyboard focus.
|
com.vaadin.ui.Component[] |
getAssistiveDescription()
Gets the components that are used as assistive description.
|
String |
getAssistivePostfix()
Gets the accessibility postfix for the subwindow caption.
|
String |
getAssistivePrefix()
Gets the accessibility prefix for the subwindow caption.
|
com.vaadin.shared.ui.window.WindowRole |
getAssistiveRole()
Gets the WAI-ARIA role the subwindow.
|
Collection<SubWindow.CloseShortcut> |
getCloseShortcuts()
Returns an unmodifiable collection of
SubWindow.CloseShortcut objects currently registered with this SubWindow. |
protected Collection<String> |
getCustomAttributes() |
int |
getOrderPosition()
Returns the position of this subwindow in the order of all open subwindows for this UI.
|
int |
getPositionX()
Gets the distance of Window left border in pixels from left border of the containing (main subwindow) when the subwindow is in
SubWindowMode.NORMAL. |
int |
getPositionY()
Gets the distance of Window top border in pixels from top border of the containing (main subwindow) when the subwindow is in
SubWindowMode.NORMAL state, or when next set to that state. |
protected SubWindowState |
getState() |
protected SubWindowState |
getState(boolean markAsDirty) |
String |
getTabStopBottomAssistiveText()
Gets the message that is provided to users of assistive devices when the user reaches the bottom of the subwindow when leaving a subwindow with
the tab key is prevented.
|
String |
getTabStopTopAssistiveText()
Gets the message that is provided to users of assistive devices when the user reaches the top of the subwindow when leaving a subwindow with
the tab key is prevented.
|
SubWindowMode |
getWindowMode()
Gets the current mode of the subwindow.
|
boolean |
hasCloseShortcut(int keyCode,
int... modifiers)
Checks if a close subwindow shortcut key has already been registered.
|
boolean |
isClosable()
Returns the closable status of the subwindow.
|
boolean |
isDraggable()
Indicates whether a subwindow can be dragged or not.
|
boolean |
isModal() |
boolean |
isResizable() |
boolean |
isResizeLazy() |
boolean |
isTabStopEnabled()
Get if it is prevented to leave a subwindow with the tab key.
|
void |
paintContent(com.vaadin.server.PaintTarget target) |
void |
readDesign(org.jsoup.nodes.Element design,
com.vaadin.ui.declarative.DesignContext context) |
protected void |
readDesignChildren(org.jsoup.select.Elements children,
com.vaadin.ui.declarative.DesignContext context)
Reads the content and possible assistive descriptions from the list of child elements of a design.
|
void |
removeAllCloseShortcuts()
Removes all close shortcuts.
|
void |
removeCloseListener(SubWindow.CloseListener listener)
Deprecated.
|
void |
removeCloseShortcut()
Deprecated.
Use
removeCloseShortcut(int, int...) instead. |
void |
removeCloseShortcut(int keyCode,
int... modifiers)
Removes a close shortcut previously added with
addCloseShortcut(int, int...). |
void |
removeMinimizeListener(SubWindow.MinimizeListener listener)
Deprecated.
|
void |
removeResizeListener(SubWindow.ResizeListener listener)
Deprecated.
|
void |
removeWindowModeChangeListener(SubWindow.WindowModeChangeListener listener)
Deprecated.
|
void |
setAssistiveDescription(com.vaadin.ui.Component... components)
Allows to specify which components contain the description for the subwindow.
|
void |
setAssistivePostfix(String assistivePostfix)
Sets the accessibility postfix for the subwindow caption.
|
void |
setAssistivePrefix(String prefix)
Sets the accessibility prefix for the subwindow caption.
|
void |
setAssistiveRole(com.vaadin.shared.ui.window.WindowRole role)
Sets the WAI-ARIA role the subwindow.
|
void |
setClosable(boolean closable)
Sets the closable status for the subwindow.
|
void |
setCloseShortcut(int keyCode,
int... modifiers)
Deprecated.
Use
addCloseShortcut(int, int...) instead. |
void |
setDraggable(boolean draggable)
Enables or disables that a subwindow can be dragged (moved) by the user.
|
void |
setModal(boolean modal)
Sets subwindow modality.
|
void |
setParent(com.vaadin.ui.HasComponents parent) |
void |
setPosition(int x,
int y)
Sets the position of the subwindow on the screen using
setPositionX(int) and setPositionY(int). |
void |
setPositionX(int positionX)
Sets the distance of Window left border in pixels from left border of the containing (main subwindow).
|
void |
setPositionY(int positionY)
Sets the distance of Window top border in pixels from top border of the containing (main subwindow).
|
void |
setResizable(boolean resizable)
Sets subwindow resizable.
|
void |
setResizeLazy(boolean resizeLazy)
Should resize operations be lazy, i.e. should there be a delay before layout sizes are recalculated.
|
void |
setTabStopBottomAssistiveText(String bottomMessage)
Sets the message that is provided to users of assistive devices when the user reaches the bottom of the subwindow when leaving a subwindow with
the tab key is prevented.
|
void |
setTabStopEnabled(boolean tabStop)
Set if it should be prevented to set the focus to a component outside a non-modal subwindow with the tab key.
|
void |
setTabStopTopAssistiveText(String topMessage)
Sets the message that is provided to users of assistive devices when the user reaches the top of the subwindow when leaving a subwindow with
the tab key is prevented.
|
void |
setWindowMode(SubWindowMode windowMode)
Sets the mode for the subwindow.
|
void |
writeDesign(org.jsoup.nodes.Element design,
com.vaadin.ui.declarative.DesignContext context) |
addAction, addActionHandler, addClickListener, getActionManager, getScrollLeft, getScrollTop, getTabIndex, removeAction, removeActionHandler, removeAllActionHandlers, removeClickListener, setCaption, setScrollLeft, setScrollTop, setTabIndexaddComponentAttachListener, addComponentDetachListener, fireComponentAttachEvent, fireComponentDetachEvent, getComponentCount, getContent, iterator, removeComponentAttachListener, removeComponentDetachListener, removeFromParent, setContent, setHeight, setWidthaddContextClickListener, addListener, addShortcutListener, addStyleName, attach, beforeClientResponse, detach, findAncestor, fireComponentErrorEvent, fireComponentEvent, getCaption, getComponentError, getData, getDebugId, getDescription, getErrorMessage, getHeight, getHeightUnits, getIcon, getId, getLocale, getParent, getPrimaryStyleName, getStyleName, getWidth, getWidthUnits, isCaptionAsHtml, isConnectorEnabled, isEnabled, isOrHasAncestor, isReadOnly, isRequiredIndicatorVisible, isResponsive, isVisible, removeContextClickListener, removeListener, removeShortcutListener, removeStyleName, setCaptionAsHtml, setComponentError, setData, setDebugId, setDescription, setDescription, setEnabled, setHeight, setHeightUndefined, setIcon, setId, setLocale, setPrimaryStyleName, setReadOnly, setRequiredIndicatorVisible, setResponsive, setSizeFull, setSizeUndefined, setStyleName, setStyleName, setVisible, setWidth, setWidthUndefinedaddAttachListener, addDetachListener, addExtension, addListener, addListener, addListener, addMethodInvocationToQueue, createState, encodeState, equals, fireEvent, getAllChildrenIterable, getConnectorId, getErrorHandler, getExtensions, getListeners, getResource, getRpcManager, getRpcProxy, getSession, getStateType, getUI, handleConnectorRequest, hashCode, hasListeners, isAttached, isThis, markAsDirty, markAsDirtyRecursive, registerRpc, registerRpc, removeAttachListener, removeDetachListener, removeExtension, removeListener, removeListener, removeListener, removeListener, requestRepaint, requestRepaintAll, retrievePendingRpcCalls, setErrorHandler, setResource, updateDiffstateclone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitaddListener, addStyleName, addStyleNames, attach, getCaption, getDescription, getIcon, getId, getLocale, getParent, getPrimaryStyleName, getStyleName, getUI, isEnabled, isVisible, removeListener, removeStyleName, removeStyleNames, setEnabled, setIcon, setId, setPrimaryStyleName, setStyleName, setVisibleaddAttachListener, addDetachListener, beforeClientResponse, detach, encodeState, getErrorHandler, getExtensions, getRpcManager, getStateType, handleConnectorRequest, isAttached, isConnectorEnabled, markAsDirtyRecursive, removeAttachListener, removeDetachListener, removeExtension, requestRepaint, requestRepaintAll, retrievePendingRpcCalls, setErrorHandlergetHeight, getHeightUnits, getWidth, getWidthUnits, setHeight, setHeight, setHeightUndefined, setSizeFull, setSizeUndefined, setWidth, setWidth, setWidthUndefinedforEach, spliteratorpublic SubWindow()
public SubWindow(String caption)
caption - the title of the subwindow.public SubWindow(String caption, com.vaadin.ui.Component content)
caption - the title of the subwindow.content - the contents of the subwindowpublic void paintContent(com.vaadin.server.PaintTarget target)
throws com.vaadin.server.PaintException
paintContent in interface com.vaadin.ui.LegacyComponentpaintContent in class com.vaadin.ui.Panelcom.vaadin.server.PaintExceptionpublic void setParent(com.vaadin.ui.HasComponents parent)
setParent in interface com.vaadin.ui.ComponentsetParent in class com.vaadin.ui.AbstractComponentpublic void changeVariables(Object source, Map<String,Object> variables)
changeVariables in interface com.vaadin.server.VariableOwnerchangeVariables in class com.vaadin.ui.Panelpublic void close()
By default, subwindows are removed from their respective UIs and thus visually closed on browser-side.
To react to a subwindow being closed (after it is closed), register a SubWindow.CloseListener.
public int getPositionX()
SubWindowMode.NORMAL.public void setPosition(int x,
int y)
setPositionX(int) and setPositionY(int).x - The new x coordinate for the subwindowy - The new y coordinate for the subwindowpublic void setPositionX(int positionX)
SubWindowMode.NORMAL mode.positionX - the Distance of Window left border in pixels from left border of the containing (main subwindow). or -1 if unspecified.public int getPositionY()
SubWindowMode.NORMAL state, or when next set to that state.public int getOrderPosition()
Window with position 0 is on the bottom, and subwindow with greatest position is at the top. If subwindow has no position (it's not yet
attached or hidden) then position is -1.
UI.addWindowOrderUpdateListener(com.vaadin.ui.UI.WindowOrderUpdateListener)public void setPositionY(int positionY)
SubWindowMode.NORMAL mode.positionY - the Distance of Window top border in pixels from top border of the containing (main subwindow). or -1 if unspecifiedpublic com.vaadin.shared.Registration addWindowOrderChangeListener(SubWindow.WindowOrderChangeListener listener)
The WindowOrderChangeEvent is fired when the order position is changed. It can happen when some subwindow (this or other) is brought to front or detached.
The other way to listen positions of all subwindows in UI is
UI.addWindowOrderUpdateListener(com.vaadin.ui.UI.WindowOrderUpdateListener)
listener - the WindowModeChangeListener to add.UI.addWindowOrderUpdateListener(com.vaadin.ui.UI.WindowOrderUpdateListener)protected void fireWindowOrderChange(Integer order)
order - orderpublic com.vaadin.shared.Registration addCloseListener(SubWindow.CloseListener listener)
Since Vaadin 6.5, removing subwindows using #removeWindow(SubWindow) does fire the CloseListener.
listener - the CloseListener to add, not null@Deprecated public void removeCloseListener(SubWindow.CloseListener listener)
For more information on CloseListeners see SubWindow.CloseListener.
listener - the CloseListener to remove.protected void fireClose()
public com.vaadin.shared.Registration addMinimizeListener(SubWindow.MinimizeListener listener)
Since Vaadin 6.5, removing subwindows using #removeWindow(SubWindow) does fire the CloseListener.
listener - the CloseListener to add, not null@Deprecated public void removeMinimizeListener(SubWindow.MinimizeListener listener)
For more information on MinimizeListeners see SubWindow.MinimizeListener.
listener - the MinimizeListener to remove.protected void fireMinimize()
public com.vaadin.shared.Registration addWindowModeChangeListener(SubWindow.WindowModeChangeListener listener)
listener - the WindowModeChangeListener to add.@Deprecated public void removeWindowModeChangeListener(SubWindow.WindowModeChangeListener listener)
listener - the WindowModeChangeListener to remove.protected void fireWindowWindowModeChange()
public com.vaadin.shared.Registration addResizeListener(SubWindow.ResizeListener listener)
listener - the listener to add, not nullRegistration@Deprecated public void removeResizeListener(SubWindow.ResizeListener listener)
listener - listenerprotected void fireResize()
public void bringToFront()
public void setModal(boolean modal)
Keyboard navigation is restricted by blocking the tab key at the top and bottom of the subwindow by activating the tab stop function internally.
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 subwindow can be closed by the user.public boolean isDraggable()
true if subwindow is draggable; false if notpublic void setDraggable(boolean draggable)
draggable - true if the subwindow can be dragged by the userpublic SubWindowMode getWindowMode()
SubWindowModepublic void setWindowMode(SubWindowMode windowMode)
windowMode - windowModeSubWindowMode@Deprecated public void setCloseShortcut(int keyCode, int... modifiers)
addCloseShortcut(int, int...) instead.SubWindow - to preserve compatibility with existing code under the new
functionality, this method now first removes all registered close shortcuts, then adds the default ESCAPE shortcut key, and then attempts to
add the shortcut provided as parameters to this method. This method, and its companion removeCloseShortcut(), are now considered
deprecated, as their main function is to preserve exact backwards compatibility with old code. For all new code, use the new keyboard shortcuts
API: addCloseShortcut(int,int...),
removeCloseShortcut(int,int...),
removeAllCloseShortcuts(), hasCloseShortcut(int,int...) and getCloseShortcuts().
Original description: Makes it possible to close the subwindow by pressing the given ShortcutAction.KeyCode and (optional) ShortcutAction.ModifierKeys. Note
that this shortcut only reacts while the subwindow has focus, closing itself - if you want to close a subwindow from a UI, use
UI.addAction(com.vaadin.event.Action) of the UI instead.
keyCode - the keycode for invoking the shortcutmodifiers - the (optional) modifiers for invoking the shortcut. Can be set to null to be explicit about not having modifiers.@Deprecated public void removeCloseShortcut()
removeCloseShortcut(int, int...) instead.setCloseShortcut(int, int...) and addCloseShortcut(int, int...), then adds
the default ShortcutAction.KeyCode.ESCAPE shortcut.
This is the old way of removing the (single) keyboard close shortcut, and is retained only for exact backwards compatibility. For all new code,
use the new keyboard shortcuts API: addCloseShortcut(int,int...),
removeCloseShortcut(int,int...),
removeAllCloseShortcuts(), hasCloseShortcut(int,int...) and getCloseShortcuts().
public void addCloseShortcut(int keyCode,
int... modifiers)
keyCode - the keycode for invoking the shortcutmodifiers - the (optional) modifiers for invoking the shortcut. Can be set to null to be explicit about not having modifiers.public void removeCloseShortcut(int keyCode,
int... modifiers)
addCloseShortcut(int, int...).keyCode - the keycode for invoking the shortcutmodifiers - the (optional) modifiers for invoking the shortcut. Can be set to null to be explicit about not having modifiers.public void removeAllCloseShortcuts()
removeCloseShortcut(int, int...).public boolean hasCloseShortcut(int keyCode,
int... modifiers)
keyCode - the keycode for invoking the shortcutmodifiers - the (optional) modifiers for invoking the shortcut. Can be set to null to be explicit about not having modifiers.public Collection<SubWindow.CloseShortcut> getCloseShortcuts()
SubWindow.CloseShortcut objects currently registered with this SubWindow. This method is provided
mainly so that users can implement their own serialization routines. To check if a certain combination of keys has been registered as a close
shortcut, use the hasCloseShortcut(int, int...) method instead.public com.vaadin.shared.Registration addFocusListener(com.vaadin.event.FieldEvents.FocusListener listener)
addFocusListener in interface com.vaadin.event.FieldEvents.FocusNotifierpublic com.vaadin.shared.Registration addBlurListener(com.vaadin.event.FieldEvents.BlurListener listener)
addBlurListener in interface com.vaadin.event.FieldEvents.BlurNotifierpublic void focus()
focus in interface com.vaadin.ui.Component.Focusablefocus in class com.vaadin.ui.Panelprotected SubWindowState getState()
getState in class com.vaadin.ui.Panelprotected SubWindowState getState(boolean markAsDirty)
getState in class com.vaadin.ui.Panelpublic void setAssistiveDescription(com.vaadin.ui.Component... components)
components - the components to use as descriptionpublic com.vaadin.ui.Component[] getAssistiveDescription()
public void setAssistivePrefix(String prefix)
prefix - String that is placed before the subwindow captionpublic String getAssistivePrefix()
public void setAssistivePostfix(String assistivePostfix)
assistivePostfix - String that is placed after the subwindow captionpublic String getAssistivePostfix()
public void setAssistiveRole(com.vaadin.shared.ui.window.WindowRole role)
role - WAI-ARIA role to set for the subwindowpublic com.vaadin.shared.ui.window.WindowRole getAssistiveRole()
public void setTabStopEnabled(boolean tabStop)
This is meant to help users of assistive devices to not leaving the subwindow unintentionally.
For modal subwindows, this function is activated automatically, while preserving the stored value of tabStop.
tabStop - true to keep the focus inside the subwindow when reaching the top or bottom, false (default) to allow leaving the subwindowpublic boolean isTabStopEnabled()
public void setTabStopTopAssistiveText(String topMessage)
This message is not visible on the screen.
topMessage - String provided when the user navigates with Shift-Tab keys to the top of the subwindowpublic void setTabStopBottomAssistiveText(String bottomMessage)
This message is not visible on the screen.
bottomMessage - String provided when the user navigates with the Tab key to the bottom of the subwindowpublic String getTabStopTopAssistiveText()
public String getTabStopBottomAssistiveText()
public void readDesign(org.jsoup.nodes.Element design,
com.vaadin.ui.declarative.DesignContext context)
readDesign in interface com.vaadin.ui.ComponentreadDesign in class com.vaadin.ui.Panelprotected void readDesignChildren(org.jsoup.select.Elements children,
com.vaadin.ui.declarative.DesignContext context)
:assistive-description attribute, adds the parsed component to the list of components used as the assistive description of this Window.
Otherwise, sets the component as the content of this Window. If there are multiple non-description elements, throws a DesignException.readDesignChildren in class com.vaadin.ui.AbstractSingleComponentContainerchildren - child elements in a designcontext - the DesignContext instance used to parse the designcom.vaadin.ui.declarative.DesignException - if there are multiple non-description child elementscom.vaadin.ui.declarative.DesignException - if a child element could not be parsed as a ComponentAbstractSingleComponentContainer.setContent(Component),
setAssistiveDescription(Component...)public void writeDesign(org.jsoup.nodes.Element design,
com.vaadin.ui.declarative.DesignContext context)
writeDesign in interface com.vaadin.ui.ComponentwriteDesign in class com.vaadin.ui.Panelprotected Collection<String> getCustomAttributes()
getCustomAttributes in class com.vaadin.ui.PanelCopyright © 2018 Awesome controls. All rights reserved.