aboutsummaryrefslogtreecommitdiffstats
path: root/src/org/apache
diff options
context:
space:
mode:
authorKeiron Liddle <keiron@apache.org>2001-09-17 13:29:53 +0000
committerKeiron Liddle <keiron@apache.org>2001-09-17 13:29:53 +0000
commitab48baaa46dc79d8ed211a4141f4a7fd933fb3c6 (patch)
tree85ffd8461ea641261917b5626d2ff6bae34b9f69 /src/org/apache
parentf3c3996b7b0e01ac0420b4dec2aeef74e1c56236 (diff)
downloadxmlgraphics-fop-ab48baaa46dc79d8ed211a4141f4a7fd933fb3c6.tar.gz
xmlgraphics-fop-ab48baaa46dc79d8ed211a4141f4a7fd933fb3c6.zip
fixed a few awt render problems and a bit more render refactoring
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@194466 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/org/apache')
-rw-r--r--src/org/apache/fop/apps/AWTStarter.java9
-rw-r--r--src/org/apache/fop/apps/CommandLineOptions.java5
-rw-r--r--src/org/apache/fop/apps/Driver.java3
-rw-r--r--src/org/apache/fop/render/AbstractRenderer.java52
-rw-r--r--src/org/apache/fop/render/PrintRenderer.java74
-rw-r--r--src/org/apache/fop/render/awt/AWTRenderer.java43
-rw-r--r--src/org/apache/fop/render/mif/MIFRenderer.java2
-rw-r--r--src/org/apache/fop/render/ps/PSRenderer.java2
-rw-r--r--src/org/apache/fop/render/xml/XMLRenderer.java2
9 files changed, 66 insertions, 126 deletions
diff --git a/src/org/apache/fop/apps/AWTStarter.java b/src/org/apache/fop/apps/AWTStarter.java
index 3c2b06b60..27749d9f8 100644
--- a/src/org/apache/fop/apps/AWTStarter.java
+++ b/src/org/apache/fop/apps/AWTStarter.java
@@ -13,7 +13,6 @@ package org.apache.fop.apps;
* Stanislav Gorkhover: Stanislav.Gorkhover@jCatalog.com
* Modified to use streaming API by Mark Lillywhite, mark-fop@inomial.com
*/
-import org.apache.fop.messaging.MessageHandler;
import org.apache.fop.viewer.*;
import org.apache.fop.render.awt.*;
@@ -46,7 +45,6 @@ import java.util.*;
/**
* initialize AWT previewer
*/
-
public class AWTStarter extends CommandLineStarter {
PreviewDialog frame;
@@ -90,13 +88,12 @@ public class AWTStarter extends CommandLineStarter {
frame = createPreviewDialog(renderer, resource);
renderer.setProgressListener(frame);
renderer.setComponent(frame);
- MessageHandler.setOutputMethod(MessageHandler.EVENT);
- MessageHandler.addListener(frame);
}
public void run() throws FOPException {
Driver driver = new Driver();
+ driver.setLogger(log);
if (errorDump) {
driver.setErrorDump(true);
}
@@ -157,8 +154,8 @@ public class AWTStarter extends CommandLineStarter {
URL url = getClass().getResource(path);
in = url.openStream();
} catch (Exception ex) {
- MessageHandler.logln("Can't find URL to: <" + path + "> "
- + ex.getMessage());
+ log.error("Can't find URL to: <" + path + "> "
+ + ex.getMessage(), ex);
}
return new SecureResourceBundle(in);
}
diff --git a/src/org/apache/fop/apps/CommandLineOptions.java b/src/org/apache/fop/apps/CommandLineOptions.java
index 80d8aa42e..29039d780 100644
--- a/src/org/apache/fop/apps/CommandLineOptions.java
+++ b/src/org/apache/fop/apps/CommandLineOptions.java
@@ -139,11 +139,13 @@ public class CommandLineOptions {
for (int i = 0; i < args.length; i++) {
if (args[i].equals("-d") || args[i].equals("--full-error-dump")) {
errorDump = new Boolean(true);
+ log.setPriority(Priority.DEBUG);
} else if (args[i].equals("-x")
|| args[i].equals("--dump-config")) {
dumpConfiguration = new Boolean(true);
} else if (args[i].equals("-q") || args[i].equals("--quiet")) {
quiet = new Boolean(true);
+ log.setPriority(Priority.ERROR);
} else if (args[i].equals("-c")) {
if ((i + 1 == args.length)
|| (args[i + 1].charAt(0) == '-')) {
@@ -416,6 +418,7 @@ public class CommandLineOptions {
}
throw new FOPException("AWTStarter could not be loaded.", e);
}
+ break;
case PRINT_OUTPUT:
try {
starter = ((Starter)Class.forName("org.apache.fop.apps.PrintStarter").getConstructor(new Class[] {
@@ -430,7 +433,7 @@ public class CommandLineOptions {
throw new FOPException("PrintStarter could not be loaded.",
e);
}
-
+ break;
default:
starter = new CommandLineStarter(this);
}
diff --git a/src/org/apache/fop/apps/Driver.java b/src/org/apache/fop/apps/Driver.java
index 88967f79b..8d11fc8cd 100644
--- a/src/org/apache/fop/apps/Driver.java
+++ b/src/org/apache/fop/apps/Driver.java
@@ -230,6 +230,9 @@ public class Driver implements Loggable {
*/
public synchronized void reset() {
_areaTree = null;
+ _source = null;
+ _stream = null;
+ _reader = null;
_treeBuilder.reset();
}
diff --git a/src/org/apache/fop/render/AbstractRenderer.java b/src/org/apache/fop/render/AbstractRenderer.java
index 677018200..23cf0ec7a 100644
--- a/src/org/apache/fop/render/AbstractRenderer.java
+++ b/src/org/apache/fop/render/AbstractRenderer.java
@@ -64,6 +64,58 @@ public abstract class AbstractRenderer implements Renderer {
protected abstract void doFrame(Area area);
/**
+ * render area container
+ *
+ * @param area the area container to render
+ */
+ public void renderAreaContainer(AreaContainer area) {
+
+ int saveY = this.currentYPosition;
+ int saveX = this.currentAreaContainerXPosition;
+
+ if (area.getPosition() == Position.ABSOLUTE) {
+ // XPosition and YPosition give the content rectangle position
+ this.currentYPosition = area.getYPosition();
+ this.currentAreaContainerXPosition = area.getXPosition();
+ } else if (area.getPosition() == Position.RELATIVE) {
+ this.currentYPosition -= area.getYPosition();
+ this.currentAreaContainerXPosition += area.getXPosition();
+ } else if (area.getPosition() == Position.STATIC) {
+ this.currentYPosition -= area.getPaddingTop()
+ + area.getBorderTopWidth();
+ /*
+ * this.currentAreaContainerXPosition +=
+ * area.getPaddingLeft() + area.getBorderLeftWidth();
+ */
+ }
+
+ this.currentXPosition = this.currentAreaContainerXPosition;
+ doFrame(area);
+
+ Enumeration e = area.getChildren().elements();
+ while (e.hasMoreElements()) {
+ Box b = (Box)e.nextElement();
+ b.render(this);
+ }
+ // Restore previous origin
+ this.currentYPosition = saveY;
+ this.currentAreaContainerXPosition = saveX;
+ if (area.getPosition() == Position.STATIC) {
+ this.currentYPosition -= area.getHeight();
+ }
+
+ /**
+ * **
+ * if (area.getPosition() != Position.STATIC) {
+ * this.currentYPosition = saveY;
+ * this.currentAreaContainerXPosition = saveX;
+ * } else
+ * this.currentYPosition -= area.getHeight();
+ * **
+ */
+ }
+
+ /**
* render block area
*
* @param area the block area to render
diff --git a/src/org/apache/fop/render/PrintRenderer.java b/src/org/apache/fop/render/PrintRenderer.java
index 3a6e355b4..02fe86307 100644
--- a/src/org/apache/fop/render/PrintRenderer.java
+++ b/src/org/apache/fop/render/PrintRenderer.java
@@ -177,58 +177,6 @@ public abstract class PrintRenderer extends AbstractRenderer {
addRect(x, y, w, h, fill, fill);
}
- /**
- * render area container
- *
- * @param area the area container to render
- */
- public void renderAreaContainer(AreaContainer area) {
-
- int saveY = this.currentYPosition;
- int saveX = this.currentAreaContainerXPosition;
-
- if (area.getPosition() == Position.ABSOLUTE) {
- // XPosition and YPosition give the content rectangle position
- this.currentYPosition = area.getYPosition();
- this.currentAreaContainerXPosition = area.getXPosition();
- } else if (area.getPosition() == Position.RELATIVE) {
- this.currentYPosition -= area.getYPosition();
- this.currentAreaContainerXPosition += area.getXPosition();
- } else if (area.getPosition() == Position.STATIC) {
- this.currentYPosition -= area.getPaddingTop()
- + area.getBorderTopWidth();
- /*
- * this.currentAreaContainerXPosition +=
- * area.getPaddingLeft() + area.getBorderLeftWidth();
- */
- }
-
- this.currentXPosition = this.currentAreaContainerXPosition;
- doFrame(area);
-
- Enumeration e = area.getChildren().elements();
- while (e.hasMoreElements()) {
- Box b = (Box)e.nextElement();
- b.render(this);
- }
- // Restore previous origin
- this.currentYPosition = saveY;
- this.currentAreaContainerXPosition = saveX;
- if (area.getPosition() == Position.STATIC) {
- this.currentYPosition -= area.getHeight();
- }
-
- /**
- * **
- * if (area.getPosition() != Position.STATIC) {
- * this.currentYPosition = saveY;
- * this.currentAreaContainerXPosition = saveX;
- * } else
- * this.currentYPosition -= area.getHeight();
- * **
- */
- }
-
public void renderBodyAreaContainer(BodyAreaContainer area) {
int saveY = this.currentYPosition;
int saveX = this.currentAreaContainerXPosition;
@@ -342,28 +290,6 @@ public abstract class PrintRenderer extends AbstractRenderer {
new PDFColor(bp.getBorderColor(BorderAndPadding.BOTTOM)));
}
-
- /**
- * render block area
- *
- * @param area the block area to render
- *
- public void renderBlockArea(BlockArea area) {
- // KLease: Temporary test to fix block positioning
- // Offset ypos by padding and border widths
- this.currentYPosition -= (area.getPaddingTop()
- + area.getBorderTopWidth());
- doFrame(area);
- Enumeration e = area.getChildren().elements();
- while (e.hasMoreElements()) {
- Box b = (Box)e.nextElement();
- b.render(this);
- }
- this.currentYPosition -= (area.getPaddingBottom()
- + area.getBorderBottomWidth());
- }
-*/
-
/**
* render display space
*
diff --git a/src/org/apache/fop/render/awt/AWTRenderer.java b/src/org/apache/fop/render/awt/AWTRenderer.java
index e65eef64e..9a664b5a2 100644
--- a/src/org/apache/fop/render/awt/AWTRenderer.java
+++ b/src/org/apache/fop/render/awt/AWTRenderer.java
@@ -392,49 +392,6 @@ public class AWTRenderer extends AbstractRenderer implements Printable, Pageable
*/
}
- public void renderAreaContainer(AreaContainer area) {
-
- int saveY = this.currentYPosition;
- int saveX = this.currentAreaContainerXPosition;
-
- if (area.getPosition()
- == org.apache.fop.fo.properties.Position.ABSOLUTE) {
- // Y position is computed assuming positive Y axis, adjust
- // for negative postscript one
- this.currentYPosition = area.getYPosition()
- - 2 * area.getPaddingTop()
- - 2 * area.getBorderTopWidth();
- this.currentAreaContainerXPosition = area.getXPosition();
- } else if (area.getPosition()
- == org.apache.fop.fo.properties.Position.RELATIVE) {
- this.currentYPosition -= area.getYPosition();
- this.currentAreaContainerXPosition += area.getXPosition();
- } else if (area.getPosition()
- == org.apache.fop.fo.properties.Position.STATIC) {
- this.currentYPosition -= area.getPaddingTop()
- + area.getBorderTopWidth();
- this.currentAreaContainerXPosition += area.getPaddingLeft()
- + area.getBorderLeftWidth();
- }
-
- doFrame(area);
-
- Enumeration e = area.getChildren().elements();
- while (e.hasMoreElements()) {
- org.apache.fop.layout.Box b =
- (org.apache.fop.layout.Box)e.nextElement();
- b.render(this);
- }
-
- if (area.getPosition()
- != org.apache.fop.fo.properties.Position.STATIC) {
- this.currentYPosition = saveY;
- this.currentAreaContainerXPosition = saveX;
- } else {
- this.currentYPosition -= area.getHeight();
- }
- }
-
public void renderBodyAreaContainer(BodyAreaContainer area) {
renderAreaContainer(area.getBeforeFloatReferenceArea());
renderAreaContainer(area.getFootnoteReferenceArea());
diff --git a/src/org/apache/fop/render/mif/MIFRenderer.java b/src/org/apache/fop/render/mif/MIFRenderer.java
index 47627311f..6dc9724aa 100644
--- a/src/org/apache/fop/render/mif/MIFRenderer.java
+++ b/src/org/apache/fop/render/mif/MIFRenderer.java
@@ -238,7 +238,7 @@ public class MIFRenderer extends AbstractRenderer {
}
- private void doFrame(Area area) {
+ protected void doFrame(Area area) {
int w, h;
int rx = this.currentAreaContainerXPosition;
w = area.getContentWidth();
diff --git a/src/org/apache/fop/render/ps/PSRenderer.java b/src/org/apache/fop/render/ps/PSRenderer.java
index 3f8039545..e3cd72039 100644
--- a/src/org/apache/fop/render/ps/PSRenderer.java
+++ b/src/org/apache/fop/render/ps/PSRenderer.java
@@ -849,7 +849,7 @@ public class PSRenderer extends AbstractRenderer {
write(area.getContentWidth() + " 0 RM");
}
- private void doFrame(Area area) {
+ protected void doFrame(Area area) {
int w, h;
int rx = this.currentAreaContainerXPosition;
w = area.getContentWidth();
diff --git a/src/org/apache/fop/render/xml/XMLRenderer.java b/src/org/apache/fop/render/xml/XMLRenderer.java
index 22223a171..815706091 100644
--- a/src/org/apache/fop/render/xml/XMLRenderer.java
+++ b/src/org/apache/fop/render/xml/XMLRenderer.java
@@ -55,6 +55,8 @@ public class XMLRenderer extends AbstractRenderer {
public XMLRenderer() {}
+ protected void doFrame(Area area) {}
+
/**
* set up renderer options
*/