Package com.kheops.ui.component
Class ButtonGroup
java.lang.Object
com.kheops.ui.component.ButtonGroup
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 Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds the button to the group.void
Adds a listener for this group.void
buttonSelected
(Button button) Sets/unsets the selected value for theButton
.void
buttonSelected
(Button button, boolean fireActionEvent) Sets/unsets the selected value for theButton
.Returns the selected button;null
if none.void
Removes the button from the group.void
Removes all buttons from the group.
-
Constructor Details
-
ButtonGroup
public ButtonGroup()Creates a newButtonGroup
.
-
-
Method Details
-
addButtonSelectionChangedListener
Adds a listener for this group.- Parameters:
listener
-
-
add
Adds the button to the group.- Parameters:
button
- the button to be added
-
removeAll
public void removeAll()Removes all buttons from the group. -
remove
Removes the button from the group.- Parameters:
button
- the button to be removed
-
buttonSelected
Sets/unsets the selected value for theButton
. Only one button in the group may be selected at a time.- Parameters:
button
- theButton
-
buttonSelected
Sets/unsets the selected value for theButton
. Only one button in the group may be selected at a time.- Parameters:
button
- theButton
fireActionEvent
- do we fire the ActionEvent associated with this button
-
getSelection
Returns the selected button;null
if none.- Returns:
- selected button
-