aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorarved <arved@unknown>2000-12-18 03:35:20 +0000
committerarved <arved@unknown>2000-12-18 03:35:20 +0000
commit3f3bb854975e6558e3e89f570dfaaf62a00ed6d4 (patch)
treeec907e3b8804d731614dbc4afe2b454ffb3d77fb
parent6a1466c47817d9b40729476e341e2866c5b3bbe3 (diff)
downloadxmlgraphics-fop-3f3bb854975e6558e3e89f570dfaaf62a00ed6d4.tar.gz
xmlgraphics-fop-3f3bb854975e6558e3e89f570dfaaf62a00ed6d4.zip
Supports marker snapshots
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@193893 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--src/org/apache/fop/fo/FONode.java46
1 files changed, 46 insertions, 0 deletions
diff --git a/src/org/apache/fop/fo/FONode.java b/src/org/apache/fop/fo/FONode.java
index e4d22c2f6..87f7e55ce 100644
--- a/src/org/apache/fop/fo/FONode.java
+++ b/src/org/apache/fop/fo/FONode.java
@@ -230,4 +230,50 @@ abstract public class FONode {
return(null);
}
+ /**
+ * At the start of a new span area layout may be partway through a
+ * nested FO, and balancing requires rollback to this known point.
+ * The snapshot records exactly where layout is at.
+ * @param snapshot a Vector of markers (Integer)
+ * @returns the updated Vector of markers (Integers)
+ */
+ public Vector getMarkerSnapshot(Vector snapshot)
+ {
+ snapshot.addElement(new Integer(this.marker));
+
+ // terminate if no kids or child not yet accessed
+ if (this.marker < 0)
+ return snapshot;
+ else if (children.isEmpty())
+ return snapshot;
+ else
+ return ((FONode) children.elementAt(this.marker)).getMarkerSnapshot(snapshot);
+ }
+
+ /**
+ * When balancing occurs, the flow layout() method restarts at the
+ * point specified by the current marker snapshot, which is retrieved
+ * and restored using this method.
+ * @param snapshot the Vector of saved markers (Integers)
+ */
+ public void rollback(Vector snapshot)
+ {
+ this.marker = ((Integer)snapshot.remove(0)).intValue();
+
+ if (this.marker == START)
+ {
+ // make sure all the children of this FO are also reset
+ resetMarker();
+ return;
+ }
+ else if ((this.marker == -1) || children.isEmpty())
+ return;
+
+ int numChildren = this.children.size();
+ for (int i = this.marker + 1; i < numChildren; i++) {
+ FONode fo = (FONode) children.elementAt(i);
+ fo.resetMarker();
+ }
+ ((FONode) children.elementAt(this.marker)).rollback(snapshot);
+ }
}