From ab987f1da4b78523b33915df0cb3f700baa693ed Mon Sep 17 00:00:00 2001 From: Jeremias Maerki Date: Fri, 7 Nov 2003 21:49:02 +0000 Subject: [PATCH] Tried to fix basic driver tests but didn't manage, yet. Some initialisation code moved from render() to getContentHandler(). git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@196986 13f79535-47bb-0310-9956-ffa450edef68 --- src/java/org/apache/fop/apps/Driver.java | 32 +++++++++++------------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/src/java/org/apache/fop/apps/Driver.java b/src/java/org/apache/fop/apps/Driver.java index 52d05da2a..2115b7c94 100644 --- a/src/java/org/apache/fop/apps/Driver.java +++ b/src/java/org/apache/fop/apps/Driver.java @@ -540,8 +540,23 @@ public class Driver implements LogEnabled { foInputHandler.enableLogging(getLogger()); + /** Document creation is hard-wired for now, but needs to be made + accessible through the API and/or configuration */ + if (currentDocument == null) { + currentDocument = new Document(this); + } + currentDocument.foInputHandler = foInputHandler; + /** LayoutStrategy is hard-wired for now, but needs to be made + accessible through the API and/or configuration */ + if (foInputHandler instanceof FOTreeHandler) { + if (currentDocument.getLayoutStrategy() == null) { + currentDocument.setLayoutStrategy(new LayoutManagerLS(currentDocument)); + } + } + treeBuilder.setUserAgent(getUserAgent()); treeBuilder.setFOInputHandler(foInputHandler); + treeBuilder.foTreeControl = currentDocument; return treeBuilder; } @@ -568,24 +583,7 @@ public class Driver implements LogEnabled { */ public synchronized void render(XMLReader parser, InputSource source) throws FOPException { - if (!isInitialized()) { - initialize(); - } - /** Document creation is hard-wired for now, but needs to be made - accessible through the API and/or configuration */ - if (currentDocument == null) { - currentDocument = new Document(this); - } parser.setContentHandler(getContentHandler()); - currentDocument.foInputHandler = foInputHandler; - /** LayoutStrategy is hard-wired for now, but needs to be made - accessible through the API and/or configuration */ - if (foInputHandler instanceof FOTreeHandler) { - if (currentDocument.getLayoutStrategy() == null) { - currentDocument.setLayoutStrategy(new LayoutManagerLS(currentDocument)); - } - } - treeBuilder.foTreeControl = currentDocument; try { if (foInputHandler instanceof FOTreeHandler) { FOTreeHandler foTreeHandler = (FOTreeHandler)foInputHandler; -- 2.39.5