Package org.apache.fop.layoutmgr.table
Class ActiveCell
- java.lang.Object
-
- org.apache.fop.layoutmgr.table.ActiveCell
-
class ActiveCell extends java.lang.ObjectA cell playing in the construction of steps for a row-group.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classActiveCell.FillerBoxprivate static classActiveCell.FillerPenaltyprivate static classActiveCell.StepAuxiliary class to store all the informations related to a breaking step.
-
Field Summary
Fields Modifier and Type Field Description private ActiveCell.StepafterNextStepThe step following nextStep.private intbpAfterNormalprivate intbpAfterTrailingprivate intbpBeforeLeadingprivate intbpBeforeNormalprivate java.util.ListelementListKnuth elements for this active cell.private intendRowIndexNumber of the row where the row-span ends, zero-based.private intincludedLengthLength of the Knuth elements already included in the steps.private KeepkeepWithNextprivate java.util.ListIteratorknuthIterIterator over the Knuth element list.private booleanlastCellPartTrue if the next CellPart that will be created will be the last one for this cell.private static org.apache.commons.logging.Loglogprivate ActiveCell.StepnextStepprivate intpaddingAfterNormalprivate intpaddingAfterTrailingprivate intpaddingBeforeLeadingprivate intpaddingBeforeNormalprivate PrimaryGridUnitpguprivate ActiveCell.SteppreviousStepprivate intremainingLengthLength of the Knuth elements not yet included in the steps.private intspanIndexprivate inttotalLengthTotal length of this cell's content plus the lengths of the previous rows.
-
Constructor Summary
Constructors Constructor Description ActiveCell(PrimaryGridUnit pgu, EffRow row, int rowIndex, int previousRowsLength, TableLayoutManager tableLM)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) voidaddFootnotes(java.util.List footnoteList)Adds the footnotes (if any) that are part of the next step, if this cell contributes content to the next step.(package private) CellPartcreateCellPart()Creates and returns a CellPart instance for the content of this cell which is included in the next step.(package private) voidendRow(int rowIndex)Receives indication that the current row is ending, and that (collapse) borders must be updated accordingly.(package private) booleanendsOnRow(int rowIndex)Returns true if this cell ends on the given row.(package private) booleanfinishes(int step)Returns true if this cell would be finished after the given step.(package private) static intgetElementContentLength(KnuthElement el)Returns the actual length of the content represented by the given element.(package private) intgetFirstStep()Returns the minimal step that is needed for this cell to contribute some content.(package private) KeepgetKeepWithNext()(package private) intgetLastStep()Returns the last step for this cell.(package private) intgetNextStep()Returns the total length up to the next legal break, not yet included in the steps.(package private) intgetPenaltyValue()(package private) PrimaryGridUnitgetPrimaryGridUnit()(package private) intgetRemainingLength()Returns the length of this cell's content not yet included in the steps, plus the cell's borders and paddings if applicable.private voidgotoNextLegalBreak()private voidhandleExplicitHeight(MinOptMax cellBPD, MinOptMax rowBPD)Modifies the cell's element list by putting filler elements, so that the cell's or row's explicit height is always reached.private booleanincludedInLastStep()private voidincreaseCurrentStep(int limit)Increases the next step up to the given limit.(package private) voidnextRowStarts()Receives indication that the next row is about to start, and that (collapse) borders must be updated accordingly.(package private) intsignalNextStep(int minStep)Signals the length of the chosen next step, so that this cell determines whether its own step may be included or not.(package private) voidsignalRowFirstStep(int firstStep)Gets the selected first step for the current row.(package private) voidsignalRowLastStep(int lastStep)java.lang.StringtoString()
-
-
-
Field Detail
-
log
private static org.apache.commons.logging.Log log
-
pgu
private PrimaryGridUnit pgu
-
elementList
private java.util.List elementList
Knuth elements for this active cell.
-
knuthIter
private java.util.ListIterator knuthIter
Iterator over the Knuth element list.
-
endRowIndex
private int endRowIndex
Number of the row where the row-span ends, zero-based.
-
remainingLength
private int remainingLength
Length of the Knuth elements not yet included in the steps.
-
totalLength
private int totalLength
Total length of this cell's content plus the lengths of the previous rows.
-
includedLength
private int includedLength
Length of the Knuth elements already included in the steps.
-
paddingBeforeNormal
private int paddingBeforeNormal
-
paddingBeforeLeading
private int paddingBeforeLeading
-
paddingAfterNormal
private int paddingAfterNormal
-
paddingAfterTrailing
private int paddingAfterTrailing
-
bpBeforeNormal
private int bpBeforeNormal
-
bpBeforeLeading
private int bpBeforeLeading
-
bpAfterNormal
private int bpAfterNormal
-
bpAfterTrailing
private int bpAfterTrailing
-
lastCellPart
private boolean lastCellPart
True if the next CellPart that will be created will be the last one for this cell.
-
keepWithNext
private Keep keepWithNext
-
spanIndex
private int spanIndex
-
previousStep
private ActiveCell.Step previousStep
-
nextStep
private ActiveCell.Step nextStep
-
afterNextStep
private ActiveCell.Step afterNextStep
The step following nextStep. Computing it early allows to calculateActiveCell.Step.condBeforeContentLength, thus to easily determine the remaining length. That also helps forincreaseCurrentStep(int).
-
-
Constructor Detail
-
ActiveCell
ActiveCell(PrimaryGridUnit pgu, EffRow row, int rowIndex, int previousRowsLength, TableLayoutManager tableLM)
-
-
Method Detail
-
getElementContentLength
static int getElementContentLength(KnuthElement el)
Returns the actual length of the content represented by the given element. In the case where this element is used as a filler to match a row's fixed height, the value returned by the getW() method will be higher than the actual content.- Parameters:
el- an element- Returns:
- the actual content length corresponding to the element
-
handleExplicitHeight
private void handleExplicitHeight(MinOptMax cellBPD, MinOptMax rowBPD)
Modifies the cell's element list by putting filler elements, so that the cell's or row's explicit height is always reached. TODO this will work properly only for the first break. Then the limitation explained on http://wiki.apache.org/xmlgraphics-fop/TableLayout/KnownProblems occurs. The list of elements needs to be re-adjusted after each break.
-
getPrimaryGridUnit
PrimaryGridUnit getPrimaryGridUnit()
-
endsOnRow
boolean endsOnRow(int rowIndex)
Returns true if this cell ends on the given row.- Parameters:
rowIndex- index of a row in the row-group, zero-based- Returns:
- true if this cell ends on the given row
-
getRemainingLength
int getRemainingLength()
Returns the length of this cell's content not yet included in the steps, plus the cell's borders and paddings if applicable.- Returns:
- the remaining length, zero if the cell is finished
-
gotoNextLegalBreak
private void gotoNextLegalBreak()
-
getFirstStep
int getFirstStep()
Returns the minimal step that is needed for this cell to contribute some content.- Returns:
- the step for this cell's first legal break
-
getLastStep
int getLastStep()
Returns the last step for this cell. This includes the normal border- and padding-before, the whole content, the normal padding-after, and the trailing after border. Indeed, if the normal border is taken instead, and appears to be smaller than the trailing one, the last step may be smaller than the current step (see TableStepper#considerRowLastStep). This will produce a wrong infinite penalty, plus the cell's content won't be taken into account since the final step will be smaller than the current one (seesignalNextStep(int)). This actually means that the content will be swallowed.- Returns:
- the length of last step
-
increaseCurrentStep
private void increaseCurrentStep(int limit)
Increases the next step up to the given limit.- Parameters:
limit- the length up to which the next step is allowed to increase- See Also:
signalRowFirstStep(int),signalRowLastStep(int)
-
signalRowFirstStep
void signalRowFirstStep(int firstStep)
Gets the selected first step for the current row. If this cell's first step is smaller, then it may be able to add some more of its content, since there will be no break before the given step anyway.- Parameters:
firstStep- the current row's first step
-
signalRowLastStep
void signalRowLastStep(int lastStep)
-
getNextStep
int getNextStep()
Returns the total length up to the next legal break, not yet included in the steps.- Returns:
- the total length up to the next legal break (-1 signals no further step)
-
includedInLastStep
private boolean includedInLastStep()
-
signalNextStep
int signalNextStep(int minStep)
Signals the length of the chosen next step, so that this cell determines whether its own step may be included or not.- Parameters:
minStep- length of the chosen next step- Returns:
- the break class of the step, if any. One of
Constants.EN_AUTO,Constants.EN_COLUMN,Constants.EN_PAGE,Constants.EN_EVEN_PAGE,Constants.EN_ODD_PAGE. EN_AUTO if this cell's step is not included in the next step.
-
nextRowStarts
void nextRowStarts()
Receives indication that the next row is about to start, and that (collapse) borders must be updated accordingly.
-
endRow
void endRow(int rowIndex)
Receives indication that the current row is ending, and that (collapse) borders must be updated accordingly.- Parameters:
rowIndex- the index of the ending row
-
finishes
boolean finishes(int step)
Returns true if this cell would be finished after the given step. That is, it would be included in the step and the end of its content would be reached.- Parameters:
step- the next step- Returns:
- true if this cell finishes at the given step
-
createCellPart
CellPart createCellPart()
Creates and returns a CellPart instance for the content of this cell which is included in the next step.- Returns:
- a CellPart instance
-
addFootnotes
void addFootnotes(java.util.List footnoteList)
Adds the footnotes (if any) that are part of the next step, if this cell contributes content to the next step.- Parameters:
footnoteList- the list to which this cell must add its footnotes
-
getKeepWithNext
Keep getKeepWithNext()
-
getPenaltyValue
int getPenaltyValue()
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-