Class PDOutlineNode
- java.lang.Object
-
- com.tom_roush.pdfbox.pdmodel.common.PDDictionaryWrapper
-
- com.tom_roush.pdfbox.pdmodel.interactive.documentnavigation.outline.PDOutlineNode
-
- All Implemented Interfaces:
COSObjectable
- Direct Known Subclasses:
PDDocumentOutline,PDOutlineItem
public abstract class PDOutlineNode extends PDDictionaryWrapper
Base class for a node in the outline of a PDF document.
-
-
Constructor Summary
Constructors Constructor Description PDOutlineNode()Default Constructor.PDOutlineNode(COSDictionary dict)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddFirst(PDOutlineItem newChild)Adds the given node to the top of the children list.voidaddLast(PDOutlineItem newChild)Adds the given node to the bottom of the children list.Iterable<PDOutlineItem>children()voidcloseNode()Close this node.PDOutlineItemgetFirstChild()PDOutlineItemgetLastChild()intgetOpenCount()Get the number of open nodes or a negative number if this node is closed.booleanhasChildren()booleanisNodeOpen()voidopenNode()This will set this node to be open when it is shown in the viewer.-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from class com.tom_roush.pdfbox.pdmodel.common.PDDictionaryWrapper
equals, getCOSObject, hashCode
-
-
-
-
Constructor Detail
-
PDOutlineNode
public PDOutlineNode()
Default Constructor.
-
PDOutlineNode
public PDOutlineNode(COSDictionary dict)
- Parameters:
dict- The dictionary storage.
-
-
Method Detail
-
addLast
public void addLast(PDOutlineItem newChild)
Adds the given node to the bottom of the children list.- Parameters:
newChild- The node to add.- Throws:
IllegalArgumentException- if the given node is part of a list (i.e. if it has a previous or a next sibling)
-
addFirst
public void addFirst(PDOutlineItem newChild)
Adds the given node to the top of the children list.- Parameters:
newChild- The node to add.- Throws:
IllegalArgumentException- if the given node is part of a list (i.e. if it has a previous or a next sibling)
-
hasChildren
public boolean hasChildren()
- Returns:
- true if the node has at least one child
-
getFirstChild
public PDOutlineItem getFirstChild()
- Returns:
- The first child or null if there is no child.
-
getLastChild
public PDOutlineItem getLastChild()
- Returns:
- The last child or null if there is no child.
-
getOpenCount
public int getOpenCount()
Get the number of open nodes or a negative number if this node is closed. See PDF Reference 32000-1:2008 table 152 and 153 for more details. This value is updated as you append children and siblings.- Returns:
- The Count attribute of the outline dictionary.
-
openNode
public void openNode()
This will set this node to be open when it is shown in the viewer. By default, when a new node is created it will be closed. This will do nothing if the node is already open.
-
closeNode
public void closeNode()
Close this node.
-
isNodeOpen
public boolean isNodeOpen()
- Returns:
- true if this node count is greater than zero, false otherwise.
-
children
public Iterable<PDOutlineItem> children()
- Returns:
- An
Iterableview of the items children
-
-