org.apache.batik.gvt

Class GVTTreeWalker

public class GVTTreeWalker extends Object

GVTTreeWalker objects are used to navigate a GVT tree or subtree.
Field Summary
protected GraphicsNodecurrentNode
The current GraphicsNode.
protected GraphicsNodegvtRoot
The GVT root into which text is searched.
protected GraphicsNodetreeRoot
The root of the subtree of the GVT which is traversed.
Constructor Summary
GVTTreeWalker(GraphicsNode treeRoot)
Constructs a new GVTTreeWalker.
Method Summary
GraphicsNodefirstChild()
Returns the first child of the current GraphicsNode.
GraphicsNodegetCurrentGraphicsNode()
Returns the current GraphicsNode.
protected static GraphicsNodegetFirstChild(GraphicsNode node)
GraphicsNodegetGVTRoot()
Returns the GVT root graphics node.
protected static GraphicsNodegetLastChild(GraphicsNode node)
protected GraphicsNodegetNextGraphicsNode(GraphicsNode node)
GraphicsNodegetNextSibling()
Returns the next sibling of the current GraphicsNode.
protected static GraphicsNodegetNextSibling(GraphicsNode node)
protected GraphicsNodegetPreviousGraphicsNode(GraphicsNode node)
GraphicsNodegetPreviousSibling()
Returns the next previous of the current GraphicsNode.
protected static GraphicsNodegetPreviousSibling(GraphicsNode node)
GraphicsNodegetRoot()
Returns the root graphics node.
GraphicsNodelastChild()
Returns the last child of the current GraphicsNode.
GraphicsNodenextGraphicsNode()
Returns the next GraphicsNode.
GraphicsNodeparentGraphicsNode()
Returns the parent of the current GraphicsNode.
GraphicsNodepreviousGraphicsNode()
Returns the previous GraphicsNode.
voidsetCurrentGraphicsNode(GraphicsNode node)
Sets the current GraphicsNode to the specified node.

Field Detail

currentNode

protected GraphicsNode currentNode
The current GraphicsNode.

gvtRoot

protected GraphicsNode gvtRoot
The GVT root into which text is searched.

treeRoot

protected GraphicsNode treeRoot
The root of the subtree of the GVT which is traversed.

Constructor Detail

GVTTreeWalker

public GVTTreeWalker(GraphicsNode treeRoot)
Constructs a new GVTTreeWalker.

Parameters: treeRoot the top of the graphics node tree to search

Method Detail

firstChild

public GraphicsNode firstChild()
Returns the first child of the current GraphicsNode. If the current graphics node does not have a first child, returns null and retains the current node.

getCurrentGraphicsNode

public GraphicsNode getCurrentGraphicsNode()
Returns the current GraphicsNode.

getFirstChild

protected static GraphicsNode getFirstChild(GraphicsNode node)

getGVTRoot

public GraphicsNode getGVTRoot()
Returns the GVT root graphics node.

getLastChild

protected static GraphicsNode getLastChild(GraphicsNode node)

getNextGraphicsNode

protected GraphicsNode getNextGraphicsNode(GraphicsNode node)

getNextSibling

public GraphicsNode getNextSibling()
Returns the next sibling of the current GraphicsNode. If the current graphics node does not have a next sibling, returns null and retains the current node.

getNextSibling

protected static GraphicsNode getNextSibling(GraphicsNode node)

getPreviousGraphicsNode

protected GraphicsNode getPreviousGraphicsNode(GraphicsNode node)

getPreviousSibling

public GraphicsNode getPreviousSibling()
Returns the next previous of the current GraphicsNode. If the current graphics node does not have a previous sibling, returns null and retains the current node.

getPreviousSibling

protected static GraphicsNode getPreviousSibling(GraphicsNode node)

getRoot

public GraphicsNode getRoot()
Returns the root graphics node.

lastChild

public GraphicsNode lastChild()
Returns the last child of the current GraphicsNode. If the current graphics node does not have a last child, returns null and retains the current node.

nextGraphicsNode

public GraphicsNode nextGraphicsNode()
Returns the next GraphicsNode. If the current graphics node does not have a next node, returns null and retains the current node.

parentGraphicsNode

public GraphicsNode parentGraphicsNode()
Returns the parent of the current GraphicsNode. If the current graphics node has no parent, returns null and retains the current node.

previousGraphicsNode

public GraphicsNode previousGraphicsNode()
Returns the previous GraphicsNode. If the current graphics node does not have a previous node, returns null and retains the current node.

setCurrentGraphicsNode

public void setCurrentGraphicsNode(GraphicsNode node)
Sets the current GraphicsNode to the specified node.

Parameters: node the new current graphics node

Throws: IllegalArgumentException if the node is not part of the GVT Tree this walker is dedicated to

Copyright B) 2007 Apache Software Foundation. All Rights Reserved.