public abstract class RadioButton<O extends OutputManager<?>> extends AbstractContainer<O> implements DataContainer, WidgetWithConfig<RadioSetConfig>, MnemonicTrait<O>
Widget.ZOrderClass
Modifier and Type | Field and Description |
---|---|
protected boolean |
autoResize
Automatic size change enabling flag.
|
protected RadioSetConfig |
config
Reference to config.
|
protected boolean |
focused
Pseudo-focus flag.
|
private int |
itemId
button id
|
private MnemonicInfo |
mnemonic
Mnemonic information
|
private boolean |
selected
Selection flag.
|
private java.lang.String |
text
Button text.
|
private BaseDataType |
value
The value to be returned as the RadioButton value.
|
protected double |
width
The width of the button.
|
location, mousePtr, nativeInsets, physicalLocation
Constructor and Description |
---|
RadioButton(RadioSetConfig config,
java.lang.String label,
BaseDataType value)
Use this constructor when you want to set both the label and the value.
|
Modifier and Type | Method and Description |
---|---|
void |
afterConfigUpdate(RadioSetConfig beforeUpdate)
The method is called after the configuration associated with
the implementor changes.
|
RadioSetConfig |
config()
Provide access to the attributes stored in the widget.
|
abstract void |
draw()
Called by this RadioButton's parent container.
|
abstract void |
drawCaret()
Draw cursor at the correct position.
|
int |
getItemId()
Get button id.
|
MnemonicInfo |
getMnemonic()
MnemonicInfo instance getter.
|
java.lang.String |
getText()
Get label text.
|
BaseDataType |
getValue()
Returns the BaseDataType instance representing the current value.
|
boolean |
hasFocusable(Widget<O> exclude)
Reports if this widget is focusable.
|
double |
height()
Return height of the radio button.
|
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 |
isFocused()
Get current state of pseudo-focus flag.
|
boolean |
isModified()
Getting the modification state of the widget.
|
boolean |
isSelected()
Get current selection state.
|
Point |
location()
Get widget location relative to container.
|
NativePoint |
physicalLocation()
Get widget physical location relative to container, expressed in units native to UI type.
|
void |
processEvent(Event evt)
Main event processing entry point.
|
void |
replace(RadioButton<O> newButton)
Replace this radio-button with the new one.
|
void |
setFocused(boolean focused)
Set pseudo-focus flag.
|
void |
setItemId(int id)
Set button id.
|
void |
setLocation(double x,
double y)
Set widget relative location.
|
void |
setMnemonic(MnemonicInfo mnemonic)
MnemonicInfo instance setter.
|
void |
setPhysicalLocation(int x,
int y)
Set widget relative physical location.
|
void |
setSelected(boolean state)
Sets the state of the button.
|
(package private) void |
setText(java.lang.String text)
Set label text.
|
void |
setValue(BaseDataType value)
Sets the BaseDataType instance representing the current value.
|
void |
setWidthChars(double newWidth)
Set up the width of the button dynamically.
|
double |
width()
Return the width of the radio button.
|
add, add, add, addDirectly, belongsTo, checkWidget, childrenLocation, clipping, clipRectangle, currentFocus, currentFocus, cycleFocus, defaultFocus, destroy, detach, dimension, doLayout, endSizeChange, findMouseSource, firstFocus, focus, focusTraversable, focusWorker, get, getClipRect, getEffectiveScrollableSize, getFocusInt, getIgnoreFocus, getLayout, getScrollableSize, getWidgetsList, insets, lastFocus, minimumSize, moveAfterTabItem, moveBeforeTabItem, moveToBottom, moveToBottomInClass, moveToTop, moveToTopInClass, moveToZpos, nextFocus, normalizeZOrder, prepareWidgets, prevFocus, processKeyEvent, 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, enable, enclosingFrame, forceCursorOnFocus, forceVisibility, getActualBounds, getAndResetBitmap, getAndSetBitmap, getBitmapCopy, getCustomMousePointer, getDefaultEvent, getEffectiveMousePointer, getId, getLoadedMousePointer, getMenuMouse, getMouseActions, getPortableMouseEventCoordinates, getSelectedText, getState, getTextHeight, getTextHeightNative, getTextWidth, getTextWidthNative, getVisiblePart, getZOrderClass, hasFocus, hidden, hide, highlighted, ignoreAction, isDirectManipulationCapable, isDirectManipulationRequired, isDisplayed, isEnabled, isFocusable, isHeader, isRealized, isRMBEntrySupported, isTabStop, isThreeD, isTotallyObscured, isVisible, manageSystemActions, mouseActions, mouseClicked, mouseDragged, mouseEntered, mouseExited, mouseMoved, mousePressed, mouseReleased, mouseWheelMoved, moveToBottom, moveToTop, name, navigable, parent, parent, parentOrSelf, physicalBounds, physicalDimension, postprocessConfig, prepParentLocation, processDirectManipulationEvent, processFocusEvent, processKeyListeners, processMnemonic, processMnemonicImpl, processSystemKey, raiseLegacyMouseEvents, refresh, registerWidgetStateListener, repaint, requestSync, resetBitmap, resizeTo, resolveFont, resolveTitleFont, screen, screenDimension, screenHeight, screenLocation, screenPhysicalLocation, screenWidth, setBitmap, setEnabled, setHidden, setHighlighted, setLocation, setMousePointer, setParent, setState, setVisible, show, supportsCustomMousePointer, sync, topLevelWindow, toString, translate, window
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
createMnemonic, getColumnMnemonic, getMnemonicCharacter, getMnemonicKeyCode, getMnemonicLabel, isMnemonicSupported, setColumnMnemonic, updateMnemonic
addFocusListener, addKeyListener, ancestor, ancestorId, bounds, clearWidget, defaultMousePtr, displayPhysicalLocation, enclosingFrame, enforceDefaultMousePtr, forceCursorOnFocus, forceVisibility, getActualBounds, getCustomMousePointer, getEffectiveMousePointer, getId, getLegacyWidget, getLoadedMousePointer, getMenuMouse, getMouseActions, getSelectedText, getState, getVisiblePart, getZOrderClass, hasFocus, hidden, hide, highlighted, isDirectManipulable, isDisplayed, isEnabled, isFocusable, isHeader, isRealized, isRMBEntrySupported, isTabStop, isThreeD, isTotallyObscured, isVisible, moveToBottom, moveToTop, name, navigable, parent, parent, parentOrSelf, physicalBounds, physicalDimension, postprocessConfig, processDirectManipulationEvent, processFocusEvent, processKeyListeners, processMnemonic, raiseLegacyMouseEvents, repaint, requestSync, resizeTo, screen, screenLocation, screenPhysicalLocation, setEnabled, setHidden, setHighlighted, setLocation, setMousePointer, setParent, setState, setVisible, show, supportsCustomMousePointer, topLevelWindow, window
private BaseDataType value
protected double width
protected boolean autoResize
private java.lang.String text
private boolean selected
protected boolean focused
private int itemId
protected RadioSetConfig config
private MnemonicInfo mnemonic
public RadioButton(RadioSetConfig config, java.lang.String label, BaseDataType value)
config
- Reference to config.label
- The button's label which can clarify the button purpose.value
- The data which is the button's value.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 RadioSetConfig config()
config
in interface Widget<O extends OutputManager<?>>
config
in interface ConfigOwner<RadioSetConfig>
config
in class AbstractWidget<O extends OutputManager<?>>
public void afterConfigUpdate(RadioSetConfig beforeUpdate)
afterConfigUpdate
in interface ConfigOwner<RadioSetConfig>
beforeUpdate
- public java.lang.String getText()
getText
in interface DataContainer
void setText(java.lang.String text)
text
- Label text.public BaseDataType getValue()
getValue
in interface DataContainer
public boolean isModified()
isModified
in interface DataContainer
false
and is never called.public void setValue(BaseDataType value)
setValue
in interface DataContainer
value
- The value representing the current widget value.public void replace(RadioButton<O> newButton)
newButton
- The new radio button to be used instead of the current one.public Point location()
location
in interface Widget<O extends OutputManager<?>>
location
in class AbstractWidget<O extends OutputManager<?>>
public NativePoint physicalLocation()
physicalLocation
in interface Widget<O extends OutputManager<?>>
physicalLocation
in class AbstractWidget<O extends OutputManager<?>>
public void setLocation(double x, double y)
setLocation
in interface Widget<O extends OutputManager<?>>
setLocation
in class AbstractWidget<O extends OutputManager<?>>
x
- Widget X.y
- Widget Y.public void setPhysicalLocation(int x, int y)
setPhysicalLocation
in interface Widget<O extends OutputManager<?>>
setPhysicalLocation
in class AbstractWidget<O extends OutputManager<?>>
x
- Widget physical X.y
- Widget physical Y.public double width()
width
in interface Widget<O extends OutputManager<?>>
width
in class AbstractContainer<O extends OutputManager<?>>
public double height()
height
in interface Widget<O extends OutputManager<?>>
height
in class AbstractContainer<O extends OutputManager<?>>
public void setWidthChars(double newWidth)
newWidth
- The new button width in the character units.public abstract void draw()
draw
in interface Widget<O extends OutputManager<?>>
draw
in class AbstractContainer<O extends OutputManager<?>>
public abstract void drawCaret()
drawCaret
in interface Widget<O extends OutputManager<?>>
drawCaret
in class AbstractWidget<O extends OutputManager<?>>
Widget.drawCaret()
public boolean isFocused()
public void setFocused(boolean focused)
focused
- New state of the flag.public boolean hasFocusable(Widget<O> exclude)
hasFocusable
in interface Container<O extends OutputManager<?>>
hasFocusable
in class AbstractContainer<O extends OutputManager<?>>
exclude
- A widget to ignore or null
if any focusable widget will do.true
if this widget is not the excluded widget.public void setSelected(boolean state)
state
- New state of the button.public boolean isSelected()
true
if button is selected.public void processEvent(Event evt)
processEvent
in interface Widget<O extends OutputManager<?>>
processEvent
in class AbstractWidget<O extends OutputManager<?>>
evt
- Event to handle.public int getItemId()
public void setItemId(int id)
id
- New button id.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<?>>