Class PDOutlineNode

    • Constructor Detail

      • PDOutlineNode

        public PDOutlineNode()
        Default Constructor.
      • PDOutlineNode

        public PDOutlineNode​(COSDictionary dict)
        Parameters:
        dict - The dictionary storage.
    • Method Detail

      • getParent

        PDOutlineNode getParent()
        Returns:
        The parent of this node or null if there is no parent.
      • addLast

        public void addLast​(PDOutlineItem newChild)
        Adds the given node to the bottom of the children list.
        Parameters:
        newChild - The node to add.
        Throws:
        java.lang.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:
        java.lang.IllegalArgumentException - if the given node is part of a list (i.e. if it has a previous or a next sibling)
      • requireSingleNode

        void requireSingleNode​(PDOutlineItem node)
        Parameters:
        node -
        Throws:
        java.lang.IllegalArgumentException - if the given node is part of a list (i.e. if it has a previous or a next sibling)
      • append

        private void append​(PDOutlineItem newChild)
        Appends the child to the linked list of children. This method only adjust pointers but doesn't take care of the Count key in the parent hierarchy.
        Parameters:
        newChild -
      • prepend

        private void prepend​(PDOutlineItem newChild)
        Prepends the child to the linked list of children. This method only adjust pointers but doesn't take care of the Count key in the parent hierarchy.
        Parameters:
        newChild -
      • updateParentOpenCountForAddedChild

        void updateParentOpenCountForAddedChild​(PDOutlineItem newChild)
      • 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.
      • setFirstChild

        void setFirstChild​(PDOutlineNode outlineNode)
        Set the first child, this will be maintained by this class.
        Parameters:
        outlineNode - The new first child.
      • getLastChild

        public PDOutlineItem getLastChild()
        Returns:
        The last child or null if there is no child.
      • setLastChild

        void setLastChild​(PDOutlineNode outlineNode)
        Set the last child, this will be maintained by this class.
        Parameters:
        outlineNode - The new last 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.
      • setOpenCount

        void setOpenCount​(int openCount)
        Set the open count. This number is automatically managed for you when you add items to the outline.
        Parameters:
        openCount - The new open count.
      • 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.
      • switchNodeCount

        private void switchNodeCount()
      • isNodeOpen

        public boolean isNodeOpen()
        Returns:
        true if this node count is greater than zero, false otherwise.
      • updateParentOpenCount

        void updateParentOpenCount​(int delta)
        The count parameter needs to be updated when you add, remove, open or close outline items.
        Parameters:
        delta - The amount to update by.
      • children

        public java.lang.Iterable<PDOutlineItem> children()
        Returns:
        An Iterable view of the items children