ehsbe CommonsTM
Version 1.1.0rc3

com.ehsbe.commons.action
Class BoundAction

java.lang.Object
  extended by javax.swing.AbstractAction
      extended by com.ehsbe.commons.action.AbstractActionExt
          extended by com.ehsbe.commons.action.ManagedAction
              extended by com.ehsbe.commons.action.BoundAction
All Implemented Interfaces:
ActionListener, ItemListener, Serializable, Cloneable, EventListener, Action

public class BoundAction
extends ManagedAction

A class that represents the many type of actions that this framework supports.

The command invocation of this action may be delegated to another action or item state listener. If there isn't an explicit binding then the command is forwarded to the TargetManager.

Author:
Mark Davidson
See Also:
Serialized Form

Field Summary
 
Fields inherited from class com.ehsbe.commons.action.ManagedAction
actionListeners, itemListeners
 
Fields inherited from class com.ehsbe.commons.action.AbstractActionExt
GROUP, IS_STATE, LARGE_ICON_P_KEY, SELECT_PROPERTY_NAME, SMALL_ICON_P_KEY
 
Fields inherited from class javax.swing.AbstractAction
changeSupport, enabled
 
Fields inherited from interface javax.swing.Action
ACCELERATOR_KEY, ACTION_COMMAND_KEY, DEFAULT, DISPLAYED_MNEMONIC_INDEX_KEY, LARGE_ICON_KEY, LONG_DESCRIPTION, MNEMONIC_KEY, NAME, SELECTED_KEY, SHORT_DESCRIPTION, SMALL_ICON
 
Constructor Summary
BoundAction()
          Default Action constructor.
BoundAction(String name)
          Defines an Action object with the specified name and a default icon.
BoundAction(String name, Icon icon)
          Defines an Action object with the specified name and the specified icon.
BoundAction(String name, String command)
          Defines an Action object with the specified name, and the specified command key.
BoundAction(String name, String command, Icon icon)
          Defines an Action object with the specified name, the specified command key and the specified icon.
 
Method Summary
 void registerCallback(Object handler, String method)
          Registers a callback method.
 void setCallback(String callback)
          The callback string will be called to register the action callback.
 
Methods inherited from class com.ehsbe.commons.action.ManagedAction
actionPerformed, addActionListener, addItemListener, clone, itemStateChanged, removeActionListener, removeItemListener
 
Methods inherited from class com.ehsbe.commons.action.AbstractActionExt
dispose, getAccelerator, getActionCommand, getGroup, getLargeIcon, getLargePressedIcon, getLongDescription, getMnemonic, getName, getShortDescription, getSmallIcon, getSmallPressedIcon, isSelected, isStateAction, setAccelerator, setActionCommand, setGroup, setLargeIcon, setLargePressedIcon, setLongDescription, setMnemonic, setMnemonic, setName, setSelected, setShortDescription, setSmallIcon, setSmallPressedIcon, setStateAction, setStateAction, toString
 
Methods inherited from class javax.swing.AbstractAction
addPropertyChangeListener, firePropertyChange, getKeys, getPropertyChangeListeners, getValue, isEnabled, putValue, removePropertyChangeListener, setEnabled
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BoundAction

public BoundAction()
Default Action constructor.


BoundAction

public BoundAction(String name)
Defines an Action object with the specified name and a default icon.

Parameters:
name - display name of the action

BoundAction

public BoundAction(String name,
                   String command)
Defines an Action object with the specified name, and the specified command key.

Parameters:
name - display name of the action
command - the value of the action command key

BoundAction

public BoundAction(String name,
                   Icon icon)
Defines an Action object with the specified name and the specified icon.

Parameters:
name - display name of the action
icon - the action's icon

BoundAction

public BoundAction(String name,
                   String command,
                   Icon icon)
Defines an Action object with the specified name, the specified command key and the specified icon.

Parameters:
name - display name of the action
command - the value of the action command key
icon - icon to display
Method Detail

setCallback

public void setCallback(String callback)
The callback string will be called to register the action callback. Note the toggle property must be set if this is a state action before this method is called.

Parameters:
callback - a String of the format classname#method, where classname is a fully quallyfied class name and method the name of the method, which should be invoked on the given class and accepts exactly one boolean parameter
See Also:
registerCallback(Object, String)

registerCallback

public void registerCallback(Object handler,
                             String method)
Registers a callback method. When actionPerformed is invoked on this action, then the named method will be invoked on the handler Object.

If the passed action is a StateChangeAction, then the method passed should take an boolean as an argument. The value of getStateChange() on the ItemEvent object will be passed as the parameter.

Parameters:
handler - the object which will be perform the action
method - the name of the method on the handler which will be called.

ehsbe CommonsTM
Version 1.1.0rc3

Copyright ©2005-2009 EHSBE, Walther-Rathenau-Str. 58, 39104 Magdeburg, Sachsen-Anhalt, Germany. All Rights Reserved.