ptolemy.vergil.tree
Class VisibleTreeModel

java.lang.Object
  extended byptolemy.vergil.tree.EntityTreeModel
      extended byptolemy.vergil.tree.ClassAndEntityTreeModel
          extended byptolemy.vergil.tree.FullTreeModel
              extended byptolemy.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,v 1.25 2004/04/13 05:12:52 cxh Exp $
Author:
Steve Neuendorffer and Edward A. Lee
Accepted Rating:
Red (johnr)
Proposed Rating:
Red (eal)

Nested Class Summary
 
Nested classes inherited from class ptolemy.vergil.tree.EntityTreeModel
EntityTreeModel.TreeUpdateListener
 
Field Summary
 
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
 

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
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
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.

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
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
Returns:
A list of relations.