org.jlab.coda.afecs.ui.rcgui.factory
Class ATreeFactory

java.lang.Object
  extended by org.jlab.coda.afecs.ui.rcgui.factory.ATreeFactory

public class ATreeFactory
extends java.lang.Object

JSA: Thomas Jefferson National Accelerator Facility
This software was developed under a United States Government license,
described in the NOTICE file included as part of this distribution.
Copyright (c),Oct 20, 2009


Constructor Summary
ATreeFactory(java.lang.String rootnodename)
           
 
Method Summary
 void addGeneticNode(java.lang.String grandpa, java.lang.String pa, java.lang.String name)
          Adds the component node to the typenode of the specific root (runtype, session, etc)
 void addNodeToParen(java.lang.String parent, java.lang.String child)
          Adds the new node to the parent node.
 void addNodeToTheTree(java.lang.String rootnode, java.lang.String name)
          Adds the node to the root node
 void addTreeNode(javax.swing.tree.TreePath path, java.lang.String name)
          Adds the node to the path
 javax.swing.JTree createTree(java.lang.String name, javax.swing.event.TreeSelectionListener tl)
           
 void deleteTheNode(java.lang.String nn)
           
 void drawTree(java.util.HashMap map)
           
 javax.swing.tree.TreePath findNode(java.lang.String nodename)
          Finds the node starting from the root
 javax.swing.tree.TreePath findTreeNodeByName(java.util.ArrayList<java.lang.String> al)
          Finds the path in tree as specified by the arraylist of names.
 javax.swing.tree.TreePath getExactMatch(java.lang.String name, int startingRow, javax.swing.text.Position.Bias bias)
           
 javax.swing.JTree getTree()
           
 void removeNode(javax.swing.tree.DefaultMutableTreeNode selNode)
          This method removes the passed tree node from the tree and selects appropiate node
 void removeNodeFromTheTree(java.lang.String nodename)
          Removes the node from the dalog browser tree.
 void removeTreeNode(java.lang.String name)
          removes the node specified by its name
 void removeTreeNodeStartingWith(java.lang.String prefix)
          removes the node specified by its name
 javax.swing.tree.DefaultMutableTreeNode searchNode(java.lang.String nodeStr)
          This method takes the node string and traverses the tree till it finds the node matching the string.
 void updateTree(java.lang.String[] addr)
          Updates the tree based on the String array composed of agent expid, session, runtype, type, name
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ATreeFactory

public ATreeFactory(java.lang.String rootnodename)
Method Detail

createTree

public javax.swing.JTree createTree(java.lang.String name,
                                    javax.swing.event.TreeSelectionListener tl)

getTree

public javax.swing.JTree getTree()

addTreeNode

public void addTreeNode(javax.swing.tree.TreePath path,
                        java.lang.String name)
Adds the node to the path

Parameters:
path - TreePath object
name - the name of the branch

removeTreeNodeStartingWith

public void removeTreeNodeStartingWith(java.lang.String prefix)
removes the node specified by its name

Parameters:
prefix - of the name of the node

removeTreeNode

public void removeTreeNode(java.lang.String name)
removes the node specified by its name

Parameters:
name - of the node

getExactMatch

public javax.swing.tree.TreePath getExactMatch(java.lang.String name,
                                               int startingRow,
                                               javax.swing.text.Position.Bias bias)

findTreeNodeByName

public javax.swing.tree.TreePath findTreeNodeByName(java.util.ArrayList<java.lang.String> al)
Finds the path in tree as specified by the arraylist of names. The names arraylist is a sequence of names where the first is the root and i'th is a child of i-1. Returns null if not found.

Parameters:
al - array list of the names
Returns:
object of TreePath

drawTree

public void drawTree(java.util.HashMap map)

updateTree

public void updateTree(java.lang.String[] addr)
Updates the tree based on the String array composed of agent expid, session, runtype, type, name

Parameters:
addr - arr of Strings

addNodeToParen

public void addNodeToParen(java.lang.String parent,
                           java.lang.String child)
Adds the new node to the parent node. If there is a node with the same name it will remove it before adding the new one.

Parameters:
parent - The name of the parent node
child - The name of the child node

findNode

public javax.swing.tree.TreePath findNode(java.lang.String nodename)
Finds the node starting from the root

Parameters:
nodename - The name of the node
Returns:
node MutableTreeNode object

removeNodeFromTheTree

public void removeNodeFromTheTree(java.lang.String nodename)
Removes the node from the dalog browser tree. If the node has descendants all descendants are removed as well.

Parameters:
nodename - The name of the node

deleteTheNode

public void deleteTheNode(java.lang.String nn)
Parameters:
nn - node name to be remved

searchNode

public javax.swing.tree.DefaultMutableTreeNode searchNode(java.lang.String nodeStr)
This method takes the node string and traverses the tree till it finds the node matching the string. If the match is found the node is returned else null is returned

Parameters:
nodeStr - node string to search for
Returns:
tree node

removeNode

public void removeNode(javax.swing.tree.DefaultMutableTreeNode selNode)
This method removes the passed tree node from the tree and selects appropiate node

Parameters:
selNode - node to be removed

addNodeToTheTree

public void addNodeToTheTree(java.lang.String rootnode,
                             java.lang.String name)
Adds the node to the root node

Parameters:
rootnode - the name of the root node
name - the name of the branch

addGeneticNode

public void addGeneticNode(java.lang.String grandpa,
                           java.lang.String pa,
                           java.lang.String name)
Adds the component node to the typenode of the specific root (runtype, session, etc)

Parameters:
grandpa - the name of the parent of the parent node
pa - the name of the parent node
name - the name of the component node