diff options
author | Vincent Hennebert <vhennebert@apache.org> | 2007-03-27 13:46:22 +0000 |
---|---|---|
committer | Vincent Hennebert <vhennebert@apache.org> | 2007-03-27 13:46:22 +0000 |
commit | a19d73e700a125919809b3b83d3b629225cbc9f0 (patch) | |
tree | 1ea203f9892b5c8b31a2e60c9b92715766ccf525 /src/java | |
parent | 3c57004b384a4e3316d80b6b9b33f8ae8c224f64 (diff) | |
download | xmlgraphics-fop-a19d73e700a125919809b3b83d3b629225cbc9f0.tar.gz xmlgraphics-fop-a19d73e700a125919809b3b83d3b629225cbc9f0.zip |
Factorize in a method the code handling TableContentPosition elements, in TableContentLayoutManager.
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@522908 13f79535-47bb-0310-9956-ffa450edef68
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 |