Class ButtonGroup

java.lang.Object
com.kheops.ui.component.ButtonGroup

public class ButtonGroup extends Object

This class is used to create a multiple-exclusion scope for a set of buttons. Creating a set of buttons with the same ButtonGroup object means that turning "on" one of those buttons turns off all other buttons in the group.

Initially, all buttons in the group are unselected. Once any button is selected, one button is always selected in the group. There is no way to turn a button programmatically to "off", in order to clear the button group.

  • Constructor Details

    • ButtonGroup

      public ButtonGroup()
      Creates a new ButtonGroup.
  • Method Details

    • addButtonSelectionChangedListener

      public void addButtonSelectionChangedListener(ButtonSelectionChangedListener listener)
      Adds a listener for this group.
      Parameters:
      listener -
    • add

      public void add(Button button)
      Adds the button to the group.
      Parameters:
      button - the button to be added
    • removeAll

      public void removeAll()
      Removes all buttons from the group.
    • remove

      public void remove(Button button)
      Removes the button from the group.
      Parameters:
      button - the button to be removed
    • buttonSelected

      public void buttonSelected(Button button)
      Sets/unsets the selected value for the Button. Only one button in the group may be selected at a time.
      Parameters:
      button - the Button
    • buttonSelected

      public void buttonSelected(Button button, boolean fireActionEvent)
      Sets/unsets the selected value for the Button. Only one button in the group may be selected at a time.
      Parameters:
      button - the Button
      fireActionEvent - do we fire the ActionEvent associated with this button
    • getSelection

      public Button getSelection()
      Returns the selected button; null if none.
      Returns:
      selected button