com.qoppa.pdf
Class Bookmark

java.lang.Object
  extended bycom.qoppa.pdf.Bookmark
All Implemented Interfaces:
TreeNode

public abstract class Bookmark
extends Object
implements TreeNode

This class represents a Bookmark in a PDF document. The class is essentially a node on a tree that has a list of actions associated with it and a number of children.
The class implements the TreeNode interface so that it can be used directly in a JTree.

Author:
Qoppa Software

Method Summary
 void addAction(Action action)
          Adds an Action to this Bookmark
abstract  Bookmark addChild(String title)
          Add a child bookmark.
 Enumeration children()
          Returns the children of the node as an Enumeration.
 Vector getActions()
          Gets the list of actions for this Bookmark.
 boolean getAllowsChildren()
          Returns true if the node allows children.
 TreeNode getChildAt(int childIndex)
          Returns the child at the given index.
 int getChildCount()
          Returns the number of children that this node contains.
 int getIndex(TreeNode node)
          Returns the index of node in the node's children.
 TreeNode getParent()
          Returns the parent node / Bookmark.
 Color getTextColor()
          Returns the text color that should be used when showing this bookmark.
 int getTextStyle()
          Returns the text style to use when displaying the bookmark.
 String getTitle()
          Gets this bookmarks title.
 boolean isLeaf()
          Returns true if the receiver is a leaf.
 void setTextColor(Color textColor)
          Sets the text color to use when displaying this bookmark.
 void setTextStyle(int textStyle)
          Sets the text style to use when displaying this bookmark.
 void setTitle(String title)
          Sets this bookmarks title.
 String toString()
          Returns the title or name of the bookmark.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

getActions

public Vector getActions()
Gets the list of actions for this Bookmark.

Returns:
A Vector containing the actions to execute when this bookmark is clicked.

addAction

public void addAction(Action action)
               throws PDFException
Adds an Action to this Bookmark

Parameters:
action - The new action
Throws:
PDFException

addChild

public abstract Bookmark addChild(String title)
                           throws PDFException
Add a child bookmark.

Parameters:
title - The title of the new child bookmark.
Returns:
The new child Bookmark.
Throws:
PDFException

getChildCount

public int getChildCount()
Returns the number of children that this node contains.

Specified by:
getChildCount in interface TreeNode
See Also:
TreeNode.getChildCount()

getAllowsChildren

public boolean getAllowsChildren()
Returns true if the node allows children.

Specified by:
getAllowsChildren in interface TreeNode
See Also:
TreeNode.getAllowsChildren()

isLeaf

public boolean isLeaf()
Returns true if the receiver is a leaf.

Specified by:
isLeaf in interface TreeNode
See Also:
TreeNode.isLeaf()

children

public Enumeration children()
Returns the children of the node as an Enumeration.

Specified by:
children in interface TreeNode
See Also:
TreeNode.children()

getParent

public TreeNode getParent()
Returns the parent node / Bookmark. This method returns the parent Bookmark for this Bookmark. In order to implement the TreeNode interface, this method returns a TreeNode object, but this object can be safely cast to a Bookmark object.

Specified by:
getParent in interface TreeNode
See Also:
TreeNode.getParent()

getChildAt

public TreeNode getChildAt(int childIndex)
Returns the child at the given index. This method is needed to implement the TreeNode interface and so returns a TreeNode, but this can be safely casted to a Bookmark object.

Specified by:
getChildAt in interface TreeNode
See Also:
TreeNode.getChildAt(int)

getIndex

public int getIndex(TreeNode node)
Returns the index of node in the node's children.

Specified by:
getIndex in interface TreeNode
See Also:
TreeNode.getIndex(javax.swing.tree.TreeNode)

toString

public String toString()
Returns the title or name of the bookmark.


setTitle

public void setTitle(String title)
Sets this bookmarks title. The title is the string that is displayed in the 'outline' view of a PDF document.

Parameters:
title - The new title.

getTitle

public String getTitle()
Gets this bookmarks title. The title is the string that is displayed in the 'outline' view of a PDF document.

Returns:
The title.

getTextColor

public Color getTextColor()
Returns the text color that should be used when showing this bookmark.

Returns:
The color of the text.

setTextColor

public void setTextColor(Color textColor)
Sets the text color to use when displaying this bookmark.

Parameters:
textColor - The text color.

getTextStyle

public int getTextStyle()
Returns the text style to use when displaying the bookmark.

Returns:
The text style.

setTextStyle

public void setTextStyle(int textStyle)
Sets the text style to use when displaying this bookmark.

Parameters:
textStyle - The text style.