public class ToggleBoxGuiImpl extends ToggleBox<GuiOutputManager> implements AutoResizable<ToggleBoxConfig>
| Modifier and Type | Field and Description |
|---|---|
protected BrowseColumn<GuiOutputManager> |
browseColumn
Parent browse column widget (if this toggle-box is associated to a browse).
|
private static ColorRgb |
CURRENT_ROW_XOR_COLOR
Color which is XORed with background to draw current row highlighting (dotted rectangle).
|
private GuiColorResolver |
gc
Color resolver
|
private GuiDriver |
gd
Screen driver
|
private GuiFontResolver |
gf
Font resolver
|
private boolean |
pressed
Pressed button state flag.
|
config, widgetFocusedinsets, listeners, location, LOG, mousePtr, nativeInsets, physicalLocation| Constructor and Description |
|---|
ToggleBoxGuiImpl(WidgetId id,
Container<GuiOutputManager> owner,
java.lang.String text)
Constructor.
|
ToggleBoxGuiImpl(WidgetId id,
WidgetConfig 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.
|
MnemonicInfo |
createMnemonic()
Creates new
MnemonicInfoGuiImpl instance. |
void |
draw()
Draw the toggle-box implementation.
|
protected Browse<GuiOutputManager> |
getBrowse()
Get associated browse widget, if any.
|
protected int |
getLabelNativeWidth(Window<?> window)
Return the width of the actual label in native pixels.
|
Widget<?> |
getTriggerWidget(int evtCode,
boolean isKey)
This method returns the widget that should serve as the source of the triggered event.
|
double |
height()
Calculate the height of this widget.
|
void |
initialize(WidgetId id,
ToggleBoxConfig wcfg)
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 |
isAutoResize()
Get the AUTO-RESIZE status
|
boolean |
isDroppable()
Checks if the given widget is able to be the target of the drop operation.
|
boolean |
isLinkedToBrowse()
Determines whether this
ToggleBoxGuiImpl has an associated Browse
widget. |
protected boolean |
isToggleKey(int key)
Return
true if specified key can change toggle-box value. |
protected int[] |
mouseActions()
Determine the mouse actions processed by this widget.
|
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 |
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.
|
void |
processKeyEvent(KeyInput keyEvent)
Processes key events occurring on this object by dispatching them
to any registered KeyListener objects.
|
boolean |
processMnemonic(int key)
Process the given key, if this widget's mnemonic matches the key.
|
protected void |
refresh()
In GUI mode, the drawing needs to be delayed.
|
void |
setBrowseColumn(BrowseColumn<GuiOutputManager> browseColumn)
Link this toggle-box with the
BrowseColumn widget. |
void |
setColorResolver(GuiColorResolver resolver)
Sets the color resolver.
|
void |
setText(java.lang.String text)
Set the new text for the component.
|
void |
setWidthInt()
Recalculates WIDTH attribute using actual label.
|
boolean |
supportsCustomMousePointer()
Check if the widget supports LOAD-MOUSE-POINTER() method
|
void |
updateSize(ToggleBoxConfig beforeUpdate)
Update widget's size after config update
|
double |
width()
Calculate the width of this widget.
|
canMovetoTop, check, getMnemonic, getText, getValue, handleBasicEvents, isModified, setMnemonic, setTextLabel, setValueconfig, dimension, forceCursorOnFocus, getDefaultEvent, handleCursorKeys, ignoreAction, manageSystemActions, minimumSize, onFocusGained, onFocusLost, onKeyPressed, onKeyTyped, processKeyEventCommon, 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, mouseEntered, mouseExited, mouseMoved, 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, 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, sync, topLevelWindow, toString, translate, triggerLocationChanged, unrealize, unregisterWidgetListener, updateSizeWorker, updateSystemParent, widgetRealized, widgetStateChanged, windowclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetChangedValuegetColumnMnemonic, getMnemonicCharacter, getMnemonicKeyCode, getMnemonicLabel, isMnemonicSupported, setColumnMnemonic, updateMnemonicacceptsEscAsAnyKey, acceptTrigger, completeTrigger, defaultMousePtr, enforceDefaultMousePtr, getIdForTrigger, getLegacyWidget, getTriggerWidget, hasFocus, ignoreEnable, isCurrent, isDirectManipulable, isInitialValueLayout, isLegacyFocus, isProcessProgressEvent, maySwitchFocus, parent, refreshWidget, requestFocus, requestFocus, startTrigger, systemFocusGrabbed, validateDisplayValueprivate static final ColorRgb CURRENT_ROW_XOR_COLOR
private GuiColorResolver gc
private GuiDriver gd
private GuiFontResolver gf
private boolean pressed
protected BrowseColumn<GuiOutputManager> browseColumn
public ToggleBoxGuiImpl(WidgetId id, Container<GuiOutputManager> 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 ToggleBoxGuiImpl(WidgetId id, WidgetConfig cfg)
id - The widget's ID.cfg - Configuration data.public void initialize(WidgetId id, ToggleBoxConfig wcfg)
This API is called after the widget is created and added to the registry.
initialize in interface WidgetWithConfig<ToggleBoxConfig>initialize in class ToggleBox<GuiOutputManager>id - The widget's ID.wcfg - The config used to initialize this widget.public double width()
width in interface Widget<GuiOutputManager>width in class ToggleBox<GuiOutputManager>public double height()
height in interface Widget<GuiOutputManager>height in class ToggleBox<GuiOutputManager>public void setText(java.lang.String text)
setText in class ToggleBox<GuiOutputManager>text - New text value.public void draw()
draw in interface Widget<GuiOutputManager>draw in class AbstractButton<GuiOutputManager,ToggleBoxConfig>public void setColorResolver(GuiColorResolver resolver)
resolver - The color revolverpublic void setWidthInt()
public void mouseClicked(java.awt.event.MouseEvent e)
mouseClicked in interface java.awt.event.MouseListenermouseClicked in class AbstractWidget<GuiOutputManager>e - The mouse event.public void mouseDragged(java.awt.event.MouseEvent e)
mouseDragged in interface java.awt.event.MouseMotionListenermouseDragged in class AbstractWidget<GuiOutputManager>e - The mouse event.public void mousePressed(java.awt.event.MouseEvent e)
mousePressed in interface java.awt.event.MouseListenermousePressed in class AbstractWidget<GuiOutputManager>e - The mouse event.public void mouseReleased(java.awt.event.MouseEvent e)
mouseReleased in interface java.awt.event.MouseListenermouseReleased in class AbstractWidget<GuiOutputManager>e - The mouse event.public void mouseWheelMoved(java.awt.event.MouseWheelEvent e)
mouseWheelMoved in interface java.awt.event.MouseWheelListenermouseWheelMoved in class AbstractWidget<GuiOutputManager>e - The mouse event.public void afterConfigUpdate(ToggleBoxConfig beforeUpdate)
afterConfigUpdate in interface ConfigOwner<ToggleBoxConfig>afterConfigUpdate in class ToggleBox<GuiOutputManager>beforeUpdate - Previous configuration values.public boolean supportsCustomMousePointer()
supportsCustomMousePointer in interface Widget<GuiOutputManager>supportsCustomMousePointer in class AbstractWidget<GuiOutputManager>true if the widget supports
LOAD-MOUSE-POINTER() methodpublic boolean isAutoResize()
isAutoResize in interface AutoResizable<ToggleBoxConfig>true is AUTO-RESIZE is enabledpublic void updateSize(ToggleBoxConfig beforeUpdate)
updateSize in interface AutoResizable<ToggleBoxConfig>beforeUpdate - previous value of the widget's configpublic boolean processMnemonic(int key)
processMnemonic in interface Widget<GuiOutputManager>processMnemonic in class AbstractWidget<GuiOutputManager>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 MnemonicInfo createMnemonic()
MnemonicInfoGuiImpl instance.createMnemonic in interface MnemonicTrait<GuiOutputManager>MnemonicInfoGuiImpl instance.public void processKeyEvent(KeyInput keyEvent)
processKeyEvent in interface Widget<GuiOutputManager>processKeyEvent in class ToggleBox<GuiOutputManager>keyEvent - The event to be handled.public void setBrowseColumn(BrowseColumn<GuiOutputManager> browseColumn)
BrowseColumn widget.browseColumn - Parent browse column widget.public boolean isLinkedToBrowse()
ToggleBoxGuiImpl has an associated Browse
widget.true if this ToggleBoxGuiImpl has an associated
Browse widget.public Widget<?> getTriggerWidget(int evtCode, boolean isKey)
null which prevents triggering of the
legacy event.If this toggle-box is inside a browse column, that browse column widget is returned.
getTriggerWidget in interface Widget<GuiOutputManager>evtCode - The event being triggered.isKey - Whether the event being triggered is a real key.protected Browse<GuiOutputManager> getBrowse()
null if there is no associated browse widget.public boolean isDroppable()
isDroppable in interface Widget<GuiOutputManager>TRUE if this widget can be droppable at this time,
FALSE otherwise.protected int[] mouseActions()
mouseActions in class AbstractWidget<GuiOutputManager>protected void refresh()
refresh in class AbstractButton<GuiOutputManager,ToggleBoxConfig>protected boolean isToggleKey(int key)
true if specified key can change toggle-box value.
TODO: Toggle key (SPACE) PRESSED/RELEASE events work as corresponding MOUSE
events: we must draw check box background as inactive when the key is pressed
and until it will be released. So we need to add support of RELEASE event
for keys and implement that drawing.isToggleKey in class ToggleBox<GuiOutputManager>key - Key code being processed.true if specified key is a toggle key.SwingKeyboardReader.keyReleased(java.awt.event.KeyEvent)protected int getLabelNativeWidth(Window<?> window)