Class TargetableAction

All Implemented Interfaces:
ActionListener, ItemListener, Serializable, Cloneable, EventListener, Action

public class TargetableAction extends AbstractActionExt
A class that represents a dynamically targetable action. The invocation of this action will be dispatched to the TargetManager instance.

You would create instances of this class to let the TargetManager handle the action invocations from the ui components constructed with this action. The TargetManager could be configured depending on application state to handle these actions.

See Also:
  • Field Details

  • Constructor Details

    • TargetableAction

      public TargetableAction()
    • TargetableAction

      public TargetableAction(String name)
    • TargetableAction

      public TargetableAction(String name, String command)
      Parameters:
      name - display name of the action
      command - the value of the action command key
    • TargetableAction

      public TargetableAction(String name, String command, Icon icon)
      Parameters:
      name - display name of the action
      command - the value of the action command key
      icon - icon to display
    • TargetableAction

      public TargetableAction(String name, Icon icon)
  • Method Details

    • setTargetManager

      public void setTargetManager(TargetManager tm)
      Set target manager which will handle this command. This action may be reset to use the singleton instance if set to null.
      Parameters:
      tm - the target manager instance to dispatch the actions
    • getTargetManager

      public TargetManager getTargetManager()
      Returns the target manager instance which will be used for action dispatch. If the target manager has not previously been set then the singleton instance will be returned.
      Returns:
      a non null target manager
    • actionPerformed

      public void actionPerformed(ActionEvent evt)
      Callback for command actions. This event will be redispatched to the target manager along with the value of the Action.ACTION_COMMAND_KEY
      Parameters:
      evt - event which will be forwarded to the TargetManager
      See Also:
    • itemStateChanged

      public void itemStateChanged(ItemEvent evt)
      Callback for toggle actions. This event will be redispatched to the target manager along with value of the the Action.ACTION_COMMAND_KEY
      Specified by:
      itemStateChanged in interface ItemListener
      Overrides:
      itemStateChanged in class AbstractActionExt
      Parameters:
      evt - event which will be forwarded to the TargetManager
      See Also:
    • toString

      public String toString()
      Overrides:
      toString in class AbstractActionExt