Package org.apache.pivot.wtk
Class Window
- java.lang.Object
 - 
- org.apache.pivot.wtk.Component
 - 
- org.apache.pivot.wtk.Container
 - 
- org.apache.pivot.wtk.Window
 
 
 
 
- 
- All Implemented Interfaces:
 java.lang.Iterable<Component>,Sequence<Component>,ConstrainedVisual,Visual
- Direct Known Subclasses:
 ColorChooserButtonSkin.ColorChooserPopup,Frame,ListViewItemEditor,MenuPopup,Palette,Sheet,SuggestionPopup,TableViewRowEditor,Tooltip,TreeViewNodeEditor
@DefaultProperty("content") public class Window extends Container
Top-level container representing the entry point into a user interface. Windows are direct descendants of the display. 
- 
- 
Nested Class Summary
Nested Classes Modifier and Type Class Description static classWindow.ActionMappingClass representing a mapping from keystrokes to actions.classWindow.ActionMappingSequenceclassWindow.IconImageSequencestatic interfaceWindow.SkinWindow skin interface.- 
Nested classes/interfaces inherited from class org.apache.pivot.wtk.Container
Container.EDTChecker 
- 
Nested classes/interfaces inherited from class org.apache.pivot.wtk.Component
Component.DecoratorSequence, Component.StyleDictionary, Component.UserDataDictionary 
- 
Nested classes/interfaces inherited from interface org.apache.pivot.collections.Sequence
Sequence.Tree<T> 
 - 
 
- 
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidalign(Bounds bounds, HorizontalAlignment horizontalAlignment, int horizontalOffset, VerticalAlignment verticalAlignment, int verticalOffset)voidalign(Bounds bounds, HorizontalAlignment horizontalAlignment, VerticalAlignment verticalAlignment)static voidclearActive()Clears the active window.voidclearFocusDescendant()Clears the window descendant to which focus will be restored when this window is moved to the front, meaning that when this window is moved to front, focus will not be restored to the window.voidclose()Closes the window and all of its owned windows.protected voiddescendantGainedFocus(Component descendant, Component previousFocusedComponent)protected voiddescendantRemoved(Component descendant)Window.ActionMappingSequencegetActionMappings()static WindowgetActiveWindow()Returns the currently active window.BoundsgetClientArea()ComponentgetContent()ComponentgetFocusDescendant()Window.IconImageSequencegetIcons()WindowgetOwnedWindow(int index)intgetOwnedWindowCount()WindowgetOwner()WindowgetRootOwner()java.lang.StringgetTitle()Returns the window's title.ListenerList<WindowActionMappingListener>getWindowActionMappingListeners()static ListenerList<WindowClassListener>getWindowClassListeners()ListenerList<WindowListener>getWindowListeners()ListenerList<WindowStateListener>getWindowStateListeners()booleanisActive()Returns the window's active state.booleanisBottomMost()Determines if this is the bottom-most window.booleanisClosed()Returns this window's closed state.booleanisClosing()Returns this window's closing state.booleanisMaximized()booleanisOpen()Returns this window's open state.booleanisOpening()Returns this window's opening state.booleanisOwner(Window window)Tests whether this window is an owning ancestor of a given window.booleanisTopMost()Determines if this is the top-most window.booleankeyPressed(int keyCode, Keyboard.KeyLocation keyLocation)voidmoveToBack()Moves the window to the bottom of the window stack.voidmoveToFront()Moves the window to the top of the window stack.voidopen(Display display)Opens the window.voidopen(Display display, Window ownerArgument)Opens the window.voidopen(Window ownerArgument)Opens the window.Sequence<Component>remove(int index, int count)Removes one or more items from the sequence.booleanrequestActive()Requests that this window become the active window.protected voidsetActive(boolean active, Window obverseWindow)Called to notify a window that its active state has changed.voidsetContent(Component content)voidsetEnabled(boolean enabled)Sets the component's enabled state.voidsetIcon(java.lang.String iconName)Sets the window's icon by resource name.voidsetIcon(java.net.URL iconURL)Sets the window's icon by URL.voidsetMaximized(boolean maximized)protected voidsetParent(Container parent)voidsetTitle(java.lang.String title)Sets the window's title.voidsetVisible(boolean visible)Sets the component's visibility.- 
Methods inherited from class org.apache.pivot.wtk.Container
add, assertEventDispatchThread, assertEventDispatchThread, clear, containsFocus, descendantAdded, descendantLostFocus, get, getComponentAt, getContainerListeners, getContainerMouseListeners, getDescendantAt, getFocusTraversalPolicy, getGraphics, getLength, getNamedComponent, indexOf, insert, invalidate, isAncestor, isDoubleBuffered, iterator, layout, load, mouseClick, mouseDown, mouseMove, mouseOut, mouseUp, mouseWheel, move, paint, remove, removeAll, repaint, requestFocus, setDoubleBuffered, setEventDispatchThreadChecker, setFocusTraversalPolicy, store, transferFocus, update 
- 
Methods inherited from class org.apache.pivot.wtk.Component
checkSkin, clearFocus, contains, copyStyle, copyStyle, getAncestor, getAncestor, getAttribute, getAutomationID, getBaseline, getBaseline, getBounds, getComponentClassListeners, getComponentDataListeners, getComponentDecoratorListeners, getComponentKeyListeners, getComponentListeners, getComponentMouseButtonListeners, getComponentMouseListeners, getComponentMouseWheelListeners, getComponentStateListeners, getComponentStyleListeners, getComponentTooltipListeners, getCursor, getDecoratedBounds, getDecorators, getDisplay, getDragSource, getDropTarget, getFocusedComponent, getHeight, getHeightLimits, getLocation, getMaximumHeight, getMaximumWidth, getMenuHandler, getMinimumHeight, getMinimumWidth, getMouseLocation, getName, getNamedStyles, getParent, getPreferredHeight, getPreferredHeight, getPreferredSize, getPreferredWidth, getPreferredWidth, getScreenBounds, getSize, getSkin, getStyle, getStyle, getStyleBoolean, getStyleBoolean, getStyleColor, getStyleColor, getStyleFont, getStyleFont, getStyleInt, getStyleInt, getStyles, getTextInputMethodListener, getTooltipDelay, getTooltipText, getTooltipWrapText, getTypedStyles, getUserData, getVisibleArea, getVisibleArea, getVisibleArea, getWidth, getWidthLimits, getWindow, getX, getY, indexBoundsCheck, installSkin, isBlocked, isEnabled, isFocusable, isFocused, isMouseOver, isOpaque, isPreferredHeightSet, isPreferredSizeSet, isPreferredWidthSet, isShowing, isValid, isVisible, keyReleased, keyTyped, mapPointFromAncestor, mapPointFromAncestor, mapPointToAncestor, mapPointToAncestor, mouseOver, offsetToScreen, putStyle, putStyle, reenterMouse, repaint, repaint, repaint, repaint, repaint, scrollAreaToVisible, scrollAreaToVisible, setAttribute, setAutomationID, setAutomationID, setCursor, setDragSource, setDropTarget, setFocused, setHeight, setHeightLimits, setHeightLimits, setLocation, setLocation, setMaximumHeight, setMaximumWidth, setMenuHandler, setMinimumHeight, setMinimumWidth, setName, setPreferredHeight, setPreferredSize, setPreferredSize, setPreferredWidth, setSize, setSize, setSkin, setStyleName, setStyleNames, setStyleNames, setStyles, setStyles, setTooltipDelay, setTooltipText, setTooltipWrapText, setWidth, setWidthLimits, setWidthLimits, setX, setY, toString, transferFocus, validate 
 - 
 
 - 
 
