Class TableStepper

java.lang.Object
org.apache.fop.layoutmgr.table.TableStepper

public class TableStepper extends Object
This class processes row groups to create combined element lists for tables.
  • Field Details

    • log

      private static org.apache.commons.logging.Log log
      Logger
    • tclm

    • rowGroup

      private EffRow[] rowGroup
    • columnCount

      private int columnCount
      Number of columns in the row group.
    • totalHeight

      private int totalHeight
    • previousRowsLength

      private int previousRowsLength
    • activeRowIndex

      private int activeRowIndex
    • rowFinished

      private boolean rowFinished
    • activeCells

      private List activeCells
      Cells spanning the current row.
    • nextActiveCells

      private List nextActiveCells
      Cells that will start the next row.
    • delayingNextRow

      private boolean delayingNextRow
      True if the next row is being delayed, that is, if cells spanning the current and the next row have steps smaller than the next row's first step. In this case the next row may be extended to offer additional break possibilities.
    • rowFirstStep

      private int rowFirstStep
      The first step for a row. This is the minimal step necessary to include some content from all the cells starting the row.
    • rowHeightSmallerThanFirstStep

      private boolean rowHeightSmallerThanFirstStep
      Flag used to produce an infinite penalty if the height of the current row is smaller than the first step for that row (may happen with row-spanning cells).
      See Also:
    • nextBreakClass

      private int nextBreakClass
      The class of the next break. One of Constants.EN_AUTO, Constants.EN_COLUMN, Constants.EN_PAGE, Constants.EN_EVEN_PAGE, Constants.EN_ODD_PAGE. Defaults to EN_AUTO.
  • Constructor Details

    • TableStepper

      public TableStepper(TableContentLayoutManager tclm)
      Main constructor
      Parameters:
      tclm - The parent TableContentLayoutManager
  • Method Details

    • setup

      private void setup(EffRow[] rows)
      Initializes the fields of this instance to handle a new row group.
      Parameters:
      rows - the new row group to handle
    • calcTotalHeight

      private void calcTotalHeight()
    • getMaxRemainingHeight

      private int getMaxRemainingHeight()
    • activateCells

      private void activateCells(List activeCellList, int rowIndex)
      Creates ActiveCell instances for cells starting on the row at the given index.
      Parameters:
      activeCellList - the list that will hold the active cells
      rowIndex - the index of the row from which cells must be activated
    • getCombinedKnuthElementsForRowGroup

      public LinkedList getCombinedKnuthElementsForRowGroup(LayoutContext context, EffRow[] rows, int bodyType)
      Creates the combined element list for a row group.
      Parameters:
      context - Active LayoutContext
      rows - the row group
      bodyType - Indicates what type of body is processed (body, header or footer)
      Returns:
      the combined element list
    • getFirstStep

      private int getFirstStep()
      Returns the first step for the current row group.
      Returns:
      the first step for the current row group
    • getNextStep

      private int getNextStep()
      Returns the next break possibility.
      Returns:
      the next step
    • computeRowFirstStep

      private void computeRowFirstStep(List cells)
      Computes the minimal necessary step to make the next row fit. That is, so such as cell on the next row can contribute some content.
      Parameters:
      cells - the cells occupying the next row (may include cells starting on previous rows and spanning over this one)
    • computeMinStep

      private int computeMinStep()
      Computes the next minimal step.
      Returns:
      the minimal step from the active cells, < 0 if there is no such step
    • signalRowFirstStep

      private void signalRowFirstStep()
      Signals the first step to the active cells, to allow them to add more content to the step if possible.
      See Also:
    • signalNextStep

      private void signalNextStep(int step)
      Signals the next selected step to the active cells.
      Parameters:
      step - the next step
    • considerRowLastStep

      private int considerRowLastStep(int step)
      Determines if the given step will finish the current row, and if so switch to the last step for this row.

      If the row is finished then the after borders for the cell may change (their conditionalities no longer apply for the cells ending on the current row). Thus the final step may grow with respect to the given one.

      In more rare occasions, the given step may correspond to the first step of a row-spanning cell, and may be greater than the height of the current row (consider, for example, an unbreakable cell spanning three rows). In such a case the returned step will correspond to the row height and a flag will be set to produce an infinite penalty for this step. This will prevent the breaking algorithm from choosing this break, but still allow to create the appropriate TableContentPosition for the cells ending on the current row.

      Parameters:
      step - the next step
      Returns:
      the updated step if any
    • prepareNextRow

      private void prepareNextRow()
      Pre-activates the cells that will start the next row, and computes the first step for that row.
    • removeCellsEndingOnCurrentRow

      private void removeCellsEndingOnCurrentRow()
    • switchToNextRow

      private void switchToNextRow()
      Actually switches to the next row, increasing activeRowIndex and transferring to activeCells the cells starting on the next row.
    • getTableLM

      private TableLayoutManager getTableLM()
      Returns:
      the table layout manager