Package ptolemy.vergil.tree
Class VisibleTreeModel
- java.lang.Object
-
- ptolemy.vergil.tree.EntityTreeModel
-
- ptolemy.vergil.tree.ClassAndEntityTreeModel
-
- ptolemy.vergil.tree.FullTreeModel
-
- 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 contain 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$
- Author:
- Steve Neuendorffer and Edward A. Lee
- Pt.AcceptedRating:
- Red (johnr)
- Pt.ProposedRating:
- Red (eal)
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class ptolemy.vergil.tree.EntityTreeModel
EntityTreeModel.TreeUpdateListener
-
-
Field Summary
-
Fields inherited from class ptolemy.vergil.tree.EntityTreeModel
_root
-
-
Constructor Summary
Constructors Constructor Description VisibleTreeModel(CompositeEntity root)
Create a new tree model with the specified root.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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.void
valueForPathChanged(javax.swing.tree.TreePath path, java.lang.Object newValue)
Override the base class to do nothing.-
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
-
-
-
-
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 interfacejavax.swing.tree.TreeModel
- Overrides:
isLeaf
in classFullTreeModel
- Parameters:
object
- The object.- Returns:
- True if the node has no children.
-
valueForPathChanged
public void valueForPathChanged(javax.swing.tree.TreePath path, java.lang.Object newValue)
Override the base class to do nothing. This seems risky, but the problem is that without it, every time you expand a library that has a image or PDF icon it, the entire library collapses, which is extremely annoying. I guess this is OK under the assumption that the library does not change during execution.- Specified by:
valueForPathChanged
in interfacejavax.swing.tree.TreeModel
- Overrides:
valueForPathChanged
in classEntityTreeModel
- Parameters:
path
- The path of the node that has changed.newValue
- The new value of the node.
-
_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 classFullTreeModel
- 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 classFullTreeModel
- 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 classFullTreeModel
- Parameters:
object
- The object.- Returns:
- A list of relations.
-
-