Class PDStructureNode
- java.lang.Object
-
- org.apache.pdfbox.pdmodel.documentinterchange.logicalstructure.PDStructureNode
-
- All Implemented Interfaces:
COSObjectable
- Direct Known Subclasses:
PDStructureElement,PDStructureTreeRoot
public abstract class PDStructureNode extends java.lang.Object implements COSObjectable
A node in the structure tree.- Author:
- Johannes Koch
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedPDStructureNode(java.lang.String type)Constructor.protectedPDStructureNode(COSDictionary dictionary)Constructor for an existing structure node.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidappendKid(COSBase object)Appends a COS base kid.voidappendKid(PDStructureElement structureElement)Appends a structure element kid.protected voidappendObjectableKid(COSObjectable objectable)Appends an objectable kid.static PDStructureNodecreate(COSDictionary node)Creates a node in the structure tree.protected java.lang.ObjectcreateObject(COSBase kid)Creates an object for a kid of this structure node.COSDictionarygetCOSObject()Convert this standard java object to a COS object.java.util.List<java.lang.Object>getKids()Returns a list of objects for the kids (K).java.lang.StringgetType()Returns the type.protected voidinsertBefore(COSBase newKid, java.lang.Object refKid)Inserts an COS base kid before a reference kid.voidinsertBefore(PDStructureElement newKid, java.lang.Object refKid)Inserts a structure element kid before a reference kid.protected voidinsertObjectableBefore(COSObjectable newKid, java.lang.Object refKid)Inserts an objectable kid before a reference kid.protected booleanremoveKid(COSBase object)Removes a COS base kid.booleanremoveKid(PDStructureElement structureElement)Removes a structure element kid.protected booleanremoveObjectableKid(COSObjectable objectable)Removes an objectable kid.voidsetKids(java.util.List<java.lang.Object> kids)Sets the kids (K).
-
-
-
Constructor Detail
-
PDStructureNode
protected PDStructureNode(java.lang.String type)
Constructor.- Parameters:
type- the type
-
PDStructureNode
protected PDStructureNode(COSDictionary dictionary)
Constructor for an existing structure node.- Parameters:
dictionary- The existing dictionary.
-
-
Method Detail
-
create
public static PDStructureNode create(COSDictionary node)
Creates a node in the structure tree. Can be either a structure tree root, or a structure element.- Parameters:
node- the node dictionary- Returns:
- the structure node
-
getCOSObject
public COSDictionary getCOSObject()
Convert this standard java object to a COS object.- Specified by:
getCOSObjectin interfaceCOSObjectable- Returns:
- The cos object that matches this Java object.
-
getType
public java.lang.String getType()
Returns the type.- Returns:
- the type
-
getKids
public java.util.List<java.lang.Object> getKids()
Returns a list of objects for the kids (K).- Returns:
- a list of objects for the kids, never null.
-
setKids
public void setKids(java.util.List<java.lang.Object> kids)
Sets the kids (K).- Parameters:
kids- the kids
-
appendKid
public void appendKid(PDStructureElement structureElement)
Appends a structure element kid.- Parameters:
structureElement- the structure element
-
appendObjectableKid
protected void appendObjectableKid(COSObjectable objectable)
Appends an objectable kid.- Parameters:
objectable- the objectable
-
appendKid
protected void appendKid(COSBase object)
Appends a COS base kid.- Parameters:
object- the COS base
-
insertBefore
public void insertBefore(PDStructureElement newKid, java.lang.Object refKid)
Inserts a structure element kid before a reference kid.- Parameters:
newKid- the structure elementrefKid- the reference kid
-
insertObjectableBefore
protected void insertObjectableBefore(COSObjectable newKid, java.lang.Object refKid)
Inserts an objectable kid before a reference kid.- Parameters:
newKid- the objectablerefKid- the reference kid
-
insertBefore
protected void insertBefore(COSBase newKid, java.lang.Object refKid)
Inserts an COS base kid before a reference kid.- Parameters:
newKid- the COS baserefKid- the reference kid
-
removeKid
public boolean removeKid(PDStructureElement structureElement)
Removes a structure element kid.- Parameters:
structureElement- the structure element- Returns:
trueif the kid was removed,falseotherwise
-
removeObjectableKid
protected boolean removeObjectableKid(COSObjectable objectable)
Removes an objectable kid.- Parameters:
objectable- the objectable- Returns:
trueif the kid was removed,falseotherwise
-
removeKid
protected boolean removeKid(COSBase object)
Removes a COS base kid.- Parameters:
object- the COS base- Returns:
trueif the kid was removed,falseotherwise
-
createObject
protected java.lang.Object createObject(COSBase kid)
Creates an object for a kid of this structure node. The type of object depends on the type of the kid. It can be- a
PDStructureElement, - a
PDObjectReference, - a
PDMarkedContentReference, - an
Integer
- Parameters:
kid- the kid- Returns:
- the object
- a
-
-