Class TableContentLayoutManager

  • All Implemented Interfaces:
    PercentBaseContext

    public class TableContentLayoutManager
    extends java.lang.Object
    implements PercentBaseContext
    Layout manager for table contents, particularly managing the creation of combined element lists.
    • Field Detail

      • LOG

        private static final org.apache.commons.logging.Log LOG
        Logger
      • headerList

        private java.util.LinkedList headerList
      • footerList

        private java.util.LinkedList footerList
      • headerNetHeight

        private int headerNetHeight
      • footerNetHeight

        private int footerNetHeight
      • startXOffset

        private int startXOffset
      • usedBPD

        private int usedBPD
      • headerIsBeingRepeated

        private boolean headerIsBeingRepeated
      • atLeastOnce

        private boolean atLeastOnce
    • Constructor Detail

      • TableContentLayoutManager

        TableContentLayoutManager​(TableLayoutManager parent)
        Main constructor
        Parameters:
        parent - Parent layout manager
    • Method Detail

      • isSeparateBorderModel

        boolean isSeparateBorderModel()
        Returns:
        true if the table uses the separate border model.
      • getColumns

        ColumnSetup getColumns()
        Returns:
        the column setup of this table
      • getHeaderNetHeight

        protected int getHeaderNetHeight()
        Returns:
        the net header height
      • getFooterNetHeight

        protected int getFooterNetHeight()
        Returns:
        the net footer height
      • getHeaderElements

        protected java.util.LinkedList getHeaderElements()
        Returns:
        the header element list
      • getFooterElements

        protected java.util.LinkedList getFooterElements()
        Returns:
        the footer element list
      • 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.
        Parameters:
        context - the LayoutContext used to store layout information
        alignment - the desired text alignment
        Returns:
        the list of KnuthElements
        See Also:
        LayoutManager.getNextKnuthElements(LayoutContext, int)
      • getFootnotesBPD

        private int getFootnotesBPD​(java.util.List<java.util.List<KnuthElement>> footnotes)
      • getKnuthElementsForRowIterator

        private java.util.LinkedList getKnuthElementsForRowIterator​(TableRowIterator iter,
                                                                    LayoutContext context,
                                                                    int alignment,
                                                                    int bodyType)
        Creates Knuth elements by iterating over a TableRowIterator.
        Parameters:
        iter - TableRowIterator instance to fetch rows from
        context - Active LayoutContext
        alignment - alignment indicator
        bodyType - Indicates what kind of body is being processed (BODY, HEADER or FOOTER)
        Returns:
        An element list
      • getXOffsetOfGridUnit

        protected int getXOffsetOfGridUnit​(PrimaryGridUnit gu)
        Returns the X offset of the given grid unit.
        Parameters:
        gu - the grid unit
        Returns:
        the requested X offset
      • getXOffsetOfGridUnit

        protected int getXOffsetOfGridUnit​(int colIndex,
                                           int nrColSpan)
        Returns the X offset of the grid unit in the given column.
        Parameters:
        colIndex - the column index (zero-based)
        nrColSpan - number columns spanned
        Returns:
        the requested X offset
      • addAreas

        void addAreas​(PositionIterator parentIter,
                      LayoutContext layoutContext)
        Adds the areas generated by this layout manager to the area tree.
        Parameters:
        parentIter - the position iterator
        layoutContext - the layout context for adding areas
      • addHeaderFooterAreas

        private void addHeaderFooterAreas​(java.util.List elements,
                                          TablePart part,
                                          RowPainter painter,
                                          boolean lastOnPage)
      • addBodyAreas

        private void addBodyAreas​(java.util.Iterator iterator,
                                  RowPainter painter,
                                  boolean lastOnPage)
        Iterates over the positions corresponding to the table's body (which may contain several table-body elements!) and adds the corresponding areas.
        Parameters:
        iterator - iterator over TableContentPosition elements. Those positions correspond to the elements of the body present on the current page
        painter -
        lastOnPage - true if the table has no footer (then the last line of the table that will be present on the page belongs to the body)
      • addTablePartAreas

        private void addTablePartAreas​(java.util.List positions,
                                       RowPainter painter,
                                       TablePart body,
                                       boolean isFirstPos,
                                       boolean isLastPos,
                                       boolean lastInBody,
                                       boolean lastOnPage)
        Adds the areas corresponding to a single fo:table-header/footer/body element.
      • setStartXOffset

        void setStartXOffset​(int startXOffset)
        Sets the overall starting x-offset. Used for proper placement of cells.
        Parameters:
        startXOffset - starting x-offset (table's start-indent)
      • getUsedBPD

        int getUsedBPD()
        Returns:
        the amount of block-progression-dimension used by the content
      • getBaseLength

        public int getBaseLength​(int lengthBase,
                                 FObj fobj)
        Returns the base length for the given length base. Length base should be one of the constants defined in LengthBase.
        Specified by:
        getBaseLength in interface PercentBaseContext
        Parameters:
        lengthBase - Indicates which type of the base length value is to be returned
        fobj - The FO object against which the percentage should be evaluated
        Returns:
        The base length value of the given kind