public abstract class AbstractWidget<O extends OutputManager<?>> extends java.lang.Object implements Widget<O>
Widget.ZOrderClass
Modifier and Type | Field and Description |
---|---|
private boolean |
directManipulationActive
Flag indicating the direct manipulation handler registration.
|
private boolean |
enabled
Widget enabled flag.
|
private java.util.ArrayList<FocusListener> |
focusListeners
Storage for focus listeners.
|
private boolean |
hidden
Widget hidden flag.
|
private boolean |
highlighted
Widget highlighted flag.
|
protected Insets |
insets
Widget insets
|
private java.util.ArrayList<KeyListener> |
keyListeners
Storage for key listeners.
|
private java.util.List<WidgetStateListener> |
listeners
List of listeners which require notifications about the state of this widget.
|
protected Point |
location
Widget origin (upper left corner) relative to container
expressed in character cell units.
|
protected static java.util.logging.Logger |
LOG
Logger.
|
private java.util.Set<java.lang.Integer> |
mouseActions
A set of mouse actions on which this widget can react.
|
private MouseHoverAction |
mouseHoverAction
Mouse hover event handler
|
protected java.util.Optional<MousePtrWrapper> |
mousePtr
Custom mouse pointer
|
protected NativeInsets |
nativeInsets
Widget native insets
|
private java.lang.ref.WeakReference<Container<O>> |
parent
Reference to parent container.
|
protected NativePoint |
physicalLocation
Widget physical origin (upper left corner) relative to
container.
|
private boolean |
popupKeyListnrAdded
true if and only if Menu.PopupKeyListener was added to this widget. |
private O |
screen
Reference to screen.
|
private boolean |
visible
Widget visible flag.
|
Constructor and Description |
---|
AbstractWidget()
Constructor
|
Modifier and Type | Method and Description |
---|---|
private void |
_setEnabled(boolean enabled)
Update the
enabled flag in the configuration and in the widget's state. |
void |
_setHidden(boolean hidden)
Update the
hidden flag in the configuration and in the widget's state. |
void |
_setVisible(boolean visible)
Update the
visible flag in the configuration and in the widget's state. |
protected void |
activateDirectManipulation()
Activates direct manipulation engine for this widget.
|
void |
addFocusListener(FocusListener listener)
Add focus listener.
|
void |
addKeyListener(KeyListener listener)
Add key listener.
|
<C extends WidgetConfig> |
afterConfigUpdateBase(C beforeUpdate)
The method is called after the configuration associated with
the implementor changes.
|
TitledWindow<O> |
ancestor()
Get ancestor window for this widget.
|
WidgetId |
ancestorId()
Get the ID of the ancestor window for this widget.
|
protected <C extends WidgetConfig> |
autoResize(C beforeUpdate)
Invoke auto-resize logic if needed
|
Rectangle |
bounds()
Get widget bounding rectangle.
|
void |
clear(Point origin,
Dimension size,
Color color)
Determine the widget's window and clear specified area of the screen.
|
boolean |
clearWidget()
Clear widget state on CLEAR FRAME call for the parent frame.
|
protected NativeRectangle |
clipRectangle()
Build widget clipped rectangle.
|
static NativeRectangle |
clipRectangle(NativePoint origin,
NativeDimension dimension)
Build clipped rectangle for given coordinates.
|
void |
clipWith(Rectangle rect)
Determine the widget's window and add a new clipping rectangle to the bitmap.
|
<W extends WidgetConfig> |
config()
Get externalizable widget config which can be used to restore widget
state after via network.
|
protected MouseHoverAction |
createMouseHoverAction()
Create handler for processing mouse hover events
|
protected void |
deactivateDirectManipulation()
Deactivates direct manipulation engine for this widget.
|
void |
debug(java.lang.String message)
Utility method for debugging, can be used to include information from the server-side
to the client-side log
|
void |
destroy()
Destroy this widget.
|
abstract Dimension |
dimension()
Get widget dimension.
|
protected void |
disable()
Disable widget.
|
NativePoint |
displayPhysicalLocation()
Get display location of widget in screen coordinates.
|
abstract void |
draw()
Draw widget.
|
void |
drawCaret()
Draw caret.
|
protected void |
enable()
Enable widget.
|
java.util.Optional<Frame<?>> |
enclosingFrame()
Get the enclosing FRAME if it exists
|
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
|
ScreenBitmap |
getAndResetBitmap()
Determine the widget's window, get a copy of the current screen bitmap and reset clipping
entirely.
|
ScreenBitmap |
getAndSetBitmap(Rectangle rect)
Determine the widget's window, get a copy of the current screen bitmap and clip output
further so it is guaranteed not to go outside of the provided rectangle.
|
ScreenBitmap |
getBitmapCopy()
Determine the widget's window and get a copy of the current screen bitmap.
|
java.util.Optional<MousePtrWrapper> |
getCustomMousePointer()
Get the current custom mouse pointer if it is set
|
int |
getDefaultEvent(KeyInput key,
boolean inEditingBlock)
Get the default event associated for this widget and the given key.
|
MousePtrWrapper |
getEffectiveMousePointer()
Get the current effective custom mouse pointer
|
WidgetId |
getId()
Widget ID.
|
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.
|
NativePoint |
getPortableMouseEventCoordinates(NativePoint point)
Get a point to represent the LAST-EVENT:X and LAST-EVENT:Y coordinates.
|
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.
|
int |
getTextHeight(java.lang.String txt,
int font)
|
private int |
getTextHeight(java.lang.String txt,
int font,
boolean useNative)
Compute the height of the given text, using the specified font in the widget's window.
|
int |
getTextHeightNative(java.lang.String txt,
int font)
Compute the text height using
GuiDriver.getTextHeight(java.lang.String, com.goldencode.p2j.ui.client.FontDetails<F>) . |
int |
getTextWidth(java.lang.String txt,
int font)
|
private int |
getTextWidth(java.lang.String txt,
int font,
boolean useNative)
Compute the width of the given text, using the specified font in the widget's window.
|
int |
getTextWidthNative(java.lang.String txt,
int font)
Compute the text width using
GuiDriver.getTextWidth(java.lang.String, com.goldencode.p2j.ui.client.FontDetails<F>) . |
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.
|
abstract double |
height()
Get widget height.
|
boolean |
hidden()
Get current hidden state.
|
void |
hide()
Hide widget.
|
boolean |
highlighted()
Get current highlighted state.
|
boolean |
ignoreAction(int action)
Check if the given event needs to be ignored, as it can't be treated by the widget.
|
Insets |
insets()
Get widget insets.
|
protected boolean |
isDirectManipulationCapable()
Checks if direct manipulation feature can be used for this widget.
|
protected boolean |
isDirectManipulationRequired()
Checks if direct manipulation feature must be installed or removed in GUI mode.
|
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()
The default implementation delegates to WidgetConfig if it has one, otherwise return false.
|
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.
|
boolean |
manageSystemActions()
Check if the current widget can manage non-global system actions on its own, and not via the
enclosing event loop.
|
abstract Dimension |
minimumSize()
Get widget minimum size.
|
protected int[] |
mouseActions()
Sub-classes will override this to return a list of mouse actions on which the widget
responds.
|
void |
mouseClicked(java.awt.event.MouseEvent e)
Notification of a mouse clicked event occurred for this widget.
|
void |
mouseDragged(java.awt.event.MouseEvent e)
Notification of a mouse dragged event occurred for this widget.
|
void |
mouseEntered(java.awt.event.MouseEvent e)
Notification of a mouse entered event occurred for this widget.
|
void |
mouseExited(java.awt.event.MouseEvent e)
Notification of a mouse exited event occurred for this widget.
|
void |
mouseMoved(java.awt.event.MouseEvent e)
Notification of a mouse moved event occurred for this widget.
|
void |
mousePressed(java.awt.event.MouseEvent e)
Notification of a mouse pressed event occurred for this widget.
|
void |
mouseReleased(java.awt.event.MouseEvent e)
Notification of a mouse released event occurred for this widget.
|
void |
mouseWheelMoved(java.awt.event.MouseWheelEvent e)
Notification of a mouse wheel moved event occurred for this widget.
|
boolean |
moveToBottom()
Moves this widget to the bottom of other widgets in the z-ordering.
|
boolean |
moveToTop()
Moves this widget to the top of other widgets in the z-ordering.
|
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.
|
protected Point |
prepParentLocation(Widget<?> parent)
Trick, that lets to correct parent location in cases, when it needed,
for example for menus.
|
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.
|
protected boolean |
processMnemonicImpl(int key,
MnemonicTrait m)
Common code to process the specific mnemonic key by this widget.
|
void |
processSystemKey(KeyInput key)
Process the action associated with the given key in an independent drawing bracket.
|
boolean |
raiseLegacyMouseEvents()
Check if the widget implementation can raise legacy, 4GL-style, mouse events.
|
void |
refresh(Rectangle rect)
Determine the widget's window and mark a rectangle as needing repainting.
|
void |
registerWidgetStateListener(WidgetStateListener l)
Register a widget state listener for this widget.
|
void |
repaint()
Request widget repainting.
|
void |
repaint(Rectangle ur)
Request widget repainting.
|
void |
requestFocus()
Request focus.
|
void |
requestSync()
Request screen synchronization.
|
void |
resetBitmap()
Determine the widget's window and reset the screen bitmap.
|
void |
resizeTo(NativePoint origin,
NativeDimension size,
boolean raise)
Resize the widget to the specified dimensions.
|
int |
resolveFont()
This API is responsible for resolving the widget's font.
|
int |
resolveTitleFont()
This API is responsible for resolving the font associated with this widget's title.
|
O |
screen()
Get access to
OutputManager instance. |
Dimension |
screenDimension()
Determine the widget's window and get the screen dimensions.
|
double |
screenHeight()
Determine the widget's window and get the number of rows on the screen.
|
Point |
screenLocation()
Get absolute location of widget in screen coordinates.
|
NativePoint |
screenPhysicalLocation()
Get absolute location of widget in screen coordinates.
|
double |
screenWidth()
Determine the widget's window and get the number of columns on the screen.
|
void |
setBitmap(ScreenBitmap bitmap)
Determine the widget's window and restore the bitmap to a previous state.
|
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.
|
private void |
setPhysicalDimensionInt(int width,
int height)
Set widget physical dimension.
|
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
|
void |
sync()
Determine the widget's window and synchronize output with physical terminal.
|
TopLevelWindow<O> |
topLevelWindow()
Get ancestor TopLevelWindow for this widget.
|
java.lang.String |
toString()
Returns a string representation of the object.
|
NativePoint |
translate(java.awt.event.MouseEvent evt)
Translate mouse position relative to this widget.
|
void |
unrealize()
Unrealize this widget.
|
protected <C extends WidgetConfig> |
updateSizeWorker(C beforeUpdate)
Instructs the widget that its size may have changed.
|
abstract double |
width()
Get widget width.
|
Window<O> |
window()
Get ancestor Window for this widget.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
defaultMousePtr, enforceDefaultMousePtr, getLegacyWidget, isDirectManipulable
protected static final java.util.logging.Logger LOG
private boolean enabled
private boolean hidden
private boolean highlighted
private boolean visible
private java.util.ArrayList<FocusListener> focusListeners
private java.util.ArrayList<KeyListener> keyListeners
private java.lang.ref.WeakReference<Container<O extends OutputManager<?>>> parent
private boolean popupKeyListnrAdded
true
if and only if Menu.PopupKeyListener
was added to this widget.private java.util.List<WidgetStateListener> listeners
private O extends OutputManager<?> screen
private java.util.Set<java.lang.Integer> mouseActions
protected Point location
protected NativePoint physicalLocation
protected Insets insets
protected NativeInsets nativeInsets
protected java.util.Optional<MousePtrWrapper> mousePtr
private MouseHoverAction mouseHoverAction
private boolean directManipulationActive
public WidgetId getId()
getId
in interface Widget<O extends OutputManager<?>>
public O screen()
OutputManager
instance.screen
in interface Widget<O extends OutputManager<?>>
OutputManager
.public void addFocusListener(FocusListener listener)
addFocusListener
in interface Widget<O extends OutputManager<?>>
listener
- Listener to add.public void addKeyListener(KeyListener listener)
addKeyListener
in interface Widget<O extends OutputManager<?>>
listener
- Listener to add.public TitledWindow<O> ancestor()
ancestor
in interface Widget<O extends OutputManager<?>>
public WidgetId ancestorId()
ancestorId
in interface Widget<O extends OutputManager<?>>
null
if no valid ancestor exists.public Window<O> window()
window
in interface Widget<O extends OutputManager<?>>
java.lang.IllegalStateException
- When this widget is not attached to window.public TopLevelWindow<O> topLevelWindow()
topLevelWindow
in interface Widget<O extends OutputManager<?>>
java.lang.IllegalStateException
- When this widget is not attached to a top-level window.public Rectangle bounds()
bounds
in interface Widget<O extends OutputManager<?>>
public Insets insets()
insets
in interface Widget<O extends OutputManager<?>>
public abstract Dimension dimension()
dimension
in interface Widget<O extends OutputManager<?>>
public NativeDimension physicalDimension()
physicalDimension
in interface Widget<O extends OutputManager<?>>
public boolean isDisplayed()
isDisplayed
in interface Widget<O extends OutputManager<?>>
true
if widget is displayed.public boolean isRealized()
isRealized
in interface Widget<O extends OutputManager<?>>
true
if config().realized is true.public abstract void draw()
draw
in interface Widget<O extends OutputManager<?>>
public void drawCaret()
drawCaret
in interface Widget<O extends OutputManager<?>>
public boolean isEnabled()
isEnabled
in interface Widget<O extends OutputManager<?>>
true
if widget is enabled.public boolean focusTraversable()
focusTraversable
in interface Widget<O extends OutputManager<?>>
true
if widget is focus traversable.public boolean navigable()
true
only if this widget is navigable.navigable
in interface Widget<O extends OutputManager<?>>
true
if widget is navigable.public void forceVisibility(boolean visibility)
forceVisibility
in interface Widget<O extends OutputManager<?>>
visibility
- New visibility state.public boolean hasFocus()
hasFocus
in interface Widget<O extends OutputManager<?>>
true
if widget has focus.public abstract double height()
height
in interface Widget<O extends OutputManager<?>>
public boolean hidden()
hidden
in interface Widget<O extends OutputManager<?>>
public void hide()
hide
in interface Widget<O extends OutputManager<?>>
public boolean highlighted()
highlighted
in interface Widget<O extends OutputManager<?>>
public Point location()
The method always returns a valid location. If a component has not been assigned location explicitly, the method returns the default location 0,0.
location
in interface Widget<O extends OutputManager<?>>
public NativePoint physicalLocation()
The method always returns a valid location. If a component has not been assigned location explicitly, the method returns the default location 0,0.
The value returned by the method is in native (also called physical) units. Native units should not be used by the layout logic but only by the output subsystems.
physicalLocation
in interface Widget<O extends OutputManager<?>>
public abstract Dimension minimumSize()
minimumSize
in interface Widget<O extends OutputManager<?>>
public java.lang.String name()
name
in interface Widget<O extends OutputManager<?>>
public Container<O> parent()
parent
in interface Widget<O extends OutputManager<?>>
public <T extends Widget<O>> T parent(java.lang.Class<T> clazz)
parent
in interface Widget<O extends OutputManager<?>>
clazz
- The parent type to return.public <T extends Widget<O>> T parentOrSelf(java.lang.Class<T> clazz)
parentOrSelf
in interface Widget<O extends OutputManager<?>>
clazz
- The type to return.public void processFocusEvent(FocusEvent event)
processFocusEvent
in interface Widget<O extends OutputManager<?>>
event
- Event to process.public void processKeyEvent(KeyInput event)
processKeyEvent
in interface Widget<O extends OutputManager<?>>
event
- Key event to process.public void processKeyListeners(KeyInput event)
processKeyListeners
in interface Widget<O extends OutputManager<?>>
event
- Keyboard event.public void processDirectManipulationEvent(DirectManipulationEvent event)
processDirectManipulationEvent
in interface Widget<O extends OutputManager<?>>
event
- Event to process.public void repaint()
repaint
in interface Widget<O extends OutputManager<?>>
public void repaint(Rectangle ur)
repaint
in interface Widget<O extends OutputManager<?>>
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.public void requestFocus()
requestFocus
in interface Widget<O extends OutputManager<?>>
public void requestSync()
requestSync
in interface Widget<O extends OutputManager<?>>
public Point screenLocation()
screenLocation
in interface Widget<O extends OutputManager<?>>
public NativePoint screenPhysicalLocation()
screenPhysicalLocation
in interface Widget<O extends OutputManager<?>>
public NativePoint displayPhysicalLocation()
displayPhysicalLocation
in interface Widget<O extends OutputManager<?>>
public void setEnabled(boolean enabled)
setEnabled
in interface Widget<O extends OutputManager<?>>
enabled
- public void setHidden(boolean hidden)
setHidden
in interface Widget<O extends OutputManager<?>>
hidden
- New hidden state.public void setHighlighted(boolean highlighted)
setHighlighted
in interface Widget<O extends OutputManager<?>>
highlighted
- New highlighted state.public void setLocation(double x, double y)
setLocation
in interface Widget<O extends OutputManager<?>>
x
- Widget X.y
- Widget Y.public void setLocation(Point origin)
setLocation
in interface Widget<O extends OutputManager<?>>
origin
- Location to set.public void setPhysicalLocation(int x, int y)
setPhysicalLocation
in interface Widget<O extends OutputManager<?>>
x
- Widget physical X.y
- Widget physical Y.private void setPhysicalDimensionInt(int width, int height)
width
- Widget physical width.height
- Widget physical height.public NativeRectangle physicalBounds()
physicalBounds
in interface Widget<O extends OutputManager<?>>
public void resizeTo(NativePoint origin, NativeDimension size, boolean raise)
resizeTo
in interface Widget<O extends OutputManager<?>>
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.public void setParent(Container<O> container)
setParent
in interface Widget<O extends OutputManager<?>>
container
- Parent to set.public void setVisible(boolean visible)
setVisible
in interface Widget<O extends OutputManager<?>>
visible
- New visible state.public void show()
show
in interface Widget<O extends OutputManager<?>>
public boolean isTotallyObscured()
isTotallyObscured
in interface Widget<O extends OutputManager<?>>
true
if widget is totally obscured.public boolean isVisible()
isVisible
in interface Widget<O extends OutputManager<?>>
true
if widget is visible.public boolean isHeader()
isHeader
in interface Widget<O extends OutputManager<?>>
true
if widget is part of header.public boolean forceCursorOnFocus()
true
so it needs to be overwritten if other return value
is required for particular widget implementation class.forceCursorOnFocus
in interface Widget<O extends OutputManager<?>>
true
as the default value.public abstract double width()
width
in interface Widget<O extends OutputManager<?>>
protected void disable()
protected void enable()
protected <C extends WidgetConfig> void updateSizeWorker(C beforeUpdate)
This implementation uses the supplied config instance to detect whether
size has changed. If null
is passed in the method does
nothing.
beforeUpdate
- BaseConfig
reference or null
.protected <C extends WidgetConfig> void autoResize(C beforeUpdate)
beforeUpdate
- BaseConfig
reference or null
.public boolean processMnemonic(int key)
processMnemonic
in interface Widget<O extends OutputManager<?>>
key
- The pressed mnemonic key code.true
if this widget accepted this mnemonic key. Not enabled or not
visible widget will not accept it. Returns false
by default.protected final boolean processMnemonicImpl(int key, MnemonicTrait m)
key
- The pressed mnemonic key code.true
if this widget accepted this mnemonic key. Not enabled or not
visible widget will not accept it.public void processEvent(Event evt)
processEvent
in interface Widget<O extends OutputManager<?>>
evt
- Event to process.public <W extends WidgetConfig> W config()
config
in interface Widget<O extends OutputManager<?>>
W
- Config type.public boolean isFocusable()
isFocusable
in interface Widget<O extends OutputManager<?>>
true
if this widget can be focused under
certain conditions. false
if, and only if, this
widget can never receive focus.public int resolveTitleFont()
public int resolveFont()
public Widget<O> findMouseSource(NativePoint p)
findMouseSource
in interface Widget<O extends OutputManager<?>>
p
- The mouse physical location.null
if none found.public NativePoint getPortableMouseEventCoordinates(NativePoint point)
point
- The point (relative to the window's top-left corner) for which the coordinates for
the portable mouse events are needed.null
if such an event can't be raised.public void mouseDragged(java.awt.event.MouseEvent e)
mouseDragged
in interface java.awt.event.MouseMotionListener
e
- The mouse event.public void mouseMoved(java.awt.event.MouseEvent e)
mouseMoved
in interface java.awt.event.MouseMotionListener
e
- The mouse event.public void mouseClicked(java.awt.event.MouseEvent e)
In GUI mode, if the widget has a popup-menu attached, it will display it.
mouseClicked
in interface java.awt.event.MouseListener
e
- The mouse event.public void mousePressed(java.awt.event.MouseEvent e)
mousePressed
in interface java.awt.event.MouseListener
e
- The mouse event.public void mouseReleased(java.awt.event.MouseEvent e)
mouseReleased
in interface java.awt.event.MouseListener
e
- The mouse event.public void mouseEntered(java.awt.event.MouseEvent e)
mouseEntered
in interface java.awt.event.MouseListener
e
- The mouse event.public void mouseExited(java.awt.event.MouseEvent e)
mouseExited
in interface java.awt.event.MouseListener
e
- The mouse event.public void mouseWheelMoved(java.awt.event.MouseWheelEvent e)
mouseWheelMoved
in interface java.awt.event.MouseWheelListener
e
- The mouse event.public void destroy()
destroy
in interface Widget<O extends OutputManager<?>>
public void registerWidgetStateListener(WidgetStateListener l)
l
- The widget state listener.public NativePoint translate(java.awt.event.MouseEvent evt)
evt
- Mouse event.public byte getState()
getState
in interface Widget<O extends OutputManager<?>>
ScreenBuffer.UNINITIALIZED
).public Rectangle getVisiblePart()
getVisiblePart
in interface Widget<O extends OutputManager<?>>
public void setState(byte state)
setState
in interface Widget<O extends OutputManager<?>>
state
- The new state (for example ScreenBuffer.CHANGED
).public static NativeRectangle clipRectangle(NativePoint origin, NativeDimension dimension)
origin
- Physical location.dimension
- Physical dimension.protected NativeRectangle clipRectangle()
private void _setEnabled(boolean enabled)
enabled
flag in the configuration and in the widget's state.enabled
- The widget's enabled state.protected MouseHoverAction createMouseHoverAction()
public void _setVisible(boolean visible)
visible
flag in the configuration and in the widget's state.visible
- The widget's visible state.public void _setHidden(boolean hidden)
hidden
flag in the configuration and in the widget's state.hidden
- The widget's hidden state.public boolean raiseLegacyMouseEvents()
raiseLegacyMouseEvents
in interface Widget<O extends OutputManager<?>>
true
.public void sync()
OutputManager.sync(int)
public void refresh(Rectangle rect)
rect
- rectangle to mark for repaintingOutputManager.refresh(int, Rectangle)
public void clear(Point origin, Dimension size, Color color)
origin
- Upper left corner of the area to clear.size
- Dimensions of the area.color
- Color.OutputManager.clear(int, NativePoint, NativeDimension, Color)
public ScreenBitmap getAndResetBitmap()
OutputManager.getAndResetBitmap(int)
public void resetBitmap()
OutputManager.resetBitmap(int)
public ScreenBitmap getAndSetBitmap(Rectangle rect)
rect
- The extra clipping rectangle. null
has no effect
on clipping.OutputManager.getAndSetBitmap(int, Rectangle)
public ScreenBitmap getBitmapCopy()
OutputManager.getBitmapCopy(int)
public void setBitmap(ScreenBitmap bitmap)
bitmap
- The bitmap instance to set as the output primitive's bitmap.OutputManager.setBitmap(int, ScreenBitmap)
public void clipWith(Rectangle rect)
true
values. Else, if the bitmap
was just reset, fill it with false
values and set the clipping region to true.rect
- The clipping rectangle to be added.OutputManager.clipWith(int, Rectangle)
public double screenHeight()
public int getTextWidthNative(java.lang.String txt, int font)
GuiDriver.getTextWidth(java.lang.String, com.goldencode.p2j.ui.client.FontDetails<F>)
.txt
- The text.font
- The font index in the font table.getTextWidth(String, int, boolean)
public int getTextWidth(java.lang.String txt, int font)
FontManager.getTextWidth(java.lang.String, com.goldencode.p2j.ui.client.Window<?>, int, com.goldencode.p2j.ui.client.driver.ScreenDriver<?>)
.txt
- The text.font
- The font index in the font table.getTextWidth(String, int, boolean)
public int getTextHeightNative(java.lang.String txt, int font)
GuiDriver.getTextHeight(java.lang.String, com.goldencode.p2j.ui.client.FontDetails<F>)
.txt
- The text.font
- The font index in the font table.getTextHeight(String, int, boolean)
public int getTextHeight(java.lang.String txt, int font)
FontManager.getTextHeight(java.lang.String, com.goldencode.p2j.ui.client.Window<?>, int, com.goldencode.p2j.ui.client.driver.ScreenDriver<?>)
.txt
- The text.font
- The font index in the font table.getTextHeight(String, int, boolean)
public double screenWidth()
public Dimension screenDimension()
public boolean manageSystemActions()
true
if the widget has its own event management.
false
by default.public java.lang.String getSelectedText()
getSelectedText
in interface Widget<O extends OutputManager<?>>
null
if there is no selected text or if the
widget type does not support clipboard operations.public int getDefaultEvent(KeyInput key, boolean inEditingBlock)
key
- The current key.inEditingBlock
- true
if EDITING mode is active.public void processSystemKey(KeyInput key)
This must be called only in the context of widget-level event processing.
key
- The key to be processed.public boolean ignoreAction(int action)
action
- The event code.public <C extends WidgetConfig> void afterConfigUpdateBase(C beforeUpdate)
beforeUpdate
- Config reference capturing the config state before
the owner's config was modified.protected void activateDirectManipulation()
protected void deactivateDirectManipulation()
protected boolean isDirectManipulationCapable()
TRUE
if direct manipulation is available,
FALSE
otherwise.protected boolean isDirectManipulationRequired()
TRUE
if direct manipulation is need to be installed,
FALSE
if direct manipulation is need to be removed.public void debug(java.lang.String message)
message
- String parameterpublic boolean isTabStop()
isTabStop
in interface Widget<O extends OutputManager<?>>
true
if not applicablepublic void postprocessConfig()
postprocessConfig
in interface Widget<O extends OutputManager<?>>
public boolean moveToBottom()
moveToBottom
in interface Widget<O extends OutputManager<?>>
true
if operation was successful and
false
otherwise.public boolean moveToTop()
moveToTop
in interface Widget<O extends OutputManager<?>>
true
if operation was successful and
false
otherwise.public Widget.ZOrderClass getZOrderClass()
getZOrderClass
in interface Widget<O extends OutputManager<?>>
public int getMenuMouse()
getMenuMouse
in interface Widget<O extends OutputManager<?>>
public java.util.Set<java.lang.Integer> getMouseActions()
getMouseActions
in interface Widget<O extends OutputManager<?>>
mouseActions()
.public boolean isThreeD()
true
the widget should be represented with 3D visuals.
This implementation forwards the call to isThreeD()
of the parent frame. If
no parent frame exists for this widget the method returns false
.
isThreeD
in interface Widget<O extends OutputManager<?>>
public java.lang.String toString()
toString
in class java.lang.Object
public void setMousePointer(MousePtrWrapper ptr)
setMousePointer
in interface Widget<O extends OutputManager<?>>
ptr
- the custom mouse pointerpublic java.util.Optional<MousePtrWrapper> getLoadedMousePointer()
getLoadedMousePointer
in interface Widget<O extends OutputManager<?>>
public java.util.Optional<MousePtrWrapper> getCustomMousePointer()
getCustomMousePointer
in interface Widget<O extends OutputManager<?>>
public MousePtrWrapper getEffectiveMousePointer()
getEffectiveMousePointer
in interface Widget<O extends OutputManager<?>>
public NativeRectangle getActualBounds()
getActualBounds
in interface Widget<O extends OutputManager<?>>
public boolean isRMBEntrySupported()
isRMBEntrySupported
in interface Widget<O extends OutputManager<?>>
true
if this widget gains ENTRY event
when right/middle mouse button is clicked.public boolean clearWidget()
clearWidget
in interface Widget<O extends OutputManager<?>>
true
on success. false
if CLEAR cannot be applied to this
widget, e.g. if it is static text.protected int[] mouseActions()
MouseEvent
codes and P2J specific
MouseEvt
actions.
If null
, it means the widget does not respond to mouse events.
protected Point prepParentLocation(Widget<?> parent)
parent
- Parent component.public boolean supportsCustomMousePointer()
supportsCustomMousePointer
in interface Widget<O extends OutputManager<?>>
true
if the widget supports
LOAD-MOUSE-POINTER() methodpublic java.util.Optional<Frame<?>> enclosingFrame()
enclosingFrame
in interface Widget<O extends OutputManager<?>>
public void unrealize()
unrealize
in interface Widget<O extends OutputManager<?>>
private int getTextWidth(java.lang.String txt, int font, boolean useNative)
useNative
flag is set, then the width is computed directly from the
driver. Otherwise, FontManager.getTextWidth(java.lang.String, com.goldencode.p2j.ui.client.Window<?>, int, com.goldencode.p2j.ui.client.driver.ScreenDriver<?>)
is used to determine the width:
the custom text metrics are interrogated first via and, if not found, it fallbacks to using
the driver to determine the width.txt
- The text.font
- The font index in the font table.useNative
- Flag indicating that the GuiDriver.getTextWidth(java.lang.String, com.goldencode.p2j.ui.client.FontDetails<F>)
needs to be used.private int getTextHeight(java.lang.String txt, int font, boolean useNative)
useNative
flag is set, then the height is computed directly from the
driver. Otherwise, FontManager.getTextHeight(java.lang.String, com.goldencode.p2j.ui.client.Window<?>, int, com.goldencode.p2j.ui.client.driver.ScreenDriver<?>)
is used to determine the height:
the custom text metrics are interrogated first via and, if not found, it fallbacks to using
the driver to determine the height.txt
- The text.font
- The font index in the font table.useNative
- Flag indicating that the GuiDriver.getTextHeight(java.lang.String, com.goldencode.p2j.ui.client.FontDetails<F>)
needs to be used.