public class FigureAction
extends javax.swing.AbstractAction
Red (johnr) |
Red (eal) |
Modifier and Type | Class and Description |
---|---|
static class |
FigureAction.SourceType
The source of the action.
|
Modifier and Type | Field and Description |
---|---|
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 int |
PASTE_OFFSET
Offset used when pasting objects.
|
static FigureAction.SourceType |
TOOLBAR_TYPE
When the action was fired from a toolbar icon.
|
Constructor and Description |
---|
FigureAction(java.lang.String name)
Construct an action that is attached to a figure on a named object.
|
Modifier and Type | Method and Description |
---|---|
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).
|
static double[] |
offsetFigure(double x,
double y,
double xOffset,
double yOffset,
java.lang.Class<?> figureClass,
FigureLayer foregroundLayer,
java.awt.geom.Rectangle2D visibleRectangle)
Determine a new location for a figure if another figure is
already at that location.
|
public static final FigureAction.SourceType CANVAS_TYPE
public static final FigureAction.SourceType CONTEXTMENU_TYPE
public static final FigureAction.SourceType HOTKEY_TYPE
public static final FigureAction.SourceType MENUBAR_TYPE
public static final int PASTE_OFFSET
public static final FigureAction.SourceType TOOLBAR_TYPE
public FigureAction(java.lang.String name)
name
- The name of the object.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()
public static double[] offsetFigure(double x, double y, double xOffset, double yOffset, java.lang.Class<?> figureClass, FigureLayer foregroundLayer, java.awt.geom.Rectangle2D visibleRectangle)
x
- The x value of the proposed location.y
- The y value of the proposed location.xOffset
- The x offset to be used if a figure is found.yOffset
- The y offset to be used if a figure is found.figureClass
- The Class of the figure to avoid.foregroundLayer
- The layer containing the figures.visibleRectangle
- The rectangle that describe the bounds
of the visible pane.