com.crionics.jpdf.outline
Class AbstractOutlineItem

java.lang.Object
  extended by PdfObjectContainer
      extended by com.crionics.jpdf.outline.AbstractOutlineItem
Direct Known Subclasses:
OutlineItemAction, OutlineItemBasic, OutlineItemDestination

public abstract class AbstractOutlineItem
extends PdfObjectContainer

This object contains the common methods for items which can be view in a PDF Viewer as a bookmark (equivalent to a table of Content). Theses Items are organized in a Tree List, and have differents information allowing to recover their childs, parent or next Items. Also note that each Items requires 2 valid attributes:

To construct theses items, use the object OulineItemZoom... depending on the effect required when they are selected in a PDF Viewer.


Method Summary
 void addAfter(AbstractOutlineItem prev)
          Sets the current item after the specified one.
 void addBelow(AbstractOutlineItem parent)
          Sets the current item below the specified one, thus starting an new Tree Branch.
 void addChild(AbstractOutlineItem child)
          Adds the specified item below the current one, thus starting an new Tree Branch.
 void addNext(AbstractOutlineItem next)
          Add the specified item after the current one.
 boolean equals(AbstractOutlineItem item)
           
 boolean equals(java.lang.Object obj)
           
 AbstractOutlineItem getChild()
          Returns the First Child of the tree below this item.
 AbstractOutlineItem getFirst()
          Returns the First item of the current branch.
 AbstractOutlineItem getLast()
          Returns the Last item of the current branch.
 AbstractOutlineItem getNext()
          Returns the Item following this one in the current branch of the tree.
 int getPageIndex()
          Returns the index of the page associated with this Item.
 int getPageIndex(boolean searchLastIndex)
          Returns the index of the page associated with this Item.
 AbstractOutlineItem getParent()
          Returns the Parent Item of this one.
 AbstractOutlineItem getPrev()
          Returns the Previous Item to this one.
 java.lang.String getTitle()
          Returns the text to be displayed for this Item in a PDF Viewer.
 boolean hasChild()
          Allows to detect if this Item starts a new branch.
 boolean hasNext()
          Allows to detect if there is another item after the current one.
 void removeFromTree(boolean keepChilds)
          This methods allows the removal the current items from the outline tree.
 void setTitle(java.lang.String title)
          Sets the text to be displayed for this Item in a PDF Viewer.
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

addAfter

public void addAfter(AbstractOutlineItem prev)
              throws PdfException,
                     java.io.IOException
Sets the current item after the specified one.

Parameters:
prev - The previous to be Item.
Throws:
PdfException - If a problem occured while parsing the document.
java.io.IOException - If a problem occured while parsing the file.

addBelow

public void addBelow(AbstractOutlineItem parent)
              throws PdfException,
                     java.io.IOException
Sets the current item below the specified one, thus starting an new Tree Branch. If the specified Item has already a child, the current one will preceed it.

Parameters:
parent - The parent to be Item to set.
Throws:
PdfException - If a problem occured while parsing the document.
java.io.IOException - If a problem occured while parsing the file.

addChild

public void addChild(AbstractOutlineItem child)
              throws PdfException,
                     java.io.IOException
Adds the specified item below the current one, thus starting an new Tree Branch. If the current Item has already a child, the specified one will preceed it.

Parameters:
child - The parent to be Item to set.
Throws:
PdfException - If a problem occured while parsing the document.
java.io.IOException - If a problem occured while parsing the file.

addNext

public void addNext(AbstractOutlineItem next)
             throws PdfException,
                    java.io.IOException
Add the specified item after the current one.

Parameters:
next - The Item to be added.
Throws:
PdfException - If a problem occured while parsing the document.
java.io.IOException - If a problem occured while parsing the file.

equals

public boolean equals(AbstractOutlineItem item)

equals

public boolean equals(java.lang.Object obj)

getChild

public AbstractOutlineItem getChild()
                             throws PdfException,
                                    java.io.IOException
Returns the First Child of the tree below this item.

