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();
if (pos instanceof TableContentPosition) {
TableContentPosition tcpos = (TableContentPosition)pos;
lst.add(tcpos);
GridUnitPart part = (GridUnitPart)tcpos.gridUnitParts.get(0);
if (body == null) {
body = part.pgu.getBody();
}
if (tcpos.getFlag(TableContentPosition.FIRST_IN_ROWGROUP)
&& tcpos.row.getFlag(EffRow.FIRST_IN_BODY)) {
firstPos = true;
}
if (tcpos.getFlag(TableContentPosition.LAST_IN_ROWGROUP)
&& tcpos.row.getFlag(EffRow.LAST_IN_BODY)) {
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);
//reset
firstPos = false;
lastPos = false;
body = null;
lst.clear();
}
} else {
log.debug("Ignoring position: " + pos);
}
}
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);
}
}