org.pietschy.command.delegate
Class SwingActionDelegate
java.lang.Object
org.pietschy.command.delegate.CommandDelegate
org.pietschy.command.delegate.SwingActionDelegate
- All Implemented Interfaces:
- ActionCommandExecutor
public class SwingActionDelegate
- extends CommandDelegate
SwingActionDelete is an instance of CommandDelegate that invokes an existing swing action. This is
useful for mapping Commands to components that have built in actions.
Example.
CommandDelegate delgate = new SwingActionDelegate("copy-command", getActionMap(), "copy-to-clipboard")
The above example will invoke the "copy-to-clipboard" action when the "copy-command" is invoked.
- Version:
- $Revision: 1.2 $
- Author:
- andrewp
|
Constructor Summary |
SwingActionDelegate(java.lang.String id,
javax.swing.Action action)
Creates a new delegate with the specified id that invokes the specfied Action. |
SwingActionDelegate(java.lang.String id,
javax.swing.ActionMap actionMap,
java.lang.Object actionKey)
Creates a new delegate with the specified id that invokes the Action in the
specified ActionMap with the specified action key. |
|
Method Summary |
void |
execute(java.util.Map hints)
|
| Methods inherited from class org.pietschy.command.delegate.CommandDelegate |
addPropertyChangeListener, addPropertyChangeListener, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getId, getPropertyChangeListeners, getPropertyChangeListeners, isEnabled, removePropertyChangeListener, removePropertyChangeListener, setEnabled |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
SwingActionDelegate
public SwingActionDelegate(java.lang.String id,
javax.swing.Action action)
- Creates a new delegate with the specified id that invokes the specfied
Action.
- Parameters:
id - the id of the delegate.action - the Action to invoke.
SwingActionDelegate
public SwingActionDelegate(java.lang.String id,
javax.swing.ActionMap actionMap,
java.lang.Object actionKey)
- Creates a new delegate with the specified id that invokes the
Action in the
specified ActionMap with the specified action key.
Example.
CommandDelegate delgate = new SwingActionDelegate("copy-command", getActionMap(), "copy-to-clipboard")
The above example will invoke the "copy-to-clipboard" action when the "copy-command" is invoked.
- Parameters:
id - the id of the delegate.actionMap - the ActionMap containing the Action.actionKey - the actions key within the map.
execute
public void execute(java.util.Map hints)