com.lowagie.rups.view.itext.treenodes
Class PdfObjectTreeNode

java.lang.Object
  extended by javax.swing.tree.DefaultMutableTreeNode
      extended by com.lowagie.rups.view.icons.IconTreeNode
          extended by com.lowagie.rups.view.itext.treenodes.PdfObjectTreeNode
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, javax.swing.tree.MutableTreeNode, javax.swing.tree.TreeNode
Direct Known Subclasses:
PdfPagesTreeNode, PdfPageTreeNode, PdfTrailerTreeNode

public class PdfObjectTreeNode
extends IconTreeNode

Every node in our tree corresponds with a PDF object. This class is the superclass of all tree nodes used.

See Also:
Serialized Form

Field Summary
protected  PdfName key
          the key if the parent of this node is a dictionary.
protected  int number
          if the object is indirect, the number of the PDF object.
protected  PdfObject object
          the PDF object corresponding with this node.
protected  boolean recursive
          indicates if the object is indirect and recursive.
 
Fields inherited from class com.lowagie.rups.view.icons.IconTreeNode
icon
 
Fields inherited from class javax.swing.tree.DefaultMutableTreeNode
allowsChildren, children, EMPTY_ENUMERATION, parent, userObject
 
Constructor Summary
protected PdfObjectTreeNode(PdfObject object)
          Creates a tree node for a PDF object.
protected PdfObjectTreeNode(java.lang.String icon, PdfObject object)
          Creates a tree node for a PDF object.
 
Method Summary
 PdfObjectTreeNode getAncestor()
          Gets the tree path of an ancestor.
static java.lang.String getCaption(PdfObject object)
          Creates the caption for a PDF object.
static java.lang.String getDictionaryEntryCaption(PdfDictionary dict, PdfName key)
          Creates the caption for an object that is a dictionary entry.
static PdfObjectTreeNode getInstance(PdfDictionary dict, PdfName key)
          Creates an instance of a tree node for the object corresponding with a key in a dictionary.
static PdfObjectTreeNode getInstance(PdfObject object)
          Creates an instance of a tree node for a PDF object.
static PdfObjectTreeNode getInstance(PdfObject object, int number)
          Creates an instance of a tree node for an indirect object.
 int getNumber()
          Getter for the object number in case the object is indirect.
 PdfObject getPdfObject()
          Getter for the PDF Object.
 boolean isArray()
          Tells you if the node contains an array.
 boolean isDictionary()
          Tells you if the node contains a dictionary.
 boolean isDictionaryNode(PdfName key)
          Checks if this node is a dictionary item with a specific key.
 boolean isIndirect()
          Tells you if the object is indirect.
 boolean isIndirectReference()
          Tells you if the node contains an indirect reference.
 boolean isRecursive()
          Tells you if the object is a reference to a node higher up in the tree.
 boolean isStream()
          Tells you if the node contains a stream.
 void setRecursive(boolean recursive)
          Set this to true if the object is a reference to a node higher up in the tree.
 
Methods inherited from class com.lowagie.rups.view.icons.IconTreeNode
getIcon
 
Methods inherited from class javax.swing.tree.DefaultMutableTreeNode
add, breadthFirstEnumeration, children, clone, depthFirstEnumeration, getAllowsChildren, getChildAfter, getChildAt, getChildBefore, getChildCount, getDepth, getFirstChild, getFirstLeaf, getIndex, getLastChild, getLastLeaf, getLeafCount, getLevel, getNextLeaf, getNextNode, getNextSibling, getParent, getPath, getPathToRoot, getPreviousLeaf, getPreviousNode, getPreviousSibling, getRoot, getSharedAncestor, getSiblingCount, getUserObject, getUserObjectPath, insert, isLeaf, isNodeAncestor, isNodeChild, isNodeDescendant, isNodeRelated, isNodeSibling, isRoot, pathFromAncestorEnumeration, postorderEnumeration, preorderEnumeration, remove, remove, removeAllChildren, removeFromParent, setAllowsChildren, setParent, setUserObject, toString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

object

protected PdfObject object
the PDF object corresponding with this node.


key

protected PdfName key
the key if the parent of this node is a dictionary.


number

protected int number
if the object is indirect, the number of the PDF object.


recursive

protected boolean recursive
indicates if the object is indirect and recursive.

Constructor Detail

PdfObjectTreeNode

protected PdfObjectTreeNode(PdfObject object)
Creates a tree node for a PDF object.

Parameters:
object - the PDF object represented by this tree node.

PdfObjectTreeNode

protected PdfObjectTreeNode(java.lang.String icon,
                            PdfObject object)
Creates a tree node for a PDF object.

Parameters:
icon - the file with the icon
object - the PDF object represented by this tree node.
Method Detail

getInstance

public static PdfObjectTreeNode getInstance(PdfObject object)
Creates an instance of a tree node for a PDF object.

Parameters:
object - the PDF object represented by this tree node.
Returns:
a PdfObjectTreeNode

getInstance

public static PdfObjectTreeNode getInstance(PdfObject object,
                                            int number)
Creates an instance of a tree node for an indirect object.

Parameters:
object - the PDF object represented by this tree node.
number - the xref number of the indirect object
Returns:
a PdfObjectTreeNode

getInstance

public static PdfObjectTreeNode getInstance(PdfDictionary dict,
                                            PdfName key)
Creates an instance of a tree node for the object corresponding with a key in a dictionary.

Parameters:
dict - the dictionary that is the parent of this tree node.
key - the dictionary key corresponding with the PDF object in this tree node.
Returns:
a PdfObjectTreeNode

getPdfObject

public PdfObject getPdfObject()
Getter for the PDF Object.

Returns:
the PDF object represented by this tree node.

getNumber

public int getNumber()
Getter for the object number in case the object is indirect.

Returns:
-1 for direct objects; the object number for indirect objects

isIndirectReference

public boolean isIndirectReference()
Tells you if the node contains an indirect reference.

Returns:
true if the object is an indirect reference

isIndirect

public boolean isIndirect()
Tells you if the object is indirect.

Returns:
true for indirect objects; false for direct objects.

isArray

public boolean isArray()
Tells you if the node contains an array.

Returns:
true if the object is a PdfArray

isDictionaryNode

public boolean isDictionaryNode(PdfName key)
Checks if this node is a dictionary item with a specific key.

Parameters:
key - the key of the node we're looking for

isDictionary

public boolean isDictionary()
Tells you if the node contains a dictionary.

Returns:
true if the object is a PdfDictionary

isStream

public boolean isStream()
Tells you if the node contains a stream.

Returns:
true if the object is a PRStream

setRecursive

public void setRecursive(boolean recursive)
Set this to true if the object is a reference to a node higher up in the tree.

Parameters:
recursive - true if the object is indirect and recursive

isRecursive

public boolean isRecursive()
Tells you if the object is a reference to a node higher up in the tree.

Returns:
true if the node is used recursively.

getCaption

public static java.lang.String getCaption(PdfObject object)
Creates the caption for a PDF object.

Parameters:
object - the object for which a caption has to be created.
Returns:
a caption for a PDF object

getDictionaryEntryCaption

public static java.lang.String getDictionaryEntryCaption(PdfDictionary dict,
                                                         PdfName key)
Creates the caption for an object that is a dictionary entry.

Parameters:
dict - a dictionary
key - a key in the dictionary
Returns:
a caption for the object corresponding with the key in the dictionary.

getAncestor

public PdfObjectTreeNode getAncestor()
Gets the tree path of an ancestor. This only works with recursive references

Returns:
the treepath to an ancestor


iText 2.1.7