|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectca.ucalgary.innovis.NAryTreeNode
public class NAryTreeNode
This class implements a typical node that can be used for storing a hierarchical data structure and some information for representing the data structyre. Other node types can be implemented by using the TNodeModel.
| Constructor Summary | |
|---|---|
NAryTreeNode()
|
|
NAryTreeNode(java.lang.String id)
Constructor. |
|
| Method Summary | |
|---|---|
void |
addChild(NAryTreeNode child)
Adds the given node to the tree as a child. |
void |
addChild(java.lang.String id)
Creates a new node with the given id. |
java.util.Enumeration |
children()
|
boolean |
getAllowsChildren()
I don't use this but what the heck |
javax.swing.tree.TreeNode |
getChildAt(int index)
Returns the child at the current index in the list of children. |
int |
getChildCount()
Returns the number of children of this node. |
double |
getHeight()
Returns the height of the bounding box for this node. |
java.lang.String |
getID()
Returns the id for this node. |
int |
getIndex(javax.swing.tree.TreeNode n)
|
java.lang.String |
getLabel()
Returns a string representing the label for this node. |
int |
getLevel()
Returns the level of this node in the tree hierarchy. |
java.lang.Object |
getObject()
Returns the object stored in this node. |
javax.swing.tree.TreeNode |
getParent()
Returns the parent of this node. |
java.lang.String |
getType()
Returns this node's type. |
double |
getWeight()
Returns the weight (count) for this node. |
double |
getWidth()
Returns the width of the bounding box for this node. |
double |
getXPosition()
Returns the x position of the representation of this node. |
double |
getYPosition()
Returns the y position of the representation of this node. |
boolean |
isLeaf()
Returns whether this node is a leaf or not. |
void |
removeChild(NAryTreeNode child)
Removes a child from this node's list of children. |
void |
removeChildAt(int index)
Removed a child from this node's list of children. |
void |
setHeight(double height)
Sets the height of the bounding box for this node. |
void |
setID(java.lang.String id)
Sets an id or name for this node. |
void |
setLabel(java.lang.String title)
Sets a string as a label for this node. |
void |
setNodeSize(double width,
double height)
Sets the drawing size of this node. |
void |
setObject(java.lang.Object o)
Gives this node an object to store. |
void |
setPosition(double x,
double y)
Sets an arbitrary drawing position for this node |
void |
setType(java.lang.String type)
Gives the node a type. |
void |
setWeight(double nodeWeight)
Sets a variable |
void |
setWidth(double width)
Sets the width of the bounding box for this node. |
void |
setXPosition(double x)
Sets an arbitrary drawing position for this node. |
void |
setYPosition(double y)
Sets an arbitrary drawing position for this node. |
java.lang.String |
toString()
Returns a string with info about this node, containing the Node id, number of children (degree) and whether it is a leaf or not. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public NAryTreeNode()
public NAryTreeNode(java.lang.String id)
id - - the unique id of this node| Method Detail |
|---|
public void addChild(java.lang.String id)
id - unique identifier for the child. It should be unique in the whole tree.public void addChild(NAryTreeNode child)
addChild in interface NAryTreeNodeModelchild - the child to be added to this node.public void setLabel(java.lang.String title)
title - the string to be set as the label of this node.public java.lang.String getLabel()
public javax.swing.tree.TreeNode getChildAt(int index)
getChildAt in interface javax.swing.tree.TreeNodeindex - the index of the requested child in the list of children.public void removeChildAt(int index)
index - The index of the child to be removed.public void removeChild(NAryTreeNode child)
removeChild in interface NAryTreeNodeModelchild - The child to be removed.public javax.swing.tree.TreeNode getParent()
getParent in interface javax.swing.tree.TreeNodepublic void setID(java.lang.String id)
NAryTreeNodeModel
setID in interface NAryTreeNodeModelid - identifier for this node.NAryTreeNodeModel.setID(java.lang.String)public java.lang.String getID()
NAryTreeNodeModel
getID in interface NAryTreeNodeModelNAryTreeNodeModel.getID()public int getChildCount()
getChildCount in interface javax.swing.tree.TreeNodepublic boolean isLeaf()
isLeaf in interface javax.swing.tree.TreeNodepublic java.lang.String toString()
toString in class java.lang.Objectpublic void setType(java.lang.String type)
setType in interface NAryTreeNodeModeltype - the string holding a type specifier.public java.lang.String getType()
getType in interface NAryTreeNodeModelpublic void setObject(java.lang.Object o)
o - The object to store in the node.public java.lang.Object getObject()
public int getIndex(javax.swing.tree.TreeNode n)
getIndex in interface javax.swing.tree.TreeNodeTreeNode.getIndex(javax.swing.tree.TreeNode)public boolean getAllowsChildren()
getAllowsChildren in interface javax.swing.tree.TreeNodeTreeNode.getAllowsChildren()public java.util.Enumeration children()
children in interface javax.swing.tree.TreeNodeTreeNode.children()
public void setNodeSize(double width,
double height)
width - The width of the bounding box of this node.height - The height of the bounding box of this node.public double getWidth()
public double getHeight()
public void setWidth(double width)
width - The width of the bounding box for this node.public void setHeight(double height)
height - The height of the bounding box for this node.public void setXPosition(double x)
x - the x position of the representation of this nodepublic void setYPosition(double y)
y - the y position of the representation of this npde
public void setPosition(double x,
double y)
x - the position along the x-axisy - the position along the y-axispublic double getXPosition()
public double getYPosition()
public int getLevel()
getLevel in interface NAryTreeNodeModelpublic void setWeight(double nodeWeight)
nodeWeight - the weight (count) that will be saved for this node.public double getWeight()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||