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 ad...@apache.org on 2005/09/18 01:59:35 UTC

svn commit: r289865 - in /xmlgraphics/fop/trunk/src/java/org/apache/fop: fo/ fo/flow/ fo/properties/ layoutmgr/table/

Author: adelmelle
Date: Sat Sep 17 16:59:25 2005
New Revision: 289865

URL: http://svn.apache.org/viewcvs?rev=289865&view=rev
Log:
Implementation for initial values of the column-number property

Added:
    xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/TableFObj.java   (with props)
    xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/ColumnNumberPropertyMaker.java   (with props)
Modified:
    xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/FOPropertyMapping.java
    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/TableCell.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/TableColumn.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/TableFooter.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/TableHeader.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/TableRow.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/ColumnSetup.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/TableContentLayoutManager.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/TableLayoutManager.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/TableRowIterator.java

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/FOPropertyMapping.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/FOPropertyMapping.java?rev=289865&r1=289864&r2=289865&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/FOPropertyMapping.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/FOPropertyMapping.java Sat Sep 17 16:59:25 2005
@@ -28,6 +28,7 @@
 import org.apache.fop.fo.properties.BoxPropShorthandParser;
 import org.apache.fop.fo.properties.CharacterProperty;
 import org.apache.fop.fo.properties.ColorTypeProperty;
+import org.apache.fop.fo.properties.ColumnNumberPropertyMaker;
 import org.apache.fop.fo.properties.CondLengthProperty;
 import org.apache.fop.fo.properties.CorrespondingPropertyMaker;
 import org.apache.fop.fo.properties.DimensionPropertyMaker;
@@ -2386,9 +2387,7 @@
         addPropertyMaker("caption-side", m);
 
         // column-number
-        m  = new NumberProperty.Maker(PR_COLUMN_NUMBER);
-        m.setInherited(false);
-        m.setDefault("0");
+        m  = new ColumnNumberPropertyMaker(PR_COLUMN_NUMBER);
         addPropertyMaker("column-number", m);
 
         // column-width

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/Table.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/Table.java?rev=289865&r1=289864&r2=289865&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 Sat Sep 17 16:59:25 2005
@@ -18,6 +18,7 @@
 
 package org.apache.fop.fo.flow;
 
+import java.util.BitSet;
 import java.util.List;
 
 import org.xml.sax.Locator;
@@ -41,7 +42,7 @@
 /**
  * Class modelling the fo:table object.
  */
-public class Table extends FObj {
+public class Table extends TableFObj {
     // The value of properties relevant for fo:table.
     private CommonAccessibility commonAccessibility;
     private CommonAural commonAural;
@@ -49,12 +50,8 @@
     private CommonMarginBlock commonMarginBlock;
     private CommonRelativePosition commonRelativePosition;
     private LengthRangeProperty blockProgressionDimension;
-    private Numeric borderAfterPrecedence;
-    private Numeric borderBeforePrecedence;
     private int borderCollapse;
-    private Numeric borderEndPrecedence;
     private LengthPairProperty borderSeparation;
-    private Numeric borderStartPrecedence;
     private int breakAfter;
     private int breakBefore;
     private String id;
@@ -75,6 +72,8 @@
 
     /** collection of columns in this table */
     protected List columns = null;
+    private BitSet usedColumnIndices = new BitSet();
+    private int columnIndex = 1;
     private TableBody tableHeader = null;
     private TableBody tableFooter = null;
   
@@ -106,12 +105,8 @@
         commonMarginBlock = pList.getMarginBlockProps();
         commonRelativePosition = pList.getRelativePositionProps();
         blockProgressionDimension = pList.get(PR_BLOCK_PROGRESSION_DIMENSION).getLengthRange();
-        borderAfterPrecedence = pList.get(PR_BORDER_AFTER_PRECEDENCE).getNumeric();
-        borderBeforePrecedence = pList.get(PR_BORDER_BEFORE_PRECEDENCE).getNumeric();
         borderCollapse = pList.get(PR_BORDER_COLLAPSE).getEnum();
-        borderEndPrecedence = pList.get(PR_BORDER_END_PRECEDENCE).getNumeric();
         borderSeparation = pList.get(PR_BORDER_SEPARATION).getLengthPair();
-        borderStartPrecedence = pList.get(PR_BORDER_START_PRECEDENCE).getNumeric();
         breakAfter = pList.get(PR_BREAK_AFTER).getEnum();
         breakBefore = pList.get(PR_BREAK_BEFORE).getEnum();
         id = pList.get(PR_ID).getString();
@@ -126,6 +121,7 @@
         tableOmitHeaderAtBreak = pList.get(PR_TABLE_OMIT_HEADER_AT_BREAK).getEnum();
         //width = pList.get(PR_WIDTH).getLength();
         writingMode = pList.get(PR_WRITING_MODE).getEnum();
+        super.bind(pList);
 
         //Create default column in case no table-columns will be defined.
         defaultColumn = new TableColumn(this, true);
@@ -213,7 +209,8 @@
            missingChildElementError(
                    "(marker*,table-column*,table-header?,table-footer?,table-body+)");
         }
-
+        //release reference
+        usedColumnIndices = null;
         getFOEventHandler().endTable(this);
     }
 
@@ -222,10 +219,7 @@
      */
     protected void addChildNode(FONode child) throws FOPException {
         if (child.getName().equals("fo:table-column")) {
-            if (columns == null) {
-                columns = new java.util.ArrayList();
-            }
-            columns.add(((TableColumn)child));
+            addColumnNode((TableColumn) child);
         } else if (child.getName().equals("fo:table-footer")) {
             tableFooter = (TableBody)child;
         } else if (child.getName().equals("fo:table-header")) {
@@ -236,6 +230,48 @@
         }
     }
 
