diff options
Diffstat (limited to 'src/java/org/apache/fop/fo/flow/table/Table.java')
-rw-r--r-- | src/java/org/apache/fop/fo/flow/table/Table.java | 51 |
1 files changed, 26 insertions, 25 deletions
diff --git a/src/java/org/apache/fop/fo/flow/table/Table.java b/src/java/org/apache/fop/fo/flow/table/Table.java index 5b96a668e..9feb77c9c 100644 --- a/src/java/org/apache/fop/fo/flow/table/Table.java +++ b/src/java/org/apache/fop/fo/flow/table/Table.java @@ -76,8 +76,8 @@ public class Table extends TableFObj implements ColumnNumberManagerHolder { private ColumnNumberManager columnNumberManager = new ColumnNumberManager(); /** the table-header and -footer */ - private TableBody tableHeader = null; - private TableBody tableFooter = null; + private TableHeader tableHeader = null; + private TableFooter tableFooter = null; /** used for validation */ private boolean tableColumnFound = false; @@ -157,10 +157,8 @@ public class Table extends TableFObj implements ColumnNumberManagerHolder { this.propList = pList; } - /** - * {@inheritDoc} - */ - public void startOfNode() throws FOPException { + /** {@inheritDoc} */ + protected void startOfNode() throws FOPException { super.startOfNode(); getFOEventHandler().startTable(this); } @@ -200,7 +198,9 @@ public class Table extends TableFObj implements ColumnNumberManagerHolder { } else { tableFooterFound = true; if (tableBodyFound) { - nodesOutOfOrderError(loc, "fo:table-footer", "(table-body+)", true); + if (getUserAgent().validateStrictly()) { + nodesOutOfOrderError(loc, "fo:table-footer", "(table-body+)", true); + } if (!isSeparateBorderModel()) { TableEventProducer eventProducer = TableEventProducer.Provider.get( getUserAgent().getEventBroadcaster()); @@ -216,11 +216,15 @@ public class Table extends TableFObj implements ColumnNumberManagerHolder { } } - /** - * {@inheritDoc} - */ - public void endOfNode() throws FOPException { + /** {@inheritDoc} */ + protected void endOfNode() throws FOPException { + super.endOfNode(); + getFOEventHandler().endTable(this); + } + /** {@inheritDoc} */ + public void finalizeNode() throws FOPException { + if (!tableBodyFound) { missingChildElementError( "(marker*,table-column*,table-header?,table-footer?" @@ -242,13 +246,10 @@ public class Table extends TableFObj implements ColumnNumberManagerHolder { this.propList = null; rowGroupBuilder = null; } - getFOEventHandler().endTable(this); - + } - - /** - * {@inheritDoc} - */ + + /** {@inheritDoc} */ protected void addChildNode(FONode child) throws FOPException { int childId = child.getNameId(); @@ -277,10 +278,10 @@ public class Table extends TableFObj implements ColumnNumberManagerHolder { } switch (childId) { case FO_TABLE_FOOTER: - tableFooter = (TableBody) child; + tableFooter = (TableFooter) child; break; case FO_TABLE_HEADER: - tableHeader = (TableBody) child; + tableHeader = (TableHeader) child; break; default: super.addChildNode(child); @@ -402,12 +403,12 @@ public class Table extends TableFObj implements ColumnNumberManagerHolder { } /** @return the body for the table-header. */ - public TableBody getTableHeader() { + public TableHeader getTableHeader() { return tableHeader; } /** @return the body for the table-footer. */ - public TableBody getTableFooter() { + public TableFooter getTableFooter() { return tableFooter; } @@ -521,17 +522,17 @@ public class Table extends TableFObj implements ColumnNumberManagerHolder { return FO_TABLE; } - /** - * {@inheritDoc} - */ + /** {@inheritDoc} */ public FONode clone(FONode parent, boolean removeChildren) throws FOPException { Table clone = (Table) super.clone(parent, removeChildren); - clone.columnsFinalized = false; if (removeChildren) { clone.columns = new ArrayList(); + clone.columnsFinalized = false; + clone.columnNumberManager = new ColumnNumberManager(); clone.tableHeader = null; clone.tableFooter = null; + clone.rowGroupBuilder = null; } return clone; } |