org.ozoneDB.adminGui.feature.account.groups
Class GroupTreeModel

java.lang.Object
  extended byorg.ozoneDB.adminGui.feature.account.groups.GroupTreeModel
All Implemented Interfaces:
javax.swing.tree.TreeModel

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

This class is used to manage the group table.

Version:
1.0
Author:

Ibsen Ramos-Bonilla
Copyright © 1997-2004 by SMB GmbH. All Rights Reserved.


Constructor Summary
GroupTreeModel()
          Overloaded constructor begins building the model from the root.
 
Method Summary
 void addTreeModelListener(javax.swing.event.TreeModelListener l)
          Adds a listener for the TreeModelEvent posted after the tree changes.
 void clearGroups()
          This method clears the tree information.
 void fireTreeStructureChanged()
          The only event raised by this model is TreeStructureChanged with the root as path, i.e. the whole tree has changed.
 java.lang.Object getChild(java.lang.Object parent, int index)
          This method returns the child of parent at index index in the parent's child array.
 int getChildCount(java.lang.Object parent)
          This method returns the number of children of parent.
 int getIndexOfChild(java.lang.Object parent, java.lang.Object child)
          This method returns the index of child in parent.
 java.lang.Object getRoot()
          This method returns the root of the tree.
 AccountItem getRootItem()
          This method returns a reference to the root item.
 boolean isLeaf(java.lang.Object node)
          This method returns true if node is a leaf.
 void removeTreeModelListener(javax.swing.event.TreeModelListener l)
          Removes a listener previously added with addTreeModelListener().
 void valueForPathChanged(javax.swing.tree.TreePath path, java.lang.Object newValue)
          Messaged when the account 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
 

Constructor Detail

GroupTreeModel

public GroupTreeModel()
Overloaded constructor begins building the model from the root.

Method Detail

addTreeModelListener

public void addTreeModelListener(javax.swing.event.TreeModelListener l)
Adds a listener for the TreeModelEvent posted after the tree changes.

Specified by:
addTreeModelListener in interface javax.swing.tree.TreeModel
Parameters:
l - - a tree model listener.

removeTreeModelListener

public void removeTreeModelListener(javax.swing.event.TreeModelListener l)
Removes a listener previously added with addTreeModelListener().

Specified by:
removeTreeModelListener in interface javax.swing.tree.TreeModel
Parameters:
l - - a tree model listener.

getRoot

public java.lang.Object getRoot()
This method returns the root of the tree.

Specified by:
getRoot in interface javax.swing.tree.TreeModel
Returns:
Object - root item.

isLeaf

public boolean isLeaf(java.lang.Object node)
This method returns true if node is a leaf.

Specified by:
isLeaf in interface javax.swing.tree.TreeModel
Parameters:
node - - the selected node.
Returns:
boolean - TRUE = node is a leaf. FALSE = node is not a leaf.

getChildCount

public int getChildCount(java.lang.Object parent)
This method returns the number of children of parent.

Specified by:
getChildCount in interface javax.swing.tree.TreeModel
Parameters:
parent - - the parent of the child count.
Returns:
int - the number of children.

getIndexOfChild

public int getIndexOfChild(java.lang.Object parent,
                           java.lang.Object child)
This method returns the index of child in parent.

Specified by:
getIndexOfChild in interface javax.swing.tree.TreeModel
Parameters:
parent - - the parent to check connection to.
child - - the child to find conenction from.
Returns:
int - index of selected child.

valueForPathChanged

public void valueForPathChanged(javax.swing.tree.TreePath path,
                                java.lang.Object newValue)
Messaged when the account has altered the value for the item identified by path to newValue. Not used by this model.

Specified by:
valueForPathChanged in interface javax.swing.tree.TreeModel
Parameters:
path - - the path to the selected node.
newValue - - the value for the path node changed.

getChild

public java.lang.Object getChild(java.lang.Object parent,
                                 int index)
This method returns the child of parent at index index in the parent's child array.

Specified by:
getChild in interface javax.swing.tree.TreeModel
Parameters:
parent - - the parent to search for a child.
index - - the desired children pointed by the parent.
Returns:
Object - parent's child.

fireTreeStructureChanged

public void fireTreeStructureChanged()
The only event raised by this model is TreeStructureChanged with the root as path, i.e. the whole tree has changed.


getRootItem

public AccountItem getRootItem()
This method returns a reference to the root item.

Returns:
AccountItem - the root item.

clearGroups

public void clearGroups()
This method clears the tree information.



Copyright © 2004 The Ozone Database Project - www.ozone-db.org. All Rights Reserved.