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 je...@apache.org on 2005/09/16 10:39:17 UTC

svn commit: r289428 - in /xmlgraphics/fop/trunk/src/java/org/apache/fop: fo/flow/Table.java fo/flow/TableColumn.java layoutmgr/table/ColumnSetup.java

Author: jeremias
Date: Fri Sep 16 01:39:10 2005
New Revision: 289428

URL: http://svn.apache.org/viewcvs?rev=289428&view=rev
Log:
An informative warning for the user if he doesn't supply enough table-column elements in fixed table layout.

Modified:
    xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/Table.java   (contents, props changed)
    xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/TableColumn.java   (contents, props changed)
    xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/ColumnSetup.java

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=289428&r1=289427&r2=289428&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 Sep 16 01:39:10 2005
@@ -128,7 +128,7 @@
         writingMode = pList.get(PR_WRITING_MODE).getEnum();
 
         //Create default column in case no table-columns will be defined.
-        defaultColumn = new TableColumn(this);
+        defaultColumn = new TableColumn(this, true);
         PropertyList colPList = new StaticPropertyList(defaultColumn, pList);
         colPList.setWritingMode();
         defaultColumn.bind(colPList);

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

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=289428&r1=289427&r2=289428&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 Sep 16 01:39:10 2005
@@ -48,12 +48,24 @@
     private int visibility;
     // End of property values
     
+    private boolean defaultColumn;
+    
     /**
      * @param parent FONode that is the parent of this object
      */
     public TableColumn(FONode parent) {
+        this(parent, false);
+    }
+    
+    /**
+     * @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
+     */
+    public TableColumn(FONode parent, boolean defaultColumn) {
         super(parent);
+        this.defaultColumn = defaultColumn;
     }
+    
 
     /**
      * @see org.apache.fop.fo.FObj#bind(PropertyList)
@@ -155,6 +167,16 @@
     /** @see org.apache.fop.fo.FObj#getNameId() */
     public int getNameId() {
         return FO_TABLE_COLUMN;
+    }
+    
+    /**
+     * Indicates whether this table-column has been created as default column for this table in
+     * case no table-columns have been defined. Note that this only used to provide better
+     * user feedback (see ColumnSetup).
+     * @return true if this table-column has been created as default column
+     */
+    public boolean isDefaultColumn() {
+        return defaultColumn;
     }
     
     /** @see java.lang.Object#toString() */

Propchange: xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/TableColumn.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=289428&r1=289427&r2=289428&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 Sep 16 01:39:10 2005
@@ -41,6 +41,10 @@
     private List columns = new java.util.ArrayList();
     private int maxColIndexReferenced = 0;
     
+    /**
+     * Main Constructor.
+     * @param table the table to construct this column setup for
+     */
     public ColumnSetup(Table table) {
         this.table = table;
         prepareExplicitColumns();
@@ -89,7 +93,20 @@
     public TableColumn getColumn(int index) {
         int size = columns.size();
         if (index > size) {
-            maxColIndexReferenced = Math.max(maxColIndexReferenced, index);
+            if (index > maxColIndexReferenced) {
+                maxColIndexReferenced = index;
+                if (!(size == 1 && getColumn(1).isDefaultColumn())) {
+                    log.warn("There are fewer table-columns than are needed. Column " 
+                            + index + " was accessed although only " 
+                            + size + " columns have been defined. "
+                            + "The last defined column will be reused.");
+                    if (!table.isAutoLayout()) {
+                        log.warn("Please note that according XSL-FO 1.0 (4.26.9) says that "
+                                + "the 'column-width' property must be specified for every "
+                                + "column, unless the automatic table layout is used.");
+                    }
+                }
+            }
             return (TableColumn)columns.get(size - 1);
         } else {
             return (TableColumn)columns.get(index - 1);



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