org.springframework.richclient.command.support
Class DefaultCommandManager

Show UML class diagram
java.lang.Object
  extended by org.springframework.richclient.command.support.DefaultCommandManager
All Implemented Interfaces:
BeanFactoryAware, BeanPostProcessor, CommandFactory, CommandManager, CommandRegistry, CommandServices, CommandConfigurer, CommandFaceDescriptorRegistry
Direct Known Subclasses:
ApplicationWindowCommandManager

public class DefaultCommandManager
extends Object
implements CommandManager, BeanPostProcessor, BeanFactoryAware

Author:
Keith Donald

Constructor Summary
DefaultCommandManager()
           
DefaultCommandManager(CommandRegistry parent)
           
DefaultCommandManager(CommandServices commandServices)
           
 
Method Summary
 void addCommandInterceptor(String commandId, ActionCommandInterceptor interceptor)
           
 void addCommandRegistryListener(CommandRegistryListener l)
          Adds the given listener to the colleciton of listeners that will be notified of registry events.
 AbstractCommand configure(AbstractCommand command)
          Configures the given command.
 boolean containsActionCommand(String commandId)
          Returns true if the registry contains a command of type ActionCommand with the given id.
 boolean containsCommand(String commandId)
          Returns true if the registry contains a command with the given identifier.
 boolean containsCommandGroup(String groupId)
          Returns true if the registry contains a command of type CommandGroup with the given id.
 CommandGroup createCommandGroup(String groupId, Object[] members)
           
 ExclusiveCommandGroup createExclusiveCommandGroup(String groupId, Object[] members)
           
 TargetableActionCommand createTargetableActionCommand(String commandId, ActionCommandExecutor delegate)
           
 ActionCommand getActionCommand(String commandId)
          Returns the ActionCommand that has the given id.
 ButtonFactory getButtonFactory()
           
 Object getCommand(String commandId)
          Retrieves from the registry the command with the given identifier.
 Object getCommand(String commandId, Class requiredType)
          Retrieves from the registry the command with the given identifier.
 CommandConfigurer getCommandConfigurer()
           
 CommandGroup getCommandGroup(String groupId)
          Returns the CommandGroup that has the given id.
 CommandServices getCommandServices()
           
 ComponentFactory getComponentFactory()
           
 CommandButtonConfigurer getDefaultButtonConfigurer()
           
 CommandFaceDescriptor getFaceDescriptor(AbstractCommand command, String faceDescriptorId)
           
 MenuFactory getMenuFactory()
           
 CommandButtonConfigurer getMenuItemButtonConfigurer()
           
 CommandButtonConfigurer getPullDownMenuButtonConfigurer()
           
 CommandButtonConfigurer getToolBarButtonConfigurer()
           
 ButtonFactory getToolBarButtonFactory()
           
 Class getType(String commandId)
          Returns the type of the command with the given identifier, if it is contained in the registry.
 boolean isTypeMatch(String commandId, Class targetType)
          Returns true if the command with the given identifier is assignable to the given type.
 Object postProcessAfterInitialization(Object bean, String beanName)
           
 Object postProcessBeforeInitialization(Object bean, String beanName)
           
 void registerCommand(AbstractCommand command)
          Registers the given command with the registry.
 void removeCommandInterceptor(String commandId, ActionCommandInterceptor interceptor)
           
 void removeCommandRegistryListener(CommandRegistryListener l)
          Remove the given listener from the collection of listeners that will be notified of registry events.
 void setBeanFactory(BeanFactory beanFactory)
           
 void setCommandConfigurer(CommandConfigurer commandConfigurer)
           
 void setCommandServices(CommandServices commandServices)
           
 void setParent(CommandRegistry parent)
           
 void setTargetableActionCommandExecutor(String commandId, ActionCommandExecutor executor)
          Sets a command executor for the command with the given id.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultCommandManager

public DefaultCommandManager()

DefaultCommandManager

public DefaultCommandManager(CommandRegistry parent)

DefaultCommandManager

public DefaultCommandManager(CommandServices commandServices)
Method Detail

setCommandServices

public void setCommandServices(CommandServices commandServices)

getCommandServices

public CommandServices getCommandServices()

setParent