+    /**
+     * Adds a column to the columns List, and updates the columnIndex
+     * used for determining initial values for column-number
+     * 
+     * @param col   the column to add
+     * @throws FOPException
+     */
+    private void addColumnNode(TableColumn col) throws FOPException {
+        int colNumber = col.getColumnNumber();
+        int colRepeat = col.getNumberColumnsRepeated();
+        if (columns == null) {
+            columns = new java.util.ArrayList();
+        }
+        if( columns.size() < colNumber ) {
+            //add nulls for non-occupied indices between
+            //the last column up to and including the current one
+            while( columns.size() < colNumber ) {
+                columns.add(null);
+            }
+        }
+        //replace the null-value with the actual column
+        columns.set(colNumber - 1, col);
+        if( colRepeat > 1 ) {
+            //in case column is repeated:
+            //for the time being, add the same column 
+            //(colRepeat - 1) times to the columns list
+            //TODO: need to force the column-number
+            //TODO: need to make sure START/END BorderInfo
+            //      are completely independent instances (clones?)
+            //      = necessary for border-collapse="collapse"
+            //        if collapsing is handled in FOTree
+            for( int i = colRepeat - 1; --i >= 0; ) {
+                columns.add(col);
+            }
+        }
+        //flag column indices used by this column
+        usedColumnIndices.set(colNumber - 1, colNumber - 1 + colRepeat);
+        //set index for the next column to use
+        while( usedColumnIndices.get(columnIndex - 1) ) {
+            columnIndex++;
+        }
+    }
     /** @return true of table-layout="auto" */
     public boolean isAutoLayout() {
         return (tableLayout != EN_FIXED);
@@ -375,5 +411,34 @@
      */
     public int getNameId() {
         return FO_TABLE;
+    }
+
+    /**
+     * Returns the current column index of the Table
+     * 
+     * @return the next column number to use
+     */
+    public int getCurrentColumnIndex() {
+        return columnIndex;
+    }
+
+    /**
+     * Sets the current column index of the given Table
+     * (used by TableColumn.bind() in case the column-number
+     * was explicitly specified)
+     * 
+     */
+    protected void setCurrentColumnIndex(int newIndex) {
+        columnIndex = newIndex;
+    }
+
+    /**
+     * Checks if a certain column-number is already occupied
+     * 
+     * @param colNr the column-number to check
+     * @return true if column-number is already in use
+     */
+    protected boolean isColumnNumberUsed(int colNr) {
+        return usedColumnIndices.get(colNr - 1);
     }
 }

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/TableBody.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/TableBody.java?rev=289865&r1=289864&r2=289865&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 Sat Sep 17 16:59:25 2005
@@ -19,6 +19,7 @@
 package org.apache.fop.fo.flow;
 
 // Java
+import java.util.BitSet;
 import java.util.Iterator;
 import java.util.List;
 
@@ -39,23 +40,24 @@
 /**
  * Class modelling the fo:table-body object.
  */
-public class TableBody extends FObj {
+public class TableBody extends TableFObj {
     // The value of properties relevant for fo:table-body.
     private CommonAccessibility commonAccessibility;
     private CommonAural commonAural;
     private CommonBorderPaddingBackground commonBorderPaddingBackground;
     private CommonRelativePosition commonRelativePosition;
-    private Numeric borderAfterPrecedence;
-    private Numeric borderBeforePrecedence;
-    private Numeric borderEndPrecedence;
-    private Numeric borderStartPrecedence;
     private int visibility;
     // End of property values
     
     private PropertyList savedPropertyList;
 
     protected boolean tableRowsFound = false;
-    protected boolean tableCellsFound = false;   
+    protected boolean tableCellsFound = false;
+    
+    private int columnIndex = 1;
+    protected List pendingSpans;
+    protected BitSet usedColumnIndices = new BitSet();
+    private boolean firstRow = true;
     
     /**
      * @param parent FONode that is the parent of the object
@@ -72,12 +74,8 @@
         commonAural = pList.getAuralProps();
         commonBorderPaddingBackground = pList.getBorderPaddingBackgroundProps();
         commonRelativePosition = pList.getRelativePositionProps();
-        borderAfterPrecedence = pList.get(PR_BORDER_AFTER_PRECEDENCE).getNumeric();
-        borderBeforePrecedence = pList.get(PR_BORDER_BEFORE_PRECEDENCE).getNumeric();
-        borderEndPrecedence = pList.get(PR_BORDER_END_PRECEDENCE).getNumeric();
-        borderStartPrecedence = pList.get(PR_BORDER_START_PRECEDENCE).getNumeric();
         visibility = pList.get(PR_VISIBILITY).getEnum();
-        
+        super.bind(pList);
         //Used by convertCellsToRows()
         savedPropertyList = pList;
     }
@@ -86,6 +84,7 @@
      * @see org.apache.fop.fo.FONode#startOfNode
      */
     protected void startOfNode() throws FOPException {
+        initPendingSpans();
         getFOEventHandler().startBody(this);
     }
 
@@ -107,7 +106,10 @@
         if (tableCellsFound) {
             convertCellsToRows();
         }*/
-        savedPropertyList = null; //Release reference
+        //release references
+        savedPropertyList = null;
+        pendingSpans = null;
+        usedColumnIndices = null;
     }
 
     /**
@@ -142,6 +144,78 @@
             invalidChildError(loc, nsURI, localName);
         }
     }
+    
+    /**
+     * @see org.apache.fop.fo.FONode#addChildNode(FONode)
+     */
+    protected void addChildNode(FONode child) throws FOPException {
+        if( child.getNameId() == FO_TABLE_CELL ) {
+            addCellNode( (TableCell) child);
+        } else {
+            super.addChildNode(child);
+        }
+    }
+
+    /**
+     * Adds a cell to the list of child nodes, and updates the columnIndex
+     * used for determining the initial value of column-number
+     * 
+     * @param cell  cell to add
+     * @throws FOPException
+     */
+    private void addCellNode(TableCell cell) throws FOPException {
+        //if firstRow flag is still true, the cell starts a row, 
+        //and there was a previous cell that didn't explicitly
+        //end the previous row => set firstRow flag to false
+        if( firstRow && cell.startsRow() && !lastCellEndedRow() ) {
+            firstRow = false;
+        }
+        int rowSpan = cell.getNumberRowsSpanned();
+        int colSpan = cell.getNumberColumnsSpanned();
+        //if there were no explicit columns, pendingSpans
+        //will not be properly initialized for the first row
+        if( firstRow && ((Table) parent).columns == null ) {
+            if( pendingSpans == null ) {
+                pendingSpans = new java.util.ArrayList();
+            }
+            for( int i = colSpan; --i >= 0; ) {
+                pendingSpans.add(null);
+            }
+        }
+        //if the current cell spans more than one row,
+        //update pending span list for the next row
+        if( rowSpan > 1 ) {
+            for( int i = colSpan; --i >= 0; ) {
+                pendingSpans.set(columnIndex - 1 + i, 
+                        new PendingSpan(rowSpan));
+            }
+        }
+        //flag column indices used by this cell,
+        //take into account that possibly not all column-numbers
+        //are used by columns in the parent table (if any),
+        //so a cell spanning three columns, might actually
+        //take up more than three columnIndices...
+        int startIndex = columnIndex - 1;
+        int endIndex = startIndex + colSpan;
+        if( ((Table) parent).columns != null ) {
+            List cols = ((Table) parent).columns;
+            int tmpIndex = endIndex;
+            for( int i = startIndex; i <= tmpIndex; ++i ) {
+                if( i < cols.size() && cols.get(i) == null ) {
+                    endIndex++;
+                }
+            }
+        }
+        usedColumnIndices.set(startIndex, endIndex);
+        setNextColumnIndex();
+        super.addChildNode(cell);
+        if( cell.endsRow() ) {
+            if( firstRow ) {
+                firstRow = false;
+            }
+            resetColumnIndex();
+        }
+    }
 
     /**
      * If table-cells are used as direct children of a table-body|header|footer
@@ -214,6 +288,111 @@
     public boolean isLast(TableRow obj) {
         return (childNodes.size() > 0) 
             && (childNodes.get(childNodes.size() - 1) == obj);
+    }
+    
+    /**
+     * Initializes pending spans list; used for correctly
+     * assigning initial value for column-number for the
+     * cells of following rows
+     *
+     */
+    protected void initPendingSpans() {
+        if( ((Table) parent).columns != null ) {
+            List tableCols = ((Table) parent).columns;
+            pendingSpans = new java.util.ArrayList(tableCols.size());
+            for( int i = tableCols.size(); --i >= 0; ) {
+                pendingSpans.add(null);
+            }
+        }
+    }
+        
+    /**
+     * Returns the current column index of the TableBody
+     * 
+     * @return the next column number to use
+     */
+    public int getCurrentColumnIndex() {
+        return columnIndex;
+    }
+
+    /**
+     * Sets the current column index to a specific value
+     * (used by TableCell.bind() in case the column-number
+     * was explicitly specified)
+     * 
+     */
+    protected void setCurrentColumnIndex(int newIndex) {
+        columnIndex = newIndex;
+    }
+
+    /**
+     * Resets the current column index for the TableBody
+     *
+     */
+    public void resetColumnIndex() {
+        columnIndex = 1;
+        usedColumnIndices.clear();
+        PendingSpan pSpan;
+        for( int i = pendingSpans.size(); --i >= 0; ) {
+            pSpan = (PendingSpan) pendingSpans.get(i);
+            if( pSpan != null ) {
+                pSpan.rowsLeft--;
+                if( pSpan.rowsLeft == 0 ) {
+                    pendingSpans.set(i, null);
+                }
+            }
+            usedColumnIndices.set(i, pendingSpans.get(i) != null);
+        }
+        if( !firstRow ) {
+            setNextColumnIndex();
+        }
+    }
+
+    /**
+     * Increases columnIndex to the next available value
+     *
+     */
+    private void setNextColumnIndex() {
+        while( usedColumnIndices.get(columnIndex - 1) ) {
+            //increment columnIndex
+            columnIndex++;
+            //if the table has explicit columns, and
+            //the updated index is not assigned to any
+            //column, increment further until the next
+            //index occupied by a column...
+            if( ((Table) parent).columns != null ) {
+                while( columnIndex <= ((Table) parent).columns.size()
+                        && !((Table) parent).isColumnNumberUsed(columnIndex) ) {
+                    columnIndex++;
+                }
+            }
+        }
+    }
+
+    /**
+     * Checks whether the previous cell had 'ends-row="true"'
+     * 
+     * @return false only if there was a previous cell, which
+     *         had ends-row="false" (implicit or explicit)
+     */
+    public boolean lastCellEndedRow() {
+        if( childNodes != null ) {
+            FONode prevNode = (FONode) childNodes.get(childNodes.size() - 1);
+            if( prevNode.getNameId() == FO_TABLE_CELL ) {
+                return ((TableCell) prevNode).endsRow();
+            }
+        }
+        return true;
+    }
+
+    /**
+     * Checks whether a given column-number is already in use
+     * for the current row (used by TableCell.bind());
+     * 
+     * @return true if column-number is already occupied
+     */
+    protected boolean isColumnNumberUsed(int colNr) {
+        return usedColumnIndices.get(colNr - 1);
     }
 }
 

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/TableCell.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/TableCell.java?rev=289865&r1=289864&r2=289865&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/TableCell.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/TableCell.java Sat Sep 17 16:59:25 2005
@@ -38,16 +38,12 @@
  * Class modelling the fo:table-cell object.
  * @todo check need for all instance variables stored here
  */
