|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--prolog.treeview.Tree
implements a tree class able to layout and paint a amount of nodes. the tree must me contained in a container
| Field Summary | |
protected javax.swing.JComponent |
container
the container containing this tree |
protected java.awt.Rectangle |
rect
the position this tree has in the containing container |
protected RootNode |
root
the root node of this tree |
| Constructor Summary | |
Tree()
constructor |
|
| Method Summary | |
void |
doLayout()
layouts this tree |
protected void |
doLayout(Node n,
int x,
int y)
the recursive layout method |
boolean |
exportXml(java.lang.String filename)
saves the tree as xml |
void |
genXml(java.io.Writer out)
generates xml representing this object |
protected int |
getChildsWidth(Node n)
returns the width of the childs of this node |
javax.swing.JComponent |
getContainer()
returns the container which contains this tree |
java.awt.Rectangle |
getPosition()
returns the position the tree has in container |
java.awt.Dimension |
getPreferredSize()
returns the preferred size of this tree |
protected int |
getRecursiveWidth(Node n)
returns recusive the total width of the given node and all of its child nodes |
protected int |
getRecursiveWidth(Node n,
int layer)
returns recusive the total width of the given node and all of its child nodes |
RootNode |
getRoot()
returns the root of this tree |
void |
paint(java.awt.Graphics g)
paints this tree |
void |
paintLines(java.awt.Graphics2D g)
paints all lines between the nodes |
protected void |
paintNodes(java.awt.Graphics2D g)
paints all nodes |
void |
repaint()
invokes the containers repaint method |
void |
setContainer(javax.swing.JComponent c)
sets the container which contains this tree |
void |
setPosition(java.awt.Rectangle r)
sets the position the tree has in the container |
void |
setRoot(RootNode node)
sets the root of this tree |
void |
updateTree()
layouts the tree and invokes repaint |
| Methods inherited from class java.lang.Object |
|
| Field Detail |
protected RootNode root
protected java.awt.Rectangle rect
protected javax.swing.JComponent container
| Constructor Detail |
public Tree()
| Method Detail |
public void setPosition(java.awt.Rectangle r)
public java.awt.Rectangle getPosition()
public void setContainer(javax.swing.JComponent c)
public javax.swing.JComponent getContainer()
public void repaint()
public void setRoot(RootNode node)
public RootNode getRoot()
protected void paintNodes(java.awt.Graphics2D g)
g - - the graphics context to paint inpublic void paintLines(java.awt.Graphics2D g)
g - - the graphics context to paint inpublic void paint(java.awt.Graphics g)
g - - the graphics context to paint inpublic void doLayout()
public void updateTree()
protected void doLayout(Node n,
int x,
int y)
n - - the current nodex - - the middle of the new nodey - - the new yprotected int getChildsWidth(Node n)
protected int getRecursiveWidth(Node n)
protected int getRecursiveWidth(Node n,
int layer)
public void genXml(java.io.Writer out)
throws java.io.IOException
out - - the writer where to append the xmljava.io.IOException - public boolean exportXml(java.lang.String filename)
filename - - the filename to save the filepublic java.awt.Dimension getPreferredSize()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||