public void setParent(CommandRegistry parent)

getCommandConfigurer

public CommandConfigurer getCommandConfigurer()

setCommandConfigurer

public void setCommandConfigurer(CommandConfigurer commandConfigurer)

setBeanFactory

public void setBeanFactory(BeanFactory beanFactory)
Specified by:
setBeanFactory in interface BeanFactoryAware

getComponentFactory

public ComponentFactory getComponentFactory()
Specified by:
getComponentFactory in interface CommandServices

getToolBarButtonFactory

public ButtonFactory getToolBarButtonFactory()
Specified by:
getToolBarButtonFactory in interface CommandServices

getButtonFactory

public ButtonFactory getButtonFactory()
Specified by:
getButtonFactory in interface CommandServices

getMenuFactory

public MenuFactory getMenuFactory()
Specified by:
getMenuFactory in interface CommandServices

getDefaultButtonConfigurer

public CommandButtonConfigurer getDefaultButtonConfigurer()
Specified by:
getDefaultButtonConfigurer in interface CommandServices

getToolBarButtonConfigurer

public CommandButtonConfigurer getToolBarButtonConfigurer()
Specified by:
getToolBarButtonConfigurer in interface CommandServices

getMenuItemButtonConfigurer

public CommandButtonConfigurer getMenuItemButtonConfigurer()
Specified by:
getMenuItemButtonConfigurer in interface CommandServices

getPullDownMenuButtonConfigurer

public CommandButtonConfigurer getPullDownMenuButtonConfigurer()
Specified by:
getPullDownMenuButtonConfigurer in interface CommandServices

getFaceDescriptor

public CommandFaceDescriptor getFaceDescriptor(AbstractCommand command,
                                               String faceDescriptorId)
Specified by:
getFaceDescriptor in interface CommandFaceDescriptorRegistry

getActionCommand

public ActionCommand getActionCommand(String commandId)
Description copied from interface: CommandRegistry
Returns the ActionCommand that has the given id.

Specified by:
getActionCommand in interface CommandRegistry
Parameters:
commandId - The id of the action command to be returned.
Returns:
The action command with the given id, or null if no such command exists in the registry.

getCommandGroup

public CommandGroup getCommandGroup(String groupId)
Description copied from interface: CommandRegistry
Returns the CommandGroup that has the given id.

Specified by:
getCommandGroup in interface CommandRegistry
Parameters:
groupId - The id of the command group to be returned.
Returns:
The command group with the given id, or null if no such command group exists in the registry.

containsCommandGroup

public boolean containsCommandGroup(String groupId)
Description copied from interface: CommandRegistry
Returns true if the registry contains a command of type CommandGroup with the given id.

Specified by:
containsCommandGroup in interface CommandRegistry
Parameters:
groupId - The id of the command group to be searched for.
Returns:
true if the registry contains the command and it is assignable to CommandGroup.

containsActionCommand

public boolean containsActionCommand(String commandId)
Description copied from interface: CommandRegistry
Returns true if the registry contains a command of type ActionCommand with the given id.

Specified by:
containsActionCommand in interface CommandRegistry
Parameters:
commandId - The id of the command to be searched for.
Returns:
true if the registry contains the command and it is assignable to ActionCommand.

addCommandInterceptor

public void addCommandInterceptor(String commandId,
                                  ActionCommandInterceptor interceptor)
Specified by:
addCommandInterceptor in interface CommandManager

removeCommandInterceptor

public void removeCommandInterceptor(String commandId,
                                     ActionCommandInterceptor interceptor)
Specified by:
removeCommandInterceptor in interface CommandManager

registerCommand

public void registerCommand(AbstractCommand command)
Description copied from interface: CommandRegistry
Registers the given command with the registry. Neither the command nor its id can be null. All registered listeners will be notified of the newly registered command via their CommandRegistryListener.commandRegistered(CommandRegistryEvent) method. If the given command is an instance of CommandGroup, its CommandGroup.setCommandRegistry(CommandRegistry) method must be called to set this instance as the registry for the command group.

Specified by:
registerCommand in interface CommandRegistry
Parameters:
command - The command to be registered. Must not be null.

setTargetableActionCommandExecutor