- 
- 
Constructor Detail
- 
Window
public Window()
 
- 
Window
public Window(Component content)
 
 - 
 
- 
Method Detail
- 
remove
public Sequence<Component> remove(int index, int count)
Description copied from interface:SequenceRemoves one or more items from the sequence. 
- 
setVisible
public void setVisible(boolean visible)
Description copied from class:ComponentSets the component's visibility.- Overrides:
 setVisiblein classContainer- Parameters:
 visible-trueif the component should be painted;false, otherwise.
 
- 
setEnabled
public void setEnabled(boolean enabled)
Description copied from class:ComponentSets the component's enabled state. Enabled components respond to user input events; disabled components do not.- Overrides:
 setEnabledin classComponent- Parameters:
 enabled-trueif the component is enabled;false, otherwise.
 
- 
getOwner
public Window getOwner()
 
- 
getRootOwner
public Window getRootOwner()
 
- 
getOwnedWindow
public Window getOwnedWindow(int index)
 
- 
getOwnedWindowCount
public int getOwnedWindowCount()
 
- 
isOwner
public boolean isOwner(Window window)
Tests whether this window is an owning ancestor of a given window. A window is not considered an owner of itself.- Parameters:
 window- The window which could be an owned descendant of this window.- Returns:
 trueif this window is an owning ancestor of the given window;falseotherwise.
 
- 
isOpen
public boolean isOpen()
Returns this window's open state.- Returns:
 trueif the window is open;falseotherwise.
 
- 
isOpening
public boolean isOpening()
Returns this window's opening state.- Returns:
 trueif the window is opening;falseotherwise.
 
- 
open
public final void open(Display display)
Opens the window.- Parameters:
 display- The display on which to open this window.
 
- 
open
public final void open(Window ownerArgument)
Opens the window.- Parameters:
 ownerArgument- The window's owner. The window is opened on the owner's display.- Throws:
 java.lang.IllegalArgumentException- if the owner argument isnull.
 
- 
open
public void open(Display display, Window ownerArgument)
Opens the window.Note that this method is not a synchronous call, it schedules an event to open the window.
- Parameters:
 display- The display on which the window will be opened.ownerArgument- The window's owner, ornullif the window has no owner.
 
