Class LookInsideAction

  • All Implemented Interfaces:
    java.awt.event.ActionListener, java.io.Serializable, java.lang.Cloneable, java.util.EventListener, javax.swing.Action

    public class LookInsideAction
    extends FigureAction

    The action to open a composite actor model, an ontology, or a MoMLModelAttribute. This class must remain named LookInsideAction for backward compatibility.

    This used to be a private class contained in ActorController, but it is now relevant for ptolemy.vergil.ontologies.OntologyEntityController OntologyEntityController and MoMLModelAttributeController, so it has been pulled out into a public class. Additionally MoMLModelAttributeController requires a different implementation to open its contained model since it is an Attribute and not a CompositeEntity, and thus its contained model does not fit in the traditional Ptolemy containment hierarchy.

    Previously MoMLModelAttribute contained its own private LookInsideAction class, but the shortcut key binding did not work correctly. This was because in a Ptolemy model, a shortcut key can only bind one action for every node in the entire model graphical space to any given key. If a model contains both normal CompositeEntity (including ptolemy.data.ontologies.Ontology entities) elements and MoMLModelAttributes, then only one look inside action will be bound to the shortcut L key even though each action will be accessible from their individual context menus (See GUIUtilities.addHotKey()).

    The solution here is that there is a single class to implement the look inside action that has two private methods to implement look inside for the normal Ptolemy CompositeEntity case and the special MoMLModelAttribute case. The controller for each respective Ptolemy element can customize its instance of the LookInsideAction with its own menu label for its context menu, but the actual actionPerformed(java.awt.event.ActionEvent) method that executes the action is the same for all instances. So regardless of which LookInsideAction gets bound to the L key, it will work for all Ptolemy elements.

    If the element is not a CompositeEntity or a MoMLModelAttribute, it will just open the java text file of the element's class definition.

    Since:
    Ptolemy II 10.0
    Version:
    $Id$
    Author:
    Charles Shelton
    See Also:
    Serialized Form
    Pt.AcceptedRating:
    Red (cshelton)
    Pt.ProposedRating:
    Red (cshelton)
    • 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
      LookInsideAction​(java.lang.String menuActionLabel)
      Create a new LookInsideAction object with the given string as its menu action label.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void actionPerformed​(java.awt.event.ActionEvent event)
      Execute the look inside action command received from the event sent from the user interface.
      void setConfiguration​(Configuration configuration)
      Set the configuration to be used by the LookInsideAction object.
      • 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

      • LookInsideAction

        public LookInsideAction​(java.lang.String menuActionLabel)
        Create a new LookInsideAction object with the given string as its menu action label.
        Parameters:
        menuActionLabel - The label of the menu action to be displayed in the GUI context menus.
    • Method Detail

      • actionPerformed

        public void actionPerformed​(java.awt.event.ActionEvent event)
        Execute the look inside action command received from the event sent from the user interface.
        Specified by:
        actionPerformed in interface java.awt.event.ActionListener
        Overrides:
        actionPerformed in class FigureAction
        Parameters:
        event - The event received to execute the look inside action.
      • setConfiguration

        public void setConfiguration​(Configuration configuration)
        Set the configuration to be used by the LookInsideAction object.
        Parameters:
        configuration - The configuration.