aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/org/apache/fop/fo/flow
diff options
context:
space:
mode:
authorVincent Hennebert <vhennebert@apache.org>2008-01-24 16:40:46 +0000
committerVincent Hennebert <vhennebert@apache.org>2008-01-24 16:40:46 +0000
commitc1492fcb2473e44a309be8fd5e432f1cc7744d4c (patch)
tree5b87604ab27b2c4b1cd8b9526a413d26c027e646 /src/java/org/apache/fop/fo/flow
parent8f8d5b995c0d964311705ef7f3a6262f55340158 (diff)
downloadxmlgraphics-fop-c1492fcb2473e44a309be8fd5e432f1cc7744d4c.tar.gz
xmlgraphics-fop-c1492fcb2473e44a309be8fd5e432f1cc7744d4c.zip
Cleanup:
- renamed startRow/startCol into rowIndex/colIndex - improved javadoc of PrimaryGridUnit.getRowIndex() - moved colIndex from GridUnit into PrimaryGridUnit since it's only needed there - simplified EmptyGridUnit constructor git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@614920 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/fop/fo/flow')
-rw-r--r--src/java/org/apache/fop/fo/flow/table/EffRow.java2
-rw-r--r--src/java/org/apache/fop/fo/flow/table/EmptyGridUnit.java7
-rw-r--r--src/java/org/apache/fop/fo/flow/table/FixedColRowGroupBuilder.java7
-rw-r--r--src/java/org/apache/fop/fo/flow/table/GridUnit.java42
-rw-r--r--src/java/org/apache/fop/fo/flow/table/PrimaryGridUnit.java50
5 files changed, 50 insertions, 58 deletions
diff --git a/src/java/org/apache/fop/fo/flow/table/EffRow.java b/src/java/org/apache/fop/fo/flow/table/EffRow.java
index 03012aa3c..fb2162e55 100644
--- a/src/java/org/apache/fop/fo/flow/table/EffRow.java
+++ b/src/java/org/apache/fop/fo/flow/table/EffRow.java
@@ -57,7 +57,7 @@ public class EffRow {
for (Iterator guIter = gridUnits.iterator(); guIter.hasNext();) {
Object gu = guIter.next();
if (gu instanceof PrimaryGridUnit) {
- ((PrimaryGridUnit) gu).setStartRow(index);
+ ((PrimaryGridUnit) gu).setRowIndex(index);
}
}
}
diff --git a/src/java/org/apache/fop/fo/flow/table/EmptyGridUnit.java b/src/java/org/apache/fop/fo/flow/table/EmptyGridUnit.java
index 7a8b0be62..1f0f7be04 100644
--- a/src/java/org/apache/fop/fo/flow/table/EmptyGridUnit.java
+++ b/src/java/org/apache/fop/fo/flow/table/EmptyGridUnit.java
@@ -30,11 +30,10 @@ public class EmptyGridUnit extends GridUnit {
/**
* @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
+ * @param colIndex column index, 0-based
*/
- EmptyGridUnit(Table table, TableRow row, int startRow, int startCol) {
- super(table, row, table.getColumn(startCol), startCol, 0, 0);
+ EmptyGridUnit(Table table, TableRow row, int colIndex) {
+ super(table, row, table.getColumn(colIndex), 0, 0);
}
/** {@inheritDoc} */
diff --git a/src/java/org/apache/fop/fo/flow/table/FixedColRowGroupBuilder.java b/src/java/org/apache/fop/fo/flow/table/FixedColRowGroupBuilder.java
index 2f8b0bbb8..51279c399 100644
--- a/src/java/org/apache/fop/fo/flow/table/FixedColRowGroupBuilder.java
+++ b/src/java/org/apache/fop/fo/flow/table/FixedColRowGroupBuilder.java
@@ -87,8 +87,7 @@ class FixedColRowGroupBuilder extends RowGroupBuilder {
GridUnit[] cellRow = new GridUnit[cell.getNumberColumnsSpanned()];
cellRow[0] = pgu;
for (int j = 1; j < cell.getNumberColumnsSpanned(); j++) {
- GridUnit gu = new GridUnit(pgu, currentTableRow, table.getColumn(columnIndex + j),
- columnIndex + j, j, 0);
+ GridUnit gu = new GridUnit(pgu, currentTableRow, table.getColumn(columnIndex + j), j, 0);
row.set(columnIndex + j, gu);
cellRow[j] = gu;
}
@@ -98,7 +97,7 @@ class FixedColRowGroupBuilder extends RowGroupBuilder {
cellRow = new GridUnit[cell.getNumberColumnsSpanned()];
for (int j = 0; j < cell.getNumberColumnsSpanned(); j++) {
GridUnit gu = new GridUnit(pgu, currentTableRow, table.getColumn(columnIndex + j),
- columnIndex + j, j, i);
+ j, i);
row.set(columnIndex + j, gu);
cellRow[j] = gu;
}
@@ -124,7 +123,7 @@ class FixedColRowGroupBuilder extends RowGroupBuilder {
// Fill gaps with empty grid units
for (int i = 0; i < numberOfColumns; i++) {
if (currentRow.get(i) == null) {
- currentRow.set(i, new EmptyGridUnit(table, currentTableRow, currentRowIndex, i));
+ currentRow.set(i, new EmptyGridUnit(table, currentTableRow, i));
}
}
borderResolver.endRow(currentRow, container);
diff --git a/src/java/org/apache/fop/fo/flow/table/GridUnit.java b/src/java/org/apache/fop/fo/flow/table/GridUnit.java
index a583697f6..75d0c5516 100644
--- a/src/java/org/apache/fop/fo/flow/table/GridUnit.java
+++ b/src/java/org/apache/fop/fo/flow/table/GridUnit.java
@@ -59,9 +59,6 @@ public class GridUnit {
/** Table column that this grid unit belongs to */
private TableColumn column;
- /** start index of grid unit within row in column direction */
- private int startCol;
-
/** index of grid unit within cell in column direction */
private int colSpanIndex;
@@ -84,13 +81,12 @@ public class GridUnit {
* @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, TableRow row, TableColumn column, int startCol,
- int colSpanIndex, int rowSpanIndex) {
- this(row, column, startCol, colSpanIndex, rowSpanIndex);
+ protected GridUnit(Table table, TableRow row, TableColumn column, int colSpanIndex,
+ int rowSpanIndex) {
+ this(row, column, colSpanIndex, rowSpanIndex);
setBorders(table);
}
@@ -100,13 +96,12 @@ public class GridUnit {
* @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, TableRow row, TableColumn column, int startCol,
- int colSpanIndex, int rowSpanIndex) {
- this(row, column, startCol, colSpanIndex, rowSpanIndex);
+ protected GridUnit(TableCell cell, TableRow row, TableColumn column, int colSpanIndex,
+ int rowSpanIndex) {
+ this(row, column, colSpanIndex, rowSpanIndex);
this.cell = cell;
setBorders(cell.getTable());
}
@@ -117,21 +112,18 @@ public class GridUnit {
* @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, TableRow row, TableColumn column, int startCol,
- int colSpanIndex, int rowSpanIndex) {
- this(primary.getCell(), row, column, startCol, colSpanIndex, rowSpanIndex);
+ GridUnit(PrimaryGridUnit primary, TableRow row, TableColumn column, int colSpanIndex,
+ int rowSpanIndex) {
+ this(primary.getCell(), row, column, colSpanIndex, rowSpanIndex);
this.primary = primary;
}
- private GridUnit(TableRow row, TableColumn column, int startCol, int colSpanIndex,
- int rowSpanIndex) {
+ private GridUnit(TableRow row, TableColumn column, int colSpanIndex, int rowSpanIndex) {
this.row = row;
this.column = column;
- this.startCol = startCol;
this.colSpanIndex = colSpanIndex;
this.rowSpanIndex = rowSpanIndex;
}
@@ -222,15 +214,6 @@ public class GridUnit {
return cell == null;
}
- /**
- * Returns the index of the column this grid unit belongs to.
- *
- * @return the column index, 0-based
- */
- public int getStartCol() {
- return startCol;
- }
-
/** @return true if the grid unit is the last in column spanning direction */
public boolean isLastGridUnitColSpan() {
return (colSpanIndex == cell.getNumberColumnsSpanned() - 1);
@@ -474,10 +457,9 @@ public class GridUnit {
buffer.append("(last)");
}
}
- buffer.append(" startCol=").append(startCol);
if (!isPrimary() && getPrimary() != null) {
- buffer.append(" primary=").append(getPrimary().getStartRow());
- buffer.append("/").append(getPrimary().getStartCol());
+ buffer.append(" primary=").append(getPrimary().getRowIndex());
+ buffer.append("/").append(getPrimary().getColIndex());
if (getPrimary().getCell() != null) {
buffer.append(" id=" + getPrimary().getCell().getId());
}
diff --git a/src/java/org/apache/fop/fo/flow/table/PrimaryGridUnit.java b/src/java/org/apache/fop/fo/flow/table/PrimaryGridUnit.java
index 684fa58d1..b73cd62d7 100644
--- a/src/java/org/apache/fop/fo/flow/table/PrimaryGridUnit.java
+++ b/src/java/org/apache/fop/fo/flow/table/PrimaryGridUnit.java
@@ -22,8 +22,6 @@ package org.apache.fop.fo.flow.table;
import java.util.LinkedList;
import java.util.List;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.apache.fop.fo.properties.CommonBorderPaddingBackground;
import org.apache.fop.layoutmgr.ElementListUtils;
import org.apache.fop.layoutmgr.table.TableCellLayoutManager;
@@ -34,14 +32,17 @@ import org.apache.fop.layoutmgr.table.TableCellLayoutManager;
*/
public class PrimaryGridUnit extends GridUnit {
- private static Log log = LogFactory.getLog(PrimaryGridUnit.class);
-
/** Cell layout manager. */
private TableCellLayoutManager cellLM;
/** List of Knuth elements representing the contents of the cell. */
private LinkedList elements;
- /** Index of row where this cell starts */
- private int startRow;
+
+ /** Index of the row where this cell starts. */
+ private int rowIndex;
+
+ /** Index of the column where this cell starts. */
+ private int colIndex;
+
/** Links to the spanned grid units. (List of GridUnit arrays, one array represents a row) */
private List rows;
/** The calculated size of the cell's content. (cached value) */
@@ -56,15 +57,14 @@ public class PrimaryGridUnit extends GridUnit {
* @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
+ * @param colIndex index of the column this grid unit belongs to, zero-based
*/
- PrimaryGridUnit(TableCell cell, TableRow row, TableColumn column, int startCol) {
- super(cell, row, column, startCol, 0, 0);
+ PrimaryGridUnit(TableCell cell, TableRow row, TableColumn column, int colIndex) {
+ super(cell, row, column, 0, 0);
+ this.colIndex = colIndex;
this.isSeparateBorderModel = column.getTable().isSeparateBorderModel(); // TODO
this.halfBorderSeparationBPD = column.getTable().getBorderSeparation().getBPD().getLength()
.getValue() / 2; // TODO
- log.trace("PrimaryGridUnit created, row " + startRow + " col " + startCol);
}
public TableCellLayoutManager getCellLM() {
@@ -248,17 +248,29 @@ public class PrimaryGridUnit extends GridUnit {
rows.add(row);
}
- void setStartRow(int startRow) {
- this.startRow = startRow;
+ void setRowIndex(int rowIndex) {
+ this.rowIndex = rowIndex;
}
/**
- * Returns the index of the row this grid unit belongs to.
- *
- * @return the index of the row this grid unit belongs to.
+ * Returns the index of the row this grid unit belongs to. This is the index, in the
+ * enclosing table part, of the first row spanned by the cell. Note that if the table
+ * has several table-body children, then the index grows continuously across them;
+ * they are considered to form one single part, the "body of the table".
+ *
+ * @return the index of the row this grid unit belongs to, 0-based.
+ */
+ public int getRowIndex() {
+ return rowIndex;
+ }
+
+ /**
+ * Returns the index of the column this grid unit belongs to.
+ *
+ * @return the column index, 0-based
*/
- public int getStartRow() {
- return this.startRow;
+ public int getColIndex() {
+ return colIndex;
}
/**
@@ -290,7 +302,7 @@ public class PrimaryGridUnit extends GridUnit {
/** {@inheritDoc} */
public String toString() {
StringBuffer sb = new StringBuffer(super.toString());
- sb.append(" startRow=").append(startRow);
+ sb.append(" rowIndex=").append(rowIndex);
return sb.toString();
}