|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.pietschy.command.Command
org.pietschy.command.ActionCommand
org.pietschy.command.delegate.DelegatingCommand
public class DelegatingCommand
Delegating commands allow a single command to delegate its behaviour to another object. This is most useful when the commands actaul behaviour is dependant on the current context of the UI. A typical examples would be cut, paste and print.
The behaviour of the command is provided by instances of CommandDelegate which are
automatically extracted from the DelegateContainer once
trackDelegateIn(String, java.awt.Window) has been invoked.
DelegatingCommands are automatically bound to delegates whose id match their own.
DelegateContainer,
CommandDelegate| Field Summary |
|---|
| Fields inherited from class org.pietschy.command.ActionCommand |
|---|
HINT_ACTION_EVENT, HINT_INVOKER, HINT_INVOKER_WINDOW, HINT_MODIFIERS |
| Fields inherited from class org.pietschy.command.Command |
|---|
internalLog, listenerList, pcs |
| Constructor Summary | |
|---|---|
DelegatingCommand(CommandManager commandManager,
java.lang.String commandId)
Creates a new DelegatingCommand with the specified id and that is bound to the specifed CommandManager. |
|
DelegatingCommand(java.lang.String id)
Creates a new DelegatingCommand with the specified id. |
|
| Method Summary | |
|---|---|
void |
delegatesChanged(DelegateMediatorEvent event)
Invoked when the DelegateContainers of a specific DelegateMediator
have changed. |
protected ActionCommandExecutor |
getDelegate()
|
protected void |
handleExecute()
Main entry point for command subclasses that must be implemented to provide command specific behaviour. |
protected void |
setDelegate(ActionCommandExecutor newDelegate)
Sets the delegate for this command to use. |
protected void |
setDelegateIdToTrack(java.lang.String delegateIdToTrack)
Sets the delegate id this command is to track. |
DelegatingCommand |
trackDelegateIn(java.lang.String delegateId,
java.awt.Window window)
This method configures the command to track delegates in the specified Window. |
| Methods inherited from class org.pietschy.command.ActionCommand |
|---|
addCommandListener, addInterceptor, areEqual, attach, configureButtonStates, detach, execute, execute, getActionAdapter, getActionAdapter, getActionCommand, getActionEvent, getHint, getHint, getHints, getInvoker, getInvokerWindow, getModifiers, installShortCut, installShortCut, postExecute, preExecute, putHint, putHints, removeCommandListener, removeInterceptor, requestDefautIn, setActionCommand, uninstallShortCut, uninstallShortCut |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface org.pietschy.command.ActionCommandExecutor |
|---|
addPropertyChangeListener, addPropertyChangeListener, isEnabled, removePropertyChangeListener, removePropertyChangeListener |
| Constructor Detail |
|---|
public DelegatingCommand(java.lang.String id)
CommandManager.defaultInstance()
id - the id of the command.
public DelegatingCommand(CommandManager commandManager,
java.lang.String commandId)
CommandManager.
commandManager - the CommandManager to which the command is bound.commandId - the id of the command.| Method Detail |
|---|
protected void setDelegateIdToTrack(java.lang.String delegateIdToTrack)
delegateIdToTrack - the id of the delegate that this command will invoke.
public DelegatingCommand trackDelegateIn(java.lang.String delegateId,
java.awt.Window window)
Window. The implementation
simply adds the command as a listener to the DelegateManager of the specified window.
I.e.
DelegateManager manager = DelegateManager.getInstanceFor(window); manager.addDelegateManagerListener(this);
delegateId - the id of the delegate to track.window - the window in which to track delegates.
this as a convenience for creating a new commannd on one line, new DelegatingCommand(...).trackDelegatesIn(win).export();.protected void handleExecute()
ActionCommand
This method should never be called directly to invoke a comand. All
command invocation must be performed using the ActionCommand.execute() and
ActionCommand.execute(Map) methods.
handleExecute in class ActionCommandprotected void setDelegate(ActionCommandExecutor newDelegate)
trackDelegateIn(String, java.awt.Window) is invoked.
and should not normally be used.
newDelegate - the delegate this command is to use.trackDelegateIn(String, java.awt.Window)protected ActionCommandExecutor getDelegate()
public void delegatesChanged(DelegateMediatorEvent event)
DelegateMediatorListenerDelegateContainers of a specific DelegateMediator
have changed.
delegatesChanged in interface DelegateMediatorListenerevent - the event.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||