From df279ef6027b528405bd16d8efb824ac0e48c27f Mon Sep 17 00:00:00 2001 From: Keiron Liddle Date: Thu, 22 Nov 2001 07:11:41 +0000 Subject: [PATCH] removed message handler git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@194574 13f79535-47bb-0310-9956-ffa450edef68 --- src/org/apache/fop/apps/AWTStarter.java | 3 - src/org/apache/fop/apps/Fop.java | 6 +- src/org/apache/fop/apps/InputHandler.java | 3 +- src/org/apache/fop/apps/Options.java | 19 +- src/org/apache/fop/apps/PrintStarter.java | 4 +- .../fop/configuration/Configuration.java | 25 +- .../configuration/ConfigurationParser.java | 15 +- .../configuration/ConfigurationReader.java | 5 +- src/org/apache/fop/datatypes/AutoLength.java | 1 - src/org/apache/fop/datatypes/ColorType.java | 11 +- src/org/apache/fop/datatypes/FixedLength.java | 5 +- src/org/apache/fop/datatypes/Length.java | 1 - src/org/apache/fop/datatypes/LengthBase.java | 5 +- src/org/apache/fop/datatypes/LengthRange.java | 6 +- src/org/apache/fop/fo/ColorProfile.java | 20 +- src/org/apache/fop/fo/EnumProperty.java | 5 +- src/org/apache/fop/fo/Property.java | 8 +- src/org/apache/fop/fo/PropertyList.java | 19 +- .../apache/fop/fo/PropertyListBuilder.java | 32 +- src/org/apache/fop/fo/XMLObj.java | 5 + src/org/apache/fop/fo/flow/Character.java | 1 - src/org/apache/fop/fo/flow/Flow.java | 8 +- src/org/apache/fop/fo/flow/Footnote.java | 1 - src/org/apache/fop/fo/flow/FootnoteBody.java | 1 - .../fop/fo/flow/InstreamForeignObject.java | 101 ++++-- src/org/apache/fop/fo/flow/ListItem.java | 1 - src/org/apache/fop/fo/flow/ListItemBody.java | 1 - src/org/apache/fop/fo/flow/ListItemLabel.java | 1 - .../apache/fop/fo/flow/MultiProperties.java | 1 - .../apache/fop/fo/flow/MultiPropertySet.java | 1 - src/org/apache/fop/fo/flow/MultiSwitch.java | 1 - src/org/apache/fop/fo/flow/MultiToggle.java | 1 - .../apache/fop/fo/flow/RetrieveMarker.java | 1 - src/org/apache/fop/fo/flow/StaticContent.java | 9 +- src/org/apache/fop/fo/flow/Table.java | 1 - src/org/apache/fop/fo/flow/TableBody.java | 1 - src/org/apache/fop/fo/flow/TableCell.java | 1 - src/org/apache/fop/fo/flow/TableColumn.java | 1 - src/org/apache/fop/fo/flow/TableFooter.java | 1 - src/org/apache/fop/fo/flow/TableHeader.java | 1 - src/org/apache/fop/fonts/TTFSubSetFile.java | 19 +- src/org/apache/fop/image/EPSImage.java | 5 +- .../apache/fop/image/FopImageConsumer.java | 29 +- src/org/apache/fop/image/SVGImage.java | 5 +- .../apache/fop/image/analyser/SVGReader.java | 6 +- src/org/apache/fop/layout/BlockArea.java | 1 - src/org/apache/fop/layout/FontInfo.java | 4 +- src/org/apache/fop/layout/LineArea.java | 23 +- .../fop/layout/hyphenation/Hyphenator.java | 55 ++-- .../fop/messaging/DefaultMessageListener.java | 34 --- .../apache/fop/messaging/MessageEvent.java | 56 ---- .../apache/fop/messaging/MessageHandler.java | 287 ------------------ .../apache/fop/messaging/MessageListener.java | 25 -- src/org/apache/fop/mif/MIFDocument.java | 3 +- src/org/apache/fop/pdf/FlateFilter.java | 5 +- src/org/apache/fop/pdf/PDFPages.java | 3 +- src/org/apache/fop/pdf/PDFStream.java | 5 +- src/org/apache/fop/pdf/PDFXObject.java | 13 +- .../fop/render/awt/FontMetricsMapper.java | 1 - src/org/apache/fop/render/awt/FontSetup.java | 3 - src/org/apache/fop/render/mif/FontSetup.java | 2 - src/org/apache/fop/render/pdf/FontSetup.java | 2 +- .../apache/fop/render/pdf/fonts/LazyFont.java | 7 +- .../fop/render/pdf/fonts/MultiByteFont.java | 5 +- src/org/apache/fop/viewer/Command.java | 7 +- src/org/apache/fop/viewer/GoToPageDialog.java | 6 +- .../apache/fop/viewer/LoadableProperties.java | 7 +- src/org/apache/fop/viewer/PreviewDialog.java | 16 +- .../fop/viewer/SecureResourceBundle.java | 7 +- src/org/apache/fop/viewer/UserMessage.java | 44 +-- 70 files changed, 311 insertions(+), 707 deletions(-) delete mode 100644 src/org/apache/fop/messaging/DefaultMessageListener.java delete mode 100644 src/org/apache/fop/messaging/MessageEvent.java delete mode 100644 src/org/apache/fop/messaging/MessageHandler.java delete mode 100644 src/org/apache/fop/messaging/MessageListener.java diff --git a/src/org/apache/fop/apps/AWTStarter.java b/src/org/apache/fop/apps/AWTStarter.java index caba1f42b..85fcaa9be 100644 --- a/src/org/apache/fop/apps/AWTStarter.java +++ b/src/org/apache/fop/apps/AWTStarter.java @@ -41,7 +41,6 @@ import java.net.URL; import java.util.*; - /** * initialize AWT previewer */ @@ -162,5 +161,3 @@ public class AWTStarter extends CommandLineStarter { } - - diff --git a/src/org/apache/fop/apps/Fop.java b/src/org/apache/fop/apps/Fop.java index 8cd8d71e7..a3c11a0b3 100644 --- a/src/org/apache/fop/apps/Fop.java +++ b/src/org/apache/fop/apps/Fop.java @@ -7,8 +7,6 @@ package org.apache.fop.apps; -import org.apache.fop.messaging.MessageHandler; - public class Fop { public static void main(String[] args) { CommandLineOptions options = null; @@ -18,12 +16,12 @@ public class Fop { Starter starter = options.getStarter(); starter.run(); } catch (FOPException e) { - MessageHandler.errorln("" + e.getMessage()); + System.err.println("" + e.getMessage()); if (options != null && options.isDebugMode().booleanValue()) { e.printStackTrace(); } } catch (java.io.FileNotFoundException e) { - MessageHandler.errorln("" + e.getMessage()); + System.err.println("" + e.getMessage()); if (options != null && options.isDebugMode().booleanValue()) { e.printStackTrace(); } diff --git a/src/org/apache/fop/apps/InputHandler.java b/src/org/apache/fop/apps/InputHandler.java index c2899ddbe..4bf7e9031 100644 --- a/src/org/apache/fop/apps/InputHandler.java +++ b/src/org/apache/fop/apps/InputHandler.java @@ -16,7 +16,6 @@ import java.net.URL; import java.io.File; // FOP -import org.apache.fop.messaging.MessageHandler; import org.apache.fop.configuration.Configuration; @@ -60,7 +59,7 @@ abstract public class InputHandler { */ protected static XMLReader createParser() throws FOPException { String parserClassName = Driver.getParserClassName(); - MessageHandler.logln("using SAX parser " + parserClassName); + //log.debug("using SAX parser " + parserClassName); try { return (XMLReader)Class.forName(parserClassName).newInstance(); diff --git a/src/org/apache/fop/apps/Options.java b/src/org/apache/fop/apps/Options.java index 9253c32c6..bdccd96c1 100644 --- a/src/org/apache/fop/apps/Options.java +++ b/src/org/apache/fop/apps/Options.java @@ -15,7 +15,6 @@ import java.io.File; import java.io.InputStream; // fop -import org.apache.fop.messaging.MessageHandler; import org.apache.fop.configuration.Configuration; import org.apache.fop.configuration.ConfigurationReader; @@ -44,7 +43,7 @@ public class Options { // initializing option settings void initOptions() { if (Configuration.getBooleanValue("quiet").booleanValue()) { - MessageHandler.setQuiet(true); + //MessageHandler.setQuiet(true); } if (Configuration.getBooleanValue("debugMode").booleanValue()) { errorDump = true; @@ -84,7 +83,7 @@ public class Options { // quiet mode if (clOptions.isQuiet() != null) { - MessageHandler.setQuiet(clOptions.isQuiet().booleanValue()); + //MessageHandler.setQuiet(clOptions.isQuiet().booleanValue()); } // set base directory @@ -97,7 +96,7 @@ public class Options { } catch (Exception e) {} } if (errorDump) { - MessageHandler.logln("base directory: " + baseDir); + //log.debug("base directory: " + baseDir); } } @@ -130,7 +129,7 @@ public class Options { throw new FOPException("can't find default configuration file"); } if (errorDump) { - MessageHandler.logln("reading default configuration file"); + //log.error("reading default configuration file"); } ConfigurationReader reader = new ConfigurationReader(new InputSource(configfile)); @@ -148,7 +147,7 @@ public class Options { public void loadUserconfiguration(File userConfigFile) { // read user configuration file if (userConfigFile != null) { - MessageHandler.logln("reading user configuration file"); + //log.debug("reading user configuration file"); ConfigurationReader reader = new ConfigurationReader(InputHandler.fileInputSource(userConfigFile)); if (errorDump) { @@ -157,10 +156,10 @@ public class Options { try { reader.start(); } catch (org.apache.fop.apps.FOPException error) { - MessageHandler.errorln("Could not load user configuration file " - + userConfigFile + " - error: " - + error.getMessage()); - MessageHandler.errorln("using default values"); + //log.error("Could not load user configuration file " + // + userConfigFile + " - error: " + // + error.getMessage()); + //log.error("using default values"); if (errorDump) { reader.dumpError(error); } diff --git a/src/org/apache/fop/apps/PrintStarter.java b/src/org/apache/fop/apps/PrintStarter.java index f5eac2776..21b160e1b 100644 --- a/src/org/apache/fop/apps/PrintStarter.java +++ b/src/org/apache/fop/apps/PrintStarter.java @@ -33,8 +33,6 @@ import java.util.Vector; import org.apache.fop.render.awt.AWTRenderer; import org.apache.fop.layout.AreaTree; import org.apache.fop.layout.Page; -import org.apache.fop.messaging.MessageHandler; - /** * This class prints a xsl-fo dokument without interaction. @@ -60,7 +58,7 @@ public class PrintStarter extends CommandLineStarter { } String version = Version.getVersion(); - MessageHandler.errorln(version); + //log.debug(version); XMLReader parser = inputHandler.getParser(); diff --git a/src/org/apache/fop/configuration/Configuration.java b/src/org/apache/fop/configuration/Configuration.java index 298a10e2a..002e7952b 100644 --- a/src/org/apache/fop/configuration/Configuration.java +++ b/src/org/apache/fop/configuration/Configuration.java @@ -10,7 +10,6 @@ package org.apache.fop.configuration; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; -import org.apache.fop.messaging.MessageHandler; /** * a configuration class for all general configuration aspects except those @@ -254,7 +253,7 @@ public class Configuration { awtConfiguration = config; break; default: - MessageHandler.errorln("Can't setup configuration. Unknown configuration role/target"); + //log.error("Can't setup configuration. Unknown configuration role/target"); } } @@ -278,9 +277,9 @@ public class Configuration { break; default: standardConfiguration.put(key, value); - MessageHandler.errorln("Unknown role for new configuration entry. " - + "Putting key:" + key + " - value:" - + value + " into standard configuration."); + //log.error("Unknown role for new configuration entry. " + // + "Putting key:" + key + " - value:" + // + value + " into standard configuration."); } } @@ -312,31 +311,29 @@ public class Configuration { standardConfiguration, pdfConfiguration, awtConfiguration }; for (int i = 0; i < configs.length; i++) { - MessageHandler.logln("----------------------"); + //log.debug("----------------------"); configuration = configs[i]; Iterator iterator = configuration.keySet().iterator(); while (iterator.hasNext()) { key = (String)iterator.next(); - MessageHandler.logln("key: " + key); + //log.debug("key: " + key); value = configuration.get(key); if (value instanceof String) { - MessageHandler.logln(" value: " + value); + //log.debug(" value: " + value); } else if (value instanceof ArrayList) { list = (ArrayList)value; - MessageHandler.log(" values: "); + //log.debug(" values: "); for (int count = 0; count < list.size(); count++) { - MessageHandler.log(list.get(count) + " - "); + //log.debug(list.get(count) + " - "); } - MessageHandler.logln(""); } else if (value instanceof HashMap) { map = (HashMap)value; Iterator iter = map.keySet().iterator(); - MessageHandler.log(" values: "); + //log.debug(" values: "); while (iter.hasNext()) { tmp = (String)iter.next(); - MessageHandler.log(" " + tmp + ":" + map.get(tmp)); + //log.debug(" " + tmp + ":" + map.get(tmp)); } - MessageHandler.logln(""); } } } diff --git a/src/org/apache/fop/configuration/ConfigurationParser.java b/src/org/apache/fop/configuration/ConfigurationParser.java index f314da14a..39039dd89 100644 --- a/src/org/apache/fop/configuration/ConfigurationParser.java +++ b/src/org/apache/fop/configuration/ConfigurationParser.java @@ -17,9 +17,6 @@ import org.xml.sax.Locator; import java.util.HashMap; import java.util.ArrayList; -// fop -import org.apache.fop.messaging.MessageHandler; - /** * SAX2 Handler which retrieves the configuration information and stores them in Configuration. * Normally this class doesn't need to be accessed directly. @@ -144,8 +141,8 @@ public class ConfigurationParser extends DefaultHandler { fontTriplets.add(fontTriplet); } else { // to make sure that user knows about false tag - MessageHandler.errorln("Unknown tag in configuration file: " - + localName); + //log.error("Unknown tag in configuration file: " + // + localName); } } // end startElement @@ -251,10 +248,10 @@ public class ConfigurationParser extends DefaultHandler { if (activeConfiguration != null) { activeConfiguration.put(key, value); } else { - MessageHandler.errorln("Unknown role >" + role - + "< for new configuration entry. \n" - + "Putting configuration with key:" + key - + " into standard configuration."); + //log.error("Unknown role >" + role + // + "< for new configuration entry. \n" + // + "Putting configuration with key:" + key + // + " into standard configuration."); } } diff --git a/src/org/apache/fop/configuration/ConfigurationReader.java b/src/org/apache/fop/configuration/ConfigurationReader.java index 3f982407f..2f7d882a4 100644 --- a/src/org/apache/fop/configuration/ConfigurationReader.java +++ b/src/org/apache/fop/configuration/ConfigurationReader.java @@ -16,7 +16,6 @@ import org.xml.sax.InputSource; // fop import org.apache.fop.apps.Driver; -import org.apache.fop.messaging.MessageHandler; import org.apache.fop.apps.FOPException; import org.apache.fop.configuration.Configuration; @@ -94,8 +93,8 @@ public class ConfigurationReader { public static XMLReader createParser() throws FOPException { String parserClassName = Driver.getParserClassName(); if (errorDump) { - MessageHandler.logln("configuration reader using SAX parser " - + parserClassName); + //log.debug("configuration reader using SAX parser " + // + parserClassName); } try { diff --git a/src/org/apache/fop/datatypes/AutoLength.java b/src/org/apache/fop/datatypes/AutoLength.java index 77bf78271..a51b283ad 100644 --- a/src/org/apache/fop/datatypes/AutoLength.java +++ b/src/org/apache/fop/datatypes/AutoLength.java @@ -8,7 +8,6 @@ package org.apache.fop.datatypes; import org.apache.fop.fo.Property; -import org.apache.fop.messaging.MessageHandler; /** * a length quantity in XSL which is specified as "auto" diff --git a/src/org/apache/fop/datatypes/ColorType.java b/src/org/apache/fop/datatypes/ColorType.java index fcbe4f49d..c44ba60df 100644 --- a/src/org/apache/fop/datatypes/ColorType.java +++ b/src/org/apache/fop/datatypes/ColorType.java @@ -8,7 +8,6 @@ package org.apache.fop.datatypes; import java.util.*; -import org.apache.fop.messaging.MessageHandler; /** * a colour quantity in XSL @@ -68,13 +67,13 @@ public class ColorType { this.red = 0; this.green = 0; this.blue = 0; - MessageHandler.errorln("unknown colour format. Must be #RGB or #RRGGBB"); + //log.error("unknown colour format. Must be #RGB or #RRGGBB"); } } catch (Exception e) { this.red = 0; this.green = 0; this.blue = 0; - MessageHandler.errorln("unknown colour format. Must be #RGB or #RRGGBB"); + //log.error("unknown colour format. Must be #RGB or #RRGGBB"); } } else if (value.startsWith("rgb(")) { int poss = value.indexOf("("); @@ -117,7 +116,7 @@ public class ColorType { this.red = 0; this.green = 0; this.blue = 0; - MessageHandler.errorln("unknown colour format. Must be #RGB or #RRGGBB"); + //log.error("unknown colour format. Must be #RGB or #RRGGBB"); } } } else if (value.startsWith("url(")) { @@ -143,8 +142,8 @@ public class ColorType { this.red = 0; this.green = 0; this.blue = 0; - MessageHandler.errorln("unknown colour name: " - + value); + //log.error("unknown colour name: " + // + value); } } } diff --git a/src/org/apache/fop/datatypes/FixedLength.java b/src/org/apache/fop/datatypes/FixedLength.java index f425040bb..bfce0c018 100644 --- a/src/org/apache/fop/datatypes/FixedLength.java +++ b/src/org/apache/fop/datatypes/FixedLength.java @@ -9,7 +9,6 @@ package org.apache.fop.datatypes; import org.apache.fop.fo.Property; import org.apache.fop.fo.expr.Numeric; -import org.apache.fop.messaging.MessageHandler; /** * a length quantity in XSL @@ -64,8 +63,8 @@ public class FixedLength extends Length { dvalue = dvalue * assumed_resolution; else { dvalue = 0; - MessageHandler.errorln("unknown length unit '" + unit - + "'"); + //log.error("unknown length unit '" + unit + // + "'"); } setComputedValue((int)(dvalue * 1000)); } diff --git a/src/org/apache/fop/datatypes/Length.java b/src/org/apache/fop/datatypes/Length.java index 050de80e7..410fc65d5 100644 --- a/src/org/apache/fop/datatypes/Length.java +++ b/src/org/apache/fop/datatypes/Length.java @@ -9,7 +9,6 @@ package org.apache.fop.datatypes; import org.apache.fop.fo.expr.Numeric; import org.apache.fop.fo.Property; -import org.apache.fop.messaging.MessageHandler; /** * a length quantity in XSL diff --git a/src/org/apache/fop/datatypes/LengthBase.java b/src/org/apache/fop/datatypes/LengthBase.java index 31eee8802..c2d1d2cdc 100644 --- a/src/org/apache/fop/datatypes/LengthBase.java +++ b/src/org/apache/fop/datatypes/LengthBase.java @@ -10,7 +10,6 @@ package org.apache.fop.datatypes; import org.apache.fop.fo.FObj; import org.apache.fop.fo.FONode; import org.apache.fop.fo.PropertyList; -import org.apache.fop.messaging.MessageHandler; public class LengthBase implements PercentBase { // Standard kinds of percent-based length @@ -83,10 +82,10 @@ public class LengthBase implements PercentBase { return 0; } case CUSTOM_BASE: - MessageHandler.errorln("!!! LengthBase.getBaseLength() called on CUSTOM_BASE type !!!"); + //log.debug("!!! LengthBase.getBaseLength() called on CUSTOM_BASE type !!!"); return 0; default: - MessageHandler.errorln("Unknown base type for LengthBase."); + //log.error("Unknown base type for LengthBase."); return 0; } } diff --git a/src/org/apache/fop/datatypes/LengthRange.java b/src/org/apache/fop/datatypes/LengthRange.java index a15002423..158ab9c20 100644 --- a/src/org/apache/fop/datatypes/LengthRange.java +++ b/src/org/apache/fop/datatypes/LengthRange.java @@ -101,7 +101,7 @@ public class LengthRange implements CompoundDatatype { * // if minimum is explicit, force max to min * if ((bfSet&MAXSET)!=0) { * // Warning: min>max, resetting max to min - * MessageHandler.errorln("forcing max to min in LengthRange"); + * log.error("forcing max to min in LengthRange"); * } * maximum = minimum ; * } @@ -114,7 +114,7 @@ public class LengthRange implements CompoundDatatype { * if ((bfSet&OPTSET)!=0) { * if ((bfSet&MAXSET)!=0) { * // Warning: opt > max, resetting opt to max - * MessageHandler.errorln("forcing opt to max in LengthRange"); + * log.error("forcing opt to max in LengthRange"); * optimum = maximum ; * } * else { @@ -130,7 +130,7 @@ public class LengthRange implements CompoundDatatype { * if ((bfSet&MINSET)!=0) { * // if minimum is explicit, force opt to min * if ((bfSet&OPTSET)!=0) { - * MessageHandler.errorln("forcing opt to min in LengthRange"); + * log.error("forcing opt to min in LengthRange"); * } * optimum = minimum ; * } diff --git a/src/org/apache/fop/fo/ColorProfile.java b/src/org/apache/fop/fo/ColorProfile.java index ef8546384..012361d07 100644 --- a/src/org/apache/fop/fo/ColorProfile.java +++ b/src/org/apache/fop/fo/ColorProfile.java @@ -10,6 +10,12 @@ package org.apache.fop.fo; // FOP import org.apache.fop.datatypes.ColorType; +import java.awt.color.ICC_Profile; +import java.awt.color.ICC_ColorSpace; +import java.net.URL; +import java.io.IOException; +import java.io.InputStream; + /** * The fo:color-profile formatting object. * This loads the color profile when needed and resolves a requested color. @@ -18,6 +24,7 @@ public class ColorProfile extends FObj { int intent; String src; String profileName; + ICC_ColorSpace colorSpace = null; protected ColorProfile(FONode parent) { super(parent); @@ -43,6 +50,8 @@ public class ColorProfile extends FObj { * or the value is not found. */ public ColorType getColor(int[] colorVals, int defR, int defG, int defB) { + // float[] rgbvals = colorSpace.toRGB(colorVals); + // return new ColorType(rgbvals); return null; } @@ -50,6 +59,15 @@ public class ColorProfile extends FObj { * Load the color profile. */ private void load() { - + try { + URL url = new URL(src); + InputStream is = url.openStream(); + ICC_Profile iccProfile = ICC_Profile.getInstance(is); + colorSpace = new ICC_ColorSpace(iccProfile); + } catch(IOException ioe) { + log.error("Could not read Color Profile src", ioe); + } catch(IllegalArgumentException iae) { + log.error("Color Profile src not an ICC Profile", iae); + } } } diff --git a/src/org/apache/fop/fo/EnumProperty.java b/src/org/apache/fop/fo/EnumProperty.java index 1227aad5e..08e9e2e01 100644 --- a/src/org/apache/fop/fo/EnumProperty.java +++ b/src/org/apache/fop/fo/EnumProperty.java @@ -8,7 +8,6 @@ package org.apache.fop.fo; import org.apache.fop.apps.FOPException; -import org.apache.fop.messaging.MessageHandler; public class EnumProperty extends Property { @@ -23,8 +22,8 @@ public class EnumProperty extends Property { * Called by subclass if no match found. */ public Property checkEnumValues(String value) { - MessageHandler.errorln("Unknown enumerated value for property '" - + getPropName() + "': " + value); + //log.error("Unknown enumerated value for property '" + // + getPropName() + "': " + value); return null; } diff --git a/src/org/apache/fop/fo/Property.java b/src/org/apache/fop/fo/Property.java index 7aa9745ac..12fca1c19 100644 --- a/src/org/apache/fop/fo/Property.java +++ b/src/org/apache/fop/fo/Property.java @@ -132,7 +132,7 @@ public class Property { return setSubprop(baseProp, partName, p); } } else { - //MessageHandler.errorln("compound property component " + //log.error("compound property component " // + partName + " unknown."); } return baseProp; @@ -223,10 +223,10 @@ public class Property { } } catch (FOPException e) { - //MessageHandler.errorln("convertShorthandProperty caught FOPException " + //log.error("convertShorthandProperty caught FOPException " // + e); } catch (org.apache.fop.fo.expr.PropertyException propEx) { - //MessageHandler.errorln("convertShorthandProperty caught PropertyException " + //log.error("convertShorthandProperty caught PropertyException " // + propEx); } if (pret != null) { @@ -332,7 +332,7 @@ public class Property { return make(propertyList, specVal, propertyList.getParentFObj()); } catch (FOPException e) { - //MessageHandler.errorln("Error computing property value for " + //log.error("Error computing property value for " // + propName + " from " // + specVal); return null; diff --git a/src/org/apache/fop/fo/PropertyList.java b/src/org/apache/fop/fo/PropertyList.java index cb8d89d81..c99259236 100644 --- a/src/org/apache/fop/fo/PropertyList.java +++ b/src/org/apache/fop/fo/PropertyList.java @@ -8,7 +8,6 @@ package org.apache.fop.fo; import java.util.HashMap; -import org.apache.fop.messaging.MessageHandler; import org.apache.fop.fo.properties.WritingMode; import org.apache.fop.apps.FOPException; @@ -160,8 +159,8 @@ public class PropertyList extends HashMap { return builder.makeProperty(this, namespace, element, propertyName); } catch (org.apache.fop.apps.FOPException e) { - MessageHandler.errorln("Exception in getInherited(): property=" - + propertyName + " : " + e); + //log.error("Exception in getInherited(): property=" + // + propertyName + " : " + e); } } } @@ -233,9 +232,9 @@ public class PropertyList extends HashMap { private Property get(String propertyName, boolean bTryInherit, boolean bTryDefault) { - if (builder == null) - MessageHandler.errorln("OH OH, builder has not been set"); - + if (builder == null) { + //log.error("OH OH, builder has not been set"); + } /* Handle request for one part of a compound property */ int sepchar = propertyName.indexOf('.'); String subpropName = null; @@ -301,8 +300,8 @@ public class PropertyList extends HashMap { p = this.builder.makeProperty(this, namespace, element, propertyName); } catch (FOPException e) { - MessageHandler.errorln("Exception in getNearestSpecified(): property=" - + propertyName + " : " + e); + //log.error("Exception in getNearestSpecified(): property=" + // + propertyName + " : " + e); } } return p; @@ -324,8 +323,8 @@ public class PropertyList extends HashMap { return builder.makeProperty(this, namespace, element, propertyName); } catch (org.apache.fop.apps.FOPException e) { - MessageHandler.errorln("Exception in getFromParent(): property=" - + propertyName + " : " + e); + //log.error("Exception in getFromParent(): property=" + // + propertyName + " : " + e); } } return null; // No builder or exception in makeProperty! diff --git a/src/org/apache/fop/fo/PropertyListBuilder.java b/src/org/apache/fop/fo/PropertyListBuilder.java index f5f11a82d..4079ddf9b 100644 --- a/src/org/apache/fop/fo/PropertyListBuilder.java +++ b/src/org/apache/fop/fo/PropertyListBuilder.java @@ -8,7 +8,6 @@ package org.apache.fop.fo; import org.apache.fop.fo.properties.*; -import org.apache.fop.messaging.MessageHandler; import org.apache.fop.svg.*; import org.apache.fop.datatypes.*; @@ -51,14 +50,14 @@ public class PropertyListBuilder { try { p = propertyMaker.compute(propertyList); } catch (FOPException e) { - MessageHandler.errorln("exception occurred while computing" - + " value of property '" - + propertyName + "': " - + e.getMessage()); + //log.error("exception occurred while computing" + // + " value of property '" + // + propertyName + "': " + // + e.getMessage()); } } else { - MessageHandler.errorln("property " + propertyName - + " ignored"); + //log.error("property " + propertyName + // + " ignored"); } return p; } @@ -72,7 +71,7 @@ public class PropertyListBuilder { if (propertyMaker != null) { b = propertyMaker.isInherited(); } else { - // MessageHandler.errorln("Unknown property " + propertyName); + // log.error("Unknown property " + propertyName); b = true; } return b; @@ -166,12 +165,13 @@ public class PropertyListBuilder { p.put(propName, propVal); } } catch (FOPException e) { /* Do other props. */ - MessageHandler.errorln(e.getMessage()); + //log.error(e.getMessage()); } } else { - if (!attributeName.startsWith("xmlns")) - MessageHandler.errorln("property '" - + attributeName + "' ignored"); + if (!attributeName.startsWith("xmlns")) { + //log.error("property '" + // + attributeName + "' ignored"); + } } } @@ -197,7 +197,7 @@ public class PropertyListBuilder { if (propertyMaker != null) { return propertyMaker.isCorrespondingForced(propertyList); } else { - MessageHandler.errorln("no Maker for " + propertyName); + //log.error("no Maker for " + propertyName); } return false; } @@ -209,7 +209,7 @@ public class PropertyListBuilder { if (propertyMaker != null) { return propertyMaker.getShorthand(propertyList); } else { - MessageHandler.errorln("no Maker for " + propertyName); + //log.error("no Maker for " + propertyName); return null; } } @@ -226,8 +226,8 @@ public class PropertyListBuilder { if (propertyMaker != null) { p = propertyMaker.make(propertyList); } else { - MessageHandler.errorln("property " + propertyName - + " ignored"); + //log.error("property " + propertyName + // + " ignored"); } return p; } diff --git a/src/org/apache/fop/fo/XMLObj.java b/src/org/apache/fop/fo/XMLObj.java index c52006d8a..7df3d26c3 100644 --- a/src/org/apache/fop/fo/XMLObj.java +++ b/src/org/apache/fop/fo/XMLObj.java @@ -50,6 +50,11 @@ public abstract class XMLObj extends FONode { public void handleAttrs(Attributes attlist) throws FOPException { attr = attlist; } + + public Document getDocument() { + return doc; + } + public abstract String getNameSpace(); protected static HashMap ns = new HashMap(); diff --git a/src/org/apache/fop/fo/flow/Character.java b/src/org/apache/fop/fo/flow/Character.java index 3bcdf934c..80cce3595 100644 --- a/src/org/apache/fop/fo/flow/Character.java +++ b/src/org/apache/fop/fo/flow/Character.java @@ -41,7 +41,6 @@ public class Character extends FObj { public Character(FONode parent) { super(parent); - this.name = "fo:character"; } public Status layout(Area area) throws FOPException { diff --git a/src/org/apache/fop/fo/flow/Flow.java b/src/org/apache/fop/fo/flow/Flow.java index 56ad56fab..9538f81b7 100644 --- a/src/org/apache/fop/fo/flow/Flow.java +++ b/src/org/apache/fop/fo/flow/Flow.java @@ -54,7 +54,6 @@ public class Flow extends FObj { public Flow(FONode parent) { super(parent); - this.name = getElementName(); } public void handleAttrs(Attributes attlist) throws FOPException { @@ -89,7 +88,7 @@ public class Flow extends FObj { protected void setFlowName(String name) throws FOPException { if (name == null || name.equals("")) { log.warn("A 'flow-name' is required for " - + getElementName() + + getName() + ". This constraint will be enforced in future versions of FOP"); _flowName = "xsl-region-body"; } else { @@ -211,15 +210,10 @@ public class Flow extends FObj { return this.contentWidth; } - protected String getElementName() { - return "fo:flow"; - } - public Status getStatus() { return _status; } - public boolean generatesReferenceAreas() { return true; } diff --git a/src/org/apache/fop/fo/flow/Footnote.java b/src/org/apache/fop/fo/flow/Footnote.java index a9a450a40..4beb198e3 100644 --- a/src/org/apache/fop/fo/flow/Footnote.java +++ b/src/org/apache/fop/fo/flow/Footnote.java @@ -21,7 +21,6 @@ public class Footnote extends FObj { public Footnote(FONode parent) { super(parent); - this.name = "fo:footnote"; } public Status layout(Area area) throws FOPException { diff --git a/src/org/apache/fop/fo/flow/FootnoteBody.java b/src/org/apache/fop/fo/flow/FootnoteBody.java index ac9e4629e..ef560ab45 100644 --- a/src/org/apache/fop/fo/flow/FootnoteBody.java +++ b/src/org/apache/fop/fo/flow/FootnoteBody.java @@ -29,7 +29,6 @@ public class FootnoteBody extends FObj { public FootnoteBody(FONode parent) { super(parent); - this.name = "fo:footnote-body"; } public Status layout(Area area) throws FOPException { diff --git a/src/org/apache/fop/fo/flow/InstreamForeignObject.java b/src/org/apache/fop/fo/flow/InstreamForeignObject.java index 8103c66e5..6c5ee2a30 100644 --- a/src/org/apache/fop/fo/flow/InstreamForeignObject.java +++ b/src/org/apache/fop/fo/flow/InstreamForeignObject.java @@ -10,14 +10,19 @@ package org.apache.fop.fo.flow; // FOP import org.apache.fop.fo.*; import org.apache.fop.fo.properties.*; -import org.apache.fop.layout.*; -import org.apache.fop.layout.inline.*; -import org.apache.fop.layout.BlockArea; +import org.apache.fop.area.inline.InlineArea; +import org.apache.fop.area.inline.Viewport; +import org.apache.fop.area.inline.ForeignObject; import org.apache.fop.layout.FontState; +import org.apache.fop.layout.AccessibilityProps; +import org.apache.fop.layout.AuralProps; +import org.apache.fop.layout.BorderAndPadding; +import org.apache.fop.layout.BackgroundProps; +import org.apache.fop.layout.MarginInlineProps; +import org.apache.fop.layout.RelativePositionProps; import org.apache.fop.apps.FOPException; -// Java -import java.util.Enumeration; +import org.w3c.dom.Document; public class InstreamForeignObject extends FObj { @@ -37,7 +42,7 @@ public class InstreamForeignObject extends FObj { int startIndent; int endIndent; - ForeignObjectArea areaCurrent; + Viewport areaCurrent; /** * constructs an instream-foreign-object object (called by Maker). @@ -49,13 +54,71 @@ public class InstreamForeignObject extends FObj { super(parent); } + /** + * Get the inline area created by this element. + */ + protected InlineArea getInlineArea() { + if (children == null) { + return areaCurrent; + } + + if (this.children.size() != 1) { + // error + } + FONode fo = (FONode)children.get(0); + if(!(fo instanceof XMLObj)) { + // error + } + XMLObj child = (XMLObj)fo; + + // Common Accessibility Properties + AccessibilityProps mAccProps = propMgr.getAccessibilityProps(); + + // Common Aural Properties + AuralProps mAurProps = propMgr.getAuralProps(); + + // Common Border, Padding, and Background Properties + BorderAndPadding bap = propMgr.getBorderAndPadding(); + BackgroundProps bProps = propMgr.getBackgroundProps(); + + // Common Margin Properties-Inline + MarginInlineProps mProps = propMgr.getMarginInlineProps(); + + // Common Relative Position Properties + RelativePositionProps mRelProps = propMgr.getRelativePositionProps(); + + // viewport size is determined by block-progression-dimension + // and inline-progression-dimension + + // if replaced then use height then ignore block-progression-dimension + //int h = this.properties.get("height").getLength().mvalue(); + + // use line-height then ignore dimension in height direction + int lh = this.properties.get("line-height").getLength().mvalue(); + + int bpd = this.properties.get("block-progression-dimension").getLength().mvalue(); + int ipd = this.properties.get("inline-progression-dimension").getLength().mvalue(); + + // if auto then use the intrinsic size of the content scaled + // to the content-height and content-width + + Document doc = child.getDocument(); + String ns = child.getNameSpace(); + + children = null; + ForeignObject foreign = new ForeignObject(doc, ns); + + areaCurrent = new Viewport(foreign); + return areaCurrent; + } + /** * layout this formatting object. * * @param area the area to layout the object into * * @return the status of the layout - */ + * public Status layout(Area area) throws FOPException { if (this.marker == BREAK_AFTER) { @@ -102,7 +165,7 @@ public class InstreamForeignObject extends FObj { // this.properties.get("text-align"); // this.properties.get("width"); - /* retrieve properties */ + /* retrieve properties * String id = this.properties.get("id").getString(); int align = this.properties.get("text-align").getEnum(); int valign = this.properties.get("vertical-align").getEnum(); @@ -159,7 +222,7 @@ public class InstreamForeignObject extends FObj { if (numChildren > 1) { throw new FOPException("Only one child element is allowed in an instream-foreign-object"); } - /* layout foreign object */ + /* layout foreign object * if (this.children.size() > 0) { FONode fo = (FONode)children.get(0); Status status; @@ -168,7 +231,7 @@ public class InstreamForeignObject extends FObj { return status; } - /* finish off the foreign object area */ + /* finish off the foreign object area * this.areaCurrent.end(); } } @@ -218,29 +281,29 @@ public class InstreamForeignObject extends FObj { /* * endIndent = areaCurrent.getEffectiveWidth() - forcedWidth - * forcedStartOffset; - */ + * } areaCurrent.setStartIndent(startIndent); // areaCurrent.setEndIndent(endIndent); - /* if there is a space-before */ + /* if there is a space-before * if (spaceBefore != 0) { - /* add a display space */ + /* add a display space * // area.addDisplaySpace(spaceBefore); } - /* add the SVG area to the containing area */ + /* add the SVG area to the containing area * // area.addChild(areaCurrent); areaCurrent.setPage(area.getPage()); - /* increase the height of the containing area accordingly */ + /* increase the height of the containing area accordingly * // area.increaseHeight(areaCurrent.getEffectiveHeight()); - /* if there is a space-after */ + /* if there is a space-after * if (spaceAfter != 0) { - /* add a display space */ + /* add a display space * // area.addDisplaySpace(spaceAfter); } @@ -261,8 +324,8 @@ public class InstreamForeignObject extends FObj { } areaCurrent = null; - /* return status */ + /* return status * return new Status(Status.OK); } - +*/ } diff --git a/src/org/apache/fop/fo/flow/ListItem.java b/src/org/apache/fop/fo/flow/ListItem.java index 6a0ebbced..349352b1f 100644 --- a/src/org/apache/fop/fo/flow/ListItem.java +++ b/src/org/apache/fop/fo/flow/ListItem.java @@ -34,7 +34,6 @@ public class ListItem extends FObj { public ListItem(FONode parent) { super(parent); - this.name = "fo:list-item"; } public Status layout(Area area) throws FOPException { diff --git a/src/org/apache/fop/fo/flow/ListItemBody.java b/src/org/apache/fop/fo/flow/ListItemBody.java index 3a3daa0c8..0799bc17c 100644 --- a/src/org/apache/fop/fo/flow/ListItemBody.java +++ b/src/org/apache/fop/fo/flow/ListItemBody.java @@ -21,7 +21,6 @@ public class ListItemBody extends FObj { public ListItemBody(FONode parent) { super(parent); - this.name = "fo:list-item-body"; } public Status layout(Area area) throws FOPException { diff --git a/src/org/apache/fop/fo/flow/ListItemLabel.java b/src/org/apache/fop/fo/flow/ListItemLabel.java index 0134117f5..a8490306f 100644 --- a/src/org/apache/fop/fo/flow/ListItemLabel.java +++ b/src/org/apache/fop/fo/flow/ListItemLabel.java @@ -21,7 +21,6 @@ public class ListItemLabel extends FObj { public ListItemLabel(FONode parent) { super(parent); - this.name = "fo:list-item-label"; } public Status layout(Area area) throws FOPException { diff --git a/src/org/apache/fop/fo/flow/MultiProperties.java b/src/org/apache/fop/fo/flow/MultiProperties.java index 6215b1d03..5ee51d855 100644 --- a/src/org/apache/fop/fo/flow/MultiProperties.java +++ b/src/org/apache/fop/fo/flow/MultiProperties.java @@ -20,7 +20,6 @@ public class MultiProperties extends ToBeImplementedElement { public MultiProperties(FONode parent) { super(parent); - this.name = "fo:multi-properties"; } public Status layout(Area area) throws FOPException { diff --git a/src/org/apache/fop/fo/flow/MultiPropertySet.java b/src/org/apache/fop/fo/flow/MultiPropertySet.java index 8fab59adb..be5c24183 100644 --- a/src/org/apache/fop/fo/flow/MultiPropertySet.java +++ b/src/org/apache/fop/fo/flow/MultiPropertySet.java @@ -20,7 +20,6 @@ public class MultiPropertySet extends ToBeImplementedElement { public MultiPropertySet(FONode parent) { super(parent); - this.name = "fo:multi-property-set"; } public Status layout(Area area) throws FOPException { diff --git a/src/org/apache/fop/fo/flow/MultiSwitch.java b/src/org/apache/fop/fo/flow/MultiSwitch.java index 4d2c00551..b378f8003 100644 --- a/src/org/apache/fop/fo/flow/MultiSwitch.java +++ b/src/org/apache/fop/fo/flow/MultiSwitch.java @@ -20,7 +20,6 @@ public class MultiSwitch extends ToBeImplementedElement { public MultiSwitch(FONode parent) { super(parent); - this.name = "fo:multi-switch"; } public Status layout(Area area) throws FOPException { diff --git a/src/org/apache/fop/fo/flow/MultiToggle.java b/src/org/apache/fop/fo/flow/MultiToggle.java index 6eb42b102..6f4f1402f 100644 --- a/src/org/apache/fop/fo/flow/MultiToggle.java +++ b/src/org/apache/fop/fo/flow/MultiToggle.java @@ -20,7 +20,6 @@ public class MultiToggle extends ToBeImplementedElement { public MultiToggle(FONode parent) { super(parent); - this.name = "fo:multi-toggle"; } public Status layout(Area area) throws FOPException { diff --git a/src/org/apache/fop/fo/flow/RetrieveMarker.java b/src/org/apache/fop/fo/flow/RetrieveMarker.java index 859fa18e6..eb3d0497f 100644 --- a/src/org/apache/fop/fo/flow/RetrieveMarker.java +++ b/src/org/apache/fop/fo/flow/RetrieveMarker.java @@ -27,7 +27,6 @@ public class RetrieveMarker extends FObjMixed { public RetrieveMarker(FONode parent) { super(parent); - this.name = "fo:retrieve-marker"; } public void handleAttrs(Attributes attlist) throws FOPException { diff --git a/src/org/apache/fop/fo/flow/StaticContent.java b/src/org/apache/fop/fo/flow/StaticContent.java index f71f09787..df70955b4 100644 --- a/src/org/apache/fop/fo/flow/StaticContent.java +++ b/src/org/apache/fop/fo/flow/StaticContent.java @@ -14,9 +14,6 @@ import org.apache.fop.fo.pagination.*; import org.apache.fop.layout.Area; import org.apache.fop.apps.FOPException; -// Java -import java.util.Enumeration; - public class StaticContent extends Flow { public StaticContent(FONode parent) { @@ -77,15 +74,11 @@ public class StaticContent extends Flow { return new Status(Status.OK); } - protected String getElementName() { - return "fo:static-content"; - } - // flowname checking is more stringient for static content currently protected void setFlowName(String name) throws FOPException { if (name == null || name.equals("")) { throw new FOPException("A 'flow-name' is required for " - + getElementName() + "."); + + getName() + "."); } else { super.setFlowName(name); } diff --git a/src/org/apache/fop/fo/flow/Table.java b/src/org/apache/fop/fo/flow/Table.java index 9e7788d69..6277ed606 100644 --- a/src/org/apache/fop/fo/flow/Table.java +++ b/src/org/apache/fop/fo/flow/Table.java @@ -49,7 +49,6 @@ public class Table extends FObj { public Table(FONode parent) { super(parent); - this.name = "fo:table"; } public Status layout(Area area) throws FOPException { diff --git a/src/org/apache/fop/fo/flow/TableBody.java b/src/org/apache/fop/fo/flow/TableBody.java index d487e1a81..3ee7183cd 100644 --- a/src/org/apache/fop/fo/flow/TableBody.java +++ b/src/org/apache/fop/fo/flow/TableBody.java @@ -32,7 +32,6 @@ public class TableBody extends FObj { public TableBody(FONode parent) { super(parent); - this.name = "fo:table-body"; } public void setColumns(ArrayList columns) { diff --git a/src/org/apache/fop/fo/flow/TableCell.java b/src/org/apache/fop/fo/flow/TableCell.java index 9f99de0f0..03276390f 100644 --- a/src/org/apache/fop/fo/flow/TableCell.java +++ b/src/org/apache/fop/fo/flow/TableCell.java @@ -88,7 +88,6 @@ public class TableCell extends FObj { public TableCell(FONode parent) { super(parent); - this.name = "fo:table-cell"; } public void handleAttrs(Attributes attlist) throws FOPException { diff --git a/src/org/apache/fop/fo/flow/TableColumn.java b/src/org/apache/fop/fo/flow/TableColumn.java index f86c107fa..45817d7e8 100644 --- a/src/org/apache/fop/fo/flow/TableColumn.java +++ b/src/org/apache/fop/fo/flow/TableColumn.java @@ -30,7 +30,6 @@ public class TableColumn extends FObj { public TableColumn(FONode parent) { super(parent); - this.name = "fo:table-column"; } public Length getColumnWidthAsLength() { diff --git a/src/org/apache/fop/fo/flow/TableFooter.java b/src/org/apache/fop/fo/flow/TableFooter.java index 128d8cc13..32b9416a1 100644 --- a/src/org/apache/fop/fo/flow/TableFooter.java +++ b/src/org/apache/fop/fo/flow/TableFooter.java @@ -26,7 +26,6 @@ public class TableFooter extends TableBody { public TableFooter(FONode parent) { super(parent); - this.name = "fo:table-footer"; } } diff --git a/src/org/apache/fop/fo/flow/TableHeader.java b/src/org/apache/fop/fo/flow/TableHeader.java index 703abc31f..49b13abeb 100644 --- a/src/org/apache/fop/fo/flow/TableHeader.java +++ b/src/org/apache/fop/fo/flow/TableHeader.java @@ -18,7 +18,6 @@ public class TableHeader extends TableBody { public TableHeader(FONode parent) { super(parent); - this.name = "fo:table-header"; } } diff --git a/src/org/apache/fop/fonts/TTFSubSetFile.java b/src/org/apache/fop/fonts/TTFSubSetFile.java index 4ecdb7289..e8d3e34cf 100644 --- a/src/org/apache/fop/fonts/TTFSubSetFile.java +++ b/src/org/apache/fop/fonts/TTFSubSetFile.java @@ -10,7 +10,6 @@ import java.io.*; import java.util.Iterator; import java.util.HashMap; import java.util.ArrayList; -import org.apache.fop.messaging.MessageHandler; /** * Reads a TrueType file and generates a subset @@ -462,10 +461,10 @@ public class TTFSubSetFile extends TTFFile { if (newIdx == null) { // This errormessage would look much better // if the fontname was printed to - MessageHandler.error("An embedded font " - + "contains bad glyph data. " - + "Characters might not display " - + "correctly."); + //log.error("An embedded font " + // + "contains bad glyph data. " + // + "Characters might not display " + // + "correctly."); moreComposites = false; continue; } @@ -603,35 +602,35 @@ public class TTFSubSetFile extends TTFFile { createCvt(in); // copy the cvt table } catch (IOException ex) { // Cvt is optional (only required for OpenType (MS) fonts) - MessageHandler.errorln("TrueType warning: " + ex.getMessage()); + //log.error("TrueType warning: " + ex.getMessage()); } try { createFpgm(in); // copy fpgm table } catch (IOException ex) { // Fpgm is optional (only required for OpenType (MS) fonts) - MessageHandler.errorln("TrueType warning: " + ex.getMessage()); + //log.error("TrueType warning: " + ex.getMessage()); } try { createPrep(in); // copy prep table } catch (IOException ex) { // Prep is optional (only required for OpenType (MS) fonts) - MessageHandler.errorln("TrueType warning: " + ex.getMessage()); + //log.error("TrueType warning: " + ex.getMessage()); } try { createLoca(glyphs.size()); // create empty loca table } catch (IOException ex) { // Loca is optional (only required for OpenType (MS) fonts) - MessageHandler.errorln("TrueType warning: " + ex.getMessage()); + //log.error("TrueType warning: " + ex.getMessage()); } try { createGlyf(in, glyphs); } catch (IOException ex) { // Glyf is optional (only required for OpenType (MS) fonts) - MessageHandler.errorln("TrueType warning: " + ex.getMessage()); + //log.error("TrueType warning: " + ex.getMessage()); } pad4(); diff --git a/src/org/apache/fop/image/EPSImage.java b/src/org/apache/fop/image/EPSImage.java index ada6fbfcf..7bcf1e484 100644 --- a/src/org/apache/fop/image/EPSImage.java +++ b/src/org/apache/fop/image/EPSImage.java @@ -86,8 +86,9 @@ public class EPSImage extends AbstractFopImage { } public byte[] getEPSImage() throws FopImageException { - if (epsImage == null) - MessageHandler.errorln("ERROR LOADING EXTERNAL EPS"); + if (epsImage == null) { + //log.error("ERROR LOADING EXTERNAL EPS"); + } return epsImage; } diff --git a/src/org/apache/fop/image/FopImageConsumer.java b/src/org/apache/fop/image/FopImageConsumer.java index 696f1bdd1..79f326daf 100644 --- a/src/org/apache/fop/image/FopImageConsumer.java +++ b/src/org/apache/fop/image/FopImageConsumer.java @@ -12,7 +12,6 @@ package org.apache.fop.image; // Java import java.util.Hashtable; -import org.apache.fop.messaging.MessageHandler; import java.awt.image.*; import java.awt.*; @@ -34,25 +33,25 @@ public class FopImageConsumer implements ImageConsumer { public void imageComplete(int status) { /* - * MessageHandler.error("Status "); + * log.error("Status "); * if (status == ImageConsumer.COMPLETESCANLINES) { - * MessageHandler.errorln("CompleteScanLines"); + * log.error("CompleteScanLines"); * } else if (status == ImageConsumer.IMAGEABORTED) { - * MessageHandler.errorln("ImageAborted"); + * log.error("ImageAborted"); * } else if (status == ImageConsumer.IMAGEERROR) { - * MessageHandler.errorln("ImageError"); + * log.error("ImageError"); * } else if (status == ImageConsumer.RANDOMPIXELORDER) { - * MessageHandler.errorln("RandomPixelOrder"); + * log.error("RandomPixelOrder"); * } else if (status == ImageConsumer.SINGLEFRAME) { - * MessageHandler.errorln("SingleFrame"); + * log.error("SingleFrame"); * } else if (status == ImageConsumer.SINGLEFRAMEDONE) { - * MessageHandler.errorln("SingleFrameDone"); + * log.error("SingleFrameDone"); * } else if (status == ImageConsumer.SINGLEPASS) { - * MessageHandler.errorln("SinglePass"); + * log.error("SinglePass"); * } else if (status == ImageConsumer.STATICIMAGEDONE) { - * MessageHandler.errorln("StaticImageDone"); + * log.error("StaticImageDone"); * } else if (status == ImageConsumer.TOPDOWNLEFTRIGHT) { - * MessageHandler.errorln("TopDownLeftRight"); + * log.error("TopDownLeftRight"); * } */ synchronized (this.imageStatus) { @@ -63,23 +62,23 @@ public class FopImageConsumer implements ImageConsumer { } public void setColorModel(ColorModel model) { - // MessageHandler.errorln("setColorModel: " + model); + // log.error("setColorModel: " + model); this.cm = model; } public void setDimensions(int width, int height) { - // MessageHandler.errorln("setDimension: w=" + width + " h=" + height); + // log.error("setDimension: w=" + width + " h=" + height); this.width = width; this.height = height; } public void setHints(int hintflags) { - // MessageHandler.errorln("setHints: " + hintflags); + // log.error("setHints: " + hintflags); this.hints = hintflags; } public void setProperties(Hashtable props) { - // MessageHandler.errorln("setProperties: " + props); + // log.error("setProperties: " + props); this.properties = props; } diff --git a/src/org/apache/fop/image/SVGImage.java b/src/org/apache/fop/image/SVGImage.java index 34f4a625a..4fd0d1b7b 100644 --- a/src/org/apache/fop/image/SVGImage.java +++ b/src/org/apache/fop/image/SVGImage.java @@ -13,7 +13,6 @@ import org.w3c.dom.svg.SVGDocument; // FOP import org.apache.fop.apps.Driver; -import org.apache.fop.messaging.*; import org.apache.fop.datatypes.ColorSpace; import org.apache.fop.pdf.PDFColor; import org.apache.fop.image.analyser.ImageReader; @@ -56,8 +55,8 @@ public class SVGImage extends AbstractFopImage { new SAXSVGDocumentFactory(SVGImage.getParserName()); doc = factory.createDocument(this.m_href.toExternalForm()); } catch (Exception e) { - MessageHandler.errorln("Could not load external SVG: " - + e.getMessage()); + //log.error("Could not load external SVG: " + // + e.getMessage()); } } diff --git a/src/org/apache/fop/image/analyser/SVGReader.java b/src/org/apache/fop/image/analyser/SVGReader.java index a27080380..96ab9aba3 100644 --- a/src/org/apache/fop/image/analyser/SVGReader.java +++ b/src/org/apache/fop/image/analyser/SVGReader.java @@ -96,12 +96,12 @@ public class SVGReader extends AbstractImageReader { return true; } catch (NoClassDefFoundError ncdfe) { - MessageHandler.errorln("Batik not in class path"); + //log.error("Batik not in class path"); return false; } catch (Exception e) { - MessageHandler.errorln("Could not load external SVG: " + - e.getMessage()); + //log.error("Could not load external SVG: " + + // e.getMessage()); // assuming any exception means this document is not svg // or could not be loaded for some reason return false; diff --git a/src/org/apache/fop/layout/BlockArea.java b/src/org/apache/fop/layout/BlockArea.java index 8eabf175c..c8d4a99a9 100644 --- a/src/org/apache/fop/layout/BlockArea.java +++ b/src/org/apache/fop/layout/BlockArea.java @@ -17,7 +17,6 @@ import org.apache.fop.fo.properties.*; // Java import java.util.Vector; import java.util.Enumeration; -import org.apache.fop.messaging.MessageHandler; /** * This class represents a Block Area. diff --git a/src/org/apache/fop/layout/FontInfo.java b/src/org/apache/fop/layout/FontInfo.java index edfefc1eb..9ef871176 100644 --- a/src/org/apache/fop/layout/FontInfo.java +++ b/src/org/apache/fop/layout/FontInfo.java @@ -57,9 +57,9 @@ public class FontInfo { if (f == null) { throw new FOPException("no default font defined by OutputConverter"); } - //MessageHandler.errorln("defaulted font to any,normal,normal"); + //log.error("defaulted font to any,normal,normal"); } - //MessageHandler.errorln("unknown font " + key + //log.error("unknown font " + key // + " so defaulted font to any"); } diff --git a/src/org/apache/fop/layout/LineArea.java b/src/org/apache/fop/layout/LineArea.java index 97167e472..20c572a72 100644 --- a/src/org/apache/fop/layout/LineArea.java +++ b/src/org/apache/fop/layout/LineArea.java @@ -9,7 +9,6 @@ package org.apache.fop.layout; // fop import org.apache.fop.render.Renderer; -import org.apache.fop.messaging.MessageHandler; import org.apache.fop.layout.inline.*; import org.apache.fop.datatypes.IDNode; import org.apache.fop.fo.properties.WrapOption; @@ -391,8 +390,9 @@ public class LineArea extends Area { wordWidth = charWidth; if ((finalWidth + spaceWidth + wordWidth) > this.getContentWidth()) { - if (overrun) - MessageHandler.log("area contents overflows area"); + if (overrun) { + //log.debug("area contents overflows area"); + } if (this.wrapOption == WrapOption.WRAP) { return i; } @@ -443,7 +443,7 @@ public class LineArea extends Area { (wordStart == start) && (finalWidth == 0)) { - MessageHandler.log("area contents overflows area"); + //log.debug("area contents overflows area"); addSpacedWord(new String(data, wordStart, wordLength - 1), ls, finalWidth + spaceWidth @@ -501,8 +501,9 @@ public class LineArea extends Area { wordWidth = 0; } - if (overrun) - MessageHandler.log("area contents overflows area"); + if (overrun) { + //log.debug("area contents overflows area"); + } return -1; } @@ -619,8 +620,8 @@ public class LineArea extends Area { break; // leader pattern use-content not implemented. case LeaderPattern.USECONTENT: - MessageHandler.errorln("leader-pattern=\"use-content\" not " - + "supported by this version of Fop"); + //log.error("leader-pattern=\"use-content\" not " + // + "supported by this version of Fop"); return; } // adds leader length to length of pending inline areas @@ -821,8 +822,8 @@ public class LineArea extends Area { private InlineArea buildSimpleLeader(char c, int leaderLength) { int width = this.currentFontState.width(currentFontState.mapChar(c)); if (width == 0) { - MessageHandler.errorln("char " + c - + " has width 0. Using width 100 instead."); + //log.error("char " + c + // + " has width 0. Using width 100 instead."); width = 100; } int factor = (int)Math.floor(leaderLength / width); @@ -896,7 +897,7 @@ public class LineArea extends Area { int remainingWidth) { // check whether the language property has been set if (this.hyphProps.language.equalsIgnoreCase("none")) { - MessageHandler.errorln("if property 'hyphenate' is used, a language must be specified"); + //log.error("if property 'hyphenate' is used, a language must be specified"); return wordStart; } diff --git a/src/org/apache/fop/layout/hyphenation/Hyphenator.java b/src/org/apache/fop/layout/hyphenation/Hyphenator.java index 9d70dd72d..20b0ee372 100644 --- a/src/org/apache/fop/layout/hyphenation/Hyphenator.java +++ b/src/org/apache/fop/layout/hyphenation/Hyphenator.java @@ -10,7 +10,6 @@ package org.apache.fop.layout.hyphenation; import java.io.*; import java.util.Hashtable; import org.apache.fop.configuration.*; -import org.apache.fop.messaging.MessageHandler; /** * This class is the main entry point to the hyphenation package. @@ -57,8 +56,8 @@ public class Hyphenator { if (hTree != null) { hyphenTrees.put(key, hTree); } else { - MessageHandler.errorln("Couldn't find hyphenation pattern " - + key); + //log.error("Couldn't find hyphenation pattern " + // + key); } return hTree; } @@ -96,24 +95,24 @@ public class Hyphenator { if (key.length() == 5) { is = getResourceStream(key.substring(0, 2)); if (is != null) { - MessageHandler.errorln("Couldn't find hyphenation pattern " - + key - + "\nusing general language pattern " - + key.substring(0, 2) - + " instead."); + //log.error("Couldn't find hyphenation pattern " + // + key + // + "\nusing general language pattern " + // + key.substring(0, 2) + // + " instead."); } else { if (errorDump) { - MessageHandler.errorln("Couldn't find precompiled " - + "fop hyphenation pattern " - + key + ".hyp"); + //log.error("Couldn't find precompiled " + // + "fop hyphenation pattern " + // + key + ".hyp"); } return null; } } else { if (errorDump) { - MessageHandler.errorln("Couldn't find precompiled " - + "fop hyphenation pattern " - + key + ".hyp"); + //log.error("Couldn't find precompiled " + // + "fop hyphenation pattern " + // + key + ".hyp"); } return null; } @@ -128,7 +127,7 @@ public class Hyphenator { try { ois.close(); } catch (IOException e) { - MessageHandler.errorln("can't close hyphenation object stream"); + //log.error("can't close hyphenation object stream"); } } } @@ -172,8 +171,8 @@ public class Hyphenator { if (hyphenFile.exists()) { hTree = new HyphenationTree(); if (errorDump) { - MessageHandler.errorln("reading " + hyphenDir + key - + ".xml"); + //log.error("reading " + hyphenDir + key + // + ".xml"); } try { hTree.loadPatterns(hyphenFile.getPath()); @@ -184,18 +183,18 @@ public class Hyphenator { return hTree; } catch (HyphenationException ex) { if (errorDump) { - MessageHandler.errorln("Can't load user patterns " - + "from xml file " + hyphenDir - + key + ".xml"); + //log.error("Can't load user patterns " + // + "from xml file " + hyphenDir + // + key + ".xml"); } return null; } } else { if (errorDump) { - MessageHandler.errorln("Tried to load " - + hyphenFile.toString() - + "\nCannot find compiled nor xml file for " - + "hyphenation pattern" + key); + //log.error("Tried to load " + // + hyphenFile.toString() + // + "\nCannot find compiled nor xml file for " + // + "hyphenation pattern" + key); } return null; } @@ -207,8 +206,8 @@ public class Hyphenator { int rightMin) { HyphenationTree hTree = getHyphenationTree(lang, country); if (hTree == null) { - MessageHandler.errorln("Error building hyphenation tree for language " - + lang); + //log.error("Error building hyphenation tree for language " + // + lang); return null; } return hTree.hyphenate(word, leftMin, rightMin); @@ -219,8 +218,8 @@ public class Hyphenator { int leftMin, int rightMin) { HyphenationTree hTree = getHyphenationTree(lang, country); if (hTree == null) { - MessageHandler.errorln("Error building hyphenation tree for language " - + lang); + //log.error("Error building hyphenation tree for language " + // + lang); return null; } return hTree.hyphenate(word, offset, len, leftMin, rightMin); diff --git a/src/org/apache/fop/messaging/DefaultMessageListener.java b/src/org/apache/fop/messaging/DefaultMessageListener.java deleted file mode 100644 index 081bd6032..000000000 --- a/src/org/apache/fop/messaging/DefaultMessageListener.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * $Id$ - * Copyright (C) 2001 The Apache Software Foundation. All rights reserved. - * For details on use and redistribution please refer to the - * LICENSE file included with these sources. - */ - -package org.apache.fop.messaging; - -/** - * A trivial implementation of a MessageListener - * For further explanation - */ -public class DefaultMessageListener implements MessageListener { - - /** - * The method processMessage has to be overwritten to handle the MessageEvents. - * The message type (information or error) is accessible via event.getMessageType(). - */ - - public void processMessage(MessageEvent event) { - switch (event.getMessageType()) { - case MessageEvent.ERROR: - System.err.print("ERROR: " + event.getMessage()); - break; - case MessageEvent.LOG: - System.out.print("LOG: " + event.getMessage()); - break; - default: - System.out.print("Unknown message type: " + event.getMessage()); - } - } - -} diff --git a/src/org/apache/fop/messaging/MessageEvent.java b/src/org/apache/fop/messaging/MessageEvent.java deleted file mode 100644 index 92a742aaa..000000000 --- a/src/org/apache/fop/messaging/MessageEvent.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * $Id$ - * Copyright (C) 2001 The Apache Software Foundation. All rights reserved. - * For details on use and redistribution please refer to the - * LICENSE file included with these sources. - */ - -package org.apache.fop.messaging; - -import java.util.EventObject; - -/** - * a container for the text and the type of a message - * MessageEvents are created by MessageHandler and can be received by any - * MessageListener, which is added to MessageHandler; - */ -public class MessageEvent extends EventObject { - public static final int LOG = 0; - public static final int ERROR = 1; - String message; - int messageType = MessageEvent.LOG; - - public MessageEvent(Object source) { - super(source); - message = (String)source; // MessageHandler.getMessage() - } - - /** - * retrieves the message - * @return String containing the message - * - */ - public String getMessage() { - return message; - } - - /** - * sets the message type - * @param messageType the type of the message as int in the form of MessageEvent.LOG or MessageEvent.ERROR - * - */ - void setMessageType(int messageType) { - this.messageType = messageType; - } - - /** - * returns the type of message as int - * - * @return messageType the type of the message as int in the form of MessageEvent.LOG or MessageEvent.ERROR - */ - public int getMessageType() { - return messageType; - } - -} - diff --git a/src/org/apache/fop/messaging/MessageHandler.java b/src/org/apache/fop/messaging/MessageHandler.java deleted file mode 100644 index b9229f897..000000000 --- a/src/org/apache/fop/messaging/MessageHandler.java +++ /dev/null @@ -1,287 +0,0 @@ -/* - * Copyright (C) 2001 The Apache Software Foundation. All rights reserved. - * For details on use and redistribution please refer to the - * LICENSE file included with these sources." - */ - - -package org.apache.fop.messaging; - -import java.io.*; -import java.util.*; - -import org.apache.log.*; - -/** - * The class MessageHandler contains the static methods log and error which - * should be used for any end user information instead of System.out.print() or - * System.err.print(). The class defines several output methods: - * writing to the screen (default), logging to a file, creating message events and repressing all - * output. If you don't want to change the default behaviour, you should be - * happy with MessageHandler.log(message) and MessageHandler.error(message)
- * The class MessageHandler also supports the setting of an id. If set every message - * has as a prefix an identifying string. That way Fop probably can also be used in - * environments, where more than one Fop instance are running in same JVM.
- * If Fop is embedded in a gui application or for any reasons the existing - * messaging system doesn't meet the programmer's requirements, one can add - * a MessageEvent listener to MessageHandler and handle the incoming messages - * in an appropriate way. See the class DefaultMessageListener, which is a trivial - * implementation of the MessageListener. - * Here is an example how to configure MessageHandler for the DefaultMessageListener (anybody - * can provide his own listener by extending MessageListener
- * - * MessageHandler.setOutputMethod(MessageHandler.EVENT); - * MessageHandler.addListener(new DefaultMessageListener()); - *
- * This examples shows, how to redirect the messages to a log file called fop.log. - * All messages are appended to this file. - * - * MessageHandler.setOutputMethod(MessageHandler.FILE); - * MessageHandler.setLogfileName("\\fop.log",true); - * - */ - -public class MessageHandler { - public static final int SCREEN = 0; - public static final int FILE = 1; - public static final int EVENT = 2; - public static final int NONE = 3; // this should always be the last method - - private static String logfileName = "fop.log"; - private static PrintWriter writer; - private static int outputMethod = SCREEN; - private static boolean fileOpened = false; - private static boolean appendToFile = true; - private static String message = ""; - private static String prefix = ""; - private static Vector listeners = new Vector(); - private static boolean IDisSet = false; - private static boolean quiet = false; - - /** - * helper class to access the message - * @return a string containing the message - */ - - private static String getMessage() { - return message; - } - - /** - * helper class which sets the message - * and adds a prefix which can contain - * the id of the thread which uses this messagehandler - */ - private static void setMessage(String m) { - if (IDisSet) { - message = getID() + ":" + m; - } else { - message = m; - } - } - - // temp workaround - private static Logger logger = null; - - /** - * informs the user of the message - * @param message the message for the user - */ - public static void log(String message) { - if (!quiet) { - if(logger == null) { - logger = Hierarchy.getDefaultHierarchy().getLoggerFor("fop"); - } - setMessage(message); - switch (outputMethod) { - case SCREEN: - logger.debug(getMessage()); - break; - case FILE: - if (fileOpened) { - writer.print(getMessage()); - writer.flush(); - } else { - openFile(); - writer.print(getMessage()); - writer.flush(); - } - break; - case EVENT: - setMessage(message); - Enumeration enum = listeners.elements(); - while (enum.hasMoreElements()) { - ((MessageListener)enum.nextElement()).processMessage(new MessageEvent(getMessage())); - } - break; - case NONE: - // do nothing - break; - default: - logger.debug(message); - } - } - } - - /** - * convenience method which adds a return to the message - * @param message the message for the user - */ - public static void logln(String message) { - log(message); - } - - /** - * error warning for the user - * @param errorMessage contains the warning string - */ - - public static void error(String errorMessage) { - if(logger == null) { - logger = Hierarchy.getDefaultHierarchy().getLoggerFor("fop"); - } - setMessage(errorMessage); - switch (outputMethod) { - case SCREEN: - logger.error(getMessage()); - break; - case FILE: - if (fileOpened) { - writer.print(getMessage()); - writer.flush(); - } else { - openFile(); - writer.print(getMessage()); - writer.flush(); - } - break; - case EVENT: - setMessage(message); - Enumeration enum = listeners.elements(); - while (enum.hasMoreElements()) { - MessageEvent messEv = new MessageEvent(getMessage()); - messEv.setMessageType(MessageEvent.ERROR); - ((MessageListener)enum.nextElement()).processMessage(messEv); - } - break; - case NONE: - // do nothing - break; - default: - logger.error(errorMessage); - } - } - - /** - * convenience method which adds a return to the error message - * @param errorMessage the message for the user - */ - public static void errorln(String errorMessage) { - error(errorMessage); - } - - /** - * adds a MessageListener which listens for MessageEvents - * @param MessageListener the listener to add - */ - public static void addListener(MessageListener listener) { - listeners.addElement(listener); - } - - /** - * removes a MessageListener - * @param MessageListener the listener to remove - */ - public static void removeListener(MessageListener listener) { - listeners.removeElement(listener); - } - - /** - * sets the output method - * @param method the output method to use, allowed values are
- * MessageHandler.SCREEN, MessageHandler.FILE, MessageHandler.EVENT - * MessageHandler.NONE - */ - public static void setOutputMethod(int method) { - if (method > NONE) { - MessageHandler.error("Error: Unknown output method"); - } else { - outputMethod = method; - } - } - - /** - * informs what output method is set - * @return the output method - */ - public static int getOutputMethod() { - return outputMethod; - } - - /** - * sets the logfile name - * @param filename name of the logfile - * @param append if true, the logfile is appended - */ - public static void setLogfileName(String filename, boolean append) { - logfileName = filename; - appendToFile = append; - } - - /** - * returns the logfile name - * @return String containing the logfile name - */ - public static String getLogfileName() { - return logfileName; - } - - /** - * helper file which opens the file for output method FILE - */ - private static void openFile() { - try { - writer = - new PrintWriter(new FileWriter(logfileName, appendToFile), - true); - writer.println("\n=============================================="); - fileOpened = true; - } catch (IOException ioe) { - System.err.println("Error: " + ioe); - } - } - - /** - * if set to true an id string is prefixed to every message - * uses the thread info as an id for the message producer. Should be used if - * more than one instance of Fop is running in the same JVM - * this id becomes a prefix to every message - */ - private static String getID() { - return Thread.currentThread().toString(); - } - - /** - * if set to true an id string is prefixed to every message - * uses the thread info as an id for the message producer. Should be used if - * more than one instance of Fop is running in the same JVM - * this id becomes a prefix to every message - * - * @param id boolean (default is false) - */ - - public static void setID(boolean id) { - IDisSet = id; - } - - /** - * if set to true all normal messages are suppressed. - * error messages are displayed allthesame - * - * @param quietMode boolean (default is false) - */ - public static void setQuiet(boolean quietMode) { - quiet = quietMode; - } - -} diff --git a/src/org/apache/fop/messaging/MessageListener.java b/src/org/apache/fop/messaging/MessageListener.java deleted file mode 100644 index 77340aeda..000000000 --- a/src/org/apache/fop/messaging/MessageListener.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * $Id$ - * Copyright (C) 2001 The Apache Software Foundation. All rights reserved. - * For details on use and redistribution please refer to the - * LICENSE file included with these sources. - */ - -package org.apache.fop.messaging; - -/** - * For situations, where the messages Fop directs to the user have to be handled in some - * special way, the interface MessageListener and the class MessageEvent are provided. - * Embedding Fop into a graphical user interface could be such a scenario.
- * Any MessageListener listens for MessageEvents, which contain the user message and - * also the message type information (progress information or error warning). - * The class DefaultMessageListener shows an trivial implementation of MessageListener. - */ - - -public interface MessageListener { - - void processMessage(MessageEvent event); - -} - diff --git a/src/org/apache/fop/mif/MIFDocument.java b/src/org/apache/fop/mif/MIFDocument.java index ea4a16277..f0a7f618f 100644 --- a/src/org/apache/fop/mif/MIFDocument.java +++ b/src/org/apache/fop/mif/MIFDocument.java @@ -13,7 +13,6 @@ package org.apache.fop.mif; // referenced and I'd rather not do it import org.apache.fop.image.FopImage; -import org.apache.fop.messaging.MessageHandler; import org.apache.fop.layout.LinkSet; import org.apache.fop.datatypes.ColorSpace; @@ -993,7 +992,7 @@ public class MIFDocument { } else if (bookComponent.document.height != height || bookComponent.document.width != width) { - MessageHandler.logln("Warning : FrameMaker doesnt support different page-sizes in a document"); + //log.warn("FrameMaker doesnt support different page-sizes in a document"); } } diff --git a/src/org/apache/fop/pdf/FlateFilter.java b/src/org/apache/fop/pdf/FlateFilter.java index b10aa78f4..f439b9cc0 100644 --- a/src/org/apache/fop/pdf/FlateFilter.java +++ b/src/org/apache/fop/pdf/FlateFilter.java @@ -76,9 +76,8 @@ public class FlateFilter extends PDFFilter { compressedStream.flush(); compressedStream.close(); } catch (IOException e) { - org.apache.fop.messaging.MessageHandler.error("Fatal error: " - + e.getMessage()); - e.printStackTrace(); + //log.error("Fatal error: " + // + e.getMessage(), e); } return outArrayStream.toByteArray(); diff --git a/src/org/apache/fop/pdf/PDFPages.java b/src/org/apache/fop/pdf/PDFPages.java index a2f3c91bb..8054ef836 100644 --- a/src/org/apache/fop/pdf/PDFPages.java +++ b/src/org/apache/fop/pdf/PDFPages.java @@ -9,7 +9,6 @@ package org.apache.fop.pdf; // Java import java.io.PrintWriter; -import org.apache.fop.messaging.MessageHandler; import java.util.ArrayList; /** @@ -72,7 +71,7 @@ public class PDFPages extends PDFObject { */ public void incrementCount() { this.count++; - // MessageHandler.logln("Incrementing count to " + this.getCount()); + // log.debug("Incrementing count to " + this.getCount()); } /** diff --git a/src/org/apache/fop/pdf/PDFStream.java b/src/org/apache/fop/pdf/PDFStream.java index ce0f98fd6..1a268306c 100644 --- a/src/org/apache/fop/pdf/PDFStream.java +++ b/src/org/apache/fop/pdf/PDFStream.java @@ -13,7 +13,6 @@ import java.io.IOException; import java.util.ArrayList; import java.util.Enumeration; import org.apache.fop.configuration.Configuration; -import org.apache.fop.messaging.MessageHandler; /** * class representing a PDF stream. @@ -87,8 +86,8 @@ public class PDFStream extends PDFObject { } else if (filterType.equals("")) { return; } else { - MessageHandler.errorln("Unsupported filter type in stream-filter-list: " - + filterType); + //log.error("Unsupported filter type in stream-filter-list: " + // + filterType); } } diff --git a/src/org/apache/fop/pdf/PDFXObject.java b/src/org/apache/fop/pdf/PDFXObject.java index 989008321..35754b739 100644 --- a/src/org/apache/fop/pdf/PDFXObject.java +++ b/src/org/apache/fop/pdf/PDFXObject.java @@ -12,7 +12,6 @@ package org.apache.fop.pdf; // Java import java.io.IOException; -import org.apache.fop.messaging.MessageHandler; import java.io.OutputStream; // FOP @@ -52,7 +51,7 @@ public class PDFXObject extends PDFObject { isPS = false; this.Xnum = Xnumber; if (img == null) - MessageHandler.errorln("FISH"); + //log.error("FISH"); fopimage = img; this.pdfDoc = pdfdoc; pdfICCStream = null; @@ -71,9 +70,9 @@ public class PDFXObject extends PDFObject { } } } catch (Exception e) { - MessageHandler.errorln("Error while reading image " + - fopimage.getURL() + - ": " + e.getMessage()); + //log.error("Error while reading image " + + // fopimage.getURL() + + // ": " + e.getMessage()); } } @@ -224,8 +223,8 @@ public class PDFXObject extends PDFObject { length += pdfBytes.length; } } catch (FopImageException imgex) { - MessageHandler.errorln("Error in XObject : " - + imgex.getMessage()); + //log.error("Error in XObject : " + // + imgex.getMessage()); } return length; diff --git a/src/org/apache/fop/render/awt/FontMetricsMapper.java b/src/org/apache/fop/render/awt/FontMetricsMapper.java index 2991e85a0..251249bc0 100644 --- a/src/org/apache/fop/render/awt/FontMetricsMapper.java +++ b/src/org/apache/fop/render/awt/FontMetricsMapper.java @@ -8,7 +8,6 @@ package org.apache.fop.render.awt; // FOP -import org.apache.fop.messaging.MessageHandler; import org.apache.fop.layout.FontInfo; import org.apache.fop.layout.FontDescriptor; import org.apache.fop.layout.FontState; diff --git a/src/org/apache/fop/render/awt/FontSetup.java b/src/org/apache/fop/render/awt/FontSetup.java index 90e33f8f6..e0e6d0669 100644 --- a/src/org/apache/fop/render/awt/FontSetup.java +++ b/src/org/apache/fop/render/awt/FontSetup.java @@ -8,7 +8,6 @@ package org.apache.fop.render.awt; // FOP -import org.apache.fop.messaging.MessageHandler; import org.apache.fop.layout.FontInfo; import org.apache.fop.layout.FontDescriptor; @@ -41,8 +40,6 @@ public class FontSetup { FontMetricsMapper metric; int normal, bold, bolditalic, italic; - MessageHandler.logln("setting up fonts"); - /* * available java fonts are: * Serif - bold, normal, italic, bold-italic diff --git a/src/org/apache/fop/render/mif/FontSetup.java b/src/org/apache/fop/render/mif/FontSetup.java index 39c9b32d1..df06dd06a 100644 --- a/src/org/apache/fop/render/mif/FontSetup.java +++ b/src/org/apache/fop/render/mif/FontSetup.java @@ -9,7 +9,6 @@ package org.apache.fop.render.mif; // FOP import org.apache.fop.render.mif.fonts.*; -import org.apache.fop.messaging.MessageHandler; import org.apache.fop.layout.FontInfo; import org.apache.fop.layout.FontDescriptor; import org.apache.fop.mif.MIFDocument; @@ -36,7 +35,6 @@ public class FontSetup { * @param fontInfo the font info object to set up */ public static void setup(FontInfo fontInfo) { - MessageHandler.logln("setting up fonts"); fontInfo.addMetrics("F1", new Helvetica()); fontInfo.addMetrics("F2", new HelveticaOblique()); diff --git a/src/org/apache/fop/render/pdf/FontSetup.java b/src/org/apache/fop/render/pdf/FontSetup.java index 83ea71e8b..f450a5b76 100644 --- a/src/org/apache/fop/render/pdf/FontSetup.java +++ b/src/org/apache/fop/render/pdf/FontSetup.java @@ -176,7 +176,7 @@ public class FontSetup { } } } catch (Exception ex) { - //MessageHandler.error("Failed to read font metrics file " + //log.error("Failed to read font metrics file " // + configFontInfo.getMetricsFile() // + " : " + ex.getMessage()); } diff --git a/src/org/apache/fop/render/pdf/fonts/LazyFont.java b/src/org/apache/fop/render/pdf/fonts/LazyFont.java index 062d03f83..ae453dbfd 100644 --- a/src/org/apache/fop/render/pdf/fonts/LazyFont.java +++ b/src/org/apache/fop/render/pdf/fonts/LazyFont.java @@ -10,7 +10,6 @@ package org.apache.fop.render.pdf.fonts; import org.apache.fop.render.pdf.Font; import org.apache.fop.layout.FontDescriptor; import org.apache.fop.pdf.PDFStream; -import org.apache.fop.messaging.MessageHandler; import java.util.HashMap; import org.apache.fop.render.pdf.FontReader; @@ -44,9 +43,9 @@ public class LazyFont extends Font implements FontDescriptor { } // System.out.println("Metrics " + metricsFileName + " loaded."); } catch (Exception ex) { - MessageHandler.error("Failed to read font metrics file " - + metricsFileName - + " : " + ex.getMessage()); + //log.error("Failed to read font metrics file " + // + metricsFileName + // + " : " + ex.getMessage()); } } } diff --git a/src/org/apache/fop/render/pdf/fonts/MultiByteFont.java b/src/org/apache/fop/render/pdf/fonts/MultiByteFont.java index 4f8769fc2..9cc624fd1 100644 --- a/src/org/apache/fop/render/pdf/fonts/MultiByteFont.java +++ b/src/org/apache/fop/render/pdf/fonts/MultiByteFont.java @@ -18,7 +18,6 @@ import org.apache.fop.pdf.PDFCIDFont; import org.apache.fop.render.pdf.CIDFont; import org.apache.fop.render.pdf.CMap; import org.apache.fop.pdf.PDFTTFStream; -import org.apache.fop.messaging.MessageHandler; import java.io.InputStream; import java.io.IOException; import java.io.FileInputStream; @@ -205,8 +204,8 @@ public class MultiByteFont extends CIDFont implements FontDescriptor { embeddedFont.addFilter("ascii-85"); embeddedFont.setData(subsetFont, subsetFont.length); } catch (IOException ioe) { - MessageHandler.errorln("Failed to embed font [" + i + "] " - + fontName + ": " + ioe.getMessage()); + //log.error("Failed to embed font [" + i + "] " + // + fontName + ": " + ioe.getMessage()); return (PDFStream)null; } diff --git a/src/org/apache/fop/viewer/Command.java b/src/org/apache/fop/viewer/Command.java index d25377a81..452d92c03 100644 --- a/src/org/apache/fop/viewer/Command.java +++ b/src/org/apache/fop/viewer/Command.java @@ -13,7 +13,6 @@ package org.apache.fop.viewer; */ import java.awt.event.ActionEvent; -import org.apache.fop.messaging.MessageHandler; import javax.swing.AbstractAction; import javax.swing.ImageIcon; import java.net.*; @@ -46,7 +45,7 @@ public class Command extends AbstractAction { String path = IMAGE_DIR + iconName + ".gif"; URL url = getClass().getResource(path); if (url == null) { - MessageHandler.errorln("Icon not found: " + path); + //log.error("Icon not found: " + path); } else putValue(SMALL_ICON, new ImageIcon(url)); } @@ -56,11 +55,11 @@ public class Command extends AbstractAction { } public void doit() { - MessageHandler.errorln("Not implemented."); + //log.error("Not implemented."); } public void undoit() { - MessageHandler.errorln("Not implemented."); + //log.error("Not implemented."); } } diff --git a/src/org/apache/fop/viewer/GoToPageDialog.java b/src/org/apache/fop/viewer/GoToPageDialog.java index f5bce3f66..0040d75ea 100644 --- a/src/org/apache/fop/viewer/GoToPageDialog.java +++ b/src/org/apache/fop/viewer/GoToPageDialog.java @@ -18,8 +18,6 @@ import java.awt.*; import javax.swing.*; import java.awt.event.*; -import org.apache.fop.messaging.MessageHandler; - public class GoToPageDialog extends JDialog { JPanel panel1 = new JPanel(); GridBagLayout gridBagLayout1 = new GridBagLayout(); @@ -36,8 +34,8 @@ public class GoToPageDialog extends JDialog { jbInit(); pack(); } catch (Exception ex) { - MessageHandler.errorln("GoToPageDialog: Konstruktor: " - + ex.getMessage()); + //log.error("GoToPageDialog: Konstruktor: " + // + ex.getMessage(), ex); } } diff --git a/src/org/apache/fop/viewer/LoadableProperties.java b/src/org/apache/fop/viewer/LoadableProperties.java index 6e00e00bf..92be4ed9e 100644 --- a/src/org/apache/fop/viewer/LoadableProperties.java +++ b/src/org/apache/fop/viewer/LoadableProperties.java @@ -8,7 +8,6 @@ package org.apache.fop.viewer; import java.io.*; -import org.apache.fop.messaging.MessageHandler; import java.util.*; /** @@ -67,9 +66,9 @@ public class LoadableProperties extends Hashtable { if (index > 0 && str.length() > index) { return true; } else { - MessageHandler.logln(getClass().getName() - + ": load(): invalid line " + str + "." - + " Character '=' missed."); + //log.debug(getClass().getName() + // + ": load(): invalid line " + str + "." + // + " Character '=' missed."); return false; } } diff --git a/src/org/apache/fop/viewer/PreviewDialog.java b/src/org/apache/fop/viewer/PreviewDialog.java index a421777c6..219c25078 100644 --- a/src/org/apache/fop/viewer/PreviewDialog.java +++ b/src/org/apache/fop/viewer/PreviewDialog.java @@ -32,13 +32,11 @@ import javax.swing.*; import org.apache.fop.layout.*; import org.apache.fop.render.awt.*; -import org.apache.fop.messaging.*; /** * Frame and User Interface for Preview */ -public class PreviewDialog extends JFrame implements ProgressListener, - MessageListener { +public class PreviewDialog extends JFrame implements ProgressListener { protected Translator res; @@ -554,11 +552,11 @@ public class PreviewDialog extends JFrame implements ProgressListener, /** - * Called by MessageHandler if an error message or a + * Called by logger if an error message or a * log message is received. */ - public void processMessage(MessageEvent event) { - String error = event.getMessage(); + public void processMessage() { +/* String error = event.getMessage(); String text = processStatus.getText(); FontMetrics fmt = processStatus.getFontMetrics(processStatus.getFont()); @@ -623,16 +621,12 @@ public class PreviewDialog extends JFrame implements ProgressListener, progress(event.getMessage()); } } - } + }*/ } - public void dispose() { System.exit(0); } } // class PreviewDialog - - - diff --git a/src/org/apache/fop/viewer/SecureResourceBundle.java b/src/org/apache/fop/viewer/SecureResourceBundle.java index 6ed849ea9..9e0f44048 100644 --- a/src/org/apache/fop/viewer/SecureResourceBundle.java +++ b/src/org/apache/fop/viewer/SecureResourceBundle.java @@ -8,7 +8,6 @@ package org.apache.fop.viewer; import java.util.*; -import org.apache.fop.messaging.MessageHandler; import java.io.*; @@ -44,7 +43,7 @@ public class SecureResourceBundle extends ResourceBundle try { lookup.load(in); } catch (Exception ex) { - MessageHandler.logln("Abgefangene Exception: " + ex.getMessage()); + //log.error("Abgefangene Exception: " + ex.getMessage()); isSourceFound = false; } } @@ -79,8 +78,8 @@ public class SecureResourceBundle extends ResourceBundle return obj; else { if (isMissingEmphasized) { - MessageHandler.logln(getClass().getName() + ": missing key: " - + key); + //log.debug(getClass().getName() + ": missing key: " + // + key); return getMissedRepresentation(key.toString()); } else return key.toString(); diff --git a/src/org/apache/fop/viewer/UserMessage.java b/src/org/apache/fop/viewer/UserMessage.java index ceb1ce0f9..badf61ef9 100644 --- a/src/org/apache/fop/viewer/UserMessage.java +++ b/src/org/apache/fop/viewer/UserMessage.java @@ -8,7 +8,6 @@ package org.apache.fop.viewer; import java.awt.*; -import org.apache.fop.messaging.MessageHandler; import java.io.*; import java.awt.event.*; import java.util.*; @@ -44,7 +43,7 @@ public class UserMessage { public static void setTranslator(Translator aRes) { res = aRes; if (res == null) { - MessageHandler.logln("UserMessage: setTranslator(null) !"); + //log.debug("UserMessage: setTranslator(null) !"); res = new SecureResourceBundle(null); } @@ -150,22 +149,23 @@ public class UserMessage { * Ersetzt die eventuellen Platzhalter durch die übergebenen Parameter */ static String prepareMessage(String rawText, String[] par) { - MessageHandler.logln("prepareMessage(): " + rawText + ", parameter: " - + par); + //log.debug("prepareMessage(): " + rawText + ", parameter: " + // + par); int index = rawText.indexOf(PARAMETER_TAG); String composedMess = ""; if ((index == -1) && (par == null)) return rawText; if ((index != -1) && (par == null)) { - MessageHandler.logln("Message " + actMessId - + " erwartet Parameter. Aufgerufen ohne Parameter"); + //log.debug("Message " + actMessId + // + " erwartet Parameter. Aufgerufen ohne Parameter"); return rawText; } if ((index == -1) && (par != null)) { - MessageHandler.logln("Message " + actMessId - + " erwartet keine Parameter. Aufgerufen mit folgenden Parametern:"); - for (int i = 0; i < par.length; ++i) - MessageHandler.logln(par[i].toString()); + //log.debug("Message " + actMessId + // + " erwartet keine Parameter. Aufgerufen mit folgenden Parametern:"); + for (int i = 0; i < par.length; ++i) { + //log.debug(par[i].toString()); + } return rawText; } int tagCount = 0; @@ -174,19 +174,19 @@ public class UserMessage { try { composedMess += rawText.substring(0, index) + par[tagCount]; } catch (ArrayIndexOutOfBoundsException ex) { - MessageHandler.logln("Anzahl der übergebenen Parameter zu der Meldung " - + actMessId - + " ist weniger als erwartet."); - ex.printStackTrace(); + //log.error("Anzahl der übergebenen Parameter zu der Meldung " + // + actMessId + // + " ist weniger als erwartet.", ex); return composedMess + rawText; } rawText = rawText.substring(index + PARAMETER_TAG.length()); tagCount++; } composedMess += rawText; - if (tagCount != par.length) - MessageHandler.logln("Die zu der Meldung " + actMessId - + " übergebenen Parameter sind mehr als die Meldung vorsieht."); + if (tagCount != par.length) { + //log.debug("Die zu der Meldung " + actMessId + // + " übergebenen Parameter sind mehr als die Meldung vorsieht."); + } return composedMess; } @@ -291,12 +291,12 @@ public class UserMessage { translatedMes.substring(translatedMes.indexOf(':') + 1); } catch (Exception ex) { - MessageHandler.logln("FALSCHES FORMAT: MESSAGE: " + textID); + //log.debug("FALSCHES FORMAT: MESSAGE: " + textID); } } else { // Message not found - MessageHandler.logln("UserMessage: textID '" + textID - + "' not found. Return " - + "value 'CANCEL' = " + CANCEL); + //log.debug("UserMessage: textID '" + textID + // + "' not found. Return " + // + "value 'CANCEL' = " + CANCEL); // return CANCEL; @@ -334,7 +334,7 @@ public class UserMessage { } else { if (optionTypeIndex == STYLE_NOBUTTON) { // Wird nicht mehr unterstützt - MessageHandler.logln("UserMessage: STYLE_NOBUTTON wird nicht unterstützt"); + //log.debug("UserMessage: STYLE_NOBUTTON wird nicht unterstützt"); return result; } else { result = MessagesDialog.showConfirmDialog(null, preparedMes, -- 2.39.5