com.pietschy.command.toggle
Class ToggleGroupController

java.lang.Object
  extended by com.pietschy.command.toggle.ToggleGroupController

public class ToggleGroupController
extends java.lang.Object

Controls the selection of ToggleCommands within a ToggleGroup. It support both exclusive and non-exclusive selection.


Constructor Summary
ToggleGroupController()
          Creates a new instance.
 
Method Summary
 void add(ToggleCommand command)
          Adds the specified command to the controller.
 void handleSelectionRequest(ToggleCommand toggleCommand, boolean selected)
          Handles a particular selection request on a particular command.
 boolean isEmptySelectionAllowed()
          Checks if this groups allows empty selection.
 boolean isExclusive()
          Checks if this group is exclusive.
 void remove(ToggleCommand command)
          Removes the specified command from the controller.
 void setEmptySelectionAllowed(boolean emptySelectionAllowed)
          Sets if this groups allows empty selection.
 void setExclusive(boolean exclusive)
          Configures the exclusive state of the group.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ToggleGroupController

public ToggleGroupController()
Creates a new instance.

Method Detail

add

public void add(ToggleCommand command)
Adds the specified command to the controller.

Parameters:
command - the command to add.

remove

public void remove(ToggleCommand command)
Removes the specified command from the controller.

Parameters:
command -

isEmptySelectionAllowed

public boolean isEmptySelectionAllowed()
Checks if this groups allows empty selection.

Returns:
true if the group allows empty selection, false if there must always be at least on selected command.

setEmptySelectionAllowed

public void setEmptySelectionAllowed(boolean emptySelectionAllowed)
Sets if this groups allows empty selection.

Parameters:
emptySelectionAllowed - true if the group should allow empty selection, false if there must always be at least on selected command.

isExclusive

public boolean isExclusive()
Checks if this group is exclusive.

Returns:
true if the group is exclusive, false otherwise.

setExclusive

public void setExclusive(boolean exclusive)
Configures the exclusive state of the group.

Parameters:
exclusive - true to only allow exclusive selection, false otherwise.

handleSelectionRequest

public void handleSelectionRequest(ToggleCommand toggleCommand,
                                   boolean selected)
Handles a particular selection request on a particular command.

Parameters:
toggleCommand - the command that has been selected
selected - the new state of the command.


Copyright © 2006 - 2007 Andrew Pietsch