public interface Widget<O extends OutputManager<?>>
extends java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.awt.event.MouseWheelListener
Modifier and Type | Interface and Description |
---|---|
static class |
Widget.ZOrderClass
Enums for Z-Order widget classes
|
Modifier and Type | Method and Description |
---|---|
void |
addFocusListener(FocusListener listener)
Add focus listener.
|
void |
addKeyListener(KeyListener listener)
Add key listener.
|
Widget<O> |
ancestor()
Get ancestor window for this widget.
|
WidgetId |
ancestorId()
Get the ID of the ancestor window for this widget.
|
Rectangle |
bounds()
Get widget bounding rectangle.
|
boolean |
clearWidget()
Clear widget state on CLEAR FRAME call for the parent frame.
|
<W extends WidgetConfig> |
config()
Get externalizable widget config which can be used to restore widget
state after via network.
|
default java.util.Optional<MousePtrWrapper> |
defaultMousePtr()
Get default mouse pointer for this widget
|
void |
destroy()
Destroy this widget.
|
Dimension |
dimension()
Get widget dimension.
|
NativePoint |
displayPhysicalLocation()
Get display location of widget in screen coordinates.
|
void |
draw()
Draw widget.
|
void |
drawCaret()
Draw caret.
|
java.util.Optional<Frame<?>> |
enclosingFrame()
Get the enclosing FRAME if it exists
|
default boolean |
enforceDefaultMousePtr()
Check if the default mouse pointer should be used regardless of
the parent settings
|
Widget<O> |
findMouseSource(NativePoint p)
Find the widget positioned just bellow the specified mouse position (in physical units).
|
boolean |
focusTraversable()
Check if widget is focus traversable.
|
boolean |
forceCursorOnFocus()
Check if widget needs in cursor to be on when having the input focus.
|
void |
forceVisibility(boolean visibility)
Force widget visibility change without associated repainting.
|
NativeRectangle |
getActualBounds()
Get the widget's actual bounds
|
java.util.Optional<MousePtrWrapper> |
getCustomMousePointer()
Get the current custom mouse pointer if it is set
|
MousePtrWrapper |
getEffectiveMousePointer()
Get the current effective custom mouse pointer
|
WidgetId |
getId()
Widget ID.
|
default Widget<O> |
getLegacyWidget()
The method returns the legacy widget representing this possibly virtual widget.
|
java.util.Optional<MousePtrWrapper> |
getLoadedMousePointer()
Get the loaded custom mouse pointer if it is set
|
int |
getMenuMouse()
Get the value of the MENU-MOUSE attribute
|
java.util.Set<java.lang.Integer> |
getMouseActions()
Get the mouse actions on which this widget can respond.
|
java.lang.String |
getSelectedText()
Obtain any selected text in the widget for copying to the clipboard.
|
byte |
getState()
Gets the current state of this component's data.
|
Rectangle |
getVisiblePart()
Gets the sub-rectangle which should be visible.
|
Widget.ZOrderClass |
getZOrderClass()
Get the Z-Order class
|
boolean |
hasFocus()
Check if widget has focus.
|
double |
height()
Get widget height.
|
boolean |
hidden()
Get current hidden state.
|
void |
hide()
Hide widget.
|
boolean |
highlighted()
Get current highlighted state.
|
Insets |
insets()
Get widget insets.
|
default boolean |
isDirectManipulable()
Check the direct manipulation capability of the widget.
|
boolean |
isDisplayed()
Check if widget is displayed.
|
boolean |
isEnabled()
Check if widget is enabled.
|
boolean |
isFocusable()
Checks whether this widget can receive focus generally.
|
boolean |
isHeader()
Check if widget is part of a header.
|
boolean |
isRealized()
Check if widget is realized.
|
boolean |
isRMBEntrySupported()
Check if this widget gains ENTRY event when right/middle mouse button is clicked.
|
boolean |
isTabStop()
Check the value of the TAB-STOP attribute
|
boolean |
isThreeD()
If the method returns
true the widget should be represented with 3D visuals. |
boolean |
isTotallyObscured()
Check if widget is totally obscured.
|
boolean |
isVisible()
Check if widget is visible.
|
Point |
location()
Get widget location relative to container.
|
Dimension |
minimumSize()
Get widget minimum size.
|
boolean |
moveToBottom()
Move the widget to the bottom in z-order
|
boolean |
moveToTop()
Move the widget to the top in z-order
|
java.lang.String |
name()
Get widget name.
|
boolean |
navigable()
Returns
true only if this widget is navigable. |
Container<O> |
parent()
Get widget parent.
|
<T extends Widget<O>> |
parent(java.lang.Class<T> clazz)
Get widget parent of the specified type.
|
<T extends Widget<O>> |
parentOrSelf(java.lang.Class<T> clazz)
Get this or widget parent of the specified type.
|
NativeRectangle |
physicalBounds()
Determine the physical bounds, relative to screen, expressed in units native to UI type.
|
NativeDimension |
physicalDimension()
Get widget physical dimension, expressed in units native to UI type.
|
NativePoint |
physicalLocation()
Get widget physical location relative to container, expressed in units native to UI type.
|
void |
postprocessConfig()
Additional processing required when widget configuration is updated AFTER the frame layout
has been performed.
|
void |
processDirectManipulationEvent(DirectManipulationEvent event)
Process direct manipulation event.
|
void |
processEvent(Event evt)
Process event and dispatch it to specific method.
|
void |
processFocusEvent(FocusEvent event)
Process focus event.
|
void |
processKeyEvent(KeyInput event)
Process key event.
|
void |
processKeyListeners(KeyInput event)
Process key listeners.
|
boolean |
processMnemonic(int key)
Process the given key, if this widget's mnemonic matches the key.
|
boolean |
raiseLegacyMouseEvents()
Check if the widget implementation can raise legacy, 4GL-style, mouse events.
|
void |
repaint()
Request widget repainting.
|
void |
repaint(Rectangle ur)
Request repainting of the area occupied by widget.
|
void |
requestFocus()
Request focus.
|
void |
requestSync()
Request screen synchronization.
|
void |
resizeTo(NativePoint origin,
NativeDimension size,
boolean raise)
Resize the widget to the specified dimensions.
|
O |
screen()
Get access to
OutputManager instance. |
Point |
screenLocation()
Get absolute location of widget in screen coordinates.
|
NativePoint |
screenPhysicalLocation()
Get absolute location of widget in screen coordinates.
|
void |
setEnabled(boolean enabled)
Enable/disable widget.
|
void |
setHidden(boolean hidden)
Tracks the hidden state of the widget.
|
void |
setHighlighted(boolean highlighted)
Tracks the highlighted state of the widget.
|
void |
setLocation(double x,
double y)
Set widget relative location.
|
void |
setLocation(Point origin)
Set widget relative location.
|
void |
setMousePointer(MousePtrWrapper ptr)
Set the custom mouse pointer
|
void |
setParent(Container<O> container)
Set widget parent.
|
void |
setPhysicalLocation(int x,
int y)
Set widget relative physical location.
|
void |
setState(byte state)
Stores the new state of the component's data.
|
void |
setVisible(boolean visible)
Hide/show widget.
|
void |
show()
Show widget.
|
boolean |
supportsCustomMousePointer()
Check if the widget supports LOAD-MOUSE-POINTER() method
|
TopLevelWindow<O> |
topLevelWindow()
Get ancestor TopLevelWindow for this widget.
|
void |
unrealize()
Unrealize this widget.
|
double |
width()
Get widget width in character units.
|
Window<O> |
window()
Get ancestor Window for this widget.
|
WidgetId getId()
O screen()
OutputManager
instance.OutputManager
.void addFocusListener(FocusListener listener)
listener
- Listener to add.void addKeyListener(KeyListener listener)
listener
- Listener to add.Window<O> window()
java.lang.IllegalStateException
- When this widget is not attached to window.TopLevelWindow<O> topLevelWindow()
java.lang.IllegalStateException
- When this widget is not attached to a top-level window.WidgetId ancestorId()
Rectangle bounds()
Insets insets()
Dimension dimension()
NativeDimension physicalDimension()
boolean isDisplayed()
true
if widget is displayed.boolean isRealized()
true
if widget is realized.void draw()
void drawCaret()
boolean isEnabled()
true
if widget is enabled.boolean focusTraversable()
true
if widget is focus traversable.void forceVisibility(boolean visibility)
visibility
- New visibility state.boolean hasFocus()
true
if widget has focus.double height()
boolean hidden()
void hide()
boolean highlighted()
Point location()
Dimension minimumSize()
java.lang.String name()
<T extends Widget<O>> T parent(java.lang.Class<T> clazz)
clazz
- The parent type to return.<T extends Widget<O>> T parentOrSelf(java.lang.Class<T> clazz)
clazz
- The type to return.void processFocusEvent(FocusEvent event)
event
- Event to process.void processKeyEvent(KeyInput event)
event
- Key event to process.void processDirectManipulationEvent(DirectManipulationEvent event)
event
- Event to process.default boolean isDirectManipulable()
TRUE
if the widget is able to be directly manipulated,
FALSE
otherwise.void processKeyListeners(KeyInput event)
event
- Keyboard event.void repaint()
void repaint(Rectangle ur)
ur
- The update rectangle (relative to the origin of its parent
Container) which will be repainted. Note that it is clipped by
all parent containers.void requestFocus()
void requestSync()
Point screenLocation()
NativePoint screenPhysicalLocation()
NativePoint displayPhysicalLocation()
void setEnabled(boolean enabled)
enabled
- void setHidden(boolean hidden)
hidden
- New hidden state.void setHighlighted(boolean highlighted)
highlighted
- New highlighted state.void setLocation(double x, double y)
x
- Widget X.y
- Widget Y.void setLocation(Point origin)
origin
- Location to set.void setParent(Container<O> container)
container
- Parent to set.void setVisible(boolean visible)
visible
- New visible state.void show()
boolean isTotallyObscured()
true
if widget is totally obscured.boolean isVisible()
true
if widget is visible.boolean isHeader()
true
if widget is part of header.boolean forceCursorOnFocus()
true
if cursor is required.double width()
void processEvent(Event evt)
evt
- Event to process.<W extends WidgetConfig> W config()
W
- Config type.boolean isFocusable()
true
if this widget can be focused under
certain conditions. false
if, and only if, this
widget can never receive focus.void setPhysicalLocation(int x, int y)
x
- Widget physical X.y
- Widget physical Y.NativePoint physicalLocation()
NativeRectangle physicalBounds()
Widget<O> findMouseSource(NativePoint p)
p
- The mouse physical location.null
if none found.void destroy()
void resizeTo(NativePoint origin, NativeDimension size, boolean raise)
origin
- The top-left window corner new position.size
- The new window size.raise
- Flag indicating if the 4GL WINDOW-RESIZED event needs to be raised.byte getState()
ScreenBuffer.UNINITIALIZED
).java.lang.String getSelectedText()
null
if there is no selected text or if the
widget type does not support clipboard operations.Rectangle getVisiblePart()
void setState(byte state)
state
- The new state (for example ScreenBuffer.CHANGED
).boolean raiseLegacyMouseEvents()
true
if a mouse action on this widget will raise legacy, 4GL-style,
mouse events.void postprocessConfig()
boolean isTabStop()
true
if not applicableboolean moveToTop()
true
if operation was successfulboolean moveToBottom()
true
if operation was successfulWidget.ZOrderClass getZOrderClass()
int getMenuMouse()
java.util.Set<java.lang.Integer> getMouseActions()
This is compatible with the AWT mouse event codes and P2J specific MouseEvt
actions.
boolean isThreeD()
true
the widget should be represented with 3D visuals.boolean navigable()
true
only if this widget is navigable.true
if widget is navigable.void setMousePointer(MousePtrWrapper ptr)
ptr
- the custom mouse pointerjava.util.Optional<MousePtrWrapper> getLoadedMousePointer()
java.util.Optional<MousePtrWrapper> getCustomMousePointer()
MousePtrWrapper getEffectiveMousePointer()
java.util.Optional<Frame<?>> enclosingFrame()
boolean supportsCustomMousePointer()
true
if the widget supports
LOAD-MOUSE-POINTER() methoddefault java.util.Optional<MousePtrWrapper> defaultMousePtr()
Optional.empty()
if one is inherited from the enclosing framedefault boolean enforceDefaultMousePtr()
true
if the default mouse pointer should always be usedNativeRectangle getActualBounds()
boolean isRMBEntrySupported()
true
if this widget gains ENTRY event
when right/middle mouse button is clicked.void unrealize()
boolean clearWidget()
true
on success. false
if CLEAR cannot be applied to this
widget, e.g. if it is static text.default Widget<O> getLegacyWidget()
The default implementation walks up the widget tree starting at this
. The first
enumerated widget returning false
from WidgetId.virtualWidget(WidgetId)
is returned.
null
if none found.boolean processMnemonic(int key)
key
- The pressed mnemonic key code.true
if this widget accepted this mnemonic key. Not enabled or not
visible widget will not accept it.