com.lowagie.rups.model

Class TreeNodeFactory

public class TreeNodeFactory extends Object

A factory that creates TreeNode objects corresponding with PDF objects.
Field Summary
protected ArrayList<PdfObjectTreeNode>nodes
An list containing the nodes of every indirect object.
protected IndirectObjectFactoryobjects
The factory that can produce all indirect objects.
Constructor Summary
TreeNodeFactory(IndirectObjectFactory objects)
Creates a factory that can produce TreeNode objects corresponding with PDF objects.
Method Summary
voidaddNodes(PdfObjectTreeNode parent, PdfObjectTreeNode child)
Tries adding a child node to a parent node without throwing an exception.
voidexpandNode(PdfObjectTreeNode node)
Creates the Child TreeNode objects for a PDF object TreeNode.
PdfObjectTreeNodegetChildNode(PdfObjectTreeNode node, PdfName key)
Finds a specific child of dictionary node.
PdfObjectTreeNodegetNode(int ref)
Gets a TreeNode for an indirect objects.

Field Detail

nodes

protected ArrayList<PdfObjectTreeNode> nodes
An list containing the nodes of every indirect object.

objects

protected IndirectObjectFactory objects
The factory that can produce all indirect objects.

Constructor Detail

TreeNodeFactory

public TreeNodeFactory(IndirectObjectFactory objects)
Creates a factory that can produce TreeNode objects corresponding with PDF objects.

Parameters: objects a factory that can produce all the indirect objects of a PDF file.

Method Detail

addNodes

private void addNodes(PdfObjectTreeNode parent, PdfObjectTreeNode child)
Tries adding a child node to a parent node without throwing an exception. Normally, if the child node is already added as one of the ancestors, an IllegalArgumentException is thrown (to avoid an endless loop). Loops like this are allowed in PDF, not in a JTree.

Parameters: parent the parent node child a child node

expandNode

public void expandNode(PdfObjectTreeNode node)
Creates the Child TreeNode objects for a PDF object TreeNode.

Parameters: node the parent node

getChildNode

public PdfObjectTreeNode getChildNode(PdfObjectTreeNode node, PdfName key)
Finds a specific child of dictionary node.

Parameters: node the node with a dictionary among its children key the key of the item corresponding with the node we need

getNode

public PdfObjectTreeNode getNode(int ref)
Gets a TreeNode for an indirect objects.

Parameters: ref the reference number of the indirect object.

Returns: the TreeNode representing the PDF object