|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.ceryle.ui.tree.TopicTreeModel
public class TopicTreeModel
Implements TreeModel as the model used
for displaying a set of hierarchical Topics in tree form. Because
multiple traversals of a graph may generate different orderings
of parent (superclass) or child (subclass) nodes, the generated,
ordered lists for each Topic are cached. Clearing the TreeModel
or setting the root clears these caches.
| Field Summary | |
|---|---|
protected int |
facetMode
An indicator of whether or not facets should be shown in the generated list, and if so, prior to or after the superclasses or subclasses. |
protected Inferencer |
m_infer
|
static int |
NO_FACETS
An enumerated constant indicating that no facets should be shown in the list. |
static int |
POST_FACETS
An enumerated constant indicating that facets should be shown after the superclasses or subclasses in the list. |
static int |
PRE_FACETS
An enumerated constant indicating that facets should be shown prior to superclasses or subclasses in the list. |
| Constructor Summary | |
|---|---|
TopicTreeModel(List list,
Inferencer inferencer,
boolean superclasses)
Constructor for a TopicTreeModel, provided with a List container of initial Topics, an Inferencer (for traversal), and the traversal direction (when superclasses is true, shows superclasses, otherwise subclasses), and defaults to showing no facets (i.e., facetMode is set to NO_FACETS). |
|
TopicTreeModel(List list,
Inferencer inferencer,
boolean superclasses,
int facetMode)
Constructor for a TopicTreeModel, provided with a List container of initial Topics, an Inferencer (for traversal), the traversal direction (when superclasses is true, shows superclasses, otherwise subclasses), and a facet setting. |
|
| Method Summary | |
|---|---|
void |
addTreeModelListener(TreeModelListener listener)
Adds a listener for the TreeModelEvent posted after the tree changes. |
void |
clearCaches()
Clears the traversal caches. |
protected void |
fireTreeStructureChanged(TopicTreeNode oldRoot)
The only event raised by this model is TreeStructureChanged with the root as path: that is, the whole tree has changed. |
Object |
getChild(Object parent,
int index)
Returns the child of parent at index index in the parent's child array. |
int |
getChildCount(Object parent)
Returns the number of children of parent. |
int |
getFacetMode()
Returns the current facet mode. |
int |
getIndexOfChild(Object parent,
Object child)
Returns the index of child in parent. |
Object |
getRoot()
Returns the root of the tree (a TopicTreeNode whose user object is a List containing zero or more Topics). |
List |
getSubclassesForTopic(Topic topic)
Returns a Vector-backed List of the subclasses for Topic topic, The result is cached, so that subsequent requests don't require a re-traversal of the graph, and list order remains the same. |
List |
getSuperclassesForTopic(Topic topic)
Returns a Vector-backed List of the superclasses for Topic topic, The result is cached, so that subsequent requests don't require a re-traversal of the graph, and list order remains the same. |
boolean |
isLeaf(Object node)
Returns true if node is a leaf. |
boolean |
isRoot(Object o)
Returns true if Object o is the root of the tree. |
void |
removeTreeModelListener(TreeModelListener listener)
Removes a listener previously added with addTreeModelListener(). |
void |
setFacetMode(int mode)
Sets whether or not facets should be shown in the generated list, and if so, prior to or after the superclasses or subclasses. |
void |
showRelations(List list,
boolean superclasses)
Used to toggle between show superclass/show subclass mode and to change the root of the tree (when non-null, this also clears the traversal caches). |
void |
showSubclassesOf(List list)
Show the subclasses of the List of Topics list (as an Object). |
void |
showSuperclassesOf(List list)
Show the superclasses of the List of Topics list (as an Object). |
void |
valueForPathChanged(TreePath path,
Object newValue)
Messaged when the user has altered the value for the item identified by path to newValue. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int NO_FACETS
public static final int PRE_FACETS
public static final int POST_FACETS
protected int facetMode
NO_FACETS, PRE_FACETS (the default), and POST_FACETS.
protected Inferencer m_infer
| Constructor Detail |
|---|
public TopicTreeModel(List list,
Inferencer inferencer,
boolean superclasses)
throws TopicMapException
TopicMapException
public TopicTreeModel(List list,
Inferencer inferencer,
boolean superclasses,
int facetMode)
throws TopicMapException
TopicMapException| Method Detail |
|---|
public void setFacetMode(int mode)
NO_FACETS (no facets), PRE_FACETS (prior to
superclasses or subclasses), and POST_FACETS (after superclasses
or subclasses). Values outside this range are ignored.
public int getFacetMode()
setFacetMode(int)public void showSuperclassesOf(List list)
This is a convenience method that calls showRelations(List,boolean).
public void showSubclassesOf(List list)
This is a convenience method that calls showRelations(List,boolean).
public void showRelations(List list,
boolean superclasses)
protected void fireTreeStructureChanged(TopicTreeNode oldRoot)
public void addTreeModelListener(TreeModelListener listener)
addTreeModelListener in interface TreeModel
public Object getChild(Object parent,
int index)
getChild in interface TreeModelpublic int getChildCount(Object parent)
getChildCount in interface TreeModel
public int getIndexOfChild(Object parent,
Object child)
getIndexOfChild in interface TreeModelpublic Object getRoot()
getRoot in interface TreeModelpublic boolean isRoot(Object o)
public boolean isLeaf(Object node)
isLeaf in interface TreeModelpublic void removeTreeModelListener(TreeModelListener listener)
removeTreeModelListener in interface TreeModel
public void valueForPathChanged(TreePath path,
Object newValue)
valueForPathChanged in interface TreeModelpublic void clearCaches()
public List getSuperclassesForTopic(Topic topic)
throws InferenceException
InferenceException
public List getSubclassesForTopic(Topic topic)
throws InferenceException
InferenceException
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||