Class EditIconFrame

  • All Implemented Interfaces:
    java.awt.datatransfer.ClipboardOwner, java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.awt.event.MouseWheelListener, java.awt.event.WindowFocusListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.awt.print.Printable, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants, ImageExportable, ChangeListener, StatusHandler, HTMLExportable

    public class EditIconFrame
    extends BasicGraphFrame
    This is an icon editor frame for Ptolemy II models.

    One aspect in which this editor differs from the base class is that it does not support the "drop into" feature, where if you drop a new instance onto an instance of NamedObj, that instance of NamedObj becomes the container of the new object. This feature is not useful for icon editing, and results in visual elements mysteriously disappearing when they are dropped.

    Since:
    Ptolemy II 4.0
    Version:
    $Id$
    Author:
    Edward A. Lee
    See Also:
    Serialized Form
    Pt.AcceptedRating:
    Red (johnr)
    Pt.ProposedRating:
    Red (eal)
    • Constructor Detail

      • EditIconFrame

        public EditIconFrame​(EditorIcon icon,
                             Tableau tableau)
        Construct a frame to edit the specified icon. After constructing this, it is necessary to call setVisible(true) to make the frame appear. This is typically done by calling show() on the controlling tableau. This constructor results in a frame that obtains its library either from the model (if it has one) or the default library defined in the configuration.
        Parameters:
        icon - The icon to put in this frame.
        tableau - The tableau responsible for this frame.
        See Also:
        Tableau.show()
      • EditIconFrame

        public EditIconFrame​(EditorIcon entity,
                             Tableau tableau,
                             LibraryAttribute defaultLibrary)
        Construct a frame to edit the specified icon. After constructing this, it is necessary to call setVisible(true) to make the frame appear. This is typically done by calling show() on the controlling tableau. This constructor results in a graph frame that obtains its library either from the model (if it has one), or the defaultLibrary argument (if it is non-null), or the default library defined in the configuration.
        Parameters:
        entity - The model to put in this frame.
        tableau - The tableau responsible for this frame.
        defaultLibrary - An attribute specifying the default library to use if the model does not have a library.
        See Also:
        Tableau.show()
    • Method Detail

      • zoomReset

        public void zoomReset()
        Set zoom to the nominal. This overrides the base class to set a zoom factor and center more appropriate for editing icons.
        Overrides:
        zoomReset in class BasicGraphFrame
      • _addMenus

        protected void _addMenus()
        Create the menus that are used by this frame. It is essential that _createGraphPane() be called before this.
        Overrides:
        _addMenus in class BasicGraphFrame
      • _createDefaultLibrary

        protected CompositeEntity _createDefaultLibrary​(Workspace workspace)
        Create the default library to use if an entity has no LibraryAttribute. Note that this is called in the constructor and therefore overrides in subclasses should not refer to any members that may not have been initialized. This method overrides the base class to look for a library called "icon library" in the configuration. If there is no such library, then it provides a simple default library, created in the specified workspace.
        Overrides:
        _createDefaultLibrary in class BasicGraphFrame
        Parameters:
        workspace - The workspace in which to create the library, if one needs to be created.
        Returns:
        The new library, or null if there is no configuration.
      • _createGraphPane

        protected GraphPane _createGraphPane​(NamedObj entity)
        Create a new graph pane. Note that this method is called in constructor of the base class, so it must be careful to not reference local variables that may not have yet been created.
        Specified by:
        _createGraphPane in class BasicGraphFrame
        Parameters:
        entity - The object to be displayed in the pane.
        Returns:
        The pane that is created.
      • _drawReferenceBox

        protected void _drawReferenceBox()
        Draw a reference box with the default icon size, 60x40.