]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
Moved check for explicit column-number to ColumnNumberPropertyMaker
authorAndreas L. Delmelle <adelmelle@apache.org>
Sat, 24 Sep 2005 10:02:01 +0000 (10:02 +0000)
committerAndreas L. Delmelle <adelmelle@apache.org>
Sat, 24 Sep 2005 10:02:01 +0000 (10:02 +0000)
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@291270 13f79535-47bb-0310-9956-ffa450edef68

src/java/org/apache/fop/fo/flow/TableBody.java
src/java/org/apache/fop/fo/flow/TableCell.java
src/java/org/apache/fop/fo/flow/TableColumn.java
src/java/org/apache/fop/fo/flow/TableFObj.java
src/java/org/apache/fop/fo/flow/TableRow.java
src/java/org/apache/fop/fo/properties/ColumnNumberPropertyMaker.java

index bed35017c8f039a94bc5051391ab7ffe19b04a58..eaf3cb5108c6c94d95ab320650225867749be999 100644 (file)
@@ -329,7 +329,7 @@ public class TableBody extends TableFObj {
      * 
      * @param newIndex  the new column index
      */
-    protected void setCurrentColumnIndex(int newIndex) {
+    public void setCurrentColumnIndex(int newIndex) {
         columnIndex = newIndex;
     }
 
index fa03a0f88a889010ec6c40cc3199297ce5354bcf..8195e941ab1fc869fdf7e7b4bd663a44043c64b3 100644 (file)
@@ -149,15 +149,9 @@ public class TableCell extends TableFObj {
             //in the current row => error!
             if (((TableFObj) parent).isColumnNumberUsed(columnIndex)) {
                 throw new FOPException("fo:table-cell overlaps in column "
-                        + i, locator);
+                        + columnIndex, 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(columnNumber.getValue());
-        }
     }
 
     /**
index 55b68a568adfd40298f74780c58384ba13b28351..94cacf4e663777079d7494b30daf23c2cc6cae1a 100644 (file)
@@ -75,18 +75,9 @@ public class TableColumn extends TableFObj {
         visibility = pList.get(PR_VISIBILITY).getEnum();
         super.bind(pList);
         
-        if (pList.getExplicit(PR_COLUMN_NUMBER) != null) {
-            if (getTable().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)
-                getTable().setCurrentColumnIndex(columnNumber.getValue());
-            }
+        if (getTable().isColumnNumberUsed(columnNumber.getValue())) {
+            throw new PropertyException("column-number \"" + columnNumber 
+                    + "\" has already been assigned to a previous column");
         }
         if (numberColumnsRepeated.getValue() <= 0) {
             throw new PropertyException("number-columns-repeated must be 1 or bigger, "
index f40c46c89c4683bc385c646456f7e9d987446a29..11f4c3295a0a0dadc77380936648b55d3148bd21 100644 (file)
@@ -125,7 +125,7 @@ public abstract class TableFObj extends FObj {
      * 
      * @param   newIndex    new value for column index
      */
-    protected void setCurrentColumnIndex(int newIndex) {
+    public void setCurrentColumnIndex(int newIndex) {
         //do nothing by default
     }
     
index 2179b3f3ec17e89c221ae0a0e77ede689193de77..41543ef83c8d463f3e0af0c7939dda04a1cabe67 100644 (file)
@@ -305,7 +305,7 @@ public class TableRow extends TableFObj {
      * 
      * @param newIndex  new value for column index
      */
-    protected void setCurrentColumnIndex(int newIndex) {
+    public void setCurrentColumnIndex(int newIndex) {
         columnIndex = newIndex;
     }
 
index 46e87c2c6c3fe8bb7ecbd3caf78fc647a7c5a4a3..211055e5c40e8f29f9449061c6f95f319f7b0bf6 100644 (file)
@@ -86,9 +86,9 @@ public class ColumnNumberPropertyMaker extends NumberProperty.Maker {
         
         Property p = super.get(0, propertyList, tryInherit, tryDefault);
         FObj fo = propertyList.getFObj();
+        TableFObj parent = (TableFObj) propertyList.getParentFObj();
         
         if (p.getNumeric().getValue() <= 0) {
-            TableFObj parent = (TableFObj) propertyList.getParentFObj();
             int columnIndex = parent.getCurrentColumnIndex();
             fo.getLogger().warn("Specified negative or zero value for "
                     + "column-number on " + fo.getName() + ": "
@@ -97,6 +97,13 @@ public class ColumnNumberPropertyMaker extends NumberProperty.Maker {
             return new NumberProperty(columnIndex);
         }
         //TODO: check for non-integer value and round
+        
+        //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 (propertyList.getExplicit(Constants.PR_COLUMN_NUMBER) != null) {
+            parent.setCurrentColumnIndex(p.getNumeric().getValue());
+        }
         return p;
     }
 }