public class ToggleBoxGuiImpl extends ToggleBox<GuiOutputManager> implements AutoResizable<ToggleBoxConfig>
Widget.ZOrderClass
Modifier and Type | Field and Description |
---|---|
private Browse |
browse
Browse widget to notify.
|
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, widgetFocused
insets, 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.
|
void |
draw()
Draw the toggle-box implementation.
|
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
|
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 |
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 |
setBrowse(Browse browse)
Link editor with the
Browse widget. |
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.
|
check, getMnemonic, getText, getValue, handleBasicEvents, isModified, setMnemonic, setTextLabel, setValue
config, 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, createMouseHoverAction, deactivateDirectManipulation, debug, destroy, disable, displayPhysicalLocation, drawCaret, enable, enclosingFrame, findMouseSource, focusTraversable, forceVisibility, getActualBounds, getAndResetBitmap, getAndSetBitmap, getBitmapCopy, getCustomMousePointer, getEffectiveMousePointer, getId, getLoadedMousePointer, getMenuMouse, getMouseActions, getPortableMouseEventCoordinates, getSelectedText, getState, getTextHeight, getTextHeightNative, getTextWidth, getTextWidthNative, getVisiblePart, getZOrderClass, hasFocus, hidden, hide, highlighted, insets, isDirectManipulationCapable, isDirectManipulationRequired, isDisplayed, isEnabled, isFocusable, isHeader, isRealized, isRMBEntrySupported, isTabStop, isThreeD, isTotallyObscured, isVisible, location, mouseEntered, mouseExited, mouseMoved, mouseWheelMoved, moveToBottom, moveToTop, name, navigable, parent, parent, parentOrSelf, physicalBounds, physicalDimension, physicalLocation, postprocessConfig, prepParentLocation, processDirectManipulationEvent, processEvent, processFocusEvent, processKeyListeners, processMnemonicImpl, processSystemKey, raiseLegacyMouseEvents, refresh, registerWidgetStateListener, repaint, repaint, requestFocus, requestSync, resetBitmap, resizeTo, resolveFont, resolveTitleFont, screen, screenDimension, screenHeight, screenLocation, screenPhysicalLocation, screenWidth, setBitmap, setEnabled, setHidden, setHighlighted, setLocation, setLocation, setMousePointer, setParent, setPhysicalLocation, setState, setVisible, show, 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
private static final ColorRgb CURRENT_ROW_XOR_COLOR
private GuiColorResolver gc
private GuiDriver gd
private GuiFontResolver gf
private boolean pressed
private Browse browse
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 setWidthInt()
public void mouseClicked(java.awt.event.MouseEvent e)
mouseClicked
in interface java.awt.event.MouseListener
mouseClicked
in class AbstractWidget<GuiOutputManager>
e
- The mouse event.public void mouseDragged(java.awt.event.MouseEvent e)
mouseDragged
in interface java.awt.event.MouseMotionListener
mouseDragged
in class AbstractWidget<GuiOutputManager>
e
- The mouse event.public void mousePressed(java.awt.event.MouseEvent e)
mousePressed
in interface java.awt.event.MouseListener
mousePressed
in class AbstractWidget<GuiOutputManager>
e
- The mouse event.public void mouseReleased(java.awt.event.MouseEvent e)
mouseReleased
in interface java.awt.event.MouseListener
mouseReleased
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 void processKeyEvent(KeyInput keyEvent)
processKeyEvent
in interface Widget<GuiOutputManager>
processKeyEvent
in class ToggleBox<GuiOutputManager>
keyEvent
- The event to be handled.public void setBrowse(Browse browse)
Browse
widget.browse
- The instance of the Browse
to link with.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)