public class DefaultRadioButtonHandler extends AbstractRadioButtonHandler<Integer>
A concrete default implementation of a CompositeComponentHandler
for
a group of radio buttons.
An instance of this class is used as ComponentHandler
for a radio
button group if no specific handler class is specified. This implementation
just uses the index of the selected button in the group as data. So a Java
bean acting as model for a form that contains a radio button group should
have a corresponding property of type Integer
for this group. Note
that really Integer
should be used instead of int
because the
value can be set to null if no radio button in the group is selected.
Implementation note: This class is not thread-safe.
Constructor and Description |
---|
DefaultRadioButtonHandler()
Creates a new instance of
DefaultRadioButtonHandler . |
Modifier and Type | Method and Description |
---|---|
protected int |
getButtonIndex(Integer value)
Returns the index of the radio button in the associated group that
represents the passed in data value.
|
protected Integer |
getDataForButton(int idx)
Returns the data value that corresponds to the radio button with the
given index.
|
getData, getUnselectedData, getUnselectedIndex, setData
addHandler, getChildHandler, getChildHandlerCount, getChildHandlerIndex, getChildHandlerNameAt, getChildHandlerNames, getChildHandlers, getComponent, getOuterComponent, getType, isEnabled, setEnabled
public DefaultRadioButtonHandler()
DefaultRadioButtonHandler
.protected int getButtonIndex(Integer value)
getButtonIndex
in class AbstractRadioButtonHandler<Integer>
value
- the data valueprotected Integer getDataForButton(int idx)
getDataForButton
in class AbstractRadioButtonHandler<Integer>
idx
- the index of the selected radio buttonCopyright © 2016 The JGUIraffe Team. All rights reserved.