TreeMap Java Library

treemap
Interface TMModelNode

All Known Implementing Classes:
TMFileModelNode

public interface TMModelNode

The TMModelNode interface should be implemented by object that are model of nodes of the tree that want to be displayed in the TreeMap. It's the equivalent of theTreeModel, but for the TreeMap.

If you have already a tree structure, just implements this interface in the model of the tree.

Version:
2.5
Author:
Christophe Bouthier [bouthier@loria.fr]

Method Summary
 java.util.Enumeration children(java.lang.Object node)
          Returns the children of the given node in an Enumeration.
 java.lang.Object getRoot()
          Returns the root of the tree.
 boolean isLeaf(java.lang.Object node)
          Checks if the given node is a leaf or not.
 void setUpdater(TMModelUpdater updater)
          Called by the TMModelUpdater constructor.
 

Method Detail

getRoot

java.lang.Object getRoot()
Returns the root of the tree. Should not return null.

Returns:
the root of the tree

children

java.util.Enumeration children(java.lang.Object node)
Returns the children of the given node in an Enumeration. If the given node does not have children, it should return an empty Enumeration, not null.

Returns:
an Enumeration containing childs of the given node

isLeaf

boolean isLeaf(java.lang.Object node)
Checks if the given node is a leaf or not. A node could have no children and still not be a leaf.

Returns:
true if the given node is a leaf; false otherwise

setUpdater

void setUpdater(TMModelUpdater updater)
Called by the TMModelUpdater constructor. Gives to this model of nodes a reference to a TMModelUpdater object. This node should use this reference to notify treemap that something has changed. See the differents update methods of the TMModelUpdater interface.

As this method is called by the constructor of TMModelUpdater, don't call methods of TMModelUpdater in this method.

Parameters:
updater - TMModelUpdater to be called when something has changed

TreeMap Java Library

TreeMap Java Library - www.bouthier.net - treemap.sf.net - 2001