|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JTree
wt.clients.widgets.JIBATree
------------------------------------------------------------ This class extends JTree and provide some extended functionalities acrossing the IBA. It contains a hashtable which takes the ObjectID as the key and the DefaultMutableTreeNode as the object. It provides easier methods to find specific node. It also provides the choices of linear search and binary search for sorting the tree. The search will be done when the user add the node or update the node.
Nested Class Summary |
Nested classes inherited from class javax.swing.JTree |
JTree.AccessibleJTree, JTree.DynamicUtilTreeNode, JTree.EmptySelectionModel, JTree.TreeModelHandler, JTree.TreeSelectionRedirector |
Nested classes inherited from class javax.swing.JComponent |
JComponent.AccessibleJComponent |
Nested classes inherited from class java.awt.Container |
Container.AccessibleAWTContainer |
Nested classes inherited from class java.awt.Component |
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy |
Field Summary | |
private DefaultTreeModel |
defaultTreeModel
|
private boolean |
multiRoot
|
private Hashtable |
nodeTable
|
Fields inherited from class javax.swing.JComponent |
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
Fields inherited from class java.awt.Container |
|
Fields inherited from class java.awt.Component |
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
Fields inherited from interface java.awt.image.ImageObserver |
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
JIBATree(boolean multiRoot)
Constructor to construct the tree. |
Method Summary | |
void |
addEntry(DefaultMutableTreeNode node)
Add a new entry in the hashtable |
private int |
addInOrderBinarySearch(DefaultMutableTreeNode parent,
DefaultMutableTreeNode node)
Do a binary search on the children of the parent node and return the position which this node should add to. |
void |
addNode(DefaultMutableTreeNode parent,
DefaultMutableTreeNode node)
This method will add the node to the parent node. |
JToolTip |
createToolTip()
|
void |
expandNode(DefaultMutableTreeNode node)
Expand the tree node |
void |
expandNode(Object obj)
Expand the tree node |
DefaultMutableTreeNode |
findNode(Object obj)
Method to find a node from the user object using the hashtable |
DefaultMutableTreeNode |
findNode(String key)
Method to find a node from the key (ObjectID) using the hashtable |
Enumeration |
getKeys()
Return the Enumeration of keys of the hashtable |
DefaultMutableTreeNode |
getRoot()
Return the root of the tree |
DefaultMutableTreeNode |
getSelectedNode()
Get the selected node |
Vector |
getSelectedNodes()
Get the selected nodes |
Object |
getSelectedObject()
Get the selected User Object |
Vector |
getSelectedObjects()
Get the selected User Objects |
String |
getToolTipText(MouseEvent evt)
|
DefaultTreeModel |
getTreeModel()
Method to return the DefaultTreeModel this tree is using |
Enumeration |
getValues()
Return the enumeration of values of the hashtable |
void |
nodeStructureChanged(DefaultMutableTreeNode node)
Call the nodeStructureChanged method from the DefaultTreeModel |
void |
removeAllChildren(DefaultMutableTreeNode node)
This method will remove the node children from itself. |
boolean |
removeEntry(Object obj)
Remove the entry in the hashtable |
void |
removeNode(DefaultMutableTreeNode parent,
DefaultMutableTreeNode node)
This method will remove the node from it's parent. |
void |
selectAndExpandNode(DefaultMutableTreeNode node)
Select and expand the tree node |
void |
selectAndExpandNode(Object obj)
Select and expand the tree node |
void |
selectNode(DefaultMutableTreeNode node)
Select the tree node |
void |
selectNode(Object obj)
Slect the tree node |
void |
setMultiSelection(boolean multi)
Set the tree Selection as SINGLE or DISCONTIGUOUS |
void |
setRoot(DefaultMutableTreeNode root)
Set the root of this tree to root |
void |
setTreeProperties()
This method is for setting the multiroot tree properties. |
void |
updateNode(DefaultMutableTreeNode node,
Object obj)
This method will update the node with the new object. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
private boolean multiRoot
private Hashtable nodeTable
private DefaultTreeModel defaultTreeModel
Constructor Detail |
public JIBATree(boolean multiRoot)
multiRoot
- indicate whether it's a multiroot or notMethod Detail |
public void setTreeProperties()
public void setMultiSelection(boolean multi)
multi
- boolean; false indiciate SINGLE.public DefaultTreeModel getTreeModel()
public DefaultMutableTreeNode getRoot()
public void setRoot(DefaultMutableTreeNode root)
root
- the root to be setpublic Enumeration getKeys()
public Enumeration getValues()
public DefaultMutableTreeNode findNode(String key)
public DefaultMutableTreeNode findNode(Object obj)
obj
- Object as the key
public void addEntry(DefaultMutableTreeNode node)
node
- New node to add to the hashtablepublic boolean removeEntry(Object obj)
obj
- Object key which will be removed from the hashtable
public void addNode(DefaultMutableTreeNode parent, DefaultMutableTreeNode node)
parent
- DefaultMutableTreeNode parent nodeprivate int addInOrderBinarySearch(DefaultMutableTreeNode parent, DefaultMutableTreeNode node)
parent
- DefaultMutableTreeNode which the node will be added to.
public void removeNode(DefaultMutableTreeNode parent, DefaultMutableTreeNode node)
parent
- DefaultMutableTreeNode parent nodepublic void removeAllChildren(DefaultMutableTreeNode node)
public void updateNode(DefaultMutableTreeNode node, Object obj)
node
- DefaultMutableTreeNode to be updatedobj
- Object that will be put into the nodepublic void nodeStructureChanged(DefaultMutableTreeNode node)
public DefaultMutableTreeNode getSelectedNode()
public Object getSelectedObject()
public Vector getSelectedNodes()
public Vector getSelectedObjects()
public void selectNode(DefaultMutableTreeNode node)
node
- node to be selectedpublic void selectNode(Object obj)
obj
- object that the selected node will containpublic void expandNode(DefaultMutableTreeNode node)
node
- node to be expandedpublic void expandNode(Object obj)
obj
- object that the expanded node will containpublic void selectAndExpandNode(DefaultMutableTreeNode node)
node
- node to be selected and expandedpublic void selectAndExpandNode(Object obj)
obj
- object that the selected and expanded node will containpublic String getToolTipText(MouseEvent evt)
public JToolTip createToolTip()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |