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
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 Modifier and Type Field Description private java.lang.String
bookmarkTitle
private java.lang.String
idRef
private PageViewport
pageRef
private boolean
showChildren
private java.util.List<BookmarkData>
subData
private java.util.Map<java.lang.String,java.util.List<Resolvable>>
unresolvedIDRefs
-
Fields inherited from class org.apache.fop.area.AbstractOffDocumentItem
AFTER_PAGE, END_OF_DOC, IMMEDIATELY, START_OF_DOC, whenToProcess
-
-
Constructor Summary
Constructors Constructor Description BookmarkData()
Create a new bookmark data root object.BookmarkData(java.lang.String title, boolean showChildren, PageViewport pv, java.lang.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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addSubData(BookmarkData sub)
Add a child bookmark data object.private BookmarkData
createBookmarkData(Bookmark bookmark)
Create and return the bookmark data for this bookmark This creates a bookmark data with the destination and adds all the data from child bookmarksjava.lang.String
getBookmarkTitle()
Get the title for this bookmark object.int
getCount()
Get the size of child data objects.java.lang.String
getIDRef()
Get the idref for this bookmark-itemjava.lang.String[]
getIDRefs()
Get the array of idrefs of this resolvable object.java.lang.String
getName()
Return a human-readable name for this ODI (for error messages, etc.)PageViewport
getPageViewport()
Get the PageViewport object that this bookmark refers toBookmarkData
getSubData(int count)
Get the child data object.boolean
isResolved()
Check if this resolvable object has been resolved.private void
putUnresolved(java.lang.String id, BookmarkData bd)
void
resolveIDRef(java.lang.String id, java.util.List<PageViewport> pages)
Resolve this resolvable object.boolean
showChildItems()
Indicator of whether to initially display child bookmarks.-
Methods inherited from class org.apache.fop.area.AbstractOffDocumentItem
getWhenToProcess
-
-
-
-
Field Detail
-
subData
private java.util.List<BookmarkData> subData
-
bookmarkTitle
private java.lang.String bookmarkTitle
-
showChildren
private boolean showChildren
-
idRef
private java.lang.String idRef
-
pageRef
private PageViewport pageRef
-
unresolvedIDRefs
private java.util.Map<java.lang.String,java.util.List<Resolvable>> unresolvedIDRefs
-
-
Constructor Detail
-
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
-
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()
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
public BookmarkData(java.lang.String title, boolean showChildren, PageViewport pv, java.lang.String idRef)
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 Detail
-
putUnresolved
private void putUnresolved(java.lang.String id, BookmarkData bd)
-
getIDRef
public java.lang.String getIDRef()
Get the idref for this bookmark-item- Returns:
- the idref for the bookmark-item
-
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 java.lang.String 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
public BookmarkData getSubData(int count)
Get the child data object.- Parameters:
count
- the index to get- Returns:
- the child bookmark data
-
getPageViewport
public PageViewport 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
public java.lang.String[] 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
public void resolveIDRef(java.lang.String id, java.util.List<PageViewport> 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. 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
public java.lang.String 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
-
createBookmarkData
private BookmarkData createBookmarkData(Bookmark bookmark)
Create and return the bookmark data for this bookmark This creates a bookmark data with the destination and adds all the data from child bookmarks- Parameters:
bookmark
- the Bookmark object for which a bookmark entry should be created- Returns:
- the new bookmark data
-
-