Class 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
    • Field Summary

      • Fields inherited from class javax.swing.AbstractAction

        changeSupport, enabled
      • Fields inherited from interface javax.swing.Action

        ACCELERATOR_KEY, ACTION_COMMAND_KEY, DEFAULT, DISPLAYED_MNEMONIC_INDEX_KEY, LARGE_ICON_KEY, LONG_DESCRIPTION, MNEMONIC_KEY, NAME, SELECTED_KEY, SHORT_DESCRIPTION, SMALL_ICON
    • 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 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
      • Methods inherited from interface javax.swing.Action

        accept
    • 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 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.
        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 interface java.awt.event.ActionListener
        Overrides:
        actionPerformed in class FigureAction
        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.