org.springframework.richclient.command
Class ToggleCommand

java.lang.Object
  extended by org.springframework.binding.value.support.AbstractPropertyChangePublisher
      extended by org.springframework.richclient.command.AbstractCommand
          extended by org.springframework.richclient.command.ActionCommand
              extended by org.springframework.richclient.command.ToggleCommand
All Implemented Interfaces:
BeanNameAware, InitializingBean, PropertyChangePublisher, ActionCommandExecutor, GuardedActionCommandExecutor, ParameterizableActionCommandExecutor, Authorizable, Guarded, SecurityControllable
Direct Known Subclasses:
AbstractReporterForm.StateSynchronizingToggleCommand

public abstract class ToggleCommand
extends ActionCommand


Field Summary
static String SELECTED_PROPERTY
           
 
Fields inherited from class org.springframework.richclient.command.ActionCommand
ACTION_COMMAND_PARAMETER_KEY, ACTION_COMMAND_PROPERTY, ACTION_EVENT_PARAMETER_KEY, MODIFIERS_PARAMETER_KEY
 
Fields inherited from class org.springframework.richclient.command.AbstractCommand
ENABLED_PROPERTY_NAME, VISIBLE_PROPERTY_NAME
 
Fields inherited from class org.springframework.binding.value.support.AbstractPropertyChangePublisher
logger
 
Fields inherited from interface org.springframework.richclient.core.Authorizable
AUTHORIZED_PROPERTY
 
Constructor Summary
ToggleCommand()
           
ToggleCommand(String commandId)
           
ToggleCommand(String id, CommandFaceDescriptor face)
           
ToggleCommand(String id, String encodedLabel)
           
ToggleCommand(String id, String encodedLabel, Icon icon, String caption)
           
 
Method Summary
 AbstractButton createButton(String faceDescriptorId, ButtonFactory buttonFactory, CommandButtonConfigurer configurer)
          Creates a button using the provided id, factory and configurer.
 AbstractButton createCheckBox()
           
 AbstractButton createCheckBox(ButtonFactory buttonFactory)
           
 AbstractButton createCheckBox(String faceDescriptorId, ButtonFactory buttonFactory)
           
 AbstractButton createCheckBox(String faceDescriptorId, ButtonFactory buttonFactory, CommandButtonConfigurer configurer)
           
 JMenuItem createMenuItem(String faceDescriptorId, MenuFactory factory, CommandButtonConfigurer buttonConfigurer)
          Create a menuItem using the provided id, factory and configurer.
 AbstractButton createRadioButton()
           
 AbstractButton createRadioButton(ButtonFactory buttonFactory)
           
 AbstractButton createRadioButton(String faceDescriptorId, ButtonFactory buttonFactory)
           
 AbstractButton createRadioButton(String faceDescriptorId, ButtonFactory buttonFactory, CommandButtonConfigurer configurer)
           
protected  void doExecuteCommand()
          Executing a toggleCommand will flip its select state.
 boolean isExclusiveGroupMember()
           
 boolean isSelected()
          Returns true if the command is selected.
protected  void onButtonAttached(AbstractButton button)
          Additional code to execute when attaching a button.
protected  void onDeselection()
          Convenience hook method for processing a deselection action.
protected  void onSelection()
          Convenience hook method for processing a selection action.
protected  boolean onSelection(boolean selected)
          Hook method to perform the toggle action.
 void requestDefaultIn(RootPaneContainer container)
           
protected  boolean requestSetSelection(boolean selected)
          Handles the switching of the selected state.
 void setExclusiveController(ExclusiveCommandGroupSelectionController exclusiveController)
           
 void setSelected(boolean selected)
          Set the selection state of the command.
 
Methods inherited from class org.springframework.richclient.command.ActionCommand
addCommandInterceptor, addParameter, execute, execute, getActionAdapter, getActionCommand, getModifiers, getParameter, getParameter, getParameters, isDisplaysInputDialog, onPostExecute, onPreExecute, removeCommandInterceptor, setActionCommand, setDefaultButton, setDefaultButtonIn, setDisplaysInputDialog
 
Methods inherited from class org.springframework.richclient.command.AbstractCommand
addEnabledListener, afterPropertiesSet, attach, attach, attach, buttonIterator, createButton, createButton, createButton, createButton, createButton, createMenuItem, createMenuItem, createMenuItem, createMenuItem, createMenuItem, defaultButtonIterator, detach, getAccelerator, getButtonFactory, getButtonIn, getCommandServices, getComponentFactory, getDefaultButtonConfigurer, getDefaultFaceDescriptorId, getFaceDescriptor, getFaceDescriptorRegistry, getIcon, getId, getMenuFactory, getMenuItemButtonConfigurer, getMnemonic, getMnemonicIndex, getSecurityControllerId, getText, getToolBarButtonConfigurer, getToolBarButtonFactory, isAnonymous, isAttached, isAuthorized, isEnabled, isFaceConfigured, isVisible, onButtonDetached, removeEnabledListener, requestFocusIn, setAuthorized, setBeanName, setCaption, setCommandServices, setDefaultFaceDescriptorId, setEnabled, setFaceDescriptor, setFaceDescriptor, setFaceDescriptorRegistry, setFaceDescriptors, setIcon, setIconInfo, setId, setLabel, setLabel, setSecurityControllerId, setVisible, toString, updatedEnabledState, updatedVisibleState
 