public void setTargetableActionCommandExecutor(String commandId,
                                               ActionCommandExecutor executor)
Description copied from interface: CommandRegistry
Sets a command executor for the command with the given id. The actual type of the command must be assignable to TargetableActionCommand.

Specified by:
setTargetableActionCommandExecutor in interface CommandRegistry
Parameters:
commandId - The id of the targetable command that will have its executor set. Must not be null.
executor - The command executor. May be null.

addCommandRegistryListener

public void addCommandRegistryListener(CommandRegistryListener l)
Description copied from interface: CommandRegistry
Adds the given listener to the colleciton of listeners that will be notified of registry events.

Specified by:
addCommandRegistryListener in interface CommandRegistry
Parameters:
l - The listener to be added. Must not be null.

removeCommandRegistryListener

public void removeCommandRegistryListener(CommandRegistryListener l)
Description copied from interface: CommandRegistry
Remove the given listener from the collection of listeners that will be notified of registry events.

Specified by:
removeCommandRegistryListener in interface CommandRegistry
Parameters:
l - The listener to be removed.

createTargetableActionCommand

public TargetableActionCommand createTargetableActionCommand(String commandId,
                                                             ActionCommandExecutor delegate)
Specified by:
createTargetableActionCommand in interface CommandFactory

createCommandGroup

public CommandGroup createCommandGroup(String groupId,
                                       Object[] members)
Specified by:
createCommandGroup in interface CommandFactory

createExclusiveCommandGroup

public ExclusiveCommandGroup createExclusiveCommandGroup(String groupId,
                                                         Object[] members)
Specified by:
createExclusiveCommandGroup in interface CommandFactory

configure

public AbstractCommand configure(AbstractCommand command)
Description copied from interface: CommandConfigurer
Configures the given command.

Specified by:
configure in interface CommandConfigurer
Parameters:
command - The command to be configured. Must not be null.
Returns:
The configured command.

postProcessAfterInitialization

public Object postProcessAfterInitialization(Object bean,
                                             String beanName)
                                      throws BeansException
Specified by:
postProcessAfterInitialization in interface BeanPostProcessor
Throws:
BeansException

postProcessBeforeInitialization

public Object postProcessBeforeInitialization(Object bean,
                                              String beanName)
                                       throws BeansException
Specified by:
postProcessBeforeInitialization in interface BeanPostProcessor
Throws:
BeansException

containsCommand

public boolean containsCommand(String commandId)
Returns true if the registry contains a command with the given identifier.

Specified by:
containsCommand in interface CommandRegistry
Parameters:
commandId - The ID of the command to search for.
Returns:
true if the registry contains the command, false otherwise.

getCommand

public Object getCommand(String commandId,
                         Class requiredType)
                  throws CommandNotOfRequiredTypeException
Retrieves from the registry the command with the given identifier. An exception is thrown if the retrieved command is not assignable to the required type.

Specified by:
getCommand in interface CommandRegistry
Parameters:
commandId - The identifier of the command to be retrieved. Must not be null.
requiredType - The required type of the command with the given id.
Returns:
The command with the given id if it exists in the registry and is of the required type.
Throws:
CommandNotOfRequiredTypeException - if the retrieved command is not assignable to the required type.

getCommand

public Object getCommand(String commandId)
Retrieves from the registry the command with the given identifier.

Specified by:
getCommand in interface CommandRegistry
Parameters:
commandId - The ID of the command to be retrieved.
Returns:
The command with the given ID, or null if no such command could be found.

getType

public Class getType(String commandId)
Returns the type of the command with the given identifier, if it is contained in the registry.

Specified by:
getType in interface CommandRegistry
Parameters:
commandId - The ID of the command whose type is to be returned. Must not be null.
Returns:
The type of the command with the given ID, or null if no such command exists in the registry.

isTypeMatch

public boolean isTypeMatch(String commandId,
                           Class targetType)
Returns true if the command with the given identifier is assignable to the given type.

Specified by:
isTypeMatch in interface CommandRegistry
Parameters:
commandId - The ID of the command whose type will be checked. Must not be null.
targetType - The type to be checked against the type of the command. Must not be null.
Returns:
true if a command with the given ID exists in the registry and it is assignable to the given target type, false otherwise.


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