Class BaseBoxTreeBuilder

    • Field Detail

      • pageUrl

        protected URL pageUrl
      • pageTitle

        protected String pageTitle
      • useVisualBounds

        protected boolean useVisualBounds
        Use real visual bounds instead of the element content bounds for building the box hierarchy
      • preserveAux

        protected boolean preserveAux
        Preserve auxiliary boxes that have no actual visual result
    • Constructor Detail

      • BaseBoxTreeBuilder

        public BaseBoxTreeBuilder​(boolean useVisualBounds,
                                  boolean preserveAux)
    • Method Detail

      • getPage

        public abstract Page getPage()
        The resulting page model.
        Returns:
        the page
      • buildTree

        protected Box buildTree​(List<Box> boxlist,
                                Color bgColor)
      • markChildNodes

        public void markChildNodes​(Box parent,
                                   List<Box> list,
                                   List<Box> parents)
        Takes a list of nodes and selects the nodes whose parent box is identical to this node's box. The nearestParent of the selected boxes is set to this box node.
        Parameters:
        list - the list of nodes to test
      • markNodesInside

        protected void markNodesInside​(Box parent,
                                       List<Box> list,
                                       boolean useVisualBounds,
                                       List<Box> parents)
        Takes a list of nodes and selects the nodes that are located directly inside of this node's box. The corresponding positions in the destination list of parents is set to the parent box.
        Parameters:
        parent - the parent node to consider
        list - the list of nodes to test
        useVisualBounds - when set to true, only the boxes within the visual bounds are considered. Otherwise, all the nodes within the box content bounds are considered.
        parents - the list of parent boxes where the parent nodes are marked. The list must have the same size as list.
      • takeChildren

        protected void takeChildren​(Box parent,
                                    List<Box> list,
                                    List<Box> parents)
        Goes through the parent's children, takes all the nodes that are inside of this node and makes them the children of this node. Then, recursively calls the children to take their nodes.
      • contentEncloses

        protected boolean contentEncloses​(Box parent,
                                          Box child)
      • visuallyEncloses

        protected boolean visuallyEncloses​(Box parent,
                                           Box child)
      • computeBackgrounds

        protected void computeBackgrounds​(Box root,
                                          Color currentbg)
        Computes efficient background color for all the nodes in the tree
      • recomputeBounds

        public void recomputeBounds​(Box root,
                                    boolean useVisualBounds)
        Recomputes the total bounds of the whole subtree. The bounds of each box will correspond to its visual bounds. If the child boxes exceed the parent box, the parent box bounds will be expanded accordingly.
        Parameters:
        root - the root node of the subtree
        useVisualBounds - use the visual bounds instead of the content bounds
      • recomputeVisualBounds

        protected void recomputeVisualBounds​(List<Box> boxes)
        Recomputes the visual bounds for a list of boxes.
        Parameters:
        boxes -
      • recomputeVisualBounds

        protected void recomputeVisualBounds​(Box root)
        Recomputes the visual bounds of the whole subtree.
        Parameters:
        root - the root node of the subtree
      • computeVisualBounds

        protected Rectangular computeVisualBounds​(Box box)
      • getMinimalVisualBounds

        protected Rectangular getMinimalVisualBounds​(Box box)
        Returns the minimal bounds of the box for enclosing all the contained boxes.
        Returns:
        the minimal visual bounds