ptolemy.vergil.basic
Class DependencyHighlighter

java.lang.Object
  extended by ptolemy.kernel.util.NamedObj
      extended by ptolemy.kernel.util.Attribute
          extended by ptolemy.kernel.util.SingletonAttribute
              extended by ptolemy.vergil.basic.NodeControllerFactory
                  extended by ptolemy.vergil.basic.DependencyHighlighter
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, Changeable, Debuggable, DebugListener, Derivable, ModelErrorHandler, MoMLExportable, Moveable, Nameable, Singleton

public class DependencyHighlighter
extends NodeControllerFactory

This is an attribute that produces a custom node controller that adds context menu commands to highlight dependents and prerequisites. A dependent is a downstream actor, and a prerequisite is an upstream actor. To use this, drop it onto any actor. The context menu (right click or command click) aquires four additional commands to highlight or clear highlights on dependents or prerequisites.

Since:
Ptolemy II 8.0
Version:
$Id: DependencyHighlighter.java 57044 2010-01-27 22:41:05Z cxh $
Author:
Edward A. Lee
See Also:
Serialized Form
Accepted Rating:
Red (johnr)
Proposed Rating:
Red (eal)

Nested Class Summary
 class DependencyHighlighter.DependencyController
          The controller that adds commands to the context menu.
private  class DependencyHighlighter.HighlightDependents
          The action for the commands added to the context menu.
 
Nested classes/interfaces inherited from class ptolemy.kernel.util.NamedObj
NamedObj.ContainedObjectsIterator
 
Field Summary
 ColorAttribute highlightColor
          The highlight color.
 
Fields inherited from class ptolemy.kernel.util.NamedObj
_changeListeners, _changeLock, _changeRequests, _debugging, _debugListeners, _elementName, _isPersistent, _verbose, _workspace, ATTRIBUTES, CLASSNAME, COMPLETE, CONTENTS, DEEP, FULLNAME, LINKS
 
Constructor Summary
DependencyHighlighter(NamedObj container, java.lang.String name)
          Construct a new attribute with the given container and name.
 
Method Summary
private  void _addHighlights(NamedObj actor, java.lang.StringBuffer moml, java.util.HashSet<NamedObj> visited, boolean forward, boolean clear)
          Add MoML for highlights for the specified actor to the specified buffer.
 NamedObjController create(GraphController controller)
          Return a new node controller.
 
Methods inherited from class ptolemy.kernel.util.SingletonAttribute
setContainer
 
Methods inherited from class ptolemy.kernel.util.Attribute
_checkContainer, _getContainedObject, _propagateExistence, clone, getContainer, moveDown, moveToFirst, moveToIndex, moveToLast, moveUp, setName, updateContent
 
Methods inherited from class ptolemy.kernel.util.NamedObj
_addAttribute, _adjustOverride, _attachText, _cloneFixAttributeFields, _debug, _debug, _debug, _debug, _debug, _description, _exportMoMLContents, _getIndentPrefix, _isMoMLSuppressed, _markContentsDerived, _propagateValue, _recordDecoratedAttributes, _removeAttribute, _splitName, _stripNumericSuffix, _validateSettables, addChangeListener, addDebugListener, attributeChanged, attributeList, attributeList, attributeTypeChanged, clone, containedObjectsIterator, deepContains, depthInHierarchy, description, description, event, executeChangeRequests, exportMoML, exportMoML, exportMoML, exportMoML, exportMoML, exportMoMLPlain, getAttribute, getAttribute, getAttributes, getChangeListeners, getClassName, getDecoratorAttribute, getDecoratorAttributes, getDerivedLevel, getDerivedList, getDisplayName, getElementName, getFullName, getModelErrorHandler, getName, getName, getPrototypeList, getSource, handleModelError, isDeferringChangeRequests, isOverridden, isPersistent, lazyContainedObjectsIterator, message, propagateExistence, propagateValue, propagateValues, removeChangeListener, removeDebugListener, requestChange, setClassName, setDeferringChangeRequests, setDerivedLevel, setDisplayName, setModelErrorHandler, setPersistent, setSource, sortContainedObjects, toplevel, toString, uniqueName, validateSettables, workspace
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

highlightColor

public ColorAttribute highlightColor
The highlight color.

Constructor Detail

DependencyHighlighter

public DependencyHighlighter(NamedObj container,
                             java.lang.String name)
                      throws NameDuplicationException,
                             IllegalActionException
Construct a new attribute with the given container and name.

Parameters:
container - The container.
name - The name.
Throws:
IllegalActionException - If the attribute cannot be contained by the proposed container.
NameDuplicationException - If the container already has an attribute with this name.
Method Detail

create

public NamedObjController create(GraphController controller)
Return a new node controller. This base class returns an instance of IconController. Derived classes can return some other class to customize the context menu.

Overrides:
create in class NodeControllerFactory
Parameters:
controller - The associated graph controller.
Returns:
A new node controller.

_addHighlights

private void _addHighlights(NamedObj actor,
                            java.lang.StringBuffer moml,
                            java.util.HashSet<NamedObj> visited,
                            boolean forward,
                            boolean clear)
Add MoML for highlights for the specified actor to the specified buffer.

Parameters:
actor - The actor.
moml - The string buffer into which to add the MoML for the highlights.
visited - The set of actors that have been visited.
forward - True for dependents, false for prerequisites.
clear - True to clear, false to highlight.