Package ptolemy.vergil.basic
Class WithIconGraphController.NewPortAction
- java.lang.Object
-
- javax.swing.AbstractAction
-
- ptolemy.vergil.toolbox.FigureAction
-
- ptolemy.vergil.basic.WithIconGraphController.NewPortAction
-
- All Implemented Interfaces:
java.awt.event.ActionListener
,java.io.Serializable
,java.lang.Cloneable
,java.util.EventListener
,javax.swing.Action
- Enclosing class:
- WithIconGraphController
public class WithIconGraphController.NewPortAction extends FigureAction
An action to create a new port.- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class ptolemy.vergil.toolbox.FigureAction
FigureAction.SourceType
-
-
Field Summary
-
Fields inherited from class ptolemy.vergil.toolbox.FigureAction
CANVAS_TYPE, CONTEXTMENU_TYPE, HOTKEY_TYPE, MENUBAR_TYPE, PASTE_OFFSET, TOOLBAR_TYPE
-
-
Constructor Summary
Constructors Constructor 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.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method 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.-
Methods inherited from class ptolemy.vergil.toolbox.FigureAction
getFigure, getFrame, getSourceType, getTarget, getX, getY, offsetFigure
-
Methods inherited from class javax.swing.AbstractAction
addPropertyChangeListener, clone, firePropertyChange, getKeys, getPropertyChangeListeners, getValue, isEnabled, putValue, removePropertyChangeListener, setEnabled
-
-
-
-
Constructor Detail
-
NewPortAction
public 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. If the specified port is null, then a new port that is neither an input, an output, nor a multiport will be created.- Parameters:
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.
-
NewPortAction
public 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. If the specified port is null, then a new port that is neither an input, an output, nor a multiport will be created.- Parameters:
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 asGUIUtilities.LARGE_ICON
,GUIUtilities.ROLLOVER_ICON
,GUIUtilities.ROLLOVER_SELECTED_ICON
orGUIUtilities.SELECTED_ICON
. If this parameter is null, then the icon comes from the calling getNodeRenderer() on theWithIconGraphController._portController
.- See Also:
GUIUtilities.addIcons(Action, String[][])
-
-
Method Detail
-
actionPerformed
public void actionPerformed(java.awt.event.ActionEvent e)
Create a new port.- Specified by:
actionPerformed
in interfacejava.awt.event.ActionListener
- Overrides:
actionPerformed
in classFigureAction
- Parameters:
e
- The event.
-
_offsetFigure
protected double[] _offsetFigure(double x, double y, double xOffset, double yOffset)
Offset a figure if another figure is already at that location.- Parameters:
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.- Returns:
- An array of two doubles (x and y) that represents either the original location or an offset location that does not obscure an object of class figure.
-
-