JAC project
AOPSYS
CEDRIC & LIP6 labs

org.objectweb.jac.aspects.gui
Class TreeModel

java.lang.Object
  |
  +--javax.swing.tree.DefaultTreeModel
        |
        +--org.objectweb.jac.aspects.gui.TreeModel
All Implemented Interfaces:
Serializable, TreeModel, TreeView

public class TreeModel
extends DefaultTreeModel
implements TreeView

A data model for trees.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class javax.swing.tree.DefaultTreeModel
asksAllowsChildren, listenerList, root
 
Constructor Summary
TreeModel(RootNode rootNode, String rootObjects, boolean showRelations)
          Constructs a new tree model.
 
Method Summary
 void addNode(AbstractNode parent, AbstractNode child)
          Add a child node to a node
 void addNodes(AbstractNode rootNode, String curPathDef, Object substance, FieldItem relation)
           
static void addNodes(TreeView tree, ObjectNode rootNode, Object o, boolean showRelations)
          Add the children nodes for a node.
 void addTreeListener(TreeListener listener)
           
static void initTree(TreeView tree, String rootObjects, boolean showRelations)
          Initialize a tree view.
static boolean isLeafNode(TreeView tree, ObjectNode node, Object o, boolean showRelations)
          Tells wether a node is a leaf or not, without computing all its children.
 void setRootNode(AbstractNode root)
          Set the root node of the tree.
 void setSelection(TreePath selection)
          Sets the selected node for this tree.
 void unregisterEvents()
           
 
Methods inherited from class javax.swing.tree.DefaultTreeModel
addTreeModelListener, asksAllowsChildren, fireTreeNodesChanged, fireTreeNodesInserted, fireTreeNodesRemoved, fireTreeStructureChanged, getChild, getChildCount, getIndexOfChild, getListeners, getPathToRoot, getPathToRoot, getRoot, getTreeModelListeners, insertNodeInto, isLeaf, nodeChanged, nodesChanged, nodeStructureChanged, nodesWereInserted, nodesWereRemoved, reload, reload, removeNodeFromParent, removeTreeModelListener, setAsksAllowsChildren, setRoot, valueForPathChanged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.objectweb.jac.aspects.gui.TreeView
nodeChanged, nodesWereInserted, nodesWereRemoved
 

Constructor Detail

TreeModel

public TreeModel(RootNode rootNode,
                 String rootObjects,
                 boolean showRelations)
Constructs a new tree model.

Parameters:
rootNode - the root node
rootObjects - ???
showRelations - tells if the tree should show the interobjects relations as nodes
Method Detail

setRootNode

public void setRootNode(AbstractNode root)
Description copied from interface: TreeView
Set the root node of the tree.

Specified by:
setRootNode in interface TreeView
Parameters:
root - the root node

addNode

public void addNode(AbstractNode parent,
                    AbstractNode child)
Description copied from interface: TreeView
Add a child node to a node

Specified by:
addNode in interface TreeView
Parameters:
parent - the node to add the child node to
child - the node to add

addNodes

public void addNodes(AbstractNode rootNode,
                     String curPathDef,
                     Object substance,
                     FieldItem relation)

setSelection

public void setSelection(TreePath selection)
Description copied from interface: TreeView
Sets the selected node for this tree.

Specified by:
setSelection in interface TreeView
Parameters:
selection - a tree path indicating the selected node

addTreeListener

public void addTreeListener(TreeListener listener)

unregisterEvents

public void unregisterEvents()

addNodes

public static void addNodes(TreeView tree,
                            ObjectNode rootNode,
                            Object o,
                            boolean showRelations)
Add the children nodes for a node.

Parameters:
rootNode - the parent node for which to add children nodes.
o - the object represented by the rootNode

isLeafNode

public static boolean isLeafNode(TreeView tree,
                                 ObjectNode node,
                                 Object o,
                                 boolean showRelations)
Tells wether a node is a leaf or not, without computing all its children.

Parameters:
tree - The tree the node belongs to
node - the node
o - the object represented by the node
showRelations - wether to show a node for relations

initTree

public static void initTree(TreeView tree,
                            String rootObjects,
                            boolean showRelations)
Initialize a tree view.

Parameters:
tree - the tree view to initialize
rootObjects - a regular expression designating root objects
showRelations - wether to build nodes for the relations themselves

Contact JAC development team:
Renaud Pawlak
Lionel Seinturier
Laurent Martelli