Synergy Home Page

au.edu.swin.synergy.lib
Class BTreeModel

java.lang.Object
  |
  +--au.edu.swin.synergy.lib.BTreeModel
Direct Known Subclasses:
BWorkspaceTreeModel

public class BTreeModel
extends Object
implements BTreeModelInterface, BTreeNode

A reusable tree model that can contain any implementaion of a TreeNode

Author:
Matthew Evans

Field Summary
protected  Vector branches
          The collection of branches in the tree
 
Constructor Summary
BTreeModel(String name)
          Creates a new tree model, and gives it a name
 
Method Summary
 boolean add(BTreeNode branch)
           
 void addBranch(BTreeNode branch)
           
 void addTreeModelListener(TreeModelListener l)
           
 void fireInserted(TreeModelEvent e)
           
protected  void fireNodesInserted()
           
protected  void fireNodesRemoved()
           
 void fireRemoved(TreeModelEvent e)
           
protected  void fireStructureChanged()
           
 Vector getBranches()
           
 Object getChild(Object parent, int index)
           
 Object getChildAt(int index)
           
 int getChildCount()
           
 int getChildCount(Object parent)
           
 int getIndexOf(Object node)
           
 int getIndexOfChild(Object parent, Object child)
           
 String getName()
           
 Object getParent()
           
 Object getRoot()
           
 boolean isLeaf()
           
 boolean isLeaf(Object node)
           
 void nodeWasInserted(BTreeNode node, int index, BTreeNode added)
           
 void nodeWasRemoved(BTreeNode node, int index, BTreeNode removed)
           
 boolean remove(BTreeNode branch)
           
 void removeAllChildren()
           
 void removeBranch(BTreeNode branch)
           
 void removeTreeModelListener(TreeModelListener listener)
           
 void setName(String newUserName)
          Sets the name of the tree model to the title specified.
 void setParent(Object parent)
           
 String toString()
          Returns the name of the workspace, so it can be displayed on the tree for the root node
 void valueForPathChanged(TreePath path, Object newValue)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

branches

protected Vector branches
The collection of branches in the tree
Constructor Detail

BTreeModel

public BTreeModel(String name)
Creates a new tree model, and gives it a name
Parameters:
name - the name of the model
Method Detail

setName

public void setName(String newUserName)
Sets the name of the tree model to the title specified. This will be reflected on the screen immediately
Specified by:
setName in interface BTreeNode
Parameters:
newPackageName - The name of the package

getName

public String getName()
Specified by:
getName in interface BTreeNode

addBranch

public void addBranch(BTreeNode branch)

removeBranch

public void removeBranch(BTreeNode branch)

getBranches

public Vector getBranches()

addTreeModelListener

public void addTreeModelListener(TreeModelListener l)

getChild

public Object getChild(Object parent,
                       int index)

getChildCount

public int getChildCount(Object parent)

getIndexOfChild

public int getIndexOfChild(Object parent,
                           Object child)

getRoot

public Object getRoot()

isLeaf

public boolean isLeaf(Object node)

removeTreeModelListener

public void removeTreeModelListener(TreeModelListener listener)

valueForPathChanged

public void valueForPathChanged(TreePath path,
                                Object newValue)

nodeWasInserted

public void nodeWasInserted(BTreeNode node,
                            int index,
                            BTreeNode added)

nodeWasRemoved

public void nodeWasRemoved(BTreeNode node,
                           int index,
                           BTreeNode removed)

fireStructureChanged

protected void fireStructureChanged()

fireNodesInserted

protected void fireNodesInserted()

fireNodesRemoved

protected void fireNodesRemoved()

fireInserted

public void fireInserted(TreeModelEvent e)
Specified by:
fireInserted in interface BTreeModelInterface

fireRemoved

public void fireRemoved(TreeModelEvent e)
Specified by:
fireRemoved in interface BTreeModelInterface

toString

public String toString()
Returns the name of the workspace, so it can be displayed on the tree for the root node
Returns:
the name of the workspace
Overrides:
toString in class Object

add

public boolean add(BTreeNode branch)

remove

public boolean remove(BTreeNode branch)

isLeaf

public boolean isLeaf()
Specified by:
isLeaf in interface BTreeNode

getChildAt

public Object getChildAt(int index)
Specified by:
getChildAt in interface BTreeNode

getChildCount

public int getChildCount()
Specified by:
getChildCount in interface BTreeNode

getParent

public Object getParent()
Specified by:
getParent in interface BTreeNode

getIndexOf

public int getIndexOf(Object node)
Specified by:
getIndexOf in interface BTreeNode

setParent

public void setParent(Object parent)
Specified by:
setParent in interface BTreeNode

removeAllChildren

public void removeAllChildren()
Specified by:
removeAllChildren in interface BTreeNode

Synergy Home Page