Class BlockLayoutManager

    • Field Detail

      • log

        private static org.apache.commons.logging.Log log
        logging instance
      • curBlockArea

        private Block curBlockArea
      • proxyLMiter

        protected java.util.ListIterator<LayoutManager> proxyLMiter
        Iterator over the child layout managers.
      • lead

        private int lead
      • lineHeight

        private Length lineHeight
      • follow

        private int follow
    • Constructor Detail

      • BlockLayoutManager

        public BlockLayoutManager​(Block inBlock)
        Creates a new BlockLayoutManager.
        Parameters:
        inBlock - the block FO object to create the layout manager for.
    • Method Detail

      • getNextKnuthElements

        public java.util.List getNextKnuthElements​(LayoutContext context,
                                                   int alignment)
        Get a sequence of KnuthElements representing the content of the node assigned to the LM.
        Specified by:
        getNextKnuthElements in interface LayoutManager
        Overrides:
        getNextKnuthElements in class BlockStackingLayoutManager
        Parameters:
        context - the LayoutContext used to store layout information
        alignment - the desired text alignment
        Returns:
        the list of KnuthElements
      • getNextKnuthElements

        public java.util.List getNextKnuthElements​(LayoutContext context,
                                                   int alignment,
                                                   java.util.Stack lmStack,
                                                   Position restartPosition,
                                                   LayoutManager restartAtLM)
        Returns an updated list of Knuth elements corresponding to this layout manager, after a change of IPD has been detected.
        Specified by:
        getNextKnuthElements in interface LayoutManager
        Overrides:
        getNextKnuthElements in class BlockStackingLayoutManager
        Parameters:
        context - the layout context
        alignment - the alignment
        lmStack - the stack of LMs that are active at the IPD change
        restartPosition - the position corresponding to the element finishing the page before the IPD change
        restartAtLM - if not null, the layout manager from which to restart. That is, the IPD change occurs between two block elements and not inside a paragraph
        Returns:
        an updated list of elements, taking the new IPD into account
      • getNextChildElements

        protected java.util.List<ListElement> getNextChildElements​(LayoutManager childLM,
                                                                   LayoutContext context,
                                                                   LayoutContext childLC,
                                                                   int alignment,
                                                                   java.util.Stack lmStack,
                                                                   Position restartPosition,
                                                                   LayoutManager restartAtLM)
        Overridden to take into account that the childLM may be the block's LineLayoutManager. Gets the next set of child elements for the given childLM. The default implementation basically copies the pending marks to the child layout context, and subsequently calls the appropriate variant of childLM.getNextKnuthElements(), passing it all relevant parameters.
        Overrides:
        getNextChildElements in class BlockStackingLayoutManager
        Parameters:
        childLM - the current child LM
        context - the layout context
        childLC - the child layout context
        alignment - the vertical alignment
        lmStack - the stack of currently active LMs (if any)
        restartPosition - the position to restart from (if any)
        restartAtLM - the LM to restart from (if any)
        Returns:
        list of elements corresponding to the content generated by childLM
      • resetSpaces

        private void resetSpaces()
      • createNextChildLMs

        public boolean createNextChildLMs​(int pos)
        Create more child LMs of the parent, up to child LM index pos
        Specified by:
        createNextChildLMs in interface LayoutManager
        Overrides:
        createNextChildLMs in class AbstractLayoutManager
        Parameters:
        pos - index up to which child LMs are requested
        Returns:
        true if requested index does exist
      • createLineManager

        private LineLayoutManager createLineManager​(LayoutManager firstlm)
        Create a new LineLM, and collect all consecutive inline generating LMs as its child LMs.
        Parameters:
        firstlm - First LM in new LineLM
        Returns:
        the newly created LineLM
      • addAreas

        public void addAreas​(PositionIterator parentIter,
                             LayoutContext layoutContext)
        Tell the layout manager to add all the child areas implied by Position objects which will be returned by the Iterator.
        Specified by:
        addAreas in interface LayoutManager
        Overrides:
        addAreas in class AbstractLayoutManager
        Parameters:
        parentIter - the position iterator
        layoutContext - the context
      • getParentArea

        public Area getParentArea​(Area childArea)
        Return an Area which can contain the passed childArea. The childArea may not yet have any content, but it has essential traits set. In general, if the LayoutManager already has an Area it simply returns it. Otherwise, it makes a new Area of the appropriate class. It gets a parent area for its area by calling its parent LM. Finally, based on the dimensions of the parent area, it initializes its own area. This includes setting the content IPD and the maximum BPD.
        Specified by:
        getParentArea in interface LayoutManager
        Overrides:
        getParentArea in class AbstractLayoutManager
        Parameters:
        childArea - area to get the parent area for
        Returns:
        the parent area
      • addChildArea

        public void addChildArea​(Area childArea)
        Add the childArea to the current area. Called by child LayoutManager when it has filled one of its areas. The LM should already have an Area in which to put the child. See if the area will fit in the current area. If so, add it. Otherwise initiate breaking.
        Specified by:
        addChildArea in interface LayoutManager
        Overrides:
        addChildArea in class BlockStackingLayoutManager
        Parameters:
        childArea - the area to add: will be some block-stacked Area.
      • flush

        protected void flush()
        Force current area to be added to parent area. Force current area to be added to parent area.
        Overrides:
        flush in class BlockStackingLayoutManager
      • getBlockFO

        protected Block getBlockFO()
        convenience method that returns the Block node
        Returns:
        the block node
      • isRestartable

        public boolean isRestartable()
        Returns true if this layout manager is able to re-generate its Knuth elements after an IPD change.
        Specified by:
        isRestartable in interface LayoutManager
        Overrides:
        isRestartable in class AbstractBaseLayoutManager
        Returns:
        true if this layout manager can be restarted after an IPD change