The target manager dispatches commands to Targetable objects
that it manages. This design of this class is based on the Chain of
Responsiblity and Mediator design patterns. The target manager
acts as a mediator between TargetableAction s and the intended targets.
This allows Action based components to invoke commands on components
without explicitly binding the user Action to the component action.
The target manager maintains a reference to a current
target and a target list.
The target list is managed using the addTarget and
removeTarget methods. The current target is managed using the
setTarget and getTarget methods.
Commands are dispatched to the Targetable objects in the doCommand
method in a well defined order. The doCommand method on the Targetable object
is called and if it returns true then the command has been handled and
command dispatching will stop. If the Targetable doCommand method returns
false then the
If none of the Targetable objects can handle the command then the default
behaviour is to retrieve an Action from the ActionMap of
the permanent focus owner with a key that matches the command key. If an
Action can be found thenthe actionPerformed
method is invoked using an ActionEvent that was constructed
using the command string.
If the Action is not found on the focus order then the ActionMaps of the ancestor
hierarchy of the focus owner is searched until a matching Action can be found.
Finally, if none
of the components can handle the command then it is dispatche to the ActionMap
of the current Application instance.
The order of command dispatch is as follows:
Current Targetable object invoking doCommand method
List order of Targetable objects invoking doCommand method
ActionMap entry of the permanent focus owner invoking actionPerfomed
ActionMap entry of the ancestor hierarchy of the permanent focus owner
ActionMap entry of the current Application instance
The target manager maintains a reference to a current target and a target list. The target list is managed using the
addTargetandremoveTargetmethods. The current target is managed using thesetTargetandgetTargetmethods.Commands are dispatched to the Targetable objects in the
doCommandmethod in a well defined order. The doCommand method on the Targetable object is called and if it returns true then the command has been handled and command dispatching will stop. If the Targetable doCommand method returns false then theIf none of the Targetable objects can handle the command then the default behaviour is to retrieve an Action from the ActionMap of the permanent focus owner with a key that matches the command key. If an Action can be found thenthe
actionPerformedmethod is invoked using anActionEventthat was constructed using the command string.If the Action is not found on the focus order then the ActionMaps of the ancestor hierarchy of the focus owner is searched until a matching Action can be found. Finally, if none of the components can handle the command then it is dispatche to the ActionMap of the current Application instance.
The order of command dispatch is as follows: