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/02 12:01:44 UTC

svn commit: r591299 - in /xmlgraphics/fop/trunk: src/java/org/apache/fop/fo/flow/ src/java/org/apache/fop/layoutmgr/table/ test/fotree/unittests/table/ test/java/org/apache/fop/fo/flow/

Author: vhennebert
Date: Fri Nov  2 04:01:41 2007
New Revision: 591299

URL: http://svn.apache.org/viewvc?rev=591299&view=rev
Log:
Reworked the creation of implicit columns to match new behaviour: the number of columns of a table without explicit fo:table-column is set by the row that has the most columns.

Added:
    xmlgraphics/fop/trunk/test/fotree/unittests/table/implicit_columns_column-number.fo   (with props)
Modified:
    xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/Table.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/TableBody.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/TableCellContainer.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/TableColumn.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/ColumnSetup.java
    xmlgraphics/fop/trunk/test/java/org/apache/fop/fo/flow/TableColumnColumnNumberTestCase.java

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/Table.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/Table.java?rev=591299&r1=591298&r2=591299&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/Table.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/Table.java Fri Nov  2 04:01:41 2007
@@ -35,6 +35,7 @@
 import org.apache.fop.fo.properties.KeepProperty;
 import org.apache.fop.fo.properties.LengthPairProperty;
 import org.apache.fop.fo.properties.LengthRangeProperty;
+import org.apache.fop.fo.properties.TableColLength;
 import org.xml.sax.Locator;
 
 /**
@@ -84,6 +85,7 @@
     private boolean tableBodyFound = false;
 
     private boolean hasExplicitColumns = false;
+    private boolean columnsFinalized = false;
 
     /**
      * The table's property list. Used in case the table has
@@ -244,46 +246,68 @@
             } else {
                 columns.add((TableColumn) child);
             }
-            return;
-        case FO_TABLE_FOOTER:
-            tableFooter = (TableBody) child;
             break;
         case FO_TABLE_HEADER:
-            tableHeader = (TableBody) child;
+        case FO_TABLE_FOOTER:
+        case FO_TABLE_BODY:
+            if (hasExplicitColumns && !columnsFinalized) {
+                columnsFinalized = true;
+                finalizeColumns();
+            }
+            switch (childId) {
+            case FO_TABLE_FOOTER:
+                tableFooter = (TableBody) child;
+                break;
+            case FO_TABLE_HEADER:
+                tableHeader = (TableBody) child;
+                break;
+            default:
+                super.addChildNode(child);
+            }
             break;
         default:
             super.addChildNode(child);
         }
     }
 
+    private void finalizeColumns() throws FOPException {
+        for (int i = 0; i < columns.size(); i++) {
+            if (columns.get(i) == null) {
+                columns.set(i, createImplicitColumn(i + 1));
+            }
+        }
+    }
+
     /** {@inheritDoc} */
     public Table getTable() {
         return this;
     }
 
     /**
-     * Adds a default column to the columns list (called from
-     * TableBody.addChildNode() when the table has no explicit
-     * columns, and if processing the first row)
+     * Creates the appropriate number of additional implicit columns to match the given
+     * column number. Used when the table has no explicit column: the number of columns is
+     * then determined by the row that has the most columns.
      * 
-     * @param colWidth  the column's width (null if the default should be used)
-     * @param colNr     the column-number from the cell
-     * @throws FOPException  if there was an error creating the property list
+     * @param columnNumber the table must at least have this number of column
+     * @throws FOPException if there was an error creating the property list for implicit
+     * columns
      */
-    void addDefaultColumn(Length colWidth, int colNr)
+    void ensureColumnNumber(int columnNumber) throws FOPException {
+        for (int i = columns.size() + 1; i <= columnNumber; i++) {
+            columns.add(createImplicitColumn(i));
+        }
+    }
+
+    private TableColumn createImplicitColumn(int colNumber)
                     throws FOPException {
-        TableColumn defaultColumn = new TableColumn(this, true);
+        TableColumn implicitColumn = new TableColumn(this, true);
         PropertyList pList = new StaticPropertyList(
-                                defaultColumn, this.propList);
+                                implicitColumn, this.propList);
         pList.setWritingMode();
