no.uio.labmed.util.output
Class TreeAdapter

java.lang.Object
  |
  +--no.uio.labmed.util.output.TreeAdapter
All Implemented Interfaces:
javax.swing.tree.TreeModel

public class TreeAdapter
extends java.lang.Object
implements javax.swing.tree.TreeModel

NB: FORELDET!!!!!!!!!!!!!!!!!!!!

Adapter class for making javax.swing.JTree views of a tree. The JTreeAdapterNode is both a adapter and wrapper class whose nodes are instantiated as they are refered to: ie., for a large tree, only those nodes that are actually addressed are instantiated.

This implementation uses the TreePointerInterface to access the tree, and does therefore not explicitly need to access the actual nodes of the tree.

See Also:
JTreeAdapterNode

Constructor Summary
TreeAdapter(TreeAdapterNode node)
          Constructor: Initiate tree with given node as root
TreeAdapter(TreePointerInterface node)
          Constructor: Initiate tree with given node as root
 
Method Summary
protected  boolean addChildren(TreeAdapterNode node)
          Add children to node if not previously done, returning true.
 void addTreeModelListener(javax.swing.event.TreeModelListener l)
          Empty implementation
 java.lang.Object getChild(java.lang.Object parent, int index)
          Get child of parent by index in 0..N-1
 int getChildCount(java.lang.Object parent)
          Return number of children
 int getIndexOfChild(java.lang.Object parent, java.lang.Object child)
          Return index of child or -1 if not a child.
 java.lang.Object getRoot()
          Return root.
 boolean isLeaf(java.lang.Object node)
          Return true if node is leaf.
 void removeTreeModelListener(javax.swing.event.TreeModelListener l)
          Empty implementation
 void valueForPathChanged(javax.swing.tree.TreePath path, java.lang.Object newValue)
          Empty implementation
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TreeAdapter

public TreeAdapter(TreePointerInterface node)
Constructor: Initiate tree with given node as root


TreeAdapter

public TreeAdapter(TreeAdapterNode node)
Constructor: Initiate tree with given node as root

Method Detail

addTreeModelListener

public void addTreeModelListener(javax.swing.event.TreeModelListener l)
Empty implementation

Specified by:
addTreeModelListener in interface javax.swing.tree.TreeModel

removeTreeModelListener

public void removeTreeModelListener(javax.swing.event.TreeModelListener l)
Empty implementation

Specified by:
removeTreeModelListener in interface javax.swing.tree.TreeModel

valueForPathChanged

public void valueForPathChanged(javax.swing.tree.TreePath path,
                                java.lang.Object newValue)
Empty implementation

Specified by:
valueForPathChanged in interface javax.swing.tree.TreeModel

getChild

public java.lang.Object getChild(java.lang.Object parent,
                                 int index)
Get child of parent by index in 0..N-1

Specified by:
getChild in interface javax.swing.tree.TreeModel

getChildCount

public int getChildCount(java.lang.Object parent)
Return number of children

Specified by:
getChildCount in interface javax.swing.tree.TreeModel

getIndexOfChild

public int getIndexOfChild(java.lang.Object parent,
                           java.lang.Object child)
Return index of child or -1 if not a child.

Specified by:
getIndexOfChild in interface javax.swing.tree.TreeModel

getRoot

public java.lang.Object getRoot()
Return root.

Specified by:
getRoot in interface javax.swing.tree.TreeModel

isLeaf

public boolean isLeaf(java.lang.Object node)
Return true if node is leaf.

Specified by:
isLeaf in interface javax.swing.tree.TreeModel

addChildren

protected boolean addChildren(TreeAdapterNode node)
Add children to node if not previously done, returning true.