Package com.itextpdf.kernel.pdf.tagutils
Class WaitingTagsManager
- java.lang.Object
-
- com.itextpdf.kernel.pdf.tagutils.WaitingTagsManager
-
public class WaitingTagsManager extends java.lang.ObjectThis class is used to manage waiting tags state. Any tag in the structure tree could be marked as "waiting". This state indicates that tag is not yet finished and therefore should not be flushed or removed if page tags are flushed or removed or if parent tags are flushed.Waiting state of tags is defined by the association with arbitrary objects instances.
Waiting state could also be perceived as a temporal association of the object to some particular tag.
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.Map<java.lang.Object,PdfStructElem>associatedObjToWaitingTagprivate java.util.Map<PdfDictionary,java.lang.Object>waitingTagToAssociatedObj
-
Constructor Summary
Constructors Constructor Description WaitingTagsManager()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.ObjectassignWaitingState(TagTreePointer pointerToTag, java.lang.Object associatedObj)Assigns waiting state to the tag at which givenTagTreePointerpoints, associating it with the givenObject.private voidflushStructElementAndItKids(PdfStructElem elem)(package private) IStructureNodeflushTag(PdfStructElem tagStruct)(package private) java.lang.ObjectgetObjForStructDict(PdfDictionary structDict)(package private) PdfStructElemgetStructForObj(java.lang.Object associatedObj)booleanisObjectAssociatedWithWaitingTag(java.lang.Object obj)Checks if there is waiting tag which state was assigned using givenObject.voidremoveAllWaitingStates()Removes waiting state of all waiting tags by removing association with objects.booleanremoveWaitingState(java.lang.Object associatedObject)Removes waiting state of the tag which is associated with the given object.private voidremoveWaitingStateAndFlushIfParentFlushed(PdfStructElem structElem)(package private) java.lang.ObjectsaveAssociatedObjectForWaitingTag(java.lang.Object associatedObj, PdfStructElem structElem)booleantryMovePointerToWaitingTag(TagTreePointer tagPointer, java.lang.Object associatedObject)Moves givenTagTreePointerto the waiting tag which is associated with the given object.
-
-
-
Field Detail
-
associatedObjToWaitingTag
private final java.util.Map<java.lang.Object,PdfStructElem> associatedObjToWaitingTag
-
waitingTagToAssociatedObj
private final java.util.Map<PdfDictionary,java.lang.Object> waitingTagToAssociatedObj
-
-
Method Detail
-
assignWaitingState
public java.lang.Object assignWaitingState(TagTreePointer pointerToTag, java.lang.Object associatedObj)
Assigns waiting state to the tag at which givenTagTreePointerpoints, associating it with the givenObject. If current tag of the givenTagTreePointeris already waiting, then after this method call it's associated object will change to the one passed as the argument and the old one will not longer be an associated object.- Parameters:
pointerToTag- aTagTreePointerpointing at a tag which is desired to be marked as waiting.associatedObj- an object that is to be associated with the waiting tag. A null value is forbidden.- Returns:
- the previous associated object with the tag if it has already had waiting state, or null if it was not waiting tag.
-
isObjectAssociatedWithWaitingTag
public boolean isObjectAssociatedWithWaitingTag(java.lang.Object obj)
Checks if there is waiting tag which state was assigned using givenObject.- Parameters:
obj- anObjectwhich is to be checked if it is associated with any waiting tag. A null value is forbidden.- Returns:
- true if object is currently associated with some waiting tag.
-
tryMovePointerToWaitingTag
public boolean tryMovePointerToWaitingTag(TagTreePointer tagPointer, java.lang.Object associatedObject)
Moves givenTagTreePointerto the waiting tag which is associated with the given object. If the passed object is not associated with any waiting tag,TagTreePointerposition won't change.- Parameters:
tagPointer- aTagTreePointerwhich position in the tree is to be changed to the waiting tag in case of the successful call.associatedObject- an object which is associated with the waiting tag to whichTagTreePointeris to be moved.- Returns:
- true if given object is actually associated with the waiting tag and
TagTreePointerwas moved in order to point at it.
-
removeWaitingState
public boolean removeWaitingState(java.lang.Object associatedObject)
Removes waiting state of the tag which is associated with the given object.NOTE: if parent of the waiting tag is already flushed, the tag and it's children (unless they are waiting tags on their own) will be also immediately flushed right after the waiting state removal.
- Parameters:
associatedObject- an object which association with the waiting tag is to be removed.- Returns:
- true if object was actually associated with some tag and it's association was removed.
-
removeAllWaitingStates
public void removeAllWaitingStates()
Removes waiting state of all waiting tags by removing association with objects.NOTE: if parent of the waiting tag is already flushed, the tag and it's children will be also immediately flushed right after the waiting state removal.
-
getStructForObj
PdfStructElem getStructForObj(java.lang.Object associatedObj)
-
getObjForStructDict
java.lang.Object getObjForStructDict(PdfDictionary structDict)
-
saveAssociatedObjectForWaitingTag
java.lang.Object saveAssociatedObjectForWaitingTag(java.lang.Object associatedObj, PdfStructElem structElem)
-
flushTag
IStructureNode flushTag(PdfStructElem tagStruct)
- Returns:
- parent of the flushed tag
-
flushStructElementAndItKids
private void flushStructElementAndItKids(PdfStructElem elem)
-
removeWaitingStateAndFlushIfParentFlushed
private void removeWaitingStateAndFlushIfParentFlushed(PdfStructElem structElem)
-
-