Class PDStructureNode
- java.lang.Object
-
- com.tom_roush.pdfbox.pdmodel.documentinterchange.logicalstructure.PDStructureNode
-
- All Implemented Interfaces:
COSObjectable
- Direct Known Subclasses:
PDStructureElement,PDStructureTreeRoot
public abstract class PDStructureNode extends Object implements COSObjectable
A node in the structure tree.
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedPDStructureNode(COSDictionary dictionary)Constructor for an existing structure node.protectedPDStructureNode(String type)Constructor.
-
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 ObjectcreateObject(COSBase kid)Creates an object for a kid of this structure node.COSDictionarygetCOSObject()Convert this standard java object to a COS object.List<Object>getKids()Returns a list of objects for the kids (K).StringgetType()Returns the type.protected voidinsertBefore(COSBase newKid, Object refKid)Inserts an COS base kid before a reference kid.voidinsertBefore(PDStructureElement newKid, Object refKid)Inserts a structure element kid before a reference kid.protected voidinsertObjectableBefore(COSObjectable newKid, 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(List<Object> kids)Sets the kids (K).
-
-
-
Constructor Detail
-
PDStructureNode
protected PDStructureNode(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 String getType()
Returns the type.- Returns:
- the type
-
getKids
public List<Object> getKids()
Returns a list of objects for the kids (K).- Returns:
- a list of objects for the kids, never null.
-
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, 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, Object refKid)
Inserts an objectable kid before a reference kid.- Parameters:
newKid- the objectablerefKid- the reference kid
-
insertBefore
protected void insertBefore(COSBase newKid, 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
-
-