-public class TableCell extends FObj {
+public class TableCell extends TableFObj {
     // The value of properties relevant for fo:table-cell.
     private CommonAccessibility commonAccessibility;
     private CommonAural commonAural;
     private CommonBorderPaddingBackground commonBorderPaddingBackground;
     private CommonRelativePosition commonRelativePosition;
-    private Numeric borderAfterPrecedence;
-    private Numeric borderBeforePrecedence;
-    private Numeric borderEndPrecedence;
-    private Numeric borderStartPrecedence;
     private LengthRangeProperty blockProgressionDimension;
     private int borderCollapse; //inherited from fo:table
     private LengthPairProperty borderSeparation; //inherited from fo:table
@@ -118,10 +114,6 @@
         commonAural = pList.getAuralProps();
         commonBorderPaddingBackground = pList.getBorderPaddingBackgroundProps();
         commonRelativePosition = pList.getRelativePositionProps();
-        borderAfterPrecedence = pList.get(PR_BORDER_AFTER_PRECEDENCE).getNumeric();
-        borderBeforePrecedence = pList.get(PR_BORDER_BEFORE_PRECEDENCE).getNumeric();
-        borderEndPrecedence = pList.get(PR_BORDER_END_PRECEDENCE).getNumeric();
-        borderStartPrecedence = pList.get(PR_BORDER_START_PRECEDENCE).getNumeric();
         blockProgressionDimension = pList.get(PR_BLOCK_PROGRESSION_DIMENSION).getLengthRange();
         borderCollapse = pList.get(PR_BORDER_COLLAPSE).getEnum();
         borderSeparation = pList.get(PR_BORDER_SEPARATION).getLengthPair();
@@ -137,6 +129,24 @@
         numberRowsSpanned = pList.get(PR_NUMBER_ROWS_SPANNED).getNumeric();
         startsRow = pList.get(PR_STARTS_ROW).getEnum();
         width = pList.get(PR_WIDTH).getLength();
+        super.bind(pList);
+        
+        //check if any of the column-numbers occupied by this cell
+        //are already in use in the current row...
+        for( int i = getColumnNumber(); 
+                ++i <= getColumnNumber() + getNumberColumnsSpanned(); ) {
+            if( ((TableFObj) parent).isColumnNumberUsed(i - 1) ) {
+                throw new FOPException("cell overlaps in column " + (i - 1),
+                              locator);
+            }
+        }
+        //if column-number was explicitly specified, force the parent's current
+        //column index to the specified value, so that the updated index will
+        //be the correct initial value for the next cell (see Rec 7.26.8)
+        if( pList.getExplicit(PR_COLUMN_NUMBER) != null ) {
+            ((TableFObj) parent).setCurrentColumnIndex(
+                    pList.getExplicit(PR_COLUMN_NUMBER).getNumeric().getValue());
+        }
     }
 
     /**
@@ -156,7 +166,11 @@
         if (!blockItemFound) {
             missingChildElementError("marker* (%block;)+");
         }
-        //TODO Complain about startsRow|endsRow=true if parent is a table-row
+        if( (startsRow() || endsRow()) 
+                && getParent().getNameId() == FO_TABLE_ROW ) {
+            getLogger().warn("starts-row/ends-row for fo:table-cells "
+                    + "non-applicable for children of an fo:table-row.");
+        }
         getFOEventHandler().endCell(this);
     }
 
@@ -288,17 +302,10 @@
     }
 
     /**
-     * @return true if the "column-number" property was set.
-     */
-    public boolean hasColumnNumber() {
-        return (columnNumber.getValue() >= 1);
-    }
-
-    /**
      * @return the "column-number" property.
      */
     public int getColumnNumber() {
-        return Math.max(columnNumber.getValue(), 0);
+        return columnNumber.getValue();
     }
 
     /** @return true if "empty-cells" is "show" */

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/TableColumn.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/TableColumn.java?rev=289865&r1=289864&r2=289865&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 Sat Sep 17 16:59:25 2005
@@ -34,13 +34,9 @@
 /**
  * Class modelling the fo:table-column object.
  */
-public class TableColumn extends FObj {
+public class TableColumn extends TableFObj {
     // The value of properties relevant for fo:table-column.
     private CommonBorderPaddingBackground commonBorderPaddingBackground;
-    private Numeric borderAfterPrecedence;
-    private Numeric borderBeforePrecedence;
-    private Numeric borderEndPrecedence;
-    private Numeric borderStartPrecedence;
     private Numeric columnNumber;
     private Length columnWidth;
     private Numeric numberColumnsRepeated;
@@ -72,21 +68,32 @@
      */
     public void bind(PropertyList pList) throws FOPException {
         commonBorderPaddingBackground = pList.getBorderPaddingBackgroundProps();
-        borderAfterPrecedence = pList.get(PR_BORDER_AFTER_PRECEDENCE).getNumeric();
-        borderBeforePrecedence = pList.get(PR_BORDER_BEFORE_PRECEDENCE).getNumeric();
-        borderEndPrecedence = pList.get(PR_BORDER_END_PRECEDENCE).getNumeric();
-        borderStartPrecedence = pList.get(PR_BORDER_START_PRECEDENCE).getNumeric();
         columnNumber = pList.get(PR_COLUMN_NUMBER).getNumeric();
         columnWidth = pList.get(PR_COLUMN_WIDTH).getLength();
         numberColumnsRepeated = pList.get(PR_NUMBER_COLUMNS_REPEATED).getNumeric();
         numberColumnsSpanned = pList.get(PR_NUMBER_COLUMNS_SPANNED).getNumeric();
         visibility = pList.get(PR_VISIBILITY).getEnum();
+        super.bind(pList);
         
-        if (columnNumber.getValue() < 0) {
-            //not catching 0 here because it is the indication that no 
-            //column-number has been specified
-            throw new PropertyException("column-number must be 1 or bigger, "
-                    + "but got " + columnNumber.getValue());
+        if( pList.getExplicit(PR_COLUMN_NUMBER) != null ) {
+            if (columnNumber.getValue() <= 0) {
+                //TODO: This is actually a non-fatal error. See Rec 7.26.8:
+                //"A positive integer. If a negative or non-integer value 
+                // is provided, the value will be rounded to the
+                // nearest integer value greater than or equal to 1."
+                throw new PropertyException("column-number must be 1 or bigger, "
+                        + "but got " + columnNumber);
+            } else if( ((Table) parent).isColumnNumberUsed(columnNumber.getValue()) ) {
+                throw new PropertyException("specified column-number \""
+                        + columnNumber 
+                        + "\" has already been assigned to a previous column");
+            } else {
+                //force parent table's current column index
+                //to the specified value, so that the updated index
+                //will be the correct initial value for the next column
+                //(see Rec 7.26.8)
+                ((Table) parent).setCurrentColumnIndex(columnNumber.getValue());
+            }
         }
         if (numberColumnsRepeated.getValue() <= 0) {
             throw new PropertyException("number-columns-repeated must be 1 or bigger, "
@@ -136,13 +143,6 @@
     }
 
     /**
-     * @return true if the "column-number" property was set.
-     */
-    public boolean hasColumnNumber() {
-        return (columnNumber.getValue() >= 1);
-    }
-
-    /**
      * @return the "column-number" property.
      */
     public int getColumnNumber() {
@@ -182,9 +182,7 @@
     /** @see java.lang.Object#toString() */
     public String toString() {
         StringBuffer sb = new StringBuffer("fo:table-column");
-        if (hasColumnNumber()) {
-            sb.append(" column-number=").append(getColumnNumber());
-        }
+        sb.append(" column-number=").append(getColumnNumber());
         if (getNumberColumnsRepeated() > 1) {
             sb.append(" number-columns-repeated=").append(getNumberColumnsRepeated());
         }

Added: xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/TableFObj.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/TableFObj.java?rev=289865&view=auto
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/TableFObj.java (added)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/TableFObj.java Sat Sep 17 16:59:25 2005
@@ -0,0 +1,110 @@
+package org.apache.fop.fo.flow;
+
+import org.apache.fop.apps.FOPException;
+import org.apache.fop.datatypes.Numeric;
+import org.apache.fop.fo.FONode;
+import org.apache.fop.fo.FObj;
+import org.apache.fop.fo.PropertyList;
+import org.apache.fop.fo.properties.CommonBorderPaddingBackground;
+
+
+public abstract class TableFObj extends FObj {
+
+    private Numeric borderAfterPrecedence;
+    private Numeric borderBeforePrecedence;
+    private Numeric borderEndPrecedence;
+    private Numeric borderStartPrecedence;
+        
+    protected static class PendingSpan {
+        protected int rowsLeft;
+        
+        public PendingSpan( int rows ) {
+            rowsLeft = rows;
+        }
+        
+        public String toString() {
+            StringBuffer sb = new StringBuffer();
+            sb.append("pending span: rowsLeft=").append(rowsLeft);
+            return sb.toString();
+        }
+    }
+    
+    public TableFObj(FONode parent) {
+        super(parent);
+    }
+    
+    public void bind(PropertyList pList) throws FOPException {
+        borderAfterPrecedence = pList.get(PR_BORDER_AFTER_PRECEDENCE).getNumeric();
+        borderBeforePrecedence = pList.get(PR_BORDER_BEFORE_PRECEDENCE).getNumeric();
+        borderEndPrecedence = pList.get(PR_BORDER_END_PRECEDENCE).getNumeric();
+        borderStartPrecedence = pList.get(PR_BORDER_START_PRECEDENCE).getNumeric();
+    }
+    
+    /**
+     * 
+     * @param side  the side for which to return the border precedence
+     * @return the "border-precedence" value for the given side
+     */
+    public Numeric getBorderPrecedence(int side) {
+        switch( side ) {
+        case CommonBorderPaddingBackground.BEFORE:
+            return borderBeforePrecedence;
+        case CommonBorderPaddingBackground.AFTER:
+            return borderAfterPrecedence;
+        case CommonBorderPaddingBackground.START:
+            return borderStartPrecedence;
+        case CommonBorderPaddingBackground.END:
+            return borderEndPrecedence;
+        default:
+            return null;
+        }
+    }
+    
+    protected void setBorderPrecedence(int side, Numeric newPrecedence) {
+        switch( side ) {
+        case CommonBorderPaddingBackground.BEFORE:
+            borderBeforePrecedence = newPrecedence;
+        case CommonBorderPaddingBackground.AFTER:
+            borderAfterPrecedence = newPrecedence;
+        case CommonBorderPaddingBackground.START:
+            borderStartPrecedence = newPrecedence;
+        case CommonBorderPaddingBackground.END:
+            borderEndPrecedence = newPrecedence;
+        }
+    }
+    
+    /**
+     * Returns the current column index of the given TableFObj
+     * (overridden for Table, TableBody, TableRow)
+     * 
+     * @return the next column number to use
+     */
+    public int getCurrentColumnIndex() {
+        return 0;
+    }
+    
+    /**
+     * Sets the current column index of the given TableFObj
+     * (overridden for Table, TableBody, TableRow)
+     */
+    protected void setCurrentColumnIndex(int newIndex) {
+        //do nothing by default
+    }
+    
+    /**
+     * Checks if a certain column-number is already occupied
+     * (overridden for Table, TableBody, TableRow)
+     * 
+     * @param colNr the column-number to check
+     * @return true if column-number is already in use
+     */
+    protected boolean isColumnNumberUsed(int colNr) {
+        return false;
+    }
+    
+    /**
+     * @return the Common Border, Padding, and Background Properties.
+     */
+    public abstract CommonBorderPaddingBackground getCommonBorderPaddingBackground();
+
+}

Propchange: xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/TableFObj.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/TableFObj.java
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/TableFooter.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/TableFooter.java?rev=289865&r1=289864&r2=289865&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/TableFooter.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/TableFooter.java Sat Sep 17 16:59:25 2005
@@ -39,7 +39,8 @@
      * @see org.apache.fop.fo.FONode#startOfNode
      */
     protected void startOfNode() throws FOPException {
-//      getFOEventHandler().startBody(this);
+        initPendingSpans();
+        //getFOEventHandler().startBody(this);
     }
 
     /**

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/TableHeader.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/TableHeader.java?rev=289865&r1=289864&r2=289865&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/TableHeader.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/TableHeader.java Sat Sep 17 16:59:25 2005
@@ -39,7 +39,8 @@
      * @see org.apache.fop.fo.FONode#startOfNode
      */
     protected void startOfNode() throws FOPException {
-//      getFOEventHandler().startHeader(this);
+        initPendingSpans();
+        //getFOEventHandler().startHeader(this);
     }
 
     /**

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/TableRow.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/TableRow.java?rev=289865&r1=289864&r2=289865&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/TableRow.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/TableRow.java Sat Sep 17 16:59:25 2005
@@ -18,6 +18,9 @@
 
 package org.apache.fop.fo.flow;
 
+import java.util.BitSet;
+import java.util.List;
+
 import org.xml.sax.Locator;
 
 import org.apache.fop.apps.FOPException;
@@ -37,17 +40,13 @@
 /**
  * Class modelling the fo:table-row object.
  */
-public class TableRow extends FObj {
+public class TableRow extends TableFObj {
     // The value of properties relevant for fo:table-row.
     private CommonAccessibility commonAccessibility;
     private LengthRangeProperty blockProgressionDimension;
     private CommonAural commonAural;
     private CommonBorderPaddingBackground commonBorderPaddingBackground;
     private CommonRelativePosition commonRelativePosition;
-    private Numeric borderAfterPrecedence;
-    private Numeric borderBeforePrecedence;
-    private Numeric borderEndPrecedence;
-    private Numeric borderStartPrecedence;
     private int breakAfter;
     private int breakBefore;
     private Length height;
@@ -59,6 +58,10 @@
     // End of property values
 
     private boolean setup = false;
+    
+    private List pendingSpans;
+    private BitSet usedColumnIndices;
+    private int columnIndex = 1;
 
     /**
      * @param parent FONode that is the parent of this object
@@ -76,10 +79,6 @@
         commonAural = pList.getAuralProps();
         commonBorderPaddingBackground = pList.getBorderPaddingBackgroundProps();
         commonRelativePosition = pList.getRelativePositionProps();
-        borderAfterPrecedence = pList.get(PR_BORDER_AFTER_PRECEDENCE).getNumeric();
-        borderBeforePrecedence = pList.get(PR_BORDER_BEFORE_PRECEDENCE).getNumeric();
-        borderEndPrecedence = pList.get(PR_BORDER_END_PRECEDENCE).getNumeric();
-        borderStartPrecedence = pList.get(PR_BORDER_START_PRECEDENCE).getNumeric();
         breakAfter = pList.get(PR_BREAK_AFTER).getEnum();
         breakBefore = pList.get(PR_BREAK_BEFORE).getEnum();
         id = pList.get(PR_ID).getString();
@@ -88,6 +87,7 @@
         keepWithNext = pList.get(PR_KEEP_WITH_NEXT).getKeep();
         keepWithPrevious = pList.get(PR_KEEP_WITH_PREVIOUS).getKeep();
         visibility = pList.get(PR_VISIBILITY).getEnum();
+        super.bind(pList);
     }
 
     /**
@@ -107,6 +107,12 @@
      * @see org.apache.fop.fo.FONode#startOfNode
      */
     protected void startOfNode() throws FOPException {
+        pendingSpans = ((TableBody) parent).pendingSpans;
+        usedColumnIndices = ((TableBody) parent).usedColumnIndices;
+        while( usedColumnIndices.get(columnIndex - 1) ) {
+            columnIndex++;
+        }
+        
         checkId(id);
         getFOEventHandler().startRow(this);
     }
@@ -118,6 +124,16 @@
         if (childNodes == null) {
             missingChildElementError("(table-cell+)");
         }
+        if( ((TableBody) parent).isFirst(this) 
+                && ((Table) parent.getParent()).columns == null ) {
+            //force parent body's pendingSpans
+            //to the one accumulated after processing this row
+            ((TableBody) parent).pendingSpans = pendingSpans;
+        }
+        ((TableBody) parent).resetColumnIndex();
+        //release references
+        pendingSpans = null;
+        usedColumnIndices = null;
         getFOEventHandler().endRow(this);
     }
 
@@ -131,6 +147,55 @@
             invalidChildError(loc, nsURI, localName);
         }
     }
+    
+    /**
+     * @see org.apache.fop.fo.FONode#addChildNode(FONode)
+     */
+    protected void addChildNode(FONode child) throws FOPException {
+        TableCell cell = (TableCell) child;
+        int rowSpan = cell.getNumberRowsSpanned();
+        int colSpan = cell.getNumberColumnsSpanned();
+        if( ((TableBody) parent).isFirst(this) 
+                && ((Table) parent.getParent()).columns == null ) {
+            if( pendingSpans == null ) {
+                pendingSpans = new java.util.ArrayList();
+            }
+            pendingSpans.add(null);
+            if( usedColumnIndices == null ) {
+                usedColumnIndices = new BitSet();
+            }
+        }
+        //if the current cell spans more than one row,
+        //update pending span list for the next row
+        if( rowSpan > 1 ) {
+            for( int i = colSpan; --i >= 0; ) {
+                pendingSpans.set(columnIndex - 1 + i, 
+                        new PendingSpan(rowSpan));
+            }
+        }
+        //flag column indices used by this cell,
+        //take into account that possibly not all column-numbers
+        //are used by columns in the parent table (if any),
+        //so a cell spanning three columns, might actually
+        //take up more than three columnIndices...
+        int startIndex = columnIndex - 1;
+        int endIndex = startIndex + colSpan;
+        if( ((Table) parent.getParent()).columns != null ) {
+            List cols = ((Table) parent.getParent()).columns;
+            int tmpIndex = endIndex;
+            for( int i = startIndex; i <= tmpIndex; ++i ) {
+                if( i < cols.size() && cols.get(i) == null ) {
+                    endIndex++;
+                }
+            }
+        }
+        usedColumnIndices.set(startIndex, endIndex);
+        //update columnIndex for the next cell
+        while( usedColumnIndices.get(columnIndex - 1) ) {
+            columnIndex++;
+        }
+        super.addChildNode(cell);
+    }
 
     /**
      * @return the "id" property.
@@ -220,5 +285,34 @@
     /** @see org.apache.fop.fo.FObj#getNameId() */
     public int getNameId() {
         return FO_TABLE_ROW;
+    }
+    
+    /**
+     * Returns the current column index of the TableRow
+     *                                 
+     * @return the next column number to use
+     */
+    public int getCurrentColumnIndex() {
+        return columnIndex;
+    }
+
+    /**
+     * Sets the current column index to a specific value
+     * in case a column-number was explicitly specified
+     * (used by TableCell.bind())
+     * 
+     */
+    protected void setCurrentColumnIndex(int newIndex) {
+        columnIndex = newIndex;
+    }
+
+    /**
+     * Checks whether a given column-number is already in use
+     * for the current row (used by TableCell.bind());
+     * 
+     * @return true if column-number is already occupied
+     */
+    protected boolean isColumnNumberUsed(int colNr) {
+        return usedColumnIndices.get(colNr - 1);
     }
 }

Added: xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/ColumnNumberPropertyMaker.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/ColumnNumberPropertyMaker.java?rev=289865&view=auto
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/ColumnNumberPropertyMaker.java (added)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/ColumnNumberPropertyMaker.java Sat Sep 17 16:59:25 2005
@@ -0,0 +1,67 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed 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$ */
+
+package org.apache.fop.fo.properties;
+
+import org.apache.fop.fo.Constants;
+import org.apache.fop.fo.FObj;
+import org.apache.fop.fo.PropertyList;
+import org.apache.fop.fo.expr.PropertyException;
+import org.apache.fop.fo.flow.TableFObj;
+import org.apache.fop.fo.flow.TableBody;
+
+public class ColumnNumberPropertyMaker extends NumberProperty.Maker {
+
+    public ColumnNumberPropertyMaker(int propId) {
+        super(propId);
+    }
+    
+    /**
+     * Set default column-number from parent's currentColumnIndex
+     * 
+     * @return  the default value for column-number
+     */
+    public Property make(PropertyList propertyList) throws PropertyException {
+        FObj fo = propertyList.getFObj();
+        
+        if( fo.getNameId() == Constants.FO_TABLE_CELL 
+                || fo.getNameId() == Constants.FO_TABLE_COLUMN ) {
+            TableFObj parent = (TableFObj) propertyList.getParentFObj();
+            int columnIndex = parent.getCurrentColumnIndex();
+            if( fo.getNameId() == Constants.FO_TABLE_CELL 
+                    && parent.getNameId() == Constants.FO_TABLE_BODY ) {
+                boolean startsRow = propertyList.get(Constants.PR_STARTS_ROW)
+                    .getEnum() == Constants.EN_TRUE;
+                
+                //cell w/ starts-row="true", but previous cell 
+                //didn't have ends-row="true", so index has still has
+                //to be reset (for other cases this already happened in
+                //body.addChildNode())
+                if( startsRow && !((TableBody) parent).lastCellEndedRow() ) {
+                    //reset column index, and reassign...
+                    ((TableBody) parent).resetColumnIndex();
+                    columnIndex = parent.getCurrentColumnIndex();
+                }
+            }
+            return new NumberProperty(columnIndex);
+        } else {
+            throw new PropertyException("column-number property is only allowed on " 
+                    + "fo:table-cell or fo:table-column, not on " + fo.getName());
+        }
+    }
+}

Propchange: xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/ColumnNumberPropertyMaker.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/ColumnNumberPropertyMaker.java
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/ColumnSetup.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/ColumnSetup.java?rev=289865&r1=289864&r2=289865&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 Sat Sep 17 16:59:25 2005
@@ -60,7 +60,7 @@
             ListIterator iter = rawCols.listIterator();
             while (iter.hasNext()) {
                 TableColumn col = (TableColumn)iter.next();
-                if (col.hasColumnNumber()) {
+                if( col != null ) {
                     colnum = col.getColumnNumber();
                 }
                 for (int i = 0; i < col.getNumberColumnsRepeated(); i++) {
@@ -151,7 +151,9 @@
     public int getXOffset(int col, PercentBaseContext context) {
         int xoffset = 0;
         for (int i = 1; i < col; i++) {
-            xoffset += getColumn(i).getColumnWidth().getValue(context);
+            if( getColumn(i) != null ) {
+                xoffset += getColumn(i).getColumnWidth().getValue(context);
+            }
         }
         return xoffset;
     }

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/TableContentLayoutManager.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/TableContentLayoutManager.java?rev=289865&r1=289864&r2=289865&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/TableContentLayoutManager.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/TableContentLayoutManager.java Sat Sep 17 16:59:25 2005
@@ -439,8 +439,10 @@
                                 i < primary.getStartCol() 
                                         + primary.getCell().getNumberColumnsSpanned();
                                 i++) {
-                            spanWidth += getTableLM().getColumns().getColumn(i + 1)
-                                .getColumnWidth().getValue(getTableLM());
+                            if( getTableLM().getColumns().getColumn(i + 1) != null ) {
+                                spanWidth += getTableLM().getColumns().getColumn(i + 1)
+                                    .getColumnWidth().getValue(getTableLM());
+                            }
                         }
                         LayoutContext childLC = new LayoutContext(0);
                         childLC.setStackLimit(context.getStackLimit()); //necessary?

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/TableLayoutManager.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/TableLayoutManager.java?rev=289865&r1=289864&r2=289865&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/TableLayoutManager.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/TableLayoutManager.java Sat Sep 17 16:59:25 2005
@@ -156,10 +156,12 @@
         float factors = 0;
         for (Iterator i = columns.iterator(); i.hasNext();) {
             TableColumn column = (TableColumn) i.next();
-            Length width = column.getColumnWidth();
-            sumCols += width.getValue(this);
-            if (width instanceof TableColLength) {
-                factors += ((TableColLength) width).getTableUnits();
+            if( column != null ) {
+                Length width = column.getColumnWidth();
+                sumCols += width.getValue(this);
+                if (width instanceof TableColLength) {
+                    factors += ((TableColLength) width).getTableUnits();
+                }
             }
         }
         // sets TABLE_UNITS in case where one or more oldColumns is defined using 

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/TableRowIterator.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/TableRowIterator.java?rev=289865&r1=289864&r2=289865&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/TableRowIterator.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/TableRowIterator.java Sat Sep 17 16:59:25 2005
@@ -362,15 +362,12 @@
         while (iter.hasNext()) {
             TableCell cell = (TableCell)iter.next();
             
-            if (cell.hasColumnNumber()) {
-                colnum = cell.getColumnNumber();
-            } else {
-                //Skip columns with spanning grid units
-                while (safelyGetListItem(gridUnits, colnum - 1) != null) {
-                    colnum++;
-                }
-            }
+            colnum = cell.getColumnNumber();
 
+            //TODO: remove the check below???
+            //shouldn't happen here, since
+            //overlapping cells already caught in 
+            //fo.flow.TableCell.bind()...
             if (safelyGetListItem(gridUnits, colnum - 1) != null) {
                 log.error("Overlapping cell at position " + colnum);
                 //TODO throw layout exception



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


Re: svn commit: r289865 - in /xmlgraphics/fop/trunk/src/java/org/apache/fop: fo/ fo/flow/ fo/properties/ layoutmgr/table/

Posted by Andreas L Delmelle <a_...@pandora.be>.
On Sep 18, 2005, at 21:58, Finn Bock wrote:

Hi Finn,

>> +        if( pList.getExplicit(PR_COLUMN_NUMBER) != null ) {
>> +            ((TableFObj) parent).setCurrentColumnIndex(
>> +                    
>> pList.getExplicit(PR_COLUMN_NUMBER).getNumeric().getValue());
>> +        }
>
> Why is explit specified values different? In all other cases in FOP, 
> the fo object only needs the computed values.

Normally, if the value wasn't explicitly specified and the 
column-number received the initial value in ColumnNumberPropertyMaker 
(via the call to getCurrentColumnIndex()), the current column index for 
the parent at that point --whether it's a TableRow or a TableBody-- 
will obviously be the very same as the property's value.

It's only in the case where a column-number was explicitly specified on 
the FO, that the parent's columnIndex will be 'out-of-sync'. The 
column-number for the next cell should be the current cell's 
column-number plus it's number-columns-spanned. The 'plus 
number-columns-spanned' part is dealt with automatically when the cell 
is added to the parent's list of child nodes.

Earlier on, I had tried to solve this by comparing the current cell's 
column-number with the parent's columnIndex, but this didn't work for 
all cases... So I needed a way to check whether the value was generated 
as a default, and bumped into getExplicit() which turned out to be the 
answer.

But I think I know what you mean: apart from the check *whether* the 
explicit value is null,
maybe it's better to use
setCurrentColumnIndex(columnNumber.getValue()).

Sorry, I have a tendency to make things more complicated than they 
actually are :-)

Does this address your concern?


Cheers,

Andreas


Re: svn commit: r289865 - in /xmlgraphics/fop/trunk/src/java/org/apache/fop: fo/ fo/flow/ fo/properties/ layoutmgr/table/

Posted by Finn Bock <bc...@worldonline.dk>.
[adelmelle]

> Author: adelmelle
> Date: Sat Sep 17 16:59:25 2005
> New Revision: 289865
> 
> URL: http://svn.apache.org/viewcvs?rev=289865&view=rev
> Log:
> Implementation for initial values of the column-number property
> 
> Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/TableCell.java
> URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/TableCell.java?rev=289865&r1=289864&r2=289865&view=diff
> ==============================================================================
> --- xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/TableCell.java (original)
> +++ xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/TableCell.java Sat Sep 17 16:59:25 2005
...
> +        if( pList.getExplicit(PR_COLUMN_NUMBER) != null ) {
> +            ((TableFObj) parent).setCurrentColumnIndex(
> +                    pList.getExplicit(PR_COLUMN_NUMBER).getNumeric().getValue());
> +        }

Why is explit specified values different? In all other cases in FOP, the 
fo object only needs the computed values.

Perhaps it is needed here for table objects, but I find it very strange.

regards,
finn

Re: svn commit: r289865 - in /xmlgraphics/fop/trunk/src/java/org/apache/fop: fo/ fo/flow/ fo/properties/ layoutmgr/table/

Posted by Jeremias Maerki <de...@jeremias-maerki.ch>.
On 19.09.2005 23:19:46 Andreas L Delmelle wrote:
> On Sep 19, 2005, at 18:03, Andreas L Delmelle wrote:
> 
> > On Sep 19, 2005, at 11:08, Jeremias Maerki wrote:
> >
> >> Looks ok on first glance, though I've got a request: Would you please
> >> consider installing a checkstyle plug-in into your IDE and configuring
> >> the rules file for FOP? Thanks!
> >
> > Dammit! And I thought I had all bases covered... :-(
> >
> > My apologies for this. I hope it didn't cause too much inconvenience.
> 
> Ok, corrected most of my violations.

Thanks!

> BTW: is it necessary for the FOTree tests to have an Apache header as 
> well? Let me know, and I'll add them too...

Yes. http://www.apache.org/dev/apply-license.html says:

"The license is applied to each source file (code and documentation, but
excluding the LICENSE and NOTICE files) by including a short copyright
notice at the top, as demonstrated by the boilerplate notice provided in
the appendix."

In theory, all our files should have a license header where the format
allows it (i.e. it's obviously difficult for bitmap etc.).

Jeremias Maerki


Re: svn commit: r289865...

Posted by Andreas L Delmelle <a_...@pandora.be>.
On Sep 19, 2005, at 23:19, Andreas L Delmelle wrote:

>
> Ok, corrected most of my violations.

'Most', I said... :-S
There's still a few left, but bug 36720 came up, so the others will be 
committed together with the bugfix. Seems I've been quite sloppy in a 
few places... put too much focus on the difficult cases --hey, that 
rhymes :-)


Cheers,

Andreas


Re: svn commit: r289865 - in /xmlgraphics/fop/trunk/src/java/org/apache/fop: fo/ fo/flow/ fo/properties/ layoutmgr/table/

Posted by Andreas L Delmelle <a_...@pandora.be>.
On Sep 19, 2005, at 18:03, Andreas L Delmelle wrote:

> On Sep 19, 2005, at 11:08, Jeremias Maerki wrote:
>
>> Looks ok on first glance, though I've got a request: Would you please
>> consider installing a checkstyle plug-in into your IDE and configuring
>> the rules file for FOP? Thanks!
>
> Dammit! And I thought I had all bases covered... :-(
>
> My apologies for this. I hope it didn't cause too much inconvenience.

Ok, corrected most of my violations.

BTW: is it necessary for the FOTree tests to have an Apache header as 
well? Let me know, and I'll add them too...

Cheers,

Andreas


Re: svn commit: r289865 - in /xmlgraphics/fop/trunk/src/java/org/apache/fop: fo/ fo/flow/ fo/properties/ layoutmgr/table/

Posted by Andreas L Delmelle <a_...@pandora.be>.
On Sep 19, 2005, at 11:08, Jeremias Maerki wrote:

> Looks ok on first glance, though I've got a request: Would you please
> consider installing a checkstyle plug-in into your IDE and configuring
> the rules file for FOP? Thanks!

Dammit! And I thought I had all bases covered... :-(

My apologies for this. I hope it didn't cause too much inconvenience.


Cheers,

Andreas


Re: svn commit: r289865 - in /xmlgraphics/fop/trunk/src/java/org/apache/fop: fo/ fo/flow/ fo/properties/ layoutmgr/table/

Posted by Jeremias Maerki <de...@jeremias-maerki.ch>.
Looks ok on first glance, though I've got a request: Would you please
consider installing a checkstyle plug-in into your IDE and configuring
the rules file for FOP? Thanks!

On 18.09.2005 02:10:48 Andreas L Delmelle wrote:
> On Sep 18, 2005, at 01:59, adelmelle@apache.org wrote:
> 
> > Author: adelmelle
> > Date: Sat Sep 17 16:59:25 2005
> > New Revision: 289865
> >
> > URL: http://svn.apache.org/viewcvs?rev=289865&view=rev
> > Log:
> > Implementation for initial values of the column-number property
> 
> Ok, after a whole lot of talking, here it is then --finally...
> 
> Since this is my first substantial contribution, if there's anything 
> the Java geeks around here have to add or if I made any serious errors, 
> please don't shoot me :-)
> 
> Passed all regression tests, so nothing should break for the common 
> cases. If anyone comes up with cases that break this approach, just add 
> them to the FOTree testsuite. I've added a few rather exceptional cases 
> myself to make sure it was as generic as possible.
> Don't hesitate to ask further info if something is not quite clear WRT 
> the logic/theory.
> 
> Thanks to everyone --especially Jeremias-- for your patience, and for 
> the FOTree testsuite, without which I'd probably still be analyzing 
> numerous log.debug() messages... :-)
> 
> Hope it meets with your approval.
> 
> Cheers,
> 
> Andreas



Jeremias Maerki


Re: svn commit: r289865 - in /xmlgraphics/fop/trunk/src/java/org/apache/fop: fo/ fo/flow/ fo/properties/ layoutmgr/table/

Posted by Andreas L Delmelle <a_...@pandora.be>.
On Sep 18, 2005, at 01:59, adelmelle@apache.org wrote:

> Author: adelmelle
> Date: Sat Sep 17 16:59:25 2005
> New Revision: 289865
>
> URL: http://svn.apache.org/viewcvs?rev=289865&view=rev
> Log:
> Implementation for initial values of the column-number property

Ok, after a whole lot of talking, here it is then --finally...

Since this is my first substantial contribution, if there's anything 
the Java geeks around here have to add or if I made any serious errors, 
please don't shoot me :-)

Passed all regression tests, so nothing should break for the common 
cases. If anyone comes up with cases that break this approach, just add 
them to the FOTree testsuite. I've added a few rather exceptional cases 
myself to make sure it was as generic as possible.
Don't hesitate to ask further info if something is not quite clear WRT 
the logic/theory.

Thanks to everyone --especially Jeremias-- for your patience, and for 
the FOTree testsuite, without which I'd probably still be analyzing 
numerous log.debug() messages... :-)

Hope it meets with your approval.

Cheers,

Andreas