public class RadioSetGuiImpl extends RadioSet<GuiOutputManager>
RadioButton
objects.
This is GUI specific implementation of the widget.
Widget.ZOrderClass
Modifier and Type | Field and Description |
---|---|
private boolean |
firstStateCheck
Flag to keep track first time state check when widget become realized.
|
private GuiColorResolver |
gc
Color resolver
|
private GuiDriver |
gd
Screen driver
|
private GuiFontResolver |
gf
Font resolver
|
private int |
rightPadding
The padding of radio-buttons to the right-side.
|
private boolean |
selecting
Selection in progress flag.
|
config
location, mousePtr, nativeInsets, physicalLocation
Constructor and Description |
---|
RadioSetGuiImpl(WidgetId id,
WidgetConfig cfg)
Special constructor used to restore component using given configuration.
|
Modifier and Type | Method and Description |
---|---|
void |
draw()
Draws RadioSet widget in GUI mode.
|
private void |
drawInt()
Draws radio-set widget.
|
protected double |
getButtonsExpandWidth(ControlSetItem[] items)
Gets button width for expand mode.
|
protected double |
getButtonsExtraDistance()
Gets extra distance between radio-buttons.
|
protected double |
getListHeightChars()
Gets the list height in character units for radio-set.
|
protected double |
getListWidthChars()
Gets the list width in character units for radio-set.
|
private int |
getRadioButtonIndex(java.awt.event.MouseEvent mEvt)
Locates the radio-button index for the given mouse event coordinates inside radio-set.
|
(package private) int |
getRightPadding()
Get the right-padding width to be added to each button, in horizontal mode.
|
byte |
getState()
Gets the current state of this component's data.
|
double |
height()
Returns the height of the radio-set widget.
|
void |
initialize(WidgetId id,
RadioSetConfig 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.
|
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 |
mousePressed(java.awt.event.MouseEvent e)
Notification of a mouse pressed event occurred for this widget.
|
void |
processKeyEvent(KeyInput keyEvent)
This overriding is used to move the focus from this widget to the
next/previous one, rather than moving between radio buttons inside the
current radio-set.
|
boolean |
processMnemonic(int key)
Process the given key, if this widget's mnemonic matches the key.
|
void |
refreshItemsImpl(int selectedId,
boolean selectedDisabled)
Refresh widget look using new set of buttons, after the concrete implementation has done any
other needed calculations.
|
boolean |
supportsCustomMousePointer()
Check if the widget supports LOAD-MOUSE-POINTER() method
|
double |
width()
Returns the width of the radio-set widget.
|
afterConfigUpdate, currentFocus, defaultFocus, focusTraversable, getCharWidth, getIndex, getSelected, getSelection, getText, getValue, getVisiblePart, isModified, manageSystemActions, onFocusGained, onFocusLost, refreshItems, reset, selectButton, setEnabled, setValue, setWidthChars
config, destroy, getColon, getColumnLabelText, getColumnMnemonic, getLabelInstance, getLabelText, getMnemonic, getTo, isForceLabel, isNoLabels, isRightAligned, postprocessConfig, setColumnMnemonic, setHidden, setLabelInstance, setMnemonic, setNoLabels, setVisible, setWasVisible, wasVisible
add, add, add, addDirectly, belongsTo, checkWidget, childrenLocation, clipping, clipRectangle, currentFocus, cycleFocus, detach, dimension, doLayout, endSizeChange, findMouseSource, firstFocus, focus, focusWorker, get, getClipRect, getEffectiveScrollableSize, getFocusInt, getIgnoreFocus, getLayout, getScrollableSize, getWidgetsList, hasFocusable, insets, lastFocus, minimumSize, moveAfterTabItem, moveBeforeTabItem, moveToBottom, moveToBottomInClass, moveToTop, moveToTopInClass, moveToZpos, nextFocus, normalizeZOrder, prepareWidgets, prevFocus, remove, repaint, replace, requestFocus, setFocus, setFocusInt, setHeight, setIgnoreFocus, setInsets, setLayout, setSize, setSize, setWidth, startSizeChange, unrealize, updateSizeWorker, widgets
_setHidden, _setVisible, activateDirectManipulation, addFocusListener, addKeyListener, afterConfigUpdateBase, ancestor, ancestorId, autoResize, bounds, clear, clearWidget, clipRectangle, clipRectangle, clipWith, createMouseHoverAction, deactivateDirectManipulation, debug, disable, displayPhysicalLocation, drawCaret, enable, enclosingFrame, forceCursorOnFocus, forceVisibility, getActualBounds, getAndResetBitmap, getAndSetBitmap, getBitmapCopy, getCustomMousePointer, getDefaultEvent, getEffectiveMousePointer, getId, getLoadedMousePointer, getMenuMouse, getMouseActions, getPortableMouseEventCoordinates, getSelectedText, getTextHeight, getTextHeightNative, getTextWidth, getTextWidthNative, getZOrderClass, hasFocus, hidden, hide, highlighted, ignoreAction, isDirectManipulationCapable, isDirectManipulationRequired, isDisplayed, isEnabled, isFocusable, isHeader, isRealized, isRMBEntrySupported, isTabStop, isThreeD, isTotallyObscured, isVisible, location, mouseDragged, mouseEntered, mouseExited, mouseMoved, mouseReleased, mouseWheelMoved, moveToBottom, moveToTop, name, navigable, parent, parent, parentOrSelf, physicalBounds, physicalDimension, physicalLocation, prepParentLocation, processDirectManipulationEvent, processEvent, processFocusEvent, processKeyListeners, processMnemonicImpl, processSystemKey, raiseLegacyMouseEvents, refresh, registerWidgetStateListener, repaint, requestSync, resetBitmap, resizeTo, resolveFont, resolveTitleFont, screen, screenDimension, screenHeight, screenLocation, screenPhysicalLocation, screenWidth, setBitmap, setHighlighted, setLocation, setLocation, setMousePointer, setParent, setPhysicalLocation, setState, show, sync, topLevelWindow, toString, translate, window
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
addFocusListener, addKeyListener, ancestor, ancestorId, bounds, clearWidget, defaultMousePtr, dimension, displayPhysicalLocation, drawCaret, enclosingFrame, enforceDefaultMousePtr, findMouseSource, forceCursorOnFocus, forceVisibility, getActualBounds, getCustomMousePointer, getEffectiveMousePointer, getId, getLegacyWidget, getLoadedMousePointer, getMenuMouse, getMouseActions, getSelectedText, getZOrderClass, hasFocus, hidden, hide, highlighted, insets, isDirectManipulable, isDisplayed, isEnabled, isFocusable, isHeader, isRealized, isRMBEntrySupported, isTabStop, isThreeD, isTotallyObscured, isVisible, location, minimumSize, moveToBottom, moveToTop, name, navigable, parent, parent, parentOrSelf, physicalBounds, physicalDimension, physicalLocation, processDirectManipulationEvent, processEvent, processFocusEvent, processKeyListeners, raiseLegacyMouseEvents, repaint, repaint, requestFocus, requestSync, resizeTo, screen, screenLocation, screenPhysicalLocation, setHighlighted, setLocation, setLocation, setMousePointer, setParent, setPhysicalLocation, setState, show, topLevelWindow, unrealize, window
mouseEntered, mouseExited, mouseReleased
createMnemonic, getMnemonicCharacter, getMnemonicKeyCode, getMnemonicLabel, isMnemonicSupported, updateMnemonic
private GuiDriver gd
private GuiColorResolver gc
private GuiFontResolver gf
private boolean selecting
private boolean firstStateCheck
private int rightPadding
public RadioSetGuiImpl(WidgetId id, WidgetConfig cfg)
Call initialize(com.goldencode.p2j.ui.WidgetId, com.goldencode.p2j.ui.RadioSetConfig)
to finish the widget initialization.
id
- The widget's ID.cfg
- Configuration data.public void initialize(WidgetId id, RadioSetConfig cfg)
This API is called after the widget is created and added to the registry.
initialize
in interface WidgetWithConfig<RadioSetConfig>
initialize
in class RadioSet<GuiOutputManager>
id
- The widget's ID.cfg
- The config used to initialize this widget.public void refreshItemsImpl(int selectedId, boolean selectedDisabled)
In GUI, this computes the right-padding to be added to each radio-button.
refreshItemsImpl
in class RadioSet<GuiOutputManager>
selectedId
- The selected button ID; -1 if none selected.selectedDisabled
- Flag indicating if the selected button is disabled.public byte getState()
getState
in interface Widget<GuiOutputManager>
getState
in class AbstractWidget<GuiOutputManager>
ScreenBuffer.UNINITIALIZED
).public double width()
width
in interface Widget<GuiOutputManager>
width
in class AbstractContainer<GuiOutputManager>
public double height()
height
in interface Widget<GuiOutputManager>
height
in class AbstractContainer<GuiOutputManager>
public void draw()
draw
in interface Widget<GuiOutputManager>
draw
in class RadioSet<GuiOutputManager>
public 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 RadioSet<GuiOutputManager>
keyEvent
- The key event to be processed.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 mouseClicked(java.awt.event.MouseEvent e)
mouseClicked
in interface java.awt.event.MouseListener
mouseClicked
in class AbstractWidget<GuiOutputManager>
e
- The mouse event.protected int[] mouseActions()
mouseActions
in class AbstractWidget<GuiOutputManager>
public boolean supportsCustomMousePointer()
supportsCustomMousePointer
in interface Widget<GuiOutputManager>
supportsCustomMousePointer
in class AbstractWidget<GuiOutputManager>
true
if the widget supports
LOAD-MOUSE-POINTER() methodprotected double getButtonsExpandWidth(ControlSetItem[] items)
getButtonsExpandWidth
in class RadioSet<GuiOutputManager>
items
- Radio-button set to check.protected double getButtonsExtraDistance()
getButtonsExtraDistance
in class RadioSet<GuiOutputManager>
protected double getListHeightChars()
getListHeightChars
in class RadioSet<GuiOutputManager>
protected double getListWidthChars()
getListWidthChars
in class RadioSet<GuiOutputManager>
int getRightPadding()
rightPadding
value.private void drawInt()
private int getRadioButtonIndex(java.awt.event.MouseEvent mEvt)
mEvt
- The mouse event to be checked.null
if none.