ptolemy.vergil.icon
Class EditIconGraphController

java.lang.Object
  extended by diva.graph.AbstractGraphController
      extended by ptolemy.vergil.basic.BasicGraphController
          extended by ptolemy.vergil.icon.EditIconGraphController
All Implemented Interfaces:
GraphController, DebugListener, ValueListener

public class EditIconGraphController
extends BasicGraphController

A graph controller for the Ptolemy II icon editor. This controller contains a set of default node controllers for attributes, which are the only objects that an icon editor can contain. The default controller can be overridden by attributes of type NodeControllerFactory. The getNodeController() method always returns an attribute controller.

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

Nested Class Summary
 
Nested classes/interfaces inherited from class ptolemy.vergil.basic.BasicGraphController
BasicGraphController.OpenBaseClassAction, BasicGraphController.SchematicContextMenuFactory, BasicGraphController.UnitSolverDialogAction
 
Field Summary
protected  NamedObjController _attributeController
          The attribute controller.
private  SelectionDragger _selectionDragger
           
private static double _SNAP_RESOLUTION
           
 
Fields inherited from class ptolemy.vergil.basic.BasicGraphController
_animated, _animationRenderer, _configureAction, _configureMenuFactory, _menuCreator, _menuFactory, _openBaseClassAction, _unitSolverDialogAction
 
Constructor Summary
EditIconGraphController()
          Create a new basic controller with default terminal and edge interactors and default context menus.
 
Method Summary
protected  void _createControllers()
          Create the controllers for nodes in this graph.
 void addToMenuAndToolbar(javax.swing.JMenu menu, javax.swing.JToolBar toolbar)
          Add hot key for look inside.
 EdgeController getEdgeController(java.lang.Object edge)
          Throw an exception.
 NodeController getNodeController(java.lang.Object object)
          Return the node controller appropriate for the specified object.
protected  void initializeInteraction()
          Initialize all interaction on the graph pane.
 void setConfiguration(Configuration configuration)
          Set the configuration.
 
Methods inherited from class ptolemy.vergil.basic.BasicGraphController
_addHotKeys, _initializeInteraction, clearAnimation, event, getAnimationDelay, getConfiguration, getConfigureMenuFactory, getFrame, message, setAnimationDelay, setFigure, setFrame, valueChanged
 
Methods inherited from class diva.graph.AbstractGraphController
addEdge, addEdge, addGraphViewListener, addNode, addNode, addNode, addNode, clear, clearEdge, clearNode, dispatch, drawEdge, drawNode, drawNode, getFigure, getGraphModel, getGraphPane, getSelectionModel, removeEdge, removeGraphViewListener, removeNode, rerender, rerenderEdge, rerenderNode, setGraphModel, setGraphPane, setSelectionModel
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_attributeController

protected NamedObjController _attributeController
The attribute controller.


_selectionDragger

private SelectionDragger _selectionDragger

_SNAP_RESOLUTION

private static double _SNAP_RESOLUTION
Constructor Detail

EditIconGraphController

public EditIconGraphController()
Create a new basic controller with default terminal and edge interactors and default context menus.

Method Detail

addToMenuAndToolbar

public void addToMenuAndToolbar(javax.swing.JMenu menu,
                                javax.swing.JToolBar toolbar)
Add hot key for look inside.

Overrides:
addToMenuAndToolbar in class BasicGraphController
Parameters:
menu - The menu to add to, which is ignored.
toolbar - The toolbar to add to, which is also ignored.

getEdgeController

public EdgeController getEdgeController(java.lang.Object edge)
Throw an exception. This should not be called.

Specified by:
getEdgeController in interface GraphController
Specified by:
getEdgeController in class AbstractGraphController
Parameters:
edge - The edge object.
Returns:
An exception.
Throws:
InternalErrorException - If this is called.

getNodeController

public NodeController getNodeController(java.lang.Object object)
Return the node controller appropriate for the specified object. If the specified object is an instance of Locatable and its container contains a NodeControllerFactory (which is an attribute), then invoke that factory to create a node controller. Otherwise, if the object implements Locatable and is contained by an instance of Attribute, then return the attribute controller. Otherwise, throw a runtime exception.

Specified by:
getNodeController in interface GraphController
Overrides:
getNodeController in class BasicGraphController
Parameters:
object - A Vertex, Locatable, or Port.
Returns:
object The node controller.
Throws:
java.lang.RuntimeException - If the specified object is not a Locatable contained by an Attribute.

setConfiguration

public void setConfiguration(Configuration configuration)
Set the configuration. The configuration is used when opening documentation files, for example.

Overrides:
setConfiguration in class BasicGraphController
Parameters:
configuration - The configuration.
See Also:
BasicGraphController.getConfiguration()

_createControllers

protected void _createControllers()
Create the controllers for nodes in this graph. This is called by the constructor, so derived classes that override this must be careful not to reference local variables defined in the derived classes, because the derived classes will not have been fully constructed by the time this is called.

Overrides:
_createControllers in class BasicGraphController

initializeInteraction

protected void initializeInteraction()
Initialize all interaction on the graph pane. This method is called by the setGraphPane() method of the superclass. This initialization cannot be done in the constructor because the controller does not yet have a reference to its pane at that time.

Overrides:
initializeInteraction in class BasicGraphController