public abstract class AbstractButton<O extends OutputManager<?>,C extends ControlConfig> extends AbstractWidget<O> implements WidgetWithConfig<C>, KeyListener, FocusListener
| Modifier and Type | Field and Description |
|---|---|
protected C |
config
The config instance.
|
private boolean |
curvis
Previous cursor visibility flag to restore on focus lost.
|
private java.lang.String |
textLabel
Button label.
|
protected boolean |
widgetFocused
Widget in focus flag.
|
insets, listeners, location, LOG, mousePtr, nativeInsets, physicalLocation| Constructor and Description |
|---|
AbstractButton()
Default constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
afterConfigUpdate(C beforeUpdate)
The method is called after the configuration associated with
the implementor changes.
|
C |
config()
Provide access to the attributes stored in the widget.
|
Dimension |
dimension()
Get widget dimension.
|
abstract void |
draw()
Draw the button implementation.
|
boolean |
forceCursorOnFocus()
Check if widget needs in cursor to be on when having the input focus.
|
int |
getDefaultEvent(KeyInput key,
boolean inEditingBlock)
Get the default event associated for this widget and the given key.
|
protected abstract void |
handleBasicEvents(KeyInput event)
Process basic events - TAB, BACK-TAB and ENTER key event.
|
protected boolean |
handleCursorKeys(int key,
Frame<O> frame)
Handle cursor movement keys.
|
boolean |
ignoreAction(int action)
Check if the given event needs to be ignored, as it can't be treated by the widget.
|
boolean |
manageSystemActions()
Check if the current widget can manage non-global system actions on its own, and not via the
enclosing event loop.
|
Dimension |
minimumSize()
Get widget minimum size.
|
private boolean |
moveAboveWidget(Frame<O> frame)
Move focus to widget above in specified frame.
|
private boolean |
moveBelowWidget(Frame<O> frame)
Move focus to widget below in specified frame.
|
private boolean |
nextFocus()
Move focus to next widget in Tab order.
|
private boolean |
nextTabStop()
Move focus to next widget in Tab order if initiated by NAB.
|
void |
onFocusGained(FocusEvent event)
This is called when the toggle-box takes the input focus.
|
void |
onFocusLost(FocusEvent focusEvent)
This is called when the button looses the input focus.
|
void |
onKeyPressed(KeyInput event)
This method is invoked when key is pressed.
|
void |
onKeyTyped(KeyInput event)
This method is invoked when key is typed.
|
private boolean |
prevFocus()
Move focus to previous widget in Tab order.
|
private boolean |
prevTabStop()
Move focus to previous widget in Tab order if initiated by BACK-TAB.
|
protected void |
processKeyEventCommon(KeyInput keyEvent)
Processes key events occurring on this object by dispatching them
to any registered KeyListener objects.
|
protected void |
refresh()
Refresh widget at the screen.
|
protected void |
setActionCode(KeyInput ki)
Prepare event for processing.
|
abstract void |
setText(java.lang.String text)
Set the new text for the component.
|
void |
setTextLabel(java.lang.String label)
Set button label.
|
java.lang.String |
textLabel()
Get label text.
|
_setHidden, _setVisible, activateDirectManipulation, addFocusListener, addKeyListener, afterConfigUpdateBase, ancestor, ancestorId, autoResize, bounds, clear, clearWidget, clipRectangle, clipRectangle, clipWith, copyColors, copyState, createMouseHoverAction, deactivateDirectManipulation, debug, destroy, disable, disableTooltip, displayPhysicalLocation, drawCaret, enable, enableTooltip, enclosingFrame, findMouseSource, focusTraversable, forceVisibility, getActualBounds, getAndResetBitmap, getAndSetBitmap, getBitmapCopy, getCachedScreenLocation, getCachedScreenPhysicalLocation, getCustomMousePointer, getEffectiveMousePointer, getId, getLoadedMousePointer, getMenuMouse, getMouseActions, getMousePosition, getPortableMouseEventCoordinates, getSelectedText, getState, getTextHeight, getTextHeightNative, getTextHeightNative, getTextWidth, getTextWidth, getTextWidthNative, getTextWidthNative, getVisiblePart, getZOrderClass, hasFocus, hasTooltip, height, hidden, hide, highlighted, initialHeight, initialWidth, insets, isCurrent, isDirectManipulationActive, isDirectManipulationActiveOrInUIB, isDirectManipulationCapable, isDirectManipulationRequired, isDisplayed, isEnabled, isFocusable, isHeader, isMouseDrag, isRealized, isRepaintDisabled, isRMBEntrySupported, isScreenLocationCached, isTabStop, isThreeD, isTotallyObscured, isVisible, isVisible, location, mouseActions, 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, processKeyEvent, processKeyEventForSelectableWidget, processKeyListeners, processMnemonic, processMnemonicImpl, processSystemKey, raiseLegacyMouseEvents, reflectAncestorChange, reflectLocationChanged, reflectSizeChanged, refresh, registerWidgetListener, repaint, repaint, repaint, requestFocus, requestSync, resetBitmap, resizeTo, resolveFont, resolvePopupMenuId, resolveTitleFont, screen, screenDimension, screenHeight, screenLocation, screenPhysicalLocation, screenWidth, setBitmap, setCachedScreenLocation, setCachedScreenPhysicalLocation, setDirectManipulationActive, setEnabled, setHidden, setHighlighted, setLocation, setLocation, setMousePointer, setMousePointer, setParent, setPhysicalDimensionInt, setPhysicalLocation, setSensitiveForUIB, setState, setVisible, setWindow, show, showPopupMenu, supportsCustomMousePointer, sync, topLevelWindow, toString, translate, triggerLocationChanged, unrealize, unregisterWidgetListener, updateSizeWorker, updateSystemParent, widgetRealized, widgetStateChanged, width, windowclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitinitializeacceptsEscAsAnyKey, acceptTrigger, canMovetoTop, completeTrigger, defaultMousePtr, enforceDefaultMousePtr, getIdForTrigger, getLegacyWidget, getTriggerWidget, getTriggerWidget, hasFocus, ignoreEnable, isCurrent, isDirectManipulable, isDroppable, isInitialValueLayout, isLegacyFocus, isProcessProgressEvent, maySwitchFocus, parent, refreshWidget, requestFocus, requestFocus, startTrigger, systemFocusGrabbed, validateDisplayValueprotected C extends ControlConfig config
private java.lang.String textLabel
protected boolean widgetFocused
private boolean curvis
public C config()
config in interface Widget<O extends OutputManager<?>>config in interface ConfigOwner<C extends ControlConfig>config in class AbstractWidget<O extends OutputManager<?>>public void afterConfigUpdate(C beforeUpdate)
afterConfigUpdate in interface ConfigOwner<C extends ControlConfig>beforeUpdate - Config reference capturing the config state before
the owner's config was modified.public boolean ignoreAction(int action)
ignoreAction in class AbstractWidget<O extends OutputManager<?>>action - The event code.public boolean manageSystemActions()
manageSystemActions in class AbstractWidget<O extends OutputManager<?>>true as the widget has its own event management.public int getDefaultEvent(KeyInput key, boolean inEditingBlock)
getDefaultEvent in class AbstractWidget<O extends OutputManager<?>>key - The current key.inEditingBlock - true if EDITING mode is active.Keyboard.SE_CHOOSE.public Dimension dimension()
dimension in interface Widget<O extends OutputManager<?>>dimension in class AbstractWidget<O extends OutputManager<?>>public abstract void draw()
draw in interface Widget<O extends OutputManager<?>>draw in class AbstractWidget<O extends OutputManager<?>>public boolean forceCursorOnFocus()
false because toggle-box never needs cursor
visibility, even when it is required to force the cursor to be on.forceCursorOnFocus in interface Widget<O extends OutputManager<?>>forceCursorOnFocus in class AbstractWidget<O extends OutputManager<?>>false unconditionally.public Dimension minimumSize()
minimumSize in interface Widget<O extends OutputManager<?>>minimumSize in class AbstractWidget<O extends OutputManager<?>>public java.lang.String textLabel()
public abstract void setText(java.lang.String text)
text - New text value.public void setTextLabel(java.lang.String label)
label - Label text.public void onKeyPressed(KeyInput event)
onKeyPressed in interface KeyListenerevent - Event which triggered this call.public void onKeyTyped(KeyInput event)
onKeyTyped in interface KeyListenerevent - Event which triggered this call.public void onFocusGained(FocusEvent event)
onFocusGained in interface FocusListenerevent - The focus event to be processed.public void onFocusLost(FocusEvent focusEvent)
onFocusLost in interface FocusListenerfocusEvent - The focus event to be processed.protected void processKeyEventCommon(KeyInput keyEvent)
keyEvent - The event to be handled.protected abstract void handleBasicEvents(KeyInput event)
event - Key event to process.protected void refresh()
protected boolean handleCursorKeys(int key,
Frame<O> frame)
key - Key code.frame - Parent frame.true if any cursor key was found.protected void setActionCode(KeyInput ki)
ki - Input event.private boolean moveBelowWidget(Frame<O> frame)
frame - Parent frame.trueprivate boolean moveAboveWidget(Frame<O> frame)
frame - Parent frame.trueprivate boolean prevFocus()
trueprivate boolean nextFocus()
trueprivate boolean prevTabStop()
trueprivate boolean nextTabStop()
true