]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
Restored the setting of rowIndex on primary grid units (although testcases were alrea...
authorVincent Hennebert <vhennebert@apache.org>
Wed, 14 Nov 2007 12:21:53 +0000 (12:21 +0000)
committerVincent Hennebert <vhennebert@apache.org>
Wed, 14 Nov 2007 12:21:53 +0000 (12:21 +0000)
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@594852 13f79535-47bb-0310-9956-ffa450edef68

src/java/org/apache/fop/fo/flow/table/EffRow.java
src/java/org/apache/fop/fo/flow/table/FixedColRowGroupBuilder.java
src/java/org/apache/fop/fo/flow/table/PrimaryGridUnit.java
src/java/org/apache/fop/layoutmgr/table/TableRowIterator.java

index 57fcc6d696a4b497461d44fecfb8fb846a40ab0a..17ab67f988ee6e918120f15655c5c70f69854845 100644 (file)
@@ -53,6 +53,13 @@ public class EffRow {
         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 */
@@ -128,19 +135,6 @@ public class EffRow {
             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.
index 3fef2795dbd75762b6cf98420fc0ce1ec6d3a967..a5c0b1b8b34881dbf56aa2cfd12c196c78a588ce 100644 (file)
@@ -86,7 +86,7 @@ class FixedColRowGroupBuilder extends RowGroupBuilder {
         }
         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
index fa50b525f8e2e6295bb81f4081e1a9a698947f1e..2f2cd940e3a879360112af97ba211db30775f01d 100644 (file)
@@ -54,9 +54,8 @@ public class PrimaryGridUnit extends GridUnit {
      * @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);
     }
 
@@ -181,6 +180,10 @@ public class PrimaryGridUnit extends GridUnit {
         rows.add(row);
     }
 
+    void setStartRow(int startRow) {
+        this.startRow = startRow;
+    }
+
     /**
      * Returns the index of the row this grid unit belongs to.
      *
index 7c82ca7bdc8384555b3fd7657d64067902255e9c..62e308c13967562716fcf5f12a320cd8b10a76f7 100644 (file)
@@ -52,6 +52,8 @@ public class TableRowIterator {
 
     private Iterator rowGroupsIter;
 
+    private int rowIndex = 0;
+
     /**
      * Creates a new TableRowIterator.
      * @param table the table to iterate over
@@ -94,8 +96,7 @@ public class TableRowIterator {
         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;
     }