Package org.apache.fop.layoutmgr.table
Class RowPainter
- java.lang.Object
-
- org.apache.fop.layoutmgr.table.RowPainter
-
class RowPainter extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description private int[]
cellHeights
private int
colCount
private EffRow
currentRow
Currently handled row (= last encountered row).private int
currentRowOffset
private boolean[]
firstCellOnPage
private CellPart[]
firstCellParts
private int
firstRowIndex
Index of the first row of the current part present on the current page.private int
firstRowOnPageIndex
Index of the very first row on the current page.private CellPart[]
lastCellParts
private LayoutContext
layoutContext
private static org.apache.commons.logging.Log
log
private java.util.List
rowOffsets
Keeps track of the y-offsets of each row on a page.private CommonBorderPaddingBackground
tablePartBackground
private java.util.List
tablePartBackgroundAreas
private int
tablePartOffset
y-offset of the current table part.private TableContentLayoutManager
tclm
-
Constructor Summary
Constructors Constructor Description RowPainter(TableContentLayoutManager tclm, LayoutContext layoutContext)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
addAreaForEmptyGridUnit(EmptyGridUnit gu, int rowIndex, int colIndex, int actualRowHeight, int borderBeforeWhich, int borderAfterWhich, boolean lastOnPage)
private void
addAreasAndFlushRow(boolean lastInPart, boolean lastOnPage)
Creates the areas corresponding to the last row.private void
addAreasForCell(PrimaryGridUnit pgu, int startPos, int endPos, int rowHeight, int borderBeforeWhich, int borderAfterWhich, boolean lastOnPage)
private int
computeContentLength(PrimaryGridUnit pgu, int startIndex, int endIndex)
(package private) void
endBody()
Signals that the last table-body instance has ended.(package private) void
endTablePart(boolean lastInBody, boolean lastOnPage)
Signals that the end of the current table part is reached.(package private) int
getAccumulatedBPD()
private int
getRowOffset(int rowIndex)
Returns the offset of the row with the given index.(package private) void
handleTableContentPosition(TableContentPosition tcpos)
Records the fragment of row represented by the given position.private void
recordRowOffset(int rowIndex, int offset)
Records the y-offset of the row with the given index.(package private) 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.(package private) void
startBody()
Signals that the first table-body instance has started.(package private) void
startTablePart(TablePart tablePart)
-
-
-
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).
-
layoutContext
private LayoutContext layoutContext
-
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 handleBorderProps#COLLAPSE_OUTER
. This is not the same asfirstRowIndex
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.
-
tablePartBackground
private CommonBorderPaddingBackground tablePartBackground
-
tablePartBackgroundAreas
private java.util.List tablePartBackgroundAreas
-
tclm
private TableContentLayoutManager tclm
-
-
Constructor Detail
-
RowPainter
RowPainter(TableContentLayoutManager tclm, LayoutContext layoutContext)
-
-
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 inaddAreasAndFlushRow(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 rowoffset
- 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.
-
-