- 
isClosed
public boolean isClosed()
Returns this window's closed state.- Returns:
 trueif the window is closed;falseotherwise.
 
- 
isClosing
public boolean isClosing()
Returns this window's closing state.- Returns:
 trueif the window is closing;falseotherwise.
 
- 
close
public void close()
Closes the window and all of its owned windows. If any owned window fails to close, this window will also fail to close. 
- 
getTitle
public java.lang.String getTitle()
Returns the window's title.- Returns:
 - The pane's title, or 
nullif no title is set. 
 
- 
setTitle
public void setTitle(java.lang.String title)
Sets the window's title.- Parameters:
 title- The new title, ornullfor no title.
 
- 
getIcons
public Window.IconImageSequence getIcons()
- Returns:
 - The icons for this window.
 
 
- 
setIcon
public void setIcon(java.net.URL iconURL)
Sets the window's icon by URL.If the icon already exists in the application context resource cache, the cached value will be used. Otherwise, the icon will be loaded synchronously and added to the cache.
- Parameters:
 iconURL- The location of the icon to set.
 
- 
setIcon
public void setIcon(java.lang.String iconName)
Sets the window's icon by resource name.- Parameters:
 iconName- The resource name of the icon to set.- See Also:
 setIcon(URL),ImageUtils.findByName(String,String)
 
- 
getContent
public Component getContent()
 
- 
setContent
public void setContent(Component content)
 
- 
getClientArea
public Bounds getClientArea()
- Returns:
 - The bounds of the window's client area.
 
 
- 
isActive
public boolean isActive()
Returns the window's active state.- Returns:
 trueif the window is active;false; otherwise.
 
- 
requestActive
public boolean requestActive()
Requests that this window become the active window.- Returns:
 trueif the window became active;falseotherwise.
 
- 
setActive
protected void setActive(boolean active, Window obverseWindow)Called to notify a window that its active state has changed.- Parameters:
 active- The new value of the "active" state for this window.obverseWindow- The "other" window (that is now in the obverse state).
 
- 
getActiveWindow
public static Window getActiveWindow()
Returns the currently active window.- Returns:
 - The window that is currently active, or 
nullif no window is active. 
 
- 
clearActive
public static void clearActive()
Clears the active window. 
- 
getFocusDescendant
public Component getFocusDescendant()
- Returns:
 - The window descendant to which focus will be restored when this window is moved to the front.
 
 
- 
clearFocusDescendant
public void clearFocusDescendant()
Clears the window descendant to which focus will be restored when this window is moved to the front, meaning that when this window is moved to front, focus will not be restored to the window. 
- 
descendantGainedFocus
protected void descendantGainedFocus(Component descendant, Component previousFocusedComponent)
- Overrides:
 descendantGainedFocusin classContainer
 
- 
descendantRemoved
protected void descendantRemoved(Component descendant)
- Overrides:
 descendantRemovedin classContainer
 
- 
getActionMappings
public Window.ActionMappingSequence getActionMappings()
- Returns:
 - The action mappings for this window.
 
 
- 
isTopMost
public boolean isTopMost()
Determines if this is the top-most window.- Returns:
 trueif this window is at the top of the Z-order of its display.
 
- 
isBottomMost
public boolean isBottomMost()
Determines if this is the bottom-most window.- Returns:
 trueif this window is at the bottom of the Z-order of its display.
 
- 
moveToFront
public void moveToFront()
Moves the window to the top of the window stack. All owned windows are subsequently moved to the front, ensuring that this window's owned windows remain on top of it. If the window does not have any owned windows, focus is restored to it. 
- 
moveToBack
public void moveToBack()
Moves the window to the bottom of the window stack. If the window is active, the active window will be cleared. If the window is the focus host, the focus will be cleared. 
- 
isMaximized
public boolean isMaximized()
 
- 
setMaximized
public void setMaximized(boolean maximized)
 
- 
align
public void align(Bounds bounds, HorizontalAlignment horizontalAlignment, VerticalAlignment verticalAlignment)
 
- 
align
public void align(Bounds bounds, HorizontalAlignment horizontalAlignment, int horizontalOffset, VerticalAlignment verticalAlignment, int verticalOffset)
 
- 
keyPressed
public boolean keyPressed(int keyCode, Keyboard.KeyLocation keyLocation)- Overrides:
 keyPressedin classComponent
 
- 
getWindowListeners
public ListenerList<WindowListener> getWindowListeners()
 
- 
getWindowStateListeners
public ListenerList<WindowStateListener> getWindowStateListeners()
 
- 
getWindowActionMappingListeners
public ListenerList<WindowActionMappingListener> getWindowActionMappingListeners()
 
- 
getWindowClassListeners
public static ListenerList<WindowClassListener> getWindowClassListeners()
 
 - 
 
 -