private List rows = new java.util.ArrayList();
//private int indexOfFirstRowInList;
private int currentIndex = -1;
+ private int pendingRowSpans;
//prefetch state
private ListIterator bodyIterator = null;
}
EffRow lastRowInGroup = firstRowInGroup;
int lastIndex = lastRowInGroup.getIndex();
- boolean allFinished = true;
+ boolean allFinished;
do {
+ allFinished = true;
Iterator iter = lastRowInGroup.getGridUnits().iterator();
while (iter.hasNext()) {
GridUnit gu = (GridUnit)iter.next();
break;
}
}
+ lastIndex = lastRowInGroup.getIndex();
if (!allFinished) {
- lastIndex = lastRowInGroup.getIndex();
lastRowInGroup = getNextRow();
if (lastRowInGroup == null) {
allFinished = true;
if (childInBodyIterator != null) {
if (!childInBodyIterator.hasNext()) {
//force skip on to next body
+ if (pendingRowSpans > 0) {
+ this.currentRow.clear();
+ this.currentRowIndex++;
+ EffRow gridUnits = buildGridRow(this.currentRow, null);
+ log.debug(gridUnits);
+ rows.add(gridUnits);
+ return true;
+ }
childInBodyIterator = null;
if (rows.size() > 0) {
getCachedRow(rows.size() - 1).setFlagForAllGridUnits(
//Create all row-spanned grid units based on information from the last row
int colnum = 1;
- ListIterator spanIter = lastRowsSpanningCells.listIterator();
GridUnit[] horzSpan = null;
- while (spanIter.hasNext()) {
- GridUnit gu = (GridUnit)spanIter.next();
- if (gu != null) {
- if (gu.getColSpanIndex() == 0) {
- horzSpan = new GridUnit[gu.getCell().getNumberColumnsSpanned()];
- }
- GridUnit newGU = gu.createNextRowSpanningGridUnit();
- newGU.setRow(rowFO);
- safelySetListItem(gridUnits, colnum - 1, newGU);
- horzSpan[newGU.getColSpanIndex()] = newGU;
- if (newGU.isLastGridUnitColSpan()) {
- //Add the array of row-spanned grid units to the primary grid unit
- newGU.getPrimary().addRow(horzSpan);
- horzSpan = null;
- }
- if (newGU.isLastGridUnitRowSpan()) {
- spanIter.set(null);
- } else {
- spanIter.set(newGU);
+ if (pendingRowSpans > 0) {
+ ListIterator spanIter = lastRowsSpanningCells.listIterator();
+ while (spanIter.hasNext()) {
+ GridUnit gu = (GridUnit)spanIter.next();
+ if (gu != null) {
+ if (gu.getColSpanIndex() == 0) {
+ horzSpan = new GridUnit[gu.getCell().getNumberColumnsSpanned()];
+ }
+ GridUnit newGU = gu.createNextRowSpanningGridUnit();
+ newGU.setRow(rowFO);
+ safelySetListItem(gridUnits, colnum - 1, newGU);
+ horzSpan[newGU.getColSpanIndex()] = newGU;
+ if (newGU.isLastGridUnitColSpan()) {
+ //Add the array of row-spanned grid units to the primary grid unit
+ newGU.getPrimary().addRow(horzSpan);
+ horzSpan = null;
+ }
+ if (newGU.isLastGridUnitRowSpan()) {
+ spanIter.set(null);
+ pendingRowSpans--;
+ } else {
+ spanIter.set(newGU);
+ }
}
+ colnum++;
}
- colnum++;
}
//Transfer available cells to their slots
safelySetListItem(gridUnits, colnum - 1, gu);
boolean hasRowSpanningLeft = !gu.isLastGridUnitRowSpan();
if (hasRowSpanningLeft) {
+ pendingRowSpans++;
safelySetListItem(lastRowsSpanningCells, colnum - 1, gu);
}
if (elementLists[i] == null) {
continue;
}
- if (getActivePrimaryGridUnit(i).getCell().getNumberRowsSpanned() > 1) {
+ if (end[i] == elementLists[i].size() - 1) {
+ continue;
+ }
+ GridUnit gu = getActiveGridUnit(i);
+ if (!gu.isLastGridUnitRowSpan()) {
continue;
}
int len = widths[i];
if (len > 0) {
len += borderBefore[i] + borderAfter[i];
}
- if (len == rowGroup[activeRow].getHeight().opt) {
+ int nominalHeight = rowGroup[activeRow].getHeight().opt;
+ for (int r = 0; r < gu.getRowSpanIndex(); r++) {
+ nominalHeight += rowGroup[activeRow - r - 1].getHeight().opt;
+ }
+ if (len == nominalHeight) {
//row is filled
maxW = 0;
break;
}
- maxW = Math.max(maxW, rowGroup[activeRow].getHeight().opt - len);
+ maxW = Math.max(maxW, nominalHeight - len);
}
}
for (int i = activeRow + 1; i < rowGroup.length; i++) {
private void setupElementList(int column) {
GridUnit gu = getActiveGridUnit(column);
EffRow row = getActiveRow();
- if (gu.isPrimary() && !gu.isEmpty()) {
+ if (gu.isEmpty()){
+ elementLists[column] = null;
+ start[column] = 0;
+ end[column] = -1;
+ widths[column] = 0;
+ startRow[column] = activeRow;
+ keepWithNextSignals[column] = false;
+ } else if (gu.isPrimary()) {
PrimaryGridUnit pgu = (PrimaryGridUnit)gu;
boolean makeBoxForWholeRow = false;
if (row.getExplicitHeight().min > 0) {