private BoxNode createBoxTree(ElementBox rootbox, Vector<BoxNode> boxlist, boolean useBounds, boolean useVisualBounds, boolean preserveAux)
    {
        //a working copy of the box list
        Vector<BoxNode> list = new Vector<BoxNode>(boxlist);

        //an artificial root node
        BoxNode root = new BoxNode(rootbox, page, zoom);
        root.setOrder(0);
        //detach the nodes from any old trees
        for (BoxNode node : list)
            node.removeFromTree();
        
        //when working with visual bounds, remove the boxes that are not visually separated
        if (!preserveAux)
        {
            for (Iterator<BoxNode> it = list.iterator(); it.hasNext(); )
            {
                BoxNode node = it.next();
                if (!node.isVisuallySeparated() || !node.isVisible())
                    it.remove();
            }
        }
        
        //let each node choose it's children - find the roots and parents
        for (BoxNode node : list)
        {
            if (useBounds)
                node.markNodesInside(list, useVisualBounds);
            else
                node.markChildNodes(list);
        }
        
        //choose the roots
        for (Iterator<BoxNode> it = list.iterator(); it.hasNext();)
        {
            BoxNode node = it.next();
            
            /*if (!full) //DEBUG
            {
               if (node.toString().contains("mediawiki") || node.toString().contains("globalWrapper"))
                    System.out.println(node + " => " + node.nearestParent);
            }*/
            
            if (node.isRootNode())
            {
                root.appendChild(node);
                it.remove();
            }
        }
        
        //recursively choose the children
        for (int i = 0; i < root.getChildCount(); i++)
            ((BoxNode) root.getChildAt(i)).takeChildren(list);
        
        return root;
    }
private BoxNode createBoxTree(ElementBox rootbox, Vector<BoxNode> boxlist, boolean useBounds, boolean useVisualBounds, boolean preserveAux)
    {
        
        Vector<BoxNode> list = new Vector<BoxNode>(boxlist);

        
        BoxNode root = new BoxNode(rootbox, page, zoom);
        root.setOrder(0);
        
        for (BoxNode node : list)
            node.removeFromTree();
        
        
        if (!preserveAux)
        {
            for (Iterator<BoxNode> it = list.iterator(); it.hasNext(); )
            {
                BoxNode node = it.next();
                if (!node.isVisuallySeparated() || !node.isVisible())
                    it.remove();
            }
        }
        
        
        for (BoxNode node : list)
        {
            if (useBounds)
                node.markNodesInside(list, useVisualBounds);
            else
                node.markChildNodes(list);
        }
        
        
        for (Iterator<BoxNode> it = list.iterator(); it.hasNext();)
        {
            BoxNode node = it.next();
            
            
            
            if (node.isRootNode())
            {
                root.appendChild(node);
                it.remove();
            }
        }
        
        
        for (int i = 0; i < root.getChildCount(); i++)
            ((BoxNode) root.getChildAt(i)).takeChildren(list);
        
        return root;
    }
private BoxNode createBoxTree ( ElementBox rootbox , Vector < BoxNode > boxlist , boolean useBounds , boolean useVisualBounds , boolean preserveAux ) { //a working copy of the box list Vector < BoxNode > list = new Vector < BoxNode > ( boxlist ) ; //an artificial root node BoxNode root = new BoxNode ( rootbox , page , zoom ) ; root . setOrder ( 0 ) ; //detach the nodes from any old trees for ( BoxNode node : list ) node . removeFromTree ( ) ; //when working with visual bounds, remove the boxes that are not visually separated if ( ! preserveAux ) { for ( Iterator < BoxNode > it = list . iterator ( ) ; it . hasNext ( ) ; ) { BoxNode node = it . next ( ) ; if ( ! node . isVisuallySeparated ( ) || ! node . isVisible ( ) ) it . remove ( ) ; } } //let each node choose it's children - find the roots and parents for ( BoxNode node : list ) { if ( useBounds ) node . markNodesInside ( list , useVisualBounds ) ; else node . markChildNodes ( list ) ; } //choose the roots for ( Iterator < BoxNode > it = list . iterator ( ) ; it . hasNext ( ) ; ) { BoxNode node = it . next ( ) ; /*if (!full) //DEBUG
            {
               if (node.toString().contains("mediawiki") || node.toString().contains("globalWrapper"))
                    System.out.println(node + " => " + node.nearestParent);
            }*/ if ( node . isRootNode ( ) ) { root . appendChild ( node ) ; it . remove ( ) ; } } //recursively choose the children for ( int i = 0 ; i < root . getChildCount ( ) ; i ++ ) ( ( BoxNode ) root . getChildAt ( i ) ) . takeChildren ( list ) ; return root ; }
Creates a tree of box nesting based on the content bounds of the boxes.
This tree is only used for determining the backgrounds.

@param boxlist the list of boxes to build the tree from
@param useBounds when set to {@code true}, the full or visual bounds are used for constructing the tree
depending on the {@code useVisualBounds} parameter. Otherwise, the original box hierarchy is used.
@param useVisualBounds when set to {@code true} the visual bounds are used for constructing the tree. Otherwise,
the content bounds are used.
@param preserveAux when set to {@code true}, all boxes are preserved. Otherwise, only the visually
distinguished ones are preserved.
Creates a tree of box nesting based on the content bounds of the boxes . This tree is only used for determining the backgrounds .