Package org.apache.fop.area
Class BookmarkData
java.lang.Object
org.apache.fop.area.AbstractOffDocumentItem
org.apache.fop.area.BookmarkData
- All Implemented Interfaces:
OffDocumentItem
,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
-
Constructor Summary
ConstructorDescriptionCreate 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
Modifier and TypeMethodDescriptionvoid
addSubData
(BookmarkData sub) Add a child bookmark data object.Get the title for this bookmark object.int
getCount()
Get the size of child data objects.getIDRef()
Get the idref for this bookmark-itemString[]
Get the array of idrefs of this resolvable object.getName()
Return a human-readable name for this ODI (for error messages, etc.)Get the PageViewport object that this bookmark refers togetSubData
(int count) Get the child data object.boolean
Check if this resolvable object has been resolved.void
resolveIDRef
(String id, List<PageViewport> pages) Resolve this resolvable object.boolean
Indicator of whether to initially display child bookmarks.Methods inherited from class org.apache.fop.area.AbstractOffDocumentItem
getWhenToProcess
-
Constructor Details
-
BookmarkData
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
-
BookmarkData
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()Create a new bookmark data root object. This constructor is called by the AreaTreeParser when the <bookmarkTree> element is read from the XML file -
BookmarkData
Create a new bookmark data object. This constructor is called by the AreaTreeParser when a <bookmark> element is read from the XML file.- Parameters:
title
- the bookmark's titleshowChildren
- whether to initially display the bookmark's childrenpv
- the target PageViewportidRef
- the target ID
-
-
Method Details
-
getIDRef
Get the idref for this bookmark-item- Returns:
- the idref for the bookmark-item
-
addSubData
Add a child bookmark data object. This adds a child bookmark in the bookmark hierarchy.- Parameters:
sub
- the child bookmark data
-
getBookmarkTitle
Get the title for this bookmark object.- Returns:
- the bookmark title
-
showChildItems
public boolean showChildItems()Indicator of whether to initially display child bookmarks.- Returns:
- true to initially display child bookmarks, false otherwise
-
getCount
public int getCount()Get the size of child data objects.- Returns:
- the number of child bookmark data
-
getSubData
Get the child data object.- Parameters:
count
- the index to get- Returns:
- the child bookmark data
-
getPageViewport
Get the PageViewport object that this bookmark refers to- Returns:
- the PageViewport that this bookmark points to
-
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 interfaceResolvable
- Returns:
- true if this object has been resolved
-
getIDRefs
Get the array of idrefs of this resolvable object. If this object contains child resolvables that are resolved through this then it should return the idref's of the child also.- Specified by:
getIDRefs
in interfaceResolvable
- Returns:
- the id references for resolving this object
-
resolveIDRef
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. This method allows the Resolvable object to resolve one of its unresolved idrefs with the actual set of PageViewports containing the target ID. The Resolvable object initially identifies to the AreaTreeHandler which idrefs it needs resolved. After the idrefs are resolved, the ATH calls this method to allow the Resolvable object to update itself with the PageViewport information.- Specified by:
resolveIDRef
in interfaceResolvable
- Parameters:
id
- an ID matching one of the Resolvable object's unresolved idref's.pages
- the list of PageViewports with the given ID
-
getName
Return a human-readable name for this ODI (for error messages, etc.)- Specified by:
getName
in interfaceOffDocumentItem
- Specified by:
getName
in classAbstractOffDocumentItem
- Returns:
- String name of ODI
-