public 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.
|
Widget.ZOrderClass
Modifier and Type | Field and Description |
---|---|
private static byte[] |
iconDef
Default window icon.
|
private static 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.
|
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 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 |
isMaximized()
Check if the window is already maximized - it can't be resized.
|
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 |
processEvent(Event event)
Process event and dispatch it to specific method.
|
void |
processFocusEvent(FocusEvent event)
Process focus event.
|
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).
|
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 |
setLocation(double x,
double y)
Set window location.
|
protected void |
setOwner(TopLevelWindow<O> owner)
Sets the owner window.
|
void |
setPhysicalLocation(int x,
int y)
Set window physical location.
|
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(byte[] newIcon)
Sets the new application icon for given window on the client side.
|
Window<O> |
window()
Get ancestor Window for this widget.
|
draw, drawInt
destroy, destroyWidgets, findMouseSource, focusTraversable, getWorkspaceSize, getZOrderClass, hasFocus, hasTitle, hasTitlebar, hide, isDisplayed, isModal, processKeyEvent, setTitle, show, title, toString
add, add, add, addDirectly, belongsTo, checkWidget, childrenLocation, clipping, clipRectangle, currentFocus, currentFocus, cycleFocus, detach, dimension, doLayout, endSizeChange, findMouseSource, firstFocus, focus, focusWorker, get, getClipRect, getEffectiveScrollableSize, getFocusInt, getIgnoreFocus, getLayout, getScrollableSize, getWidgetsList, hasFocusable, height, insets, lastFocus, minimumSize, moveAfterTabItem, moveBeforeTabItem, moveToBottom, moveToBottomInClass, moveToTop, moveToTopInClass, moveToZpos, nextFocus, normalizeZOrder, prepareWidgets, prevFocus, remove, replace, requestFocus, setFocus, setFocusInt, setHeight, setIgnoreFocus, setInsets, setLayout, setSize, setSize, setWidth, startSizeChange, unrealize, updateSizeWorker, widgets, width
_setHidden, _setVisible, activateDirectManipulation, addFocusListener, addKeyListener, afterConfigUpdateBase, ancestorId, autoResize, clear, clearWidget, clipRectangle, clipWith, config, createMouseHoverAction, deactivateDirectManipulation, debug, disable, displayPhysicalLocation, drawCaret, enable, enclosingFrame, forceCursorOnFocus, forceVisibility, getActualBounds, getAndResetBitmap, getAndSetBitmap, getBitmapCopy, getCustomMousePointer, getDefaultEvent, getEffectiveMousePointer, getId, getLoadedMousePointer, getMenuMouse, getMouseActions, getPortableMouseEventCoordinates, getSelectedText, getState, getTextHeight, getTextHeightNative, getTextWidth, getTextWidthNative, getVisiblePart, hidden, highlighted, ignoreAction, isDirectManipulationCapable, isDirectManipulationRequired, isEnabled, isHeader, isRealized, isRMBEntrySupported, isTabStop, isThreeD, isTotallyObscured, isVisible, location, manageSystemActions, mouseActions, mouseClicked, mouseDragged, mouseEntered, mouseExited, mouseMoved, mousePressed, mouseReleased, mouseWheelMoved, moveToBottom, moveToTop, name, navigable, parent, parent, parentOrSelf, physicalDimension, physicalLocation, postprocessConfig, prepParentLocation, processDirectManipulationEvent, processKeyListeners, processMnemonic, processMnemonicImpl, processSystemKey, raiseLegacyMouseEvents, refresh, registerWidgetStateListener, repaint, requestSync, resetBitmap, resizeTo, resolveFont, screen, screenDimension, screenHeight, screenWidth, setBitmap, setEnabled, setHidden, setHighlighted, setLocation, setMousePointer, setParent, setState, setVisible, supportsCustomMousePointer, sync, topLevelWindow, translate
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
addFocusListener, addKeyListener, ancestorId, clearWidget, config, defaultMousePtr, displayPhysicalLocation, drawCaret, enclosingFrame, enforceDefaultMousePtr, forceCursorOnFocus, forceVisibility, getActualBounds, getCustomMousePointer, getEffectiveMousePointer, getId, getLegacyWidget, getLoadedMousePointer, getMenuMouse, getMouseActions, getSelectedText, getState, getVisiblePart, hidden, highlighted, isDirectManipulable, isEnabled, isHeader, isRealized, isRMBEntrySupported, isTabStop, isThreeD, isTotallyObscured, isVisible, location, moveToBottom, moveToTop, name, navigable, parent, parent, parentOrSelf, physicalDimension, physicalLocation, postprocessConfig, processDirectManipulationEvent, processKeyListeners, processMnemonic, raiseLegacyMouseEvents, repaint, requestSync, resizeTo, screen, setEnabled, setHidden, setHighlighted, setLocation, setMousePointer, setParent, setState, setVisible, supportsCustomMousePointer, topLevelWindow
private static byte[] iconDef
private java.util.Optional<TopLevelWindow<O extends OutputManager<?>>> owner
private static 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 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 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 pointnull
public Frame<?> getFirstVisibleFrame()
null
public 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 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 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 void processEvent(Event event)
processEvent
in interface Widget<O extends OutputManager<?>>
processEvent
in class TitledWindow<O extends OutputManager<?>>
event
- Event to process.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 setLocation(double x, double y)
setLocation
in interface Widget<O extends OutputManager<?>>
setLocation
in class AbstractWidget<O extends OutputManager<?>>
x
- Window X.y
- Window Y.public void setPhysicalLocation(int x, int y)
setPhysicalLocation
in interface Widget<O extends OutputManager<?>>
setPhysicalLocation
in class AbstractWidget<O extends OutputManager<?>>
x
- Window physical X.y
- Window physical Y.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
.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<?>>