O - the type of output managerpublic abstract class TopLevelWindow<O extends OutputManager<?>> extends OuterFrame<O>
A top level window may exist on a "desktop" spanning multiple physical screen devices. These screen devices form a virtual device and common coordinate system with origin at top-left corner of the primary screen. Depending on the location of the primary screen in the virtual device, negative coordinates are possible.
To determine bounds of the physical screen a window is positioned on
call GuiDriver.getDisplayBounds(int). These bounds are needed
for example when positioning the window relative to the top-left corner
of the physical screen.
| Modifier and Type | Class and Description |
|---|---|
static class |
TopLevelWindow.IconDataType
Data type passing as initial window icon.
|
| Modifier and Type | Field and Description |
|---|---|
private static byte[] |
iconDef
Default window icon.
|
private boolean |
lastLeaveResult
LEAVE event result after window deactivated.
|
private java.util.Optional<TopLevelWindow<O>> |
owner
The owner of this window.
|
private FramePlacementManager |
placementManager
Frame placement manager.
|
listeners, location, mousePtr, nativeInsets, physicalLocation| Constructor and Description |
|---|
TopLevelWindow()
Default constructor.
|
TopLevelWindow(java.lang.String title)
Constructs a window widget with title.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addFrame(Widget<O> widget,
double row,
double column)
Adds the frame to the window at the specified position.
|
TitledWindow<O> |
ancestor()
Get ancestor window for this widget.This method must be called
only for widgets that are already attached to Window.
|
Rectangle |
bounds()
Get widget bounding rectangle.
|
protected NativeRectangle |
clipRectangle()
Build widget clipped rectangle.
|
void |
close()
The method hides the window if visible and then destroys it by the means of
calling
TitledWindow.destroy() method. |
Widget<O> |
defaultFocus()
Replacement method for
AbstractContainer.defaultFocus()
implementation which takes into account that frames are listed in
reverse order by the means of Z-order (i.e. topmost window is
last in the list). |
void |
findFrames(java.util.List<Frame<?>> list,
Rectangle rect,
boolean full,
boolean redirected)
Collect all frames which are intersected with specified rectangle into
provided list.
|
void |
findFrames(java.util.List<Frame<?>> list,
Rectangle rect,
boolean full,
boolean redirected,
boolean special)
Collect all frames which are intersected with specified rectangle into
provided list.
|
abstract Container<O> |
getContentPane()
Get window content pane.
|
Frame<?> |
getFirstVisibleFrame()
Gets the first frame from the list of currently displayed frames.
|
java.util.List<Frame<O>> |
getFrames()
Returns the frames contained in this top-level window.
|
Frame<?> |
getNextEnabledFrame(Frame<?> frame)
Get the first enabled, visible frame, in z-order, after the specified
frame.
|
Frame<?> |
getNextVisibleFrame(Frame<?> frame)
Gets the frame from the list of currently displayed frames that
immediately follows the specified frame.
|
TopLevelWindow<O> |
getOwner()
Returns the owner.
|
java.util.Optional<TopLevelWindow<O>> |
getOwnerOpt()
Returns the owner as Optional.
|
FramePlacementManager |
getPlacementManager()
Get the
FramePlacementManager associated with this window. |
Frame<?> |
getPrevEnabledFrame(Frame<?> frame)
Get the first enabled, visible frame, in z-order, before the specified
frame.
|
abstract WidgetLocationRef |
getRelativeTo()
Returns the widget location relativity.
|
abstract Dimension |
getScreenDimension()
Get dimension of screen area available for the placement of frames.
|
WindowTitleBar |
getTitleBar()
Get the title bar widget associated witn this window.
|
Frame<?> |
getTopFrame(boolean ignoreState)
Returns the frame that is on top of the Z-order or
null
if no such frame present. |
Frame<?> |
getTopVisibleFrame()
Get top visible frame.
|
static byte[] |
getWindowDefaultIcon()
Sets the default window icon for all new windows on the client side.
|
boolean |
isFocusable()
Checks whether this attribute container can receive focus generally.
|
boolean |
isLastLeaveResult()
Check the window's
lastLeaveResult state. |
boolean |
isMaximized()
Check if the window is already maximized - it can't be resized.
|
boolean |
isMinimized()
Check if the window is minimized.
|
boolean |
loadWindowIcon(boolean small,
java.lang.String name)
Loads the new application icon for given window from the client side filesystem.
|
boolean |
parentOrSelfHidden()
Check if the current window or one of its ancestors is hidden.
|
NativeRectangle |
physicalBounds()
Determine the physical bounds, relative to screen, expressed in units native to UI type.
|
void |
processFocusEvent(FocusEvent event)
Process focus event.
|
void |
reflectLocationChanged()
Called when the widget's location changes.
|
void |
repaint()
For windows, repaint must use the window's top-left corner (0,0) as origin, not the
screen's.
|
void |
repaintDecorations()
Repaints window's decorations (titlebar with its components and window's border).
|
void |
resetMousePointer()
Reset the custom mouse pointer.
|
int |
resolveTitleFont()
Resolve the font associated with the window's title.
|
Point |
screenLocation()
Get absolute location of widget in screen coordinates.
|
NativePoint |
screenPhysicalLocation()
Get absolute location of widget in screen coordinates.
|
void |
setLastLeaveResult(boolean lastLeaveResult)
Set the window's
lastLeaveResult state. |
protected void |
setOwner(TopLevelWindow<O> owner)
Sets the owner window.
|
static boolean |
setWindowDefaultIcon(TopLevelWindow.IconDataType type,
java.lang.Object data)
Sets the default window icon for all new windows on the client side.
|
boolean |
setWindowIcon(boolean small,
byte[] newIcon)
Sets the new application icon for given window on the client side.
|
boolean |
setWindowIcon(byte[] newIcon)
Sets the new application icon for given window on the client side.
|
Window<O> |
window()
Get ancestor Window for this widget.
|
draw, drawIntdestroy, destroyWidgets, findMouseSource, focusTraversable, getWorkspaceSize, getZOrderClass, hasFocus, hasTitle, hasTitlebar, hide, isDisplayed, isModal, processEvent, processKeyEvent, setTitle, show, title, toStringadd, add, add, addContainerStateListener, addDirectly, belongsTo, checkWidget, childrenLocation, clipping, clipRectangle, copyState, currentFocus, currentFocus, cycleFocus, deregisterSelectedWidget, detach, dimension, doLayout, dumpCurrentWidgets, dumpWidgets, endSizeChange, findMouseSource, firstFocus, focus, focusWorker, formatDump, get, getAllSelectedWidgets, getClipRect, getEffectiveScrollableSize, getFocusInt, getIgnoreFocus, getLayout, getScrollableSize, getTabItemList, hasFocusable, height, insets, lastFocus, minimumSize, moveAfterTabItem, moveBeforeTabItem, moveToBottom, moveToBottomInClass, moveToTop, moveToTopInClass, moveToZpos, nextFocus, normalizeZOrder, onWidgetAdded, onWidgetRemoved, paintOnTop, parentOf, prepareWidgets, prevFocus, reflectAncestorChange, registerSelectedWidget, remove, removeContainerStateListener, replace, requestFocus, requestFocus, setFocus, setFocusInt, setHeight, setIgnoreFocus, setInsets, setLayout, setPhysicalDimensionInt, setSize, setSize, setTabItemList, setWidth, startSizeChange, swap, triggerContainerStateRedrawEnabled, unrealize, updateSizeWorker, widgets, widgetsAsList, widgetStateChanged, width_setHidden, _setVisible, activateDirectManipulation, addFocusListener, addKeyListener, afterConfigUpdateBase, ancestorId, autoResize, clear, clearWidget, clipRectangle, clipWith, config, copyColors, createMouseHoverAction, deactivateDirectManipulation, debug, disable, disableTooltip, displayPhysicalLocation, drawCaret, enable, enableTooltip, enclosingFrame, forceCursorOnFocus, forceVisibility, getActualBounds, getAndResetBitmap, getAndSetBitmap, getBitmapCopy, getCachedScreenLocation, getCachedScreenPhysicalLocation, getCustomMousePointer, getDefaultEvent, getEffectiveMousePointer, getId, getLoadedMousePointer, getMenuMouse, getMouseActions, getMousePosition, getPortableMouseEventCoordinates, getSelectedText, getState, getTextHeight, getTextHeightNative, getTextHeightNative, getTextWidth, getTextWidth, getTextWidthNative, getTextWidthNative, getVisiblePart, hasFocus, hasTooltip, hidden, highlighted, ignoreAction, initialHeight, initialWidth, isCurrent, isDirectManipulationActive, isDirectManipulationActiveOrInUIB, isDirectManipulationCapable, isDirectManipulationRequired, isEnabled, isHeader, isMouseDrag, isRealized, isRepaintDisabled, isRMBEntrySupported, isScreenLocationCached, isTabStop, isThreeD, isTotallyObscured, isVisible, isVisible, location, manageSystemActions, mouseActions, mouseClicked, mouseDragged, mouseEntered, mouseExited, mouseMoved, mousePressed, mouseReleased, mouseWheelMoved, moveToBottom, moveToTop, name, navigable, oleDoDrop, oleDrag, oleDragging, oleStartDragging, onOleDragging, onOleDropEnd, parent, parent, parentObject, parentOrSelf, parentOrSelfObject, physicalDimension, physicalLocation, postprocessConfig, prepParentLocation, preventFocusWhenMouseDownEventDefined, processDirectManipulationEvent, processKeyEventForSelectableWidget, processKeyListeners, processMnemonic, processMnemonicImpl, processSystemKey, raiseLegacyMouseEvents, reflectSizeChanged, refresh, registerWidgetListener, repaint, repaint, requestSync, resetBitmap, resizeTo, resolveFont, resolvePopupMenuId, screen, screenDimension, screenHeight, screenWidth, setBitmap, setCachedScreenLocation, setCachedScreenPhysicalLocation, setDirectManipulationActive, setEnabled, setHidden, setHighlighted, setLocation, setLocation, setMousePointer, setMousePointer, setParent, setPhysicalLocation, setSensitiveForUIB, setState, setVisible, setWindow, showPopupMenu, supportsCustomMousePointer, sync, topLevelWindow, translate, triggerLocationChanged, unregisterWidgetListener, updateSystemParent, widgetRealizedclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitwidgetsAsListacceptsEscAsAnyKey, acceptTrigger, addFocusListener, addKeyListener, ancestorId, canMovetoTop, clearWidget, completeTrigger, config, defaultMousePtr, displayPhysicalLocation, drawCaret, enclosingFrame, enforceDefaultMousePtr, forceCursorOnFocus, forceVisibility, getActualBounds, getCustomMousePointer, getEffectiveMousePointer, getId, getIdForTrigger, getLegacyWidget, getLoadedMousePointer, getMenuMouse, getMouseActions, getMousePosition, getSelectedText, getState, getTriggerWidget, getTriggerWidget, getVisiblePart, hasFocus, hasTooltip, hidden, highlighted, ignoreEnable, initialHeight, initialWidth, isCurrent, isCurrent, isDirectManipulable, isDirectManipulationActive, isDirectManipulationActiveOrInUIB, isDroppable, isEnabled, isHeader, isInitialValueLayout, isLegacyFocus, isProcessProgressEvent, isRealized, isRepaintDisabled, isRMBEntrySupported, isTabStop, isThreeD, isTotallyObscured, isVisible, isVisible, location, maySwitchFocus, moveToBottom, moveToTop, name, navigable, oleDrag, parent, parent, parent, parentObject, parentOrSelf, parentOrSelfObject, physicalDimension, physicalLocation, postprocessConfig, preventFocusWhenMouseDownEventDefined, processDirectManipulationEvent, processKeyListeners, processMnemonic, raiseLegacyMouseEvents, refreshWidget, registerWidgetListener, repaint, repaint, requestFocus, requestSync, resizeTo, resolvePopupMenuId, screen, setDirectManipulationActive, setEnabled, setHidden, setHighlighted, setLocation, setLocation, setMousePointer, setMousePointer, setParent, setPhysicalLocation, setSensitiveForUIB, setState, setVisible, setWindow, startTrigger, supportsCustomMousePointer, systemFocusGrabbed, topLevelWindow, unregisterWidgetListener, validateDisplayValueprivate static byte[] iconDef
private java.util.Optional<TopLevelWindow<O extends OutputManager<?>>> owner
private boolean lastLeaveResult
private FramePlacementManager placementManager
public TopLevelWindow()
public TopLevelWindow(java.lang.String title)
title - Window title.public TopLevelWindow<O> getOwner()
public java.util.Optional<TopLevelWindow<O>> getOwnerOpt()
public abstract WidgetLocationRef getRelativeTo()
public WindowTitleBar getTitleBar()
public static boolean setWindowDefaultIcon(TopLevelWindow.IconDataType type, java.lang.Object data)
type - Data type for second parameter.data - Data to create new icon on client side. Can be the byte array, filename string
or nothing for predefined icon from p2j.jar client side file.TRUE if operation successful FALSE otherwise.public Point screenLocation()
screenLocation in interface Widget<O extends OutputManager<?>>screenLocation in class TitledWindow<O extends OutputManager<?>>public NativePoint screenPhysicalLocation()
screenPhysicalLocation in interface Widget<O extends OutputManager<?>>screenPhysicalLocation in class AbstractWidget<O extends OutputManager<?>>public Rectangle bounds()
For windows, the boundary starts from (0,0) regardless where is placed on screen.
bounds in interface Widget<O extends OutputManager<?>>bounds in class AbstractWidget<O extends OutputManager<?>>public NativeRectangle physicalBounds()
For windows, the boundary starts from (0,0) regardless where is placed on screen.
physicalBounds in interface Widget<O extends OutputManager<?>>physicalBounds in class AbstractWidget<O extends OutputManager<?>>public void resetMousePointer()
public void repaintDecorations()
public abstract Container<O> getContentPane()
public void addFrame(Widget<O> widget, double row, double column)
widget - The handle of the frame to be added to the window.row - The row number for the upper-left frame corner.column - The column number for the upper-left frame corner.public abstract Dimension getScreenDimension()
Dimension which describes size of the
available screen area.public java.util.List<Frame<O>> getFrames()
public Frame<?> getNextVisibleFrame(Frame<?> frame)
frame - frame that designates the starting pointnullpublic Frame<?> getFirstVisibleFrame()
nullpublic Frame<?> getTopFrame(boolean ignoreState)
null
if no such frame present. If requested method also can filter out all
invisible, disabled and out of scope frames.ignoreState - if true then ignore frame state during search.null.public Frame<?> getNextEnabledFrame(Frame<?> frame)
If no frame is specified, it will get the bottommost enabled and visible frame.
frame - Reference frame. When null, it will return the
bottommost enabled and visible frame.public Frame<?> getPrevEnabledFrame(Frame<?> frame)
If no frame is specified, it will get the bottommost enabled and visible frame.
frame - Reference frame. When null, it will return the
topmost enabled and visible frame.public Frame<?> getTopVisibleFrame()
null if there is
no such frame.public boolean setWindowIcon(byte[] newIcon)
newIcon - A new icon image array data.TRUE if operation successful FALSE otherwise.public boolean setWindowIcon(boolean small,
byte[] newIcon)
small - Flag indicating usage of the small icon case(16x16 in size).newIcon - A new icon image array data.TRUE if operation successful FALSE otherwise.public boolean loadWindowIcon(boolean small,
java.lang.String name)
small - Flag indicating usage of the small icon case(16x16 in size).name - The fully qualified file name for the icon to be loaded.TRUE if operation successful FALSE otherwise.public static byte[] getWindowDefaultIcon()
public boolean isMaximized()
false.public boolean isMinimized()
true, false otherwise.public int resolveTitleFont()
resolveTitleFont in class AbstractWidget<O extends OutputManager<?>>public Window<O> window()
window in interface Widget<O extends OutputManager<?>>window in class AbstractWidget<O extends OutputManager<?>>java.lang.IllegalStateException - When this widget is not attached to window.public TitledWindow<O> ancestor()
ancestor in interface Widget<O extends OutputManager<?>>ancestor in class AbstractWidget<O extends OutputManager<?>>java.lang.IllegalStateException - When this widget is not attached to window.public void repaint()
repaint in interface Widget<O extends OutputManager<?>>repaint in class AbstractContainer<O extends OutputManager<?>>public Widget<O> defaultFocus()
AbstractContainer.defaultFocus()
implementation which takes into account that frames are listed in
reverse order by the means of Z-order (i.e. topmost window is
last in the list).defaultFocus in interface Container<O extends OutputManager<?>>defaultFocus in class AbstractContainer<O extends OutputManager<?>>public boolean isFocusable()
isFocusable in interface Widget<O extends OutputManager<?>>isFocusable in class AbstractWidget<O extends OutputManager<?>>true if this container can be focused under
certain conditions. false if, and only if, this
attribute container can never receive focus.public boolean parentOrSelfHidden()
true if this window or one of its ancestors is hidden.public void close()
TitledWindow.destroy() method. Both operations are enqueued on the OS
event queue, this allows all pending events to be processed before the
window is closed.public void processFocusEvent(FocusEvent event)
processFocusEvent in interface Widget<O extends OutputManager<?>>processFocusEvent in class AbstractWidget<O extends OutputManager<?>>event - Event to process.public void findFrames(java.util.List<Frame<?>> list, Rectangle rect, boolean full, boolean redirected)
list - List where frames will be stored.rect - Bounding rectangle.full - If true collect all frames. Otherwise frames
with OVERLAY option are excluded.redirected - If in redirected mode, return only redirected frames. Else,
return only the interactive frames.public void findFrames(java.util.List<Frame<?>> list, Rectangle rect, boolean full, boolean redirected, boolean special)
list - List where frames will be stored.rect - Bounding rectangle.full - If true collect all frames. Otherwise frames
with OVERLAY option are excluded.redirected - If in redirected mode, return only redirected frames. Else,
return only the interactive frames.special - Enable special handling of empty NO-BOX frames.public FramePlacementManager getPlacementManager()
FramePlacementManager associated with this window.placementManager.public boolean isLastLeaveResult()
lastLeaveResult state.public void setLastLeaveResult(boolean lastLeaveResult)
lastLeaveResult state.lastLeaveResult - The flag's state.public void reflectLocationChanged()
reflectLocationChanged in class AbstractContainer<O extends OutputManager<?>>protected void setOwner(TopLevelWindow<O> owner)
owner - Reference to the owner window.protected NativeRectangle clipRectangle()
For top-level windows, their boundary always starts from (0,0), and not their
physical location on screen.
clipRectangle in class AbstractWidget<O extends OutputManager<?>>