You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-commits@xmlgraphics.apache.org by vh...@apache.org on 2007/11/14 12:14:08 UTC
svn commit: r594836 - in
/xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/table:
EmptyGridUnit.java FixedColRowGroupBuilder.java GridUnit.java
PrimaryGridUnit.java RowGroupBuilder.java TableBody.java
VariableColRowGroupBuilder.java
Author: vhennebert
Date: Wed Nov 14 03:14:03 2007
New Revision: 594836
URL: http://svn.apache.org/viewvc?rev=594836&view=rev
Log:
Restored the setting of the parent table-row element on grid units
Modified:
xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/table/EmptyGridUnit.java
xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/table/FixedColRowGroupBuilder.java
xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/table/GridUnit.java
xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/table/PrimaryGridUnit.java
xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/table/RowGroupBuilder.java
xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/table/TableBody.java
xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/table/VariableColRowGroupBuilder.java
Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/table/EmptyGridUnit.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/table/EmptyGridUnit.java?rev=594836&r1=594835&r2=594836&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/table/EmptyGridUnit.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/table/EmptyGridUnit.java Wed Nov 14 03:14:03 2007
@@ -27,16 +27,16 @@
*/
public class EmptyGridUnit extends GridUnit {
- private TableRow row;
private TableBody body;
/**
* @param table the containing table
+ * @param row the table-row element this grid unit belongs to (if any)
* @param startRow index of the row this grid unit belongs to, 0-based
* @param startCol column index, 0-based
*/
- EmptyGridUnit(Table table, int startRow, int startCol) {
- super(table, table.getColumn(startCol), startCol, 0, 0);
+ EmptyGridUnit(Table table, TableRow row, int startRow, int startCol) {
+ super(table, row, table.getColumn(startCol), startCol, 0, 0);
}
/** {@inheritDoc} */
@@ -60,11 +60,6 @@
/** {@inheritDoc} */
public TableBody getBody() {
return this.body;
- }
-
- /** {@inheritDoc} */
- public TableRow getRow() {
- return this.row;
}
/** {@inheritDoc} */
Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/table/FixedColRowGroupBuilder.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/table/FixedColRowGroupBuilder.java?rev=594836&r1=594835&r2=594836&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/table/FixedColRowGroupBuilder.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/table/FixedColRowGroupBuilder.java Wed Nov 14 03:14:03 2007
@@ -35,6 +35,8 @@
/** Number of columns in the corresponding table. */
private int numberOfColumns;
+ private TableRow currentTableRow = null;
+
/** 0-based, index in the row group. */
private int currentRowIndex;
@@ -83,15 +85,15 @@
rows.add(effRow);
}
int columnIndex = cell.getColumnNumber() - 1;
- PrimaryGridUnit pgu = new PrimaryGridUnit(cell, table.getColumn(columnIndex), columnIndex,
- currentRowIndex);
+ PrimaryGridUnit pgu = new PrimaryGridUnit(cell, currentTableRow,
+ table.getColumn(columnIndex), columnIndex, currentRowIndex);
List row = (List) rows.get(currentRowIndex);
row.set(columnIndex, pgu);
// TODO
GridUnit[] cellRow = new GridUnit[cell.getNumberColumnsSpanned()];
cellRow[0] = pgu;
for (int j = 1; j < cell.getNumberColumnsSpanned(); j++) {
- GridUnit gu = new GridUnit(pgu, table.getColumn(columnIndex + j),
+ GridUnit gu = new GridUnit(pgu, currentTableRow, table.getColumn(columnIndex + j),
columnIndex + j, j, 0);
row.set(columnIndex + j, gu);
cellRow[j] = gu;
@@ -101,7 +103,7 @@
row = (List) rows.get(currentRowIndex + i);
cellRow = new GridUnit[cell.getNumberColumnsSpanned()];
for (int j = 0; j < cell.getNumberColumnsSpanned(); j++) {
- GridUnit gu = new GridUnit(pgu, table.getColumn(columnIndex + j),
+ GridUnit gu = new GridUnit(pgu, currentTableRow, table.getColumn(columnIndex + j),
columnIndex + j, j, i);
row.set(columnIndex + j, gu);
cellRow[j] = gu;
@@ -117,13 +119,18 @@
}
/** {@inheritDoc} */
+ void startRow(TableRow tableRow) {
+ currentTableRow = tableRow;
+ }
+
+ /** {@inheritDoc} */
void endRow(TableCellContainer container) {
List currentRow = (List) rows.get(currentRowIndex);
lastRow = currentRow;
// Fill gaps with empty grid units
for (int i = 0; i < numberOfColumns; i++) {
if (currentRow.get(i) == null) {
- currentRow.set(i, new EmptyGridUnit(table, currentRowIndex, i));
+ currentRow.set(i, new EmptyGridUnit(table, currentTableRow, currentRowIndex, i));
}
}
borderResolver.endRow(currentRow, container);
@@ -146,6 +153,7 @@
} else {
currentRowIndex++;
}
+ currentTableRow = null;
}
/** {@inheritDoc} */
Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/table/GridUnit.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/table/GridUnit.java?rev=594836&r1=594835&r2=594836&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/table/GridUnit.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/table/GridUnit.java Wed Nov 14 03:14:03 2007
@@ -69,7 +69,7 @@
/** Table cell which occupies this grid unit */
protected TableCell cell;
- /** Table row which occupies this grid unit (may be null) */
+ /** Table row occupied by this grid unit (may be null). */
private TableRow row;
/** Table column that this grid unit belongs to */
@@ -98,14 +98,15 @@
* Creates a new grid unit.
*
* @param table the containing table
+ * @param row the table-row element this grid unit belongs to (if any)
* @param column table column this grid unit belongs to
* @param startCol index of the column this grid unit belongs to
* @param colSpanIndex index of this grid unit in the span, in column direction
* @param rowSpanIndex index of this grid unit in the span, in row direction
*/
- protected GridUnit(Table table, TableColumn column, int startCol, int colSpanIndex,
- int rowSpanIndex) {
- this(column, startCol, colSpanIndex, rowSpanIndex);
+ protected GridUnit(Table table, TableRow row, TableColumn column, int startCol,
+ int colSpanIndex, int rowSpanIndex) {
+ this(row, column, startCol, colSpanIndex, rowSpanIndex);
setBorders(table);
}
@@ -113,14 +114,15 @@
* Creates a new grid unit.
*
* @param cell table cell which occupies this grid unit
+ * @param row the table-row element this grid unit belongs to (if any)
* @param column table column this grid unit belongs to
* @param startCol index of the column this grid unit belongs to
* @param colSpanIndex index of this grid unit in the span, in column direction
* @param rowSpanIndex index of this grid unit in the span, in row direction
*/
- protected GridUnit(TableCell cell, TableColumn column, int startCol, int colSpanIndex,
- int rowSpanIndex) {
- this(column, startCol, colSpanIndex, rowSpanIndex);
+ protected GridUnit(TableCell cell, TableRow row, TableColumn column, int startCol,
+ int colSpanIndex, int rowSpanIndex) {
+ this(row, column, startCol, colSpanIndex, rowSpanIndex);
this.cell = cell;
setBorders(cell.getTable());
}
@@ -129,18 +131,21 @@
* Creates a new grid unit.
*
* @param primary the before-start grid unit of the cell containing this grid unit
+ * @param row the table-row element this grid unit belongs to (if any)
* @param column table column this grid unit belongs to
* @param startCol index of the column this grid unit belongs to
* @param colSpanIndex index of this grid unit in the span, in column direction
* @param rowSpanIndex index of this grid unit in the span, in row direction
*/
- GridUnit(PrimaryGridUnit primary, TableColumn column, int startCol, int colSpanIndex,
- int rowSpanIndex) {
- this(primary.getCell(), column, startCol, colSpanIndex, rowSpanIndex);
+ GridUnit(PrimaryGridUnit primary, TableRow row, TableColumn column, int startCol,
+ int colSpanIndex, int rowSpanIndex) {
+ this(primary.getCell(), row, column, startCol, colSpanIndex, rowSpanIndex);
this.primary = primary;
}
- private GridUnit(TableColumn column, int startCol, int colSpanIndex, int rowSpanIndex) {
+ private GridUnit(TableRow row, TableColumn column, int startCol, int colSpanIndex,
+ int rowSpanIndex) {
+ this.row = row;
this.column = column;
this.startCol = startCol;
this.colSpanIndex = colSpanIndex;
@@ -181,23 +186,14 @@
return column;
}
- public TableRow getRow() {
- if (row != null) {
- return row;
- } else if (getCell().getParent() instanceof TableRow) {
- return (TableRow) getCell().getParent();
- } else {
- return null;
- }
- }
-
/**
- * Sets the table-row FO, if applicable.
+ * Returns the fo:table-row element (if any) this grid unit belongs to.
*
- * @param row the table-row FO
+ * @return the row containing this grid unit, or null if there is no fo:table-row
+ * element in the corresponding table-part
*/
- public void setRow(TableRow row) {
- this.row = row;
+ public TableRow getRow() {
+ return row;
}
public TableBody getBody() {
Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/table/PrimaryGridUnit.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/table/PrimaryGridUnit.java?rev=594836&r1=594835&r2=594836&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/table/PrimaryGridUnit.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/table/PrimaryGridUnit.java Wed Nov 14 03:14:03 2007
@@ -49,12 +49,13 @@
* Creates a new primary grid unit.
*
* @param cell table cell which occupies this grid unit
+ * @param row the table-row element this grid unit belongs to (if any)
* @param column table column this grid unit belongs to
* @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, TableColumn column, int startCol, int startRow) {
- super(cell, column, startCol, 0, 0);
+ PrimaryGridUnit(TableCell cell, TableRow row, TableColumn column, int startCol, int startRow) {
+ super(cell, row, column, startCol, 0, 0);
this.startRow = startRow;
log.trace("PrimaryGridUnit created, row " + startRow + " col " + startCol);
}
Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/table/RowGroupBuilder.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/table/RowGroupBuilder.java?rev=594836&r1=594835&r2=594836&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/table/RowGroupBuilder.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/table/RowGroupBuilder.java Wed Nov 14 03:14:03 2007
@@ -49,6 +49,13 @@
abstract void addTableCell(TableCell cell);
/**
+ * Receives notification of the start of an fo:table-row element.
+ *
+ * @param tableRow the row being started
+ */
+ abstract void startRow(TableRow tableRow);
+
+ /**
* Receives notification of the end of the current row. If the current row finishes
* the row group, the {@link TableBody#addRowGroup(List)} method of the parent table
* part (i.e., the given container itself or its parent if this is a table-row) will
Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/table/TableBody.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/table/TableBody.java?rev=594836&r1=594835&r2=594836&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/table/TableBody.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/table/TableBody.java Wed Nov 14 03:14:03 2007
@@ -202,6 +202,7 @@
}
rowsStarted = true;
lastRow = (TableRow) child;
+ getTable().getRowGroupBuilder().startRow(lastRow);
break;
case FO_TABLE_CELL:
if (!rowsStarted) {
Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/table/VariableColRowGroupBuilder.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/table/VariableColRowGroupBuilder.java?rev=594836&r1=594835&r2=594836&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/table/VariableColRowGroupBuilder.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/table/VariableColRowGroupBuilder.java Wed Nov 14 03:14:03 2007
@@ -64,6 +64,15 @@
}
/** {@inheritDoc} */
+ void startRow(final TableRow tableRow) {
+ events.add(new Event() {
+ public void play(RowGroupBuilder rowGroupBuilder) {
+ rowGroupBuilder.startRow(tableRow);
+ }
+ });
+ }
+
+ /** {@inheritDoc} */
void endRow(final TableCellContainer container) {
events.add(new Event() {
public void play(RowGroupBuilder rowGroupBuilder) {
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-commits-help@xmlgraphics.apache.org