|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjavax.swing.AbstractAction
ptolemy.vergil.toolbox.FigureAction
An action that is attached to a figure on a named object. Such an action is fired in one of several ways. The first way is through an ActionInteractor that is attached to the figure. The second way is through a context menu that is created on the figure. A third way is through a hotkey. Unfortunately, the source of the event is different in these cases. This class makes it easier to write an action that is triggered by any mechanism. Such an action would be derived from this class, and would invoke super.actionPerformed() first in its own actionPerformed() method.
| Red (johnr) |
| Red (eal) |
| Nested Class Summary | |
static class |
FigureAction.SourceType
|
| Field Summary | |
static FigureAction.SourceType |
CANVAS_TYPE
When the action was fired from a canvas interactor. |
static FigureAction.SourceType |
CONTEXTMENU_TYPE
When the action was fired from a context menu. |
static FigureAction.SourceType |
HOTKEY_TYPE
When the action was fired from a hotkey. |
static FigureAction.SourceType |
MENUBAR_TYPE
When the action was fired from a menubar. |
static FigureAction.SourceType |
TOOLBAR_TYPE
When the action was fired from a toolbar icon. |
| Fields inherited from class javax.swing.AbstractAction |
changeSupport, enabled |
| Fields inherited from interface javax.swing.Action |
ACCELERATOR_KEY, ACTION_COMMAND_KEY, DEFAULT, LONG_DESCRIPTION, MNEMONIC_KEY, NAME, SHORT_DESCRIPTION, SMALL_ICON |
| Constructor Summary | |
FigureAction(java.lang.String name)
|
|
| Method Summary | |
void |
actionPerformed(java.awt.event.ActionEvent e)
Determine the target Ptolemy II object, the originating frame, and the X, Y position of the action, if possible. |
Figure |
getFigure()
Return the figure of this action |
java.awt.Frame |
getFrame()
Return the frame responsible for triggering this action, or null if none could be found. |
FigureAction.SourceType |
getSourceType()
Return the source type of this action, which is one of CANVAS_TYPE, CONTEXTMENU_TYPE, TOOLBAR_TYPE, MENUBAR_TYPE, HOTKEY_TYPE, or null if none was recognized. |
NamedObj |
getTarget()
Return the target Ptolemy II object for this action, or null if none could be found. |
int |
getX()
Return the horizontal position of the action, or 0 if this is not relevant (e.g., the action was triggered by a toolbar button). |
int |
getY()
Return the vertical position of the action, or 0 if this is not relevant (e.g., the action was triggered by a toolbar button). |
| Methods inherited from class javax.swing.AbstractAction |
addPropertyChangeListener, clone, firePropertyChange, getKeys, getPropertyChangeListeners, getValue, isEnabled, putValue, removePropertyChangeListener, setEnabled |
| Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static FigureAction.SourceType CANVAS_TYPE
public static FigureAction.SourceType CONTEXTMENU_TYPE
public static FigureAction.SourceType TOOLBAR_TYPE
public static FigureAction.SourceType MENUBAR_TYPE
public static FigureAction.SourceType HOTKEY_TYPE
| Constructor Detail |
public FigureAction(java.lang.String name)
| Method Detail |
public void actionPerformed(java.awt.event.ActionEvent e)
e - The event.public Figure getFigure()
public java.awt.Frame getFrame()
public FigureAction.SourceType getSourceType()
public NamedObj getTarget()
public int getX()
public int getY()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||