|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.pietschy.command.delegate.ActionCommandDelegate
com.pietschy.command.delegate.SwingActionDelegate
public class SwingActionDelegate
An instance of ActionCommandDelegate that invokes an existing swing action. This
is useful for creating delegates from standard actions built into existing components.
SwingActionDelegate delegate = new SwingActionDelegate("copy", myTextPane, "copy-to-clipboard");
delegate.bind(myTextPane);
This class also provides convenience methods for creating and binding a number of delegates at once.
SwingActionDelegate.bindAll(myTextPane, "copy-to-clipboard", "cut-to-clipboard", "paste-from-clipboard");
In this case the delegate ids will match the action ids.
| Field Summary |
|---|
| Fields inherited from class com.pietschy.command.delegate.ActionCommandDelegate |
|---|
PROPERTY_ENABLED |
| 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.JComponent component)
Creates a new delegate with the specified id that invokes the corresponding Action in the specified component. |
|
SwingActionDelegate(java.lang.String id,
javax.swing.JComponent component,
java.lang.Object actionKey)
Creates a new delegate with the specified id that invokes the Action in the
specifeid componetn with the specified action id. |
|
| Method Summary | |
|---|---|
static void |
bindAll(CommandContainer container,
javax.swing.JComponent component,
java.lang.Object... actionIds)
Creates SwingActionDelegate instances for all the specified action ids defined for the specified component. |
static void |
bindAll(javax.swing.JComponent component,
java.lang.Object... actionIds)
Creates SwingActionDelegate instances for all the specified action ids defined for the specified component. |
protected void |
handleExecute()
Invokes this delegates Action. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public SwingActionDelegate(java.lang.String id,
javax.swing.Action action)
Action.
id - the id of the delegate.action - the Action to invoke.
public SwingActionDelegate(java.lang.String id,
javax.swing.JComponent component)
Action in the specified component.
The follwing example will invoke the "copy-to-clipboard" action on the specified component
when executed.
CommandDelegate delgate = new SwingActionDelegate("copy-to-clipboard", component)
id - the id of the delegate and action.component - the component whose action map contains the Action.
public SwingActionDelegate(java.lang.String id,
javax.swing.JComponent component,
java.lang.Object actionKey)
Action in the
specifeid componetn with the specified action id.
The following example will invoke the "copy-to-clipboard" action when the "copy" command is executed.
CommandDelegate delgate = new SwingActionDelegate("copy-command", myTextPane, "copy-to-clipboard")
id - the id of the delegate.component - the component whose action map contains the Action.actionKey - the actions key within the map.| Method Detail |
|---|
public static void bindAll(javax.swing.JComponent component,
java.lang.Object... actionIds)
component - the component containing the actions.actionIds - the action ids to create delegates for.
public static void bindAll(CommandContainer container,
javax.swing.JComponent component,
java.lang.Object... actionIds)
CommandContainer.
container - the container to which the delegates will be bound.component - the component containing the actions.actionIds - the action ids to create delegates for.protected void handleExecute()
Action.
handleExecute in class ActionCommandDelegate
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||