Package org.apache.fop.layoutmgr.table
Class TableStepper
java.lang.Object
org.apache.fop.layoutmgr.table.TableStepper
This class processes row groups to create combined element lists for tables.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate List
Cells spanning the current row.private int
private int
Number of columns in the row group.private boolean
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.private static org.apache.commons.logging.Log
Loggerprivate List
Cells that will start the next row.private int
The class of the next break.private int
private boolean
private int
The first step for a row.private EffRow[]
private boolean
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).private TableContentLayoutManager
private int
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate void
activateCells
(List activeCellList, int rowIndex) Creates ActiveCell instances for cells starting on the row at the given index.private void
private int
Computes the next minimal step.private void
computeRowFirstStep
(List cells) Computes the minimal necessary step to make the next row fit.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.getCombinedKnuthElementsForRowGroup
(LayoutContext context, EffRow[] rows, int bodyType) Creates the combined element list for a row group.private int
Returns the first step for the current row group.private int
private int
Returns the next break possibility.private TableLayoutManager
private void
Pre-activates the cells that will start the next row, and computes the first step for that row.private void
private void
Initializes the fields of this instance to handle a new row group.private void
signalNextStep
(int step) Signals the next selected step to the active cells.private void
Signals the first step to the active cells, to allow them to add more content to the step if possible.private void
Actually switches to the next row, increasing activeRowIndex and transferring to activeCells the cells starting on the next row.
-
Field Details
-
log
private static org.apache.commons.logging.Log logLogger -
tclm
-
rowGroup
-
columnCount
private int columnCountNumber of columns in the row group. -
totalHeight
private int totalHeight -
previousRowsLength
private int previousRowsLength -
activeRowIndex
private int activeRowIndex -
rowFinished
private boolean rowFinished -
activeCells
Cells spanning the current row. -
nextActiveCells
Cells that will start the next row. -
delayingNextRow
private boolean delayingNextRowTrue 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 rowFirstStepThe 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 rowHeightSmallerThanFirstStepFlag 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 nextBreakClassThe class of the next break. One ofConstants.EN_AUTO
,Constants.EN_COLUMN
,Constants.EN_PAGE
,Constants.EN_EVEN_PAGE
,Constants.EN_ODD_PAGE
. Defaults to EN_AUTO.
-
-
Constructor Details
-
TableStepper
Main constructor- Parameters:
tclm
- The parent TableContentLayoutManager
-
-
Method Details
-
setup
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
Creates ActiveCell instances for cells starting on the row at the given index.- Parameters:
activeCellList
- the list that will hold the active cellsrowIndex
- 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 LayoutContextrows
- the row groupbodyType
- 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
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
- Returns:
- the table layout manager
-