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.
FigureAction.SourceType
CANVAS_TYPE, CONTEXTMENU_TYPE, HOTKEY_TYPE, MENUBAR_TYPE, PASTE_OFFSET, TOOLBAR_TYPE
Constructor and Description |
---|
LookInsideAction(java.lang.String menuActionLabel)
Create a new LookInsideAction object with the given
string as its menu action label.
|
Modifier and Type | Method and 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.
|
getFigure, getFrame, getSourceType, getTarget, getX, getY, offsetFigure
public LookInsideAction(java.lang.String menuActionLabel)
menuActionLabel
- The label of the menu action to be displayed in
the GUI context menus.public void actionPerformed(java.awt.event.ActionEvent event)
actionPerformed
in interface java.awt.event.ActionListener
actionPerformed
in class FigureAction
event
- The event received to execute the look inside action.public void setConfiguration(Configuration configuration)
configuration
- The configuration.