public abstract class ToggleBox<O extends OutputManager<?>> extends AbstractButton<O,ToggleBoxConfig> implements DataContainer, MnemonicTrait<O>
| Modifier and Type | Field and Description |
|---|---|
private MnemonicInfo |
mnemonic
Mnemonic information
|
config, widgetFocusedinsets, listeners, location, LOG, mousePtr, nativeInsets, physicalLocation| Constructor and Description |
|---|
ToggleBox(WidgetId id,
Container<O> owner,
java.lang.String text)
This constructor creates a toggle-box with a given text label.
|
ToggleBox(WidgetId id,
ToggleBoxConfig cfg)
Special constructor used to restore component using given configuration.
|
| Modifier and Type | Method and Description |
|---|---|
void |
afterConfigUpdate(ToggleBoxConfig beforeUpdate)
The method is called after the configuration associated with
the implementor changes.
|
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.
|
protected void |
check(java.awt.event.MouseEvent e)
Inverse checked state and post VALUE-CHANGED event.
|
MnemonicInfo |
getMnemonic()
MnemonicInfo instance getter.
|
java.lang.String |
getText()
Get label text.
|
BaseDataType |
getValue()
Getting the BaseDataType object representing the current value.
|
protected void |
handleBasicEvents(KeyInput event)
Process basic events - TAB, BACK-TAB and ENTER key event.
|
double |
height()
Calculate the height of this widget.
|
void |
initialize(WidgetId id,
ToggleBoxConfig 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 |
isModified()
Getting the modification state of the widget.
|
protected boolean |
isToggleKey(int key)
Return
true if specified key can change toggle-box value. |
void |
processKeyEvent(KeyInput keyEvent)
Processes key events occurring on this object by dispatching them
to any registered KeyListener objects.
|
void |
setMnemonic(MnemonicInfo mnemonic)
MnemonicInfo instance setter.
|
void |
setText(java.lang.String text)
Set the new text for the component.
|
void |
setTextLabel(java.lang.String label)
Set button label.
|
void |
setValue(BaseDataType value)
Sets the value of the toggle-box (the checked state) based on a
BaseDataType value.
|
double |
width()
Calculate the width of this widget.
|
config, dimension, draw, forceCursorOnFocus, getDefaultEvent, handleCursorKeys, ignoreAction, manageSystemActions, minimumSize, onFocusGained, onFocusLost, onKeyPressed, onKeyTyped, processKeyEventCommon, refresh, setActionCode, textLabel_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, 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, 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, windowclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetChangedValuecreateMnemonic, getColumnMnemonic, getMnemonicCharacter, getMnemonicKeyCode, getMnemonicLabel, isMnemonicSupported, setColumnMnemonic, updateMnemonicacceptsEscAsAnyKey, acceptTrigger, completeTrigger, defaultMousePtr, enforceDefaultMousePtr, getIdForTrigger, getLegacyWidget, getTriggerWidget, getTriggerWidget, hasFocus, ignoreEnable, isCurrent, isDirectManipulable, isDroppable, isInitialValueLayout, isLegacyFocus, isProcessProgressEvent, maySwitchFocus, parent, refreshWidget, requestFocus, requestFocus, startTrigger, systemFocusGrabbed, validateDisplayValueprivate MnemonicInfo mnemonic
public ToggleBox(WidgetId id, Container<O> owner, java.lang.String text)
id - The widget's ID.owner - The parent container, frame or dialog which will include this toggle-box.text - The string to be used as the toggle-box text.public ToggleBox(WidgetId id, ToggleBoxConfig cfg)
Call initialize(com.goldencode.p2j.ui.WidgetId, com.goldencode.p2j.ui.ToggleBoxConfig) to finish the widget initialization.
id - The widget's ID.cfg - Configuration data.public void initialize(WidgetId id, ToggleBoxConfig cfg)
This API is called after the widget is created and added to the registry.
initialize in interface WidgetWithConfig<ToggleBoxConfig>id - The widget's ID.cfg - The config used to initialize this widget.public void afterConfigUpdate(ToggleBoxConfig beforeUpdate)
afterConfigUpdate in interface ConfigOwner<ToggleBoxConfig>afterConfigUpdate in class AbstractButton<O extends OutputManager<?>,ToggleBoxConfig>beforeUpdate - Config reference capturing the config state before
the owner's config was modified.public java.lang.String getText()
getText in interface DataContainerpublic BaseDataType getValue()
getValue in interface DataContainerpublic boolean isModified()
isModified in interface DataContainertrue if the widget value was modified,
false otherwise.public void setValue(BaseDataType value)
setValue in interface DataContainervalue - The BaseDataType value of the logical value for toggle-box.public double width()
width in interface Widget<O extends OutputManager<?>>width in class AbstractWidget<O extends OutputManager<?>>public double height()
height in interface Widget<O extends OutputManager<?>>height in class AbstractWidget<O extends OutputManager<?>>public void processKeyEvent(KeyInput keyEvent)
processKeyEvent in interface Widget<O extends OutputManager<?>>processKeyEvent in class AbstractWidget<O extends OutputManager<?>>keyEvent - The event to be handled.public void setText(java.lang.String text)
setText in class AbstractButton<O extends OutputManager<?>,ToggleBoxConfig>text - New text value.public MnemonicInfo getMnemonic()
The implementors should simply return the value of the mnemonic class field. No additional processing logic is advised.
getMnemonic in interface MnemonicTrait<O extends OutputManager<?>>public void setMnemonic(MnemonicInfo mnemonic)
The implementors should simply assign the parameter value to the mnemonic class field. No additional processing logic is advised.
setMnemonic in interface MnemonicTrait<O extends OutputManager<?>>mnemonic - Mnemonic info.public void setTextLabel(java.lang.String label)
setTextLabel in class AbstractButton<O extends OutputManager<?>,ToggleBoxConfig>label - Label text.public boolean canMovetoTop()
canMovetoTop in interface Widget<O extends OutputManager<?>>true.protected void handleBasicEvents(KeyInput event)
handleBasicEvents in class AbstractButton<O extends OutputManager<?>,ToggleBoxConfig>event - Key event to process.protected void check(java.awt.event.MouseEvent e)
e - Mouse event or null, that means, that the source event is a key press.protected boolean isToggleKey(int key)
true if specified key can change toggle-box value.key - Key code being processed.true if specified key is a toggle key.