aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/org/apache
diff options
context:
space:
mode:
authorJeremias Maerki <jeremias@apache.org>2005-09-16 08:39:10 +0000
committerJeremias Maerki <jeremias@apache.org>2005-09-16 08:39:10 +0000
commit461b36809cbfc355916e050d3b24cc213f3d3fe0 (patch)
treeee0d633ae0a8a5d9830475d1de3d4a86668d6c19 /src/java/org/apache
parentd045c95550882cf20478f79dae253722d39fba90 (diff)
downloadxmlgraphics-fop-461b36809cbfc355916e050d3b24cc213f3d3fe0.tar.gz
xmlgraphics-fop-461b36809cbfc355916e050d3b24cc213f3d3fe0.zip
An informative warning for the user if he doesn't supply enough table-column elements in fixed table layout.
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@289428 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache')
-rw-r--r--src/java/org/apache/fop/fo/flow/Table.java2
-rw-r--r--src/java/org/apache/fop/fo/flow/TableColumn.java22
-rw-r--r--src/java/org/apache/fop/layoutmgr/table/ColumnSetup.java19
3 files changed, 41 insertions, 2 deletions
diff --git a/src/java/org/apache/fop/fo/flow/Table.java b/src/java/org/apache/fop/fo/flow/Table.java
index 4b0dd7a7c..e958c3c64 100644
--- a/src/java/org/apache/fop/fo/flow/Table.java
+++ b/src/java/org/apache/fop/fo/flow/Table.java
@@ -128,7 +128,7 @@ public class Table extends FObj {
writingMode = pList.get(PR_WRITING_MODE).getEnum();
//Create default column in case no table-columns will be defined.
- defaultColumn = new TableColumn(this);
+ defaultColumn = new TableColumn(this, true);
PropertyList colPList = new StaticPropertyList(defaultColumn, pList);
colPList.setWritingMode();
defaultColumn.bind(colPList);
diff --git a/src/java/org/apache/fop/fo/flow/TableColumn.java b/src/java/org/apache/fop/fo/flow/TableColumn.java
index 8a87dcc28..a0aa9d647 100644
--- a/src/java/org/apache/fop/fo/flow/TableColumn.java
+++ b/src/java/org/apache/fop/fo/flow/TableColumn.java
@@ -48,12 +48,24 @@ public class TableColumn extends FObj {
private int visibility;
// End of property values
+ private boolean defaultColumn;
+
/**
* @param parent FONode that is the parent of this object
*/
public TableColumn(FONode parent) {
+ this(parent, false);
+ }
+
+ /**
+ * @param parent FONode that is the parent of this object
+ * @param defaultColumn true if this table-column has been manually created as a default column
+ */
+ public TableColumn(FONode parent, boolean defaultColumn) {
super(parent);
+ this.defaultColumn = defaultColumn;
}
+
/**
* @see org.apache.fop.fo.FObj#bind(PropertyList)
@@ -157,6 +169,16 @@ public class TableColumn extends FObj {
return FO_TABLE_COLUMN;
}
+ /**
+ * Indicates whether this table-column has been created as default column for this table in
+ * case no table-columns have been defined. Note that this only used to provide better
+ * user feedback (see ColumnSetup).
+ * @return true if this table-column has been created as default column
+ */
+ public boolean isDefaultColumn() {
+ return defaultColumn;
+ }
+
/** @see java.lang.Object#toString() */
public String toString() {
StringBuffer sb = new StringBuffer("fo:table-column");
diff --git a/src/java/org/apache/fop/layoutmgr/table/ColumnSetup.java b/src/java/org/apache/fop/layoutmgr/table/ColumnSetup.java
index 188b9f6ab..8df556afc 100644
--- a/src/java/org/apache/fop/layoutmgr/table/ColumnSetup.java
+++ b/src/java/org/apache/fop/layoutmgr/table/ColumnSetup.java
@@ -41,6 +41,10 @@ public class ColumnSetup {
private List columns = new java.util.ArrayList();
private int maxColIndexReferenced = 0;
+ /**
+ * Main Constructor.
+ * @param table the table to construct this column setup for
+ */
public ColumnSetup(Table table) {
this.table = table;
prepareExplicitColumns();
@@ -89,7 +93,20 @@ public class ColumnSetup {
public TableColumn getColumn(int index) {
int size = columns.size();
if (index > size) {
- maxColIndexReferenced = Math.max(maxColIndexReferenced, index);
+ if (index > maxColIndexReferenced) {
+ maxColIndexReferenced = index;
+ if (!(size == 1 && getColumn(1).isDefaultColumn())) {
+ log.warn("There are fewer table-columns than are needed. Column "
+ + index + " was accessed although only "
+ + size + " columns have been defined. "
+ + "The last defined column will be reused.");
+ if (!table.isAutoLayout()) {
+ log.warn("Please note that according XSL-FO 1.0 (4.26.9) says that "
+ + "the 'column-width' property must be specified for every "
+ + "column, unless the automatic table layout is used.");
+ }
+ }
+ }
return (TableColumn)columns.get(size - 1);
} else {
return (TableColumn)columns.get(index - 1);