Klasse BooleanRadioButtonHandler
java.lang.Object
net.sf.jguiraffe.gui.builder.components.AbstractCompositeComponentHandler<Boolean,Boolean>
net.sf.jguiraffe.gui.builder.components.model.AbstractRadioButtonHandler<Boolean>
net.sf.jguiraffe.examples.tutorial.viewset.BooleanRadioButtonHandler
- Alle implementierten Schnittstellen:
CompositeComponentHandler<Boolean,
,Boolean> ComponentHandler<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.
- Version:
- $Id: BooleanRadioButtonHandler.java 205 2012-01-29 18:29:57Z oheger $
- Autor:
- Oliver Heger
-
Konstruktorübersicht
KonstruktorenKonstruktorBeschreibungCreates a new instance ofBooleanRadioButtonHandler
-
Methodenübersicht
Modifizierer und TypMethodeBeschreibungprotected 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.Von Klasse geerbte Methoden net.sf.jguiraffe.gui.builder.components.model.AbstractRadioButtonHandler
getData, getUnselectedData, getUnselectedIndex, setData
Von Klasse geerbte Methoden net.sf.jguiraffe.gui.builder.components.AbstractCompositeComponentHandler
addHandler, getChildHandler, getChildHandlerCount, getChildHandlerIndex, getChildHandlerNameAt, getChildHandlerNames, getChildHandlers, getComponent, getOuterComponent, getType, isEnabled, setEnabled
-
Konstruktordetails
-
BooleanRadioButtonHandler
public BooleanRadioButtonHandler()Creates a new instance ofBooleanRadioButtonHandler
-
-
Methodendetails
-
getButtonIndex
Returns the index of the button with the specified value. This method maps data values of the radio group to specific radio buttons. Because in our example true represents the descending button we return the corresponding index.- Angegeben von:
getButtonIndex
in KlasseAbstractRadioButtonHandler<Boolean>
- Parameter:
value
- the data value of the radio group- Gibt zurück:
- the index of the selected radio button
-
getDataForButton
Returns the value of the radio button with the specified index. This method determines the data value for the whole radio group based on the selected radio button. Here we return true if and only if the descending radio button is selected.- Angegeben von:
getDataForButton
in KlasseAbstractRadioButtonHandler<Boolean>
- Parameter:
idx
- the index of the selected radio button- Gibt zurück:
- the corresponding value for the whole radio group
-