public class WithIconGraphController.NewPortAction extends FigureAction
FigureAction.SourceType
CANVAS_TYPE, CONTEXTMENU_TYPE, HOTKEY_TYPE, MENUBAR_TYPE, PASTE_OFFSET, TOOLBAR_TYPE
Constructor and Description |
---|
NewPortAction(IOPort prototype,
java.lang.String description,
int mnemonicKey)
Create a new port that has the same input, output, and
multiport properties as the specified port.
|
NewPortAction(IOPort prototype,
java.lang.String description,
int mnemonicKey,
java.lang.String[][] iconRoles)
Create a new port that has the same input, output, and
multiport properties as the specified port and has icons
associated with being unselected, rollover, rollover
selected, and selected.
|
Modifier and Type | Method and Description |
---|---|
protected double[] |
_offsetFigure(double x,
double y,
double xOffset,
double yOffset)
Offset a figure if another figure is already at that location.
|
void |
actionPerformed(java.awt.event.ActionEvent e)
Create a new port.
|
getFigure, getFrame, getSourceType, getTarget, getX, getY, offsetFigure
public NewPortAction(IOPort prototype, java.lang.String description, int mnemonicKey)
prototype
- Prototype port.description
- The description used for menu entries and
tooltips.mnemonicKey
- The KeyEvent field for the mnemonic key to
use in the menu.public NewPortAction(IOPort prototype, java.lang.String description, int mnemonicKey, java.lang.String[][] iconRoles)
prototype
- Prototype port.description
- The description used for menu entries and
tooltips.mnemonicKey
- The KeyEvent field for the mnemonic key to
use in the menu.iconRoles
- A matrix of Strings, where each element
consists of two Strings, the absolute URL of the icon
and the key that represents the role of the icon. The keys
are usually static fields from this class, such as
GUIUtilities.LARGE_ICON
,
GUIUtilities.ROLLOVER_ICON
,
GUIUtilities.ROLLOVER_SELECTED_ICON
or
GUIUtilities.SELECTED_ICON
.
If this parameter is null, then the icon comes from
the calling getNodeRenderer() on the WithIconGraphController._portController
.GUIUtilities.addIcons(Action, String[][])
public void actionPerformed(java.awt.event.ActionEvent e)
actionPerformed
in interface java.awt.event.ActionListener
actionPerformed
in class FigureAction
e
- The event.protected double[] _offsetFigure(double x, double y, double xOffset, double yOffset)
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 x offset to be used if a figure is found.