diff options
author | Andreas L. Delmelle <adelmelle@apache.org> | 2008-06-22 20:57:43 +0000 |
---|---|---|
committer | Andreas L. Delmelle <adelmelle@apache.org> | 2008-06-22 20:57:43 +0000 |
commit | d02d89fc246b1ba9ee398f69ac15664656420cb2 (patch) | |
tree | 132464f80d80de9ee3331b172516b5e64d949c88 /src/java/org/apache/fop/fo/flow/table | |
parent | e04c31d665be016ffe9e36efb9e5f41917e30069 (diff) | |
download | xmlgraphics-fop-d02d89fc246b1ba9ee398f69ac15664656420cb2.tar.gz xmlgraphics-fop-d02d89fc246b1ba9ee398f69ac15664656420cb2.zip |
Partial fix of FOEventHandler call sequence (see also Bugzilla #45237):
call startOfNode() after addChildNode()
moved initialization for tableFOs to processNode()
moved finishing code to a finalizeNode() method (which is now also used by AbstractRetrieveMarker)
restored protected status of startOfNode()/endOfNode() in fo.flow.table package
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@670412 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/fop/fo/flow/table')
8 files changed, 54 insertions, 50 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 771ec0c64..9feb77c9c 100644 --- a/src/java/org/apache/fop/fo/flow/table/Table.java +++ b/src/java/org/apache/fop/fo/flow/table/Table.java @@ -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); } @@ -218,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?" @@ -244,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(); @@ -523,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; } diff --git a/src/java/org/apache/fop/fo/flow/table/TableBody.java b/src/java/org/apache/fop/fo/flow/table/TableBody.java index c3cf772ac..b4071e255 100644 --- a/src/java/org/apache/fop/fo/flow/table/TableBody.java +++ b/src/java/org/apache/fop/fo/flow/table/TableBody.java @@ -38,13 +38,13 @@ public class TableBody extends TablePart { } /** {@inheritDoc} */ - public void startOfNode() throws FOPException { + protected void startOfNode() throws FOPException { super.startOfNode(); getFOEventHandler().startBody(this); } /** {@inheritDoc} */ - public void endOfNode() throws FOPException { + protected void endOfNode() throws FOPException { super.endOfNode(); getFOEventHandler().endBody(this); } diff --git a/src/java/org/apache/fop/fo/flow/table/TableCell.java b/src/java/org/apache/fop/fo/flow/table/TableCell.java index 2603ba8b4..21da54128 100644 --- a/src/java/org/apache/fop/fo/flow/table/TableCell.java +++ b/src/java/org/apache/fop/fo/flow/table/TableCell.java @@ -91,17 +91,24 @@ public class TableCell extends TableFObj { } /** {@inheritDoc} */ - public void startOfNode() throws FOPException { + protected void startOfNode() throws FOPException { super.startOfNode(); getFOEventHandler().startCell(this); } /** * Make sure content model satisfied, if so then tell the - * FOEventHandler that we are at the end of the flow. + * FOEventHandler that we are at the end of the table-cell. * {@inheritDoc} */ - public void endOfNode() throws FOPException { + protected void endOfNode() throws FOPException { + super.endOfNode(); + getFOEventHandler().endCell(this); + } + + /** {@inheritDoc} */ + public void finalizeNode() throws FOPException { + if (!blockItemFound) { missingChildElementError("marker* (%block;)+", true); } @@ -111,9 +118,9 @@ public class TableCell extends TableFObj { getUserAgent().getEventBroadcaster()); eventProducer.startEndRowUnderTableRowWarning(this, getLocator()); } - getFOEventHandler().endCell(this); + } - + /** * {@inheritDoc} * <br>XSL Content Model: marker* (%block;)+ diff --git a/src/java/org/apache/fop/fo/flow/table/TableFObj.java b/src/java/org/apache/fop/fo/flow/table/TableFObj.java index 016046ae2..370bb9de4 100644 --- a/src/java/org/apache/fop/fo/flow/table/TableFObj.java +++ b/src/java/org/apache/fop/fo/flow/table/TableFObj.java @@ -34,6 +34,8 @@ import org.apache.fop.fo.properties.NumberProperty; import org.apache.fop.fo.properties.Property; import org.apache.fop.fo.properties.PropertyMaker; import org.apache.fop.layoutmgr.table.CollapsingBorderModel; +import org.xml.sax.Locator; +import org.xml.sax.Attributes; /** * Common base class for table-related FOs @@ -207,8 +209,8 @@ public abstract class TableFObj extends FObj { } /** {@inheritDoc} */ - public void startOfNode() throws FOPException { - super.startOfNode(); + public void processNode(String elementName, Locator locator, Attributes attlist, PropertyList pList) throws FOPException { + super.processNode(elementName, locator, attlist, pList); Table table = getTable(); if (!inMarker() && !table.isSeparateBorderModel()) { collapsingBorderModel = CollapsingBorderModel.getBorderModelFor(table @@ -216,15 +218,7 @@ public abstract class TableFObj extends FObj { setCollapsedBorders(); } } - - /* - * TODO made public so that RetrieveMarker can access it. - */ - /** {@inheritDoc} */ - public void endOfNode() throws FOPException { - super.endOfNode(); - } - + /** * Prepares the borders of this element if the collapsing-border model is in use. * Conflict resolution with parent elements is done where applicable. diff --git a/src/java/org/apache/fop/fo/flow/table/TableFooter.java b/src/java/org/apache/fop/fo/flow/table/TableFooter.java index 886001e76..a89a2e431 100644 --- a/src/java/org/apache/fop/fo/flow/table/TableFooter.java +++ b/src/java/org/apache/fop/fo/flow/table/TableFooter.java @@ -41,13 +41,13 @@ public class TableFooter extends TablePart { } /** {@inheritDoc} */ - public void startOfNode() throws FOPException { + protected void startOfNode() throws FOPException { super.startOfNode(); getFOEventHandler().startFooter(this); } /** {@inheritDoc} */ - public void endOfNode() throws FOPException { + protected void endOfNode() throws FOPException { super.endOfNode(); getFOEventHandler().endFooter(this); } diff --git a/src/java/org/apache/fop/fo/flow/table/TableHeader.java b/src/java/org/apache/fop/fo/flow/table/TableHeader.java index c42d79b46..7f4173754 100644 --- a/src/java/org/apache/fop/fo/flow/table/TableHeader.java +++ b/src/java/org/apache/fop/fo/flow/table/TableHeader.java @@ -40,13 +40,13 @@ public class TableHeader extends TablePart { } /** {@inheritDoc} */ - public void startOfNode() throws FOPException { + protected void startOfNode() throws FOPException { super.startOfNode(); getFOEventHandler().startHeader(this); } /** {@inheritDoc} */ - public void endOfNode() throws FOPException { + protected void endOfNode() throws FOPException { super.endOfNode(); getFOEventHandler().endHeader(this); } diff --git a/src/java/org/apache/fop/fo/flow/table/TablePart.java b/src/java/org/apache/fop/fo/flow/table/TablePart.java index 67af69e03..4d20db8c4 100644 --- a/src/java/org/apache/fop/fo/flow/table/TablePart.java +++ b/src/java/org/apache/fop/fo/flow/table/TablePart.java @@ -79,7 +79,8 @@ public abstract class TablePart extends TableCellContainer { public void processNode(String elementName, Locator locator, Attributes attlist, PropertyList pList) throws FOPException { - + + super.processNode(elementName, locator, attlist, pList); if (!inMarker()) { Table t = getTable(); if (t.hasExplicitColumns()) { @@ -93,13 +94,11 @@ public abstract class TablePart extends TableCellContainer { } columnNumberManager = new ColumnNumberManager(); } - super.processNode(elementName, locator, attlist, pList); - + } /** {@inheritDoc} */ - public void endOfNode() throws FOPException { - super.endOfNode(); + public void finalizeNode() throws FOPException { if (!inMarker()) { pendingSpans = null; columnNumberManager = null; diff --git a/src/java/org/apache/fop/fo/flow/table/TableRow.java b/src/java/org/apache/fop/fo/flow/table/TableRow.java index 8b5fc6bd4..ac6eafc2f 100644 --- a/src/java/org/apache/fop/fo/flow/table/TableRow.java +++ b/src/java/org/apache/fop/fo/flow/table/TableRow.java @@ -78,12 +78,12 @@ public class TableRow extends TableCellContainer { /** {@inheritDoc} */ public void processNode(String elementName, Locator locator, Attributes attlist, PropertyList pList) throws FOPException { + super.processNode(elementName, locator, attlist, pList); if (!inMarker()) { TablePart part = (TablePart) parent; pendingSpans = part.pendingSpans; columnNumberManager = part.columnNumberManager; } - super.processNode(elementName, locator, attlist, pList); } /** {@inheritDoc} */ @@ -97,13 +97,19 @@ public class TableRow extends TableCellContainer { } /** {@inheritDoc} */ - public void startOfNode() throws FOPException { + protected void startOfNode() throws FOPException { super.startOfNode(); getFOEventHandler().startRow(this); } /** {@inheritDoc} */ - public void endOfNode() throws FOPException { + protected void endOfNode() throws FOPException { + super.endOfNode(); + getFOEventHandler().endRow(this); + } + + /** {@inheritDoc} */ + public void finalizeNode() throws FOPException { if (firstChild == null) { missingChildElementError("(table-cell+)"); } @@ -111,9 +117,8 @@ public class TableRow extends TableCellContainer { pendingSpans = null; columnNumberManager = null; } - getFOEventHandler().endRow(this); } - + /** * {@inheritDoc} String, String) * <br>XSL Content Model: (table-cell+) |