org.apache.pdfbox.pdmodel.interactive.documentnavigation.outline

## Class PDOutlineNode

- java.lang.Object
- - org.apache.pdfbox.pdmodel.common.PDDictionaryWrapper
  - - org.apache.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.

Author:
  Ben Litchfield

### Constructor Summary

Constructors
Constructor and Description
`PDOutlineNode()` Default Constructor.
`PDOutlineNode(COSDictionary dict)`

### Method Summary

All Methods Instance Methods Concrete Methods
`void` `addFirst(PDOutlineItem newChild)` Adds the given node to the top of the children list.
`void` `addLast(PDOutlineItem newChild)` Adds the given node to the bottom of the children list.
`Iterable<PDOutlineItem>` `children()`
`void` `closeNode()` Close this node.
`PDOutlineItem` `getFirstChild()`
`PDOutlineItem` `getLastChild()`
`int` `getOpenCount()` Get the number of open nodes or a negative number if this node is closed.
`boolean` `hasChildren()`
`boolean` `isNodeOpen()`
`void` `openNode()` This will set this node to be open when it is shown in the viewer.

### Methods inherited from class org.apache.pdfbox.pdmodel.common.PDDictionaryWrapper

`equals, getCOSObject, hashCode`

### Methods inherited from class java.lang.Object

`clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

### 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 `Iterable` view of the items children