public class BooleanRadioButtonHandler extends AbstractRadioButtonHandler<Boolean>
A specialized ComponentHandler
implementation for a radio button
group with only two elements.
This handler implementation is used for the radio button group which defines the sort direction. It can be either ascending or descending. For demonstration purposes we map these values to a boolean flag (true means descending, false means ascending). It would also be possible to use an enumeration type instead. This class mainly demonstrates how a custom component handler for radio buttons can be created.
Constructor and Description |
---|
BooleanRadioButtonHandler()
Creates a new instance of
BooleanRadioButtonHandler |
Modifier and Type | Method and Description |
---|---|
protected int |
getButtonIndex(Boolean value)
Returns the index of the button with the specified value.
|
protected Boolean |
getDataForButton(int idx)
Returns the value of the radio button with the specified index.
|
getData, getUnselectedData, getUnselectedIndex, setData
addHandler, getChildHandler, getChildHandlerCount, getChildHandlerIndex, getChildHandlerNameAt, getChildHandlerNames, getChildHandlers, getComponent, getOuterComponent, getType, isEnabled, setEnabled
public BooleanRadioButtonHandler()
BooleanRadioButtonHandler
protected int getButtonIndex(Boolean value)
getButtonIndex
in class AbstractRadioButtonHandler<Boolean>
value
- the data value of the radio groupprotected Boolean getDataForButton(int idx)
getDataForButton
in class AbstractRadioButtonHandler<Boolean>
idx
- the index of the selected radio buttonCopyright © 2016 The JGUIraffe Team. All rights reserved.