Methods inherited from class org.springframework.binding.value.support.AbstractPropertyChangePublisher
addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, addVetoableChangeListener, firePropertiesChanged, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, fireVetoableChange, fireVetoableChange, fireVetoableChange, fireVetoableChange, fireVetoableChange, getPropertyChangeListeners, getPropertyChangeListeners, getVetoableChangeListeners, getVetoableChangeListeners, hasChanged, hasChanged, hasChanged, hasChanged, hasChanged, hasChanged, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, removeVetoableChangeListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

SELECTED_PROPERTY

public static final String SELECTED_PROPERTY
See Also:
Constant Field Values
Constructor Detail

ToggleCommand

public ToggleCommand()

ToggleCommand

public ToggleCommand(String commandId)

ToggleCommand

public ToggleCommand(String id,
                     CommandFaceDescriptor face)

ToggleCommand

public ToggleCommand(String id,
                     String encodedLabel)

ToggleCommand

public ToggleCommand(String id,
                     String encodedLabel,
                     Icon icon,
                     String caption)
Method Detail

setExclusiveController

public void setExclusiveController(ExclusiveCommandGroupSelectionController exclusiveController)

isExclusiveGroupMember

public boolean isExclusiveGroupMember()

createMenuItem

public JMenuItem createMenuItem(String faceDescriptorId,
                                MenuFactory factory,
                                CommandButtonConfigurer buttonConfigurer)
Description copied from class: AbstractCommand
Create a menuItem using the provided id, factory and configurer.

Overrides:
createMenuItem in class AbstractCommand
Parameters:
faceDescriptorId - id of the faceDescriptor used to configure the button.
factory - factory that delivers the menuItem.
buttonConfigurer - configurer mapping the faceDescriptor on the button.
Returns:
a menuItem attached to this command.

createButton

public AbstractButton createButton(String faceDescriptorId,
                                   ButtonFactory buttonFactory,
                                   CommandButtonConfigurer configurer)
Description copied from class: AbstractCommand
Creates a button using the provided id, factory and configurer.

Overrides:
createButton in class AbstractCommand
Parameters:
faceDescriptorId - id of the faceDescriptor used to configure the button.
buttonFactory - factory that delivers the button.
configurer - configurer mapping the faceDescriptor on the button.
Returns:
a button attached to this command.

createCheckBox

public final AbstractButton createCheckBox()

createCheckBox

public final AbstractButton createCheckBox(ButtonFactory buttonFactory)

createCheckBox

public final AbstractButton createCheckBox(String faceDescriptorId,
                                           ButtonFactory buttonFactory)

createCheckBox

public AbstractButton createCheckBox(String faceDescriptorId,
                                     ButtonFactory buttonFactory,
                                     CommandButtonConfigurer configurer)

createRadioButton

public final AbstractButton createRadioButton()

createRadioButton

public final AbstractButton createRadioButton(ButtonFactory buttonFactory)

createRadioButton

public final AbstractButton createRadioButton(String faceDescriptorId,
                                              ButtonFactory buttonFactory)

createRadioButton

public AbstractButton createRadioButton(String faceDescriptorId,
                                        ButtonFactory buttonFactory,
                                        CommandButtonConfigurer configurer)

onButtonAttached

protected void onButtonAttached(AbstractButton button)
Additional code to execute when attaching a button.

Overrides:
onButtonAttached in class ActionCommand
Parameters:
button - the button that has been attached.

isSelected

public final boolean isSelected()
Returns true if the command is selected.


setSelected

public final void setSelected(boolean selected)
Set the selection state of the command.


requestSetSelection

protected boolean requestSetSelection(boolean selected)
Handles the switching of the selected state. All attached buttons are updated.

Parameters:
selected - select state to set.
Returns:
the select state afterwards.

doExecuteCommand

protected final void doExecuteCommand()
Executing a toggleCommand will flip its select state.

Specified by:
doExecuteCommand in class ActionCommand

onSelection

protected boolean onSelection(boolean selected)
Hook method to perform the toggle action. Subclasses may override.

The toggle selection request can be vetoed by returning a boolean result (for example if onSelected is handed 'true', signaling the toggle command was activated, a subclass can veto that by returning false.)

Parameters:
selected - The newly requested selection state of this toggle command
Returns:
the value of selected, if allowed, !selection if vetoed.

onSelection

protected void onSelection()
Convenience hook method for processing a selection action.


onDeselection

protected void onDeselection()
Convenience hook method for processing a deselection action.


requestDefaultIn

public void requestDefaultIn(RootPaneContainer container)


Copyright © 2004-2008 The Spring Framework. All Rights Reserved.