org.apache.fop.area

Class BookmarkData

Implemented Interfaces:
OffDocumentItem, Resolvable

public class BookmarkData
extends AbstractOffDocumentItem
implements Resolvable

An instance of this class is either a PDF bookmark-tree and its child bookmark-items, or a bookmark-item and the child child bookmark-items under it.

Field Summary

Fields inherited from class org.apache.fop.area.AbstractOffDocumentItem

AFTER_PAGE, END_OF_DOC, IMMEDIATELY, START_OF_DOC, whenToProcess

Fields inherited from interface org.apache.fop.area.OffDocumentItem

AFTER_PAGE, END_OF_DOC, IMMEDIATELY

Constructor Summary

BookmarkData()
Create a new bookmark data root object.
BookmarkData(String title, boolean showChildren, PageViewport pv, String idRef)
Create a new bookmark data object.
BookmarkData(Bookmark bookmark)
Create a new pdf bookmark data object.
BookmarkData(BookmarkTree bookmarkTree)
Create a new bookmark data object.

Method Summary

void
addSubData(BookmarkData sub)
Add a child bookmark data object.
String
getBookmarkTitle()
Get the title for this bookmark object.
int
getCount()
Get the size of child data objects.
String
getIDRef()
Get the idref for this bookmark-item
String[]
getIDRefs()
String
getName()
PageViewport
getPageViewport()
Get the PageViewport object that this bookmark refers to
BookmarkData
getSubData(int count)
Get the child data object.
boolean
isResolved()
Check if this resolvable object has been resolved.
void
resolveIDRef(String id, List pages)
Resolve this resolvable object.
boolean
showChildItems()
Indicator of whether to initially display child bookmarks.

Methods inherited from class org.apache.fop.area.AbstractOffDocumentItem

getName, getWhenToProcess

Constructor Details

BookmarkData

public BookmarkData()
Create a new bookmark data root object. This constructor is called by the AreaTreeParser when the element is read from the XML file

BookmarkData

public BookmarkData(String title,
                    boolean showChildren,
                    PageViewport pv,
                    String idRef)
Create a new bookmark data object. This constructor is called by the AreaTreeParser when a element is read from the XML file.
Parameters:
title - the bookmark's title
showChildren - whether to initially display the bookmark's children
pv - the target PageViewport
idRef - the target ID

BookmarkData

public BookmarkData(Bookmark bookmark)
Create a new pdf bookmark data object. This is used by the bookmark-items to create a data object with a idref. During processing, this idref will be subsequently resolved to a particular PageViewport.
Parameters:
bookmark - the fo:bookmark object

BookmarkData

public BookmarkData(BookmarkTree bookmarkTree)
Create a new bookmark data object. This should only be called by the bookmark-tree item because it has no idref item that needs to be resolved.
Parameters:
bookmarkTree - fo:bookmark-tree for this document

Method Details

addSubData

public void addSubData(BookmarkData sub)
Add a child bookmark data object. This adds a child bookmark in the bookmark hierarchy.
Parameters:
sub - the child bookmark data

getBookmarkTitle

public String getBookmarkTitle()
Get the title for this bookmark object.
Returns:
the bookmark title

getCount

public int getCount()
Get the size of child data objects.
Returns:
the number of child bookmark data

getIDRef

public String getIDRef()
Get the idref for this bookmark-item
Returns:
the idref for the bookmark-item

getIDRefs

public String[] getIDRefs()
Specified by:
getIDRefs in interface Resolvable

getName

public String getName()
Specified by:
getName in interface OffDocumentItem
Overrides:
getName in interface AbstractOffDocumentItem

getPageViewport

public PageViewport getPageViewport()
Get the PageViewport object that this bookmark refers to
Returns:
the PageViewport that this bookmark points to

getSubData

public BookmarkData getSubData(int count)
Get the child data object.
Parameters:
count - the index to get
Returns:
the child bookmark data

isResolved

public boolean isResolved()
Check if this resolvable object has been resolved. A BookmarkData object is considered resolved once the idrefs for it and for all of its child bookmark-items have been resolved.
Specified by:
isResolved in interface Resolvable
Returns:
true if this object has been resolved

resolveIDRef

public void resolveIDRef(String id,
                         List pages)
Resolve this resolvable object. This resolves the idref of this object and if possible also resolves id references of child elements that have the same id reference.
Specified by:
resolveIDRef in interface Resolvable
To do:
check to make sure it works if multiple bookmark-items have the same idref

showChildItems

public boolean showChildItems()
Indicator of whether to initially display child bookmarks.
Returns:
true to initially display child bookmarks, false otherwise

Copyright 1999-2007 The Apache Software Foundation. All Rights Reserved.