diff options
author | Andreas L. Delmelle <adelmelle@apache.org> | 2008-05-11 12:22:22 +0000 |
---|---|---|
committer | Andreas L. Delmelle <adelmelle@apache.org> | 2008-05-11 12:22:22 +0000 |
commit | 7085b0c9a97cca2eb7fa1fa4d7a1aa83e9de918c (patch) | |
tree | af60ee060e03886ed50f509dd1decf9de1611c06 | |
parent | dd70681e3f6d4b4dedabd20ac2fa4169be2d1c50 (diff) | |
download | xmlgraphics-fop-7085b0c9a97cca2eb7fa1fa4d7a1aa83e9de918c.tar.gz xmlgraphics-fop-7085b0c9a97cca2eb7fa1fa4d7a1aa83e9de918c.zip |
Make the LM clean up on end-of-layout, if possible.
Added clearChildNodes() method to FObj to release the reference to the FO's children.
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@655309 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | src/java/org/apache/fop/fo/FObj.java | 9 | ||||
-rw-r--r-- | src/java/org/apache/fop/layoutmgr/AbstractLayoutManager.java | 39 |
2 files changed, 37 insertions, 11 deletions
diff --git a/src/java/org/apache/fop/fo/FObj.java b/src/java/org/apache/fop/fo/FObj.java index 79b04c4d7..0bbec4d47 100644 --- a/src/java/org/apache/fop/fo/FObj.java +++ b/src/java/org/apache/fop/fo/FObj.java @@ -515,6 +515,13 @@ public abstract class FObj extends FONode implements Constants { return -1; } + /** + * Clears the list of child nodes. + */ + public void clearChildNodes() { + this.firstChild = null; + } + /** @return the "id" property. */ public String getId() { return id; @@ -598,7 +605,7 @@ public abstract class FObj extends FONode implements Constants { return (super.toString() + "[@id=" + this.id + "]"); } - + /** Basic {@link FONodeIterator} implementation */ public class FObjIterator implements FONodeIterator { private static final int F_NONE_ALLOWED = 0; diff --git a/src/java/org/apache/fop/layoutmgr/AbstractLayoutManager.java b/src/java/org/apache/fop/layoutmgr/AbstractLayoutManager.java index ef32bbc75..3f2143bae 100644 --- a/src/java/org/apache/fop/layoutmgr/AbstractLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/AbstractLayoutManager.java @@ -147,15 +147,11 @@ public abstract class AbstractLayoutManager extends AbstractBaseLayoutManager isFinished = fin; } - /** - * {@inheritDoc} - */ + /** {@inheritDoc} */ public void addAreas(PositionIterator posIter, LayoutContext context) { } - /** - * {@inheritDoc} - */ + /** {@inheritDoc} */ public LinkedList getNextKnuthElements(LayoutContext context, int alignment) { log.warn("null implementation of getNextKnuthElements() called!"); @@ -163,9 +159,7 @@ public abstract class AbstractLayoutManager extends AbstractBaseLayoutManager return null; } - /** - * {@inheritDoc} - */ + /** {@inheritDoc} */ public LinkedList getChangedKnuthElements(List oldList, int alignment) { log.warn("null implementation of getChangeKnuthElement() called!"); @@ -390,7 +384,7 @@ public abstract class AbstractLayoutManager extends AbstractBaseLayoutManager /** * Checks to see if the incoming {@link Position} * is the last one for this LM, and if so, calls - * {@link #notifyEndOfLayout()} + * {@link #notifyEndOfLayout()} and cleans up. * * @param pos the {@link Position} to check */ @@ -398,7 +392,32 @@ public abstract class AbstractLayoutManager extends AbstractBaseLayoutManager if (pos != null && pos.getLM() == this && this.isLast(pos)) { + notifyEndOfLayout(); + + /* References to the child LMs are no longer needed + */ + childLMs = null; + curChildLM = null; + childLMiter = null; + + /* markers that qualify have been transferred to the page + */ + markers = null; + + /* References to the FO's children can be released if the + * LM is a descendant of the FlowLM. For static-content + * the FO may still be needed on following pages. + */ + LayoutManager lm = this.parentLM; + while (!(lm instanceof FlowLayoutManager + || lm instanceof PageSequenceLayoutManager)) { + lm = lm.getParent(); + } + if (lm instanceof FlowLayoutManager) { + fobj.clearChildNodes(); + fobjIter = null; + } } } |