From 293de4526a65c7fbeda738913f9fadd513c0a210 Mon Sep 17 00:00:00 2001 From: Kelly Campbell Date: Sun, 18 Mar 2001 01:18:22 +0000 Subject: [PATCH] Driver reset patch PR: Obtained from: Submitted by: Art Welch Reviewed by: git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@194164 13f79535-47bb-0310-9956-ffa450edef68 --- src/org/apache/fop/apps/Driver.java | 17 ++++++++++++----- src/org/apache/fop/fo/FOTreeBuilder.java | 12 ++++++++++++ 2 files changed, 24 insertions(+), 5 deletions(-) diff --git a/src/org/apache/fop/apps/Driver.java b/src/org/apache/fop/apps/Driver.java index 3f2dfa86a..3443d4087 100644 --- a/src/org/apache/fop/apps/Driver.java +++ b/src/org/apache/fop/apps/Driver.java @@ -132,7 +132,9 @@ public class Driver { /** create a new Driver */ public Driver() { - reset(); + _stream = null; + _treeBuilder = new FOTreeBuilder(); + setupDefaultMappings(); } public Driver(InputSource source, OutputStream stream) { @@ -142,14 +144,19 @@ public class Driver { } /** - * Resets the Driver so it can be reused. Property and element mappings are reset to defaults. + * Resets the Driver so it can be reused. Property and element + * mappings are reset to defaults. * The output stream is cleared. The renderer is cleared. */ public synchronized void reset() { - _stream = null; - _treeBuilder = new FOTreeBuilder(); - setupDefaultMappings(); + _areaTree = null; + _treeBuilder.reset(); + } + + public boolean hasData() + { + return(_treeBuilder.hasData()); } /** diff --git a/src/org/apache/fop/fo/FOTreeBuilder.java b/src/org/apache/fop/fo/FOTreeBuilder.java index bb4ea2727..01f8f948d 100644 --- a/src/org/apache/fop/fo/FOTreeBuilder.java +++ b/src/org/apache/fop/fo/FOTreeBuilder.java @@ -298,4 +298,16 @@ public class FOTreeBuilder extends DefaultHandler implements TreeBuilder { MessageHandler.logln("formatting FOs into areas"); ((Root) this.rootFObj).format(areaTree); } + + public void reset() + { + currentFObj = null; + rootFObj = null; + } + + public boolean hasData() + { + return (rootFObj != null); + } + } -- 2.39.5