diff options
Diffstat (limited to 'src/java')
-rw-r--r-- | src/java/org/apache/fop/layoutmgr/table/TableContentLayoutManager.java | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/src/java/org/apache/fop/layoutmgr/table/TableContentLayoutManager.java b/src/java/org/apache/fop/layoutmgr/table/TableContentLayoutManager.java index f9d7c6397..914f134af 100644 --- a/src/java/org/apache/fop/layoutmgr/table/TableContentLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/table/TableContentLayoutManager.java @@ -701,15 +701,16 @@ public class TableContentLayoutManager implements PercentBaseContext { } /** - * Iterates over a part of the table and paints the related elements. + * Iterates over a part of the table (header, footer, body) and paints the related + * elements. * - * @param iterator iterator over the table's header, body or footer elements + * @param iterator iterator over Position elements. Those positions correspond to the + * elements of the table present on the current page * @param painter */ private void iterateAndPaintPositions(Iterator iterator, RowPainter painter) { List lst = new java.util.ArrayList(); boolean firstPos = false; - boolean lastPos = false; TableBody body = null; while (iterator.hasNext()) { Position pos = (Position)iterator.next(); @@ -728,18 +729,9 @@ public class TableContentLayoutManager implements PercentBaseContext { if (tcpos.getFlag(TableContentPosition.LAST_IN_ROWGROUP) && tcpos.row.getFlag(EffRow.LAST_IN_PART)) { log.trace("LAST_IN_ROWGROUP + LAST_IN_PART"); - lastPos = true; - getTableLM().getCurrentPV().addMarkers(body.getMarkers(), - true, firstPos, lastPos); - int size = lst.size(); - for (int i = 0; i < size; i++) { - painter.handleTableContentPosition((TableContentPosition)lst.get(i)); - } - getTableLM().getCurrentPV().addMarkers(body.getMarkers(), - false, firstPos, lastPos); + handleMarkersAndPositions(lst, body, firstPos, true, painter); //reset firstPos = false; - lastPos = false; body = null; lst.clear(); } @@ -750,18 +742,26 @@ public class TableContentLayoutManager implements PercentBaseContext { } } if (body != null) { - getTableLM().getCurrentPV().addMarkers(body.getMarkers(), - true, firstPos, lastPos); - int size = lst.size(); - for (int i = 0; i < size; i++) { - painter.handleTableContentPosition((TableContentPosition)lst.get(i)); - } - getTableLM().getCurrentPV().addMarkers(body.getMarkers(), - false, firstPos, lastPos); + // Entering this block means that the end of the current table-part hasn't + // been reached (otherwise it would have been caught by the test above). So + // lastPos is necessarily false + handleMarkersAndPositions(lst, body, firstPos, false, painter); } painter.addAreasAndFlushRow(true); } - + + private void handleMarkersAndPositions(List positions, TableBody body, boolean firstPos, + boolean lastPos, RowPainter painter) { + getTableLM().getCurrentPV().addMarkers(body.getMarkers(), + true, firstPos, lastPos); + int size = positions.size(); + for (int i = 0; i < size; i++) { + painter.handleTableContentPosition((TableContentPosition)positions.get(i)); + } + getTableLM().getCurrentPV().addMarkers(body.getMarkers(), + false, firstPos, lastPos); + } + /** * Get the area for a row for background. * @param row the table-row object or null |