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 |
branches
protected Vector branches
- The collection of branches in the tree
BTreeModel
public BTreeModel(String name)
- Creates a new tree model, and gives it a name
- Parameters:
name
- the name of the model
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