Class RowPainter


  • class RowPainter
    extends java.lang.Object
    • Field Detail

      • log

        private static org.apache.commons.logging.Log log
      • colCount

        private int colCount
      • currentRowOffset

        private int currentRowOffset
      • currentRow

        private EffRow currentRow
        Currently handled row (= last encountered row).
      • firstRowIndex

        private int firstRowIndex
        Index of the first row of the current part present on the current page.
      • firstRowOnPageIndex

        private int firstRowOnPageIndex
        Index of the very first row on the current page. Needed to properly handle BorderProps#COLLAPSE_OUTER. This is not the same as firstRowIndex when the table has headers!
      • rowOffsets

        private java.util.List rowOffsets
        Keeps track of the y-offsets of each row on a page. This is particularly needed for spanned cells where you need to know the y-offset of the starting row when the area is generated at the time the cell is closed.
      • cellHeights

        private int[] cellHeights
      • firstCellOnPage

        private boolean[] firstCellOnPage
      • firstCellParts

        private CellPart[] firstCellParts
      • lastCellParts

        private CellPart[] lastCellParts
      • tablePartOffset

        private int tablePartOffset
        y-offset of the current table part.
    • Method Detail

      • startTablePart

        void startTablePart​(TablePart tablePart)
      • endTablePart

        void endTablePart​(boolean lastInBody,
                          boolean lastOnPage)
        Signals that the end of the current table part is reached.
        Parameters:
        lastInBody - true if the part is the last table-body element to be displayed on the current page. In which case all the cells must be flushed even if they aren't finished, plus the proper collapsed borders must be selected (trailing instead of normal, or rest if the cell is unfinished)
        lastOnPage - true if the part is the last to be displayed on the current page. In which case collapsed after borders for the cells on the last row must be drawn in the outer mode
      • getAccumulatedBPD

        int getAccumulatedBPD()
      • handleTableContentPosition

        void handleTableContentPosition​(TableContentPosition tcpos)
        Records the fragment of row represented by the given position. If it belongs to another (grid) row than the current one, that latter is painted and flushed first.
        Parameters:
        tcpos - a position representing the row fragment
      • addAreasAndFlushRow

        private void addAreasAndFlushRow​(boolean lastInPart,
                                         boolean lastOnPage)
        Creates the areas corresponding to the last row. That is, an area with background for the row, plus areas for all the cells that finish on the row (not spanning over further rows).
        Parameters:
        lastInPart - true if the row is the last from its table part to be displayed on the current page. In which case all the cells must be flushed even if they aren't finished, plus the proper collapsed borders must be selected (trailing instead of normal, or rest if the cell is unfinished)
        lastOnPage - true if the row is the very last row of the table that will be displayed on the current page. In which case collapsed after borders must be drawn in the outer mode
      • computeContentLength

        private int computeContentLength​(PrimaryGridUnit pgu,
                                         int startIndex,
                                         int endIndex)
      • addAreasForCell

        private void addAreasForCell​(PrimaryGridUnit pgu,
                                     int startPos,
                                     int endPos,
                                     int rowHeight,
                                     int borderBeforeWhich,
                                     int borderAfterWhich,
                                     boolean lastOnPage)
      • addAreaForEmptyGridUnit

        private void addAreaForEmptyGridUnit​(EmptyGridUnit gu,
                                             int rowIndex,
                                             int colIndex,
                                             int actualRowHeight,
                                             int borderBeforeWhich,
                                             int borderAfterWhich,
                                             boolean lastOnPage)
      • registerPartBackgroundArea

        void registerPartBackgroundArea​(Block backgroundArea)
        Registers the given area, that will be used to render the part of table-header/footer/body background covered by a table-cell. If percentages are used to place the background image, the final bpd of the (fraction of) table part that will be rendered on the current page must be known. The traits can't then be set when the areas for the cell are created since at that moment this bpd is yet unknown. So they will instead be set in addAreasAndFlushRow(boolean, boolean).
        Parameters:
        backgroundArea - the block of the cell's dimensions that will hold the part background
      • recordRowOffset

        private void recordRowOffset​(int rowIndex,
                                     int offset)
        Records the y-offset of the row with the given index.
        Parameters:
        rowIndex - index of the row
        offset - y-offset of the row on the page
      • getRowOffset

        private int getRowOffset​(int rowIndex)
        Returns the offset of the row with the given index.
        Parameters:
        rowIndex - index of the row
        Returns:
        its y-offset on the page
      • startBody

        void startBody()
        Signals that the first table-body instance has started.
      • endBody

        void endBody()
        Signals that the last table-body instance has ended.