-        defaultColumn.bind(pList);
-        if (colWidth != null) {
-            defaultColumn.setColumnWidth(colWidth);
-        }
-        if (colNr != 0) {
-            defaultColumn.setColumnNumber(colNr);
-        }
-        addColumnNode(defaultColumn);
+        implicitColumn.bind(pList);
+        implicitColumn.setColumnWidth(new TableColLength(1.0, implicitColumn));
+        implicitColumn.setColumnNumber(colNumber);
+        return implicitColumn;
     }
 
     /**
@@ -335,17 +359,13 @@
     }
 
     /**
-     * Returns the column at the given index, if any.
+     * Returns the column at the given index.
      * 
      * @param index index of the column to be retrieved, 0-based
-     * @return the corresponding column, or null if their is no column at the given index
+     * @return the corresponding column (may be an implicitly created column)
      */
     TableColumn getColumn(int index) {
-        if (index >= columns.size()) {
-            return null;
-        } else {
-            return (TableColumn) columns.get(index);
-        }
+        return (TableColumn) columns.get(index);
     }
 
     /**

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/TableBody.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/TableBody.java?rev=591299&r1=591298&r2=591299&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/TableBody.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/TableBody.java Fri Nov  2 04:01:41 2007
@@ -19,7 +19,8 @@
 
 package org.apache.fop.fo.flow;
 
-// Java
+import java.util.ArrayList;
+
 import org.apache.fop.apps.FOPException;
 import org.apache.fop.fo.FONode;
 import org.apache.fop.fo.PropertyList;
@@ -76,11 +77,16 @@
                             Attributes attlist, PropertyList pList)
                     throws FOPException {
         if (!inMarker()) {
-            int cap = getTable().getNumberOfColumns();
-            if (cap == 0) {
-                cap = 10; // Default value for ArrayList
+            Table t = getTable();
+            if (t.hasExplicitColumns()) {
+                int size = t.getNumberOfColumns();
+                pendingSpans = new ArrayList(size);
+                for (int i = 0; i < size; i++) {
+                    pendingSpans.add(null);
+                }
+            } else {
+                pendingSpans = new ArrayList();
             }
-            pendingSpans = new java.util.ArrayList(cap);
             columnNumberManager = new ColumnNumberManager();
         }
         super.processNode(elementName, locator, attlist, pList);

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/TableCellContainer.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/TableCellContainer.java?rev=591299&r1=591298&r2=591299&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/TableCellContainer.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/TableCellContainer.java Fri Nov  2 04:01:41 2007
@@ -68,14 +68,21 @@
         int rowSpan = cell.getNumberRowsSpanned();
 
         Table t = getTable();
-        if (t.hasExplicitColumns() && colNumber + colSpan - 1 > t.getNumberOfColumns()) {
-            throw new ValidationException(FONode.errorText(locator) + "column-number or number "
-                    + "of cells in the row overflows the number of fo:table-column specified "
-                    + "for the table.");
+        if (t.hasExplicitColumns()) {
+            if (colNumber + colSpan - 1 > t.getNumberOfColumns()) {
+                throw new ValidationException(FONode.errorText(locator) + "column-number or "
+                        + "number of cells in the row overflows the number of fo:table-column "
+                        + "specified for the table.");
+            }
+        } else {
+            t.ensureColumnNumber(colNumber + colSpan - 1);
+            // re-cap the size of pendingSpans
+            while (pendingSpans.size() < colNumber + colSpan - 1) {
+                pendingSpans.add(null);
+            }
         }
         if (firstRow) {
             handleCellWidth(cell, colNumber, colSpan);
-            updatePendingSpansSize(cell, colNumber, colSpan);
         }
 
         /* if the current cell spans more than one row,
@@ -101,23 +108,9 @@
 
         for (int i = colNumber; i < colNumber + colSpan; ++i) {
             TableColumn col = t.getColumn(i - 1);
-            if (col == null) {
-                t.addDefaultColumn(colWidth,
-                        i == colNumber
-                            ? cell.getColumnNumber()
-                            : 0);
-            } else {
-                if (!col.isDefaultColumn()
-                        && colWidth != null) {
-                    col.setColumnWidth(colWidth);
-                }
+            if (colWidth != null) {
+                col.setColumnWidth(colWidth);
             }
-        }
-    }
-
-    private void updatePendingSpansSize(TableCell cell, int colNumber, int colSpan) {
-        while (pendingSpans.size() < colNumber + colSpan - 1) {
-            pendingSpans.add(null);
         }
     }
 

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/TableColumn.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/TableColumn.java?rev=591299&r1=591298&r2=591299&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/TableColumn.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/TableColumn.java Fri Nov  2 04:01:41 2007
@@ -46,7 +46,7 @@
     //     private int visibility;
     // End of property values
 
-    private boolean defaultColumn;
+    private boolean implicitColumn;
     private PropertyList pList = null;
 
     /**
@@ -58,11 +58,12 @@
 
     /**
      * @param parent FONode that is the parent of this object
-     * @param defaultColumn true if this table-column has been manually created as a default column
+     * @param implicit true if this table-column has automatically been created (does not
+     * correspond to an explicit fo:table-column in the input document)
      */
