From d4f4f5456b21d3b099e9c3145109246819d204bf Mon Sep 17 00:00:00 2001 From: "Andreas L. Delmelle" Date: Tue, 22 Aug 2006 01:43:29 +0000 Subject: [PATCH] Minor enhancement of column-number property code / removal of unused method git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@433459 13f79535-47bb-0310-9956-ffa450edef68 --- src/java/org/apache/fop/fo/flow/Table.java | 7 +-- .../org/apache/fop/fo/flow/TableFObj.java | 9 +++- .../testcases/column-number_non-integer.fo | 54 +++++++++++++++++++ 3 files changed, 63 insertions(+), 7 deletions(-) create mode 100644 test/fotree/testcases/column-number_non-integer.fo diff --git a/src/java/org/apache/fop/fo/flow/Table.java b/src/java/org/apache/fop/fo/flow/Table.java index 5ea294064..ac3fc95ee 100644 --- a/src/java/org/apache/fop/fo/flow/Table.java +++ b/src/java/org/apache/fop/fo/flow/Table.java @@ -339,12 +339,7 @@ public class Table extends TableFObj { public boolean isAutoLayout() { return (tableLayout == EN_AUTO); } - - /** @return the default table column */ - public TableColumn getDefaultColumn() { - return (TableColumn) this.columns.get(0); - } - + /** @return the list of table-column elements. */ public List getColumns() { return columns; diff --git a/src/java/org/apache/fop/fo/flow/TableFObj.java b/src/java/org/apache/fop/fo/flow/TableFObj.java index a5370a36d..c72e4da9d 100644 --- a/src/java/org/apache/fop/fo/flow/TableFObj.java +++ b/src/java/org/apache/fop/fo/flow/TableFObj.java @@ -378,7 +378,14 @@ public abstract class TableFObj extends FObj { + parent.getCurrentColumnIndex()); return new NumberProperty(parent.getCurrentColumnIndex()); } - //TODO: check for non-integer value and round + + double tmpIndex = p.getNumeric().getNumericValue(); + if (tmpIndex - columnIndex > 0.0) { + columnIndex = (int) Math.round(tmpIndex); + fo.getLogger().warn("Rounding specified column-number of " + + tmpIndex + " to " + columnIndex); + return new NumberProperty(columnIndex); + } /* if column-number was explicitly specified, force the * parent's current column index to the specified value, diff --git a/test/fotree/testcases/column-number_non-integer.fo b/test/fotree/testcases/column-number_non-integer.fo new file mode 100644 index 000000000..ee69d7e48 --- /dev/null +++ b/test/fotree/testcases/column-number_non-integer.fo @@ -0,0 +1,54 @@ + + + + + + + + + + + + + + + + + + + + + + + + Cell1 + + + + Cell2 + + + + + + + + + -- 2.39.5