Class CommandToggleGroupModel
java.lang.Object
org.pushingpixels.radiance.component.api.common.model.CommandToggleGroupModel
Group of toggle commands.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate booleanIffalse, the selection cannot be cleared.private Vector<BaseCommand> Contains all group commands.private Map<BaseCommand, ChangeListener> Map of registered model change listeners.private BaseCommandThe currently selected command. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(BaseCommand command) Adds the specified command to the group.voidClears the selection of this command toggle group model.Returns an unmodifiable collection with all the commands tracked by this model.Returns the selected command of this group model.booleanReturns the current value for clearing selection.voidremove(BaseCommand command) Removes the specified command from the group.voidvoidsetAllowsClearingSelection(boolean allowsClearingSelection) Sets the new value for clearing selection.voidsetSelected(BaseCommand command, boolean isSelected) Changes the selected status of the specified command.
-
Field Details
-
commands
Contains all group commands. -
modelChangeListeners
Map of registered model change listeners. -
selection
The currently selected command. Can benull. -
allowsClearingSelection
private boolean allowsClearingSelectionIffalse, the selection cannot be cleared. By default the command group allows clearing the selection inclearSelection()orsetSelected(BaseCommand, boolean)(passing the currently selected command andfalse).
-
-
Constructor Details
-
CommandToggleGroupModel
public CommandToggleGroupModel()Creates a new command group.
-
-
Method Details
-
getCommands
Returns an unmodifiable collection with all the commands tracked by this model.- Returns:
- An unmodifiable collection with all the commands tracked by this model.
-
setAllowsClearingSelection
public void setAllowsClearingSelection(boolean allowsClearingSelection) Sets the new value for clearing selection. Iftrueis passed, the selection can be cleared inclearSelection()orsetSelected(BaseCommand, boolean)(passing the currently selected command 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(BaseCommand, boolean)(passing the currently selected command andfalse).- Returns:
- The current value for clearing selection.
-
add
Adds the specified command to the group. If the command is selected, and the group has a selected command, the newly added command is marked as unselected.- Parameters:
command- The command to be added.
-
remove
Removes the specified command from the group.- Parameters:
command- The command to be removed
-
removeAll
public void removeAll() -
setSelected
Changes the selected status of the specified command.- Parameters:
command- command.isSelected- Selection indication.
-
getSelected
Returns the selected command of this group model.- Returns:
- The selected command of this group model. The result can be
null.
-
clearSelection
public void clearSelection()Clears the selection of this command toggle group model.
-