From: Andreas L. Delmelle Date: Sat, 24 Sep 2005 10:02:01 +0000 (+0000) Subject: Moved check for explicit column-number to ColumnNumberPropertyMaker X-Git-Tag: fop-0_90-alpha1~182 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=3bbd46a754991021b4ab2a1e644dad54c865dcbe;p=xmlgraphics-fop.git Moved check for explicit column-number to ColumnNumberPropertyMaker git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@291270 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/java/org/apache/fop/fo/flow/TableBody.java b/src/java/org/apache/fop/fo/flow/TableBody.java index bed35017c..eaf3cb510 100644 --- a/src/java/org/apache/fop/fo/flow/TableBody.java +++ b/src/java/org/apache/fop/fo/flow/TableBody.java @@ -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; } diff --git a/src/java/org/apache/fop/fo/flow/TableCell.java b/src/java/org/apache/fop/fo/flow/TableCell.java index fa03a0f88..8195e941a 100644 --- a/src/java/org/apache/fop/fo/flow/TableCell.java +++ b/src/java/org/apache/fop/fo/flow/TableCell.java @@ -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()); - } } /** diff --git a/src/java/org/apache/fop/fo/flow/TableColumn.java b/src/java/org/apache/fop/fo/flow/TableColumn.java index 55b68a568..94cacf4e6 100644 --- a/src/java/org/apache/fop/fo/flow/TableColumn.java +++ b/src/java/org/apache/fop/fo/flow/TableColumn.java @@ -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, " diff --git a/src/java/org/apache/fop/fo/flow/TableFObj.java b/src/java/org/apache/fop/fo/flow/TableFObj.java index f40c46c89..11f4c3295 100644 --- a/src/java/org/apache/fop/fo/flow/TableFObj.java +++ b/src/java/org/apache/fop/fo/flow/TableFObj.java @@ -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 } diff --git a/src/java/org/apache/fop/fo/flow/TableRow.java b/src/java/org/apache/fop/fo/flow/TableRow.java index 2179b3f3e..41543ef83 100644 --- a/src/java/org/apache/fop/fo/flow/TableRow.java +++ b/src/java/org/apache/fop/fo/flow/TableRow.java @@ -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; } diff --git a/src/java/org/apache/fop/fo/properties/ColumnNumberPropertyMaker.java b/src/java/org/apache/fop/fo/properties/ColumnNumberPropertyMaker.java index 46e87c2c6..211055e5c 100644 --- a/src/java/org/apache/fop/fo/properties/ColumnNumberPropertyMaker.java +++ b/src/java/org/apache/fop/fo/properties/ColumnNumberPropertyMaker.java @@ -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; } }