diff options
author | Jeremias Maerki <jeremias@apache.org> | 2005-10-24 19:48:37 +0000 |
---|---|---|
committer | Jeremias Maerki <jeremias@apache.org> | 2005-10-24 19:48:37 +0000 |
commit | f8463ff055f84f34be1dd3483162daf487563786 (patch) | |
tree | 5839696bbbbb9b187ca62e057406319dd1fbf72d /src | |
parent | 79e11e6891f88e772ea63ffb143babf0d4316cd2 (diff) | |
download | xmlgraphics-fop-f8463ff055f84f34be1dd3483162daf487563786.tar.gz xmlgraphics-fop-f8463ff055f84f34be1dd3483162daf487563786.zip |
Simplified configuration XML as proposed.
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@328145 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src')
-rw-r--r-- | src/java/org/apache/fop/apps/FOUserAgent.java | 33 |
1 files changed, 18 insertions, 15 deletions
diff --git a/src/java/org/apache/fop/apps/FOUserAgent.java b/src/java/org/apache/fop/apps/FOUserAgent.java index b462bc58c..567bd531b 100644 --- a/src/java/org/apache/fop/apps/FOUserAgent.java +++ b/src/java/org/apache/fop/apps/FOUserAgent.java @@ -355,14 +355,16 @@ public class FOUserAgent { log.info("Initializing User Agent Configuration"); if (userConfig.getChild("base", false) != null) { try { - String cfgBaseDir = userConfig.getChild("base") - .getAttribute("url"); - File dir = new File(cfgBaseDir); - if (dir.isDirectory()) { - cfgBaseDir = "file://" + dir.getCanonicalPath() - + System.getProperty("file.separator"); + String cfgBaseDir = userConfig.getChild("base").getValue(null); + if (cfgBaseDir != null) { + File dir = new File(cfgBaseDir); + if (dir.isDirectory()) { + cfgBaseDir = "file://" + dir.getCanonicalPath() + + System.getProperty("file.separator"); + cfgBaseDir = cfgBaseDir.replace( + System.getProperty("file.separator").charAt(0), '/'); + } } - URL cfgBaseURL = new URL(cfgBaseDir); setBaseURL(cfgBaseDir); } catch (MalformedURLException mue) { log.error("Base URL in user config is malformed!"); @@ -374,17 +376,18 @@ public class FOUserAgent { if (userConfig.getChild("pixelToMillimeter", false) != null) { this.px2mm = userConfig.getChild("pixelToMillimeter") .getAttributeAsFloat("value", DEFAULT_PX2MM); - log.info("pixelToMillimeter set to: " + px2mm); + log.info("pixelToMillimeter set to: " + px2mm + " (" + (25.4f / px2mm) + "dpi)"); + } else if (userConfig.getChild("resolution", false) != null) { + this.px2mm = 25.4f / userConfig.getChild("resolution").getValueAsFloat(DEFAULT_PX2MM); + log.info("pixelToMillimeter set to: " + px2mm + " (" + (25.4f / px2mm) + "dpi)"); } - Configuration pageConfig = userConfig.getChild("pagesettings"); - if (pageConfig.getChild("pageHeight", false) != null) { - setPageHeight(pageConfig.getChild("pageHeight") - .getAttribute("value")); + Configuration pageConfig = userConfig.getChild("default-page-settings"); + if (pageConfig.getAttribute("height", null) != null) { + setPageHeight(pageConfig.getAttribute("height")); log.info("Default page-height set to: " + pageHeight); } - if (pageConfig.getChild("pageWidth", false) != null) { - setPageWidth(pageConfig.getChild("pageWidth") - .getAttribute("value")); + if (pageConfig.getAttribute("width", null) != null) { + setPageWidth(pageConfig.getAttribute("width")); log.info("Default page-width set to: " + pageWidth); } } |