this.index = index;
this.bodyType = bodyType;
this.gridUnits = gridUnits;
+ // TODO this is ugly, but we may eventually be able to do without that index
+ for (Iterator guIter = gridUnits.iterator(); guIter.hasNext();) {
+ Object gu = guIter.next();
+ if (gu instanceof PrimaryGridUnit) {
+ ((PrimaryGridUnit) gu).setStartRow(index);
+ }
+ }
}
/** @return the index of the EffRow in the sequence of rows */
return null;
}
}
-
- /**
- * Sets a flag on all grid units of this effective row.
- * @param flag which flag to set (on of the GridUnit.* constants)
- * @param value new value for the flag
- */
- public void setFlagForAllGridUnits(int flag, boolean value) {
- Iterator iter = gridUnits.iterator();
- while (iter.hasNext()) {
- GridUnit gu = (GridUnit)iter.next();
- gu.setFlag(flag, value);
- }
- }
/**
* Returns a flag for this effective row. Only a subset of the flags on GridUnit is supported.
}
int columnIndex = cell.getColumnNumber() - 1;
PrimaryGridUnit pgu = new PrimaryGridUnit(cell, currentTableRow,
- table.getColumn(columnIndex), columnIndex, currentRowIndex);
+ table.getColumn(columnIndex), columnIndex);
List row = (List) rows.get(currentRowIndex);
row.set(columnIndex, pgu);
// TODO
* @param startCol index of the column this grid unit belongs to, zero-based
* @param startRow index of the row this grid unit belongs to, zero-based
*/
- PrimaryGridUnit(TableCell cell, TableRow row, TableColumn column, int startCol, int startRow) {
+ PrimaryGridUnit(TableCell cell, TableRow row, TableColumn column, int startCol) {
super(cell, row, column, startCol, 0, 0);
- this.startRow = startRow;
log.trace("PrimaryGridUnit created, row " + startRow + " col " + startCol);
}
rows.add(row);
}
+ void setStartRow(int startRow) {
+ this.startRow = startRow;
+ }
+
/**
* Returns the index of the row this grid unit belongs to.
*
private Iterator rowGroupsIter;
+ private int rowIndex = 0;
+
/**
* Creates a new TableRowIterator.
* @param table the table to iterate over
int i = 0;
for (Iterator rowIter = rowGroup.iterator(); rowIter.hasNext();) {
List gridUnits = (List) rowIter.next();
- effRowGroup[i] = new EffRow(i, tablePart, gridUnits);
- i++;
+ effRowGroup[i++] = new EffRow(rowIndex++, tablePart, gridUnits);
}
return effRowGroup;
}