O
- the output managerpublic interface Widget<O extends OutputManager<?>>
extends java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.awt.event.MouseWheelListener
Modifier and Type | Method and Description |
---|---|
void |
addFocusListener(FocusListener listener)
Add focus listener.
|
void |
addKeyListener(KeyListener listener)
Add key listener.
|
TitledWindow<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.
|
default boolean |
canMovetoTop()
Flag indicating if this widget can be moved to top by a DISPLAY statement when WINDOW:KEEP-FRAME-Z-ORDER
flag is set.
|
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
|
org.roaringbitmap.RoaringBitmap |
getMouseActions()
Get the mouse actions on which this widget can respond.
|
NativePoint |
getMousePosition()
Returns current mouse cursor position relative to the this widget.
|
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.
|
default Widget<O> |
getTriggerWidget()
For some virtual widgets, the widget where triggers are checked is different (i.e.
|
default Widget<?> |
getTriggerWidget(int evtCode,
boolean isKey)
Complex legacy widgets are usually assembled from multiple individual widget classes.
|
Rectangle |
getVisiblePart()
Gets the sub-rectangle which should be visible.
|
ZOrderClass |
getZOrderClass()
Get the Z-Order class
|
default boolean |
hasFocus()
Check if widget has focus.
|
boolean |
hasFocus(boolean recurse)
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.
|
default boolean |
ignoreEnable()
Some widgets can ignore an ENABLE statement (like read-only, hidden TEXT).
|
double |
initialHeight()
Get initial widget height in character units.
|
double |
initialWidth()
Get initial widget width in character units.
|
Insets |
insets()
Get widget insets.
|
boolean |
isCurrent()
The method returns true if the widget is set as current in its parent container.
|
default boolean |
isDirectManipulable()
Check the direct manipulation capability of the widget.
|
default boolean |
isDirectManipulationActive()
Check if direct manipulation is active for this widget.
|
boolean |
isDisplayed()
Check if widget is displayed.
|
default boolean |
isDroppable()
Checks if the given widget is able to be the target of the drop operation.
|
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.
|
default boolean |
isInitialValueLayout()
Reports if the initial height/width of the widget should take precedence in the frame layout
algorithm.
|
default boolean |
isLegacyFocus()
Returns a flag marking the widget as subject to legacy focus handling.
|
boolean |
isRealized()
Check if widget is realized.
|
boolean |
isRepaintDisabled()
Returns true when the widget repaint is disabled.
|
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.
|
boolean |
isVisible(boolean recursive)
Check if widget is visible.
|
Point |
location()
Get widget location relative to container.
|
default boolean |
maySwitchFocus()
Some widgets (like scroll bars) react on user input (like mouse click), but don't steal focus from
currently focused widget.
|
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. |
void |
oleDrag()
Start an OLE drag/drop event with the given control as the source.
|
default Container<O> |
parent()
Get widget parent.
|
Container<O> |
parent(boolean system)
Get widget parent.
|
<T extends Widget<O>> |
parent(java.lang.Class<T> clazz)
Get widget parent of the specified type.
|
<T> T |
parentObject(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.
|
<T> T |
parentOrSelfObject(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.
|
boolean |
preventFocusWhenMouseDownEventDefined()
Test if this widget must prevent receiving focus on mouse-down event.
|
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.
|
default void |
refreshWidget()
Refresh widget.
|
void |
registerWidgetStateListener(WidgetStateListener l)
Register a widget state listener for this widget.
|
void |
repaint()
Request widget repainting.
|
void |
repaint(NativeRectangle rect)
Request repainting of the area occupied by widget.
|
void |
repaint(Rectangle ur)
Request repainting of the area occupied by widget.
|
default void |
requestFocus()
Request focus.
|
default void |
requestFocus(boolean force)
Request focus.
|
void |
requestFocus(boolean force,
boolean mouse)
Request focus.
|
void |
requestSync()
Request screen synchronization.
|
void |
resizeTo(NativePoint origin,
NativeDimension size,
boolean raise)
Resize the widget to the specified dimensions.
|
int |
resolvePopupMenuId()
Returns the popup menu effective for this widget.
|
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
|
default boolean |
systemFocusGrabbed()
Check if this widget grabs the system focus.
|
TopLevelWindow<O> |
topLevelWindow()
Get ancestor TopLevelWindow for this widget.
|
void |
unrealize()
Unrealize this widget.
|
void |
unregisterWidgetStateListener(WidgetStateListener l)
Unregister a widget state listener for this widget.
|
default boolean |
validateDisplayValue()
Performs format validation of the widget value being entered, i.e.
|
void |
widgetStateChanged()
Notification that this widget's state has changed (visibility, sensitivity, z-order).
|
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.TitledWindow<O> ancestor()
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.default boolean hasFocus()
Effectively calls hasFocus(boolean) with true
argument.
true
if widget has focus.boolean hasFocus(boolean recurse)
When true
is passed as the argument the method considers this widget focused when all the
parent widgets up to the top-level window are current and the widget itself is a leaf node of the
widget tree. When false
is passed as the argument the method considers this widget focused
when all the parent widgets up to the top-level window are current but the widget itself does not
have to be a leaf node.
recurse
- see abovetrue
if widget has focus.default boolean isLegacyFocus()
default boolean systemFocusGrabbed()
true
if this widget grabs the system focus.boolean isCurrent()
double height()
double initialHeight()
boolean hidden()
void hide()
boolean highlighted()
Point location()
Dimension minimumSize()
java.lang.String name()
Container<O> parent(boolean system)
system
- Set to true
to search the system-level widget hierarchy. See
BaseEntity.setSystemParent(GenericWidget)
for more info.<T extends Widget<O>> T parent(java.lang.Class<T> clazz)
clazz
- The parent type to return.<T> T parentObject(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.<T> T parentOrSelfObject(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.default boolean isDirectManipulationActive()
true
if direct manipulation is active false
if not.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 repaint(NativeRectangle rect)
rect
- The update rectangle (relative to the origin of its parent
Container) which will be repainted. Note that it is clipped by
all parent containers.default void requestFocus()
default void requestFocus(boolean force)
force
- When true
the method will set focus on this widget unconditionally.void requestFocus(boolean force, boolean mouse)
force
- When true
the method will set focus on this widget unconditionally.mouse
- If true
then the focus request was caused by a mouse event.void requestSync()
Point screenLocation()
NativePoint screenPhysicalLocation()
NativePoint displayPhysicalLocation()
void setEnabled(boolean enabled)
enabled
- New enabled state.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 isVisible(boolean recursive)
recursive
- false
behaves as isVisible()
, otherwise the method returns
true
only when the parent's call to isVisible(true)
returns
true
.true
if widget is visible.boolean isHeader()
true
if widget is part of header.boolean forceCursorOnFocus()
true
if cursor is required.double width()
double initialWidth()
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.void registerWidgetStateListener(WidgetStateListener l)
l
- The widget state listener.void unregisterWidgetStateListener(WidgetStateListener l)
l
- The widget state listener.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 successfulZOrderClass getZOrderClass()
int getMenuMouse()
org.roaringbitmap.RoaringBitmap 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.default Widget<O> getTriggerWidget()
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.default boolean isDroppable()
TRUE
if this widget can be droppable at this time,
FALSE
otherwise.boolean isRepaintDisabled()
int resolvePopupMenuId()
default boolean maySwitchFocus()
true
if the widget may steal focus from currently focused widget,
false
otherwise.void widgetStateChanged()
default Widget<?> getTriggerWidget(int evtCode, boolean isKey)
This method solves the cases where multiple widget classes make up a legacy widget and one of the
widget class causes a trigger to be invoked. This method returns the widget that should server as the
source of the triggered event. This widget must always be a non-virtual widget. The method may also
return null
which prevents triggering of the legacy event.
evtCode
- The event being triggered.isKey
- Whether the event being triggered is a real key.default void refreshWidget()
void oleDrag()
default boolean ignoreEnable()
This implementation always returns false
.
true
if the ENABLE statement must ignore it.NativePoint getMousePosition()
null
.default boolean isInitialValueLayout()
true
if the initial values control layout.boolean preventFocusWhenMouseDownEventDefined()
true
.default boolean validateDisplayValue()
true
if the display value conforms to the widgets format, false
otherwise.default boolean canMovetoTop()
false
.