public class RadioSet<O extends OutputManager<?>> extends LabeledPanel<O,RadioSetConfig> implements FocusListener, DataContainer, ControlSetComponent
RadioButton objects.
This is the ChUI specific implementation of the widget.
| Modifier and Type | Field and Description |
|---|---|
protected java.util.ArrayList<RadioButton<O>> |
buttons
Button collection.
|
protected int |
current
current button
|
configlisteners, location, mousePtr, nativeInsets, physicalLocation| Constructor and Description |
|---|
RadioSet(WidgetId id,
WidgetConfig cfg)
Special constructor used to restore component using given configuration.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
adjustCurrentButton()
No-op in ChUI.
|
void |
afterConfigUpdate(RadioSetConfig 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.
|
Widget<O> |
currentFocus()
Return reference to this, since REDIO-SET is always retains focus on
itself.
|
Widget<O> |
defaultFocus()
Get default focusable widget.
|
void |
draw()
Draw RadioSet widget.
|
boolean |
focusTraversable()
Indicates whether this component can be traversed using TAB or BACK-TAB
events.
|
protected double |
getButtonsExpandWidth(ControlSetItem[] items)
Gets button width for expand mode.
|
protected double |
getButtonsExtraDistance()
Gets extra distance between radio-buttons.
|
double |
getCharWidth()
Getting the width of the button.
|
int |
getIndex(RadioButton<O> rb)
Request index of some button.
|
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.
|
RadioButton<O> |
getSelected()
Get selected button.
|
int[] |
getSelection()
Request indexes of selected items.
|
java.lang.String |
getText()
Get text representation of the currently selected value.
|
BaseDataType |
getValue()
Must return the value of the radio-set as a BaseDataType.
|
Rectangle |
getVisiblePart()
Gets the sub-rectangle which should be visible.
|
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.
|
boolean |
isModified()
Getting the modification state of the widget.
|
boolean |
manageSystemActions()
Check if the current widget can manage non-global system actions on its own, and not via the
enclosing event loop.
|
void |
onFocusGained(FocusEvent focusEvent)
This is called when the radio-set takes the input focus.
|
void |
onFocusLost(FocusEvent focusEvent)
This is called when the radio-set looses the input focus.
|
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.
|
void |
reflectAncestorChange()
Called when any of the widget's ancestors gets re-assigned.
|
void |
refreshItems()
Refresh widget look using new set of buttons.
|
protected void |
refreshItemsImpl(int selectedId,
boolean selectedDisabled)
Refresh widget look using new set of buttons, after the concrete implementation has done any
other needed calculations.
|
void |
reset()
Resets the value of the radio-set (the selected button) to the first
button of the set.
|
protected void |
selectButton(RadioButton<O> button)
Select specified button and remove current selection.
|
void |
setInitial()
Track index of currently selected button.
|
void |
setValue(BaseDataType value)
Sets the value of the radio-set (the selected button) based on a
BaseDataType value.
|
void |
setWidthChars(double newWidth)
Set up the width of the button dynamically.
|
config, destroy, getColon, getColumnLabelText, getColumnMnemonic, getLabelInstance, getLabelText, getMnemonic, getTo, isForceLabel, isNoLabels, isRightAligned, postprocessConfig, setColumnMnemonic, setHidden, setLabelInstance, setMnemonic, setNoLabels, setVisible, setWasVisible, wasVisibleadd, add, add, addContainerStateListener, addDirectly, belongsTo, checkWidget, childrenLocation, clipping, clipRectangle, copyState, currentFocus, cycleFocus, deregisterSelectedWidget, detach, dimension, doLayout, dumpCurrentWidgets, dumpWidgets, endSizeChange, findMouseSource, firstFocus, focus, focusWorker, formatDump, get, getAllSelectedWidgets, getClipRect, getEffectiveScrollableSize, getFocusInt, getIgnoreFocus, getLayout, getScrollableSize, getTabItemList, hasFocusable, height, insets, lastFocus, minimumSize, moveAfterTabItem, moveBeforeTabItem, moveToBottom, moveToBottomInClass, moveToTop, moveToTopInClass, moveToZpos, nextFocus, normalizeZOrder, onWidgetAdded, onWidgetRemoved, paintOnTop, parentOf, prepareWidgets, prevFocus, reflectLocationChanged, registerSelectedWidget, remove, removeContainerStateListener, repaint, replace, requestFocus, requestFocus, setFocus, setFocusInt, setHeight, setIgnoreFocus, setInsets, setLayout, setPhysicalDimensionInt, setSize, setSize, setTabItemList, setWidth, startSizeChange, swap, triggerContainerStateRedrawEnabled, unrealize, updateSizeWorker, widgets, widgetsAsList, widgetStateChanged, width_setHidden, _setVisible, activateDirectManipulation, addFocusListener, addKeyListener, afterConfigUpdateBase, ancestor, ancestorId, autoResize, bounds, clear, clearWidget, clipRectangle, clipRectangle, clipWith, copyColors, createMouseHoverAction, deactivateDirectManipulation, debug, disable, disableTooltip, displayPhysicalLocation, drawCaret, enable, enableTooltip, enclosingFrame, forceCursorOnFocus, forceVisibility, getActualBounds, getAndResetBitmap, getAndSetBitmap, getBitmapCopy, getCachedScreenLocation, getCachedScreenPhysicalLocation, getCustomMousePointer, getDefaultEvent, getEffectiveMousePointer, getId, getLoadedMousePointer, getMenuMouse, getMouseActions, getMousePosition, getPortableMouseEventCoordinates, getSelectedText, getState, getTextHeight, getTextHeightNative, getTextHeightNative, getTextWidth, getTextWidth, getTextWidthNative, getTextWidthNative, getZOrderClass, hasFocus, hasTooltip, hidden, hide, highlighted, ignoreAction, initialHeight, initialWidth, 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, prepParentLocation, preventFocusWhenMouseDownEventDefined, processDirectManipulationEvent, processEvent, processFocusEvent, processKeyEventForSelectableWidget, processKeyListeners, processMnemonic, processMnemonicImpl, processSystemKey, raiseLegacyMouseEvents, reflectSizeChanged, refresh, registerWidgetListener, repaint, repaint, requestSync, resetBitmap, resizeTo, resolveFont, resolvePopupMenuId, resolveTitleFont, screen, screenDimension, screenHeight, screenLocation, screenPhysicalLocation, screenWidth, setBitmap, setCachedScreenLocation, setCachedScreenPhysicalLocation, setDirectManipulationActive, setEnabled, setHighlighted, setLocation, setLocation, setMousePointer, setMousePointer, setParent, setPhysicalLocation, setSensitiveForUIB, setState, setWindow, show, showPopupMenu, supportsCustomMousePointer, sync, topLevelWindow, toString, translate, triggerLocationChanged, unregisterWidgetListener, updateSystemParent, widgetRealized, windowclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetChangedValueacceptsEscAsAnyKey, acceptTrigger, addFocusListener, addKeyListener, ancestor, ancestorId, bounds, clearWidget, completeTrigger, defaultMousePtr, dimension, displayPhysicalLocation, drawCaret, enclosingFrame, enforceDefaultMousePtr, findMouseSource, forceCursorOnFocus, forceVisibility, getActualBounds, getCustomMousePointer, getEffectiveMousePointer, getId, getIdForTrigger, getLegacyWidget, getLoadedMousePointer, getMenuMouse, getMouseActions, getMousePosition, getSelectedText, getState, getTriggerWidget, getTriggerWidget, getZOrderClass, hasFocus, hasFocus, hasTooltip, height, hidden, hide, highlighted, ignoreEnable, initialHeight, initialWidth, insets, isCurrent, isCurrent, isDirectManipulable, isDirectManipulationActive, isDirectManipulationActiveOrInUIB, isDisplayed, isDroppable, isEnabled, isFocusable, isHeader, isInitialValueLayout, isLegacyFocus, isProcessProgressEvent, isRealized, isRepaintDisabled, isRMBEntrySupported, isTabStop, isThreeD, isTotallyObscured, isVisible, isVisible, location, maySwitchFocus, minimumSize, moveToBottom, moveToTop, name, navigable, oleDrag, parent, parent, parent, parentObject, parentOrSelf, parentOrSelfObject, physicalBounds, physicalDimension, physicalLocation, preventFocusWhenMouseDownEventDefined, processDirectManipulationEvent, processEvent, processFocusEvent, processKeyListeners, processMnemonic, raiseLegacyMouseEvents, refreshWidget, registerWidgetListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocus, requestSync, resizeTo, resolvePopupMenuId, screen, screenLocation, screenPhysicalLocation, setDirectManipulationActive, setEnabled, setHighlighted, setLocation, setLocation, setMousePointer, setMousePointer, setParent, setPhysicalLocation, setSensitiveForUIB, setState, setWindow, show, startTrigger, supportsCustomMousePointer, systemFocusGrabbed, topLevelWindow, unrealize, unregisterWidgetListener, validateDisplayValue, widgetStateChanged, width, windowmouseClicked, mouseEntered, mouseExited, mousePressed, mouseReleasedcreateMnemonic, getMnemonicCharacter, getMnemonicKeyCode, getMnemonicLabel, isMnemonicSupported, updateMnemonicwidgetsAsListprotected int current
protected java.util.ArrayList<RadioButton<O extends OutputManager<?>>> buttons
public RadioSet(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>id - The widget's ID.cfg - The config used to initialize this widget.public void processKeyEvent(KeyInput keyEvent)
processKeyEvent in interface Widget<O extends OutputManager<?>>processKeyEvent in class AbstractContainer<O extends OutputManager<?>>keyEvent - The key event to be processed.public BaseDataType getValue()
getValue in interface DataContainerpublic java.lang.String getText()
getText in interface DataContainerpublic void setValue(BaseDataType value)
setValue in interface DataContainervalue - The BaseDataType value of the button to be selected inside
the button group.public void reset()
public boolean focusTraversable()
focusTraversable in interface Widget<O extends OutputManager<?>>focusTraversable in class AbstractContainer<O extends OutputManager<?>>true if widget can be traversed.public Widget<O> defaultFocus()
If at least one button is focusable, then return this radio-set (not individual button).
defaultFocus in interface Container<O extends OutputManager<?>>defaultFocus in class AbstractContainer<O extends OutputManager<?>>public Widget<O> currentFocus()
currentFocus in interface Container<O extends OutputManager<?>>currentFocus in class AbstractContainer<O extends OutputManager<?>>public boolean isModified()
isModified in interface DataContainertrue if the widget value was modified,
false otherwise.public void setWidthChars(double newWidth)
newWidth - The new width of the radio-button.public double getCharWidth()
public void draw()
draw in interface Widget<O extends OutputManager<?>>draw in class AbstractContainer<O extends OutputManager<?>>public void onFocusGained(FocusEvent focusEvent)
onFocusGained in interface FocusListenerfocusEvent - The focus event to be processed.public void onFocusLost(FocusEvent focusEvent)
onFocusLost in interface FocusListenerfocusEvent - The focus event to be processed.public void refreshItems()
refreshItems in interface ControlSetComponentpublic int[] getSelection()
getSelection in interface ControlSetComponentpublic int getIndex(RadioButton<O> rb)
rb - Radio button.public void setInitial()
public RadioButton<O> getSelected()
public Rectangle getVisiblePart()
getVisiblePart in interface Widget<O extends OutputManager<?>>getVisiblePart in class AbstractWidget<O extends OutputManager<?>>public boolean manageSystemActions()
manageSystemActions in class AbstractWidget<O extends OutputManager<?>>true as the widget has its own event management.public void afterConfigUpdate(RadioSetConfig beforeUpdate)
afterConfigUpdate in interface ConfigOwner<RadioSetConfig>afterConfigUpdate in class LabeledPanel<O extends OutputManager<?>,RadioSetConfig>beforeUpdate - Original configuration state.public void reflectAncestorChange()
AbstractWidget.ancestorCache and AbstractWidget.window) for itself and the entire widget tree starting
from this container.reflectAncestorChange in class AbstractContainer<O extends OutputManager<?>>public boolean canMovetoTop()
canMovetoTop in interface Widget<O extends OutputManager<?>>true.protected void refreshItemsImpl(int selectedId,
boolean selectedDisabled)
selectedId - The selected button ID; -1 if none selected.selectedDisabled - Flag indicating if the selected button is disabled.protected void selectButton(RadioButton<O> button)
button - Button to select.protected double getButtonsExpandWidth(ControlSetItem[] items)
items - Radio-button set to check.protected double getButtonsExtraDistance()
protected double getListWidthChars()
protected double getListHeightChars()
protected void adjustCurrentButton()