diff options
author | Glen Mazza <gmazza@apache.org> | 2004-07-18 00:50:08 +0000 |
---|---|---|
committer | Glen Mazza <gmazza@apache.org> | 2004-07-18 00:50:08 +0000 |
commit | 3d598730fe1e84e080ebd43580a6a60cb75bcb7e (patch) | |
tree | 739e843860e75e06eceec477d3e4fe10dd9a31c7 /src/java/org/apache/fop/render | |
parent | db8e56a16f00fd1b43e60b39d164f3215ad3cc33 (diff) | |
download | xmlgraphics-fop-3d598730fe1e84e080ebd43580a6a60cb75bcb7e.tar.gz xmlgraphics-fop-3d598730fe1e84e080ebd43580a6a60cb75bcb7e.zip |
1. New constructor for Driver created, takes FOUserAgent constructor.
Used for both CLI and AWTRenderer. (Thanks to Simon Pepping)
2. Removed Driver(AWTRenderer) constructor.
3. OutputStream validation moved to FOTreeBuilder.
4. Driver.reset() removed, not currently serving a purpose.
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@197797 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/fop/render')
-rw-r--r-- | src/java/org/apache/fop/render/awt/AWTRenderer.java | 7 | ||||
-rw-r--r-- | src/java/org/apache/fop/render/awt/viewer/PreviewDialog.java | 22 |
2 files changed, 15 insertions, 14 deletions
diff --git a/src/java/org/apache/fop/render/awt/AWTRenderer.java b/src/java/org/apache/fop/render/awt/AWTRenderer.java index 975f631f4..6fbb5402b 100644 --- a/src/java/org/apache/fop/render/awt/AWTRenderer.java +++ b/src/java/org/apache/fop/render/awt/AWTRenderer.java @@ -106,7 +106,8 @@ public class AWTRenderer extends AbstractRenderer implements Printable, Pageable public void setUserAgent(FOUserAgent foUserAgent) { super.setUserAgent(foUserAgent); - createPreviewDialog(foUserAgent.getInputHandler()); + userAgent.setRendererOverride(this); // for document regeneration + createPreviewDialog(); } public FOUserAgent getUserAgent() { @@ -180,8 +181,8 @@ public class AWTRenderer extends AbstractRenderer implements Printable, Pageable return 0; } - private PreviewDialog createPreviewDialog(InputHandler handler) { - frame = new PreviewDialog(this, handler); + private PreviewDialog createPreviewDialog() { + frame = new PreviewDialog(userAgent); frame.addWindowListener(new WindowAdapter() { public void windowClosed(WindowEvent we) { System.exit(0); diff --git a/src/java/org/apache/fop/render/awt/viewer/PreviewDialog.java b/src/java/org/apache/fop/render/awt/viewer/PreviewDialog.java index 8a09828f1..ef565573b 100644 --- a/src/java/org/apache/fop/render/awt/viewer/PreviewDialog.java +++ b/src/java/org/apache/fop/render/awt/viewer/PreviewDialog.java @@ -49,8 +49,9 @@ import java.awt.print.PrinterException; //FOP import org.apache.fop.apps.Driver; -import org.apache.fop.apps.InputHandler; +import org.apache.fop.apps.FOUserAgent; import org.apache.fop.apps.FOPException; +import org.apache.fop.fo.Constants; import org.apache.fop.render.awt.AWTRenderer; /** @@ -66,8 +67,8 @@ public class PreviewDialog extends JFrame { protected Translator translator; /** The AWT renderer */ protected AWTRenderer renderer; - /** The InputHandler associated with this window */ - protected InputHandler inputHandler; + /** The FOUserAgent associated with this window */ + protected FOUserAgent foUserAgent; /** The Driver used for refreshing/reloading the view */ protected Driver driver; @@ -83,9 +84,9 @@ public class PreviewDialog extends JFrame { * Creates a new PreviewDialog that uses the given renderer. * @param aRenderer the to use renderer */ - public PreviewDialog(AWTRenderer aRenderer, InputHandler handler) { - renderer = aRenderer; - inputHandler = handler; + public PreviewDialog(FOUserAgent foUserAgent) { + renderer = (AWTRenderer) foUserAgent.getRendererOverride(); + this.foUserAgent = foUserAgent; translator = renderer.getTranslator(); //Commands aka Actions @@ -219,7 +220,7 @@ public class PreviewDialog extends JFrame { } }); // inputHandler must be set to allow reloading - if (inputHandler != null) { + if (foUserAgent.getInputHandler() != null) { menu.add(new Command(translator.getString("Menu.Reload")) { public void doit() { reload(); @@ -384,9 +385,8 @@ public class PreviewDialog extends JFrame { private class Reloader extends Thread { public void run() { if (driver == null) { - driver = new Driver(renderer); - } else { - driver.reset(); + driver = new Driver(foUserAgent); + driver.setRenderer(Constants.RENDER_AWT); } pageLabel.setIcon(null); @@ -395,7 +395,7 @@ public class PreviewDialog extends JFrame { try { setStatus(translator.getString("Status.Build.FO.tree")); - driver.render(inputHandler); + driver.render(foUserAgent.getInputHandler()); setStatus(translator.getString("Status.Show")); } catch (FOPException e) { reportException(e); |