ptolemy.vergil.actor
Class ClassDefinitionController

java.lang.Object
  extended by diva.graph.BasicNodeController
      extended by ptolemy.vergil.basic.LocatableNodeController
          extended by ptolemy.vergil.basic.NamedObjController
              extended by ptolemy.vergil.basic.ParameterizedNodeController
                  extended by ptolemy.vergil.basic.IconController
                      extended by ptolemy.vergil.kernel.AttributeController
                          extended by ptolemy.vergil.actor.ActorController
                              extended by ptolemy.vergil.actor.ClassDefinitionController
All Implemented Interfaces:
NodeController

public class ClassDefinitionController
extends ActorController

This class provides interaction with nodes that represent Ptolemy II classes. This extends the base class by providing mechanisms in the context menu for creating an instance, creating a subclass, and converting to an instance.

NOTE: There should be only one instance of this class associated with a given GraphController. This is because this controller listens for changes to the graph and re-renders the ports of any actor instance in the graph when the graph changes. If there is more than one instance, this rendering will be done twice, which can result in bugs like port labels appearing twice.

Since:
Ptolemy II 4.0
Version:
$Id: ClassDefinitionController.java 57040 2010-01-27 20:52:32Z cxh $
Author:
Edward A. Lee and Steve Neuendorffer
Accepted Rating:
Red (johnr)
Proposed Rating:
Red (eal)

Nested Class Summary
private  class ClassDefinitionController.ConvertToInstanceAction
           
private  class ClassDefinitionController.CreateInstanceAction
           
private  class ClassDefinitionController.CreateSubclassAction
           
 
Nested classes/interfaces inherited from class ptolemy.vergil.actor.ActorController
ActorController.EntityLayout, ActorController.ListenToActorAction
 
Nested classes/interfaces inherited from class ptolemy.vergil.kernel.AttributeController
AttributeController.Access
 
Nested classes/interfaces inherited from class ptolemy.vergil.basic.IconController
IconController.IconRenderer
 
Field Summary
protected  ClassDefinitionController.ConvertToInstanceAction _convertToInstanceAction
          The action that handles converting a class to an instance.
protected  ClassDefinitionController.CreateInstanceAction _createInstanceAction
          The action that handles creating an instance from a class.
protected  ClassDefinitionController.CreateSubclassAction _createSubclassAction
          The action that handles creating a subclass from a class.
private static java.awt.Color _HIGHLIGHT_COLOR
          A fourth argument would make this highlight translucent, which enables combination with other highlights.
 
Fields inherited from class ptolemy.vergil.actor.ActorController
_access, _editIconAction, _flipPortsHorizontal, _flipPortsVertical, _lookInsideAction, _openInstanceAction, _removeIconAction, _rotatePortsClockwise, _rotatePortsCounterclockwise
 
Fields inherited from class ptolemy.vergil.kernel.AttributeController
_appearanceMenuActionFactory, _listenToAction, _renameAction, FULL, PARTIAL
 
Fields inherited from class ptolemy.vergil.basic.ParameterizedNodeController
_configureAction, _configureMenuFactory, _menuCreator, _menuFactory
 
Fields inherited from class ptolemy.vergil.basic.NamedObjController
_configuration
 
Fields inherited from class ptolemy.vergil.basic.LocatableNodeController
_decoratable, CLASS_ELEMENT_HIGHLIGHT_COLOR
 
Constructor Summary
ClassDefinitionController(GraphController controller)
          Create an actor instance controller associated with the specified graph controller with full access.
ClassDefinitionController(GraphController controller, AttributeController.Access access)
          Create a controller associated with the specified graph controller with the specified access.
 
Method Summary
private  void _createChangeRequest(NamedObj object, boolean subclass)
          Create a change request to create an instance or a subclass of the object.
protected  Figure _renderNode(java.lang.Object node)
          Draw the node at its location.
 void addHotKeys(JGraph jgraph)
          Add hot keys to the actions in the given JGraph.
 
Methods inherited from class ptolemy.vergil.actor.ActorController
_getComponentType, addMenuItemFactory, setConfiguration
 
Methods inherited from class ptolemy.vergil.basic.ParameterizedNodeController
getConfigureMenuFactory
 
Methods inherited from class ptolemy.vergil.basic.LocatableNodeController
_drawChildren, _getCompositeFigure, _hide, _isPropertySet, addNode, drawNode, getLocation, hasLocation, locateFigure, setLocation, setSnapResolution
 
Methods inherited from class diva.graph.BasicNodeController
addNode, addNode, addNode, clearNode, drawNode, getController, getNodeInteractor, getNodeRenderer, removeNode, setNodeInteractor, setNodeRenderer
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_convertToInstanceAction

protected ClassDefinitionController.ConvertToInstanceAction _convertToInstanceAction
The action that handles converting a class to an instance.


_createInstanceAction

protected ClassDefinitionController.CreateInstanceAction _createInstanceAction
The action that handles creating an instance from a class.


_createSubclassAction

protected ClassDefinitionController.CreateSubclassAction _createSubclassAction
The action that handles creating a subclass from a class.


_HIGHLIGHT_COLOR

private static java.awt.Color _HIGHLIGHT_COLOR
A fourth argument would make this highlight translucent, which enables combination with other highlights. However, this forces printing to PDF to rasterize the image, which results in far lower quality.

Constructor Detail

ClassDefinitionController

public ClassDefinitionController(GraphController controller)
Create an actor instance controller associated with the specified graph controller with full access.

Parameters:
controller - The associated graph controller.

ClassDefinitionController

public ClassDefinitionController(GraphController controller,
                                 AttributeController.Access access)
Create a controller associated with the specified graph controller with the specified access.

Parameters:
controller - The associated graph controller.
access - The access level, one of FULL or PARTIAL.
Method Detail

addHotKeys

public void addHotKeys(JGraph jgraph)
Add hot keys to the actions in the given JGraph.

Overrides:
addHotKeys in class ActorController
Parameters:
jgraph - The JGraph to which hot keys are to be added.

_renderNode

protected Figure _renderNode(java.lang.Object node)
Draw the node at its location. This overrides the base class to highlight the actor to indicate that it is a class definition.

Overrides:
_renderNode in class LocatableNodeController
Parameters:
node - The node to render.
Returns:
the newly created figure.

_createChangeRequest

private void _createChangeRequest(NamedObj object,
                                  boolean subclass)
Create a change request to create an instance or a subclass of the object.

Parameters:
object - The class to subclass or instantiate.
subclass - True to create a subclass, false to create an instance.