aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/org/apache/fop
diff options
context:
space:
mode:
authorVincent Hennebert <vhennebert@apache.org>2007-10-31 15:06:35 +0000
committerVincent Hennebert <vhennebert@apache.org>2007-10-31 15:06:35 +0000
commitfc34b198fd486c5db87e4982b118ba558dcbbedd (patch)
tree3e11525e613b51e7732691a31a8535a3cff0081a /src/java/org/apache/fop
parente340490662dcbb38c1ef6771435b8ff4e3721cc1 (diff)
downloadxmlgraphics-fop-fc34b198fd486c5db87e4982b118ba558dcbbedd.tar.gz
xmlgraphics-fop-fc34b198fd486c5db87e4982b118ba558dcbbedd.zip
- Enforced check for proper number of columns in a table. Now if a table has explicit table-columns, those fix the total number of columns and any row having more columns will lead to an error.
- Set up a framework for unit-testing classes from the FO tree, and added some first testcases for the number of columns in tables. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@590705 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/fop')
-rw-r--r--src/java/org/apache/fop/fo/flow/Table.java7
-rw-r--r--src/java/org/apache/fop/fo/flow/TableCellContainer.java7
2 files changed, 14 insertions, 0 deletions
diff --git a/src/java/org/apache/fop/fo/flow/Table.java b/src/java/org/apache/fop/fo/flow/Table.java
index 7bc2d49ec..2dfc06fdf 100644
--- a/src/java/org/apache/fop/fo/flow/Table.java
+++ b/src/java/org/apache/fop/fo/flow/Table.java
@@ -83,6 +83,8 @@ public class Table extends TableFObj implements ColumnNumberManagerHolder {
private boolean tableFooterFound = false;
private boolean tableBodyFound = false;
+ private boolean hasExplicitColumns = false;
+
/**
* The table's property list. Used in case the table has
* no explicit columns, as a parent property list to
@@ -236,6 +238,7 @@ public class Table extends TableFObj implements ColumnNumberManagerHolder {
switch (childId) {
case FO_TABLE_COLUMN:
+ hasExplicitColumns = true;
if (!inMarker()) {
addColumnNode((TableColumn) child);
} else {
@@ -313,6 +316,10 @@ public class Table extends TableFObj implements ColumnNumberManagerHolder {
columnNumberManager.signalUsedColumnNumbers(colNumber, colNumber + colRepeat - 1);
}
+ boolean hasExplicitColumns() {
+ return hasExplicitColumns;
+ }
+
/** @return true of table-layout="auto" */
public boolean isAutoLayout() {
return (tableLayout == EN_AUTO);
diff --git a/src/java/org/apache/fop/fo/flow/TableCellContainer.java b/src/java/org/apache/fop/fo/flow/TableCellContainer.java
index 228e3c80d..348ae93f2 100644
--- a/src/java/org/apache/fop/fo/flow/TableCellContainer.java
+++ b/src/java/org/apache/fop/fo/flow/TableCellContainer.java
@@ -24,6 +24,7 @@ import java.util.List;
import org.apache.fop.apps.FOPException;
import org.apache.fop.datatypes.Length;
import org.apache.fop.fo.FONode;
+import org.apache.fop.fo.ValidationException;
/**
* A common class for fo:table-body and fo:table-row which both can contain fo:table-cell.
@@ -66,6 +67,12 @@ public abstract class TableCellContainer extends TableFObj implements ColumnNumb
int colSpan = cell.getNumberColumnsSpanned();
int rowSpan = cell.getNumberRowsSpanned();
+ Table t = getTable();
+ if (t.hasExplicitColumns() && colNumber + colSpan - 1 > t.getNumberOfColumns()) {
+ throw new ValidationException(FONode.errorText(locator) + "column-number or number "
+ + "of cells in the row overflows the number of fo:table-column specified "
+ + "for the table.");
+ }
if (firstRow) {
handleCellWidth(cell, colNumber, colSpan);
updatePendingSpansSize(cell, colNumber, colSpan);