Returns:
The Child Item or null if there is no tree below this item.
Throws:
PdfException - If a problem occured while parsing the document.
java.io.IOException - If a problem occured while parsing the file.

getFirst

public AbstractOutlineItem getFirst()
                             throws PdfException,
                                    java.io.IOException
Returns the First item of the current branch.

Returns:
The First item of the current branch.
Throws:
PdfException - If a problem occured while parsing the document.
java.io.IOException - If a problem occured while parsing the file.

getLast

public AbstractOutlineItem getLast()
                            throws PdfException,
                                   java.io.IOException
Returns the Last item of the current branch.

Returns:
The Last item of the current branch.
Throws:
PdfException - If a problem occured while parsing the document.
java.io.IOException - If a problem occured while parsing the file.

getNext

public AbstractOutlineItem getNext()
                            throws PdfException,
                                   java.io.IOException
Returns the Item following this one in the current branch of the tree.

Returns:
The next Item or null if there is no Items following this one.
Throws:
PdfException - If a problem occured while parsing the document.
java.io.IOException - If a problem occured while parsing the file.

getPageIndex

public int getPageIndex()
                 throws PdfException,
                        java.io.IOException
Returns the index of the page associated with this Item.
This method calls the method getPageIndex(boolean)with the parameter searchLastIndex set to false.

Returns:
The Index of the Page or -1 if no page index was detected.
Throws:
PdfException - If a problem occured while parsing the document.
java.io.IOException - If a problem occured while parsing the file.

getPageIndex

public int getPageIndex(boolean searchLastIndex)
                 throws PdfException,
                        java.io.IOException
Returns the index of the page associated with this Item.
Note: Not all the type of Outline Items have the page index encoded into them. In such event, you can instruct the API to look upward in the outline tree for the last page index present.

Parameters:
searchLastIndex - Set to true to search for the last page index if the current item do not have any reference to a page, or false otherwise.
Returns:
The Index of the Page or -1 if no page index was detected.
Throws:
PdfException - If a problem occured while parsing the document.
java.io.IOException - If a problem occured while parsing the file.

getParent

public AbstractOutlineItem getParent()
                              throws PdfException,
                                     java.io.IOException
Returns the Parent Item of this one.

Returns:
The Parent Item or null if none exists.
Throws:
PdfException - If a problem occured while parsing the document.
java.io.IOException - If a problem occured while parsing the file.

getPrev

public AbstractOutlineItem getPrev()
                            throws PdfException,
                                   java.io.IOException
Returns the Previous Item to this one.

Returns:
The Previous Item or null if none exists.
Throws:
PdfException - If a problem occured while parsing the document.
java.io.IOException - If a problem occured while parsing the file.

getTitle

public java.lang.String getTitle()
                          throws PdfException,
                                 java.io.IOException
Returns the text to be displayed for this Item in a PDF Viewer.

Returns:
The title.
Throws:
PdfException - If a problem occured while parsing the document.
java.io.IOException - If a problem occured while parsing the file.

hasChild

public boolean hasChild()
Allows to detect if this Item starts a new branch.

Returns:
true if this is the case, false otherwise.

hasNext

public boolean hasNext()
Allows to detect if there is another item after the current one.

Returns:
true if this is the case, false otherwise.

removeFromTree

public void removeFromTree(boolean keepChilds)
                    throws PdfException,
                           java.io.IOException
This methods allows the removal the current items from the outline tree. (useful when the item is to be moved to another position)

Parameters:
keepChilds - true if the related childs should be kept, false otherwise.
Throws:
PdfException - If a problem occured while parsing the document.
java.io.IOException - If a problem occured while parsing the file.

setTitle

public void setTitle(java.lang.String title)
              throws PdfException,
                     java.io.IOException
Sets the text to be displayed for this Item in a PDF Viewer.

Parameters:
title - The title to set.
Throws:
PdfException - If a problem occured while parsing the document.
java.io.IOException - If a problem occured while parsing the file.


Copyright © 1999-2007 Crionics. All Rights Reserved.