-    public TableColumn(FONode parent, boolean defaultColumn) {
+    public TableColumn(FONode parent, boolean implicit) {
         super(parent);
-        this.defaultColumn = defaultColumn;
+        this.implicitColumn = implicit;
     }
 
 
@@ -93,7 +94,7 @@
          * warn only for explicit columns
          */
         if (columnWidth.getEnum() == EN_AUTO) {
-            if (!this.defaultColumn && !getTable().isAutoLayout()) {
+            if (!this.implicitColumn && !getTable().isAutoLayout()) {
                 log.warn("table-layout=\"fixed\" and column-width unspecified "
                         + "=> falling back to proportional-column-width(1)");
             }
@@ -105,7 +106,7 @@
          * we need a reference to the column's property list
          * (cleared in Table.endOfNode())
          */
-        if (!this.defaultColumn) {
+        if (!this.implicitColumn) {
             this.pList = pList;
         }
     }
@@ -199,8 +200,8 @@
      * user feedback (see ColumnSetup).
      * @return true if this table-column has been created as default column
      */
-    public boolean isDefaultColumn() {
-        return defaultColumn;
+    public boolean isImplicitColumn() {
+        return implicitColumn;
     }
 
     /** {@inheritDoc} */

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/ColumnSetup.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/ColumnSetup.java?rev=591299&r1=591298&r2=591299&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/ColumnSetup.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/ColumnSetup.java Fri Nov  2 04:01:41 2007
@@ -100,7 +100,7 @@
         if (index > size) {
             if (index > maxColIndexReferenced) {
                 maxColIndexReferenced = index;
-                if (!(size == 1 && getColumn(1).isDefaultColumn())) {
+                if (!(size == 1 && getColumn(1).isImplicitColumn())) {
                     log.warn(FONode.decorateWithContextInfo(
                             "There are fewer table-columns than are needed. "
                             + "Column " + index + " was accessed, but only "

Added: xmlgraphics/fop/trunk/test/fotree/unittests/table/implicit_columns_column-number.fo
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/test/fotree/unittests/table/implicit_columns_column-number.fo?rev=591299&view=auto
==============================================================================
--- xmlgraphics/fop/trunk/test/fotree/unittests/table/implicit_columns_column-number.fo (added)
+++ xmlgraphics/fop/trunk/test/fotree/unittests/table/implicit_columns_column-number.fo Fri Nov  2 04:01:41 2007
@@ -0,0 +1,240 @@
+<?xml version="1.0" standalone="no"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<!-- $Id$ -->
+<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
+  <fo:layout-master-set>
+    <fo:simple-page-master master-name="page" page-height="29.7cm" page-width="21cm" margin="10pt">
+      <fo:region-body/>
+    </fo:simple-page-master>
+  </fo:layout-master-set>
+  <fo:page-sequence master-reference="page">
+    <fo:flow flow-name="xsl-region-body">
+      <fo:block space-after="10pt">Checking that the number of columns is correctly computed
+        for tables without explicit fo:table-column.</fo:block>
+
+      <fo:block space-before="10pt" space-after="2pt">Number of columns determined by the header’s
+        first row.</fo:block>
+      <fo:table table-layout="fixed" border-collapse="separate" width="200pt">
+        <fo:table-header>
+          <fo:table-cell id="h1_1.1" border="1pt solid black"><fo:block>Header 1.1</fo:block></fo:table-cell>
+          <fo:table-cell id="h1_1.2" border="1pt solid black"><fo:block>Header 1.2</fo:block></fo:table-cell>
+          <fo:table-cell id="h1_2.1" starts-row="true"
+                                     border="1pt solid black"><fo:block>Header 2.1</fo:block></fo:table-cell>
+        </fo:table-header>
+        <fo:table-footer>
+          <fo:table-cell id="f1_1.1" border="1pt solid black"><fo:block>Footer 1.1</fo:block></fo:table-cell>
+        </fo:table-footer>
+        <fo:table-body>
+          <fo:table-cell id="b1_1.1" border="1pt solid black"><fo:block>Cell 1.1</fo:block></fo:table-cell>
+          <fo:table-cell id="b1_2.1" starts-row="true"
+                                     border="1pt solid black"><fo:block>Cell 2.1</fo:block></fo:table-cell>
+        </fo:table-body>
+      </fo:table>
+
+      <fo:block space-before="10pt" space-after="2pt">Number of columns determined by the header’s
+        second row.</fo:block>
+      <fo:table table-layout="fixed" border-collapse="separate" width="200pt">
+        <fo:table-header>
+          <fo:table-row>
+            <fo:table-cell id="h2_1.1" border="1pt solid black"><fo:block>Header 1.1</fo:block></fo:table-cell>
+          </fo:table-row>
+          <fo:table-row>
+            <fo:table-cell id="h2_2.1" border="1pt solid black"><fo:block>Header 2.1</fo:block></fo:table-cell>
+            <fo:table-cell id="h2_2.2" border="1pt solid black"><fo:block>Header 2.2</fo:block></fo:table-cell>
+          </fo:table-row>
+        </fo:table-header>
+        <fo:table-footer>
+          <fo:table-row>
+            <fo:table-cell id="f2_1.1" border="1pt solid black"><fo:block>Footer 1.1</fo:block></fo:table-cell>
+          </fo:table-row>
+        </fo:table-footer>
+        <fo:table-body>
+          <fo:table-row>
+            <fo:table-cell id="b2_1.1" border="1pt solid black"><fo:block>Cell 1.1</fo:block></fo:table-cell>
+          </fo:table-row>
+          <fo:table-row>
+            <fo:table-cell id="b2_2.1" border="1pt solid black"><fo:block>Cell 2.1</fo:block></fo:table-cell>
+          </fo:table-row>
+        </fo:table-body>
+      </fo:table>
+
+      <fo:block space-before="10pt" space-after="2pt">Number of columns determined by the footer’s
+        first row.</fo:block>
+      <fo:table table-layout="fixed" border-collapse="separate" width="200pt">
+        <fo:table-header>
+          <fo:table-row>
+            <fo:table-cell id="h3_1.1" border="1pt solid black"><fo:block>Header 1.1</fo:block></fo:table-cell>
+          </fo:table-row>
+          <fo:table-row>
+            <fo:table-cell id="h3_2.1" border="1pt solid black"><fo:block>Header 2.1</fo:block></fo:table-cell>
+          </fo:table-row>
+        </fo:table-header>
+        <fo:table-footer>
+          <fo:table-row>
+            <fo:table-cell id="f3_1.1" border="1pt solid black"><fo:block>Footer 1.1</fo:block></fo:table-cell>
+            <fo:table-cell id="f3_1.2" border="1pt solid black"><fo:block>Footer 1.2</fo:block></fo:table-cell>
+          </fo:table-row>
+          <fo:table-row>
+            <fo:table-cell id="f3_2.1" border="1pt solid black"><fo:block>Footer 2.1</fo:block></fo:table-cell>
+          </fo:table-row>
+        </fo:table-footer>
+        <fo:table-body>
+          <fo:table-row>
+            <fo:table-cell id="b3_1.1" border="1pt solid black"><fo:block>Cell 1.1</fo:block></fo:table-cell>
+          </fo:table-row>
+          <fo:table-row>
+            <fo:table-cell id="b3_2.1" border="1pt solid black"><fo:block>Cell 2.1</fo:block></fo:table-cell>
+          </fo:table-row>
+        </fo:table-body>
+      </fo:table>
+
+      <fo:block space-before="10pt" space-after="2pt">Number of columns determined by the footer’s
+        second row.</fo:block>
+      <fo:table table-layout="fixed" border-collapse="separate" width="200pt">
+        <fo:table-header>
+          <fo:table-cell id="h4_1.1" border="1pt solid black"><fo:block>Header 1.1</fo:block></fo:table-cell>
+        </fo:table-header>
+        <fo:table-footer>
+          <fo:table-cell id="f4_1.1" border="1pt solid black"><fo:block>Footer 1.1</fo:block></fo:table-cell>
+          <fo:table-cell id="f4_2.2" starts-row="true" column-number="2"
+                                     border="1pt solid black"><fo:block>Footer 2.2</fo:block></fo:table-cell>
+        </fo:table-footer>
+        <fo:table-body>
+          <fo:table-cell id="b4_1.1" border="1pt solid black"><fo:block>Cell 1.1</fo:block></fo:table-cell>
+          <fo:table-cell id="b4_2.1" starts-row="true"
+                                     border="1pt solid black"><fo:block>Cell 2.1</fo:block></fo:table-cell>
+        </fo:table-body>
+      </fo:table>
+
+      <fo:block space-before="10pt" space-after="2pt">Number of columns determined by the body’s
+        first row.</fo:block>
+      <fo:table table-layout="fixed" border-collapse="separate" width="300pt">
+        <fo:table-header>
+          <fo:table-row>
+            <fo:table-cell id="h5_1.1" border="1pt solid black"><fo:block>Header 1.1</fo:block></fo:table-cell>
+            <fo:table-cell id="h5_1.2" border="1pt solid black"><fo:block>Header 1.2</fo:block></fo:table-cell>
+          </fo:table-row>
+          <fo:table-row>
+            <fo:table-cell id="h5_2.1" border="1pt solid black"><fo:block>Header 2.1</fo:block></fo:table-cell>
+            <fo:table-cell id="h5_2.2" border="1pt solid black"><fo:block>Header 2.2</fo:block></fo:table-cell>
+          </fo:table-row>
+        </fo:table-header>
+        <fo:table-footer>
+          <fo:table-row>
+            <fo:table-cell id="f5_1.1" border="1pt solid black"><fo:block>Footer 1.1</fo:block></fo:table-cell>
+            <fo:table-cell id="f5_1.2" border="1pt solid black"><fo:block>Footer 1.2</fo:block></fo:table-cell>
+          </fo:table-row>
+          <fo:table-row>
+            <fo:table-cell id="f5_2.1" border="1pt solid black"><fo:block>Footer 2.1</fo:block></fo:table-cell>
+          </fo:table-row>
+        </fo:table-footer>
+        <fo:table-body>
+          <fo:table-row>
+            <fo:table-cell id="b5_1.1" border="1pt solid black"><fo:block>Cell 1.1</fo:block></fo:table-cell>
+            <fo:table-cell id="b5_1.2" border="1pt solid black"><fo:block>Cell 1.2</fo:block></fo:table-cell>
+            <fo:table-cell id="b5_1.3" border="1pt solid black"><fo:block>Cell 1.3</fo:block></fo:table-cell>
+          </fo:table-row>
+          <fo:table-row>
+            <fo:table-cell id="b5_2.1" border="1pt solid black"><fo:block>Cell 2.1</fo:block></fo:table-cell>
+            <fo:table-cell id="b5_2.2" border="1pt solid black"><fo:block>Cell 2.2</fo:block></fo:table-cell>
+          </fo:table-row>
+        </fo:table-body>
+      </fo:table>
+
+      <fo:block space-before="10pt" space-after="2pt">Number of columns determined by the body’s
+        not first row.</fo:block>
+      <fo:table table-layout="fixed" border-collapse="separate" width="300pt">
+        <fo:table-header>
+          <fo:table-cell id="h6_1.1" border="1pt solid black"><fo:block>Header 1.1</fo:block></fo:table-cell>
+          <fo:table-cell id="h6_1.2" border="1pt solid black"><fo:block>Header 1.2</fo:block></fo:table-cell>
+          <fo:table-cell id="h6_2.1" starts-row="true"
+                                     border="1pt solid black"><fo:block>Header 2.1</fo:block></fo:table-cell>
+          <fo:table-cell id="h6_2.2" border="1pt solid black"><fo:block>Header 2.2</fo:block></fo:table-cell>
+        </fo:table-header>
+        <fo:table-footer>
+          <fo:table-cell id="f6_1.1" border="1pt solid black"><fo:block>Footer 1.1</fo:block></fo:table-cell>
+          <fo:table-cell id="f6_1.2" border="1pt solid black"><fo:block>Footer 1.2</fo:block></fo:table-cell>
+          <fo:table-cell id="f6_2.1" starts-row="true"
+                                     border="1pt solid black"><fo:block>Footer 2.1</fo:block></fo:table-cell>
+        </fo:table-footer>
+        <fo:table-body>
+          <fo:table-cell id="b6_1.1" border="1pt solid black"><fo:block>Cell 1.1</fo:block></fo:table-cell>
+          <fo:table-cell id="b6_1.2" border="1pt solid black"><fo:block>Cell 1.2</fo:block></fo:table-cell>
+          <fo:table-cell id="b6_2.1" starts-row="true"
+                                     border="1pt solid black"><fo:block>Cell 2.1</fo:block></fo:table-cell>
+          <fo:table-cell id="b6_2.2" border="1pt solid black"><fo:block>Cell 2.2</fo:block></fo:table-cell>
+          <fo:table-cell id="b6_3.1" starts-row="true" column-number="3"
+                                     border="1pt solid black"><fo:block>Cell 3.1</fo:block></fo:table-cell>
+          <fo:table-cell id="b6_3.2" border="1pt solid black"><fo:block>Cell 3.2</fo:block></fo:table-cell>
+        </fo:table-body>
+      </fo:table>
+
+      <fo:block space-before="10pt" space-after="2pt">Number of columns determined by the second
+        body.</fo:block>
+      <fo:table table-layout="fixed" border-collapse="separate" width="300pt">
+        <fo:table-header>
+          <fo:table-row>
+            <fo:table-cell id="h7_1.1" border="1pt solid black"><fo:block>Header 1.1</fo:block></fo:table-cell>
+            <fo:table-cell id="h7_1.2" border="1pt solid black"><fo:block>Header 1.2</fo:block></fo:table-cell>
+          </fo:table-row>
+          <fo:table-row>
+            <fo:table-cell id="h7_2.2" column-number="2"
+                                       border="1pt solid black"><fo:block>Header 2.2</fo:block></fo:table-cell>
+          </fo:table-row>
+        </fo:table-header>
+        <fo:table-footer>
+          <fo:table-row>
+            <fo:table-cell id="f7_1.1" border="1pt solid black"><fo:block>Footer 1.1</fo:block></fo:table-cell>
+          </fo:table-row>
+          <fo:table-row>
+            <fo:table-cell id="f7_2.1" border="1pt solid black"><fo:block>Footer 2.1</fo:block></fo:table-cell>
+            <fo:table-cell id="f7_2.2" border="1pt solid black"><fo:block>Footer 2.2</fo:block></fo:table-cell>
+          </fo:table-row>
+        </fo:table-footer>
+        <fo:table-body>
+          <fo:table-cell id="b71_1.1" border="1pt solid black"><fo:block>Cell 1.1</fo:block></fo:table-cell>
+          <fo:table-cell id="b71_1.2" border="1pt solid black"><fo:block>Cell 1.2</fo:block></fo:table-cell>
+          <fo:table-cell id="b71_2.1" starts-row="true"
+                                      border="1pt solid black"><fo:block>Cell 2.1</fo:block></fo:table-cell>
+          <fo:table-cell id="b71_2.2" border="1pt solid black"><fo:block>Cell 2.2</fo:block></fo:table-cell>
+          <fo:table-cell id="b71_3.1" starts-row="true"
+                                      border="1pt solid black"><fo:block>Cell 3.1</fo:block></fo:table-cell>
+          <fo:table-cell id="b71_3.2" border="1pt solid black"><fo:block>Cell 3.2</fo:block></fo:table-cell>
+        </fo:table-body>
+        <fo:table-body>
+          <fo:table-row>
+            <fo:table-cell id="b72_1.1" border="1pt solid blue"><fo:block>Cell 1.1</fo:block></fo:table-cell>
+            <fo:table-cell id="b72_1.2" border="1pt solid blue"><fo:block>Cell 1.2</fo:block></fo:table-cell>
+          </fo:table-row>
+          <fo:table-row>
+            <fo:table-cell id="b72_2.1" border="1pt solid blue"><fo:block>Cell 2.1</fo:block></fo:table-cell>
+            <fo:table-cell id="b72_2.2" border="1pt solid blue"><fo:block>Cell 2.2</fo:block></fo:table-cell>
+          </fo:table-row>
+          <fo:table-row>
+            <fo:table-cell id="b72_3.3" column-number="3"
+                                        border="1pt solid blue"><fo:block>Cell 3.3</fo:block></fo:table-cell>
+            <fo:table-cell id="b72_3.1" column-number="1"
+                                        border="1pt solid blue"><fo:block>Cell 3.1</fo:block></fo:table-cell>
+            <fo:table-cell id="b72_3.2" border="1pt solid blue"><fo:block>Cell 3.2</fo:block></fo:table-cell>
+          </fo:table-row>
+        </fo:table-body>
+      </fo:table>
+
+    </fo:flow>
+  </fo:page-sequence>
+</fo:root>

Propchange: xmlgraphics/fop/trunk/test/fotree/unittests/table/implicit_columns_column-number.fo
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: xmlgraphics/fop/trunk/test/fotree/unittests/table/implicit_columns_column-number.fo
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: xmlgraphics/fop/trunk/test/java/org/apache/fop/fo/flow/TableColumnColumnNumberTestCase.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/test/java/org/apache/fop/fo/flow/TableColumnColumnNumberTestCase.java?rev=591299&r1=591298&r2=591299&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/test/java/org/apache/fop/fo/flow/TableColumnColumnNumberTestCase.java (original)
+++ xmlgraphics/fop/trunk/test/java/org/apache/fop/fo/flow/TableColumnColumnNumberTestCase.java Fri Nov  2 04:01:41 2007
@@ -51,11 +51,11 @@
         super();
     }
 
-    private void checkColumn(Table t, int number, boolean isDefault, int spans, int repeated, int width) {
+    private void checkColumn(Table t, int number, boolean isImplicit, int spans, int repeated, int width) {
         TableColumn c = t.getColumn(number - 1);
         // TODO a repeated column has a correct number only for its first occurrence 
 //        assertEquals(number, c.getColumnNumber());
-        assertEquals(isDefault, c.isDefaultColumn());
+        assertEquals(isImplicit, c.isImplicitColumn());
         assertEquals(spans, c.getNumberColumnsSpanned());
         assertEquals(repeated, c.getNumberColumnsRepeated());
         assertEquals(width, c.getColumnWidth().getValue(percentBaseContext));
@@ -87,5 +87,27 @@
         checkColumn(t, 2, true, 1, 1, 125000);
         checkColumn(t, 3, false, 1, 1, 150000);
         checkColumn(t, 4, false, 1, 1, 175000);
+    }
+
+    private void checkImplicitColumns(Iterator tableIter, int columnNumber) {
+        Table t = (Table) tableIter.next();
+        assertEquals(columnNumber, t.getNumberOfColumns());
+        for (int i = 1; i <= columnNumber; i++) {
+            checkColumn(t, i, true, 1, 1, 100000);
+        }
+    }
+
+    public void testImplicitColumns() throws Exception {
+        setUp("table/implicit_columns_column-number.fo");
+        percentBaseContext.setUnitaryWidth(100000);
+        Iterator tableIter = getTableHandler().getTables().iterator();
+
+        checkImplicitColumns(tableIter, 2);
+        checkImplicitColumns(tableIter, 2);
+        checkImplicitColumns(tableIter, 2);
+        checkImplicitColumns(tableIter, 2);
+        checkImplicitColumns(tableIter, 3);
+        checkImplicitColumns(tableIter, 4);
+        checkImplicitColumns(tableIter, 3);
     }
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: fop-commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-commits-help@xmlgraphics.apache.org