Class CommandToggleButtonGroup
- java.lang.Object
-
- org.pushingpixels.flamingo.api.common.CommandToggleButtonGroup
-
- All Implemented Interfaces:
Serializable
public class CommandToggleButtonGroup extends Object implements Serializable
Group of command toggle buttons. Unlike theButtonGroup, this class operates on buttons and not on button models.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected booleanallowsClearingSelectionIffalse, the selection cannot be cleared.protected Vector<JCommandToggleButton>buttonsContains all group buttons.protected Map<JCommandToggleButton,ChangeListener>modelChangeListenersMap of registered model change listeners.static StringSELECTED_PROPERTYName of the property change event fired when the group selection is changed.protected JCommandToggleButtonselectionThe currently selected button.
-
Constructor Summary
Constructors Constructor Description CommandToggleButtonGroup()Creates a new button group.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(JCommandToggleButton b)Adds the specified button to the group.voidaddPropertyChangeListener(PropertyChangeListener listener)Adds the specified property change listener on this button group.voidclearSelection()Clears the selection of this button group.protected voidfirePropertyChange(String propertyName, Object oldValue, Object newValue)Fires a property change event on all registered listeners.JCommandToggleButtongetSelected()Returns the selected button of this group.booleanisAllowsClearingSelection()Returns the current value for clearing selection.voidremove(JCommandToggleButton b)Removes the specified button from the group.voidremovePropertyChangeListener(PropertyChangeListener listener)Removes the specified property change listener from this button group.voidsetAllowsClearingSelection(boolean allowsClearingSelection)Sets the new value for clearing selection.voidsetSelected(JCommandToggleButton button, boolean isSelected)Changes the selected status of the specified button.
-
-
-
Field Detail
-
buttons
protected Vector<JCommandToggleButton> buttons
Contains all group buttons.
-
modelChangeListeners
protected Map<JCommandToggleButton,ChangeListener> modelChangeListeners
Map of registered model change listeners.
-
SELECTED_PROPERTY
public static final String SELECTED_PROPERTY
Name of the property change event fired when the group selection is changed.- See Also:
- Constant Field Values
-
selection
protected JCommandToggleButton selection
The currently selected button. Can benull.
-
allowsClearingSelection
protected boolean allowsClearingSelection
Iffalse, the selection cannot be cleared. By default the button group allows clearing the selection inclearSelection()orsetSelected(JCommandToggleButton, boolean)(passing the currently selected button andfalse).
-
-
Method Detail
-
setAllowsClearingSelection
public void setAllowsClearingSelection(boolean allowsClearingSelection)
Sets the new value for clearing selection. Iftrueis passed, the selection can be cleared inclearSelection()orsetSelected(JCommandToggleButton, boolean)(passing the currently selected button andfalse).- Parameters:
allowsClearingSelection- The new value for clearing selection.
-
isAllowsClearingSelection
public boolean isAllowsClearingSelection()
Returns the current value for clearing selection.trueis returned when selection can be cleared inclearSelection()orsetSelected(JCommandToggleButton, boolean)(passing the currently selected button andfalse).- Returns:
- The current value for clearing selection.
-
add
public void add(JCommandToggleButton b)
Adds the specified button to the group. If the button is selected, and the group has a selected button, the newly added button is marked as unselected.- Parameters:
b- The button to be added.
-
remove
public void remove(JCommandToggleButton b)
Removes the specified button from the group.- Parameters:
b- The button to be removed
-
setSelected
public void setSelected(JCommandToggleButton button, boolean isSelected)
Changes the selected status of the specified button.- Parameters:
button- Button.isSelected- Selection indication.
-
getSelected
public JCommandToggleButton getSelected()
Returns the selected button of this group.- Returns:
- The selected button of this group. The result can be
null.
-
clearSelection
public void clearSelection()
Clears the selection of this button group.
-
addPropertyChangeListener
public void addPropertyChangeListener(PropertyChangeListener listener)
Adds the specified property change listener on this button group.- Parameters:
listener- Listener to add.
-
removePropertyChangeListener
public void removePropertyChangeListener(PropertyChangeListener listener)
Removes the specified property change listener from this button group.- Parameters:
listener- Listener to remove.
-
-