Klasse BooleanRadioButtonHandler

Alle implementierten Schnittstellen:
CompositeComponentHandler<Boolean,Boolean>, ComponentHandler<Boolean>

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.

Version:
$Id: BooleanRadioButtonHandler.java 205 2012-01-29 18:29:57Z oheger $
Autor:
Oliver Heger
  • Konstruktordetails

    • BooleanRadioButtonHandler

      public BooleanRadioButtonHandler()
      Creates a new instance of BooleanRadioButtonHandler
  • Methodendetails

    • getButtonIndex

      protected int getButtonIndex(Boolean value)
      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 Klasse AbstractRadioButtonHandler<Boolean>
      Parameter:
      value - the data value of the radio group
      Gibt zurück:
      the index of the selected radio button
    • getDataForButton

      protected Boolean getDataForButton(int idx)
      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 Klasse AbstractRadioButtonHandler<Boolean>
      Parameter:
      idx - the index of the selected radio button
      Gibt zurück:
      the corresponding value for the whole radio group