ptolemy.vergil.tree
Class VisibleTreeModel

java.lang.Object
  extended by ptolemy.vergil.tree.EntityTreeModel
      extended by ptolemy.vergil.tree.ClassAndEntityTreeModel
          extended by ptolemy.vergil.tree.FullTreeModel
              extended by ptolemy.vergil.tree.VisibleTreeModel
All Implemented Interfaces:
javax.swing.tree.TreeModel

public class VisibleTreeModel
extends FullTreeModel

A tree model for the Vergil library panel. This is a tree model that shows all entities and some ports, relations, and attributes. The ports, relations, and attributes that it shows are those that contains an attribute of class EditorIcon, or that contain an attribute named "_iconDescription" or "_smallIconDescription". A composite entity that contains an attribute with name "_libraryMarker" is treated as a sublibrary. A composite entity without such an attribute is treated as an atomic entity. This is designed for use with JTree, which renders the hierarchy.

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

Nested Class Summary
 
Nested classes/interfaces inherited from class ptolemy.vergil.tree.EntityTreeModel
EntityTreeModel.TreeUpdateListener
 
Field Summary
private  java.util.Map _attributeListCache
           
private  java.util.Map _portListCache
           
private  java.util.Map _relationListCache
           
private  Workspace _workspace
           
private  long _workspaceAttributeVersion
           
private  long _workspacePortVersion
           
private  long _workspaceRelationVersion
           
 
Fields inherited from class ptolemy.vergil.tree.EntityTreeModel
_root
 
Constructor Summary
VisibleTreeModel(CompositeEntity root)
          Create a new tree model with the specified root.
 
Method Summary
protected  java.util.List _attributes(java.lang.Object object)
          Return the list of attributes, or an empty list if there are none.
protected  boolean _isVisible(NamedObj object)
          Return true if the object contains either an attribute of class EditorIcon or an attribute of any class named "_iconDescription" or "_smallIconDescription".
protected  java.util.List _ports(java.lang.Object object)
          Return the list of ports, or an empty list if there are none.
protected  java.util.List _relations(java.lang.Object object)
          Return the list of relations, or an empty list if there are none.
 boolean isLeaf(java.lang.Object object)
          Return true if the object is a leaf node.
 
Methods inherited from class ptolemy.vergil.tree.FullTreeModel
getChild, getChildCount, getIndexOfChild
 
Methods inherited from class ptolemy.vergil.tree.ClassAndEntityTreeModel
_classes
 
Methods inherited from class ptolemy.vergil.tree.EntityTreeModel
addTreeModelListener, getRoot, removeTreeModelListener, setRoot, valueForPathChanged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_workspace

private Workspace _workspace

_workspaceAttributeVersion

private long _workspaceAttributeVersion

_workspacePortVersion

private long _workspacePortVersion

_workspaceRelationVersion

private long _workspaceRelationVersion

_attributeListCache

private java.util.Map _attributeListCache

_portListCache

private java.util.Map _portListCache

_relationListCache

private java.util.Map _relationListCache
Constructor Detail

VisibleTreeModel

public VisibleTreeModel(CompositeEntity root)
Create a new tree model with the specified root.

Parameters:
root - The root of the tree.
Method Detail

isLeaf

public boolean isLeaf(java.lang.Object object)
Return true if the object is a leaf node. An object is a leaf node if it has no children that are instances of one of the classes specified by setFilter(), if a filter has been specified.

Specified by:
isLeaf in interface javax.swing.tree.TreeModel
Overrides:
isLeaf in class FullTreeModel
Parameters:
object - The object.
Returns:
True if the node has no children.

_attributes

protected java.util.List _attributes(java.lang.Object object)
Return the list of attributes, or an empty list if there are none. Override this method if you wish to show only a subset of the attributes.

Overrides:
_attributes in class FullTreeModel
Parameters:
object - The object.
Returns:
A list of attributes.

_isVisible

protected boolean _isVisible(NamedObj object)
Return true if the object contains either an attribute of class EditorIcon or an attribute of any class named "_iconDescription" or "_smallIconDescription". This will result in the object being rendered in the library.

Parameters:
object - The object.
Returns:
True if the object is to be rendered in the library.

_ports

protected java.util.List _ports(java.lang.Object object)
Return the list of ports, or an empty list if there are none. Override this method if you wish to show only a subset of the ports.

Overrides:
_ports in class FullTreeModel
Parameters:
object - The object.
Returns:
A list of ports.

_relations

protected java.util.List _relations(java.lang.Object object)
Return the list of relations, or an empty list if there are none. Override this method if you wish to show only a subset of the relations.

Overrides:
_relations in class FullTreeModel
Parameters:
object - The object.
Returns:
A list of relations.