com.etymon.pjx.util
Class PdfFieldTree

java.lang.Object
  extended by com.etymon.pjx.util.PdfFieldTree

public class PdfFieldTree
extends java.lang.Object

Provides methods for retrieving and modifying the field tree of a PDF document. This class is synchronized.


Nested Class Summary
protected  class PdfFieldTree.FieldTreeIterator
          An iterator over the tree of field dictionaries in a PDF document.
 
Field Summary
protected  PdfCatalog _catalog
          The catalog associated with this document.
protected static java.util.Set _inheritable
          Defines the set of inheritable field attributes.
protected static java.util.Set _inheritableAcroForm
          Defines the set of field attributes that are inheritable from the AcroForm.
protected  PdfManager _m
          The manager associated with this document.
protected  java.util.Stack _nested
          A stack for holding nested levels of field nodes.
protected static PdfName PDFNAME_ACROFORM
           
protected static PdfName PDFNAME_FIELDS
           
protected static PdfName PDFNAME_KIDS
           
protected static PdfName PDFNAME_PARENT
           
protected static PdfName PDFNAME_T
           
protected static PdfName PDFNAME_TYPE
           
 
Constructor Summary
PdfFieldTree(PdfManager manager)
          Constructs a PdfFieldTree instance based on a specified PdfManager.
 
Method Summary
protected  PdfObject getAcroForm()
          Returns the interactive form dictionary of the document.
 java.lang.String getFullyQualifiedName(PdfDictionary field)
          Determines the fully qualified field name of a specified field.
 PdfFieldTreeIterator getIterator()
          Returns an iterator over the terminal field objects in this document's field tree.
 PdfDictionary inheritAttributes(PdfDictionary field)
          Adds inherited attributes to a specified field dictionary object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_nested

protected java.util.Stack _nested
A stack for holding nested levels of field nodes.


_m

protected PdfManager _m
The manager associated with this document.


_catalog

protected PdfCatalog _catalog
The catalog associated with this document.


_inheritable

protected static java.util.Set _inheritable
Defines the set of inheritable field attributes.


_inheritableAcroForm

protected static java.util.Set _inheritableAcroForm
Defines the set of field attributes that are inheritable from the AcroForm.


PDFNAME_ACROFORM

protected static final PdfName PDFNAME_ACROFORM

PDFNAME_KIDS

protected static final PdfName PDFNAME_KIDS

PDFNAME_FIELDS

protected static final PdfName PDFNAME_FIELDS

PDFNAME_PARENT

protected static final PdfName PDFNAME_PARENT

PDFNAME_T

protected static final PdfName PDFNAME_T

PDFNAME_TYPE

protected static final PdfName PDFNAME_TYPE
Constructor Detail

PdfFieldTree

public PdfFieldTree(PdfManager manager)
Constructs a PdfFieldTree instance based on a specified PdfManager.

Method Detail

getAcroForm

protected PdfObject getAcroForm()
                         throws java.io.IOException,
                                PdfFormatException
Returns the interactive form dictionary of the document. This method returns a PdfDictionary (the AcroForm dictionary), a PdfReference (an indirect reference to the AcroForm dictionary), or null if there is no AcroForm dictionary present.

Returns:
the AcroForm dictionary (direct object or indirect reference) or null.
Throws:
java.io.IOException
PdfFormatException

getFullyQualifiedName

public java.lang.String getFullyQualifiedName(PdfDictionary field)
                                       throws java.io.IOException,
                                              PdfFormatException
Determines the fully qualified field name of a specified field.

Parameters:
field - the field dictionary.
Returns:
the fully qualified field name.
Throws:
java.io.IOException
PdfFormatException

inheritAttributes

public PdfDictionary inheritAttributes(PdfDictionary field)
                                throws java.io.IOException,
                                       PdfFormatException
Adds inherited attributes to a specified field dictionary object. The field object is cloned and the inherited attributes are made explicit in the cloned object's dictionary. The inherited attributes are retrieved by ascending the field tree and looking for inheritable attributes (if any) that are missing from the specified field dictionary. The interactive form dictionary is also checked (if necessary) for document-wide default values.

Parameters:
field - the field dictionary to be filled in with inherited attributes.
Returns:
a clone of the specified field dictionary, with all inherited attributes filled in.
Throws:
java.io.IOException
PdfFormatException

getIterator

public PdfFieldTreeIterator getIterator()
                                 throws java.io.IOException,
                                        PdfFormatException
Returns an iterator over the terminal field objects in this document's field tree. Note that terminal field objects do not include inherited attributes; inheritAttributes(PdfDictionary) should be used to obtain inherited attributes.

Returns:
the iterator over the terminal field objects.
Throws:
java.io.IOException
PdfFormatException