]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
Tried to fix basic driver tests but didn't manage, yet.
authorJeremias Maerki <jeremias@apache.org>
Fri, 7 Nov 2003 21:49:02 +0000 (21:49 +0000)
committerJeremias Maerki <jeremias@apache.org>
Fri, 7 Nov 2003 21:49:02 +0000 (21:49 +0000)
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

index 52d05da2a6eaba88630a4c823bb053fb86c35471..2115b7c94dfc2f09c7126bf7d947513db2591b92 100644 (file)
@@ -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;