Class LookInsideAction
- java.lang.Object
-
- javax.swing.AbstractAction
-
- ptolemy.vergil.toolbox.FigureAction
-
- ptolemy.vergil.basic.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 andMoMLModelAttributeController
, 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 normalCompositeEntity
(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 (SeeGUIUtilities.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)
-
-
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 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 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
-
-
-
-
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 interfacejava.awt.event.ActionListener
- Overrides:
actionPerformed
in classFigureAction
- 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.
-
-