|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.springframework.richclient.command.support.DefaultCommandRegistry
public class DefaultCommandRegistry
The default implementation of the CommandRegistry interface. This implementation
may act as the child of another registry, allowing for a hierarchy of registries to be created.
If a command is requested from this registry but cannot be found, the request will be delegated
to the parent registry.
| Field Summary | |
|---|---|
protected org.apache.commons.logging.Log |
logger
Class logger, available to subclasses. |
| Constructor Summary | |
|---|---|
DefaultCommandRegistry()
Creates a new uninitialized DefaultCommandRegistry. |
|
DefaultCommandRegistry(CommandRegistry parent)
Creates a new DefaultCommandRegistry as a child of the given registry. |
|
| Method Summary | |
|---|---|
void |
addCommandRegistryListener(CommandRegistryListener listener)
Adds the given listener to the colleciton of listeners that will be notified of registry events. |
void |
commandRegistered(CommandRegistryEvent event)
|
boolean |
containsActionCommand(String commandId)
Deprecated. |
boolean |
containsCommand(String commandId)
Returns true if the registry contains a command with the given identifier. |
boolean |
containsCommandGroup(String groupId)
Deprecated. |
protected void |
fireCommandRegistered(AbstractCommand command)
Fires a 'commandRegistered' CommandRegistryEvent for the given command to all
registered listeners. |
ActionCommand |
getActionCommand(String commandId)
Deprecated. |
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. |
CommandGroup |
getCommandGroup(String groupId)
Deprecated. |
CommandRegistry |
getParent()
Returns the parent registry of this instance. |
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. |
void |
registerCommand(AbstractCommand command)
Registers the given command with the registry. |
void |
removeCommandRegistryListener(CommandRegistryListener listener)
Remove the given listener from the collection of listeners that will be notified of registry events. |
void |
setParent(CommandRegistry parent)
Sets the given registry to be the parent of this instance. |
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 |
| Field Detail |
|---|
protected final org.apache.commons.logging.Log logger
| Constructor Detail |
|---|
public DefaultCommandRegistry()
DefaultCommandRegistry.
public DefaultCommandRegistry(CommandRegistry parent)
DefaultCommandRegistry as a child of the given registry. The newly
created instance will be added as a listener on the parent registry.
parent - The parent registry. May be null.| Method Detail |
|---|
public void setParent(CommandRegistry parent)
parent - The parent registry. May be null.public void commandRegistered(CommandRegistryEvent event)
commandRegistered in interface CommandRegistryListenerpublic ActionCommand getActionCommand(String commandId)
ActionCommand that has the given id.
getActionCommand in interface CommandRegistrycommandId - The id of the action command to be returned.
public CommandGroup getCommandGroup(String groupId)
CommandGroup that has the given id.
getCommandGroup in interface CommandRegistrygroupId - The id of the command group to be returned.
public boolean containsActionCommand(String commandId)
ActionCommand with the
given id.
containsActionCommand in interface CommandRegistrycommandId - The id of the command to be searched for.
ActionCommand.public boolean containsCommandGroup(String groupId)
CommandGroup with the
given id.
containsCommandGroup in interface CommandRegistrygroupId - The id of the command group to be searched for.
CommandGroup.public void registerCommand(AbstractCommand command)
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.
registerCommand in interface CommandRegistrycommand - The command to be registered. Must not be null.protected void fireCommandRegistered(AbstractCommand command)
CommandRegistryEvent for the given command to all
registered listeners.
command - The command that has been registered. Must not be null.
IllegalArgumentException - if command is null.
public void setTargetableActionCommandExecutor(String commandId,
ActionCommandExecutor executor)
TargetableActionCommand.
setTargetableActionCommandExecutor in interface CommandRegistrycommandId - The id of the targetable command that will have its executor set.
Must not be null.executor - The command executor. May be null.public void addCommandRegistryListener(CommandRegistryListener listener)
addCommandRegistryListener in interface CommandRegistrylistener - The listener to be added. Must not be null.public void removeCommandRegistryListener(CommandRegistryListener listener)
removeCommandRegistryListener in interface CommandRegistrylistener - The listener to be removed.public CommandRegistry getParent()
public boolean containsCommand(String commandId)
containsCommand in interface CommandRegistrycommandId - The ID of the command to search for.
public Object getCommand(String commandId)
getCommand in interface CommandRegistrycommandId - The ID of the command to be retrieved.
public Object getCommand(String commandId,
Class requiredType)
throws CommandNotOfRequiredTypeException
getCommand in interface CommandRegistrycommandId - The identifier of the command to be retrieved. Must not be null.requiredType - The required type of the command with the given id.
CommandNotOfRequiredTypeException - if the retrieved command is not assignable to
the required type.public Class getType(String commandId)
getType in interface CommandRegistrycommandId - The ID of the command whose type is to be returned. Must not be null.
public boolean isTypeMatch(String commandId,
Class targetType)
isTypeMatch in interface CommandRegistrycommandId - 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.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||