public abstract class DriverWidgetHost<C extends BaseConfig> extends AbstractContainer<GuiOutputManager> implements WidgetWithConfig<C>
Modifier and Type | Field and Description |
---|---|
private C |
config
Associated config instance
|
private boolean |
destroyed
Flag indicating the widget has been destroyed, so consume any other posted events.
|
private GuiColorResolver |
gc
Color resolver
|
protected GuiDriver |
gd
Screen driver
|
private GuiFontResolver |
gf
Font resolver
|
private WidgetId |
id
Widget id
|
private boolean |
placeWidget
Flag indicating the widget needs to be placed (as its location has changed).
|
private boolean |
sensitivityChanged
Flag indicating the widget's sensitivity has changed.
|
private boolean |
visibilityChanged
Flag indicating the widget's visibility has changed.
|
location, mousePtr, nativeInsets, physicalLocation
Constructor and Description |
---|
DriverWidgetHost(WidgetId id,
C cfg)
Construtor.
|
Modifier and Type | Method and Description |
---|---|
void |
afterConfigUpdate(C beforeUpdate)
The method is called after the configuration associated with the
owner changes.
|
private boolean |
collectDrawingBoundaries(Widget start,
java.util.Set<NativeRectangle> boundaries)
Collect all drawing boundaries until this widget is encountered, in z-order.
|
C |
config()
Get externalizable widget config which can be used to restore widget
state after via network.
|
Widget<GuiOutputManager> |
currentFocus()
Get widget which is in focus.
|
void |
destroy()
Destroy this widget.
|
void |
draw()
Draw the widget.
|
boolean |
focusTraversable()
Check if widget is focus traversable.
|
WidgetId |
getId()
Widget ID.
|
double |
height()
Get widget height.
|
void |
initialize(WidgetId id,
C cfg)
Replacement API for the logic which should exist in the widget's c'tor, but the logic
can't be executed as it depends on the widget being registered into the official registry.
|
boolean |
isTotallyObscured()
Check if widget is totally obscured.
|
protected int[] |
mouseActions()
Determine the mouse actions processed by this widget.
|
void |
processKeyEvent(KeyInput event)
Process key event.
|
void |
reflectAncestorChange()
Called when any of the widget's ancestors gets re-assigned.
|
void |
reflectLocationChange()
Called when the widget's location changes.
|
void |
triggerEvent(byte eventId,
byte[] paramsData)
Called by the driver to notify about a triggered high-level widget specific event.
|
void |
widgetStateChanged()
Notification that this widget's state has changed (visibility, sensitivity, z-order).
|
double |
width()
Get widget width.
|
add, add, add, addContainerStateListener, addDirectly, belongsTo, checkWidget, childrenLocation, clipping, clipRectangle, copyState, currentFocus, cycleFocus, defaultFocus, deregisterSelectedWidget, detach, dimension, doLayout, dumpCurrentWidgets, dumpWidgets, endSizeChange, findMouseSource, firstFocus, focus, focusWorker, formatDump, get, getAllSelectedWidgets, getClipRect, getEffectiveScrollableSize, getFocusInt, getIgnoreFocus, getLayout, getScrollableSize, getTabItemList, hasFocusable, insets, lastFocus, minimumSize, moveAfterTabItem, moveBeforeTabItem, moveToBottom, moveToBottomInClass, moveToTop, moveToTopInClass, moveToZpos, nextFocus, normalizeZOrder, onWidgetAdded, onWidgetRemoved, paintOnTop, parentOf, prepareWidgets, prevFocus, registerSelectedWidget, remove, removeContainerStateListener, repaint, replace, requestFocus, requestFocus, setFocus, setFocusInt, setHeight, setIgnoreFocus, setInsets, setLayout, setSize, setSize, setTabItemList, setWidth, startSizeChange, triggerContainerStateRedrawEnabled, unrealize, updateSizeWorker, widgets, widgetsAsList
_setHidden, _setVisible, activateDirectManipulation, addFocusListener, addKeyListener, afterConfigUpdateBase, ancestor, ancestorId, autoResize, bounds, clear, clearWidget, clipRectangle, clipRectangle, clipWith, copyColors, createMouseHoverAction, deactivateDirectManipulation, debug, disable, disableTooltip, displayPhysicalLocation, drawCaret, enable, enableTooltip, enclosingFrame, forceCursorOnFocus, forceVisibility, getActualBounds, getAndResetBitmap, getAndSetBitmap, getBitmapCopy, getCachedScreenLocation, getCachedScreenPhysicalLocation, getCustomMousePointer, getDefaultEvent, getEffectiveMousePointer, getLoadedMousePointer, getMenuMouse, getMouseActions, getMousePosition, getPortableMouseEventCoordinates, getSelectedText, getState, getTextHeight, getTextHeightNative, getTextHeightNative, getTextWidth, getTextWidth, getTextWidthNative, getTextWidthNative, getVisiblePart, getZOrderClass, hasFocus, hidden, hide, highlighted, ignoreAction, initialHeight, initialWidth, isCurrent, isDirectManipulationActive, isDirectManipulationCapable, isDirectManipulationRequired, isDisplayed, isEnabled, isFocusable, isHeader, isMouseDrag, isRealized, isRepaintDisabled, isRMBEntrySupported, isScreenLocationCached, isTabStop, isThreeD, isVisible, isVisible, location, manageSystemActions, mouseClicked, mouseDragged, mouseEntered, mouseExited, mouseMoved, mousePressed, mouseReleased, mouseWheelMoved, moveToBottom, moveToTop, name, navigable, oleDoDrop, oleDrag, oleDragging, oleStartDragging, onOleDragging, onOleDropEnd, parent, parent, parentObject, parentOrSelf, parentOrSelfObject, physicalBounds, physicalDimension, physicalLocation, postprocessConfig, prepParentLocation, preventFocusWhenMouseDownEventDefined, processDirectManipulationEvent, processEvent, processFocusEvent, processKeyEventForSelectableWidget, processKeyListeners, processMnemonic, processMnemonicImpl, processSystemKey, raiseLegacyMouseEvents, refresh, registerWidgetStateListener, repaint, repaint, requestSync, resetBitmap, resizeTo, resolveFont, resolvePopupMenuId, resolveTitleFont, screen, screenDimension, screenHeight, screenLocation, screenPhysicalLocation, screenWidth, setBitmap, setCachedScreenLocation, setCachedScreenPhysicalLocation, setEnabled, setHidden, setHighlighted, setLocation, setLocation, setMousePointer, setParent, setPhysicalLocation, setState, setVisible, show, showPopupMenu, supportsCustomMousePointer, sync, topLevelWindow, toString, translate, unregisterWidgetStateListener, window
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
widgetsAsList
addFocusListener, addKeyListener, ancestor, ancestorId, bounds, canMovetoTop, clearWidget, defaultMousePtr, displayPhysicalLocation, drawCaret, enclosingFrame, enforceDefaultMousePtr, forceCursorOnFocus, forceVisibility, getActualBounds, getCustomMousePointer, getEffectiveMousePointer, getLegacyWidget, getLoadedMousePointer, getMenuMouse, getMouseActions, getMousePosition, getSelectedText, getState, getTriggerWidget, getTriggerWidget, getVisiblePart, getZOrderClass, hasFocus, hasFocus, hidden, hide, highlighted, ignoreEnable, initialHeight, initialWidth, isCurrent, isDirectManipulable, isDirectManipulationActive, isDisplayed, isDroppable, isEnabled, isFocusable, isHeader, isInitialValueLayout, isLegacyFocus, isRealized, isRepaintDisabled, isRMBEntrySupported, isTabStop, isThreeD, isVisible, isVisible, location, maySwitchFocus, moveToBottom, moveToTop, name, navigable, oleDrag, parent, parent, parent, parentObject, parentOrSelf, parentOrSelfObject, physicalBounds, physicalDimension, physicalLocation, postprocessConfig, preventFocusWhenMouseDownEventDefined, processDirectManipulationEvent, processEvent, processFocusEvent, processKeyListeners, processMnemonic, raiseLegacyMouseEvents, refreshWidget, registerWidgetStateListener, repaint, repaint, requestFocus, requestSync, resizeTo, resolvePopupMenuId, screen, screenLocation, screenPhysicalLocation, setEnabled, setHidden, setHighlighted, setLocation, setLocation, setMousePointer, setParent, setPhysicalLocation, setState, setVisible, show, supportsCustomMousePointer, systemFocusGrabbed, topLevelWindow, unregisterWidgetStateListener, validateDisplayValue, window
private WidgetId id
private C extends BaseConfig config
protected GuiDriver gd
private GuiFontResolver gf
private GuiColorResolver gc
private boolean placeWidget
private boolean sensitivityChanged
private boolean visibilityChanged
private boolean destroyed
public void initialize(WidgetId id, C cfg)
This API is called after the widget is created and added to the registry.
initialize
in interface WidgetWithConfig<C extends BaseConfig>
id
- The widget's ID.cfg
- Config instance.public WidgetId getId()
getId
in interface Widget<GuiOutputManager>
getId
in class AbstractWidget<GuiOutputManager>
public C config()
Note that only very limited set of widgets actually have config. By default widget has no config.
config
in interface Widget<GuiOutputManager>
config
in interface ConfigOwner<C extends BaseConfig>
config
in class AbstractWidget<GuiOutputManager>
public void afterConfigUpdate(C beforeUpdate)
The implemented logic must be idempotent - the method must produce the same results if executed once or multiple times not relying on any particular call sequence or related state. This is necessary so that the method can be repeated or retried as often as necessary without causing unintended effects
afterConfigUpdate
in interface ConfigOwner<C extends BaseConfig>
beforeUpdate
- Config reference capturing the iconfig state before the owner's config was modified.public double width()
width
in interface Widget<GuiOutputManager>
width
in class AbstractContainer<GuiOutputManager>
public double height()
height
in interface Widget<GuiOutputManager>
height
in class AbstractContainer<GuiOutputManager>
public void reflectLocationChange()
reflectLocationChange
in class AbstractContainer<GuiOutputManager>
public void reflectAncestorChange()
reflectAncestorChange
in class AbstractContainer<GuiOutputManager>
public void widgetStateChanged()
widgetStateChanged
in interface Widget<GuiOutputManager>
widgetStateChanged
in class AbstractContainer<GuiOutputManager>
public boolean isTotallyObscured()
isTotallyObscured
in interface Widget<GuiOutputManager>
isTotallyObscured
in class AbstractWidget<GuiOutputManager>
true
if widget is totally obscured.public void destroy()
destroy
in interface Widget<GuiOutputManager>
destroy
in class AbstractContainer<GuiOutputManager>
public void processKeyEvent(KeyInput event)
processKeyEvent
in interface Widget<GuiOutputManager>
processKeyEvent
in class AbstractContainer<GuiOutputManager>
event
- Key event to process.public void draw()
draw
in interface Widget<GuiOutputManager>
draw
in class AbstractContainer<GuiOutputManager>
public void triggerEvent(byte eventId, byte[] paramsData)
eventId
- Event id.paramsData
- Parameters data.protected int[] mouseActions()
mouseActions
in class AbstractWidget<GuiOutputManager>
public Widget<GuiOutputManager> currentFocus()
AbstractContainer
currentFocus
in interface Container<GuiOutputManager>
currentFocus
in class AbstractContainer<GuiOutputManager>
public boolean focusTraversable()
AbstractContainer
focusTraversable
in interface Widget<GuiOutputManager>
focusTraversable
in class AbstractContainer<GuiOutputManager>
true
if widget is focus traversable.private boolean collectDrawingBoundaries(Widget start, java.util.Set<NativeRectangle> boundaries)
start
- The starting widget to search.boundaries
- The set collecting boundaries.true
if the collect should continue.