| 
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.jdesktop.swingx.action.TargetManager
public class TargetManager
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 TargetableActions 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 then the 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 dispatched to the ActionMap of the current Application instance.
The order of command dispatch is as follows:
Targetable, 
TargetableAction| Constructor Summary | |
|---|---|
TargetManager()
Create a target manager.  | 
|
| Method Summary | |
|---|---|
 void | 
addPropertyChangeListener(PropertyChangeListener listener)
 | 
 void | 
addTarget(Targetable target)
Appends the target to the target list.  | 
 void | 
addTarget(Targetable target,
          boolean prepend)
Add a target to the target list.  | 
 boolean | 
doCommand(Object command,
          Object value)
Executes the command on the current targetable component.  | 
static TargetManager | 
getInstance()
Return the singleton instance.  | 
 Targetable | 
getTarget()
Return the current targetable component.  | 
 Targetable[] | 
getTargets()
Returns an array of managed targets that were added with the addTarget methods. | 
 void | 
removePropertyChangeListener(PropertyChangeListener listener)
 | 
 void | 
removeTarget(Targetable target)
Remove the target from the list  | 
 void | 
setTarget(Targetable newTarget)
Gets the current targetable component.  | 
| Methods inherited from class java.lang.Object | 
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
| Constructor Detail | 
|---|
public TargetManager()
| Method Detail | 
|---|
public static TargetManager getInstance()
public void addTarget(Targetable target,
                      boolean prepend)
Targets added to the head of the list will will be the first to handle the command.
target - the targeted object to addprepend - if true add at the head of the list; false appendpublic void addTarget(Targetable target)
target - the targeted object to addpublic void removeTarget(Targetable target)
public Targetable[] getTargets()
addTarget methods.
Targetable added or an empty array if no
         targets have been addedpublic void setTarget(Targetable newTarget)
newTarget - the current targetable component to set or null if
       the TargetManager shouldn't have a current targetable component.public Targetable getTarget()
public void addPropertyChangeListener(PropertyChangeListener listener)
public void removePropertyChangeListener(PropertyChangeListener listener)
public boolean doCommand(Object command,
                         Object value)
command - the key of the commandvalue - the value of the command; depends on context
  | 
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||