Package org.apache.fop.area
Class IDTracker
- java.lang.Object
-
- org.apache.fop.area.IDTracker
-
public class IDTracker extends java.lang.Object
Used by the AreaTreeHandler to keep track of ID reference usage on a PageViewport level.
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.Set<java.lang.String>
alreadyResolvedIDs
private java.util.Map<java.lang.String,java.util.List<PageViewport>>
idLocations
private static org.apache.commons.logging.Log
LOG
private java.util.Set<java.lang.String>
unfinishedIDs
private java.util.Map<java.lang.String,java.util.Set<Resolvable>>
unresolvedIDRefs
-
Constructor Summary
Constructors Constructor Description IDTracker()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addUnresolvedIDRef(java.lang.String idref, Resolvable res)
Add an Resolvable object with an unresolved idrefboolean
alreadyResolvedID(java.lang.String id)
Check if an ID has already been resolvedvoid
associateIDWithPageViewport(java.lang.String id, PageViewport pv)
Tie a PageViewport with an ID found on a child area of the PV.PageViewport
getFirstPageViewportContaining(java.lang.String id)
Get the firstPageViewport
containing content generated by the FO with the givenid
.PageViewport
getLastPageViewportContaining(java.lang.String id)
Get the lastPageViewport
containing content generated by the FO with the givenid
.java.util.List<PageViewport>
getPageViewportsContainingID(java.lang.String id)
Get the list of page viewports that have an area with a given id.void
replacePageViewPort(PageViewport oldPageViewPort, PageViewport newPageViewPort)
Replace all id locations pointing to the old page view port with a new one.void
signalIDProcessed(java.lang.String id)
Signals that all areas for the formatting object with the given ID have been generated.void
signalPendingID(java.lang.String id)
This method tie an ID to the areaTreeHandler until this one is ready to be processed.private void
tryIDResolution(java.lang.String id, java.util.List<PageViewport> pvList)
Tries to resolve all unresolved ID references on the given set of pages.void
tryIDResolution(PageViewport pv)
Tries to resolve all unresolved ID references on the given page.
-
-
-
Field Detail
-
LOG
private static final org.apache.commons.logging.Log LOG
-
idLocations
private java.util.Map<java.lang.String,java.util.List<PageViewport>> idLocations
-
unresolvedIDRefs
private java.util.Map<java.lang.String,java.util.Set<Resolvable>> unresolvedIDRefs
-
unfinishedIDs
private java.util.Set<java.lang.String> unfinishedIDs
-
alreadyResolvedIDs
private java.util.Set<java.lang.String> alreadyResolvedIDs
-
-
Method Detail
-
associateIDWithPageViewport
public void associateIDWithPageViewport(java.lang.String id, PageViewport pv)
Tie a PageViewport with an ID found on a child area of the PV. Note that an area with a given ID may be on more than one PV, hence an ID may have more than one PV associated with it.- Parameters:
id
- the property ID of the areapv
- a page viewport that contains the area with this ID
-
signalPendingID
public void signalPendingID(java.lang.String id)
This method tie an ID to the areaTreeHandler until this one is ready to be processed. This is used in page-number-citation-last processing so we know when an id can be resolved.- Parameters:
id
- the id of the object being processed
-
signalIDProcessed
public void signalIDProcessed(java.lang.String id)
Signals that all areas for the formatting object with the given ID have been generated. This is used to determine when page-number-citation-last ref-ids can be resolved.- Parameters:
id
- the id of the formatting object which was just finished
-
alreadyResolvedID
public boolean alreadyResolvedID(java.lang.String id)
Check if an ID has already been resolved- Parameters:
id
- the id to check- Returns:
- true if the ID has been resolved
-
tryIDResolution
private void tryIDResolution(java.lang.String id, java.util.List<PageViewport> pvList)
Tries to resolve all unresolved ID references on the given set of pages.- Parameters:
id
- ID to resolvepvList
- list of PageViewports
-
tryIDResolution
public void tryIDResolution(PageViewport pv)
Tries to resolve all unresolved ID references on the given page.- Parameters:
pv
- page viewport whose ID refs to resolve
-
getPageViewportsContainingID
public java.util.List<PageViewport> getPageViewportsContainingID(java.lang.String id)
Get the list of page viewports that have an area with a given id.- Parameters:
id
- the id to lookup- Returns:
- the list of PageViewports
-
getFirstPageViewportContaining
public PageViewport getFirstPageViewportContaining(java.lang.String id)
Get the firstPageViewport
containing content generated by the FO with the givenid
.- Parameters:
id
- the id- Returns:
- the first
PageViewport
for the id;null
if no matchingPageViewport
was found
-
getLastPageViewportContaining
public PageViewport getLastPageViewportContaining(java.lang.String id)
Get the lastPageViewport
containing content generated by the FO with the givenid
.- Parameters:
id
- the id- Returns:
- the last
PageViewport
for the id;null
if no matchingPageViewport
was found
-
addUnresolvedIDRef
public void addUnresolvedIDRef(java.lang.String idref, Resolvable res)
Add an Resolvable object with an unresolved idref- Parameters:
idref
- the idref whose target id has not yet been locatedres
- the Resolvable object needing the idref to be resolved
-
replacePageViewPort
public void replacePageViewPort(PageViewport oldPageViewPort, PageViewport newPageViewPort)
Replace all id locations pointing to the old page view port with a new one. This is necessary when a layouted page is replaced with a new one (e.g. last page handling).- Parameters:
oldPageViewPort
- old page view portnewPageViewPort
- new page view port
-
-