diff options
author | Andreas L. Delmelle <adelmelle@apache.org> | 2005-09-24 10:02:01 +0000 |
---|---|---|
committer | Andreas L. Delmelle <adelmelle@apache.org> | 2005-09-24 10:02:01 +0000 |
commit | 3bbd46a754991021b4ab2a1e644dad54c865dcbe (patch) | |
tree | 0c5e1bbdcdcc35c0d713e4fa9e90319fb0e1301c | |
parent | 4d9064b61f534279acc7cda72c758529e215c69b (diff) | |
download | xmlgraphics-fop-3bbd46a754991021b4ab2a1e644dad54c865dcbe.tar.gz xmlgraphics-fop-3bbd46a754991021b4ab2a1e644dad54c865dcbe.zip |
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
6 files changed, 15 insertions, 23 deletions
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; } } |