ciips.animation.tree
Class MultiwayTree
java.lang.Object
|
+--ciips.animation.tree.BasicNode
|
+--ciips.animation.tree.MultiNode
|
+--ciips.animation.tree.MultiwayTree
- public class MultiwayTree
- extends MultiNode
This class regards a TreeNode as a binary tree.
Its draw method draws the descending arcs also.
- See Also:
TreeNode,
DrawingPanel.addDrawingObj(ciips.animation.DrawingObj),
DrawingPanel.removeObj(ciips.animation.DrawingObj)
| Fields inherited from class ciips.animation.tree.BasicNode |
depth, diff_x, diff_y, highlight, highlightNode, label, node_dim, nodeColor, weight, x, y |
|
Method Summary |
void |
displace(int dx,
int dy)
Displace the tree starting with node dx pixels to the right and dy
pixels down. |
void |
draw(java.awt.Graphics g)
This method draws the node on the corresponding graphical context
normally passed in from the drawing panel. |
static void |
drawEdge(java.awt.Graphics g,
MultiNode parent,
MultiNode child,
boolean highlight)
|
void |
drawSubTree(java.awt.Graphics g)
Draw a node and its subtree |
void |
move(int x,
int y)
Move the node and all its branches based on the parameters. |
void |
setDepth(int depth)
Sets the depth of this node corresponding to the root node of the tree. |
void |
setPosition(int x,
int y,
int dx,
int dy)
Start at a node and set the positions for the sub-tree elements |
| Methods inherited from class ciips.animation.tree.BasicNode |
getData, getDepth, getHighlight, getLabel, getX, getY, initColors, initFonts, setColour, setHighlight, setLabel, setLabelColour, setWeight, setX, setXY, setY, unHighlight |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
size
public int size
MultiwayTree
public MultiwayTree()
- Create a new tree
setPosition
public void setPosition(int x,
int y,
int dx,
int dy)
- Start at a node and set the positions for the sub-tree elements
- Overrides:
setPosition in class MultiNode
setDepth
public void setDepth(int depth)
- Sets the depth of this node corresponding to the root node of the tree.
- Overrides:
setDepth in class BasicNode
- Parameters:
depth - Depth of the node.
move
public void move(int x,
int y)
- Move the node and all its branches based on the parameters.
- Overrides:
move in class MultiNode
- Parameters:
x - The horizontal destination position of this node.y - The vertical destination position of this node.
displace
public void displace(int dx,
int dy)
- Displace the tree starting with node dx pixels to the right and dy
pixels down.
- Overrides:
displace in class MultiNode
- Parameters:
node - The root node of the tree to be moved.dx - The change in x direction.dy - The change in y direction.
drawSubTree
public void drawSubTree(java.awt.Graphics g)
- Draw a node and its subtree
- Overrides:
drawSubTree in class MultiNode
drawEdge
public static void drawEdge(java.awt.Graphics g,
MultiNode parent,
MultiNode child,
boolean highlight)
draw
public void draw(java.awt.Graphics g)
- This method draws the node on the corresponding graphical context
normally passed in from the drawing panel.
- Overrides:
draw in class BasicNode