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, widgetFocused
insets, 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.
|
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, displayPhysicalLocation, drawCaret, enable, enclosingFrame, findMouseSource, focusTraversable, forceVisibility, getActualBounds, getAndResetBitmap, getAndSetBitmap, getBitmapCopy, getCachedScreenLocation, getCachedScreenPhysicalLocation, getCustomMousePointer, getEffectiveMousePointer, getId, getLoadedMousePointer, getMenuMouse, getMouseActions, getPortableMouseEventCoordinates, getSelectedText, getState, getTextHeight, getTextHeightNative, getTextWidth, getTextWidth, getTextWidthNative, getTextWidthNative, getVisiblePart, getZOrderClass, hasFocus, hidden, hide, highlighted, insets, isCurrent, isDirectManipulationCapable, isDirectManipulationRequired, isDisplayed, isEnabled, isFocusable, isHeader, isRealized, isRepaintDisabled, isRMBEntrySupported, isScreenLocationCached, isTabStop, isThreeD, isTotallyObscured, isVisible, isVisible, location, mouseActions, mouseClicked, mouseDragged, mouseEntered, mouseExited, mouseMoved, mousePressed, mouseReleased, mouseWheelMoved, moveToBottom, moveToTop, name, navigable, parent, parent, parentObject, parentOrSelf, parentOrSelfObject, physicalBounds, physicalDimension, physicalLocation, postprocessConfig, prepParentLocation, processDirectManipulationEvent, processEvent, processFocusEvent, processKeyListeners, processMnemonic, processMnemonicImpl, processSystemKey, raiseLegacyMouseEvents, reflectAncestorChange, reflectLocationChange, refresh, registerWidgetStateListener, repaint, repaint, requestFocus, 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, unrealize, updateSizeWorker, window
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
createMnemonic, getColumnMnemonic, getMnemonicCharacter, getMnemonicKeyCode, getMnemonicLabel, isMnemonicSupported, setColumnMnemonic, updateMnemonic
defaultMousePtr, enforceDefaultMousePtr, getLegacyWidget, isDirectManipulable, isDroppable, maySwitchFocus, requestFocus
private 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
- public java.lang.String getText()
getText
in interface DataContainer
public BaseDataType getValue()
getValue
in interface DataContainer
public boolean isModified()
isModified
in interface DataContainer
true
if the widget value was modified,
false
otherwise.public void setValue(BaseDataType value)
setValue
in interface DataContainer
value
- 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<?>>
public void setTextLabel(java.lang.String label)
setTextLabel
in class AbstractButton<O extends OutputManager<?>,ToggleBoxConfig>
label
- Label text.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.