foray-commit Mailing List for FOray (Page 264)
Modular XSL-FO Implementation for Java.
Status: Alpha
Brought to you by:
victormote
You can subscribe to this list here.
| 2006 |
Jan
|
Feb
|
Mar
(139) |
Apr
(98) |
May
(250) |
Jun
(394) |
Jul
(84) |
Aug
(13) |
Sep
(420) |
Oct
(186) |
Nov
(1) |
Dec
(3) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2007 |
Jan
(108) |
Feb
(202) |
Mar
(291) |
Apr
(247) |
May
(374) |
Jun
(227) |
Jul
(231) |
Aug
(60) |
Sep
(31) |
Oct
(45) |
Nov
(18) |
Dec
|
| 2008 |
Jan
(38) |
Feb
(71) |
Mar
(142) |
Apr
|
May
(59) |
Jun
(6) |
Jul
(10) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2009 |
Jan
(12) |
Feb
(4) |
Mar
(88) |
Apr
(121) |
May
(17) |
Jun
(30) |
Jul
|
Aug
(5) |
Sep
|
Oct
(1) |
Nov
|
Dec
|
| 2010 |
Jan
(11) |
Feb
(76) |
Mar
(11) |
Apr
|
May
(11) |
Jun
|
Jul
|
Aug
(44) |
Sep
(14) |
Oct
(7) |
Nov
|
Dec
|
| 2011 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(9) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(10) |
Nov
|
Dec
|
| 2012 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(3) |
Jul
(4) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2016 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(168) |
| 2017 |
Jan
(77) |
Feb
(11) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2018 |
Jan
|
Feb
|
Mar
(1) |
Apr
(6) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2019 |
Jan
|
Feb
(88) |
Mar
(118) |
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2020 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(6) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(141) |
| 2021 |
Jan
(170) |
Feb
(20) |
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
|
Oct
(62) |
Nov
(189) |
Dec
(162) |
| 2022 |
Jan
(201) |
Feb
(118) |
Mar
(8) |
Apr
|
May
(2) |
Jun
(47) |
Jul
(19) |
Aug
(14) |
Sep
(3) |
Oct
|
Nov
(28) |
Dec
(235) |
| 2023 |
Jan
(112) |
Feb
(23) |
Mar
(2) |
Apr
(2) |
May
|
Jun
(1) |
Jul
|
Aug
(70) |
Sep
(92) |
Oct
(20) |
Nov
(1) |
Dec
(1) |
| 2024 |
Jan
|
Feb
|
Mar
(1) |
Apr
(1) |
May
(14) |
Jun
(11) |
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2025 |
Jan
(10) |
Feb
(29) |
Mar
|
Apr
(162) |
May
(245) |
Jun
(83) |
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
|
|
From: <vic...@us...> - 2006-05-26 22:18:15
|
Revision: 7285 Author: victormote Date: 2006-05-26 15:18:04 -0700 (Fri, 26 May 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=7285&view=rev Log Message: ----------- Move some of the FOray-specific bootstrapping logic out of FOraySession and into FOraySpecific. Modified Paths: -------------- trunk/foray/foray-app/src/java/org/foray/app/CommandLineStarter.java trunk/foray/foray-app/src/java/org/foray/app/FOraySession.java trunk/foray/foray-app/src/java/org/foray/app/FOraySpecific.java Modified: trunk/foray/foray-app/src/java/org/foray/app/CommandLineStarter.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/app/CommandLineStarter.java 2006-05-26 22:15:02 UTC (rev 7284) +++ trunk/foray/foray-app/src/java/org/foray/app/CommandLineStarter.java 2006-05-26 22:18:04 UTC (rev 7285) @@ -97,7 +97,7 @@ sessionConfig, graphicServer, textServer); AreaTreeFactory areaTreeFactory = FOraySpecific.makeAreaTreeFactory( logger, textServer); - LayoutFactory layoutFactory = null; + LayoutFactory layoutFactory = FOraySpecific.makeLayoutFactory(logger); FOraySession session = new FOraySession(logger, sessionConfig, fontServer, textServer, graphicServer, foTreeServer, areaTreeFactory, layoutFactory); Modified: trunk/foray/foray-app/src/java/org/foray/app/FOraySession.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/app/FOraySession.java 2006-05-26 22:15:02 UTC (rev 7284) +++ trunk/foray/foray-app/src/java/org/foray/app/FOraySession.java 2006-05-26 22:18:04 UTC (rev 7285) @@ -27,7 +27,6 @@ import org.foray.core.Application; import org.foray.core.FOrayException; import org.foray.core.SessionConfig; -import org.foray.pioneer.PioneerFactory; import org.axsl.areaW.AreaTreeFactory; import org.axsl.foR.FOTreeFactory; @@ -163,8 +162,12 @@ } this.areaTreeFactory = areaTreeFactory; + /* Validate LayoutFactory. */ + if (layoutFactory == null) { + throw new FOrayException("LayoutFactory required for " + + "FOraySession."); + } this.layoutFactory = layoutFactory; - setupLayoutFactory(); } public Log getLogger() { @@ -215,16 +218,6 @@ return this.textServer; } - /** - * Sets up a LayoutFactory if there is not one already. - */ - private void setupLayoutFactory() { - if (this.layoutFactory != null) { - return; - } - this.layoutFactory = new PioneerFactory(this.getLogger()); - } - public GraphicServer getGraphicServer() { return this.graphicServer; } Modified: trunk/foray/foray-app/src/java/org/foray/app/FOraySpecific.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/app/FOraySpecific.java 2006-05-26 22:15:02 UTC (rev 7284) +++ trunk/foray/foray-app/src/java/org/foray/app/FOraySpecific.java 2006-05-26 22:18:04 UTC (rev 7285) @@ -32,6 +32,7 @@ import org.foray.font.FOrayFontServer; import org.foray.fotree.FOrayFOTreeServer; import org.foray.graphic.FOrayGraphicServer; +import org.foray.pioneer.PioneerFactory; import org.axsl.areaW.AreaTreeFactory; import org.axsl.foR.FOTreeFactory; @@ -126,8 +127,9 @@ return new FOrayAreaTreeFactory(logger, textServer); } - public static LayoutFactory makeLayoutFactory() throws FOrayException { - return null; + public static LayoutFactory makeLayoutFactory(Log logger) + throws FOrayException { + return new PioneerFactory(logger); } public static EntityResolver makeEntityResolver( This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <vic...@us...> - 2006-05-26 22:15:15
|
Revision: 7284 Author: victormote Date: 2006-05-26 15:15:02 -0700 (Fri, 26 May 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=7284&view=rev Log Message: ----------- Move some of the FOray-specific bootstrapping logic out of FOraySession and into FOraySpecific. Modified Paths: -------------- trunk/foray/foray-app/src/java/org/foray/app/CommandLineStarter.java trunk/foray/foray-app/src/java/org/foray/app/FOraySession.java trunk/foray/foray-app/src/java/org/foray/app/FOraySpecific.java Modified: trunk/foray/foray-app/src/java/org/foray/app/CommandLineStarter.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/app/CommandLineStarter.java 2006-05-26 22:10:46 UTC (rev 7283) +++ trunk/foray/foray-app/src/java/org/foray/app/CommandLineStarter.java 2006-05-26 22:15:02 UTC (rev 7284) @@ -95,7 +95,8 @@ GraphicServer graphicServer = FOraySpecific.makeGraphicServer(logger); FOTreeFactory foTreeServer = FOraySpecific.makeFOTreeFactory(logger, sessionConfig, graphicServer, textServer); - AreaTreeFactory areaTreeFactory = null; + AreaTreeFactory areaTreeFactory = FOraySpecific.makeAreaTreeFactory( + logger, textServer); LayoutFactory layoutFactory = null; FOraySession session = new FOraySession(logger, sessionConfig, fontServer, textServer, graphicServer, foTreeServer, Modified: trunk/foray/foray-app/src/java/org/foray/app/FOraySession.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/app/FOraySession.java 2006-05-26 22:10:46 UTC (rev 7283) +++ trunk/foray/foray-app/src/java/org/foray/app/FOraySession.java 2006-05-26 22:15:02 UTC (rev 7284) @@ -21,10 +21,9 @@ */ /* $Id$ */ - + package org.foray.app; -import org.foray.area.FOrayAreaTreeFactory; import org.foray.core.Application; import org.foray.core.FOrayException; import org.foray.core.SessionConfig; @@ -157,8 +156,13 @@ } this.foTreeFactory = foTreeFactory; + /* Validate AreaTreeFactory. */ + if (areaTreeFactory == null) { + throw new FOrayException("AreaTreeFactory required for " + + "FOraySession."); + } this.areaTreeFactory = areaTreeFactory; - setupAreaTreeFactory(); + this.layoutFactory = layoutFactory; setupLayoutFactory(); } @@ -212,17 +216,6 @@ } /** - * Sets up an AreaTreeFactory if there is not one already. - */ - private void setupAreaTreeFactory() { - if (this.areaTreeFactory != null) { - return; - } - this.areaTreeFactory = new FOrayAreaTreeFactory(this.getLogger(), - this.getTextServer()); - } - - /** * Sets up a LayoutFactory if there is not one already. */ private void setupLayoutFactory() { Modified: trunk/foray/foray-app/src/java/org/foray/app/FOraySpecific.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/app/FOraySpecific.java 2006-05-26 22:10:46 UTC (rev 7283) +++ trunk/foray/foray-app/src/java/org/foray/app/FOraySpecific.java 2006-05-26 22:15:02 UTC (rev 7284) @@ -24,6 +24,7 @@ package org.foray.app; +import org.foray.area.FOrayAreaTreeFactory; import org.foray.common.Logging; import org.foray.common.XMLParser; import org.foray.core.FOrayException; @@ -120,9 +121,9 @@ return urls; } - public static AreaTreeFactory makeAreaTreeFactory() - throws FOrayException { - return null; + public static AreaTreeFactory makeAreaTreeFactory(Log logger, + TextServer textServer) throws FOrayException { + return new FOrayAreaTreeFactory(logger, textServer); } public static LayoutFactory makeLayoutFactory() throws FOrayException { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <vic...@us...> - 2006-05-26 22:10:54
|
Revision: 7283 Author: victormote Date: 2006-05-26 15:10:46 -0700 (Fri, 26 May 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=7283&view=rev Log Message: ----------- Move some of the FOray-specific bootstrapping logic out of FOraySession and into FOraySpecific. Modified Paths: -------------- trunk/foray/foray-app/src/java/org/foray/app/CommandLineStarter.java trunk/foray/foray-app/src/java/org/foray/app/FOraySession.java trunk/foray/foray-app/src/java/org/foray/app/FOraySpecific.java Modified: trunk/foray/foray-app/src/java/org/foray/app/CommandLineStarter.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/app/CommandLineStarter.java 2006-05-26 22:01:44 UTC (rev 7282) +++ trunk/foray/foray-app/src/java/org/foray/app/CommandLineStarter.java 2006-05-26 22:10:46 UTC (rev 7283) @@ -93,7 +93,8 @@ TextServer textServer = FOraySpecific.makeTextServer(logger, sessionConfig); GraphicServer graphicServer = FOraySpecific.makeGraphicServer(logger); - FOTreeFactory foTreeServer = null; + FOTreeFactory foTreeServer = FOraySpecific.makeFOTreeFactory(logger, + sessionConfig, graphicServer, textServer); AreaTreeFactory areaTreeFactory = null; LayoutFactory layoutFactory = null; FOraySession session = new FOraySession(logger, sessionConfig, Modified: trunk/foray/foray-app/src/java/org/foray/app/FOraySession.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/app/FOraySession.java 2006-05-26 22:01:44 UTC (rev 7282) +++ trunk/foray/foray-app/src/java/org/foray/app/FOraySession.java 2006-05-26 22:10:46 UTC (rev 7283) @@ -28,7 +28,6 @@ import org.foray.core.Application; import org.foray.core.FOrayException; import org.foray.core.SessionConfig; -import org.foray.fotree.FOrayFOTreeServer; import org.foray.pioneer.PioneerFactory; import org.axsl.areaW.AreaTreeFactory; @@ -42,8 +41,6 @@ import org.xml.sax.EntityResolver; -import java.net.MalformedURLException; -import java.net.URL; import java.util.ArrayList; import java.util.Iterator; @@ -83,7 +80,7 @@ private GraphicServer graphicServer; /** */ - private FOTreeFactory foTreeServer; + private FOTreeFactory foTreeFactory; private AreaTreeFactory areaTreeFactory; @@ -117,7 +114,7 @@ */ public FOraySession(Log logger, SessionConfig configuration, FontServer fontServer, TextServer textServer, - GraphicServer graphicServer, FOTreeFactory foTreeServer, + GraphicServer graphicServer, FOTreeFactory foTreeFactory, AreaTreeFactory areaTreeFactory, LayoutFactory layoutFactory) throws FOrayException { /* Validate Logger. */ @@ -146,15 +143,20 @@ } this.textServer = textServer; - /* Validate TextServer. */ + /* Validate GraphicServer. */ if (graphicServer == null) { throw new FOrayException("GraphicServer required for " + "FOraySession."); } this.graphicServer = graphicServer; - this.foTreeServer = foTreeServer; - setupFOTreeServer(); + /* Validate FOTreeFactory. */ + if (foTreeFactory == null) { + throw new FOrayException("FOTreeFactory required for " + + "FOraySession."); + } + this.foTreeFactory = foTreeFactory; + this.areaTreeFactory = areaTreeFactory; setupAreaTreeFactory(); this.layoutFactory = layoutFactory; @@ -210,19 +212,6 @@ } /** - * Sets up a FOTreeServer if there is not one already. - */ - private void setupFOTreeServer() { - if (this.foTreeServer != null) { - return; - } - this.foTreeServer = new FOrayFOTreeServer(this.getLogger(), - this.getGraphicServer(), this.getTextServer(), - this.buildGraphicSearchPath(), - getConfiguration().optionCacheGraphics()); - } - - /** * Sets up an AreaTreeFactory if there is not one already. */ private void setupAreaTreeFactory() { @@ -243,21 +232,6 @@ this.layoutFactory = new PioneerFactory(this.getLogger()); } - /** - * - */ - private URL[] buildGraphicSearchPath() { - URL[] urls = new URL[3]; - urls[0] = getConfiguration().getBaseDocument(); - urls[1] = getConfiguration().optionBaseDirectory(); - try { - urls[2] = new URL(System.getProperty("user.dir")); - } catch (MalformedURLException e) { - // Ignore this -- just leave the null value in the array - } - return urls; - } - public GraphicServer getGraphicServer() { return this.graphicServer; } @@ -279,7 +253,7 @@ } public FOTreeFactory getFOTreeServer() { - return this.foTreeServer; + return this.foTreeFactory; } /** Modified: trunk/foray/foray-app/src/java/org/foray/app/FOraySpecific.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/app/FOraySpecific.java 2006-05-26 22:01:44 UTC (rev 7282) +++ trunk/foray/foray-app/src/java/org/foray/app/FOraySpecific.java 2006-05-26 22:10:46 UTC (rev 7283) @@ -29,6 +29,7 @@ import org.foray.core.FOrayException; import org.foray.core.SessionConfig; import org.foray.font.FOrayFontServer; +import org.foray.fotree.FOrayFOTreeServer; import org.foray.graphic.FOrayGraphicServer; import org.axsl.areaW.AreaTreeFactory; @@ -44,6 +45,7 @@ import org.xml.sax.EntityResolver; +import java.net.MalformedURLException; import java.net.URL; /** @@ -97,16 +99,27 @@ return new FOrayGraphicServer(logger, XMLParser.getParserClassName()); } - public static FOTreeFactory makeFOTreeFactory(GraphicServer graphicServer, - TextServer textServer, URL[] graphicSearchPath) + public static FOTreeFactory makeFOTreeFactory(Log logger, + SessionConfig configuration, GraphicServer graphicServer, + TextServer textServer) throws FOrayException { - return null; -// return new FOrayFOTreeServer(this.getLogger(), -// graphicServer, textServer, graphicSearchPath,Wi -// getConfiguration().optionCacheGraphics()); -// + URL[] graphicSearchPath = buildGraphicSearchPath(configuration); + return new FOrayFOTreeServer(logger, graphicServer, textServer, + graphicSearchPath, configuration.optionCacheGraphics()); } + private static URL[] buildGraphicSearchPath(SessionConfig configuration) { + URL[] urls = new URL[3]; + urls[0] = configuration.getBaseDocument(); + urls[1] = configuration.optionBaseDirectory(); + try { + urls[2] = new URL(System.getProperty("user.dir")); + } catch (MalformedURLException e) { + // Ignore this -- just leave the null value in the array + } + return urls; + } + public static AreaTreeFactory makeAreaTreeFactory() throws FOrayException { return null; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <vic...@us...> - 2006-05-26 22:01:49
|
Revision: 7282 Author: victormote Date: 2006-05-26 15:01:44 -0700 (Fri, 26 May 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=7282&view=rev Log Message: ----------- Move some of the FOray-specific bootstrapping logic out of FOraySession and into FOraySpecific. Modified Paths: -------------- trunk/foray/foray-app/src/java/org/foray/app/CommandLineStarter.java trunk/foray/foray-app/src/java/org/foray/app/FOraySession.java trunk/foray/foray-app/src/java/org/foray/app/FOraySpecific.java Modified: trunk/foray/foray-app/src/java/org/foray/app/CommandLineStarter.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/app/CommandLineStarter.java 2006-05-26 21:54:55 UTC (rev 7281) +++ trunk/foray/foray-app/src/java/org/foray/app/CommandLineStarter.java 2006-05-26 22:01:44 UTC (rev 7282) @@ -90,8 +90,9 @@ Log logger = FOraySpecific.makeLogger(sessionConfig); FontServer fontServer = FOraySpecific.makeFontServer(logger, sessionConfig); - TextServer textServer = null; - GraphicServer graphicServer = null; + TextServer textServer = FOraySpecific.makeTextServer(logger, + sessionConfig); + GraphicServer graphicServer = FOraySpecific.makeGraphicServer(logger); FOTreeFactory foTreeServer = null; AreaTreeFactory areaTreeFactory = null; LayoutFactory layoutFactory = null; Modified: trunk/foray/foray-app/src/java/org/foray/app/FOraySession.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/app/FOraySession.java 2006-05-26 21:54:55 UTC (rev 7281) +++ trunk/foray/foray-app/src/java/org/foray/app/FOraySession.java 2006-05-26 22:01:44 UTC (rev 7282) @@ -25,17 +25,14 @@ package org.foray.app; import org.foray.area.FOrayAreaTreeFactory; -import org.foray.common.XMLParser; import org.foray.core.Application; import org.foray.core.FOrayException; import org.foray.core.SessionConfig; import org.foray.fotree.FOrayFOTreeServer; -import org.foray.graphic.FOrayGraphicServer; import org.foray.pioneer.PioneerFactory; import org.axsl.areaW.AreaTreeFactory; import org.axsl.foR.FOTreeFactory; -import org.axsl.fontR.FontException; import org.axsl.fontR.FontServer; import org.axsl.graphicR.GraphicServer; import org.axsl.layout.LayoutFactory; @@ -123,30 +120,39 @@ GraphicServer graphicServer, FOTreeFactory foTreeServer, AreaTreeFactory areaTreeFactory, LayoutFactory layoutFactory) throws FOrayException { + /* Validate Logger. */ if (logger == null) { throw new FOrayException("Logger required for FOraySession."); } this.log = logger; log.info(Application.getVersion()); + /* Validate Configuration. */ this.configuration = configuration; if (this.configuration == null) { this.configuration = new SessionConfig(logger); } + /* Validate FontServer. */ if (fontServer == null) { throw new FOrayException("FontServer required for FOraySession."); } this.fontServer = fontServer; - try { - setupFontServer(); - } catch (FontException e) { - throw new FOrayException(e); + setupFontServer(); + + /* Validate TextServer. */ + if (textServer == null) { + throw new FOrayException("TextServer required for FOraySession."); } this.textServer = textServer; - setupTextServer(); + + /* Validate TextServer. */ + if (graphicServer == null) { + throw new FOrayException("GraphicServer required for " + + "FOraySession."); + } this.graphicServer = graphicServer; - setupGraphicServer(); + this.foTreeServer = foTreeServer; setupFOTreeServer(); this.areaTreeFactory = areaTreeFactory; @@ -173,7 +179,7 @@ /** * Sets up a FontServer instance if there is not one already. */ - private void setupFontServer() throws FontException { + private void setupFontServer() { if (log.isDebugEnabled()) { String[] systemFontFamilies = fontServer.getSystemFontFamilyList(); if (systemFontFamilies != null) { @@ -199,35 +205,11 @@ return this.fontServer; } - /** - * Sets up a TextServer if there is not one already. - */ - private void setupTextServer() { - if (this.textServer != null) { - return; - } - URL hyphenationDir = this.configuration - .optionHyphenationBaseDirectory(); - this.textServer = new org.foray.text.TextServer(getLogger(), - hyphenationDir); - } - public TextServer getTextServer() { return this.textServer; } /** - * Sets up a GraphicServer if there is not one already. - */ - private void setupGraphicServer() { - if (this.graphicServer != null) { - return; - } - this.graphicServer = new FOrayGraphicServer(getLogger(), - XMLParser.getParserClassName()); - } - - /** * Sets up a FOTreeServer if there is not one already. */ private void setupFOTreeServer() { Modified: trunk/foray/foray-app/src/java/org/foray/app/FOraySpecific.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/app/FOraySpecific.java 2006-05-26 21:54:55 UTC (rev 7281) +++ trunk/foray/foray-app/src/java/org/foray/app/FOraySpecific.java 2006-05-26 22:01:44 UTC (rev 7282) @@ -90,7 +90,6 @@ SessionConfig configuration) throws FOrayException { URL hyphenationDir = configuration.optionHyphenationBaseDirectory(); return new org.foray.text.TextServer(logger, hyphenationDir); - } public static GraphicServer makeGraphicServer(Log logger) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <vic...@us...> - 2006-05-26 21:55:06
|
Revision: 7281 Author: victormote Date: 2006-05-26 14:54:55 -0700 (Fri, 26 May 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=7281&view=rev Log Message: ----------- Move some of the FOray-specific bootstrapping logic out of FOraySession and into FOraySpecific. Modified Paths: -------------- trunk/foray/foray-app/src/java/org/foray/app/CommandLineStarter.java trunk/foray/foray-app/src/java/org/foray/app/FOraySession.java trunk/foray/foray-app/src/java/org/foray/app/FOraySpecific.java Modified: trunk/foray/foray-app/src/java/org/foray/app/CommandLineStarter.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/app/CommandLineStarter.java 2006-05-26 21:27:20 UTC (rev 7280) +++ trunk/foray/foray-app/src/java/org/foray/app/CommandLineStarter.java 2006-05-26 21:54:55 UTC (rev 7281) @@ -86,9 +86,10 @@ */ /* Set Logger to null so that new one will be created at the right * verbosity level. */ - Log logger = null; SessionConfig sessionConfig = this.options.getSessionConfig(); - FontServer fontServer = null; + Log logger = FOraySpecific.makeLogger(sessionConfig); + FontServer fontServer = FOraySpecific.makeFontServer(logger, + sessionConfig); TextServer textServer = null; GraphicServer graphicServer = null; FOTreeFactory foTreeServer = null; Modified: trunk/foray/foray-app/src/java/org/foray/app/FOraySession.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/app/FOraySession.java 2006-05-26 21:27:20 UTC (rev 7280) +++ trunk/foray/foray-app/src/java/org/foray/app/FOraySession.java 2006-05-26 21:54:55 UTC (rev 7281) @@ -25,12 +25,10 @@ package org.foray.app; import org.foray.area.FOrayAreaTreeFactory; -import org.foray.common.Logging; import org.foray.common.XMLParser; import org.foray.core.Application; import org.foray.core.FOrayException; import org.foray.core.SessionConfig; -import org.foray.font.FOrayFontServer; import org.foray.fotree.FOrayFOTreeServer; import org.foray.graphic.FOrayGraphicServer; import org.foray.pioneer.PioneerFactory; @@ -44,7 +42,6 @@ import org.axsl.text.TextServer; import org.apache.commons.logging.Log; -import org.apache.xerces.util.XMLCatalogResolver; import org.xml.sax.EntityResolver; @@ -102,10 +99,6 @@ * etc. */ private EntityResolver entityResolver; - /** Indicates whether an attempt has been made to create a default - * EntityResolver. If so, it should not be attempted again. */ - private boolean entityResolverCreated = false; - /** * Constructor. * @param logger The (optional) logger that should be used for this @@ -130,19 +123,20 @@ GraphicServer graphicServer, FOTreeFactory foTreeServer, AreaTreeFactory areaTreeFactory, LayoutFactory layoutFactory) throws FOrayException { - this.log = logger; - if (this.log == null) { - if (configuration.optionVerbosity().equals("debug")) { - this.log = Logging.makeDebugLogger(); - } else { - this.log = Logging.makeDefaultLogger(); - } + if (logger == null) { + throw new FOrayException("Logger required for FOraySession."); } + this.log = logger; log.info(Application.getVersion()); + this.configuration = configuration; if (this.configuration == null) { this.configuration = new SessionConfig(logger); } + + if (fontServer == null) { + throw new FOrayException("FontServer required for FOraySession."); + } this.fontServer = fontServer; try { setupFontServer(); @@ -180,17 +174,6 @@ * Sets up a FontServer instance if there is not one already. */ private void setupFontServer() throws FontException { - if (this.fontServer != null) { - return; - } - FOrayFontServer forayFontServer = new FOrayFontServer(getLogger()); - forayFontServer.setBaseFontURL( - this.configuration.optionFontBaseDirectory()); - forayFontServer.setBaseURL(this.configuration.optionBaseDirectory()); - forayFontServer.setEntityResolver(this.getEntityResolver()); - forayFontServer.setup(this.configuration.optionFontConfiguration(), - null); - this.fontServer = forayFontServer; if (log.isDebugEnabled()) { String[] systemFontFamilies = fontServer.getSystemFontFamilyList(); if (systemFontFamilies != null) { @@ -329,22 +312,6 @@ * @return The EntityResolver that should be used to resolve XML entities. */ public EntityResolver getEntityResolver() { - if (this.entityResolver != null) { - return this.entityResolver; - } - if (this.entityResolverCreated) { - return null; - } - this.entityResolverCreated = true; - String catalog = this.configuration.optionXMLCatalog(); - if (catalog == null) { - return null; - } - String [] catalogs = {catalog}; - XMLCatalogResolver resolver = new XMLCatalogResolver(); - resolver.setPreferPublic(true); - resolver.setCatalogList(catalogs); - this.entityResolver = resolver; return this.entityResolver; } Modified: trunk/foray/foray-app/src/java/org/foray/app/FOraySpecific.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/app/FOraySpecific.java 2006-05-26 21:27:20 UTC (rev 7280) +++ trunk/foray/foray-app/src/java/org/foray/app/FOraySpecific.java 2006-05-26 21:54:55 UTC (rev 7281) @@ -40,6 +40,7 @@ import org.axsl.text.TextServer; import org.apache.commons.logging.Log; +import org.apache.xerces.util.XMLCatalogResolver; import org.xml.sax.EntityResolver; @@ -69,8 +70,8 @@ } public static FontServer makeFontServer(Log logger, - SessionConfig configuration, EntityResolver entityResolver) - throws FOrayException { + SessionConfig configuration) throws FOrayException { + EntityResolver entityResolver = makeEntityResolver(configuration); FOrayFontServer forayFontServer = new FOrayFontServer(logger); forayFontServer.setBaseFontURL( configuration.optionFontBaseDirectory()); @@ -97,7 +98,7 @@ return new FOrayGraphicServer(logger, XMLParser.getParserClassName()); } - public FOTreeFactory makeFOTreeFactory(GraphicServer graphicServer, + public static FOTreeFactory makeFOTreeFactory(GraphicServer graphicServer, TextServer textServer, URL[] graphicSearchPath) throws FOrayException { return null; @@ -107,13 +108,26 @@ // } - public AreaTreeFactory makeAreaTreeFactory() + public static AreaTreeFactory makeAreaTreeFactory() throws FOrayException { return null; } - public LayoutFactory makeLayoutFactory() throws FOrayException { + public static LayoutFactory makeLayoutFactory() throws FOrayException { return null; } + public static EntityResolver makeEntityResolver( + SessionConfig configuration) { + String catalog = configuration.optionXMLCatalog(); + if (catalog == null) { + return null; + } + String [] catalogs = {catalog}; + XMLCatalogResolver resolver = new XMLCatalogResolver(); + resolver.setPreferPublic(true); + resolver.setCatalogList(catalogs); + return resolver; + } + } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <vic...@us...> - 2006-05-26 21:27:24
|
Revision: 7280 Author: victormote Date: 2006-05-26 14:27:20 -0700 (Fri, 26 May 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=7280&view=rev Log Message: ----------- Remove duplicate set of constants. Modified Paths: -------------- trunk/foray/foray-app/src/java/org/foray/app/CommandLineOptions.java Modified: trunk/foray/foray-app/src/java/org/foray/app/CommandLineOptions.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/app/CommandLineOptions.java 2006-05-26 21:19:36 UTC (rev 7279) +++ trunk/foray/foray-app/src/java/org/foray/app/CommandLineOptions.java 2006-05-26 21:27:20 UTC (rev 7280) @@ -44,30 +44,12 @@ */ public class CommandLineOptions { - /* input / output not set */ + /* input not set */ private static final int NOT_SET = 0; /* input: fo file */ private static final int FO_INPUT = 1; /* input: xml+xsl file */ private static final int XSLT_INPUT = 2; - /* output: pdf file */ - private static final int PDF_OUTPUT = 1; - /* output: screen using swing */ - private static final int AWT_OUTPUT = 2; - /* output: mif file */ - private static final int MIF_OUTPUT = 3; - /* output: sent swing rendered file to printer */ - private static final int PRINT_OUTPUT = 4; - /* output: pcl file */ - private static final int PCL_OUTPUT = 5; - /* output: postscript file */ - private static final int PS_OUTPUT = 6; - /* output: text file */ - private static final int TXT_OUTPUT = 7; - /* output: svg file */ - private static final int SVG_OUTPUT = 8; - /* output: XML area tree */ - private static final int AREA_OUTPUT = 9; /* user configuration file */ URL userConfigFile = null; @@ -217,11 +199,11 @@ return true; } if (args[currentArgument].equals("-awt")) { - setOutputMode(AWT_OUTPUT); + setOutputMode(OutputTargetFactory.RENDER_AWT); return true; } if (args[currentArgument].equals("-pdf")) { - setOutputMode(PDF_OUTPUT); + setOutputMode(OutputTargetFactory.RENDER_PDF); if ((currentArgument + 1 == args.length) || (args[currentArgument + 1].charAt(0) == '-')) { throw new FOrayException("you must specify the pdf output " @@ -232,7 +214,7 @@ return true; } if (args[currentArgument].equals("-mif")) { - setOutputMode(MIF_OUTPUT); + setOutputMode(OutputTargetFactory.RENDER_MIF); if ((currentArgument + 1 == args.length) || (args[currentArgument + 1].charAt(0) == '-')) { throw new FOrayException("you must specify the mif output " @@ -243,7 +225,7 @@ return true; } if (args[currentArgument].equals("-print")) { - setOutputMode(PRINT_OUTPUT); + setOutputMode(OutputTargetFactory.RENDER_PRINT); // show print help if (currentArgument + 1 < args.length) { if (args[currentArgument + 1].equals("help")) { @@ -254,7 +236,7 @@ return true; } if (args[currentArgument].equals("-pcl")) { - setOutputMode(PCL_OUTPUT); + setOutputMode(OutputTargetFactory.RENDER_PCL); if ((currentArgument + 1 == args.length) || (args[currentArgument + 1].charAt(0) == '-')) { throw new FOrayException("you must specify the pdf output " @@ -265,7 +247,7 @@ return true; } if (args[currentArgument].equals("-ps")) { - setOutputMode(PS_OUTPUT); + setOutputMode(OutputTargetFactory.RENDER_PS); if ((currentArgument + 1 == args.length) || (args[currentArgument + 1].charAt(0) == '-')) { throw new FOrayException("you must specify the PostScript " @@ -276,7 +258,7 @@ return true; } if (args[currentArgument].equals("-txt")) { - setOutputMode(TXT_OUTPUT); + setOutputMode(OutputTargetFactory.RENDER_TXT); if ((currentArgument + 1 == args.length) || (args[currentArgument + 1].charAt(0) == '-')) { throw new FOrayException("you must specify the text output " @@ -287,7 +269,7 @@ return true; } if (args[currentArgument].equals("-svg")) { - setOutputMode(SVG_OUTPUT); + setOutputMode(OutputTargetFactory.RENDER_SVG); if ((currentArgument + 1 == args.length) || (args[currentArgument + 1].charAt(0) == '-')) { throw new FOrayException("you must specify the svg output " @@ -302,7 +284,7 @@ inputmode = FO_INPUT; fofile = new File(args[currentArgument]); } else if (outputmode == NOT_SET) { - outputmode = PDF_OUTPUT; + outputmode = OutputTargetFactory.RENDER_PDF; outfile = new File(args[currentArgument]); } else { throw new FOrayException("Don't know what to do with " @@ -311,7 +293,7 @@ return true; } if (args[currentArgument].equals("-at")) { - setOutputMode(AREA_OUTPUT); + setOutputMode(OutputTargetFactory.RENDER_XML); if ((currentArgument + 1 == args.length) || (args[currentArgument + 1].charAt(0) == '-')) { throw new FOrayException("you must specify the area-tree " @@ -427,30 +409,7 @@ * type. */ public int getOutputType() throws FOrayException { - switch (outputmode) { - case NOT_SET: - throw new FOrayException("Renderer has not been set!"); - case PDF_OUTPUT: - return OutputTargetFactory.RENDER_PDF; - case AWT_OUTPUT: - return OutputTargetFactory.RENDER_AWT; - case MIF_OUTPUT: - return OutputTargetFactory.RENDER_MIF; - case PRINT_OUTPUT: - return OutputTargetFactory.RENDER_PRINT; - case PCL_OUTPUT: - return OutputTargetFactory.RENDER_PCL; - case PS_OUTPUT: - return OutputTargetFactory.RENDER_PS; - case TXT_OUTPUT: - return OutputTargetFactory.RENDER_TXT; - case SVG_OUTPUT: - return OutputTargetFactory.RENDER_SVG; - case AREA_OUTPUT: - return OutputTargetFactory.RENDER_XML; - default: - throw new FOrayException("Invalid Renderer setting!"); - } + return outputmode; } /** @@ -478,7 +437,7 @@ public Starter getStarter() throws FOrayException { Starter starter = null; switch (outputmode) { - case AWT_OUTPUT: + case OutputTargetFactory.RENDER_AWT: try { starter = new AWTStarter(log, getSessionConfig(), getRendererOptions(), this); @@ -489,7 +448,7 @@ throw new FOrayException("AWTStarter could not be loaded.", e); } break; - case PRINT_OUTPUT: + case OutputTargetFactory.RENDER_PRINT: try { starter = new PrintStarter(log, getSessionConfig(), getRendererOptions(), this); @@ -647,49 +606,47 @@ } log.debug("Output mode: "); switch (outputmode) { - case NOT_SET: - log.debug("not set"); - break; - case PDF_OUTPUT: + case OutputTargetFactory.RENDER_PDF: log.debug("pdf"); log.debug("output file: " + outfile.toString()); break; - case AWT_OUTPUT: + case OutputTargetFactory.RENDER_AWT: log.debug("awt on screen"); if (outfile != null) { log.error("awt mode, but outfile is set:"); log.debug("out file: " + outfile.toString()); } break; - case MIF_OUTPUT: + case OutputTargetFactory.RENDER_MIF: log.debug("mif"); log.debug("output file: " + outfile.toString()); break; - case PRINT_OUTPUT: + case OutputTargetFactory.RENDER_PRINT: log.debug("print directly"); if (outfile != null) { log.error("print mode, but outfile is set:"); log.error("out file: " + outfile.toString()); } break; - case PCL_OUTPUT: + case OutputTargetFactory.RENDER_PCL: log.debug("pcl"); log.debug("output file: " + outfile.toString()); break; - case PS_OUTPUT: + case OutputTargetFactory.RENDER_PS: log.debug("PostScript"); log.debug("output file: " + outfile.toString()); break; - case TXT_OUTPUT: + case OutputTargetFactory.RENDER_TXT: log.debug("txt"); log.debug("output file: " + outfile.toString()); break; - case SVG_OUTPUT: + case OutputTargetFactory.RENDER_SVG: log.debug("svg"); log.debug("output file: " + outfile.toString()); break; default: - log.debug("unknown input type"); + log.debug("not set"); + break; } log.debug("OPTIONS"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <vic...@us...> - 2006-05-26 21:19:54
|
Revision: 7279 Author: victormote Date: 2006-05-26 14:19:36 -0700 (Fri, 26 May 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=7279&view=rev Log Message: ----------- Move more FOray-specific code to OutputTargetFactory. Modified Paths: -------------- trunk/foray/foray-app/src/java/org/foray/app/CommandLineOptions.java trunk/foray/foray-app/src/java/org/foray/app/FOrayTarget.java trunk/foray/foray-app/src/java/org/foray/app/OutputTargetFactory.java trunk/foray/foray-app/src/java/org/foray/app/ant/FOrayAntTask.java trunk/foray/foray-app/src/java/org/foray/app/ant/FOrayAntTaskStarter.java trunk/foray/foray-app/src/java/org/foray/app/test/TestConverter.java trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoFO2PDF.java trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoObj2PDF.java trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoXML2PDF.java trunk/foray/foray-app/src/java/org/foray/demo/servlet/AbstractDemoServlet.java trunk/foray/foray-app/src/java/org/foray/demo/servlet/DemoPrintServlet.java trunk/foray/foray-app/src/java/org/foray/demo/servlet/DemoServlet.java Modified: trunk/foray/foray-app/src/java/org/foray/app/CommandLineOptions.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/app/CommandLineOptions.java 2006-05-26 21:13:18 UTC (rev 7278) +++ trunk/foray/foray-app/src/java/org/foray/app/CommandLineOptions.java 2006-05-26 21:19:36 UTC (rev 7279) @@ -431,23 +431,23 @@ case NOT_SET: throw new FOrayException("Renderer has not been set!"); case PDF_OUTPUT: - return FOrayTarget.RENDER_PDF; + return OutputTargetFactory.RENDER_PDF; case AWT_OUTPUT: - return FOrayTarget.RENDER_AWT; + return OutputTargetFactory.RENDER_AWT; case MIF_OUTPUT: - return FOrayTarget.RENDER_MIF; + return OutputTargetFactory.RENDER_MIF; case PRINT_OUTPUT: - return FOrayTarget.RENDER_PRINT; + return OutputTargetFactory.RENDER_PRINT; case PCL_OUTPUT: - return FOrayTarget.RENDER_PCL; + return OutputTargetFactory.RENDER_PCL; case PS_OUTPUT: - return FOrayTarget.RENDER_PS; + return OutputTargetFactory.RENDER_PS; case TXT_OUTPUT: - return FOrayTarget.RENDER_TXT; + return OutputTargetFactory.RENDER_TXT; case SVG_OUTPUT: - return FOrayTarget.RENDER_SVG; + return OutputTargetFactory.RENDER_SVG; case AREA_OUTPUT: - return FOrayTarget.RENDER_XML; + return OutputTargetFactory.RENDER_XML; default: throw new FOrayException("Invalid Renderer setting!"); } Modified: trunk/foray/foray-app/src/java/org/foray/app/FOrayTarget.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/app/FOrayTarget.java 2006-05-26 21:13:18 UTC (rev 7278) +++ trunk/foray/foray-app/src/java/org/foray/app/FOrayTarget.java 2006-05-26 21:19:36 UTC (rev 7279) @@ -68,33 +68,6 @@ public class FOrayTarget implements FOTreeListener, AreaTreeListener { private static final boolean MEM_PROFILE_WITH_GC = false; - /** Render to PDF. OutputStream must be set. */ - public static final int RENDER_PDF = 1; - - /** Render to a GUI window. No OutputStream neccessary. */ - public static final int RENDER_AWT = 2; - - /** Render to MIF. OutputStream must be set. */ - public static final int RENDER_MIF = 3; - - /** Render to XML. OutputStream must be set. */ - public static final int RENDER_XML = 4; - - /** Render to PRINT. No OutputStream neccessary. */ - public static final int RENDER_PRINT = 5; - - /** Render to PCL. OutputStream must be set. */ - public static final int RENDER_PCL = 6; - - /** Render to Postscript. OutputStream must be set. */ - public static final int RENDER_PS = 7; - - /** Render to Text. OutputStream must be set. */ - public static final int RENDER_TXT = 8; - - /** Render to SVG. OutputStream must be set. */ - public static final int RENDER_SVG = 9; - /** The "parent" FOrayDocument instance. */ private FOrayDocument document; @@ -478,70 +451,6 @@ return this.document; } - /** - * Converts a String description of the desired Renderer to a valid - * renderer code. - * @param format The String description of the desired Renderer, either - * a mime type or a standard description. - * @return One of {@link #RENDER_PDF}, {@link #RENDER_AWT}, - * {@link #RENDER_MIF}, {@link #RENDER_XML}, {@link #RENDER_PRINT}, - * {@link #RENDER_PCL}, {@link #RENDER_PS}, {@link #RENDER_TXT}, - * {@link #RENDER_SVG}, or -1 if the input is not valid. - */ - public static int getRendererType(String format) { - if ((format == null) - || format.equalsIgnoreCase("application/pdf") - || format.equalsIgnoreCase("pdf")) { - return RENDER_PDF; - } - if (format.equalsIgnoreCase("application/postscript") - || format.equalsIgnoreCase("ps")) { - return RENDER_PS; - } - if (format.equalsIgnoreCase("application/vnd.mif") - || format.equalsIgnoreCase("mif")) { - return RENDER_MIF; - } - if (format.equalsIgnoreCase("application/vnd.gp-PCL") - || format.equalsIgnoreCase("pcl")) { - return RENDER_PCL; - } - if (format.equalsIgnoreCase("text/plain") - || format.equalsIgnoreCase("txt")) { - return RENDER_TXT; - } - if (format.equalsIgnoreCase("text/xml") - || format.equalsIgnoreCase("at") - || format.equalsIgnoreCase("xml")) { - return RENDER_XML; - } - return -1; - } - - public static String getMimeExtension(int rendererType) { - switch (rendererType) { - case RENDER_PDF: { - return ".pdf"; - } - case RENDER_PS: { - return ".ps"; - } - case RENDER_MIF: { - return ".mif"; - } - case RENDER_PCL: { - return ".pcl"; - } - case RENDER_TXT: { - return ".txt"; - } - case RENDER_XML: { - return ".xml"; - } - } - return null; - } - public AreaTreeFactory getAreaTreeFactory() { return this.document.getAreaTreeFactory(); } Modified: trunk/foray/foray-app/src/java/org/foray/app/OutputTargetFactory.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/app/OutputTargetFactory.java 2006-05-26 21:13:18 UTC (rev 7278) +++ trunk/foray/foray-app/src/java/org/foray/app/OutputTargetFactory.java 2006-05-26 21:19:36 UTC (rev 7279) @@ -46,6 +46,33 @@ */ public class OutputTargetFactory { + /** Render to PDF. OutputStream must be set. */ + public static final int RENDER_PDF = 1; + + /** Render to a GUI window. No OutputStream neccessary. */ + public static final int RENDER_AWT = 2; + + /** Render to MIF. OutputStream must be set. */ + public static final int RENDER_MIF = 3; + + /** Render to XML. OutputStream must be set. */ + public static final int RENDER_XML = 4; + + /** Render to PRINT. No OutputStream neccessary. */ + public static final int RENDER_PRINT = 5; + + /** Render to PCL. OutputStream must be set. */ + public static final int RENDER_PCL = 6; + + /** Render to Postscript. OutputStream must be set. */ + public static final int RENDER_PS = 7; + + /** Render to Text. OutputStream must be set. */ + public static final int RENDER_TXT = 8; + + /** Render to SVG. OutputStream must be set. */ + public static final int RENDER_SVG = 9; + /** * Private constructor (should not be instantiated). */ @@ -74,35 +101,35 @@ OutputConfig outputOptions, Log logger) throws FOrayException { OutputTarget renderer = null; switch (rendererType) { - case FOrayTarget.RENDER_AWT: { + case RENDER_AWT: { renderer = new AWTRenderer(outputOptions); break; } - case FOrayTarget.RENDER_PRINT: { + case RENDER_PRINT: { throw new FOrayException("Print renderer cannot be instantiated " + "from the standard method."); } - case FOrayTarget.RENDER_PCL: { + case RENDER_PCL: { renderer = new PCLRenderer(outputOptions); break; } - case FOrayTarget.RENDER_PS: { + case RENDER_PS: { renderer = new PSRenderer(outputOptions); break; } - case FOrayTarget.RENDER_TXT: { + case RENDER_TXT: { renderer = new TXTRenderer(outputOptions); break; } - case FOrayTarget.RENDER_MIF: { + case RENDER_MIF: { renderer = new MIFConverter(outputOptions); break; } - case FOrayTarget.RENDER_XML: { + case RENDER_XML: { renderer = new XMLRenderer(outputOptions); break; } - case FOrayTarget.RENDER_SVG: { + case RENDER_SVG: { renderer = new SVGRenderer(outputOptions); break; } @@ -118,4 +145,68 @@ return renderer; } + /** + * Converts a String description of the desired Renderer to a valid + * renderer code. + * @param format The String description of the desired Renderer, either + * a mime type or a standard description. + * @return One of {@link #RENDER_PDF}, {@link #RENDER_AWT}, + * {@link #RENDER_MIF}, {@link #RENDER_XML}, {@link #RENDER_PRINT}, + * {@link #RENDER_PCL}, {@link #RENDER_PS}, {@link #RENDER_TXT}, + * {@link #RENDER_SVG}, or -1 if the input is not valid. + */ + public static int getRendererType(String format) { + if ((format == null) + || format.equalsIgnoreCase("application/pdf") + || format.equalsIgnoreCase("pdf")) { + return RENDER_PDF; + } + if (format.equalsIgnoreCase("application/postscript") + || format.equalsIgnoreCase("ps")) { + return RENDER_PS; + } + if (format.equalsIgnoreCase("application/vnd.mif") + || format.equalsIgnoreCase("mif")) { + return RENDER_MIF; + } + if (format.equalsIgnoreCase("application/vnd.gp-PCL") + || format.equalsIgnoreCase("pcl")) { + return RENDER_PCL; + } + if (format.equalsIgnoreCase("text/plain") + || format.equalsIgnoreCase("txt")) { + return RENDER_TXT; + } + if (format.equalsIgnoreCase("text/xml") + || format.equalsIgnoreCase("at") + || format.equalsIgnoreCase("xml")) { + return RENDER_XML; + } + return -1; + } + + public static String getMimeExtension(int rendererType) { + switch (rendererType) { + case RENDER_PDF: { + return ".pdf"; + } + case RENDER_PS: { + return ".ps"; + } + case RENDER_MIF: { + return ".mif"; + } + case RENDER_PCL: { + return ".pcl"; + } + case RENDER_TXT: { + return ".txt"; + } + case RENDER_XML: { + return ".xml"; + } + } + return null; + } + } Modified: trunk/foray/foray-app/src/java/org/foray/app/ant/FOrayAntTask.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/app/ant/FOrayAntTask.java 2006-05-26 21:13:18 UTC (rev 7278) +++ trunk/foray/foray-app/src/java/org/foray/app/ant/FOrayAntTask.java 2006-05-26 21:19:36 UTC (rev 7279) @@ -24,7 +24,7 @@ package org.foray.app.ant; -import org.foray.app.FOrayTarget; +import org.foray.app.OutputTargetFactory; import org.foray.app.Starter; import org.foray.common.Logging; import org.foray.core.FOrayException; @@ -262,12 +262,12 @@ } protected int getRendererType() { - return FOrayTarget.getRendererType(getFormat()); + return OutputTargetFactory.getRendererType(getFormat()); } protected String getFileExtension() { int rendererType = getRendererType(); - String extension = FOrayTarget.getMimeExtension(rendererType); + String extension = OutputTargetFactory.getMimeExtension(rendererType); return extension; } Modified: trunk/foray/foray-app/src/java/org/foray/app/ant/FOrayAntTaskStarter.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/app/ant/FOrayAntTaskStarter.java 2006-05-26 21:13:18 UTC (rev 7278) +++ trunk/foray/foray-app/src/java/org/foray/app/ant/FOrayAntTaskStarter.java 2006-05-26 21:19:36 UTC (rev 7279) @@ -268,7 +268,7 @@ FOrayDocument document = new FOrayDocument(session, inputHandler.getInputSource(), parser); - if (this.task.getRendererType() == FOrayTarget.RENDER_XML) { + if (this.task.getRendererType() == OutputTargetFactory.RENDER_XML) { this.outputConfig.parseOption("fineDetail", "true", SessionConfig.PRECEDENCE_DEFAULT); } Modified: trunk/foray/foray-app/src/java/org/foray/app/test/TestConverter.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/app/test/TestConverter.java 2006-05-26 21:13:18 UTC (rev 7278) +++ trunk/foray/foray-app/src/java/org/foray/app/test/TestConverter.java 2006-05-26 21:19:36 UTC (rev 7279) @@ -287,9 +287,9 @@ outname + (outputPDF ? ".pdf" : ".at.xml")))); int rendererType = -1; if (outputPDF) { - rendererType = FOrayTarget.RENDER_PDF; + rendererType = OutputTargetFactory.RENDER_PDF; } else { - rendererType = FOrayTarget.RENDER_XML; + rendererType = OutputTargetFactory.RENDER_XML; } OutputConfig renderOptions = new OutputConfig(log); Modified: trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoFO2PDF.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoFO2PDF.java 2006-05-26 21:13:18 UTC (rev 7278) +++ trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoFO2PDF.java 2006-05-26 21:19:36 UTC (rev 7279) @@ -61,7 +61,7 @@ //Setup Renderer OutputTarget renderer = OutputTargetFactory.makeOutputTarget( - FOrayTarget.RENDER_PDF, null, session.getLogger()); + OutputTargetFactory.RENDER_PDF, null, session.getLogger()); //Setup FOrayTarget OutputStream out = new FileOutputStream(pdf); Modified: trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoObj2PDF.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoObj2PDF.java 2006-05-26 21:13:18 UTC (rev 7278) +++ trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoObj2PDF.java 2006-05-26 21:19:36 UTC (rev 7279) @@ -76,7 +76,7 @@ //Setup Renderer OutputTarget renderer = OutputTargetFactory.makeOutputTarget( - FOrayTarget.RENDER_PDF, null, session.getLogger()); + OutputTargetFactory.RENDER_PDF, null, session.getLogger()); //Setup FOrayTarget OutputStream out = new FileOutputStream(pdf); Modified: trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoXML2PDF.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoXML2PDF.java 2006-05-26 21:13:18 UTC (rev 7278) +++ trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoXML2PDF.java 2006-05-26 21:19:36 UTC (rev 7279) @@ -75,7 +75,7 @@ //Setup Renderer OutputTarget renderer = OutputTargetFactory.makeOutputTarget( - FOrayTarget.RENDER_PDF, null, session.getLogger()); + OutputTargetFactory.RENDER_PDF, null, session.getLogger()); //Setup FOrayTarget OutputStream out = new FileOutputStream(pdf); Modified: trunk/foray/foray-app/src/java/org/foray/demo/servlet/AbstractDemoServlet.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/demo/servlet/AbstractDemoServlet.java 2006-05-26 21:13:18 UTC (rev 7278) +++ trunk/foray/foray-app/src/java/org/foray/demo/servlet/AbstractDemoServlet.java 2006-05-26 21:19:36 UTC (rev 7279) @@ -169,7 +169,7 @@ // Setup the Renderer OutputTarget renderer = OutputTargetFactory.makeOutputTarget( - FOrayTarget.RENDER_PDF, null, session.getLogger()); + OutputTargetFactory.RENDER_PDF, null, session.getLogger()); // Setup FOrayTarget ByteArrayOutputStream output = new ByteArrayOutputStream(); @@ -212,7 +212,7 @@ // Setup the Renderer OutputTarget renderer = OutputTargetFactory.makeOutputTarget( - FOrayTarget.RENDER_PDF, null, session.getLogger()); + OutputTargetFactory.RENDER_PDF, null, session.getLogger()); // Setup FOrayTarget ByteArrayOutputStream output = new ByteArrayOutputStream(); Modified: trunk/foray/foray-app/src/java/org/foray/demo/servlet/DemoPrintServlet.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/demo/servlet/DemoPrintServlet.java 2006-05-26 21:13:18 UTC (rev 7278) +++ trunk/foray/foray-app/src/java/org/foray/demo/servlet/DemoPrintServlet.java 2006-05-26 21:19:36 UTC (rev 7279) @@ -27,11 +27,12 @@ import org.foray.app.FOrayDocument; import org.foray.app.FOraySession; import org.foray.app.FOrayTarget; +import org.foray.app.OutputTargetFactory; import org.foray.core.FOrayException; import org.foray.core.InputHandler; import org.foray.render.awt.AWTPrintRenderer; -import java.awt.print.PrinterJob ; +import java.awt.print.PrinterJob; import java.io.File; import java.io.PrintWriter; @@ -72,7 +73,7 @@ } protected int getRendererType() { - return FOrayTarget.RENDER_PRINT; + return OutputTargetFactory.RENDER_PRINT; } /** Modified: trunk/foray/foray-app/src/java/org/foray/demo/servlet/DemoServlet.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/demo/servlet/DemoServlet.java 2006-05-26 21:13:18 UTC (rev 7278) +++ trunk/foray/foray-app/src/java/org/foray/demo/servlet/DemoServlet.java 2006-05-26 21:19:36 UTC (rev 7279) @@ -73,7 +73,7 @@ } protected int getRendererType() { - return FOrayTarget.RENDER_PDF; + return OutputTargetFactory.RENDER_PDF; } /** @@ -121,7 +121,7 @@ throws FOrayException { // Setup the Renderer OutputTarget renderer = OutputTargetFactory.makeOutputTarget( - FOrayTarget.RENDER_PDF, null, document.getLogger()); + OutputTargetFactory.RENDER_PDF, null, document.getLogger()); // Setup FOrayTarget ByteArrayOutputStream output = new ByteArrayOutputStream(); FOrayTarget target = new FOrayTarget(document, renderer, null, output); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <vic...@us...> - 2006-05-26 21:13:34
|
Revision: 7278 Author: victormote Date: 2006-05-26 14:13:18 -0700 (Fri, 26 May 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=7278&view=rev Log Message: ----------- Split the Renderer creation logic into a separate class. Modified Paths: -------------- trunk/foray/foray-app/src/java/org/foray/app/CommandLineStarter.java trunk/foray/foray-app/src/java/org/foray/app/FOrayDocument.java trunk/foray/foray-app/src/java/org/foray/app/ant/FOrayAntTaskStarter.java trunk/foray/foray-app/src/java/org/foray/app/test/TestConverter.java trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoFO2PDF.java trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoObj2PDF.java trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoXML2PDF.java trunk/foray/foray-app/src/java/org/foray/demo/servlet/AbstractDemoServlet.java trunk/foray/foray-app/src/java/org/foray/demo/servlet/DemoServlet.java Added Paths: ----------- trunk/foray/foray-app/src/java/org/foray/app/OutputTargetFactory.java Modified: trunk/foray/foray-app/src/java/org/foray/app/CommandLineStarter.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/app/CommandLineStarter.java 2006-05-26 20:55:16 UTC (rev 7277) +++ trunk/foray/foray-app/src/java/org/foray/app/CommandLineStarter.java 2006-05-26 21:13:18 UTC (rev 7278) @@ -124,8 +124,8 @@ */ int outputType = commandLineOptions.getOutputType(); OutputConfig outputOptions = this.outputConfig; - OutputTarget outputTarget = document.makeOutputTarget(outputType, - outputOptions); + OutputTarget outputTarget = OutputTargetFactory.makeOutputTarget( + outputType, outputOptions, session.getLogger()); /* * Instantiate and configure the FOrayTarget(s). Multiple targets can Modified: trunk/foray/foray-app/src/java/org/foray/app/FOrayDocument.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/app/FOrayDocument.java 2006-05-26 20:55:16 UTC (rev 7277) +++ trunk/foray/foray-app/src/java/org/foray/app/FOrayDocument.java 2006-05-26 21:13:18 UTC (rev 7278) @@ -29,23 +29,12 @@ import org.foray.core.DocumentReader; import org.foray.core.FOrayException; import org.foray.core.SessionConfig; -import org.foray.output.MIFConverter; -import org.foray.output.OutputConfig; -import org.foray.render.awt.AWTRenderer; -import org.foray.render.pcl.PCLRenderer; -import org.foray.render.pdf.PDFRenderer; -import org.foray.render.ps.PSRenderer; -import org.foray.render.svg.SVGRenderer; -import org.foray.render.txt.TXTRenderer; -import org.foray.render.xml.XMLRenderer; import org.axsl.areaW.AreaTreeFactory; import org.axsl.fontR.FontConsumer; import org.axsl.fontR.FontServer; import org.axsl.graphicR.GraphicServer; import org.axsl.layout.LayoutFactory; -import org.axsl.output.OutputTarget; -import org.axsl.pdfW.PDFDocument; import org.axsl.text.TextServer; import org.apache.commons.logging.Log; @@ -328,73 +317,6 @@ return this.treeBuilder; } - /** - * Factory method that makes a new Renderer instance for the standard - * renderers. - * @param rendererType The integral id for the Renderer that should be - * used. Must be one of: - * <ul> - * <li>RENDER_PDF - * <li>RENDER_AWT - * <li>RENDER_MIF - * <li>RENDER_XML - * <li>RENDER_PCL - * <li>RENDER_PS - * <li>RENDER_TXT - * <li>RENDER_SVG - * </ul> - * @param outputOptions Map containing the options to be used with the - * Renderer. - */ - public OutputTarget makeOutputTarget(int rendererType, - OutputConfig outputOptions) throws FOrayException { - OutputTarget renderer = null; - switch (rendererType) { - case FOrayTarget.RENDER_AWT: { - renderer = new AWTRenderer(outputOptions); - break; - } - case FOrayTarget.RENDER_PRINT: { - throw new FOrayException("Print renderer cannot be instantiated " - + "from the standard method."); - } - case FOrayTarget.RENDER_PCL: { - renderer = new PCLRenderer(outputOptions); - break; - } - case FOrayTarget.RENDER_PS: { - renderer = new PSRenderer(outputOptions); - break; - } - case FOrayTarget.RENDER_TXT: { - renderer = new TXTRenderer(outputOptions); - break; - } - case FOrayTarget.RENDER_MIF: { - renderer = new MIFConverter(outputOptions); - break; - } - case FOrayTarget.RENDER_XML: { - renderer = new XMLRenderer(outputOptions); - break; - } - case FOrayTarget.RENDER_SVG: { - renderer = new SVGRenderer(outputOptions); - break; - } - default: { - PDFDocument document = new org.foray.pdf.object.PDFDocument( - getLogger()); - renderer = new PDFRenderer(outputOptions, document); - break; - } - } - if (renderer == null) { - throw new FOrayException("Unable to create renderer."); - } - return renderer; - } - public AreaTreeFactory getAreaTreeFactory() { return this.session.getAreaTreeFactory(); } Added: trunk/foray/foray-app/src/java/org/foray/app/OutputTargetFactory.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/app/OutputTargetFactory.java (rev 0) +++ trunk/foray/foray-app/src/java/org/foray/app/OutputTargetFactory.java 2006-05-26 21:13:18 UTC (rev 7278) @@ -0,0 +1,121 @@ +/* + * Copyright 2006 The FOray Project. + * http://www.foray.org + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * This work is in part derived from the following work(s), used with the + * permission of the licensor: + * Apache FOP, licensed by the Apache Software Foundation + * + */ + +/* $Id$ */ + +package org.foray.app; + +import org.foray.core.FOrayException; +import org.foray.output.MIFConverter; +import org.foray.output.OutputConfig; +import org.foray.render.awt.AWTRenderer; +import org.foray.render.pcl.PCLRenderer; +import org.foray.render.pdf.PDFRenderer; +import org.foray.render.ps.PSRenderer; +import org.foray.render.svg.SVGRenderer; +import org.foray.render.txt.TXTRenderer; +import org.foray.render.xml.XMLRenderer; + +import org.axsl.output.OutputTarget; +import org.axsl.pdfW.PDFDocument; + +import org.apache.commons.logging.Log; + +/** + * This class manages the process of parsing an input FO document and creating + * an FOTree. + */ +public class OutputTargetFactory { + + /** + * Private constructor (should not be instantiated). + */ + private OutputTargetFactory() { + } + + /** + * Factory method that makes a new Renderer instance for the standard + * renderers. + * @param rendererType The integral id for the Renderer that should be + * used. Must be one of: + * <ul> + * <li>RENDER_PDF + * <li>RENDER_AWT + * <li>RENDER_MIF + * <li>RENDER_XML + * <li>RENDER_PCL + * <li>RENDER_PS + * <li>RENDER_TXT + * <li>RENDER_SVG + * </ul> + * @param outputOptions Map containing the options to be used with the + * Renderer. + */ + public static OutputTarget makeOutputTarget(int rendererType, + OutputConfig outputOptions, Log logger) throws FOrayException { + OutputTarget renderer = null; + switch (rendererType) { + case FOrayTarget.RENDER_AWT: { + renderer = new AWTRenderer(outputOptions); + break; + } + case FOrayTarget.RENDER_PRINT: { + throw new FOrayException("Print renderer cannot be instantiated " + + "from the standard method."); + } + case FOrayTarget.RENDER_PCL: { + renderer = new PCLRenderer(outputOptions); + break; + } + case FOrayTarget.RENDER_PS: { + renderer = new PSRenderer(outputOptions); + break; + } + case FOrayTarget.RENDER_TXT: { + renderer = new TXTRenderer(outputOptions); + break; + } + case FOrayTarget.RENDER_MIF: { + renderer = new MIFConverter(outputOptions); + break; + } + case FOrayTarget.RENDER_XML: { + renderer = new XMLRenderer(outputOptions); + break; + } + case FOrayTarget.RENDER_SVG: { + renderer = new SVGRenderer(outputOptions); + break; + } + default: { + PDFDocument document = new org.foray.pdf.object.PDFDocument(logger); + renderer = new PDFRenderer(outputOptions, document); + break; + } + } + if (renderer == null) { + throw new FOrayException("Unable to create renderer."); + } + return renderer; + } + +} Property changes on: trunk/foray/foray-app/src/java/org/foray/app/OutputTargetFactory.java ___________________________________________________________________ Name: svn:keywords + "Author Id Rev Date URL" Name: svn:eol-style + native Modified: trunk/foray/foray-app/src/java/org/foray/app/ant/FOrayAntTaskStarter.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/app/ant/FOrayAntTaskStarter.java 2006-05-26 20:55:16 UTC (rev 7277) +++ trunk/foray/foray-app/src/java/org/foray/app/ant/FOrayAntTaskStarter.java 2006-05-26 21:13:18 UTC (rev 7278) @@ -28,6 +28,7 @@ import org.foray.app.FOraySession; import org.foray.app.FOrayTarget; import org.foray.app.Options; +import org.foray.app.OutputTargetFactory; import org.foray.app.Starter; import org.foray.core.FOInputHandler; import org.foray.core.FOrayException; @@ -271,8 +272,9 @@ this.outputConfig.parseOption("fineDetail", "true", SessionConfig.PRECEDENCE_DEFAULT); } - OutputTarget outputTarget = document.makeOutputTarget( - this.task.getRendererType(), this.outputConfig); + OutputTarget outputTarget = OutputTargetFactory.makeOutputTarget( + this.task.getRendererType(), this.outputConfig, + session.getLogger()); new FOrayTarget(document, outputTarget, null, out); session.process(); Modified: trunk/foray/foray-app/src/java/org/foray/app/test/TestConverter.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/app/test/TestConverter.java 2006-05-26 20:55:16 UTC (rev 7277) +++ trunk/foray/foray-app/src/java/org/foray/app/test/TestConverter.java 2006-05-26 21:13:18 UTC (rev 7278) @@ -27,6 +27,7 @@ import org.foray.app.FOrayDocument; import org.foray.app.FOraySession; import org.foray.app.FOrayTarget; +import org.foray.app.OutputTargetFactory; import org.foray.common.Logging; import org.foray.core.FOInputHandler; import org.foray.core.FOrayException; @@ -296,8 +297,8 @@ SessionConfig.PRECEDENCE_DEFAULT); renderOptions.parseOption("consistentOutput", "true", SessionConfig.PRECEDENCE_DEFAULT); - OutputTarget renderer = document.makeOutputTarget(rendererType, - renderOptions); + OutputTarget renderer = OutputTargetFactory.makeOutputTarget( + rendererType, renderOptions, session.getLogger()); new FOrayTarget(document, renderer, null, bos); Modified: trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoFO2PDF.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoFO2PDF.java 2006-05-26 20:55:16 UTC (rev 7277) +++ trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoFO2PDF.java 2006-05-26 21:13:18 UTC (rev 7278) @@ -27,6 +27,7 @@ import org.foray.app.FOrayDocument; import org.foray.app.FOraySession; import org.foray.app.FOrayTarget; +import org.foray.app.OutputTargetFactory; import org.foray.core.Application; import org.foray.core.FOInputHandler; import org.foray.core.FOrayException; @@ -50,24 +51,24 @@ // Setup FOraySession SessionConfig config = new SessionConfig(getLogger()); - FOraySession driver = new FOraySession(getLogger(), config, null, null, + FOraySession session = new FOraySession(getLogger(), config, null, null, null, null, null, null); // Setup FOrayDocument InputHandler inputHandler = new FOInputHandler(getLogger(), fo); - FOrayDocument document = new FOrayDocument(driver, + FOrayDocument document = new FOrayDocument(session, inputHandler.getInputSource(), inputHandler.getParser()); //Setup Renderer - OutputTarget renderer = document.makeOutputTarget( - FOrayTarget.RENDER_PDF, null); + OutputTarget renderer = OutputTargetFactory.makeOutputTarget( + FOrayTarget.RENDER_PDF, null, session.getLogger()); //Setup FOrayTarget OutputStream out = new FileOutputStream(pdf); new FOrayTarget(document, renderer, null, out); // Start the processing. - driver.process(); + session.process(); } Modified: trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoObj2PDF.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoObj2PDF.java 2006-05-26 20:55:16 UTC (rev 7277) +++ trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoObj2PDF.java 2006-05-26 21:13:18 UTC (rev 7278) @@ -27,6 +27,7 @@ import org.foray.app.FOrayDocument; import org.foray.app.FOraySession; import org.foray.app.FOrayTarget; +import org.foray.app.OutputTargetFactory; import org.foray.core.Application; import org.foray.core.FOrayException; import org.foray.core.SessionConfig; @@ -56,7 +57,7 @@ // Setup FOraySession SessionConfig config = new SessionConfig(getLogger()); - FOraySession driver = new FOraySession(getLogger(), config, null, null, + FOraySession session = new FOraySession(getLogger(), config, null, null, null, null, null, null); // Setup FOrayDocument @@ -70,18 +71,19 @@ * Create the FOrayDocument using the JAXP constructor. Resulting SAX * events (the generated FO) will be piped through to FOray. */ - FOrayDocument document = new FOrayDocument(driver, transformer, source); + FOrayDocument document = new FOrayDocument(session, transformer, + source); //Setup Renderer - OutputTarget renderer = document.makeOutputTarget( - FOrayTarget.RENDER_PDF, null); + OutputTarget renderer = OutputTargetFactory.makeOutputTarget( + FOrayTarget.RENDER_PDF, null, session.getLogger()); //Setup FOrayTarget OutputStream out = new FileOutputStream(pdf); new FOrayTarget(document, renderer, null, out); // Start the processing. - driver.process(); + session.process(); } Modified: trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoXML2PDF.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoXML2PDF.java 2006-05-26 20:55:16 UTC (rev 7277) +++ trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoXML2PDF.java 2006-05-26 21:13:18 UTC (rev 7278) @@ -27,6 +27,7 @@ import org.foray.app.FOrayDocument; import org.foray.app.FOraySession; import org.foray.app.FOrayTarget; +import org.foray.app.OutputTargetFactory; import org.foray.core.Application; import org.foray.core.FOrayException; import org.foray.core.SessionConfig; @@ -55,7 +56,7 @@ // Setup FOraySession SessionConfig config = new SessionConfig(getLogger()); - FOraySession driver = new FOraySession(getLogger(), config, null, null, + FOraySession session = new FOraySession(getLogger(), config, null, null, null, null, null, null); // Setup FOrayDocument @@ -69,18 +70,19 @@ * Create the FOrayDocument using the JAXP constructor. Resulting SAX * events (the generated FO) will be piped through to FOray. */ - FOrayDocument document = new FOrayDocument(driver, transformer, source); + FOrayDocument document = new FOrayDocument(session, transformer, + source); //Setup Renderer - OutputTarget renderer = document.makeOutputTarget( - FOrayTarget.RENDER_PDF, null); + OutputTarget renderer = OutputTargetFactory.makeOutputTarget( + FOrayTarget.RENDER_PDF, null, session.getLogger()); //Setup FOrayTarget OutputStream out = new FileOutputStream(pdf); new FOrayTarget(document, renderer, null, out); // Start the processing. - driver.process(); + session.process(); } public static void main(String[] args) { Modified: trunk/foray/foray-app/src/java/org/foray/demo/servlet/AbstractDemoServlet.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/demo/servlet/AbstractDemoServlet.java 2006-05-26 20:55:16 UTC (rev 7277) +++ trunk/foray/foray-app/src/java/org/foray/demo/servlet/AbstractDemoServlet.java 2006-05-26 21:13:18 UTC (rev 7278) @@ -27,6 +27,7 @@ import org.foray.app.FOrayDocument; import org.foray.app.FOraySession; import org.foray.app.FOrayTarget; +import org.foray.app.OutputTargetFactory; import org.foray.common.Logging; import org.foray.core.FOInputHandler; import org.foray.core.FOrayException; @@ -167,8 +168,8 @@ FOrayDocument document = setupSAXDocument(session, inputHandler); // Setup the Renderer - OutputTarget renderer = document.makeOutputTarget( - FOrayTarget.RENDER_PDF, null); + OutputTarget renderer = OutputTargetFactory.makeOutputTarget( + FOrayTarget.RENDER_PDF, null, session.getLogger()); // Setup FOrayTarget ByteArrayOutputStream output = new ByteArrayOutputStream(); @@ -210,8 +211,8 @@ source); // Setup the Renderer - OutputTarget renderer = document.makeOutputTarget( - FOrayTarget.RENDER_PDF, null); + OutputTarget renderer = OutputTargetFactory.makeOutputTarget( + FOrayTarget.RENDER_PDF, null, session.getLogger()); // Setup FOrayTarget ByteArrayOutputStream output = new ByteArrayOutputStream(); Modified: trunk/foray/foray-app/src/java/org/foray/demo/servlet/DemoServlet.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/demo/servlet/DemoServlet.java 2006-05-26 20:55:16 UTC (rev 7277) +++ trunk/foray/foray-app/src/java/org/foray/demo/servlet/DemoServlet.java 2006-05-26 21:13:18 UTC (rev 7278) @@ -27,6 +27,7 @@ import org.foray.app.FOrayDocument; import org.foray.app.FOraySession; import org.foray.app.FOrayTarget; +import org.foray.app.OutputTargetFactory; import org.foray.core.FOrayException; import org.foray.core.InputHandler; @@ -119,8 +120,8 @@ private FOrayTarget setupTarget(FOrayDocument document) throws FOrayException { // Setup the Renderer - OutputTarget renderer = document.makeOutputTarget( - FOrayTarget.RENDER_PDF, null); + OutputTarget renderer = OutputTargetFactory.makeOutputTarget( + FOrayTarget.RENDER_PDF, null, document.getLogger()); // Setup FOrayTarget ByteArrayOutputStream output = new ByteArrayOutputStream(); FOrayTarget target = new FOrayTarget(document, renderer, null, output); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <vic...@us...> - 2006-05-26 20:55:30
|
Revision: 7277 Author: victormote Date: 2006-05-26 13:55:16 -0700 (Fri, 26 May 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=7277&view=rev Log Message: ----------- Remove more dependencies on FOray output/render modules. Modified Paths: -------------- trunk/foray/foray-app/src/java/org/foray/app/CommandLineStarter.java trunk/foray/foray-app/src/java/org/foray/app/FOrayDocument.java trunk/foray/foray-app/src/java/org/foray/app/ant/FOrayAntTaskStarter.java trunk/foray/foray-app/src/java/org/foray/app/test/TestConverter.java trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoFO2PDF.java trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoObj2PDF.java trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoXML2PDF.java trunk/foray/foray-app/src/java/org/foray/demo/servlet/AbstractDemoServlet.java trunk/foray/foray-app/src/java/org/foray/demo/servlet/DemoServlet.java Modified: trunk/foray/foray-app/src/java/org/foray/app/CommandLineStarter.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/app/CommandLineStarter.java 2006-05-26 20:48:35 UTC (rev 7276) +++ trunk/foray/foray-app/src/java/org/foray/app/CommandLineStarter.java 2006-05-26 20:55:16 UTC (rev 7277) @@ -28,7 +28,6 @@ import org.foray.core.SessionConfig; import org.foray.layout.LayoutStrategy; import org.foray.output.OutputConfig; -import org.foray.output.OutputTarget; import org.foray.pioneer.PioneerLS; import org.axsl.areaW.AreaTreeFactory; @@ -36,6 +35,7 @@ import org.axsl.fontR.FontServer; import org.axsl.graphicR.GraphicServer; import org.axsl.layout.LayoutFactory; +import org.axsl.output.OutputTarget; import org.axsl.text.TextServer; import org.apache.commons.logging.Log; Modified: trunk/foray/foray-app/src/java/org/foray/app/FOrayDocument.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/app/FOrayDocument.java 2006-05-26 20:48:35 UTC (rev 7276) +++ trunk/foray/foray-app/src/java/org/foray/app/FOrayDocument.java 2006-05-26 20:55:16 UTC (rev 7277) @@ -31,7 +31,6 @@ import org.foray.core.SessionConfig; import org.foray.output.MIFConverter; import org.foray.output.OutputConfig; -import org.foray.output.OutputTarget; import org.foray.render.awt.AWTRenderer; import org.foray.render.pcl.PCLRenderer; import org.foray.render.pdf.PDFRenderer; @@ -45,6 +44,7 @@ import org.axsl.fontR.FontServer; import org.axsl.graphicR.GraphicServer; import org.axsl.layout.LayoutFactory; +import org.axsl.output.OutputTarget; import org.axsl.pdfW.PDFDocument; import org.axsl.text.TextServer; Modified: trunk/foray/foray-app/src/java/org/foray/app/ant/FOrayAntTaskStarter.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/app/ant/FOrayAntTaskStarter.java 2006-05-26 20:48:35 UTC (rev 7276) +++ trunk/foray/foray-app/src/java/org/foray/app/ant/FOrayAntTaskStarter.java 2006-05-26 20:55:16 UTC (rev 7277) @@ -34,8 +34,9 @@ import org.foray.core.InputHandler; import org.foray.core.SessionConfig; import org.foray.output.OutputConfig; -import org.foray.output.OutputTarget; +import org.axsl.output.OutputTarget; + import org.apache.commons.logging.Log; import org.apache.tools.ant.BuildException; import org.apache.tools.ant.DirectoryScanner; Modified: trunk/foray/foray-app/src/java/org/foray/app/test/TestConverter.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/app/test/TestConverter.java 2006-05-26 20:48:35 UTC (rev 7276) +++ trunk/foray/foray-app/src/java/org/foray/app/test/TestConverter.java 2006-05-26 20:55:16 UTC (rev 7277) @@ -34,8 +34,9 @@ import org.foray.core.SessionConfig; import org.foray.core.TraxInputHandler; import org.foray.output.OutputConfig; -import org.foray.output.OutputTarget; +import org.axsl.output.OutputTarget; + import org.apache.commons.logging.Log; import org.w3c.dom.Document; Modified: trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoFO2PDF.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoFO2PDF.java 2006-05-26 20:48:35 UTC (rev 7276) +++ trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoFO2PDF.java 2006-05-26 20:55:16 UTC (rev 7277) @@ -24,11 +24,6 @@ package org.foray.demo.embed; -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.OutputStream; - import org.foray.app.FOrayDocument; import org.foray.app.FOraySession; import org.foray.app.FOrayTarget; @@ -37,8 +32,14 @@ import org.foray.core.FOrayException; import org.foray.core.InputHandler; import org.foray.core.SessionConfig; -import org.foray.output.OutputTarget; +import org.axsl.output.OutputTarget; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.OutputStream; + /** * This class demonstrates the conversion of an FO file to PDF using FOray. */ Modified: trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoObj2PDF.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoObj2PDF.java 2006-05-26 20:48:35 UTC (rev 7276) +++ trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoObj2PDF.java 2006-05-26 20:55:16 UTC (rev 7277) @@ -24,27 +24,27 @@ package org.foray.demo.embed; +import org.foray.app.FOrayDocument; +import org.foray.app.FOraySession; +import org.foray.app.FOrayTarget; +import org.foray.core.Application; +import org.foray.core.FOrayException; +import org.foray.core.SessionConfig; +import org.foray.demo.embed.model.ProjectTeam; + +import org.axsl.output.OutputTarget; + import java.io.File; import java.io.FileOutputStream; +import java.io.IOException; import java.io.OutputStream; -import java.io.IOException; +import javax.xml.transform.Source; import javax.xml.transform.Transformer; +import javax.xml.transform.TransformerException; import javax.xml.transform.TransformerFactory; -import javax.xml.transform.TransformerException; -import javax.xml.transform.Source; import javax.xml.transform.stream.StreamSource; -import org.foray.app.FOrayDocument; -import org.foray.app.FOraySession; -import org.foray.app.FOrayTarget; -import org.foray.output.OutputTarget; - -import org.foray.core.Application; -import org.foray.core.FOrayException; -import org.foray.core.SessionConfig; -import org.foray.demo.embed.model.ProjectTeam; - /** * This class demonstrates the conversion of an arbitrary object file to a * PDF using JAXP (XSLT) and FOray (XSL:FO). Modified: trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoXML2PDF.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoXML2PDF.java 2006-05-26 20:48:35 UTC (rev 7276) +++ trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoXML2PDF.java 2006-05-26 20:55:16 UTC (rev 7277) @@ -24,25 +24,26 @@ package org.foray.demo.embed; +import org.foray.app.FOrayDocument; +import org.foray.app.FOraySession; +import org.foray.app.FOrayTarget; +import org.foray.core.Application; +import org.foray.core.FOrayException; +import org.foray.core.SessionConfig; + +import org.axsl.output.OutputTarget; + import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStream; +import javax.xml.transform.Source; import javax.xml.transform.Transformer; +import javax.xml.transform.TransformerException; import javax.xml.transform.TransformerFactory; -import javax.xml.transform.TransformerException; -import javax.xml.transform.Source; import javax.xml.transform.stream.StreamSource; -import org.foray.app.FOrayDocument; -import org.foray.app.FOraySession; -import org.foray.app.FOrayTarget; -import org.foray.core.Application; -import org.foray.core.FOrayException; -import org.foray.core.SessionConfig; -import org.foray.output.OutputTarget; - /** * This class demonstrates the conversion of an XML file to PDF using * JAXP (XSLT) and FOray (XSL:FO). Modified: trunk/foray/foray-app/src/java/org/foray/demo/servlet/AbstractDemoServlet.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/demo/servlet/AbstractDemoServlet.java 2006-05-26 20:48:35 UTC (rev 7276) +++ trunk/foray/foray-app/src/java/org/foray/demo/servlet/AbstractDemoServlet.java 2006-05-26 20:55:16 UTC (rev 7277) @@ -32,8 +32,9 @@ import org.foray.core.FOrayException; import org.foray.core.InputHandler; import org.foray.core.SessionConfig; -import org.foray.output.OutputTarget; +import org.axsl.output.OutputTarget; + import org.apache.commons.logging.Log; import java.io.ByteArrayOutputStream; Modified: trunk/foray/foray-app/src/java/org/foray/demo/servlet/DemoServlet.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/demo/servlet/DemoServlet.java 2006-05-26 20:48:35 UTC (rev 7276) +++ trunk/foray/foray-app/src/java/org/foray/demo/servlet/DemoServlet.java 2006-05-26 20:55:16 UTC (rev 7277) @@ -29,8 +29,9 @@ import org.foray.app.FOrayTarget; import org.foray.core.FOrayException; import org.foray.core.InputHandler; -import org.foray.output.OutputTarget; +import org.axsl.output.OutputTarget; + import java.io.ByteArrayOutputStream; import java.io.File; import java.io.IOException; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <vic...@us...> - 2006-05-26 20:48:50
|
Revision: 7276 Author: victormote Date: 2006-05-26 13:48:35 -0700 (Fri, 26 May 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=7276&view=rev Log Message: ----------- Use new axsl methods to reduce dependencies on FOray output and render modules. Modified Paths: -------------- trunk/foray/foray-app/src/java/org/foray/app/FOrayTarget.java trunk/foray/foray-output/src/java/org/foray/output/OutputTarget.java trunk/foray/foray-render/src/java/org/foray/render/Renderer.java Modified: trunk/foray/foray-app/src/java/org/foray/app/FOrayTarget.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/app/FOrayTarget.java 2006-05-26 20:14:53 UTC (rev 7275) +++ trunk/foray/foray-app/src/java/org/foray/app/FOrayTarget.java 2006-05-26 20:48:35 UTC (rev 7276) @@ -27,8 +27,8 @@ import org.foray.core.Application; import org.foray.core.FOrayException; import org.foray.core.SessionConfig; -import org.foray.output.OutputTarget; -import org.foray.render.Renderer; +import org.axsl.output.OutputTarget; +import org.axsl.output.Renderer; import org.axsl.areaR.AreaRException; import org.axsl.areaR.PageArea; Modified: trunk/foray/foray-output/src/java/org/foray/output/OutputTarget.java =================================================================== --- trunk/foray/foray-output/src/java/org/foray/output/OutputTarget.java 2006-05-26 20:14:53 UTC (rev 7275) +++ trunk/foray/foray-output/src/java/org/foray/output/OutputTarget.java 2006-05-26 20:48:35 UTC (rev 7276) @@ -28,7 +28,6 @@ import org.apache.commons.logging.Log; -import java.io.IOException; import java.io.OutputStream; /** @@ -66,33 +65,6 @@ return this.fontConsumer; } - /** - * Hook allowing the OutputTarget to initialize itself and prepare to - * render pages. - * @throws IOException For problems writing the output. - */ - public abstract void startOutput() throws IOException; - - /** - * Hook allowing the OutputTarget to clean up. - * @throws IOException For problems writing the output. - */ - public abstract void stopOutput() throws IOException; - - /** - * Indicates which font sources can be used by this OutputTarget. - * @return The array of valid font sources that can be used by this - * OutputTarget. - * Valid array values are {@link FontConsumer#FONT_SOURCE_FREE_STANDING} and - * {@link FontConsumer#FONT_SOURCE_SYSTEM}. - * The order of the array signifies the order of preference for selection - * purposes. - * For example, if both system fonts and free-standing fonts can be used, - * but free-standing fonts are preferred, the array should contain - * { FONT_SOURCE_FREE_STANDING, FONT_SOURCE_SYSTEM }; - */ - public abstract int[] getFontSources() ; - public void setOutputStream(OutputStream stream) { this.outputStream = stream; } @@ -102,7 +74,7 @@ } /** - * @return True iff an OutputStream is required by this target. + * {@inheritDoc} * Subclasses that do not need an OutputStream should override this. */ public boolean outputStreamRequired() { @@ -117,7 +89,7 @@ } /** - * @param applicationName The applicationName to set. + * {@inheritDoc} */ public void setApplicationName(String applicationName) { this.applicationName = applicationName; @@ -134,7 +106,7 @@ } /** - * @param applicationNameShort The applicationNameShort to set. + * {@inheritDoc} */ public void setApplicationNameShort(String applicationNameShort) { this.applicationNameShort = applicationNameShort; @@ -149,7 +121,7 @@ } /** - * @param applicationVersion The applicationVersion to set. + * {@inheritDoc} */ public void setApplicationVersion(String applicationVersion) { this.applicationVersion = applicationVersion; @@ -165,7 +137,7 @@ } /** - * @param developerURLShort The developerURLShort to set. + * {@inheritDoc} */ public void setDeveloperURLShort(String developerURLShort) { this.developerURLShort = developerURLShort; @@ -184,7 +156,7 @@ } /** - * @param logger The logger to set. + * {@inheritDoc} */ public void setLogger(Log logger) { this.logger = logger; Modified: trunk/foray/foray-render/src/java/org/foray/render/Renderer.java =================================================================== --- trunk/foray/foray-render/src/java/org/foray/render/Renderer.java 2006-05-26 20:14:53 UTC (rev 7275) +++ trunk/foray/foray-render/src/java/org/foray/render/Renderer.java 2006-05-26 20:48:35 UTC (rev 7276) @@ -81,7 +81,8 @@ * Subclasses produce output in some format from an AreaTree or AreaTree * fragment. */ -public abstract class Renderer extends OutputTarget { +public abstract class Renderer extends OutputTarget + implements org.axsl.output.Renderer { AreaTree areaTree; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <vic...@us...> - 2006-05-26 20:15:11
|
Revision: 7275 Author: victormote Date: 2006-05-26 13:14:53 -0700 (Fri, 26 May 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=7275&view=rev Log Message: ----------- 1. Implement new axsl interface for output. 2. Adjust module dependencies. Modified Paths: -------------- trunk/foray/foray-app/.classpath trunk/foray/foray-output/.classpath trunk/foray/foray-output/src/java/org/foray/output/OutputTarget.java trunk/foray/foray-render/.classpath Modified: trunk/foray/foray-app/.classpath =================================================================== --- trunk/foray/foray-app/.classpath 2006-05-26 19:57:41 UTC (rev 7274) +++ trunk/foray/foray-app/.classpath 2006-05-26 20:14:53 UTC (rev 7275) @@ -33,5 +33,6 @@ <classpathentry combineaccessrules="false" kind="src" path="/FOrayLayout"/> <classpathentry combineaccessrules="false" kind="src" path="/axslLayout"/> <classpathentry combineaccessrules="false" kind="src" path="/FOrayCore"/> + <classpathentry combineaccessrules="false" kind="src" path="/axslOutput"/> <classpathentry kind="output" path="build/eclipse"/> </classpath> Modified: trunk/foray/foray-output/.classpath =================================================================== --- trunk/foray/foray-output/.classpath 2006-05-26 19:57:41 UTC (rev 7274) +++ trunk/foray/foray-output/.classpath 2006-05-26 20:14:53 UTC (rev 7275) @@ -10,5 +10,6 @@ <classpathentry kind="src" path="/axslCommon"/> <classpathentry kind="var" path="FORAY_LIB_ROOT/commons-logging.jar"/> <classpathentry combineaccessrules="false" kind="src" path="/FOrayMIF"/> + <classpathentry combineaccessrules="false" kind="src" path="/axslOutput"/> <classpathentry kind="output" path="build/eclipse"/> </classpath> Modified: trunk/foray/foray-output/src/java/org/foray/output/OutputTarget.java =================================================================== --- trunk/foray/foray-output/src/java/org/foray/output/OutputTarget.java 2006-05-26 19:57:41 UTC (rev 7274) +++ trunk/foray/foray-output/src/java/org/foray/output/OutputTarget.java 2006-05-26 20:14:53 UTC (rev 7275) @@ -34,7 +34,7 @@ /** * Abstract superclass for all Renderers and Converters. */ -public abstract class OutputTarget { +public abstract class OutputTarget implements org.axsl.output.OutputTarget { OutputStream outputStream; public String applicationName; Modified: trunk/foray/foray-render/.classpath =================================================================== --- trunk/foray/foray-render/.classpath 2006-05-26 19:57:41 UTC (rev 7274) +++ trunk/foray/foray-render/.classpath 2006-05-26 20:14:53 UTC (rev 7275) @@ -15,5 +15,6 @@ <classpathentry kind="var" path="FORAY_LIB_ROOT/commons-logging.jar"/> <classpathentry kind="src" path="/axslPDF-W"/> <classpathentry combineaccessrules="false" kind="src" path="/FOrayPS"/> + <classpathentry combineaccessrules="false" kind="src" path="/axslOutput"/> <classpathentry kind="output" path="build/eclipse"/> </classpath> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <vic...@us...> - 2006-05-26 19:57:57
|
Revision: 7274 Author: victormote Date: 2006-05-26 12:57:41 -0700 (Fri, 26 May 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=7274&view=rev Log Message: ----------- Remove dependency of core module on the output module. Modified Paths: -------------- trunk/foray/foray-common/src/java/org/foray/common/Configuration.java trunk/foray/foray-core/.classpath trunk/foray/foray-core/src/java/org/foray/core/ConfigurationParser.java Modified: trunk/foray/foray-common/src/java/org/foray/common/Configuration.java =================================================================== --- trunk/foray/foray-common/src/java/org/foray/common/Configuration.java 2006-05-26 19:24:09 UTC (rev 7273) +++ trunk/foray/foray-common/src/java/org/foray/common/Configuration.java 2006-05-26 19:57:41 UTC (rev 7274) @@ -190,7 +190,7 @@ * @return True if the option was successfully added, false if it does not * belong in this Configuration implementation. */ - protected abstract boolean parseOption(String key, String value, + public abstract boolean parseOption(String key, String value, int precedenceValue); /** Modified: trunk/foray/foray-core/.classpath =================================================================== --- trunk/foray/foray-core/.classpath 2006-05-26 19:24:09 UTC (rev 7273) +++ trunk/foray/foray-core/.classpath 2006-05-26 19:57:41 UTC (rev 7274) @@ -4,6 +4,5 @@ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> <classpathentry kind="var" path="FORAY_LIB_ROOT/commons-logging.jar"/> <classpathentry combineaccessrules="false" kind="src" path="/FOrayCommon"/> - <classpathentry combineaccessrules="false" kind="src" path="/FOrayOutput"/> <classpathentry kind="output" path="build/eclipse"/> </classpath> Modified: trunk/foray/foray-core/src/java/org/foray/core/ConfigurationParser.java =================================================================== --- trunk/foray/foray-core/src/java/org/foray/core/ConfigurationParser.java 2006-05-26 19:24:09 UTC (rev 7273) +++ trunk/foray/foray-core/src/java/org/foray/core/ConfigurationParser.java 2006-05-26 19:57:41 UTC (rev 7274) @@ -24,7 +24,7 @@ package org.foray.core; -import org.foray.output.OutputConfig; +import org.foray.common.Configuration; import org.apache.commons.logging.Log; @@ -57,7 +57,7 @@ // store the result configuration private SessionConfig sessionConfig; - private OutputConfig outputConfig; + private Configuration outputConfig; // stores key for new config entry private String key = ""; @@ -88,7 +88,7 @@ * should be sent. */ public ConfigurationParser(SessionConfig sessionConfig, - OutputConfig outputConfig, InputSource source, Log logger) + Configuration outputConfig, InputSource source, Log logger) throws FOrayException { this.sessionConfig = sessionConfig; this.outputConfig = outputConfig; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <vic...@us...> - 2006-05-26 19:24:25
|
Revision: 7273 Author: victormote Date: 2006-05-26 12:24:09 -0700 (Fri, 26 May 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=7273&view=rev Log Message: ----------- Move more classes to core package. Modified Paths: -------------- trunk/foray/foray-app/src/java/org/foray/app/Options.java trunk/foray/foray-core/.classpath Added Paths: ----------- trunk/foray/foray-core/src/java/org/foray/core/ConfigurationParser.java Removed Paths: ------------- trunk/foray/foray-app/src/java/org/foray/app/ConfigurationParser.java Deleted: trunk/foray/foray-app/src/java/org/foray/app/ConfigurationParser.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/app/ConfigurationParser.java 2006-05-26 19:14:47 UTC (rev 7272) +++ trunk/foray/foray-app/src/java/org/foray/app/ConfigurationParser.java 2006-05-26 19:24:09 UTC (rev 7273) @@ -1,249 +0,0 @@ -/* - * Copyright 2004 The FOray Project. - * http://www.foray.org - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * This work is in part derived from the following work(s), used with the - * permission of the licensor: - * Apache FOP, licensed by the Apache Software Foundation - * - */ - -/* $Id$ */ - -package org.foray.app; - -import org.foray.core.FOrayException; -import org.foray.core.SessionConfig; -import org.foray.output.OutputConfig; - -import org.apache.commons.logging.Log; - -import org.xml.sax.Attributes; -import org.xml.sax.InputSource; -import org.xml.sax.Locator; -import org.xml.sax.SAXException; -import org.xml.sax.XMLReader; -import org.xml.sax.helpers.DefaultHandler; - -import java.io.IOException; - -import javax.xml.parsers.SAXParserFactory; - -/** - * SAX2 Handler which retrieves the configuration information and stores them - * in Configuration. - * Normally this class doesn't need to be accessed directly. - */ -public class ConfigurationParser extends DefaultHandler { - /* - * TODO: These should all be changed to boolean values. - */ - private static final int OUT = 0; - private static final int IN_KEY = 2; - private static final int IN_VALUE = 4; - - // state of parser - private int status = OUT; - - // store the result configuration - private SessionConfig sessionConfig; - private OutputConfig outputConfig; - - // stores key for new config entry - private String key = ""; - - // stores string value - private String value = ""; - - /** - * locator for line number information - */ - private Locator locator; - - /** inputsource for configuration file */ - private InputSource filename; - - /** The logger that should be used by this parser. */ - private Log logger; - - /** - * Constructor. - * @param sessionConfig The SessionConfig instance which should be updated - * with general options found in the configuration file. - * @param outputConfig The RenderConfig instance which should be updated - * with renderer-specific options found in the configuration file. - * @param source the SAX InputSource which encapsulates the configuration - * file XML that should be parsed. - * @param logger The logger to which errors and other messages - * should be sent. - */ - public ConfigurationParser(SessionConfig sessionConfig, - OutputConfig outputConfig, InputSource source, Log logger) - throws FOrayException { - this.sessionConfig = sessionConfig; - this.outputConfig = outputConfig; - this.filename = source; - this.logger = logger; - if (this.sessionConfig == null) { - throw new FOrayException("Session Configuration is null."); - } - if (this.outputConfig == null) { - throw new FOrayException("Output Configuration is null."); - } - } - - /** - * Parses the encapsulated SAX InputSource and updates the encapsulated - * Configuration instances accordingly. - * @throws FOrayException If there are errors parsing the input. - */ - public void parseDocument() throws FOrayException { - XMLReader parser = createParser(); - parser.setContentHandler(this); - try { - parser.parse(filename); - } catch (SAXException e) { - if (e.getException() instanceof FOrayException) { - throw (FOrayException)e.getException(); - } - throw new FOrayException(e); - } catch (IOException e) { - throw new FOrayException(e); - } - } - - /** - * creates a SAX parser - * - * @return the created SAX parser - */ - private XMLReader createParser() throws FOrayException { - try { - SAXParserFactory spf = javax.xml.parsers.SAXParserFactory - .newInstance(); - spf.setNamespaceAware(true); - XMLReader xmlReader = spf.newSAXParser().getXMLReader(); - logger.info("Config: Using " - + xmlReader.getClass().getName() + " as SAX2 Parser."); - return xmlReader; - } catch (javax.xml.parsers.ParserConfigurationException e) { - throw new FOrayException(e); - } catch (SAXException e) { - throw new FOrayException(e); - } - } - - public void startDocument() { - } - - /** - * Set the locator which is used to report the position of the element - * in the source document. - */ - public void setDocumentLocator(Locator locator) { - this.locator = locator; - } - - /** - * extracts the element and attribute name and sets the fitting status and - * datatype values - */ - public void startElement(String uri, String localName, String qName, - Attributes attributes) { - if (localName.equals("key")) { - status += IN_KEY; - return; - } - if (localName.equals("value")) { - status += IN_VALUE; - return; - } - if (localName.equals("entry")) { - return; - } - if (localName.equals("foray-config")) { - return; - } - // to make sure that user knows about false tag - logger.error(getFormattedLocation() + "\nUnknown tag in " - + "configuration file: " + localName); - } // end startElement - - /** - * stores subentries or entries into their hashes (map for subentries, - * configuration for entry) - */ - public void endElement(String uri, String localName, String qName) { - if (localName.equals("entry")) { - this.store(key, value); - status = OUT; - key = ""; - value = ""; - } else if (localName.equals("key")) { - status -= IN_KEY; - } else if (localName.equals("value")) { - status -= IN_VALUE; - } - } - - /** - * extracts characters from text nodes and puts them into their respective - * variables - */ - public void characters(char[] ch, int start, int length) { - char characters[] = new char[length]; - System.arraycopy(ch, start, characters, 0, length); - String text = new String(characters); - switch (status) { - case IN_KEY: - key = text; - break; - case IN_VALUE: - value = text; - break; - } - } // end characters - - /** - * stores configuration entry into configuration Map according to the role - * - * @param key a string containing the key value for the configuration - * @param value a string containing the value for the configuration - */ - private void store(String key, String value) { - // Try the SessionConfig first. - if (this.sessionConfig.parseOption(key, value, - SessionConfig.PRECEDENCE_CONFIG_FILE)) { - return; - } - // Now try the OutputConfig. - this.outputConfig.parseOption(key, value, - SessionConfig.PRECEDENCE_CONFIG_FILE); - } - - /** - * Put the location information in a format suitable for logging and error - * messages. - * @return The location information, formatted. - */ - private String getFormattedLocation() { - if (locator == null) { - return ""; - } - return locator.getSystemId() + ":" + locator.getLineNumber() + ":" - + locator.getColumnNumber(); - } - -} Modified: trunk/foray/foray-app/src/java/org/foray/app/Options.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/app/Options.java 2006-05-26 19:14:47 UTC (rev 7272) +++ trunk/foray/foray-app/src/java/org/foray/app/Options.java 2006-05-26 19:24:09 UTC (rev 7273) @@ -24,6 +24,7 @@ package org.foray.app; +import org.foray.core.ConfigurationParser; import org.foray.core.FOrayException; import org.foray.core.InputHandler; import org.foray.core.SessionConfig; Modified: trunk/foray/foray-core/.classpath =================================================================== --- trunk/foray/foray-core/.classpath 2006-05-26 19:14:47 UTC (rev 7272) +++ trunk/foray/foray-core/.classpath 2006-05-26 19:24:09 UTC (rev 7273) @@ -4,5 +4,6 @@ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> <classpathentry kind="var" path="FORAY_LIB_ROOT/commons-logging.jar"/> <classpathentry combineaccessrules="false" kind="src" path="/FOrayCommon"/> + <classpathentry combineaccessrules="false" kind="src" path="/FOrayOutput"/> <classpathentry kind="output" path="build/eclipse"/> </classpath> Copied: trunk/foray/foray-core/src/java/org/foray/core/ConfigurationParser.java (from rev 7268, trunk/foray/foray-app/src/java/org/foray/app/ConfigurationParser.java) =================================================================== --- trunk/foray/foray-core/src/java/org/foray/core/ConfigurationParser.java (rev 0) +++ trunk/foray/foray-core/src/java/org/foray/core/ConfigurationParser.java 2006-05-26 19:24:09 UTC (rev 7273) @@ -0,0 +1,247 @@ +/* + * Copyright 2004 The FOray Project. + * http://www.foray.org + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * This work is in part derived from the following work(s), used with the + * permission of the licensor: + * Apache FOP, licensed by the Apache Software Foundation + * + */ + +/* $Id$ */ + +package org.foray.core; + +import org.foray.output.OutputConfig; + +import org.apache.commons.logging.Log; + +import org.xml.sax.Attributes; +import org.xml.sax.InputSource; +import org.xml.sax.Locator; +import org.xml.sax.SAXException; +import org.xml.sax.XMLReader; +import org.xml.sax.helpers.DefaultHandler; + +import java.io.IOException; + +import javax.xml.parsers.SAXParserFactory; + +/** + * SAX2 Handler which retrieves the configuration information and stores them + * in Configuration. + * Normally this class doesn't need to be accessed directly. + */ +public class ConfigurationParser extends DefaultHandler { + /* + * TODO: These should all be changed to boolean values. + */ + private static final int OUT = 0; + private static final int IN_KEY = 2; + private static final int IN_VALUE = 4; + + // state of parser + private int status = OUT; + + // store the result configuration + private SessionConfig sessionConfig; + private OutputConfig outputConfig; + + // stores key for new config entry + private String key = ""; + + // stores string value + private String value = ""; + + /** + * locator for line number information + */ + private Locator locator; + + /** inputsource for configuration file */ + private InputSource filename; + + /** The logger that should be used by this parser. */ + private Log logger; + + /** + * Constructor. + * @param sessionConfig The SessionConfig instance which should be updated + * with general options found in the configuration file. + * @param outputConfig The RenderConfig instance which should be updated + * with renderer-specific options found in the configuration file. + * @param source the SAX InputSource which encapsulates the configuration + * file XML that should be parsed. + * @param logger The logger to which errors and other messages + * should be sent. + */ + public ConfigurationParser(SessionConfig sessionConfig, + OutputConfig outputConfig, InputSource source, Log logger) + throws FOrayException { + this.sessionConfig = sessionConfig; + this.outputConfig = outputConfig; + this.filename = source; + this.logger = logger; + if (this.sessionConfig == null) { + throw new FOrayException("Session Configuration is null."); + } + if (this.outputConfig == null) { + throw new FOrayException("Output Configuration is null."); + } + } + + /** + * Parses the encapsulated SAX InputSource and updates the encapsulated + * Configuration instances accordingly. + * @throws FOrayException If there are errors parsing the input. + */ + public void parseDocument() throws FOrayException { + XMLReader parser = createParser(); + parser.setContentHandler(this); + try { + parser.parse(filename); + } catch (SAXException e) { + if (e.getException() instanceof FOrayException) { + throw (FOrayException)e.getException(); + } + throw new FOrayException(e); + } catch (IOException e) { + throw new FOrayException(e); + } + } + + /** + * creates a SAX parser + * + * @return the created SAX parser + */ + private XMLReader createParser() throws FOrayException { + try { + SAXParserFactory spf = javax.xml.parsers.SAXParserFactory + .newInstance(); + spf.setNamespaceAware(true); + XMLReader xmlReader = spf.newSAXParser().getXMLReader(); + logger.info("Config: Using " + + xmlReader.getClass().getName() + " as SAX2 Parser."); + return xmlReader; + } catch (javax.xml.parsers.ParserConfigurationException e) { + throw new FOrayException(e); + } catch (SAXException e) { + throw new FOrayException(e); + } + } + + public void startDocument() { + } + + /** + * Set the locator which is used to report the position of the element + * in the source document. + */ + public void setDocumentLocator(Locator locator) { + this.locator = locator; + } + + /** + * extracts the element and attribute name and sets the fitting status and + * datatype values + */ + public void startElement(String uri, String localName, String qName, + Attributes attributes) { + if (localName.equals("key")) { + status += IN_KEY; + return; + } + if (localName.equals("value")) { + status += IN_VALUE; + return; + } + if (localName.equals("entry")) { + return; + } + if (localName.equals("foray-config")) { + return; + } + // to make sure that user knows about false tag + logger.error(getFormattedLocation() + "\nUnknown tag in " + + "configuration file: " + localName); + } // end startElement + + /** + * stores subentries or entries into their hashes (map for subentries, + * configuration for entry) + */ + public void endElement(String uri, String localName, String qName) { + if (localName.equals("entry")) { + this.store(key, value); + status = OUT; + key = ""; + value = ""; + } else if (localName.equals("key")) { + status -= IN_KEY; + } else if (localName.equals("value")) { + status -= IN_VALUE; + } + } + + /** + * extracts characters from text nodes and puts them into their respective + * variables + */ + public void characters(char[] ch, int start, int length) { + char characters[] = new char[length]; + System.arraycopy(ch, start, characters, 0, length); + String text = new String(characters); + switch (status) { + case IN_KEY: + key = text; + break; + case IN_VALUE: + value = text; + break; + } + } // end characters + + /** + * stores configuration entry into configuration Map according to the role + * + * @param key a string containing the key value for the configuration + * @param value a string containing the value for the configuration + */ + private void store(String key, String value) { + // Try the SessionConfig first. + if (this.sessionConfig.parseOption(key, value, + SessionConfig.PRECEDENCE_CONFIG_FILE)) { + return; + } + // Now try the OutputConfig. + this.outputConfig.parseOption(key, value, + SessionConfig.PRECEDENCE_CONFIG_FILE); + } + + /** + * Put the location information in a format suitable for logging and error + * messages. + * @return The location information, formatted. + */ + private String getFormattedLocation() { + if (locator == null) { + return ""; + } + return locator.getSystemId() + ":" + locator.getLineNumber() + ":" + + locator.getColumnNumber(); + } + +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <vic...@us...> - 2006-05-26 19:14:56
|
Revision: 7272 Author: victormote Date: 2006-05-26 12:14:47 -0700 (Fri, 26 May 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=7272&view=rev Log Message: ----------- Add some javadoc. Added Paths: ----------- trunk/foray/foray-core/src/java/org/foray/core/package.html Added: trunk/foray/foray-core/src/java/org/foray/core/package.html =================================================================== --- trunk/foray/foray-core/src/java/org/foray/core/package.html (rev 0) +++ trunk/foray/foray-core/src/java/org/foray/core/package.html 2006-05-26 19:14:47 UTC (rev 7272) @@ -0,0 +1,6 @@ +<html> +<title>org.foray.core Package</title> +<body> +<p>The core processing classes for the application as a whole.</p> +</body> +</html> Property changes on: trunk/foray/foray-core/src/java/org/foray/core/package.html ___________________________________________________________________ Name: svn:keywords + "Author Id Rev Date URL" Name: svn:eol-style + native This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <vic...@us...> - 2006-05-26 19:01:13
|
Revision: 7271 Author: victormote Date: 2006-05-26 12:00:37 -0700 (Fri, 26 May 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=7271&view=rev Log Message: ----------- Move more classes to core package. Modified Paths: -------------- trunk/foray/foray-app/src/java/org/foray/app/CommandLineOptions.java trunk/foray/foray-app/src/java/org/foray/app/FOrayDocument.java trunk/foray/foray-app/src/java/org/foray/app/Options.java trunk/foray/foray-app/src/java/org/foray/app/Starter.java trunk/foray/foray-app/src/java/org/foray/app/ant/FOrayAntTaskStarter.java trunk/foray/foray-app/src/java/org/foray/app/test/TestConverter.java trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoAWTViewer.java trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoFO2PDF.java trunk/foray/foray-app/src/java/org/foray/demo/servlet/AbstractDemoServlet.java trunk/foray/foray-app/src/java/org/foray/demo/servlet/DemoPrintServlet.java trunk/foray/foray-app/src/java/org/foray/demo/servlet/DemoServlet.java Added Paths: ----------- trunk/foray/foray-core/src/java/org/foray/core/DocumentInputSource.java trunk/foray/foray-core/src/java/org/foray/core/DocumentReader.java trunk/foray/foray-core/src/java/org/foray/core/FOInputHandler.java trunk/foray/foray-core/src/java/org/foray/core/InputHandler.java trunk/foray/foray-core/src/java/org/foray/core/TraxInputHandler.java Removed Paths: ------------- trunk/foray/foray-app/src/java/org/foray/app/DocumentInputSource.java trunk/foray/foray-app/src/java/org/foray/app/DocumentReader.java trunk/foray/foray-app/src/java/org/foray/app/FOInputHandler.java trunk/foray/foray-app/src/java/org/foray/app/InputHandler.java trunk/foray/foray-app/src/java/org/foray/app/TraxInputHandler.java Modified: trunk/foray/foray-app/src/java/org/foray/app/CommandLineOptions.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/app/CommandLineOptions.java 2006-05-26 18:34:03 UTC (rev 7270) +++ trunk/foray/foray-app/src/java/org/foray/app/CommandLineOptions.java 2006-05-26 19:00:37 UTC (rev 7271) @@ -25,8 +25,11 @@ package org.foray.app; import org.foray.common.Logging; +import org.foray.core.FOInputHandler; import org.foray.core.FOrayException; +import org.foray.core.InputHandler; import org.foray.core.SessionConfig; +import org.foray.core.TraxInputHandler; import org.foray.output.OutputConfig; import org.apache.commons.logging.Log; Deleted: trunk/foray/foray-app/src/java/org/foray/app/DocumentInputSource.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/app/DocumentInputSource.java 2006-05-26 18:34:03 UTC (rev 7270) +++ trunk/foray/foray-app/src/java/org/foray/app/DocumentInputSource.java 2006-05-26 19:00:37 UTC (rev 7271) @@ -1,59 +0,0 @@ -/* - * Copyright 2004 The FOray Project. - * http://www.foray.org - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * This work is in part derived from the following work(s), used with the - * permission of the licensor: - * Apache FOP, licensed by the Apache Software Foundation - * - */ - -/* $Id$ */ - -package org.foray.app; - -import org.w3c.dom.Document; -import org.xml.sax.InputSource; - -/** - * This is an InputSource to be used with DocumentReader. - * - * @author Kelly A Campbell - * - */ - -public class DocumentInputSource extends InputSource { - private Document _document; - - public DocumentInputSource() { - super(); - } - - public DocumentInputSource(Document document) { - this(); - _document = document; - } - - public Document getDocument() { - return _document; - } - - public void setDocument(Document document) { - _document = document; - } - -} - - Deleted: trunk/foray/foray-app/src/java/org/foray/app/DocumentReader.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/app/DocumentReader.java 2006-05-26 18:34:03 UTC (rev 7270) +++ trunk/foray/foray-app/src/java/org/foray/app/DocumentReader.java 2006-05-26 19:00:37 UTC (rev 7271) @@ -1,515 +0,0 @@ -/* - * Copyright 2004 The FOray Project. - * http://www.foray.org - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * This work is in part derived from the following work(s), used with the - * permission of the licensor: - * Apache FOP, licensed by the Apache Software Foundation - * - */ - -/* $Id$ */ - -package org.foray.app; - - -import org.w3c.dom.Attr; -import org.w3c.dom.Document; -import org.w3c.dom.NamedNodeMap; -import org.w3c.dom.Node; -import org.xml.sax.ContentHandler; -import org.xml.sax.DTDHandler; -import org.xml.sax.EntityResolver; -import org.xml.sax.ErrorHandler; -import org.xml.sax.InputSource; -import org.xml.sax.SAXException; -import org.xml.sax.SAXNotRecognizedException; -import org.xml.sax.SAXNotSupportedException; -import org.xml.sax.XMLReader; -import org.xml.sax.helpers.AttributesImpl; - -import java.io.IOException; - -/** - * This presents a DOM as an XMLReader to make it easy to use a Document - * with a SAX-based implementation. - * - * @author Kelly A Campbell - * - */ - -public class DocumentReader implements XMLReader { - - // ////////////////////////////////////////////////////////////////// - // Configuration. - // ////////////////////////////////////////////////////////////////// - private boolean _namespaces = true; - private boolean _namespace_prefixes = true; - - - /** - * Look up the value of a feature. - * - * <p>The feature name is any fully-qualified URI. It is - * possible for an XMLReader to recognize a feature name but - * to be unable to return its value; this is especially true - * in the case of an adapter for a SAX1 Parser, which has - * no way of knowing whether the underlying parser is - * performing validation or expanding external entities.</p> - * - * <p>All XMLReaders are required to recognize the - * http://xml.org/sax/features/namespaces and the - * http://xml.org/sax/features/namespace-prefixes feature names.</p> - * - * <p>Some feature values may be available only in specific - * contexts, such as before, during, or after a parse.</p> - * - * <p>Typical usage is something like this:</p> - * - * <pre> - * XMLReader r = new MySAXDriver(); - * - * // try to activate validation - * try { - * r.setFeature("http://xml.org/sax/features/validation", true); - * } catch (SAXException e) { - * getLogger().error("Cannot activate validation."); - * } - * - * // register event handlers - * r.setContentHandler(new MyContentHandler()); - * r.setErrorHandler(new MyErrorHandler()); - * - * // parse the first document - * try { - * r.parse("http://www.foo.com/mydoc.xml"); - * } catch (IOException e) { - * getLogger().error("I/O exception reading XML document"); - * } catch (SAXException e) { - * getLogger().error("XML exception reading document."); - * } - * </pre> - * - * <p>Implementors are free (and encouraged) to invent their own features, - * using names built on their own URIs.</p> - * - * @param name The feature name, which is a fully-qualified URI. - * @return The current state of the feature (true or false). - * @exception SAXNotRecognizedException When the - * XMLReader does not recognize the feature name. - * @exception SAXNotSupportedException When the - * XMLReader recognizes the feature name but - * cannot determine its value at this time. - * @see #setFeature - */ - public boolean getFeature(String name) - throws SAXNotRecognizedException, SAXNotSupportedException { - if ("http://xml.org/sax/features/namespaces".equals(name)) { - return _namespaces; - } else if ( - "http://xml.org/sax/features/namespace-prefixes".equals(name)) { - return _namespace_prefixes; - } else { - throw new SAXNotRecognizedException("Feature '" + name - + "' not recognized or supported by Document2SAXAdapter"); - } - - } - - /** - * Set the state of a feature. - * - * <p>The feature name is any fully-qualified URI. It is - * possible for an XMLReader to recognize a feature name but - * to be unable to set its value; this is especially true - * in the case of an adapter for a SAX1 Parser, - * which has no way of affecting whether the underlying parser is - * validating, for example.</p> - * - * <p>All XMLReaders are required to support setting - * http://xml.org/sax/features/namespaces to true and - * http://xml.org/sax/features/namespace-prefixes to false.</p> - * - * <p>Some feature values may be immutable or mutable only - * in specific contexts, such as before, during, or after - * a parse.</p> - * - * @param name The feature name, which is a fully-qualified URI. - * @param value The requested state of the feature (true or false). - * @exception SAXNotRecognizedException When the - * XMLReader does not recognize the feature name. - * @exception SAXNotSupportedException When the - * XMLReader recognizes the feature name but - * cannot set the requested value. - * @see #getFeature - */ - public void setFeature(String name, boolean value) - throws SAXNotRecognizedException, SAXNotSupportedException { - if ("http://xml.org/sax/features/namespaces".equals(name)) { - _namespaces = value; - } else if ( - "http://xml.org/sax/features/namespace-prefixes".equals(name)) { - _namespace_prefixes = value; - } else { - throw new SAXNotRecognizedException("Feature '" + name - + "' not recognized or supported by Document2SAXAdapter"); - } - - } - - - - /** - * Look up the value of a property. - * - * <p>The property name is any fully-qualified URI. It is - * possible for an XMLReader to recognize a property name but - * to be unable to return its state; this is especially true - * in the case of an adapter for a SAX1 Parser.</p> - * - * <p>XMLReaders are not required to recognize any specific - * property names, though an initial core set is documented for - * SAX2.</p> - * - * <p>Some property values may be available only in specific - * contexts, such as before, during, or after a parse.</p> - * - * <p>Implementors are free (and encouraged) to invent their own properties, - * using names built on their own URIs.</p> - * - * @param name The property name, which is a fully-qualified URI. - * @return The current value of the property. - * @exception SAXNotRecognizedException When the - * XMLReader does not recognize the property name. - * @exception SAXNotSupportedException When the - * XMLReader recognizes the property name but - * cannot determine its value at this time. - * @see #setProperty - */ - public Object getProperty(String name) - throws SAXNotRecognizedException, SAXNotSupportedException { - throw new SAXNotRecognizedException("Property '" + name - + "' not recognized or supported by Document2SAXAdapter"); - } - - /** - * Set the value of a property. - * - * <p>The property name is any fully-qualified URI. It is - * possible for an XMLReader to recognize a property name but - * to be unable to set its value; this is especially true - * in the case of an adapter for a SAX1 Parser.</p> - * - * <p>XMLReaders are not required to recognize setting - * any specific property names, though a core set is provided with - * SAX2.</p> - * - * <p>Some property values may be immutable or mutable only - * in specific contexts, such as before, during, or after - * a parse.</p> - * - * <p>This method is also the standard mechanism for setting - * extended handlers.</p> - * - * @param name The property name, which is a fully-qualified URI. - * @param value The requested value for the property. - * @exception SAXNotRecognizedException When the - * XMLReader does not recognize the property name. - * @exception SAXNotSupportedException When the - * XMLReader recognizes the property name but - * cannot set the requested value. - */ - public void setProperty(String name, Object value) - throws SAXNotRecognizedException, SAXNotSupportedException { - throw new SAXNotRecognizedException("Property '" + name - + "' not recognized or supported by Document2SAXAdapter"); - } - - - - // ////////////////////////////////////////////////////////////////// - // Event handlers. - // ////////////////////////////////////////////////////////////////// - private EntityResolver _entityResolver = null; - private DTDHandler _dtdHandler = null; - private ContentHandler _contentHandler = null; - private ErrorHandler _errorHandler = null; - - - /** - * Allow an application to register an entity resolver. - * - * <p>If the application does not register an entity resolver, - * the XMLReader will perform its own default resolution.</p> - * - * <p>Applications may register a new or different resolver in the - * middle of a parse, and the SAX parser must begin using the new - * resolver immediately.</p> - * - * @param resolver The entity resolver. - * @see #getEntityResolver - */ - public void setEntityResolver(EntityResolver resolver) { - _entityResolver = resolver; - } - - - - /** - * Return the current entity resolver. - * - * @return The current entity resolver, or null if none - * has been registered. - * @see #setEntityResolver - */ - public EntityResolver getEntityResolver() { - return _entityResolver; - } - - - - /** - * Allow an application to register a DTD event handler. - * - * <p>If the application does not register a DTD handler, all DTD - * events reported by the SAX parser will be silently ignored.</p> - * - * <p>Applications may register a new or different handler in the - * middle of a parse, and the SAX parser must begin using the new - * handler immediately.</p> - * - * @param handler The DTD handler. - * @see #getDTDHandler - */ - public void setDTDHandler(DTDHandler handler) { - _dtdHandler = handler; - } - - - - /** - * Return the current DTD handler. - * - * @return The current DTD handler, or null if none - * has been registered. - * @see #setDTDHandler - */ - public DTDHandler getDTDHandler() { - return _dtdHandler; - } - - - - /** - * Allow an application to register a content event handler. - * - * <p>If the application does not register a content handler, all - * content events reported by the SAX parser will be silently - * ignored.</p> - * - * <p>Applications may register a new or different handler in the - * middle of a parse, and the SAX parser must begin using the new - * handler immediately.</p> - * - * @param handler The content handler. - * @see #getContentHandler - */ - public void setContentHandler(ContentHandler handler) { - _contentHandler = handler; - } - - /** - * Return the current content handler. - * - * @return The current content handler, or null if none - * has been registered. - * @see #setContentHandler - */ - public ContentHandler getContentHandler() { - return _contentHandler; - } - - - - /** - * Allow an application to register an error event handler. - * - * <p>If the application does not register an error handler, all - * error events reported by the SAX parser will be silently - * ignored; however, normal processing may not continue. It is - * highly recommended that all SAX applications implement an - * error handler to avoid unexpected bugs.</p> - * - * <p>Applications may register a new or different handler in the - * middle of a parse, and the SAX parser must begin using the new - * handler immediately.</p> - * - * @param handler The error handler. - * @see #getErrorHandler - */ - public void setErrorHandler(ErrorHandler handler) { - _errorHandler = handler; - } - - /** - * Return the current error handler. - * - * @return The current error handler, or null if none - * has been registered. - * @see #setErrorHandler - */ - public ErrorHandler getErrorHandler() { - return _errorHandler; - } - - - - // ////////////////////////////////////////////////////////////////// - // Parsing. - // ////////////////////////////////////////////////////////////////// - - /** - * Parse an XML DOM document. - * @param input The input source for the top-level of the XML document. - * @exception SAXException Any SAX exception, possibly - * wrapping another exception. - * @exception IOException An IO exception from the parser, - * possibly from a byte stream or character stream - * supplied by the application. - * @see org.xml.sax.InputSource - * @see #parse(String) - * @see #setEntityResolver - * @see #setDTDHandler - * @see #setContentHandler - * @see #setErrorHandler - */ - public void parse(InputSource input) throws IOException, SAXException { - if (input instanceof DocumentInputSource) { - Document document = ((DocumentInputSource)input).getDocument(); - if (_contentHandler == null) { - throw new SAXException("ContentHandler is null. Please use " - + "setContentHandler()"); - } - - /* most of this code is modified from John Cowan's */ - - Node currentNode; - AttributesImpl currentAtts; - - /* temporary array for making Strings into character arrays */ - char[] array = null; - - currentAtts = new AttributesImpl(); - - /* start at the document element */ - currentNode = document; - while (currentNode != null) { - switch (currentNode.getNodeType()) { - case Node.DOCUMENT_NODE: - _contentHandler.startDocument(); - break; - case Node.CDATA_SECTION_NODE: - case Node.TEXT_NODE: - String data = currentNode.getNodeValue(); - int datalen = data.length(); - if (array == null || array.length < datalen) { - /* - * if the array isn't big enough, make a new - * one - */ - array = new char[datalen]; - } - data.getChars(0, datalen, array, 0); - _contentHandler.characters(array, 0, datalen); - break; - case Node.PROCESSING_INSTRUCTION_NODE: - _contentHandler.processingInstruction( - currentNode.getNodeName(), - currentNode.getNodeValue()); - break; - case Node.ELEMENT_NODE: - NamedNodeMap map = currentNode.getAttributes(); - currentAtts.clear(); - for (int i = map.getLength() - 1; i >= 0; i--) { - Attr att = (Attr)map.item(i); - currentAtts.addAttribute(att.getNamespaceURI(), - att.getLocalName(), - att.getName(), "CDATA", - att.getValue()); - } - _contentHandler.startElement(currentNode.getNamespaceURI(), - currentNode.getLocalName(), - currentNode.getNodeName(), - currentAtts); - break; - } - - Node nextNode = currentNode.getFirstChild(); - if (nextNode != null) { - currentNode = nextNode; - continue; - } - - while (currentNode != null) { - switch (currentNode.getNodeType()) { - case Node.DOCUMENT_NODE: - _contentHandler.endDocument(); - break; - case Node.ELEMENT_NODE: - _contentHandler.endElement( - currentNode.getNamespaceURI(), - currentNode.getLocalName(), - currentNode.getNodeName()); - break; - } - - nextNode = currentNode.getNextSibling(); - if (nextNode != null) { - currentNode = nextNode; - break; - } - - currentNode = currentNode.getParentNode(); - } - } - - } else { - throw new SAXException("DocumentReader only supports parsing of a " - + "DocumentInputSource"); - } - - } - - - - /** - * DocumentReader requires a DocumentInputSource, so this is not implements - * and simply throws a SAXException. - * Use parse(DocumentInputSource) instead - * - * @param systemId The system identifier (URI). - * @exception SAXException Any SAX exception, possibly - * wrapping another exception. - * @exception IOException An IO exception from the parser, - * possibly from a byte stream or character stream - * supplied by the application. - * @see #parse(InputSource) - */ - public void parse(String systemId) throws IOException, SAXException { - throw new SAXException("DocumentReader only supports parsing of a " - + "DocumentInputSource"); - } - -} Deleted: trunk/foray/foray-app/src/java/org/foray/app/FOInputHandler.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/app/FOInputHandler.java 2006-05-26 18:34:03 UTC (rev 7270) +++ trunk/foray/foray-app/src/java/org/foray/app/FOInputHandler.java 2006-05-26 19:00:37 UTC (rev 7271) @@ -1,68 +0,0 @@ -/* - * Copyright 2004 The FOray Project. - * http://www.foray.org - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * This work is in part derived from the following work(s), used with the - * permission of the licensor: - * Apache FOP, licensed by the Apache Software Foundation - * - */ - -/* $Id$ */ - -package org.foray.app; - - -import org.foray.core.FOrayException; - -import org.apache.commons.logging.Log; - -import org.xml.sax.InputSource; -import org.xml.sax.XMLReader; - -import java.io.File; -import java.io.IOException; -import java.net.URL; - -/** - * Manages input if it is an xsl:fo file - */ -public class FOInputHandler extends InputHandler { - - File fofile = null; - URL foURL = null; - - public FOInputHandler (Log logger, File fofile) { - super(logger); - this.fofile = fofile; - } - - public FOInputHandler (Log logger, URL url) { - super(logger); - this.foURL = url; - } - - public InputSource getInputSource () throws IOException { - if (fofile != null) { - return super.fileInputSource(fofile); - } - return super.urlInputSource(foURL); - } - - public XMLReader getParser() throws FOrayException { - return super.createParser(); - } - -} Modified: trunk/foray/foray-app/src/java/org/foray/app/FOrayDocument.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/app/FOrayDocument.java 2006-05-26 18:34:03 UTC (rev 7270) +++ trunk/foray/foray-app/src/java/org/foray/app/FOrayDocument.java 2006-05-26 19:00:37 UTC (rev 7271) @@ -25,6 +25,8 @@ package org.foray.app; import org.foray.common.XMLParser; +import org.foray.core.DocumentInputSource; +import org.foray.core.DocumentReader; import org.foray.core.FOrayException; import org.foray.core.SessionConfig; import org.foray.output.MIFConverter; Deleted: trunk/foray/foray-app/src/java/org/foray/app/InputHandler.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/app/InputHandler.java 2006-05-26 18:34:03 UTC (rev 7270) +++ trunk/foray/foray-app/src/java/org/foray/app/InputHandler.java 2006-05-26 19:00:37 UTC (rev 7271) @@ -1,103 +0,0 @@ -/* - * Copyright 2004 The FOray Project. - * http://www.foray.org - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * This work is in part derived from the following work(s), used with the - * permission of the licensor: - * Apache FOP, licensed by the Apache Software Foundation - * - */ - -/* $Id$ */ - -package org.foray.app; - - -import org.foray.core.FOrayException; - -import org.apache.commons.logging.Log; - -import org.xml.sax.InputSource; -import org.xml.sax.SAXException; -import org.xml.sax.XMLReader; - -import java.io.File; -import java.io.IOException; -import java.net.MalformedURLException; -import java.net.URL; - -import javax.xml.parsers.SAXParserFactory; - -public abstract class InputHandler { - - Log logger; - - public abstract InputSource getInputSource() throws IOException ; - public abstract XMLReader getParser() throws FOrayException; - - public InputHandler(Log logger) { - this.logger = logger; - } - - public static InputSource urlInputSource(URL url) throws IOException { - return new InputSource(url.openStream()); - } - - /** - * create an InputSource from a File - * - * @param file the File - * @return the InputSource created - */ - public static InputSource fileInputSource(File file) { - /* this code adapted from James Clark's in XT */ - String path = file.getAbsolutePath(); - String fSep = System.getProperty("file.separator"); - if (fSep != null && fSep.length() == 1) { - path = path.replace(fSep.charAt(0), '/'); - } - if (path.length() > 0 && path.charAt(0) != '/') { - path = '/' + path; - } - try { - return new InputSource(new URL("file", null, path).toString()); - } catch (MalformedURLException e) { - throw new Error("unexpected MalformedURLException"); - } - } - - /** - * creates a SAX parser - * - * @return the created SAX parser - */ - protected XMLReader createParser() throws FOrayException { - try { - SAXParserFactory spf - = javax.xml.parsers.SAXParserFactory.newInstance(); - spf.setNamespaceAware(true); - XMLReader xmlReader = spf.newSAXParser().getXMLReader(); - this.logger.info("FO Parsing: Using " - + xmlReader.getClass().getName() + " as SAX2 Parser."); - return xmlReader; - } catch (javax.xml.parsers.ParserConfigurationException e) { - throw new FOrayException(e); - } catch (SAXException e) { - throw new FOrayException(e); - } - } - -} - Modified: trunk/foray/foray-app/src/java/org/foray/app/Options.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/app/Options.java 2006-05-26 18:34:03 UTC (rev 7270) +++ trunk/foray/foray-app/src/java/org/foray/app/Options.java 2006-05-26 19:00:37 UTC (rev 7271) @@ -25,6 +25,7 @@ package org.foray.app; import org.foray.core.FOrayException; +import org.foray.core.InputHandler; import org.foray.core.SessionConfig; import org.foray.output.OutputConfig; Modified: trunk/foray/foray-app/src/java/org/foray/app/Starter.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/app/Starter.java 2006-05-26 18:34:03 UTC (rev 7270) +++ trunk/foray/foray-app/src/java/org/foray/app/Starter.java 2006-05-26 19:00:37 UTC (rev 7271) @@ -25,6 +25,7 @@ package org.foray.app; import org.foray.core.FOrayException; +import org.foray.core.InputHandler; import org.foray.core.SessionConfig; import org.foray.output.OutputConfig; Deleted: trunk/foray/foray-app/src/java/org/foray/app/TraxInputHandler.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/app/TraxInputHandler.java 2006-05-26 18:34:03 UTC (rev 7270) +++ trunk/foray/foray-app/src/java/org/foray/app/TraxInputHandler.java 2006-05-26 19:00:37 UTC (rev 7271) @@ -1,179 +0,0 @@ -/* - * Copyright 2004 The FOray Project. - * http://www.foray.org - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * This work is in part derived from the following work(s), used with the - * permission of the licensor: - * Apache FOP, licensed by the Apache Software Foundation - * - */ - -/* $Id$ */ - -package org.foray.app; - - - -import org.foray.core.FOrayException; - -import org.apache.commons.logging.Log; - -import org.xml.sax.InputSource; -import org.xml.sax.XMLFilter; -import org.xml.sax.XMLReader; - -import java.io.File; - -import javax.xml.transform.Source; -import javax.xml.transform.Transformer; -import javax.xml.transform.TransformerFactory; -import javax.xml.transform.sax.SAXResult; -import javax.xml.transform.sax.SAXSource; -import javax.xml.transform.sax.SAXTransformerFactory; -import javax.xml.transform.stream.StreamSource; - -/** - * XSLTInputHandler basically takes an xml source and transforms it with - * an xslt source and the resulting xsl:fo document is input for FOray. - */ -public class TraxInputHandler extends InputHandler { - private Transformer transformer; - private StreamSource xmlSource; - private Source xsltSource; - - public TraxInputHandler(Log logger, File xmlfile, File xsltfile) - throws FOrayException { - super(logger); - xmlSource = new StreamSource(xmlfile); - xsltSource = new StreamSource(xsltfile); - initTransformer(); - } - - public TraxInputHandler(Log logger, String xmlURL, String xsltURL) - throws FOrayException { - super(logger); - this.xmlSource = new StreamSource(xmlURL); - this.xsltSource = new StreamSource(xsltURL); - initTransformer(); - } - - public TraxInputHandler(Log logger, InputSource xmlSource, - InputSource xsltSource) throws FOrayException { - super(logger); - this.xmlSource = new StreamSource(xmlSource.getByteStream(), - xmlSource.getSystemId()); - this.xsltSource = new StreamSource(xsltSource.getByteStream(), - xsltSource.getSystemId()); - initTransformer(); - } - - private void initTransformer() throws FOrayException { - try { - transformer = TransformerFactory.newInstance().newTransformer( - xsltSource); - } - catch(Exception ex) { - throw new FOrayException(ex); - } - } - - /** - * Overwrites the method of the super class to return the xmlfile. - * Use run(Driver driver) instead. - * @deprecated - */ - public InputSource getInputSource() { - InputSource is = new InputSource(); - is.setByteStream(xmlSource.getInputStream()); - is.setSystemId(xmlSource.getSystemId()); - return is; - } - - /** - * Overwrites this method of the super class and returns an - * XMLFilter instead of a simple XMLReader which allows chaining - * of transformations. - * Use run(Driver driver) instead. - * @deprecated - * - */ - public XMLReader getParser() throws FOrayException { - return getXMLFilter(xsltSource); - } - - /** - * Creates from the transformer an instance of an XMLFilter which - * then can be used in a chain with the XMLReader passed to Driver. This way - * during the conversion of the xml file + xslt stylesheet the resulting - * data is fed into FOary. This should help to avoid memory problems - * @param xsltSource An xslt stylesheet. - * @return An XMLFilter which can be chained together with other XMLReaders - * or XMLFilters. - */ - private XMLFilter getXMLFilter(Source xsltSource) - throws FOrayException { - try { - // Instantiate a TransformerFactory. - TransformerFactory tFactory = TransformerFactory.newInstance(); - // Determine whether the TransformerFactory supports the - // use of SAXSource and SAXResult - if (tFactory.getFeature(SAXSource.FEATURE) - && tFactory.getFeature(SAXResult.FEATURE)) { - // Cast the TransformerFactory to SAXTransformerFactory. - SAXTransformerFactory saxTFactory = - ((SAXTransformerFactory)tFactory); - // Create an XMLFilter for each stylesheet. - XMLFilter xmlfilter = - saxTFactory.newXMLFilter(xsltSource); - - // Create an XMLReader. - XMLReader parser = createParser(); - if (parser == null) { - throw new FOrayException("Unable to create SAX parser"); - } - - // xmlFilter uses the XMLReader as its reader. - xmlfilter.setParent(parser); - return xmlfilter; - } - throw new FOrayException("Your parser doesn't support the " - + "features SAXSource and SAXResult.\n" - + "Use an XSL parser which supports TrAX"); - } catch (Exception ex) { - throw new FOrayException(ex); - } - } - - - /** - * Creates from the transformer an instance of an XMLFilter which - * then can be used in a chain with the XMLReader passed to Driver. This way - * during the conversion of the xml file + xslt stylesheet the resulting - * data is fed into FOray. This should help to avoid memory problems - * @param xmlfile The xmlfile containing the text data - * @param xsltfile An xslt stylesheet - * @return XMLFilter an XMLFilter which can be chained together with other - * XMLReaders or XMLFilters - */ - public XMLFilter getXMLFilter(File xmlfile, File xsltfile) - throws FOrayException { - return getXMLFilter(new StreamSource(xsltfile)); - } - - public void setParameter(String name, Object value) { - transformer.setParameter(name, value); - } - -} Modified: trunk/foray/foray-app/src/java/org/foray/app/ant/FOrayAntTaskStarter.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/app/ant/FOrayAntTaskStarter.java 2006-05-26 18:34:03 UTC (rev 7270) +++ trunk/foray/foray-app/src/java/org/foray/app/ant/FOrayAntTaskStarter.java 2006-05-26 19:00:37 UTC (rev 7271) @@ -24,14 +24,14 @@ package org.foray.app.ant; -import org.foray.app.FOInputHandler; import org.foray.app.FOrayDocument; import org.foray.app.FOraySession; import org.foray.app.FOrayTarget; -import org.foray.app.InputHandler; import org.foray.app.Options; import org.foray.app.Starter; +import org.foray.core.FOInputHandler; import org.foray.core.FOrayException; +import org.foray.core.InputHandler; import org.foray.core.SessionConfig; import org.foray.output.OutputConfig; import org.foray.output.OutputTarget; Modified: trunk/foray/foray-app/src/java/org/foray/app/test/TestConverter.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/app/test/TestConverter.java 2006-05-26 18:34:03 UTC (rev 7270) +++ trunk/foray/foray-app/src/java/org/foray/app/test/TestConverter.java 2006-05-26 19:00:37 UTC (rev 7271) @@ -24,15 +24,15 @@ package org.foray.app.test; -import org.foray.app.FOInputHandler; import org.foray.app.FOrayDocument; import org.foray.app.FOraySession; import org.foray.app.FOrayTarget; -import org.foray.app.InputHandler; -import org.foray.app.TraxInputHandler; import org.foray.common.Logging; +import org.foray.core.FOInputHandler; import org.foray.core.FOrayException; +import org.foray.core.InputHandler; import org.foray.core.SessionConfig; +import org.foray.core.TraxInputHandler; import org.foray.output.OutputConfig; import org.foray.output.OutputTarget; Modified: trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoAWTViewer.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoAWTViewer.java 2006-05-26 18:34:03 UTC (rev 7270) +++ trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoAWTViewer.java 2006-05-26 19:00:37 UTC (rev 7271) @@ -34,13 +34,13 @@ import javax.xml.transform.TransformerException; -import org.foray.app.FOInputHandler; import org.foray.app.FOrayDocument; import org.foray.app.FOraySession; import org.foray.app.FOrayTarget; -import org.foray.app.InputHandler; import org.foray.core.Application; +import org.foray.core.FOInputHandler; import org.foray.core.FOrayException; +import org.foray.core.InputHandler; import org.foray.core.SessionConfig; import org.foray.render.awt.AWTRenderer; import org.foray.render.awt.viewer.PreviewDialog; Modified: trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoFO2PDF.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoFO2PDF.java 2006-05-26 18:34:03 UTC (rev 7270) +++ trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoFO2PDF.java 2006-05-26 19:00:37 UTC (rev 7271) @@ -29,13 +29,13 @@ import java.io.IOException; import java.io.OutputStream; -import org.foray.app.FOInputHandler; import org.foray.app.FOrayDocument; import org.foray.app.FOraySession; import org.foray.app.FOrayTarget; -import org.foray.app.InputHandler; import org.foray.core.Application; +import org.foray.core.FOInputHandler; import org.foray.core.FOrayException; +import org.foray.core.InputHandler; import org.foray.core.SessionConfig; import org.foray.output.OutputTarget; Modified: trunk/foray/foray-app/src/java/org/foray/demo/servlet/AbstractDemoServlet.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/demo/servlet/AbstractDemoServlet.java 2006-05-26 18:34:03 UTC (rev 7270) +++ trunk/foray/foray-app/src/java/org/foray/demo/servlet/AbstractDemoServlet.java 2006-05-26 19:00:37 UTC (rev 7271) @@ -24,13 +24,13 @@ package org.foray.demo.servlet; -import org.foray.app.FOInputHandler; import org.foray.app.FOrayDocument; import org.foray.app.FOraySession; import org.foray.app.FOrayTarget; -import org.foray.app.InputHandler; import org.foray.common.Logging; +import org.foray.core.FOInputHandler; import org.foray.core.FOrayException; +import org.foray.core.InputHandler; import org.foray.core.SessionConfig; import org.foray.output.OutputTarget; Modified: trunk/foray/foray-app/src/java/org/foray/demo/servlet/DemoPrintServlet.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/demo/servlet/DemoPrintServlet.java 2006-05-26 18:34:03 UTC (rev 7270) +++ trunk/foray/foray-app/src/java/org/foray/demo/servlet/DemoPrintServlet.java 2006-05-26 19:00:37 UTC (rev 7271) @@ -27,8 +27,8 @@ import org.foray.app.FOrayDocument; import org.foray.app.FOraySession; import org.foray.app.FOrayTarget; -import org.foray.app.InputHandler; import org.foray.core.FOrayException; +import org.foray.core.InputHandler; import org.foray.render.awt.AWTPrintRenderer; import java.awt.print.PrinterJob ; Modified: trunk/foray/foray-app/src/java/org/foray/demo/servlet/DemoServlet.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/demo/servlet/DemoServlet.java 2006-05-26 18:34:03 UTC (rev 7270) +++ trunk/foray/foray-app/src/java/org/foray/demo/servlet/DemoServlet.java 2006-05-26 19:00:37 UTC (rev 7271) @@ -27,8 +27,8 @@ import org.foray.app.FOrayDocument; import org.foray.app.FOraySession; import org.foray.app.FOrayTarget; -import org.foray.app.InputHandler; import org.foray.core.FOrayException; +import org.foray.core.InputHandler; import org.foray.output.OutputTarget; import java.io.ByteArrayOutputStream; Copied: trunk/foray/foray-core/src/java/org/foray/core/DocumentInputSource.java (from rev 7265, trunk/foray/foray-app/src/java/org/foray/app/DocumentInputSource.java) =================================================================== --- trunk/foray/foray-core/src/java/org/foray/core/DocumentInputSource.java (rev 0) +++ trunk/foray/foray-core/src/java/org/foray/core/DocumentInputSource.java 2006-05-26 19:00:37 UTC (rev 7271) @@ -0,0 +1,59 @@ +/* + * Copyright 2004 The FOray Project. + * http://www.foray.org + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * This work is in part derived from the following work(s), used with the + * permission of the licensor: + * Apache FOP, licensed by the Apache Software Foundation + * + */ + +/* $Id$ */ + +package org.foray.core; + +import org.w3c.dom.Document; +import org.xml.sax.InputSource; + +/** + * This is an InputSource to be used with DocumentReader. + * + * @author Kelly A Campbell + * + */ + +public class DocumentInputSource extends InputSource { + private Document _document; + + public DocumentInputSource() { + super(); + } + + public DocumentInputSource(Document document) { + this(); + _document = document; + } + + public Document getDocument() { + return _document; + } + + public void setDocument(Document document) { + _document = document; + } + +} + + Copied: trunk/foray/foray-core/src/java/org/foray/core/DocumentReader.java (from rev 7265, trunk/foray/foray-app/src/java/org/foray/app/DocumentReader.java) =================================================================== --- trunk/foray/foray-core/src/java/org/foray/core/DocumentReader.java (rev 0) +++ trunk/foray/foray-core/src/java/org/foray/core/DocumentReader.java 2006-05-26 19:00:37 UTC (rev 7271) @@ -0,0 +1,515 @@ +/* + * Copyright 2004 The FOray Project. + * http://www.foray.org + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * This work is in part derived from the following work(s), used with the + * permission of the licensor: + * Apache FOP, licensed by the Apache Software Foundation + * + */ + +/* $Id$ */ + +package org.foray.core; + + +import org.w3c.dom.Attr; +import org.w3c.dom.Document; +import org.w3c.dom.NamedNodeMap; +import org.w3c.dom.Node; +import org.xml.sax.ContentHandler; +import org.xml.sax.DTDHandler; +import org.xml.sax.EntityResolver; +import org.xml.sax.ErrorHandler; +import org.xml.sax.InputSource; +import org.xml.sax.SAXException; +import org.xml.sax.SAXNotRecognizedException; +import org.xml.sax.SAXNotSupportedException; +import org.xml.sax.XMLReader; +import org.xml.sax.helpers.AttributesImpl; + +import java.io.IOException; + +/** + * This presents a DOM as an XMLReader to make it easy to use a Document + * with a SAX-based implementation. + * + * @author Kelly A Campbell + * + */ + +public class DocumentReader implements XMLReader { + + // ////////////////////////////////////////////////////////////////// + // Configuration. + // ////////////////////////////////////////////////////////////////// + private boolean _namespaces = true; + private boolean _namespace_prefixes = true; + + + /** + * Look up the value of a feature. + * + * <p>The feature name is any fully-qualified URI. It is + * possible for an XMLReader to recognize a feature name but + * to be unable to return its value; this is especially true + * in the case of an adapter for a SAX1 Parser, which has + * no way of knowing whether the underlying parser is + * performing validation or expanding external entities.</p> + * + * <p>All XMLReaders are required to recognize the + * http://xml.org/sax/features/namespaces and the + * http://xml.org/sax/features/namespace-prefixes feature names.</p> + * + * <p>Some feature values may be available only in specific + * contexts, such as before, during, or after a parse.</p> + * + * <p>Typical usage is something like this:</p> + * + * <pre> + * XMLReader r = new MySAXDriver(); + * + * // try to activate validation + * try { + * r.setFeature("http://xml.org/sax/features/validation", true); + * } catch (SAXException e) { + * getLogger().error("Cannot activate validation."); + * } + * + * // register event handlers + * r.setContentHandler(new MyContentHandler()); + * r.setErrorHandler(new MyErrorHandler()); + * + * // parse the first document + * try { + * r.parse("http://www.foo.com/mydoc.xml"); + * } catch (IOException e) { + * getLogger().error("I/O exception reading XML document"); + * } catch (SAXException e) { + * getLogger().error("XML exception reading document."); + * } + * </pre> + * + * <p>Implementors are free (and encouraged) to invent their own features, + * using names built on their own URIs.</p> + * + * @param name The feature name, which is a fully-qualified URI. + * @return The current state of the feature (true or false). + * @exception SAXNotRecognizedException When the + * XMLReader does not recognize the feature name. + * @exception SAXNotSupportedException When the + * XMLReader recognizes the feature name but + * cannot determine its value at this time. + * @see #setFeature + */ + public boolean getFeature(String name) + throws SAXNotRecognizedException, SAXNotSupportedException { + if ("http://xml.org/sax/features/namespaces".equals(name)) { + return _namespaces; + } else if ( + "http://xml.org/sax/features/namespace-prefixes".equals(name)) { + return _namespace_prefixes; + } else { + throw new SAXNotRecognizedException("Feature '" + name + + "' not recognized or supported by Document2SAXAdapter"); + } + + } + + /** + * Set the state of a feature. + * + * <p>The feature name is any fully-qualified URI. It is + * possible for an XMLReader to recognize a feature name but + * to be unable to set its value; this is especially true + * in the case of an adapter for a SAX1 Parser, + * which has no way of affecting whether the underlying parser is + * validating, for example.</p> + * + * <p>All XMLReaders are required to support setting + * http://xml.org/sax/features/namespaces to true and + * http://xml.org/sax/features/namespace-prefixes to false.</p> + * + * <p>Some feature values may be immutable or mutable only + * in specific contexts, such as before, during, or after + * a parse.</p> + * + * @param name The feature name, which is a fully-qualified URI. + * @param value The requested state of the feature (true or false). + * @exception SAXNotRecognizedException When the + * XMLReader does not recognize the feature name. + * @exception SAXNotSupportedException When the + * XMLReader recognizes the feature name but + * cannot set the requested value. + * @see #getFeature + */ + public void setFeature(String name, boolean value) + throws SAXNotRecognizedException, SAXNotSupportedException { + if ("http://xml.org/sax/features/namespaces".equals(name)) { + _namespaces = value; + } else if ( + "http://xml.org/sax/features/namespace-prefixes".equals(name)) { + _namespace_prefixes = value; + } else { + throw new SAXNotRecognizedException("Feature '" + name + + "' not recognized or supported by Document2SAXAdapter"); + } + + } + + + + /** + * Look up the value of a property. + * + * <p>The property name is any fully-qualified URI. It is + * possible for an XMLReader to recognize a property name but + * to be unable to return its state; this is especially true + * in the case of an adapter for a SAX1 Parser.</p> + * + * <p>XMLReaders are not required to recognize any specific + * property names, though an initial core set is documented for + * SAX2.</p> + * + * <p>Some property values may be available only in specific + * contexts, such as before, during, or after a parse.</p> + * + * <p>Implementors are free (and encouraged) to invent their own properties, + * using names built on their own URIs.</p> + * + * @param name The property name, which is a fully-qualified URI. + * @return The current value of the property. + * @exception SAXNotRecognizedException When the + * XMLReader does not recognize the property name. + * @exception SAXNotSupportedException When the + * XMLReader recognizes the property name but + * cannot determine its value at this time. + * @see #setProperty + */ + public Object getProperty(String name) + throws SAXNotRecognizedException, SAXNotSupportedException { + throw new SAXNotRecognizedException("Property '" + name + + "' not recognized or supported by Document2SAXAdapter"); + } + + /** + * Set the value of a property. + * + * <p>The property name is any fully-qualified URI. It is + * possible for an XMLReader to recognize a property name but + * to be unable to set its value; this is especially true + * in the case of an adapter for a SAX1 Parser.</p> + * + * <p>XMLReaders are not required to recognize setting + * any specific property names, though a core set is provided with + * SAX2.</p> + * + * <p>Some property values may be immutable or mutable only + * in specific contexts, such as before, during, or after + * a parse.</p> + * + * <p>This method is also the standard mechanism for setting + * extended handlers.</p> + * + * @param name The property name, which is a fully-qualified URI. + * @param value The requested value for the property. + * @exception SAXNotRecognizedException When the + * XMLReader does not recognize the property name. + * @exception SAXNotSupportedException When the + * XMLReader recognizes the property name but + * cannot set the requested value. + */ + public void setProperty(String name, Object value) + throws SAXNotRecognizedException, SAXNotSupportedException { + throw new SAXNotRecognizedException("Property '" + name + + "' not recognized or supported by Document2SAXAdapter"); + } + + + + // ////////////////////////////////////////////////////////////////// + // Event handlers. + // ////////////////////////////////////////////////////////////////// + private EntityResolver _entityResolver = null; + private DTDHandler _dtdHandler = null; + private ContentHandler _contentHandler = null; + private ErrorHandler _errorHandler = null; + + + /** + * Allow an application to register an entity resolver. + * + * <p>If the application does not register an entity resolver, + * the XMLReader will perform its own default resolution.</p> + * + * <p>Applications may register a new or different resolver in the + * middle of a parse, and the SAX parser must begin using the new + * resolver immediately.</p> + * + * @param resolver The entity resolver. + * @see #getEntityResolver + */ + public void setEntityResolver(EntityResolver resolver) { + _entityResolver = resolver; + } + + + + /** + * Return the current entity resolver. + * + * @return The current entity resolver, or null if none + * has been registered. + * @see #setEntityResolver + */ + public EntityResolver getEntityResolver() { + return _entityResolver; + } + + + + /** + * Allow an application to register a DTD event handler. + * + * <p>If the application does not register a DTD handler, all DTD + * events reported by the SAX parser will be silently ignored.</p> + * + * <p>Applications may register a new or different handler in the + * middle of a parse, and the SAX parser must begin using the new + * handler immediately.</p> + * + * @param handler The DTD handler. + * @see #getDTDHandler + */ + public void setDTDHandler(DTDHandler handler) { + _dtdHandler = handler; + } + + + + /** + * Return the current DTD handler. + * + * @return The current DTD handler, or null if none + * has been registered. + * @see #setDTDHandler + */ + public DTDHandler getDTDHandler() { + return _dtdHandler; + } + + + + /** + * Allow an application to register a content event handler. + * + * <p>If the application does not register a content handler, all + * content events reported by the SAX parser will be silently + * ignored.</p> + * + * <p>Applications may register a new or different handler in the + * middle of a parse, and the SAX parser must begin using the new + * handler immediately.</p> + * + * @param handler The content handler. + * @see #getContentHandler + */ + public void setContentHandler(ContentHandler handler) { + _contentHandler = handler; + } + + /** + * Return the current content handler. + * + * @return The current content handler, or null if none + * has been registered. + * @see #setContentHandler + */ + public ContentHandler getContentHandler() { + return _contentHandler; + } + + + + /** + * Allow an application to register an error event handler. + * + * <p>If the application does not register an error handler, all + * error events reported by the SAX parser will be silently + * ignored; however, normal processing may not continue. It is + * highly recommended that all SAX applications implement an + * error handler to avoid unexpected bugs.</p> + * + * <p>Applications may register a new or different handler in the + * middle of a parse, and the SAX parser must begin using the new + * handler immediately.</p> + * + * @param handler The error handler. + * @see #getErrorHandler + */ + public void setErrorHandler(ErrorHandler handler) { + _errorHandler = handler; + } + + /** + * Return the current error handler. + * + * @return The current error handler, or null if none + * has been registered. + * @see #setErrorHandler + */ + public ErrorHandler getErrorHandler() { + return _errorHandler; + } + + + + // ////////////////////////////////////////////////////////////////// + // Parsing. + // ////////////////////////////////////////////////////////////////// + + /** + * Parse an XML DOM document. + * @param input The input source for the top-level of the XML document. + * @exception SAXException Any SAX exception, possibly + * wrapping another exception. + * @exception IOException An IO exception from the parser, + * possibly from a byte stream or character stream + * supplied by the application. + * @see org.xml.sax.InputSource + * @see #parse(String) + * @see #setEntityResolver + * @see #setDTDHandler + * @see #setContentHandler + * @see #setErrorHandler + */ + public void parse(InputSource input) throws IOException, SAXException { + if (input instanceof DocumentInputSource) { + Document document = ((DocumentInputSource)input).getDocument(); + if (_contentHandler == null) { + throw new SAXException("ContentHandler is null. Please use " + + "setContentHa... [truncated message content] |
|
From: <vic...@us...> - 2006-05-26 18:34:29
|
Revision: 7270 Author: victormote Date: 2006-05-26 11:34:03 -0700 (Fri, 26 May 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=7270&view=rev Log Message: ----------- Get build working for new core module. Modified Paths: -------------- trunk/foray/foray-app/scripts/build.xml trunk/foray/foray-core/src/java/org/foray/core/SessionConfig.java trunk/foray/scripts/build.xml Added Paths: ----------- trunk/foray/foray-core/.checkstyle trunk/foray/foray-core/.classpath trunk/foray/foray-core/.project trunk/foray/foray-core/scripts/ trunk/foray/foray-core/scripts/build.bat trunk/foray/foray-core/scripts/build.sh trunk/foray/foray-core/scripts/build.xml Modified: trunk/foray/foray-app/scripts/build.xml =================================================================== --- trunk/foray/foray-app/scripts/build.xml 2006-05-26 18:04:11 UTC (rev 7269) +++ trunk/foray/foray-app/scripts/build.xml 2006-05-26 18:34:03 UTC (rev 7270) @@ -43,6 +43,9 @@ <fileset dir="${foray.home}/foray-common/build/ant"> <include name="*.jar"/> </fileset> + <fileset dir="${foray.home}/foray-core/build/ant"> + <include name="*.jar"/> + </fileset> <fileset dir="${foray.home}/foray-font/build/ant"> <include name="*.jar"/> </fileset> Added: trunk/foray/foray-core/.checkstyle =================================================================== --- trunk/foray/foray-core/.checkstyle (rev 0) +++ trunk/foray/foray-core/.checkstyle 2006-05-26 18:34:03 UTC (rev 7270) @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> +<fileset-config file-format-version="1.2.0" simple-config="true"> + <fileset name="all" enabled="true" check-config-name="FOray Checkstyle" local="false"> + <file-match-pattern match-pattern="." include-pattern="true"/> + </fileset> +</fileset-config> Added: trunk/foray/foray-core/.classpath =================================================================== --- trunk/foray/foray-core/.classpath (rev 0) +++ trunk/foray/foray-core/.classpath 2006-05-26 18:34:03 UTC (rev 7270) @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="UTF-8"?> +<classpath> + <classpathentry kind="src" path="src/java"/> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> + <classpathentry kind="var" path="FORAY_LIB_ROOT/commons-logging.jar"/> + <classpathentry combineaccessrules="false" kind="src" path="/FOrayCommon"/> + <classpathentry kind="output" path="build/eclipse"/> +</classpath> Added: trunk/foray/foray-core/.project =================================================================== --- trunk/foray/foray-core/.project (rev 0) +++ trunk/foray/foray-core/.project 2006-05-26 18:34:03 UTC (rev 7270) @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>FOrayCore</name> + <comment></comment> + <projects> + </projects> + <buildSpec> + <buildCommand> + <name>org.eclipse.jdt.core.javabuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>com.atlassw.tools.eclipse.checkstyle.CheckstyleBuilder</name> + <arguments> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>org.eclipse.jdt.core.javanature</nature> + <nature>com.atlassw.tools.eclipse.checkstyle.CheckstyleNature</nature> + </natures> +</projectDescription> Added: trunk/foray/foray-core/scripts/build.bat =================================================================== --- trunk/foray/foray-core/scripts/build.bat (rev 0) +++ trunk/foray/foray-core/scripts/build.bat 2006-05-26 18:34:03 UTC (rev 7270) @@ -0,0 +1,27 @@ +@echo off + +echo "FOray Build System" +echo "------------------" + +IF "%JAVA_HOME%" == "" GOTO JAVA_HOME_ERR +IF "%ANT_HOME%" == "" GOTO ANT_HOME_ERR + +call %ANT_HOME%\bin\ant.bat %* + +GOTO END + +:JAVA_HOME_ERR + echo ERROR: JAVA_HOME not found in your environment. + echo + echo Please set the JAVA_HOME variable in your environment to match the + echo location of the Java Virtual Machine you want to use. +GOTO END + +:ANT_HOME_ERR + echo ERROR: ANT_HOME not found in your environment. + echo + echo Please set the ANT_HOME variable in your environment to match the + echo location of the root of your ANT installation. +GOTO END + +:END Added: trunk/foray/foray-core/scripts/build.sh =================================================================== --- trunk/foray/foray-core/scripts/build.sh (rev 0) +++ trunk/foray/foray-core/scripts/build.sh 2006-05-26 18:34:03 UTC (rev 7270) @@ -0,0 +1,29 @@ +#!/bin/sh + +# This file must be executable. + +echo +echo "FOray Build System" +echo "------------------" + +if [ "$JAVA_HOME" = "" ] +then + echo "ERROR: JAVA_HOME not found in your environment." + echo + echo "Please set the JAVA_HOME variable in your environment to match the" + echo "location of the Java Virtual Machine you want to use." + exit 1 +fi + +if [ "$ANT_HOME" = "" ] +then + echo "ERROR: ANT_HOME not found in your environment." + echo + echo "Please set the ANT_HOME variable in your environment to match the" + echo "location of the root of your ANT installation." + exit 1 +fi + +"$ANT_HOME"/bin/ant "$@" + +##### Last Line of $RCSfile$ ##### Property changes on: trunk/foray/foray-core/scripts/build.sh ___________________________________________________________________ Name: svn:executable + * Name: svn:keywords + "Author Id Rev Date URL" Name: svn:eol-style + native Added: trunk/foray/foray-core/scripts/build.xml =================================================================== --- trunk/foray/foray-core/scripts/build.xml (rev 0) +++ trunk/foray/foray-core/scripts/build.xml 2006-05-26 18:34:03 UTC (rev 7270) @@ -0,0 +1,171 @@ +<?xml version="1.0"?> +<!-- $Id$ --> + +<project default="package" basedir="."> + + <!-- Set up a prefix to designate environment variables. --> + <property environment="env"/> + + <target name="env"> + <!-- If the environment variable FORAY_CONFIG is set, use it. --> + <condition property="foray.config" value="${env.FORAY_CONFIG}"> + <and> + <isset property="env.FORAY_CONFIG"/> + <available file="${env.FORAY_CONFIG}"/> + </and> + </condition> + <!-- Otherwise, set it to the FOray scripts directory. --> + <property name="foray.config" location="../../scripts"/> + <echo>foray.config: ${foray.config}</echo> + + <!-- Retrieve externally-configured properties. --> + <property file="${foray.config}/foray-build.properties"/> + + <!-- Get a default for {foray.home}. --> + <property name="foray.home" location="../.."/> + <echo>foray.home: ${foray.home}</echo> + + <!-- Set up dependent properties. --> + <property name="lib.dir" location="${foray.home}/lib"/> + <property name="axsl.build" location="${lib.dir}"/> + + <path id="libs-build-classpath"> + <fileset dir="${axsl.build}"> + <include name="**/axsl*.jar"/> + </fileset> + <fileset dir="${lib.dir}"> + <include name="axsl*.jar"/> + <include name="commons-logging.jar"/> + </fileset> + <fileset dir="${foray.home}/foray-common/build/ant"> + <include name="*.jar"/> + </fileset> + </path> + </target> + + <!-- =================================================================== --> + <!-- Initialization target --> + <!-- =================================================================== --> + <target name="init" depends="env"> + <tstamp/> + <property name="name" value="foray"/> + <property name="contact.info" + value="The FOray project http://www.foray.org"/> + <property name="module" value="core"/> + <property name="module.dir" value="${foray.home}/foray-${module}"/> + <property name="version" value="0.1"/> + <property name="src.dir" value="${module.dir}/src"/> + <property name="build.dir" value="${module.dir}/build/ant"/> + <property name="classes.dir" value="${build.dir}/classes"/> + <property name="debug" value="on"/> + <property name="optimize" value="off"/> + <property name="deprecation" value="off"/> + <property name="source" value="1.4"/> + </target> + + <!-- =================================================================== --> + <!-- Prepares the build directory --> + <!-- =================================================================== --> + <target name="prepare" depends="init"> + <!-- create directories --> + <echo message="Preparing the build directories"/> + <mkdir dir="${build.dir}"/> + <mkdir dir="${classes.dir}"/> + </target> + + <!-- =================================================================== --> + <!-- Compiles the source directory --> + <!-- =================================================================== --> + <target name="compile" depends="prepare"> + <echo message="Compiling the sources "/> + <!-- create directories --> + <mkdir dir="${build.dir}"/> + <javac srcdir="${src.dir}" + destdir="${classes.dir}" + debug="${debug}" + deprecation="${deprecation}" + optimize="${optimize}" + source="${source}" + > + <classpath refid="libs-build-classpath"/> + </javac> + </target> + + <!-- =================================================================== --> + <!-- Creates the class package --> + <!-- =================================================================== --> + <target name="package" depends="compile, style" + description="Generates the jar files (default target)"> + <echo message="Creating the jar file ${build.dir}/${name}.jar"/> + + <tstamp> + <format property="ts" pattern="yyyyMMdd-HHmmss-z"/> + </tstamp> + <jar jarfile="${build.dir}/${name}-${module}.jar" + basedir="${classes.dir}" + > + <manifest> + <attribute name="Implementation-Title" value="${name}-${module}"/> + <attribute name="Implementation-Version" value="${version}"/> + <attribute name="Implementation-Vendor" + value="${contact.info}"/> + </manifest> + </jar> + + </target> + + <target name="javadoc-api" depends="init" description="Creates API + documentation"> + <echo message="Producing the javadoc files "/> + <mkdir dir="${build.dir}/javadoc-api"/> + <javadoc + packagenames="org.foray.core" + sourcepath="${src.dir}/java" + destdir="${build.dir}/javadoc-api" + classpathref="libs-build-classpath" + author="true" + version="true" + windowtitle="FOray Core API" + doctitle="FOray Font API" + bottom="Copyright © 2006 The FOray Project. All Rights Reserved." + overview="${src.dir}/java/org/foray/core/overview.html" + use="true" + access="public" + failonerror="true"> + <classpath refid="libs-build-classpath"/> + <classpath> + <fileset dir="${lib.dir}"> + <include name="ant*.jar"/> + </fileset> + </classpath> + </javadoc> + </target> + + <!-- =================================================================== --> + <!-- Clean targets --> + <!-- =================================================================== --> + <target name="clean" depends="init" description="Cleans the build directory"> + <delete dir="${build.dir}"/> + </target> + + <!-- =================================================================== --> + <!-- Checkstyle --> + <!-- =================================================================== --> + <target name="style" depends="init" description="Runs checkstyle" + if="checkstyle.home"> + <taskdef name="checkstyle" + classname="com.puppycrawl.tools.checkstyle.CheckStyleTask"> + <classpath> + <fileset dir="${checkstyle.home}"> + <include name="checkstyle-all-*.jar"/> + </fileset> + </classpath> + </taskdef> + <checkstyle config="../../scripts/checkstyle-config.xml"> + <fileset dir="${src.dir}" includes="**/*.java"/> + </checkstyle> + </target> + +</project> + +<!-- Last Line of $RCSfile$ --> Property changes on: trunk/foray/foray-core/scripts/build.xml ___________________________________________________________________ Name: svn:keywords + "Author Id Rev Date URL" Name: svn:eol-style + native Modified: trunk/foray/foray-core/src/java/org/foray/core/SessionConfig.java =================================================================== --- trunk/foray/foray-core/src/java/org/foray/core/SessionConfig.java 2006-05-26 18:04:11 UTC (rev 7269) +++ trunk/foray/foray-core/src/java/org/foray/core/SessionConfig.java 2006-05-26 18:34:03 UTC (rev 7270) @@ -25,7 +25,6 @@ package org.foray.core; import org.foray.common.Configuration; -import org.foray.output.OutputConfig; import org.apache.commons.logging.Log; @@ -33,8 +32,7 @@ /** * Configuration implementation for those configuration items that are - * related to the FOraySession. Renderer-specific options are handled by - * {@link OutputConfig}. + * related to the FOraySession. */ public class SessionConfig extends Configuration { Modified: trunk/foray/scripts/build.xml =================================================================== --- trunk/foray/scripts/build.xml 2006-05-26 18:04:11 UTC (rev 7269) +++ trunk/foray/scripts/build.xml 2006-05-26 18:34:03 UTC (rev 7270) @@ -153,6 +153,12 @@ <property name="foray.config" value="${foray.config}"/> </ant> + <ant antfile="${foray.home}/foray-core/scripts/build.xml" + inheritall="false" + target="package"> + <property name="foray.config" value="${foray.config}"/> + </ant> + <ant antfile="${foray.home}/foray-app/scripts/build.xml" inheritall="false" target="package"> @@ -232,6 +238,10 @@ dir="${foray.home}/foray-render/build/ant/classes"> <include name="**"/> </fileset> + <fileset id="foray-core-classes" + dir="${foray.home}/foray-core/build/ant/classes"> + <include name="**"/> + </fileset> <fileset id="foray-app-classes" dir="${foray.home}/foray-app/build/ant/classes"> <include name="**"/> @@ -254,6 +264,7 @@ <fileset refid="foray-pioneer-classes"/> <fileset refid="foray-output-classes"/> <fileset refid="foray-render-classes"/> + <fileset refid="foray-core-classes"/> <fileset refid="foray-app-classes"/> <manifest> <attribute name="Implementation-Title" value="${name}-${module}"/> @@ -372,6 +383,7 @@ private="false"> <sourcepath> <pathelement path="${foray.home}/foray-app/src/java"/> + <pathelement path="${foray.home}/foray-core/src/java"/> <pathelement path="${foray.home}/foray-pretty/src/java"/> <pathelement path="${foray.home}/foray-common/src/java"/> <pathelement path="${foray.home}/foray-ps/src/java"/> @@ -393,6 +405,10 @@ <package name="org.foray.demo"/> <package name="org.foray.demo.*"/> </group> + <group title="The FOray Core Module"> + <package name="org.foray.core"/> + <package name="org.foray.core.*"/> + </group> <group title="The FOray Common Module"> <package name="org.foray.common"/> <package name="org.foray.common.*"/> @@ -530,6 +546,10 @@ inheritall="false" target="clean"/> + <ant antfile="${foray.home}/foray-core/scripts/build.xml" + inheritall="false" + target="clean"/> + <ant antfile="${foray.home}/foray-app/scripts/build.xml" inheritall="false" target="clean"/> @@ -581,6 +601,9 @@ <ant antfile="${foray.home}/foray-render/scripts/build.xml" inheritall="false" target="style"/> + <ant antfile="${foray.home}/foray-core/scripts/build.xml" + inheritall="false" + target="style"/> <ant antfile="${foray.home}/foray-app/scripts/build.xml" inheritall="false" target="style"/> @@ -588,4 +611,4 @@ </project> -<!-- Last Line of $RCSfile$ --> +<!-- Last Line of File --> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <vic...@us...> - 2006-05-26 18:04:18
|
Revision: 7269 Author: victormote Date: 2006-05-26 11:04:11 -0700 (Fri, 26 May 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=7269&view=rev Log Message: ----------- Remove unused method. Modified Paths: -------------- trunk/foray/foray-app/src/java/org/foray/app/FOInputHandler.java trunk/foray/foray-app/src/java/org/foray/app/InputHandler.java trunk/foray/foray-app/src/java/org/foray/app/TraxInputHandler.java Modified: trunk/foray/foray-app/src/java/org/foray/app/FOInputHandler.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/app/FOInputHandler.java 2006-05-26 17:55:24 UTC (rev 7268) +++ trunk/foray/foray-app/src/java/org/foray/app/FOInputHandler.java 2006-05-26 18:04:11 UTC (rev 7269) @@ -65,9 +65,4 @@ return super.createParser(); } - public void run(FOrayDocument driver) throws FOrayException { - throw new FOrayException("not implemented: FOInputHandler.run(Driver)"); - } - } - Modified: trunk/foray/foray-app/src/java/org/foray/app/InputHandler.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/app/InputHandler.java 2006-05-26 17:55:24 UTC (rev 7268) +++ trunk/foray/foray-app/src/java/org/foray/app/InputHandler.java 2006-05-26 18:04:11 UTC (rev 7269) @@ -47,8 +47,6 @@ public abstract InputSource getInputSource() throws IOException ; public abstract XMLReader getParser() throws FOrayException; - public abstract void run(FOrayDocument driver) throws FOrayException; - public InputHandler(Log logger) { this.logger = logger; } Modified: trunk/foray/foray-app/src/java/org/foray/app/TraxInputHandler.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/app/TraxInputHandler.java 2006-05-26 17:55:24 UTC (rev 7268) +++ trunk/foray/foray-app/src/java/org/foray/app/TraxInputHandler.java 2006-05-26 18:04:11 UTC (rev 7269) @@ -172,15 +172,6 @@ return getXMLFilter(new StreamSource(xsltfile)); } - public void run(FOrayDocument document) throws FOrayException { - try { - transformer.transform(xmlSource, - new SAXResult(document.getContentHandler())); - } catch (Exception ex) { - throw new FOrayException(ex); - } - } - public void setParameter(String name, Object value) { transformer.setParameter(name, value); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <vic...@us...> - 2006-05-26 17:55:56
|
Revision: 7268 Author: victormote Date: 2006-05-26 10:55:24 -0700 (Fri, 26 May 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=7268&view=rev Log Message: ----------- Move more classes to core package. Modified Paths: -------------- trunk/foray/foray-app/src/java/org/foray/app/AWTStarter.java trunk/foray/foray-app/src/java/org/foray/app/CommandLineOptions.java trunk/foray/foray-app/src/java/org/foray/app/CommandLineStarter.java trunk/foray/foray-app/src/java/org/foray/app/ConfigurationParser.java trunk/foray/foray-app/src/java/org/foray/app/FOray.java trunk/foray/foray-app/src/java/org/foray/app/FOrayDocument.java trunk/foray/foray-app/src/java/org/foray/app/FOraySession.java trunk/foray/foray-app/src/java/org/foray/app/FOraySpecific.java trunk/foray/foray-app/src/java/org/foray/app/FOrayTarget.java trunk/foray/foray-app/src/java/org/foray/app/Options.java trunk/foray/foray-app/src/java/org/foray/app/PrintStarter.java trunk/foray/foray-app/src/java/org/foray/app/Starter.java trunk/foray/foray-app/src/java/org/foray/app/ant/FOrayAntTaskStarter.java trunk/foray/foray-app/src/java/org/foray/app/test/TestConverter.java trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoAWTViewer.java trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoFO2PDF.java trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoObj2PDF.java trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoObj2XML.java trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoXML2FO.java trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoXML2PDF.java trunk/foray/foray-app/src/java/org/foray/demo/servlet/AbstractDemoServlet.java Added Paths: ----------- trunk/foray/foray-core/src/java/org/foray/core/Application.java trunk/foray/foray-core/src/java/org/foray/core/SessionConfig.java Removed Paths: ------------- trunk/foray/foray-app/src/java/org/foray/app/Application.java trunk/foray/foray-app/src/java/org/foray/app/SessionConfig.java Property Changed: ---------------- trunk/foray/foray-core/ Modified: trunk/foray/foray-app/src/java/org/foray/app/AWTStarter.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/app/AWTStarter.java 2006-05-26 17:48:40 UTC (rev 7267) +++ trunk/foray/foray-app/src/java/org/foray/app/AWTStarter.java 2006-05-26 17:55:24 UTC (rev 7268) @@ -32,6 +32,7 @@ */ import org.foray.core.FOrayException; +import org.foray.core.SessionConfig; import org.foray.output.OutputConfig; import org.foray.render.awt.AWTRenderer; import org.foray.render.awt.viewer.PreviewDialog; Deleted: trunk/foray/foray-app/src/java/org/foray/app/Application.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/app/Application.java 2006-05-26 17:48:40 UTC (rev 7267) +++ trunk/foray/foray-app/src/java/org/foray/app/Application.java 2006-05-26 17:55:24 UTC (rev 7268) @@ -1,59 +0,0 @@ -/* - * Copyright 2004 The FOray Project. - * http://www.foray.org - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * This work is in part derived from the following work(s), used with the - * permission of the licensor: - * Apache FOP, licensed by the Apache Software Foundation - * - */ - -/* $Id$ */ - -package org.foray.app; - -/** - * class representing the FOray Application itself. - */ -public class Application { - - /** Private constructor (should not be instantiated). */ - private Application() { - } - - public static String getApplicationName() { - return "FOray"; - } - - public static String getApplicationNameShort() { - return "FOray"; - } - - /** - * @return The current version of the application. - */ - public static String getVersion() { - return "0.2b1"; - } - - /** - * @return The shortened version of the URL to the home-page of the - * developer. - */ - public static String getDeveloperURLShort() { - return "www.foray.org"; - } - -} Modified: trunk/foray/foray-app/src/java/org/foray/app/CommandLineOptions.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/app/CommandLineOptions.java 2006-05-26 17:48:40 UTC (rev 7267) +++ trunk/foray/foray-app/src/java/org/foray/app/CommandLineOptions.java 2006-05-26 17:55:24 UTC (rev 7268) @@ -26,6 +26,7 @@ import org.foray.common.Logging; import org.foray.core.FOrayException; +import org.foray.core.SessionConfig; import org.foray.output.OutputConfig; import org.apache.commons.logging.Log; Modified: trunk/foray/foray-app/src/java/org/foray/app/CommandLineStarter.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/app/CommandLineStarter.java 2006-05-26 17:48:40 UTC (rev 7267) +++ trunk/foray/foray-app/src/java/org/foray/app/CommandLineStarter.java 2006-05-26 17:55:24 UTC (rev 7268) @@ -25,6 +25,7 @@ package org.foray.app; import org.foray.core.FOrayException; +import org.foray.core.SessionConfig; import org.foray.layout.LayoutStrategy; import org.foray.output.OutputConfig; import org.foray.output.OutputTarget; Modified: trunk/foray/foray-app/src/java/org/foray/app/ConfigurationParser.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/app/ConfigurationParser.java 2006-05-26 17:48:40 UTC (rev 7267) +++ trunk/foray/foray-app/src/java/org/foray/app/ConfigurationParser.java 2006-05-26 17:55:24 UTC (rev 7268) @@ -25,6 +25,7 @@ package org.foray.app; import org.foray.core.FOrayException; +import org.foray.core.SessionConfig; import org.foray.output.OutputConfig; import org.apache.commons.logging.Log; Modified: trunk/foray/foray-app/src/java/org/foray/app/FOray.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/app/FOray.java 2006-05-26 17:48:40 UTC (rev 7267) +++ trunk/foray/foray-app/src/java/org/foray/app/FOray.java 2006-05-26 17:55:24 UTC (rev 7268) @@ -26,6 +26,7 @@ import org.foray.common.Logging; import org.foray.core.FOrayException; +import org.foray.core.SessionConfig; import org.apache.commons.logging.Log; Modified: trunk/foray/foray-app/src/java/org/foray/app/FOrayDocument.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/app/FOrayDocument.java 2006-05-26 17:48:40 UTC (rev 7267) +++ trunk/foray/foray-app/src/java/org/foray/app/FOrayDocument.java 2006-05-26 17:55:24 UTC (rev 7268) @@ -26,6 +26,7 @@ import org.foray.common.XMLParser; import org.foray.core.FOrayException; +import org.foray.core.SessionConfig; import org.foray.output.MIFConverter; import org.foray.output.OutputConfig; import org.foray.output.OutputTarget; Modified: trunk/foray/foray-app/src/java/org/foray/app/FOraySession.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/app/FOraySession.java 2006-05-26 17:48:40 UTC (rev 7267) +++ trunk/foray/foray-app/src/java/org/foray/app/FOraySession.java 2006-05-26 17:55:24 UTC (rev 7268) @@ -27,7 +27,9 @@ import org.foray.area.FOrayAreaTreeFactory; import org.foray.common.Logging; import org.foray.common.XMLParser; +import org.foray.core.Application; import org.foray.core.FOrayException; +import org.foray.core.SessionConfig; import org.foray.font.FOrayFontServer; import org.foray.fotree.FOrayFOTreeServer; import org.foray.graphic.FOrayGraphicServer; Modified: trunk/foray/foray-app/src/java/org/foray/app/FOraySpecific.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/app/FOraySpecific.java 2006-05-26 17:48:40 UTC (rev 7267) +++ trunk/foray/foray-app/src/java/org/foray/app/FOraySpecific.java 2006-05-26 17:55:24 UTC (rev 7268) @@ -27,6 +27,7 @@ import org.foray.common.Logging; import org.foray.common.XMLParser; import org.foray.core.FOrayException; +import org.foray.core.SessionConfig; import org.foray.font.FOrayFontServer; import org.foray.graphic.FOrayGraphicServer; Modified: trunk/foray/foray-app/src/java/org/foray/app/FOrayTarget.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/app/FOrayTarget.java 2006-05-26 17:48:40 UTC (rev 7267) +++ trunk/foray/foray-app/src/java/org/foray/app/FOrayTarget.java 2006-05-26 17:55:24 UTC (rev 7268) @@ -24,7 +24,9 @@ package org.foray.app; +import org.foray.core.Application; import org.foray.core.FOrayException; +import org.foray.core.SessionConfig; import org.foray.output.OutputTarget; import org.foray.render.Renderer; Modified: trunk/foray/foray-app/src/java/org/foray/app/Options.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/app/Options.java 2006-05-26 17:48:40 UTC (rev 7267) +++ trunk/foray/foray-app/src/java/org/foray/app/Options.java 2006-05-26 17:55:24 UTC (rev 7268) @@ -25,6 +25,7 @@ package org.foray.app; import org.foray.core.FOrayException; +import org.foray.core.SessionConfig; import org.foray.output.OutputConfig; import org.apache.commons.logging.Log; Modified: trunk/foray/foray-app/src/java/org/foray/app/PrintStarter.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/app/PrintStarter.java 2006-05-26 17:48:40 UTC (rev 7267) +++ trunk/foray/foray-app/src/java/org/foray/app/PrintStarter.java 2006-05-26 17:55:24 UTC (rev 7268) @@ -26,6 +26,7 @@ import org.foray.common.Logging; import org.foray.core.FOrayException; +import org.foray.core.SessionConfig; import org.foray.output.OutputConfig; import org.apache.commons.logging.Log; Deleted: trunk/foray/foray-app/src/java/org/foray/app/SessionConfig.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/app/SessionConfig.java 2006-05-26 17:48:40 UTC (rev 7267) +++ trunk/foray/foray-app/src/java/org/foray/app/SessionConfig.java 2006-05-26 17:55:24 UTC (rev 7268) @@ -1,217 +0,0 @@ -/* - * Copyright 2004 The FOray Project. - * http://www.foray.org - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * This work is in part derived from the following work(s), used with the - * permission of the licensor: - * Apache FOP, licensed by the Apache Software Foundation - * - */ - -/* $Id$ */ - -package org.foray.app; - -import org.foray.common.Configuration; -import org.foray.output.OutputConfig; - -import org.apache.commons.logging.Log; - -import java.net.URL; - -/** - * Configuration implementation for those configuration items that are - * related to the FOraySession. Renderer-specific options are handled by - * {@link OutputConfig}. - */ -public class SessionConfig extends Configuration { - - /** This is not really a configuration option, but is a permanent record - * of the original fo or xml file that was passed on the command line, - * if any. */ - URL baseDocument = null; - - public SessionConfig(Log logger) { - super(logger); - } - - public String getName() { - return "FOray Session Configuration"; - } - - /** - * Sets the default values that should be used unless overridden later. - */ - protected void setDefaults() { - URL baseDirectory = parseURLDirectory("base-directory", - System.getProperty("user.dir")); - - put("base-directory", baseDirectory, PRECEDENCE_DEFAULT); - put("cache-graphics", Boolean.FALSE, PRECEDENCE_DEFAULT); - put("dump-configuration", Boolean.FALSE, PRECEDENCE_DEFAULT); - put("font-base-directory", null, PRECEDENCE_DEFAULT); - // Skip font-configuration as it can be null. - // Skip hyphenation-base-directory as it is tied to base-directory. - put("language", "en", PRECEDENCE_DEFAULT); - put("stroke-svg-text", Boolean.TRUE, PRECEDENCE_DEFAULT); - put("verbosity", "normal", PRECEDENCE_DEFAULT); - put("xml-catalog", null, PRECEDENCE_DEFAULT); - put("mode", "render", PRECEDENCE_DEFAULT); - } - - public boolean parseOption(String key, String value, int precedenceValue) { - if (key.equals("cache-graphics") - || key.equals("dump-configuration") - || key.equals("stroke-svg-text")) { - // Boolean value. - Boolean booleanValue = this.parseBoolean(key, value); - put(key, booleanValue, precedenceValue); - return true; - } - if (key.equals("base-directory") - || key.equals("font-base-directory") - || key.equals("hyphenation-base-directory")) { - // URL for a directory. - URL baseDir = parseURLDirectory(key, value); - put (key, baseDir, precedenceValue); - return true; - } - if (key.equals("font-configuration")) { - // URL for a file. - URL baseDir = parseURLFile(key, value); - put (key, baseDir, precedenceValue); - return true; - } - if (key.equals("verbosity")) { - // Validated String. - if (value.equals("quiet") - || value.equals("normal") - || value.equals("debug")) { - put (key, value, precedenceValue); - return true; - } - } - if (key.equals("language")) { - // Unvalidated String. - put(key, value, precedenceValue); - return true; - } - if (key.equals("xml-catalog")) { - // Unvalidated String. - put(key, value, precedenceValue); - return true; - } - if (key.equals("mode")) { - // Validated String. - if (value.equals("render") - || value.equals("validate")) { - put (key, value, precedenceValue); - return true; - } - } - return false; - } - - public URL optionBaseDirectory() { - // Never null. - return (URL) getValue("base-directory"); - } - - public void setBaseDirectory(URL newBaseDir, int precedence) { - put ("base-directory", newBaseDir, precedence); - } - - public boolean optionCacheGraphics() { - // Never null. - return getBooleanValue("cache-graphics").booleanValue(); - } - - public boolean optionDumpConfiguration() { - // Never null. - return getBooleanValue("dump-configuration").booleanValue(); - } - - public URL optionFontBaseDirectory() { - URL value = (URL) getValue("font-base-directory"); - return value; - } - - /** - * @return The URL to the font-configuration file specified, or null if - * none was specified. - */ - public URL optionFontConfiguration() { - return (URL) getValue("font-configuration"); - } - - public URL optionHyphenationBaseDirectory() { - URL value = (URL) getValue("hyphenation-base-directory"); - if (value == null) { - return optionBaseDirectory(); - } - return value; - } - - public String optionLanguage() { - // Never null. - return getStringValue("language"); - } - - public boolean optionStrokeSVGText() { - // Never null. - return getBooleanValue("stroke-svg-text").booleanValue(); - } - - public String optionVerbosity() { - // Never null. - return getStringValue("verbosity"); - } - - public String optionXMLCatalog() { - // Can be null. - return getStringValue("xml-catalog"); - } - - /** - * Sets the path to the base document that should be used for finding - * resources with relative URLs. - * @param baseDocument The path to the base document. - */ - public void setBaseDocument(URL baseDocument) { - this.baseDocument = baseDocument; - } - - /** - * Returns the path to the base document that should be used for finding - * resources with relative URLs. - */ - public URL getBaseDocument() { - return this.baseDocument; - } - - public String getMode() { - // Never null. - return getStringValue("mode"); - } - - public boolean isModeRender() { - return getStringValue("mode").equals("render"); - } - - public boolean isModeValidate() { - return getStringValue("mode").equals("validate"); - } - -} Modified: trunk/foray/foray-app/src/java/org/foray/app/Starter.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/app/Starter.java 2006-05-26 17:48:40 UTC (rev 7267) +++ trunk/foray/foray-app/src/java/org/foray/app/Starter.java 2006-05-26 17:55:24 UTC (rev 7268) @@ -25,6 +25,7 @@ package org.foray.app; import org.foray.core.FOrayException; +import org.foray.core.SessionConfig; import org.foray.output.OutputConfig; import org.apache.commons.logging.Log; Modified: trunk/foray/foray-app/src/java/org/foray/app/ant/FOrayAntTaskStarter.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/app/ant/FOrayAntTaskStarter.java 2006-05-26 17:48:40 UTC (rev 7267) +++ trunk/foray/foray-app/src/java/org/foray/app/ant/FOrayAntTaskStarter.java 2006-05-26 17:55:24 UTC (rev 7268) @@ -30,9 +30,9 @@ import org.foray.app.FOrayTarget; import org.foray.app.InputHandler; import org.foray.app.Options; -import org.foray.app.SessionConfig; import org.foray.app.Starter; import org.foray.core.FOrayException; +import org.foray.core.SessionConfig; import org.foray.output.OutputConfig; import org.foray.output.OutputTarget; Modified: trunk/foray/foray-app/src/java/org/foray/app/test/TestConverter.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/app/test/TestConverter.java 2006-05-26 17:48:40 UTC (rev 7267) +++ trunk/foray/foray-app/src/java/org/foray/app/test/TestConverter.java 2006-05-26 17:55:24 UTC (rev 7268) @@ -29,10 +29,10 @@ import org.foray.app.FOraySession; import org.foray.app.FOrayTarget; import org.foray.app.InputHandler; -import org.foray.app.SessionConfig; import org.foray.app.TraxInputHandler; import org.foray.common.Logging; import org.foray.core.FOrayException; +import org.foray.core.SessionConfig; import org.foray.output.OutputConfig; import org.foray.output.OutputTarget; Modified: trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoAWTViewer.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoAWTViewer.java 2006-05-26 17:48:40 UTC (rev 7267) +++ trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoAWTViewer.java 2006-05-26 17:55:24 UTC (rev 7268) @@ -34,14 +34,14 @@ import javax.xml.transform.TransformerException; -import org.foray.app.Application; -import org.foray.app.SessionConfig; import org.foray.app.FOInputHandler; import org.foray.app.FOrayDocument; import org.foray.app.FOraySession; import org.foray.app.FOrayTarget; import org.foray.app.InputHandler; +import org.foray.core.Application; import org.foray.core.FOrayException; +import org.foray.core.SessionConfig; import org.foray.render.awt.AWTRenderer; import org.foray.render.awt.viewer.PreviewDialog; import org.foray.render.awt.viewer.SecureResourceBundle; Modified: trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoFO2PDF.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoFO2PDF.java 2006-05-26 17:48:40 UTC (rev 7267) +++ trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoFO2PDF.java 2006-05-26 17:55:24 UTC (rev 7268) @@ -29,14 +29,14 @@ import java.io.IOException; import java.io.OutputStream; -import org.foray.app.Application; -import org.foray.app.SessionConfig; import org.foray.app.FOInputHandler; import org.foray.app.FOrayDocument; import org.foray.app.FOraySession; import org.foray.app.FOrayTarget; import org.foray.app.InputHandler; +import org.foray.core.Application; import org.foray.core.FOrayException; +import org.foray.core.SessionConfig; import org.foray.output.OutputTarget; /** Modified: trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoObj2PDF.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoObj2PDF.java 2006-05-26 17:48:40 UTC (rev 7267) +++ trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoObj2PDF.java 2006-05-26 17:55:24 UTC (rev 7268) @@ -35,14 +35,14 @@ import javax.xml.transform.Source; import javax.xml.transform.stream.StreamSource; -import org.foray.app.Application; -import org.foray.app.SessionConfig; import org.foray.app.FOrayDocument; import org.foray.app.FOraySession; import org.foray.app.FOrayTarget; import org.foray.output.OutputTarget; +import org.foray.core.Application; import org.foray.core.FOrayException; +import org.foray.core.SessionConfig; import org.foray.demo.embed.model.ProjectTeam; /** Modified: trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoObj2XML.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoObj2XML.java 2006-05-26 17:48:40 UTC (rev 7267) +++ trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoObj2XML.java 2006-05-26 17:55:24 UTC (rev 7268) @@ -24,7 +24,7 @@ package org.foray.demo.embed; -import org.foray.app.Application; +import org.foray.core.Application; import org.foray.demo.embed.model.ProjectTeam; import org.foray.demo.embed.model.ProjectMember; Modified: trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoXML2FO.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoXML2FO.java 2006-05-26 17:48:40 UTC (rev 7267) +++ trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoXML2FO.java 2006-05-26 17:55:24 UTC (rev 7268) @@ -24,7 +24,7 @@ package org.foray.demo.embed; -import org.foray.app.Application; +import org.foray.core.Application; import java.io.File; import java.io.IOException; Modified: trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoXML2PDF.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoXML2PDF.java 2006-05-26 17:48:40 UTC (rev 7267) +++ trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoXML2PDF.java 2006-05-26 17:55:24 UTC (rev 7268) @@ -35,12 +35,12 @@ import javax.xml.transform.Source; import javax.xml.transform.stream.StreamSource; -import org.foray.app.Application; -import org.foray.app.SessionConfig; import org.foray.app.FOrayDocument; import org.foray.app.FOraySession; import org.foray.app.FOrayTarget; +import org.foray.core.Application; import org.foray.core.FOrayException; +import org.foray.core.SessionConfig; import org.foray.output.OutputTarget; /** Modified: trunk/foray/foray-app/src/java/org/foray/demo/servlet/AbstractDemoServlet.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/demo/servlet/AbstractDemoServlet.java 2006-05-26 17:48:40 UTC (rev 7267) +++ trunk/foray/foray-app/src/java/org/foray/demo/servlet/AbstractDemoServlet.java 2006-05-26 17:55:24 UTC (rev 7268) @@ -29,9 +29,9 @@ import org.foray.app.FOraySession; import org.foray.app.FOrayTarget; import org.foray.app.InputHandler; -import org.foray.app.SessionConfig; import org.foray.common.Logging; import org.foray.core.FOrayException; +import org.foray.core.SessionConfig; import org.foray.output.OutputTarget; import org.apache.commons.logging.Log; Property changes on: trunk/foray/foray-core ___________________________________________________________________ Name: svn:ignore + build zzlocal Copied: trunk/foray/foray-core/src/java/org/foray/core/Application.java (from rev 7265, trunk/foray/foray-app/src/java/org/foray/app/Application.java) =================================================================== --- trunk/foray/foray-core/src/java/org/foray/core/Application.java (rev 0) +++ trunk/foray/foray-core/src/java/org/foray/core/Application.java 2006-05-26 17:55:24 UTC (rev 7268) @@ -0,0 +1,59 @@ +/* + * Copyright 2004 The FOray Project. + * http://www.foray.org + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * This work is in part derived from the following work(s), used with the + * permission of the licensor: + * Apache FOP, licensed by the Apache Software Foundation + * + */ + +/* $Id$ */ + +package org.foray.core; + +/** + * class representing the FOray Application itself. + */ +public class Application { + + /** Private constructor (should not be instantiated). */ + private Application() { + } + + public static String getApplicationName() { + return "FOray"; + } + + public static String getApplicationNameShort() { + return "FOray"; + } + + /** + * @return The current version of the application. + */ + public static String getVersion() { + return "0.2b1"; + } + + /** + * @return The shortened version of the URL to the home-page of the + * developer. + */ + public static String getDeveloperURLShort() { + return "www.foray.org"; + } + +} Copied: trunk/foray/foray-core/src/java/org/foray/core/SessionConfig.java (from rev 7265, trunk/foray/foray-app/src/java/org/foray/app/SessionConfig.java) =================================================================== --- trunk/foray/foray-core/src/java/org/foray/core/SessionConfig.java (rev 0) +++ trunk/foray/foray-core/src/java/org/foray/core/SessionConfig.java 2006-05-26 17:55:24 UTC (rev 7268) @@ -0,0 +1,217 @@ +/* + * Copyright 2004 The FOray Project. + * http://www.foray.org + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * This work is in part derived from the following work(s), used with the + * permission of the licensor: + * Apache FOP, licensed by the Apache Software Foundation + * + */ + +/* $Id$ */ + +package org.foray.core; + +import org.foray.common.Configuration; +import org.foray.output.OutputConfig; + +import org.apache.commons.logging.Log; + +import java.net.URL; + +/** + * Configuration implementation for those configuration items that are + * related to the FOraySession. Renderer-specific options are handled by + * {@link OutputConfig}. + */ +public class SessionConfig extends Configuration { + + /** This is not really a configuration option, but is a permanent record + * of the original fo or xml file that was passed on the command line, + * if any. */ + URL baseDocument = null; + + public SessionConfig(Log logger) { + super(logger); + } + + public String getName() { + return "FOray Session Configuration"; + } + + /** + * Sets the default values that should be used unless overridden later. + */ + protected void setDefaults() { + URL baseDirectory = parseURLDirectory("base-directory", + System.getProperty("user.dir")); + + put("base-directory", baseDirectory, PRECEDENCE_DEFAULT); + put("cache-graphics", Boolean.FALSE, PRECEDENCE_DEFAULT); + put("dump-configuration", Boolean.FALSE, PRECEDENCE_DEFAULT); + put("font-base-directory", null, PRECEDENCE_DEFAULT); + // Skip font-configuration as it can be null. + // Skip hyphenation-base-directory as it is tied to base-directory. + put("language", "en", PRECEDENCE_DEFAULT); + put("stroke-svg-text", Boolean.TRUE, PRECEDENCE_DEFAULT); + put("verbosity", "normal", PRECEDENCE_DEFAULT); + put("xml-catalog", null, PRECEDENCE_DEFAULT); + put("mode", "render", PRECEDENCE_DEFAULT); + } + + public boolean parseOption(String key, String value, int precedenceValue) { + if (key.equals("cache-graphics") + || key.equals("dump-configuration") + || key.equals("stroke-svg-text")) { + // Boolean value. + Boolean booleanValue = this.parseBoolean(key, value); + put(key, booleanValue, precedenceValue); + return true; + } + if (key.equals("base-directory") + || key.equals("font-base-directory") + || key.equals("hyphenation-base-directory")) { + // URL for a directory. + URL baseDir = parseURLDirectory(key, value); + put (key, baseDir, precedenceValue); + return true; + } + if (key.equals("font-configuration")) { + // URL for a file. + URL baseDir = parseURLFile(key, value); + put (key, baseDir, precedenceValue); + return true; + } + if (key.equals("verbosity")) { + // Validated String. + if (value.equals("quiet") + || value.equals("normal") + || value.equals("debug")) { + put (key, value, precedenceValue); + return true; + } + } + if (key.equals("language")) { + // Unvalidated String. + put(key, value, precedenceValue); + return true; + } + if (key.equals("xml-catalog")) { + // Unvalidated String. + put(key, value, precedenceValue); + return true; + } + if (key.equals("mode")) { + // Validated String. + if (value.equals("render") + || value.equals("validate")) { + put (key, value, precedenceValue); + return true; + } + } + return false; + } + + public URL optionBaseDirectory() { + // Never null. + return (URL) getValue("base-directory"); + } + + public void setBaseDirectory(URL newBaseDir, int precedence) { + put ("base-directory", newBaseDir, precedence); + } + + public boolean optionCacheGraphics() { + // Never null. + return getBooleanValue("cache-graphics").booleanValue(); + } + + public boolean optionDumpConfiguration() { + // Never null. + return getBooleanValue("dump-configuration").booleanValue(); + } + + public URL optionFontBaseDirectory() { + URL value = (URL) getValue("font-base-directory"); + return value; + } + + /** + * @return The URL to the font-configuration file specified, or null if + * none was specified. + */ + public URL optionFontConfiguration() { + return (URL) getValue("font-configuration"); + } + + public URL optionHyphenationBaseDirectory() { + URL value = (URL) getValue("hyphenation-base-directory"); + if (value == null) { + return optionBaseDirectory(); + } + return value; + } + + public String optionLanguage() { + // Never null. + return getStringValue("language"); + } + + public boolean optionStrokeSVGText() { + // Never null. + return getBooleanValue("stroke-svg-text").booleanValue(); + } + + public String optionVerbosity() { + // Never null. + return getStringValue("verbosity"); + } + + public String optionXMLCatalog() { + // Can be null. + return getStringValue("xml-catalog"); + } + + /** + * Sets the path to the base document that should be used for finding + * resources with relative URLs. + * @param baseDocument The path to the base document. + */ + public void setBaseDocument(URL baseDocument) { + this.baseDocument = baseDocument; + } + + /** + * Returns the path to the base document that should be used for finding + * resources with relative URLs. + */ + public URL getBaseDocument() { + return this.baseDocument; + } + + public String getMode() { + // Never null. + return getStringValue("mode"); + } + + public boolean isModeRender() { + return getStringValue("mode").equals("render"); + } + + public boolean isModeValidate() { + return getStringValue("mode").equals("validate"); + } + +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <vic...@us...> - 2006-05-26 17:49:17
|
Revision: 7267 Author: victormote Date: 2006-05-26 10:48:40 -0700 (Fri, 26 May 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=7267&view=rev Log Message: ----------- Move FOrayException class to new core package. Modified Paths: -------------- trunk/foray/foray-app/.classpath trunk/foray/foray-app/src/java/org/foray/app/AWTStarter.java trunk/foray/foray-app/src/java/org/foray/app/CommandLineOptions.java trunk/foray/foray-app/src/java/org/foray/app/CommandLineStarter.java trunk/foray/foray-app/src/java/org/foray/app/ConfigurationParser.java trunk/foray/foray-app/src/java/org/foray/app/FOInputHandler.java trunk/foray/foray-app/src/java/org/foray/app/FOray.java trunk/foray/foray-app/src/java/org/foray/app/FOrayDocument.java trunk/foray/foray-app/src/java/org/foray/app/FOraySession.java trunk/foray/foray-app/src/java/org/foray/app/FOraySpecific.java trunk/foray/foray-app/src/java/org/foray/app/FOrayTarget.java trunk/foray/foray-app/src/java/org/foray/app/InputHandler.java trunk/foray/foray-app/src/java/org/foray/app/Options.java trunk/foray/foray-app/src/java/org/foray/app/PrintStarter.java trunk/foray/foray-app/src/java/org/foray/app/Starter.java trunk/foray/foray-app/src/java/org/foray/app/TraxInputHandler.java trunk/foray/foray-app/src/java/org/foray/app/ant/FOrayAntTask.java trunk/foray/foray-app/src/java/org/foray/app/ant/FOrayAntTaskStarter.java trunk/foray/foray-app/src/java/org/foray/app/test/TestConverter.java trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoAWTViewer.java trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoFO2PDF.java trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoObj2PDF.java trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoXML2PDF.java trunk/foray/foray-app/src/java/org/foray/demo/servlet/AbstractDemoServlet.java trunk/foray/foray-app/src/java/org/foray/demo/servlet/DemoPrintServlet.java trunk/foray/foray-app/src/java/org/foray/demo/servlet/DemoServlet.java Added Paths: ----------- trunk/foray/foray-core/ trunk/foray/foray-core/src/ trunk/foray/foray-core/src/java/ trunk/foray/foray-core/src/java/org/ trunk/foray/foray-core/src/java/org/foray/ trunk/foray/foray-core/src/java/org/foray/core/ trunk/foray/foray-core/src/java/org/foray/core/FOrayException.java Removed Paths: ------------- trunk/foray/foray-app/src/java/org/foray/app/FOrayException.java Modified: trunk/foray/foray-app/.classpath =================================================================== --- trunk/foray/foray-app/.classpath 2006-05-26 17:23:07 UTC (rev 7266) +++ trunk/foray/foray-app/.classpath 2006-05-26 17:48:40 UTC (rev 7267) @@ -32,5 +32,6 @@ <classpathentry combineaccessrules="false" kind="src" path="/axslArea-W"/> <classpathentry combineaccessrules="false" kind="src" path="/FOrayLayout"/> <classpathentry combineaccessrules="false" kind="src" path="/axslLayout"/> + <classpathentry combineaccessrules="false" kind="src" path="/FOrayCore"/> <classpathentry kind="output" path="build/eclipse"/> </classpath> Modified: trunk/foray/foray-app/src/java/org/foray/app/AWTStarter.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/app/AWTStarter.java 2006-05-26 17:23:07 UTC (rev 7266) +++ trunk/foray/foray-app/src/java/org/foray/app/AWTStarter.java 2006-05-26 17:48:40 UTC (rev 7267) @@ -31,6 +31,7 @@ * Modified to use streaming API by Mark Lillywhite, mar...@in... */ +import org.foray.core.FOrayException; import org.foray.output.OutputConfig; import org.foray.render.awt.AWTRenderer; import org.foray.render.awt.viewer.PreviewDialog; Modified: trunk/foray/foray-app/src/java/org/foray/app/CommandLineOptions.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/app/CommandLineOptions.java 2006-05-26 17:23:07 UTC (rev 7266) +++ trunk/foray/foray-app/src/java/org/foray/app/CommandLineOptions.java 2006-05-26 17:48:40 UTC (rev 7267) @@ -25,6 +25,7 @@ package org.foray.app; import org.foray.common.Logging; +import org.foray.core.FOrayException; import org.foray.output.OutputConfig; import org.apache.commons.logging.Log; Modified: trunk/foray/foray-app/src/java/org/foray/app/CommandLineStarter.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/app/CommandLineStarter.java 2006-05-26 17:23:07 UTC (rev 7266) +++ trunk/foray/foray-app/src/java/org/foray/app/CommandLineStarter.java 2006-05-26 17:48:40 UTC (rev 7267) @@ -24,6 +24,7 @@ package org.foray.app; +import org.foray.core.FOrayException; import org.foray.layout.LayoutStrategy; import org.foray.output.OutputConfig; import org.foray.output.OutputTarget; Modified: trunk/foray/foray-app/src/java/org/foray/app/ConfigurationParser.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/app/ConfigurationParser.java 2006-05-26 17:23:07 UTC (rev 7266) +++ trunk/foray/foray-app/src/java/org/foray/app/ConfigurationParser.java 2006-05-26 17:48:40 UTC (rev 7267) @@ -24,6 +24,7 @@ package org.foray.app; +import org.foray.core.FOrayException; import org.foray.output.OutputConfig; import org.apache.commons.logging.Log; Modified: trunk/foray/foray-app/src/java/org/foray/app/FOInputHandler.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/app/FOInputHandler.java 2006-05-26 17:23:07 UTC (rev 7266) +++ trunk/foray/foray-app/src/java/org/foray/app/FOInputHandler.java 2006-05-26 17:48:40 UTC (rev 7267) @@ -25,6 +25,8 @@ package org.foray.app; +import org.foray.core.FOrayException; + import org.apache.commons.logging.Log; import org.xml.sax.InputSource; Modified: trunk/foray/foray-app/src/java/org/foray/app/FOray.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/app/FOray.java 2006-05-26 17:23:07 UTC (rev 7266) +++ trunk/foray/foray-app/src/java/org/foray/app/FOray.java 2006-05-26 17:48:40 UTC (rev 7267) @@ -25,6 +25,7 @@ package org.foray.app; import org.foray.common.Logging; +import org.foray.core.FOrayException; import org.apache.commons.logging.Log; Modified: trunk/foray/foray-app/src/java/org/foray/app/FOrayDocument.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/app/FOrayDocument.java 2006-05-26 17:23:07 UTC (rev 7266) +++ trunk/foray/foray-app/src/java/org/foray/app/FOrayDocument.java 2006-05-26 17:48:40 UTC (rev 7267) @@ -25,6 +25,7 @@ package org.foray.app; import org.foray.common.XMLParser; +import org.foray.core.FOrayException; import org.foray.output.MIFConverter; import org.foray.output.OutputConfig; import org.foray.output.OutputTarget; Deleted: trunk/foray/foray-app/src/java/org/foray/app/FOrayException.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/app/FOrayException.java 2006-05-26 17:23:07 UTC (rev 7266) +++ trunk/foray/foray-app/src/java/org/foray/app/FOrayException.java 2006-05-26 17:48:40 UTC (rev 7267) @@ -1,166 +0,0 @@ -/* - * Copyright 2004 The FOray Project. - * http://www.foray.org - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * This work is in part derived from the following work(s), used with the - * permission of the licensor: - * Apache FOP, licensed by the Apache Software Foundation - * - */ - -/* $Id$ */ - -package org.foray.app; - -import org.xml.sax.SAXException; - -import java.io.PrintStream; -import java.io.PrintWriter; -import java.lang.reflect.InvocationTargetException; - -/** - * Exception thrown when FOray has a problem. - */ -public class FOrayException extends Exception { - static final long serialVersionUID = 298590433713255908L; - - private static final String EXCEPTION_SEPARATOR = "\n---------\n"; - - private Throwable _exception; - private String contextMessage; - - /** - * Create a new FOray Exception - * - * @param message descriptive message - */ - public FOrayException(String message) { - super(message); - this.contextMessage = null; - } - - public FOrayException(String message, String contextMessage) { - super(message); - this.contextMessage = contextMessage; - } - - public FOrayException(Throwable e) { - super(e.getMessage()); - setException(e); - this.contextMessage = null; - } - - public FOrayException(Throwable e, String contextMessage) { - super(e.getMessage()); - setException(e); - this.contextMessage = contextMessage; - } - - public FOrayException(String message, Throwable e) { - super(message); - setException(e); - this.contextMessage = null; - } - - public FOrayException(String message, Throwable e, String contextMessage) { - super(message); - setException(e); - this.contextMessage = contextMessage; - } - - protected void setException(Throwable t) { - _exception = t; - } - - public Throwable getException() { - return _exception; - } - - public void setContextMessage(String contextMessage) { - this.contextMessage = contextMessage; - } - - public boolean isContextSet() { - return this.contextMessage != null; - } - - protected Throwable getRootException() { - Throwable result = _exception; - - if (result instanceof SAXException) { - result = ((SAXException)result).getException(); - } - if (result instanceof InvocationTargetException) { - result = - ((InvocationTargetException)result) - .getTargetException(); - } - if (result != _exception) { - return result; - } - return null; - } - - public String getMessage() { - if (this.contextMessage != null) { - return super.getMessage() + "\n" - + this.contextMessage; - } - return super.getMessage(); - } - - public void printStackTrace() { - synchronized (System.err) { - super.printStackTrace(); - if (_exception != null) { - System.err.println(EXCEPTION_SEPARATOR); - _exception.printStackTrace(); - } - if (getRootException() != null) { - System.err.println(EXCEPTION_SEPARATOR); - getRootException().printStackTrace(); - } - } - } - - public void printStackTrace(PrintStream stream) { - synchronized (stream) { - super.printStackTrace(stream); - if (_exception != null) { - stream.println(EXCEPTION_SEPARATOR); - _exception.printStackTrace(stream); - } - if (getRootException() != null) { - stream.println(EXCEPTION_SEPARATOR); - getRootException().printStackTrace(stream); - } - } - } - - public void printStackTrace(PrintWriter writer) { - synchronized (writer) { - super.printStackTrace(writer); - if (_exception != null) { - writer.println(EXCEPTION_SEPARATOR); - _exception.printStackTrace(writer); - } - if (getRootException() != null) { - writer.println(EXCEPTION_SEPARATOR); - getRootException().printStackTrace(writer); - } - } - } - -} Modified: trunk/foray/foray-app/src/java/org/foray/app/FOraySession.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/app/FOraySession.java 2006-05-26 17:23:07 UTC (rev 7266) +++ trunk/foray/foray-app/src/java/org/foray/app/FOraySession.java 2006-05-26 17:48:40 UTC (rev 7267) @@ -27,6 +27,7 @@ import org.foray.area.FOrayAreaTreeFactory; import org.foray.common.Logging; import org.foray.common.XMLParser; +import org.foray.core.FOrayException; import org.foray.font.FOrayFontServer; import org.foray.fotree.FOrayFOTreeServer; import org.foray.graphic.FOrayGraphicServer; Modified: trunk/foray/foray-app/src/java/org/foray/app/FOraySpecific.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/app/FOraySpecific.java 2006-05-26 17:23:07 UTC (rev 7266) +++ trunk/foray/foray-app/src/java/org/foray/app/FOraySpecific.java 2006-05-26 17:48:40 UTC (rev 7267) @@ -26,6 +26,7 @@ import org.foray.common.Logging; import org.foray.common.XMLParser; +import org.foray.core.FOrayException; import org.foray.font.FOrayFontServer; import org.foray.graphic.FOrayGraphicServer; Modified: trunk/foray/foray-app/src/java/org/foray/app/FOrayTarget.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/app/FOrayTarget.java 2006-05-26 17:23:07 UTC (rev 7266) +++ trunk/foray/foray-app/src/java/org/foray/app/FOrayTarget.java 2006-05-26 17:48:40 UTC (rev 7267) @@ -24,6 +24,7 @@ package org.foray.app; +import org.foray.core.FOrayException; import org.foray.output.OutputTarget; import org.foray.render.Renderer; Modified: trunk/foray/foray-app/src/java/org/foray/app/InputHandler.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/app/InputHandler.java 2006-05-26 17:23:07 UTC (rev 7266) +++ trunk/foray/foray-app/src/java/org/foray/app/InputHandler.java 2006-05-26 17:48:40 UTC (rev 7267) @@ -25,6 +25,8 @@ package org.foray.app; +import org.foray.core.FOrayException; + import org.apache.commons.logging.Log; import org.xml.sax.InputSource; Modified: trunk/foray/foray-app/src/java/org/foray/app/Options.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/app/Options.java 2006-05-26 17:23:07 UTC (rev 7266) +++ trunk/foray/foray-app/src/java/org/foray/app/Options.java 2006-05-26 17:48:40 UTC (rev 7267) @@ -24,6 +24,7 @@ package org.foray.app; +import org.foray.core.FOrayException; import org.foray.output.OutputConfig; import org.apache.commons.logging.Log; Modified: trunk/foray/foray-app/src/java/org/foray/app/PrintStarter.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/app/PrintStarter.java 2006-05-26 17:23:07 UTC (rev 7266) +++ trunk/foray/foray-app/src/java/org/foray/app/PrintStarter.java 2006-05-26 17:48:40 UTC (rev 7267) @@ -25,6 +25,7 @@ package org.foray.app; import org.foray.common.Logging; +import org.foray.core.FOrayException; import org.foray.output.OutputConfig; import org.apache.commons.logging.Log; Modified: trunk/foray/foray-app/src/java/org/foray/app/Starter.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/app/Starter.java 2006-05-26 17:23:07 UTC (rev 7266) +++ trunk/foray/foray-app/src/java/org/foray/app/Starter.java 2006-05-26 17:48:40 UTC (rev 7267) @@ -24,6 +24,7 @@ package org.foray.app; +import org.foray.core.FOrayException; import org.foray.output.OutputConfig; import org.apache.commons.logging.Log; Modified: trunk/foray/foray-app/src/java/org/foray/app/TraxInputHandler.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/app/TraxInputHandler.java 2006-05-26 17:23:07 UTC (rev 7266) +++ trunk/foray/foray-app/src/java/org/foray/app/TraxInputHandler.java 2006-05-26 17:48:40 UTC (rev 7267) @@ -26,6 +26,8 @@ +import org.foray.core.FOrayException; + import org.apache.commons.logging.Log; import org.xml.sax.InputSource; Modified: trunk/foray/foray-app/src/java/org/foray/app/ant/FOrayAntTask.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/app/ant/FOrayAntTask.java 2006-05-26 17:23:07 UTC (rev 7266) +++ trunk/foray/foray-app/src/java/org/foray/app/ant/FOrayAntTask.java 2006-05-26 17:48:40 UTC (rev 7267) @@ -24,10 +24,10 @@ package org.foray.app.ant; -import org.foray.app.FOrayException; import org.foray.app.FOrayTarget; import org.foray.app.Starter; import org.foray.common.Logging; +import org.foray.core.FOrayException; import org.apache.commons.logging.Log; import org.apache.tools.ant.BuildException; Modified: trunk/foray/foray-app/src/java/org/foray/app/ant/FOrayAntTaskStarter.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/app/ant/FOrayAntTaskStarter.java 2006-05-26 17:23:07 UTC (rev 7266) +++ trunk/foray/foray-app/src/java/org/foray/app/ant/FOrayAntTaskStarter.java 2006-05-26 17:48:40 UTC (rev 7267) @@ -26,13 +26,13 @@ import org.foray.app.FOInputHandler; import org.foray.app.FOrayDocument; -import org.foray.app.FOrayException; import org.foray.app.FOraySession; import org.foray.app.FOrayTarget; import org.foray.app.InputHandler; import org.foray.app.Options; import org.foray.app.SessionConfig; import org.foray.app.Starter; +import org.foray.core.FOrayException; import org.foray.output.OutputConfig; import org.foray.output.OutputTarget; Modified: trunk/foray/foray-app/src/java/org/foray/app/test/TestConverter.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/app/test/TestConverter.java 2006-05-26 17:23:07 UTC (rev 7266) +++ trunk/foray/foray-app/src/java/org/foray/app/test/TestConverter.java 2006-05-26 17:48:40 UTC (rev 7267) @@ -26,13 +26,13 @@ import org.foray.app.FOInputHandler; import org.foray.app.FOrayDocument; -import org.foray.app.FOrayException; import org.foray.app.FOraySession; import org.foray.app.FOrayTarget; import org.foray.app.InputHandler; import org.foray.app.SessionConfig; import org.foray.app.TraxInputHandler; import org.foray.common.Logging; +import org.foray.core.FOrayException; import org.foray.output.OutputConfig; import org.foray.output.OutputTarget; Modified: trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoAWTViewer.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoAWTViewer.java 2006-05-26 17:23:07 UTC (rev 7266) +++ trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoAWTViewer.java 2006-05-26 17:48:40 UTC (rev 7267) @@ -35,13 +35,13 @@ import javax.xml.transform.TransformerException; import org.foray.app.Application; -import org.foray.app.FOrayException; import org.foray.app.SessionConfig; import org.foray.app.FOInputHandler; import org.foray.app.FOrayDocument; import org.foray.app.FOraySession; import org.foray.app.FOrayTarget; import org.foray.app.InputHandler; +import org.foray.core.FOrayException; import org.foray.render.awt.AWTRenderer; import org.foray.render.awt.viewer.PreviewDialog; import org.foray.render.awt.viewer.SecureResourceBundle; Modified: trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoFO2PDF.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoFO2PDF.java 2006-05-26 17:23:07 UTC (rev 7266) +++ trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoFO2PDF.java 2006-05-26 17:48:40 UTC (rev 7267) @@ -30,13 +30,13 @@ import java.io.OutputStream; import org.foray.app.Application; -import org.foray.app.FOrayException; import org.foray.app.SessionConfig; import org.foray.app.FOInputHandler; import org.foray.app.FOrayDocument; import org.foray.app.FOraySession; import org.foray.app.FOrayTarget; import org.foray.app.InputHandler; +import org.foray.core.FOrayException; import org.foray.output.OutputTarget; /** Modified: trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoObj2PDF.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoObj2PDF.java 2006-05-26 17:23:07 UTC (rev 7266) +++ trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoObj2PDF.java 2006-05-26 17:48:40 UTC (rev 7267) @@ -36,13 +36,13 @@ import javax.xml.transform.stream.StreamSource; import org.foray.app.Application; -import org.foray.app.FOrayException; import org.foray.app.SessionConfig; import org.foray.app.FOrayDocument; import org.foray.app.FOraySession; import org.foray.app.FOrayTarget; import org.foray.output.OutputTarget; +import org.foray.core.FOrayException; import org.foray.demo.embed.model.ProjectTeam; /** Modified: trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoXML2PDF.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoXML2PDF.java 2006-05-26 17:23:07 UTC (rev 7266) +++ trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoXML2PDF.java 2006-05-26 17:48:40 UTC (rev 7267) @@ -36,11 +36,11 @@ import javax.xml.transform.stream.StreamSource; import org.foray.app.Application; -import org.foray.app.FOrayException; import org.foray.app.SessionConfig; import org.foray.app.FOrayDocument; import org.foray.app.FOraySession; import org.foray.app.FOrayTarget; +import org.foray.core.FOrayException; import org.foray.output.OutputTarget; /** Modified: trunk/foray/foray-app/src/java/org/foray/demo/servlet/AbstractDemoServlet.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/demo/servlet/AbstractDemoServlet.java 2006-05-26 17:23:07 UTC (rev 7266) +++ trunk/foray/foray-app/src/java/org/foray/demo/servlet/AbstractDemoServlet.java 2006-05-26 17:48:40 UTC (rev 7267) @@ -26,12 +26,12 @@ import org.foray.app.FOInputHandler; import org.foray.app.FOrayDocument; -import org.foray.app.FOrayException; import org.foray.app.FOraySession; import org.foray.app.FOrayTarget; import org.foray.app.InputHandler; import org.foray.app.SessionConfig; import org.foray.common.Logging; +import org.foray.core.FOrayException; import org.foray.output.OutputTarget; import org.apache.commons.logging.Log; Modified: trunk/foray/foray-app/src/java/org/foray/demo/servlet/DemoPrintServlet.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/demo/servlet/DemoPrintServlet.java 2006-05-26 17:23:07 UTC (rev 7266) +++ trunk/foray/foray-app/src/java/org/foray/demo/servlet/DemoPrintServlet.java 2006-05-26 17:48:40 UTC (rev 7267) @@ -25,10 +25,10 @@ package org.foray.demo.servlet; import org.foray.app.FOrayDocument; -import org.foray.app.FOrayException; import org.foray.app.FOraySession; import org.foray.app.FOrayTarget; import org.foray.app.InputHandler; +import org.foray.core.FOrayException; import org.foray.render.awt.AWTPrintRenderer; import java.awt.print.PrinterJob ; Modified: trunk/foray/foray-app/src/java/org/foray/demo/servlet/DemoServlet.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/demo/servlet/DemoServlet.java 2006-05-26 17:23:07 UTC (rev 7266) +++ trunk/foray/foray-app/src/java/org/foray/demo/servlet/DemoServlet.java 2006-05-26 17:48:40 UTC (rev 7267) @@ -25,10 +25,10 @@ package org.foray.demo.servlet; import org.foray.app.FOrayDocument; -import org.foray.app.FOrayException; import org.foray.app.FOraySession; import org.foray.app.FOrayTarget; import org.foray.app.InputHandler; +import org.foray.core.FOrayException; import org.foray.output.OutputTarget; import java.io.ByteArrayOutputStream; Copied: trunk/foray/foray-core/src/java/org/foray/core/FOrayException.java (from rev 7265, trunk/foray/foray-app/src/java/org/foray/app/FOrayException.java) =================================================================== --- trunk/foray/foray-core/src/java/org/foray/core/FOrayException.java (rev 0) +++ trunk/foray/foray-core/src/java/org/foray/core/FOrayException.java 2006-05-26 17:48:40 UTC (rev 7267) @@ -0,0 +1,166 @@ +/* + * Copyright 2004 The FOray Project. + * http://www.foray.org + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * This work is in part derived from the following work(s), used with the + * permission of the licensor: + * Apache FOP, licensed by the Apache Software Foundation + * + */ + +/* $Id$ */ + +package org.foray.core; + +import org.xml.sax.SAXException; + +import java.io.PrintStream; +import java.io.PrintWriter; +import java.lang.reflect.InvocationTargetException; + +/** + * Exception thrown when FOray has a problem. + */ +public class FOrayException extends Exception { + static final long serialVersionUID = 298590433713255908L; + + private static final String EXCEPTION_SEPARATOR = "\n---------\n"; + + private Throwable _exception; + private String contextMessage; + + /** + * Create a new FOray Exception + * + * @param message descriptive message + */ + public FOrayException(String message) { + super(message); + this.contextMessage = null; + } + + public FOrayException(String message, String contextMessage) { + super(message); + this.contextMessage = contextMessage; + } + + public FOrayException(Throwable e) { + super(e.getMessage()); + setException(e); + this.contextMessage = null; + } + + public FOrayException(Throwable e, String contextMessage) { + super(e.getMessage()); + setException(e); + this.contextMessage = contextMessage; + } + + public FOrayException(String message, Throwable e) { + super(message); + setException(e); + this.contextMessage = null; + } + + public FOrayException(String message, Throwable e, String contextMessage) { + super(message); + setException(e); + this.contextMessage = contextMessage; + } + + protected void setException(Throwable t) { + _exception = t; + } + + public Throwable getException() { + return _exception; + } + + public void setContextMessage(String contextMessage) { + this.contextMessage = contextMessage; + } + + public boolean isContextSet() { + return this.contextMessage != null; + } + + protected Throwable getRootException() { + Throwable result = _exception; + + if (result instanceof SAXException) { + result = ((SAXException)result).getException(); + } + if (result instanceof InvocationTargetException) { + result = + ((InvocationTargetException)result) + .getTargetException(); + } + if (result != _exception) { + return result; + } + return null; + } + + public String getMessage() { + if (this.contextMessage != null) { + return super.getMessage() + "\n" + + this.contextMessage; + } + return super.getMessage(); + } + + public void printStackTrace() { + synchronized (System.err) { + super.printStackTrace(); + if (_exception != null) { + System.err.println(EXCEPTION_SEPARATOR); + _exception.printStackTrace(); + } + if (getRootException() != null) { + System.err.println(EXCEPTION_SEPARATOR); + getRootException().printStackTrace(); + } + } + } + + public void printStackTrace(PrintStream stream) { + synchronized (stream) { + super.printStackTrace(stream); + if (_exception != null) { + stream.println(EXCEPTION_SEPARATOR); + _exception.printStackTrace(stream); + } + if (getRootException() != null) { + stream.println(EXCEPTION_SEPARATOR); + getRootException().printStackTrace(stream); + } + } + } + + public void printStackTrace(PrintWriter writer) { + synchronized (writer) { + super.printStackTrace(writer); + if (_exception != null) { + writer.println(EXCEPTION_SEPARATOR); + _exception.printStackTrace(writer); + } + if (getRootException() != null) { + writer.println(EXCEPTION_SEPARATOR); + getRootException().printStackTrace(writer); + } + } + } + +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <vic...@us...> - 2006-05-26 17:23:19
|
Revision: 7266 Author: victormote Date: 2006-05-26 10:23:07 -0700 (Fri, 26 May 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=7266&view=rev Log Message: ----------- Move the FOraySpecific class to the app package and delete the specific package. Added Paths: ----------- trunk/foray/foray-app/src/java/org/foray/app/FOraySpecific.java Removed Paths: ------------- trunk/foray/foray-specific/ Copied: trunk/foray/foray-app/src/java/org/foray/app/FOraySpecific.java (from rev 7265, trunk/foray/foray-specific/src/java/org/foray/specific/FOraySpecific.java) =================================================================== --- trunk/foray/foray-app/src/java/org/foray/app/FOraySpecific.java (rev 0) +++ trunk/foray/foray-app/src/java/org/foray/app/FOraySpecific.java 2006-05-26 17:23:07 UTC (rev 7266) @@ -0,0 +1,117 @@ +/* + * Copyright 2006 The FOray Project. + * http://www.foray.org + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * This work is in part derived from the following work(s), used with the + * permission of the licensor: + * Apache FOP, licensed by the Apache Software Foundation + * + */ + +/* $Id$ */ + +package org.foray.app; + +import org.foray.common.Logging; +import org.foray.common.XMLParser; +import org.foray.font.FOrayFontServer; +import org.foray.graphic.FOrayGraphicServer; + +import org.axsl.areaW.AreaTreeFactory; +import org.axsl.foR.FOTreeFactory; +import org.axsl.fontR.FontException; +import org.axsl.fontR.FontServer; +import org.axsl.graphicR.GraphicServer; +import org.axsl.layout.LayoutFactory; +import org.axsl.text.TextServer; + +import org.apache.commons.logging.Log; + +import org.xml.sax.EntityResolver; + +import java.net.URL; + +/** + * Utility class that creates FOray-specific implementations of the high-level + * objects for each module. + * The purpose of the methods in this class is to simplify the task of getting + * FOray started up in a standard manner without diminishing the flexibility + * of its pluggable nature. + */ +public class FOraySpecific { + + /** + * Private constructor, as this class should never be instantiated. + */ + private FOraySpecific() { + } + + public static Log makeLogger(SessionConfig configuration) { + if (configuration.optionVerbosity().equals("debug")) { + return Logging.makeDebugLogger(); + } else { + return Logging.makeDefaultLogger(); + } + } + + public static FontServer makeFontServer(Log logger, + SessionConfig configuration, EntityResolver entityResolver) + throws FOrayException { + FOrayFontServer forayFontServer = new FOrayFontServer(logger); + forayFontServer.setBaseFontURL( + configuration.optionFontBaseDirectory()); + forayFontServer.setBaseURL(configuration.optionBaseDirectory()); + forayFontServer.setEntityResolver(entityResolver); + try { + forayFontServer.setup(configuration.optionFontConfiguration(), + null); + } catch (FontException e) { + throw new FOrayException(e); + } + return forayFontServer; + } + + public static TextServer makeTextServer(Log logger, + SessionConfig configuration) throws FOrayException { + URL hyphenationDir = configuration.optionHyphenationBaseDirectory(); + return new org.foray.text.TextServer(logger, hyphenationDir); + + } + + public static GraphicServer makeGraphicServer(Log logger) + throws FOrayException { + return new FOrayGraphicServer(logger, XMLParser.getParserClassName()); + } + + public FOTreeFactory makeFOTreeFactory(GraphicServer graphicServer, + TextServer textServer, URL[] graphicSearchPath) + throws FOrayException { + return null; +// return new FOrayFOTreeServer(this.getLogger(), +// graphicServer, textServer, graphicSearchPath,Wi +// getConfiguration().optionCacheGraphics()); +// + } + + public AreaTreeFactory makeAreaTreeFactory() + throws FOrayException { + return null; + } + + public LayoutFactory makeLayoutFactory() throws FOrayException { + return null; + } + +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <vic...@us...> - 2006-05-26 17:09:28
|
Revision: 7265 Author: victormote Date: 2006-05-26 10:09:20 -0700 (Fri, 26 May 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=7265&view=rev Log Message: ----------- Change to a static approach. Modified Paths: -------------- trunk/foray/foray-specific/src/java/org/foray/specific/FOraySpecific.java Modified: trunk/foray/foray-specific/src/java/org/foray/specific/FOraySpecific.java =================================================================== --- trunk/foray/foray-specific/src/java/org/foray/specific/FOraySpecific.java 2006-05-26 16:12:28 UTC (rev 7264) +++ trunk/foray/foray-specific/src/java/org/foray/specific/FOraySpecific.java 2006-05-26 17:09:20 UTC (rev 7265) @@ -26,6 +26,7 @@ import org.foray.app.FOrayException; import org.foray.app.SessionConfig; +import org.foray.common.Logging; import org.foray.common.XMLParser; import org.foray.font.FOrayFontServer; import org.foray.graphic.FOrayGraphicServer; @@ -44,21 +45,33 @@ import java.net.URL; +/** + * Utility class that creates FOray-specific implementations of the high-level + * objects for each module. + * The purpose of the methods in this class is to simplify the task of getting + * FOray started up in a standard manner without diminishing the flexibility + * of its pluggable nature. + */ public class FOraySpecific { - private Log logger; - - public FOraySpecific(Log logger) throws FOrayException { - this.logger = logger; + /** + * Private constructor, as this class should never be instantiated. + */ + private FOraySpecific() { } - public Log getLogger() { - return this.logger; + public static Log makeLogger(SessionConfig configuration) { + if (configuration.optionVerbosity().equals("debug")) { + return Logging.makeDebugLogger(); + } else { + return Logging.makeDefaultLogger(); + } } - public FontServer makeFontServer(SessionConfig configuration, - EntityResolver entityResolver) throws FOrayException { - FOrayFontServer forayFontServer = new FOrayFontServer(getLogger()); + public static FontServer makeFontServer(Log logger, + SessionConfig configuration, EntityResolver entityResolver) + throws FOrayException { + FOrayFontServer forayFontServer = new FOrayFontServer(logger); forayFontServer.setBaseFontURL( configuration.optionFontBaseDirectory()); forayFontServer.setBaseURL(configuration.optionBaseDirectory()); @@ -72,17 +85,16 @@ return forayFontServer; } - public TextServer makeTextServer(SessionConfig configuration) - throws FOrayException { + public static TextServer makeTextServer(Log logger, + SessionConfig configuration) throws FOrayException { URL hyphenationDir = configuration.optionHyphenationBaseDirectory(); - return new org.foray.text.TextServer(getLogger(), - hyphenationDir); + return new org.foray.text.TextServer(logger, hyphenationDir); } - public GraphicServer makeGraphicServer() throws FOrayException { - return new FOrayGraphicServer(getLogger(), - XMLParser.getParserClassName()); + public static GraphicServer makeGraphicServer(Log logger) + throws FOrayException { + return new FOrayGraphicServer(logger, XMLParser.getParserClassName()); } public FOTreeFactory makeFOTreeFactory(GraphicServer graphicServer, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <vic...@us...> - 2006-05-26 16:12:44
|
Revision: 7264 Author: victormote Date: 2006-05-26 09:12:28 -0700 (Fri, 26 May 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=7264&view=rev Log Message: ----------- Conform to axsl method name change. Modified Paths: -------------- trunk/foray/foray-areatree/src/java/org/foray/area/LineArea.java trunk/foray/foray-font/src/java/org/foray/font/FOrayFont.java Modified: trunk/foray/foray-areatree/src/java/org/foray/area/LineArea.java =================================================================== --- trunk/foray/foray-areatree/src/java/org/foray/area/LineArea.java 2006-05-26 15:58:40 UTC (rev 7263) +++ trunk/foray/foray-areatree/src/java/org/foray/area/LineArea.java 2006-05-26 16:12:28 UTC (rev 7264) @@ -573,7 +573,7 @@ int axis = this.getWritingMode().getAbsoluteAxis(Constants.AXIS_IP); int baseline = this.traitDominantBaseline(); Font font = this.getPrimaryFont().getFont(); - return font.baseline(axis, baseline, this.traitFontSize()); + return font.baselineOffset(axis, baseline, this.traitFontSize()); } public int alignmentPointX() { Modified: trunk/foray/foray-font/src/java/org/foray/font/FOrayFont.java =================================================================== --- trunk/foray/foray-font/src/java/org/foray/font/FOrayFont.java 2006-05-26 15:58:40 UTC (rev 7263) +++ trunk/foray/foray-font/src/java/org/foray/font/FOrayFont.java 2006-05-26 16:12:28 UTC (rev 7264) @@ -297,7 +297,7 @@ /** * {@inheritDoc} */ - public int baseline(int writingMode, int baselineType, int fontSize) { + public int baselineOffset(int writingMode, int baselineType, int fontSize) { int baseline = extractBaseline(writingMode, baselineType, fontSize); if (baseline == Integer.MIN_VALUE) { return estimateBaseline(writingMode, baselineType, fontSize); @@ -307,11 +307,11 @@ /** * Returns the font's explicit definition of the baseline, if possible. - * @param writingMode Same as for {@link #baseline(int, int, int)}. - * @param baselineType Same as for {@link #baseline(int, int, int)}. - * @param fontSize Same as for {@link #baseline(int, int, int)}. + * @param writingMode Same as for {@link #baselineOffset(int, int, int)}. + * @param baselineType Same as for {@link #baselineOffset(int, int, int)}. + * @param fontSize Same as for {@link #baselineOffset(int, int, int)}. * @return The extracted Baseline, as described for - * {@link #baseline(int, int, int)}, if it exists. Otherwise, returns + * {@link #baselineOffset(int, int, int)}, if it exists. Otherwise, returns * {@link Integer#MIN_VALUE}. */ public abstract int extractBaseline(int writingMode, int baselineType, @@ -320,9 +320,9 @@ /** * Provides reasonable estimates of the various baseline values for the * font, based on other font metrics. - * @param writingMode Same as for {@link #baseline(int, int, int)}. - * @param baselineType Same as for {@link #baseline(int, int, int)}. - * @param fontSize Same as for {@link #baseline(int, int, int)}. + * @param writingMode Same as for {@link #baselineOffset(int, int, int)}. + * @param baselineType Same as for {@link #baselineOffset(int, int, int)}. + * @param fontSize Same as for {@link #baselineOffset(int, int, int)}. * @return The estimated value of the baseline. */ public int estimateBaseline(int writingMode, int baselineType, @@ -346,8 +346,8 @@ } case Constants.BASELINE_MIDDLE: { /* First get the Alphabetic baseline. */ - int baseline = baseline(writingMode, Constants.BASELINE_ALPHABETIC, - fontSize); + int baseline = baselineOffset(writingMode, + Constants.BASELINE_ALPHABETIC, fontSize); baseline -= this.getXHeight(fontSize) / 2; return baseline; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <vic...@us...> - 2006-05-26 15:59:15
|
Revision: 7263 Author: victormote Date: 2006-05-26 08:58:40 -0700 (Fri, 26 May 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=7263&view=rev Log Message: ----------- Conform to axsl changes regarding location of writing-mode related constants. Modified Paths: -------------- trunk/foray/foray-areatree/src/java/org/foray/area/AbstractInlineArea.java trunk/foray/foray-areatree/src/java/org/foray/area/Area.java trunk/foray/foray-areatree/src/java/org/foray/area/AreaFlexible.java trunk/foray/foray-areatree/src/java/org/foray/area/LineArea.java trunk/foray/foray-areatree/src/java/org/foray/area/PageRA.java trunk/foray/foray-areatree/src/java/org/foray/area/RegionRABody.java trunk/foray/foray-areatree/src/java/org/foray/area/TableRowContainer.java trunk/foray/foray-fotree/src/java/org/foray/fotree/FObj.java trunk/foray/foray-fotree/src/java/org/foray/fotree/FObjScaled.java trunk/foray/foray-fotree/src/java/org/foray/fotree/PropertyList.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/AbsoluteDimension.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/AbsoluteOffset.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/BackgroundPosition.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/BorderColor.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/BorderPrecedence.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/BorderSeparation.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/BorderStyle.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/BorderWidth.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/ContentDimension.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Extent.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/GlyphOrientation.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Indent.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Margin.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Padding.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/PageDimension.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/RelativeSpace.java trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Size.java trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtWritingMode.java trunk/foray/foray-fotree/src/java/org/foray/fotree/value/PropertyCollection.java Modified: trunk/foray/foray-areatree/src/java/org/foray/area/AbstractInlineArea.java =================================================================== --- trunk/foray/foray-areatree/src/java/org/foray/area/AbstractInlineArea.java 2006-05-26 15:04:07 UTC (rev 7262) +++ trunk/foray/foray-areatree/src/java/org/foray/area/AbstractInlineArea.java 2006-05-26 15:58:40 UTC (rev 7263) @@ -26,8 +26,8 @@ import org.axsl.areaR.GeneralInlineArea; import org.axsl.areaW.AreaWException; +import org.axsl.common.Constants; import org.axsl.foR.FObj; -import org.axsl.foR.WritingMode; public abstract class AbstractInlineArea extends AreaFlexible @@ -49,7 +49,7 @@ * @see Area#contentStackingAxis() */ public byte contentStackingAxisRelative() { - return WritingMode.AXIS_IP; + return Constants.AXIS_IP; } public Area getOverflowArea(Area childRequesting) throws AreaWException { Modified: trunk/foray/foray-areatree/src/java/org/foray/area/Area.java =================================================================== --- trunk/foray/foray-areatree/src/java/org/foray/area/Area.java 2006-05-26 15:04:07 UTC (rev 7262) +++ trunk/foray/foray-areatree/src/java/org/foray/area/Area.java 2006-05-26 15:58:40 UTC (rev 7263) @@ -369,9 +369,9 @@ public int brOriginX() { // Start at the padding-rectangle origin. int x = prOriginX(); - if (this.getBPAxis() == WritingMode.AXIS_VERTICAL) { + if (this.getBPAxis() == Constants.AXIS_VERTICAL) { boolean goingRight = (this.traitIPDirection() - == WritingMode.DIRECTION_LEFT_TO_RIGHT); + == Constants.DIRECTION_LEFT_TO_RIGHT); if (goingRight) { x -= this.traitBorderStartWidth(); } else { @@ -380,7 +380,7 @@ } else { // Our BP Axis is horizontal boolean goingRight = (this.traitBPDirection() - == WritingMode.DIRECTION_LEFT_TO_RIGHT); + == Constants.DIRECTION_LEFT_TO_RIGHT); if (goingRight) { x -= this.traitBorderBeforeWidth(); } else { @@ -398,9 +398,9 @@ public int brOriginY() { // Start at the padding-rectangle origin. int y = prOriginY(); - if (this.getBPAxis() == WritingMode.AXIS_VERTICAL) { + if (this.getBPAxis() == Constants.AXIS_VERTICAL) { boolean goingDown = (this.traitBPDirection() - == WritingMode.DIRECTION_TOP_TO_BOTTOM); + == Constants.DIRECTION_TOP_TO_BOTTOM); if (goingDown) { y += this.traitBorderBeforeWidth(); } else { @@ -409,7 +409,7 @@ } else { // Our BP Axis is horizontal boolean goingUp = (this.traitIPDirection() - == WritingMode.DIRECTION_BOTTOM_TO_TOP); + == Constants.DIRECTION_BOTTOM_TO_TOP); if (goingUp) { y -= this.traitBorderStartWidth(); } else { @@ -467,9 +467,9 @@ public int prOriginX() { // Start at the content-rectangle origin. int x = crOriginX(); - if (this.getBPAxis() == WritingMode.AXIS_VERTICAL) { + if (this.getBPAxis() == Constants.AXIS_VERTICAL) { boolean goingRight = (this.traitIPDirection() - == WritingMode.DIRECTION_LEFT_TO_RIGHT); + == Constants.DIRECTION_LEFT_TO_RIGHT); if (goingRight) { x -= this.traitPaddingStart(); } else { @@ -478,7 +478,7 @@ } else { // Our BP Axis is horizontal boolean goingRight = (this.traitBPDirection() - == WritingMode.DIRECTION_LEFT_TO_RIGHT); + == Constants.DIRECTION_LEFT_TO_RIGHT); if (goingRight) { x -= this.traitPaddingBefore(); } else { @@ -496,9 +496,9 @@ public int prOriginY() { // Start at the content-rectangle origin. int y = crOriginY(); - if (this.getBPAxis() == WritingMode.AXIS_VERTICAL) { + if (this.getBPAxis() == Constants.AXIS_VERTICAL) { boolean goingDown = (this.traitBPDirection() - == WritingMode.DIRECTION_TOP_TO_BOTTOM); + == Constants.DIRECTION_TOP_TO_BOTTOM); if (goingDown) { y += this.traitPaddingBefore(); } else { @@ -507,7 +507,7 @@ } else { // Our BP Axis is horizontal boolean goingRight = (this.traitBPDirection() - == WritingMode.DIRECTION_LEFT_TO_RIGHT); + == Constants.DIRECTION_LEFT_TO_RIGHT); if (goingRight) { y -= this.traitPaddingBefore(); } else { @@ -552,21 +552,21 @@ // Start at the parent's content origin. int x = crReferenceX(); switch (getWritingMode().getIPDirectionOdd()) { - case WritingMode.DIRECTION_LEFT_TO_RIGHT: { + case Constants.DIRECTION_LEFT_TO_RIGHT: { x += this.crOriginIPDOffset(); return x; } - case WritingMode.DIRECTION_RIGHT_TO_LEFT: { + case Constants.DIRECTION_RIGHT_TO_LEFT: { x -= this.crOriginIPDOffset(); return x; } } switch (getWritingMode().getBPDirection()) { - case WritingMode.DIRECTION_LEFT_TO_RIGHT: { + case Constants.DIRECTION_LEFT_TO_RIGHT: { x += this.crOriginBPDOffset(); return x; } - case WritingMode.DIRECTION_RIGHT_TO_LEFT: { + case Constants.DIRECTION_RIGHT_TO_LEFT: { x -= this.crOriginBPDOffset(); return x; } @@ -591,21 +591,21 @@ // Start at the parent's content origin. int y = getParentArea().crOriginY(); switch (getWritingMode().getBPDirection()) { - case WritingMode.DIRECTION_TOP_TO_BOTTOM: { + case Constants.DIRECTION_TOP_TO_BOTTOM: { y -= this.crOriginBPDOffset(); return y; } - case WritingMode.DIRECTION_BOTTOM_TO_TOP: { + case Constants.DIRECTION_BOTTOM_TO_TOP: { y += this.crOriginBPDOffset(); return y; } } switch (getWritingMode().getIPDirectionOdd()) { - case WritingMode.DIRECTION_TOP_TO_BOTTOM: { + case Constants.DIRECTION_TOP_TO_BOTTOM: { y -= this.crOriginIPDOffset(); return y; } - case WritingMode.DIRECTION_RIGHT_TO_LEFT: { + case Constants.DIRECTION_RIGHT_TO_LEFT: { y += this.crOriginIPDOffset(); return y; } @@ -900,7 +900,7 @@ * stack in the IPD should override this method. */ public byte contentStackingAxisRelative() { - return WritingMode.AXIS_BP; + return Constants.AXIS_BP; } /** Modified: trunk/foray/foray-areatree/src/java/org/foray/area/AreaFlexible.java =================================================================== --- trunk/foray/foray-areatree/src/java/org/foray/area/AreaFlexible.java 2006-05-26 15:04:07 UTC (rev 7262) +++ trunk/foray/foray-areatree/src/java/org/foray/area/AreaFlexible.java 2006-05-26 15:58:40 UTC (rev 7263) @@ -24,10 +24,9 @@ package org.foray.area; +import org.axsl.common.Constants; import org.axsl.foR.FObj; -import org.axsl.foR.WritingMode; - import java.util.List; /** @@ -357,7 +356,7 @@ public int crOriginIPDOffset() { int offset = 0; if (getParentArea().contentStackingAxisRelative() - == WritingMode.AXIS_IP) { + == Constants.AXIS_IP) { offset += this.pdUsedBySiblings(); offset += this.getAnteriorSpace(); offset += this.traitBorderStartWidth(); @@ -372,7 +371,7 @@ public int crOriginBPDOffset() { int offset = 0; if (getParentArea().contentStackingAxisRelative() - == WritingMode.AXIS_BP) { + == Constants.AXIS_BP) { offset += this.pdUsedBySiblings(); offset += this.getAnteriorSpace(); offset += this.traitBorderBeforeWidth(); Modified: trunk/foray/foray-areatree/src/java/org/foray/area/LineArea.java =================================================================== --- trunk/foray/foray-areatree/src/java/org/foray/area/LineArea.java 2006-05-26 15:04:07 UTC (rev 7262) +++ trunk/foray/foray-areatree/src/java/org/foray/area/LineArea.java 2006-05-26 15:58:40 UTC (rev 7263) @@ -30,7 +30,6 @@ import org.axsl.foR.FOText; import org.axsl.foR.FObj; import org.axsl.foR.FObjMixed; -import org.axsl.foR.WritingMode; import org.axsl.foR.fo.BasicLink; import org.axsl.foR.fo.Block; import org.axsl.foR.fo.Character; @@ -532,7 +531,7 @@ * @see Area#contentStackingAxis() */ public byte contentStackingAxisRelative() { - return WritingMode.AXIS_IP; + return Constants.AXIS_IP; } /* @@ -571,9 +570,10 @@ * {@inheritDoc} */ public int alignmentPointOffset() { + int axis = this.getWritingMode().getAbsoluteAxis(Constants.AXIS_IP); int baseline = this.traitDominantBaseline(); Font font = this.getPrimaryFont().getFont(); - return font.baseline(0, baseline, this.traitFontSize()); + return font.baseline(axis, baseline, this.traitFontSize()); } public int alignmentPointX() { @@ -698,14 +698,14 @@ } case Constants.FOVAL_INSIDE: { if (this.getPage().getBindingEdge() - == WritingMode.DIRECTION_END) { + == Constants.DIRECTION_END) { return Constants.FOVAL_END; } return Constants.FOVAL_START; } case Constants.FOVAL_OUTSIDE: { if (this.getPage().getBindingEdge() - == WritingMode.DIRECTION_END) { + == Constants.DIRECTION_END) { return Constants.FOVAL_START; } return Constants.FOVAL_END; Modified: trunk/foray/foray-areatree/src/java/org/foray/area/PageRA.java =================================================================== --- trunk/foray/foray-areatree/src/java/org/foray/area/PageRA.java 2006-05-26 15:04:07 UTC (rev 7262) +++ trunk/foray/foray-areatree/src/java/org/foray/area/PageRA.java 2006-05-26 15:58:40 UTC (rev 7263) @@ -30,7 +30,6 @@ import org.axsl.areaW.AreaWException; import org.axsl.common.Constants; import org.axsl.foR.FObj; -import org.axsl.foR.WritingMode; import org.axsl.foR.fo.FootnoteBody; import org.axsl.foR.fo.Marker; import org.axsl.foR.fo.PageSequence; @@ -362,14 +361,14 @@ } public int crIPD() { - if (getWritingMode().getIPAxis() == WritingMode.AXIS_HORIZONTAL) { + if (getWritingMode().getIPAxis() == Constants.AXIS_HORIZONTAL) { return traitPageWidth() - getMarginLeft() - getMarginRight(); } return traitPageHeight() - getMarginTop() - getMarginBottom(); } public int crBPD() { - if (getWritingMode().getBPAxis() == WritingMode.AXIS_VERTICAL) { + if (getWritingMode().getBPAxis() == Constants.AXIS_VERTICAL) { return traitPageHeight() - getMarginTop() - getMarginBottom(); } return traitPageWidth() - getMarginLeft() - getMarginRight(); @@ -393,19 +392,19 @@ public int crOriginX() { switch (getWritingMode().getAbsoluteDirFromRelativeAxis( - WritingMode.AXIS_BP)) { - case WritingMode.DIRECTION_TOP_TO_BOTTOM: - case WritingMode.DIRECTION_BOTTOM_TO_TOP: { + Constants.AXIS_BP)) { + case Constants.DIRECTION_TOP_TO_BOTTOM: + case Constants.DIRECTION_BOTTOM_TO_TOP: { if (getWritingMode().getIPDirectionOdd() - == WritingMode.DIRECTION_LEFT_TO_RIGHT) { + == Constants.DIRECTION_LEFT_TO_RIGHT) { return getMarginLeft(); } return this.traitPageWidth() - getMarginRight(); } - case WritingMode.DIRECTION_LEFT_TO_RIGHT: { + case Constants.DIRECTION_LEFT_TO_RIGHT: { return getMarginLeft(); } - case WritingMode.DIRECTION_RIGHT_TO_LEFT: { + case Constants.DIRECTION_RIGHT_TO_LEFT: { return this.traitPageWidth() - getMarginRight(); } } @@ -414,17 +413,17 @@ public int crOriginY() { switch (getWritingMode().getAbsoluteDirFromRelativeAxis( - WritingMode.AXIS_BP)) { - case WritingMode.DIRECTION_TOP_TO_BOTTOM: { + Constants.AXIS_BP)) { + case Constants.DIRECTION_TOP_TO_BOTTOM: { return traitPageHeight() - getMarginTop(); } - case WritingMode.DIRECTION_BOTTOM_TO_TOP: { + case Constants.DIRECTION_BOTTOM_TO_TOP: { return getMarginBottom(); } - case WritingMode.DIRECTION_LEFT_TO_RIGHT: - case WritingMode.DIRECTION_RIGHT_TO_LEFT: { + case Constants.DIRECTION_LEFT_TO_RIGHT: + case Constants.DIRECTION_RIGHT_TO_LEFT: { if (getWritingMode().getIPDirectionOdd() - == WritingMode.DIRECTION_TOP_TO_BOTTOM) { + == Constants.DIRECTION_TOP_TO_BOTTOM) { return traitPageHeight() - getMarginTop(); } return getMarginBottom(); Modified: trunk/foray/foray-areatree/src/java/org/foray/area/RegionRABody.java =================================================================== --- trunk/foray/foray-areatree/src/java/org/foray/area/RegionRABody.java 2006-05-26 15:04:07 UTC (rev 7262) +++ trunk/foray/foray-areatree/src/java/org/foray/area/RegionRABody.java 2006-05-26 15:58:40 UTC (rev 7263) @@ -27,7 +27,7 @@ import org.axsl.areaR.MainReferenceArea; import org.axsl.areaR.RegionBodyArea; import org.axsl.areaW.AreaWException; -import org.axsl.foR.WritingMode; +import org.axsl.common.Constants; import org.axsl.foR.fo.RegionBody; import org.axsl.foR.fo.SimplePageMaster; @@ -135,7 +135,7 @@ public int crBPD() { int dimension = getParentArea().brBPD(); - if (this.getBPAxis() == WritingMode.AXIS_VERTICAL) { + if (this.getBPAxis() == Constants.AXIS_VERTICAL) { dimension -= getMarginTop(); dimension -= getMarginBottom(); } else { @@ -147,7 +147,7 @@ public int crIPD() { int dimension = getParentArea().brIPD(); - if (this.getBPAxis() == WritingMode.AXIS_VERTICAL) { + if (this.getBPAxis() == Constants.AXIS_VERTICAL) { dimension -= getMarginLeft(); dimension -= getMarginRight(); } else { @@ -178,16 +178,16 @@ RegionBody rb = (RegionBody) traitGeneratedBy(); SimplePageMaster spm = (SimplePageMaster) rb.parentFO(); switch (getParentArea().contentStackingDirectionAbsolute()) { - case WritingMode.DIRECTION_TOP_TO_BOTTOM: - case WritingMode.DIRECTION_BOTTOM_TO_TOP: { + case Constants.DIRECTION_TOP_TO_BOTTOM: + case Constants.DIRECTION_BOTTOM_TO_TOP: { // x is where it needs to be break; } - case WritingMode.DIRECTION_LEFT_TO_RIGHT: { + case Constants.DIRECTION_LEFT_TO_RIGHT: { x += spm.getStartExtent(); break; } - case WritingMode.DIRECTION_RIGHT_TO_LEFT: { + case Constants.DIRECTION_RIGHT_TO_LEFT: { x -= spm.getEndExtent(); break; } @@ -202,17 +202,17 @@ SimplePageMaster spm = (SimplePageMaster) traitGeneratedBy().parentFO(); switch (getWritingMode().getAbsoluteDirFromRelativeAxis( - WritingMode.AXIS_BP)) { - case WritingMode.DIRECTION_TOP_TO_BOTTOM: { + Constants.AXIS_BP)) { + case Constants.DIRECTION_TOP_TO_BOTTOM: { y -= spm.getBeforeExtent(); break; } - case WritingMode.DIRECTION_BOTTOM_TO_TOP: { + case Constants.DIRECTION_BOTTOM_TO_TOP: { y += spm.getAfterExtent(); break; } - case WritingMode.DIRECTION_LEFT_TO_RIGHT: - case WritingMode.DIRECTION_RIGHT_TO_LEFT: { + case Constants.DIRECTION_LEFT_TO_RIGHT: + case Constants.DIRECTION_RIGHT_TO_LEFT: { // y is where it needs to be break; } Modified: trunk/foray/foray-areatree/src/java/org/foray/area/TableRowContainer.java =================================================================== --- trunk/foray/foray-areatree/src/java/org/foray/area/TableRowContainer.java 2006-05-26 15:04:07 UTC (rev 7262) +++ trunk/foray/foray-areatree/src/java/org/foray/area/TableRowContainer.java 2006-05-26 15:58:40 UTC (rev 7263) @@ -25,7 +25,7 @@ package org.foray.area; import org.axsl.areaW.TableCellArea; -import org.axsl.foR.WritingMode; +import org.axsl.common.Constants; import org.axsl.foR.fo.TableCell; import org.axsl.foR.fo.TableRow; @@ -52,7 +52,7 @@ * @see Area#contentStackingAxis() */ public byte contentStackingAxisRelative() { - return WritingMode.AXIS_IP; + return Constants.AXIS_IP; } public int crOriginY() { Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/FObj.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/FObj.java 2006-05-26 15:04:07 UTC (rev 7262) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/FObj.java 2006-05-26 15:58:40 UTC (rev 7263) @@ -26,7 +26,6 @@ import org.foray.common.XMLCharacter; import org.foray.fotree.fo.prop.Dimension; -import org.foray.fotree.value.DtWritingMode; import org.axsl.common.Constants; import org.axsl.foR.FOTreeException; @@ -526,7 +525,7 @@ * {@inheritDoc} */ public int traitStartIndent(int ipdContainingRA) { - return propertyList.getIndent(DtWritingMode.DIRECTION_START, + return propertyList.getIndent(Constants.DIRECTION_START, ipdContainingRA); } @@ -933,7 +932,7 @@ * {@inheritDoc} */ public int traitEndIndent(int ipdContainingRA) { - return propertyList.getIndent(DtWritingMode.DIRECTION_END, + return propertyList.getIndent(Constants.DIRECTION_END, ipdContainingRA); } @@ -1339,119 +1338,119 @@ * {@inheritDoc} */ public Color traitBorderBeforeColor() { - return propertyList.getBorderColor(DtWritingMode.DIRECTION_BEFORE); + return propertyList.getBorderColor(Constants.DIRECTION_BEFORE); } /** * {@inheritDoc} */ public Color traitBorderAfterColor() { - return propertyList.getBorderColor(DtWritingMode.DIRECTION_AFTER); + return propertyList.getBorderColor(Constants.DIRECTION_AFTER); } /** * {@inheritDoc} */ public Color traitBorderStartColor() { - return propertyList.getBorderColor(DtWritingMode.DIRECTION_START); + return propertyList.getBorderColor(Constants.DIRECTION_START); } /** * {@inheritDoc} */ public Color traitBorderEndColor() { - return propertyList.getBorderColor(DtWritingMode.DIRECTION_END); + return propertyList.getBorderColor(Constants.DIRECTION_END); } /** * {@inheritDoc} */ public Color traitBorderLeftColor() { - return propertyList.getBorderColor(DtWritingMode.DIRECTION_LEFT); + return propertyList.getBorderColor(Constants.DIRECTION_LEFT); } /** * {@inheritDoc} */ public Color traitBorderRightColor() { - return propertyList.getBorderColor(DtWritingMode.DIRECTION_RIGHT); + return propertyList.getBorderColor(Constants.DIRECTION_RIGHT); } /** * {@inheritDoc} */ public Color traitBorderTopColor() { - return propertyList.getBorderColor(DtWritingMode.DIRECTION_TOP); + return propertyList.getBorderColor(Constants.DIRECTION_TOP); } /** * {@inheritDoc} */ public Color traitBorderBottomColor() { - return propertyList.getBorderColor(DtWritingMode.DIRECTION_BOTTOM); + return propertyList.getBorderColor(Constants.DIRECTION_BOTTOM); } /** * {@inheritDoc} */ public short traitBorderBeforeStyle() { - return propertyList.getBorderStyle(DtWritingMode.DIRECTION_BEFORE); + return propertyList.getBorderStyle(Constants.DIRECTION_BEFORE); } /** * {@inheritDoc} */ public short traitBorderAfterStyle() { - return propertyList.getBorderStyle(DtWritingMode.DIRECTION_AFTER); + return propertyList.getBorderStyle(Constants.DIRECTION_AFTER); } /** * {@inheritDoc} */ public short traitBorderStartStyle() { - return propertyList.getBorderStyle(DtWritingMode.DIRECTION_START); + return propertyList.getBorderStyle(Constants.DIRECTION_START); } /** * {@inheritDoc} */ public short traitBorderEndStyle() { - return propertyList.getBorderStyle(DtWritingMode.DIRECTION_END); + return propertyList.getBorderStyle(Constants.DIRECTION_END); } /** * {@inheritDoc} */ public short traitBorderLeftStyle() { - return propertyList.getBorderStyle(DtWritingMode.DIRECTION_LEFT); + return propertyList.getBorderStyle(Constants.DIRECTION_LEFT); } /** * {@inheritDoc} */ public short traitBorderRightStyle() { - return propertyList.getBorderStyle(DtWritingMode.DIRECTION_RIGHT); + return propertyList.getBorderStyle(Constants.DIRECTION_RIGHT); } /** * {@inheritDoc} */ public short traitBorderTopStyle() { - return propertyList.getBorderStyle(DtWritingMode.DIRECTION_TOP); + return propertyList.getBorderStyle(Constants.DIRECTION_TOP); } /** * {@inheritDoc} */ public short traitBorderBottomStyle() { - return propertyList.getBorderStyle(DtWritingMode.DIRECTION_BOTTOM); + return propertyList.getBorderStyle(Constants.DIRECTION_BOTTOM); } /** * {@inheritDoc} */ public int traitBorderBeforeWidth(boolean isFirst) { - return propertyList.getBorderWidth(DtWritingMode.DIRECTION_BEFORE, + return propertyList.getBorderWidth(Constants.DIRECTION_BEFORE, isFirst); } @@ -1459,7 +1458,7 @@ * {@inheritDoc} */ public int traitBorderAfterWidth(boolean isLast) { - return propertyList.getBorderWidth(DtWritingMode.DIRECTION_AFTER, + return propertyList.getBorderWidth(Constants.DIRECTION_AFTER, isLast); } @@ -1467,7 +1466,7 @@ * {@inheritDoc} */ public int traitBorderStartWidth(boolean isFirst) { - return propertyList.getBorderWidth(DtWritingMode.DIRECTION_START, + return propertyList.getBorderWidth(Constants.DIRECTION_START, isFirst); } @@ -1475,35 +1474,35 @@ * {@inheritDoc} */ public int traitBorderEndWidth(boolean isLast) { - return propertyList.getBorderWidth(DtWritingMode.DIRECTION_END, isLast); + return propertyList.getBorderWidth(Constants.DIRECTION_END, isLast); } /** * {@inheritDoc} */ public int traitBorderLeftWidth() { - return propertyList.getBorderWidth(DtWritingMode.DIRECTION_LEFT, true); + return propertyList.getBorderWidth(Constants.DIRECTION_LEFT, true); } /** * {@inheritDoc} */ public int traitBorderRightWidth() { - return propertyList.getBorderWidth(DtWritingMode.DIRECTION_RIGHT, true); + return propertyList.getBorderWidth(Constants.DIRECTION_RIGHT, true); } /** * {@inheritDoc} */ public int traitBorderTopWidth() { - return propertyList.getBorderWidth(DtWritingMode.DIRECTION_TOP, true); + return propertyList.getBorderWidth(Constants.DIRECTION_TOP, true); } /** * {@inheritDoc} */ public int traitBorderBottomWidth() { - return propertyList.getBorderWidth(DtWritingMode.DIRECTION_BOTTOM, + return propertyList.getBorderWidth(Constants.DIRECTION_BOTTOM, true); } @@ -1511,56 +1510,56 @@ * {@inheritDoc} */ public int traitPaddingBefore(boolean isFirst) { - return propertyList.getPadding(DtWritingMode.DIRECTION_BEFORE, isFirst); + return propertyList.getPadding(Constants.DIRECTION_BEFORE, isFirst); } /** * {@inheritDoc} */ public int traitPaddingAfter(boolean isLast) { - return propertyList.getPadding(DtWritingMode.DIRECTION_AFTER, isLast); + return propertyList.getPadding(Constants.DIRECTION_AFTER, isLast); } /** * {@inheritDoc} */ public int traitPaddingStart(boolean isFirst) { - return propertyList.getPadding(DtWritingMode.DIRECTION_START, isFirst); + return propertyList.getPadding(Constants.DIRECTION_START, isFirst); } /** * {@inheritDoc} */ public int traitPaddingEnd(boolean isLast) { - return propertyList.getPadding(DtWritingMode.DIRECTION_END, isLast); + return propertyList.getPadding(Constants.DIRECTION_END, isLast); } /** * {@inheritDoc} */ public int traitPaddingLeft() { - return propertyList.getPadding(DtWritingMode.DIRECTION_LEFT, true); + return propertyList.getPadding(Constants.DIRECTION_LEFT, true); } /** * {@inheritDoc} */ public int traitPaddingRight() { - return propertyList.getPadding(DtWritingMode.DIRECTION_RIGHT, true); + return propertyList.getPadding(Constants.DIRECTION_RIGHT, true); } /** * {@inheritDoc} */ public int traitPaddingTop() { - return propertyList.getPadding(DtWritingMode.DIRECTION_TOP, true); + return propertyList.getPadding(Constants.DIRECTION_TOP, true); } /** * {@inheritDoc} */ public int traitPaddingBottom() { - return propertyList.getPadding(DtWritingMode.DIRECTION_BOTTOM, true); + return propertyList.getPadding(Constants.DIRECTION_BOTTOM, true); } /** @@ -1777,8 +1776,8 @@ String script = this.traitScript(); WritingMode writingMode = this.getWritingMode(); if (script.equals("auto")) { - if (writingMode.getAbsoluteAxis(WritingMode.AXIS_IP) - == WritingMode.AXIS_HORIZONTAL) { + if (writingMode.getAbsoluteAxis(Constants.AXIS_IP) + == Constants.AXIS_HORIZONTAL) { /* The writing mode is horizontal. */ return Constants.BASELINE_ALPHABETIC; } else { @@ -2215,28 +2214,28 @@ * {@inheritDoc} */ public int traitBorderBeforePrecedence() { - return propertyList.getBorderPrecedence(DtWritingMode.DIRECTION_BEFORE); + return propertyList.getBorderPrecedence(Constants.DIRECTION_BEFORE); } /** * {@inheritDoc} */ public int traitBorderAfterPrecedence() { - return propertyList.getBorderPrecedence(DtWritingMode.DIRECTION_AFTER); + return propertyList.getBorderPrecedence(Constants.DIRECTION_AFTER); } /** * {@inheritDoc} */ public int traitBorderStartPrecedence() { - return propertyList.getBorderPrecedence(DtWritingMode.DIRECTION_START); + return propertyList.getBorderPrecedence(Constants.DIRECTION_START); } /** * {@inheritDoc} */ public int traitBorderEndPrecedence() { - return propertyList.getBorderPrecedence(DtWritingMode.DIRECTION_END); + return propertyList.getBorderPrecedence(Constants.DIRECTION_END); } /** Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/FObjScaled.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/FObjScaled.java 2006-05-26 15:04:07 UTC (rev 7262) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/FObjScaled.java 2006-05-26 15:58:40 UTC (rev 7263) @@ -26,8 +26,8 @@ import org.foray.fotree.fo.prop.ContentDimension; import org.foray.fotree.fo.prop.Dimension; -import org.foray.fotree.value.DtWritingMode; +import org.axsl.common.Constants; import org.axsl.foR.FOTreeException; import org.axsl.text.line.LineNonText; @@ -167,20 +167,20 @@ private boolean contentWidthIsAuto() { ContentDimension contentWidth = propertyList - .getContentDimensionProperty(DtWritingMode.AXIS_HORIZONTAL); + .getContentDimensionProperty(Constants.AXIS_HORIZONTAL); if (contentWidth == null) { return true; } - return contentWidth.isAuto(this, DtWritingMode.AXIS_HORIZONTAL); + return contentWidth.isAuto(this, Constants.AXIS_HORIZONTAL); } private boolean contentHeightIsAuto() { ContentDimension contentHeight = propertyList - .getContentDimensionProperty(DtWritingMode.AXIS_VERTICAL); + .getContentDimensionProperty(Constants.AXIS_VERTICAL); if (contentHeight == null) { return true; } - return contentHeight.isAuto(this, DtWritingMode.AXIS_VERTICAL); + return contentHeight.isAuto(this, Constants.AXIS_VERTICAL); } /** Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/PropertyList.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/PropertyList.java 2006-05-26 15:04:07 UTC (rev 7262) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/PropertyList.java 2006-05-26 15:58:40 UTC (rev 7263) @@ -367,22 +367,22 @@ } public int getMarginTop(int widthContainingBlock) { - return getAbsoluteMargin(DtWritingMode.DIRECTION_TOP, + return getAbsoluteMargin(Constants.DIRECTION_TOP, widthContainingBlock); } public int getMarginBottom(int widthContainingBlock) { - return getAbsoluteMargin(DtWritingMode.DIRECTION_BOTTOM, + return getAbsoluteMargin(Constants.DIRECTION_BOTTOM, widthContainingBlock); } public int getMarginLeft(int widthContainingBlock) { - return getAbsoluteMargin(DtWritingMode.DIRECTION_LEFT, + return getAbsoluteMargin(Constants.DIRECTION_LEFT, widthContainingBlock); } public int getMarginRight(int widthContainingBlock) { - return getAbsoluteMargin(DtWritingMode.DIRECTION_RIGHT, + return getAbsoluteMargin(Constants.DIRECTION_RIGHT, widthContainingBlock); } @@ -616,9 +616,9 @@ .FOPROP_BORDER_SPACING); } if (property != null) { - return property.getValue(DtWritingMode.AXIS_IP, fobj); + return property.getValue(Constants.AXIS_IP, fobj); } - return BorderSeparation.getValueNoInstance(DtWritingMode.AXIS_IP, fobj); + return BorderSeparation.getValueNoInstance(Constants.AXIS_IP, fobj); } public int getBorderSeparationBPD() { @@ -629,9 +629,9 @@ .FOPROP_BORDER_SPACING); } if (property != null) { - return property.getValue(DtWritingMode.AXIS_BP, fobj); + return property.getValue(Constants.AXIS_BP, fobj); } - return BorderSeparation.getValueNoInstance(DtWritingMode.AXIS_BP, fobj); + return BorderSeparation.getValueNoInstance(Constants.AXIS_BP, fobj); } public int getNumberColumnsRepeated() { @@ -1013,11 +1013,11 @@ } public int getPageWidth() { - return getPageDimension(DtWritingMode.AXIS_HORIZONTAL); + return getPageDimension(Constants.AXIS_HORIZONTAL); } public int getPageHeight() { - return getPageDimension(DtWritingMode.AXIS_VERTICAL); + return getPageDimension(Constants.AXIS_VERTICAL); } public short getTextAlign() { @@ -1127,7 +1127,7 @@ if (property == null) { return RelativeSpace.getValueNoInstance(); } - return property.getValue(DtWritingMode.DIRECTION_BEFORE, subProperty, + return property.getValue(Constants.DIRECTION_BEFORE, subProperty, fobj, 0); } @@ -1141,7 +1141,7 @@ * If a corresponding margin property exists, conditionality must be * set to "retain". See XSL-FO Std. 1.0, Section 5.3.2, Para 1. */ - if (correspondingMarginExists(DtWritingMode.DIRECTION_BEFORE)) { + if (correspondingMarginExists(Constants.DIRECTION_BEFORE)) { return Constants.FOVAL_RETAIN; } return RelativeSpace.getConditionalityNoInstance(); @@ -1162,7 +1162,7 @@ if (property == null) { return RelativeSpace.getValueNoInstance(); } - return property.getValue(DtWritingMode.DIRECTION_AFTER, subProperty, + return property.getValue(Constants.DIRECTION_AFTER, subProperty, fobj, 0); } @@ -1176,7 +1176,7 @@ * If a corresponding margin property exists, conditionality must be * set to "retain". See XSL-FO Std. 1.0, Section 5.3.2, Para 1. */ - if (correspondingMarginExists(DtWritingMode.DIRECTION_AFTER)) { + if (correspondingMarginExists(Constants.DIRECTION_AFTER)) { return Constants.FOVAL_RETAIN; } return RelativeSpace.getConditionalityNoInstance(); @@ -1198,7 +1198,7 @@ if (property == null) { return RelativeSpace.getValueNoInstance(); } - return property.getValue(DtWritingMode.DIRECTION_START, subProperty, + return property.getValue(Constants.DIRECTION_START, subProperty, fobj, ipdAncestorBlockArea); } @@ -1226,7 +1226,7 @@ if (property == null) { return RelativeSpace.getValueNoInstance(); } - return property.getValue(DtWritingMode.DIRECTION_END, subProperty, + return property.getValue(Constants.DIRECTION_END, subProperty, fobj, ipdAncestorBlockArea); } @@ -1258,14 +1258,14 @@ } public int getWidth(int parentAreaCR_width) { - if (getWritingMode().getBPAxis() == DtWritingMode.AXIS_HORIZONTAL) { + if (getWritingMode().getBPAxis() == Constants.AXIS_HORIZONTAL) { return traitBPDimensionOpt(parentAreaCR_width); } return traitIPDimensionOpt(parentAreaCR_width); } public int getHeight(int parentAreaCR_height) { - if (getWritingMode().getBPAxis() == DtWritingMode.AXIS_VERTICAL) { + if (getWritingMode().getBPAxis() == Constants.AXIS_VERTICAL) { return traitBPDimensionOpt(parentAreaCR_height); } return traitIPDimensionOpt(parentAreaCR_height); @@ -1293,22 +1293,22 @@ } public int getTop(int heightContainingBlock) { - return getAbsoluteOffset(DtWritingMode.DIRECTION_TOP, + return getAbsoluteOffset(Constants.DIRECTION_TOP, heightContainingBlock); } public int getBottom(int heightContainingBlock) { - return getAbsoluteOffset(DtWritingMode.DIRECTION_BOTTOM, + return getAbsoluteOffset(Constants.DIRECTION_BOTTOM, heightContainingBlock); } public int getLeft(int widthContainingBlock) { - return getAbsoluteOffset(DtWritingMode.DIRECTION_LEFT, + return getAbsoluteOffset(Constants.DIRECTION_LEFT, widthContainingBlock); } public int getRight(int widthContainingBlock) { - return getAbsoluteOffset(DtWritingMode.DIRECTION_RIGHT, + return getAbsoluteOffset(Constants.DIRECTION_RIGHT, widthContainingBlock); } @@ -1387,13 +1387,13 @@ public int getContentWidth(int intrinsicContentWidth, int viewportWidth) { - return getContentDimension(DtWritingMode.AXIS_HORIZONTAL, + return getContentDimension(Constants.AXIS_HORIZONTAL, intrinsicContentWidth, viewportWidth); } public int getContentHeight(int intrinsicContentHeight, int viewportHeight) { - return getContentDimension(DtWritingMode.AXIS_VERTICAL, + return getContentDimension(Constants.AXIS_VERTICAL, intrinsicContentHeight, viewportHeight); } @@ -1532,7 +1532,7 @@ private int getRelativeDimension(byte relativeAxis, int subProperty, int parentAreaCR_Dimension) { RelativeDimension property = null; - if (relativeAxis == DtWritingMode.AXIS_BP) { + if (relativeAxis == Constants.AXIS_BP) { property = (RelativeDimension) getProperty(Constants.FOPROP_BLOCK_PROGRESSION_DIMENSION); } else { @@ -1546,7 +1546,7 @@ // Try the corresponding absolute dimension AbsoluteDimension absDimProperty = null; byte absoluteAxis = getWritingMode().getAbsoluteAxis(relativeAxis); - if (absoluteAxis == DtWritingMode.AXIS_HORIZONTAL) { + if (absoluteAxis == Constants.AXIS_HORIZONTAL) { switch (subProperty) { case Property.MINIMUM: { absDimProperty = (AbsoluteDimension) getProperty @@ -1561,7 +1561,7 @@ (Constants.FOPROP_WIDTH); } } - } else if (absoluteAxis == DtWritingMode.AXIS_VERTICAL){ + } else if (absoluteAxis == Constants.AXIS_VERTICAL){ switch (subProperty) { case Property.MINIMUM: { absDimProperty = (AbsoluteDimension) getProperty @@ -1585,7 +1585,7 @@ } public int traitBPDimensionMin(int parentAreaCR_BPD) { - int nominal = getRelativeDimension(DtWritingMode.AXIS_BP, + int nominal = getRelativeDimension(Constants.AXIS_BP, Property.MINIMUM, parentAreaCR_BPD); if (nominal == Dimension.DIMENSION_AUTO) { return this.getFObj().autoBPDimension(); @@ -1594,7 +1594,7 @@ } public int traitBPDimensionOpt(int parentAreaCR_BPD) { - int nominal = getRelativeDimension(DtWritingMode.AXIS_BP, + int nominal = getRelativeDimension(Constants.AXIS_BP, Property.OPTIMUM, parentAreaCR_BPD); if (nominal == Dimension.DIMENSION_AUTO) { return this.getFObj().autoBPDimension(); @@ -1603,7 +1603,7 @@ } public int traitBPDimensionMax(int parentAreaCR_BPD) { - int nominal = getRelativeDimension(DtWritingMode.AXIS_BP, + int nominal = getRelativeDimension(Constants.AXIS_BP, Property.MAXIMUM, parentAreaCR_BPD); if (nominal == Dimension.DIMENSION_AUTO) { return this.getFObj().autoBPDimension(); @@ -1612,7 +1612,7 @@ } public int traitIPDimensionMin(int parentAreaCR_IPD) { - int nominal = getRelativeDimension(DtWritingMode.AXIS_IP, + int nominal = getRelativeDimension(Constants.AXIS_IP, Property.MINIMUM, parentAreaCR_IPD); if (nominal == Dimension.DIMENSION_AUTO) { return this.getFObj().autoIPDimension(); @@ -1621,7 +1621,7 @@ } public int traitIPDimensionOpt(int parentAreaCR_IPD) { - int nominal = getRelativeDimension(DtWritingMode.AXIS_IP, + int nominal = getRelativeDimension(Constants.AXIS_IP, Property.OPTIMUM, parentAreaCR_IPD); if (nominal == Dimension.DIMENSION_AUTO) { return this.getFObj().autoIPDimension(); @@ -1630,7 +1630,7 @@ } public int traitIPDimensionMax(int parentAreaCR_IPD) { - int nominal = getRelativeDimension(DtWritingMode.AXIS_IP, + int nominal = getRelativeDimension(Constants.AXIS_IP, Property.MAXIMUM, parentAreaCR_IPD); if (nominal == Dimension.DIMENSION_AUTO) { return this.getFObj().autoIPDimension(); @@ -2899,13 +2899,13 @@ public double traitPauseBefore() { Pause property = (Pause) getProperty(Constants.FOPROP_PAUSE_BEFORE); if (property != null) { - return property.getValue(fobj, DtWritingMode.DIRECTION_BEFORE); + return property.getValue(fobj, Constants.DIRECTION_BEFORE); } // Try the shorthand property = (Pause) getProperty(Constants.FOPROP_PAUSE); if (property != null) { return property.getShorthandValue(fobj, - DtWritingMode.DIRECTION_BEFORE); + Constants.DIRECTION_BEFORE); } return Pause.getValueNoInstance(); } @@ -2913,13 +2913,13 @@ public double traitPauseAfter() { Pause property = (Pause) getProperty(Constants.FOPROP_PAUSE_AFTER); if (property != null) { - return property.getValue(fobj, DtWritingMode.DIRECTION_AFTER); + return property.getValue(fobj, Constants.DIRECTION_AFTER); } // Try the shorthand property = (Pause) getProperty(Constants.FOPROP_PAUSE); if (property != null) { return property.getShorthandValue(fobj, - DtWritingMode.DIRECTION_AFTER); + Constants.DIRECTION_AFTER); } return Pause.getValueNoInstance(); } @@ -3072,20 +3072,20 @@ GlyphOrientation property = (GlyphOrientation) getProperty(Constants.FOPROP_GLYPH_ORIENTATION_HORIZONTAL); if (property != null) { - return property.getValue(fobj, DtWritingMode.AXIS_HORIZONTAL); + return property.getValue(fobj, Constants.AXIS_HORIZONTAL); } return GlyphOrientation.getValueNoInstance(fobj, - DtWritingMode.AXIS_HORIZONTAL); + Constants.AXIS_HORIZONTAL); } public short traitGlyphOrientationVertical() { GlyphOrientation property = (GlyphOrientation) getProperty(Constants.FOPROP_GLYPH_ORIENTATION_VERTICAL); if (property != null) { - return property.getValue(fobj, DtWritingMode.AXIS_VERTICAL); + return property.getValue(fobj, Constants.AXIS_VERTICAL); } return GlyphOrientation.getValueNoInstance(fobj, - DtWritingMode.AXIS_VERTICAL); + Constants.AXIS_VERTICAL); } public int traitBackgroundPositionHorizontal(int paddingRectangleWidth, @@ -3093,7 +3093,7 @@ BackgroundPosition property = (BackgroundPosition) getProperty(Constants.FOPROP_BACKGROUND_POSITION_HORIZONTAL); if (property != null) { - return property.getValue(fobj, DtWritingMode.AXIS_HORIZONTAL, + return property.getValue(fobj, Constants.AXIS_HORIZONTAL, paddingRectangleWidth, backgroundImageWidth); } // Try the first shorthand @@ -3101,7 +3101,7 @@ .FOPROP_BACKGROUND_POSITION); if (property != null) { return property.getShorthandValue(fobj, - DtWritingMode.AXIS_HORIZONTAL, paddingRectangleWidth, + Constants.AXIS_HORIZONTAL, paddingRectangleWidth, backgroundImageWidth); } // Try the second shorthand @@ -3111,7 +3111,7 @@ property = background.getPosition(); if (property != null) { return property.getShorthandValue(fobj, - DtWritingMode.AXIS_HORIZONTAL, paddingRectangleWidth, + Constants.AXIS_HORIZONTAL, paddingRectangleWidth, backgroundImageWidth); } } @@ -3123,7 +3123,7 @@ BackgroundPosition property = (BackgroundPosition) getProperty(Constants.FOPROP_BACKGROUND_POSITION_VERTICAL); if (property != null) { - return property.getValue(fobj, DtWritingMode.AXIS_VERTICAL, + return property.getValue(fobj, Constants.AXIS_VERTICAL, paddingRectangleHeight, backgroundImageHeight); } // Try the first shorthand @@ -3131,7 +3131,7 @@ .FOPROP_BACKGROUND_POSITION); if (property != null) { return property.getShorthandValue(fobj, - DtWritingMode.AXIS_VERTICAL, paddingRectangleHeight, + Constants.AXIS_VERTICAL, paddingRectangleHeight, backgroundImageHeight); } // Try the second shorthand @@ -3141,7 +3141,7 @@ property = background.getPosition(); if (property != null) { return property.getShorthandValue(fobj, - DtWritingMode.AXIS_VERTICAL, paddingRectangleHeight, + Constants.AXIS_VERTICAL, paddingRectangleHeight, backgroundImageHeight); } } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/AbsoluteDimension.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/AbsoluteDimension.java 2006-05-26 15:04:07 UTC (rev 7262) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/AbsoluteDimension.java 2006-05-26 15:58:40 UTC (rev 7263) @@ -29,7 +29,6 @@ import org.foray.fotree.PropertyList; import org.foray.fotree.value.DtLength; import org.foray.fotree.value.DtPercentage; -import org.foray.fotree.value.DtWritingMode; import org.foray.fotree.value.PropertyKeyword; import org.foray.fotree.value.PropertyValue; @@ -102,7 +101,7 @@ switch (getPropertyType()) { case Constants.FOPROP_HEIGHT: case Constants.FOPROP_WIDTH: { - if (relativeAxis == DtWritingMode.AXIS_BP) { + if (relativeAxis == Constants.AXIS_BP) { return fobj.getFObjParent().traitBPDimensionOpt (dimAncestorGenByBlockLevelFO); } @@ -111,7 +110,7 @@ } case Constants.FOPROP_MAX_HEIGHT: case Constants.FOPROP_MAX_WIDTH: { - if (relativeAxis == DtWritingMode.AXIS_BP) { + if (relativeAxis == Constants.AXIS_BP) { return fobj.getFObjParent().traitBPDimensionMax (dimAncestorGenByBlockLevelFO); } @@ -120,7 +119,7 @@ } case Constants.FOPROP_MIN_HEIGHT: case Constants.FOPROP_MIN_WIDTH: { - if (relativeAxis == DtWritingMode.AXIS_BP) { + if (relativeAxis == Constants.AXIS_BP) { return fobj.getFObjParent().traitBPDimensionMin (dimAncestorGenByBlockLevelFO); } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/AbsoluteOffset.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/AbsoluteOffset.java 2006-05-26 15:04:07 UTC (rev 7262) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/AbsoluteOffset.java 2006-05-26 15:58:40 UTC (rev 7263) @@ -30,7 +30,6 @@ import org.foray.fotree.PropertyList; import org.foray.fotree.value.DtLength; import org.foray.fotree.value.DtPercentage; -import org.foray.fotree.value.DtWritingMode; import org.foray.fotree.value.PropertyKeyword; import org.foray.fotree.value.PropertyValue; @@ -124,16 +123,16 @@ */ public static short rawPropertyName(int direction) { switch (direction) { - case DtWritingMode.DIRECTION_TOP: { + case Constants.DIRECTION_TOP: { return Constants.FOPROP_TOP; } - case DtWritingMode.DIRECTION_BOTTOM: { + case Constants.DIRECTION_BOTTOM: { return Constants.FOPROP_BOTTOM; } - case DtWritingMode.DIRECTION_LEFT: { + case Constants.DIRECTION_LEFT: { return Constants.FOPROP_LEFT; } - case DtWritingMode.DIRECTION_RIGHT: { + case Constants.DIRECTION_RIGHT: { return Constants.FOPROP_RIGHT; } } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/BackgroundPosition.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/BackgroundPosition.java 2006-05-26 15:04:07 UTC (rev 7262) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/BackgroundPosition.java 2006-05-26 15:58:40 UTC (rev 7263) @@ -30,7 +30,6 @@ import org.foray.fotree.PropertyList; import org.foray.fotree.value.DtLength; import org.foray.fotree.value.DtPercentage; -import org.foray.fotree.value.DtWritingMode; import org.foray.fotree.value.PropertyCollection; import org.foray.fotree.value.PropertyKeyword; import org.foray.fotree.value.PropertyValue; @@ -209,12 +208,12 @@ FObj parent = fobj.getFObjParent(); if (parent != null) { switch (axis) { - case DtWritingMode.AXIS_HORIZONTAL: { + case Constants.AXIS_HORIZONTAL: { return parent.traitBackgroundPositionHorizontal( paddingRectangleDimension, backgroundImageDimension); } - case DtWritingMode.AXIS_VERTICAL: { + case Constants.AXIS_VERTICAL: { return parent.traitBackgroundPositionVertical( paddingRectangleDimension, backgroundImageDimension); @@ -235,19 +234,19 @@ PropertyValue pv = bpProperty.getPropertyValue(); if (collection.getCount() == 1) { if (pv instanceof DtPercentage || pv instanceof DtLength) { - if (axis == DtWritingMode.AXIS_VERTICAL) { + if (axis == Constants.AXIS_VERTICAL) { return (int) Math.round(.5 * (paddingRectangleDimension - backgroundImageDimension)); } } if (pv instanceof PropertyKeyword) { short keyword = ((PropertyKeyword) pv).getValue(); - if (axis == DtWritingMode.AXIS_HORIZONTAL + if (axis == Constants.AXIS_HORIZONTAL && keywordInSet(keyword, validKeywordsVertical)) { return (int) Math.round(.5 * (paddingRectangleDimension - backgroundImageDimension)); } - if (axis == DtWritingMode.AXIS_VERTICAL + if (axis == Constants.AXIS_VERTICAL && keywordInSet(keyword, validKeywordsHorizontal)) { return (int) Math.round(.5 * (paddingRectangleDimension - backgroundImageDimension)); @@ -268,10 +267,10 @@ PropertyValue pv2 = bpProperty2.getPropertyValue(); BackgroundPosition bpPropertyToUse = null; if (pv instanceof DtPercentage || pv instanceof DtLength) { - if (axis == DtWritingMode.AXIS_HORIZONTAL) { + if (axis == Constants.AXIS_HORIZONTAL) { bpPropertyToUse = bpProperty; } - if (axis == DtWritingMode.AXIS_VERTICAL) { + if (axis == Constants.AXIS_VERTICAL) { bpPropertyToUse = bpProperty2; } } @@ -291,14 +290,14 @@ if (keywordInSet(keyword2, validKeywordsHorizontal)) { horizontalFirst = false; } - if (axis == DtWritingMode.AXIS_HORIZONTAL) { + if (axis == Constants.AXIS_HORIZONTAL) { if (horizontalFirst) { bpPropertyToUse = bpProperty; } else { bpPropertyToUse = bpProperty2; } } - if (axis == DtWritingMode.AXIS_VERTICAL) { + if (axis == Constants.AXIS_VERTICAL) { if (horizontalFirst) { bpPropertyToUse = bpProperty2; } else { Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/BorderColor.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/BorderColor.java 2006-05-26 15:04:07 UTC (rev 7262) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/BorderColor.java 2006-05-26 15:58:40 UTC (rev 7263) @@ -29,7 +29,6 @@ import org.foray.fotree.PropertyException; import org.foray.fotree.PropertyList; import org.foray.fotree.value.DtColor; -import org.foray.fotree.value.DtWritingMode; import org.foray.fotree.value.ExprColor; import org.foray.fotree.value.PropertyCollection; import org.foray.fotree.value.PropertyValue; @@ -124,28 +123,28 @@ */ public static short rawPropertyType(int direction) { switch (direction) { - case DtWritingMode.DIRECTION_BEFORE: { + case Constants.DIRECTION_BEFORE: { return Constants.FOPROP_BORDER_BEFORE_COLOR; } - case DtWritingMode.DIRECTION_AFTER: { + case Constants.DIRECTION_AFTER: { return Constants.FOPROP_BORDER_AFTER_COLOR; } - case DtWritingMode.DIRECTION_START: { + case Constants.DIRECTION_START: { return Constants.FOPROP_BORDER_START_COLOR; } - case DtWritingMode.DIRECTION_END: { + case Constants.DIRECTION_END: { return Constants.FOPROP_BORDER_END_COLOR; } - case DtWritingMode.DIRECTION_LEFT: { + case Constants.DIRECTION_LEFT: { return Constants.FOPROP_BORDER_LEFT_COLOR; } - case DtWritingMode.DIRECTION_RIGHT: { + case Constants.DIRECTION_RIGHT: { return Constants.FOPROP_BORDER_RIGHT_COLOR; } - case DtWritingMode.DIRECTION_TOP: { + case Constants.DIRECTION_TOP: { return Constants.FOPROP_BORDER_TOP_COLOR; } - case DtWritingMode.DIRECTION_BOTTOM: { + case Constants.DIRECTION_BOTTOM: { return Constants.FOPROP_BORDER_BOTTOM_COLOR; } default: { Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/BorderPrecedence.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/BorderPrecedence.java 2006-05-26 15:04:07 UTC (rev 7262) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/BorderPrecedence.java 2006-05-26 15:58:40 UTC (rev 7263) @@ -36,7 +36,6 @@ import org.foray.fotree.fo.obj.TableHeader; import org.foray.fotree.fo.obj.TableRow; import org.foray.fotree.value.DtInteger; -import org.foray.fotree.value.DtWritingMode; import org.foray.fotree.value.PropertyKeyword; import org.foray.fotree.value.PropertyValue; @@ -86,16 +85,16 @@ FObj parent = fobj.getFObjParent(); if (parent != null) { switch (direction) { - case DtWritingMode.DIRECTION_BEFORE: { + case Constants.DIRECTION_BEFORE: { return parent.traitBorderBeforePrecedence(); } - case DtWritingMode.DIRECTION_AFTER: { + case Constants.DIRECTION_AFTER: { return parent.traitBorderAfterPrecedence(); } - case DtWritingMode.DIRECTION_START: { + case Constants.DIRECTION_START: { return parent.traitBorderStartPrecedence(); } - case DtWritingMode.DIRECTION_END: { + case Constants.DIRECTION_END: { return parent.traitBorderEndPrecedence(); } } @@ -131,16 +130,16 @@ public static short getPropertyType(byte direction) { switch (direction) { - case DtWritingMode.DIRECTION_BEFORE: { + case Constants.DIRECTION_BEFORE: { return Constants.FOPROP_BORDER_BEFORE_PRECEDENCE; } - case DtWritingMode.DIRECTION_AFTER: { + case Constants.DIRECTION_AFTER: { return Constants.FOPROP_BORDER_AFTER_PRECEDENCE; } - case DtWritingMode.DIRECTION_START: { + case Constants.DIRECTION_START: { return Constants.FOPROP_BORDER_START_PRECEDENCE; } - case DtWritingMode.DIRECTION_END: { + case Constants.DIRECTION_END: { return Constants.FOPROP_BORDER_END_PRECEDENCE; } } Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/BorderSeparation.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/BorderSeparation.java 2006-05-26 15:04:07 UTC (rev 7262) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/BorderSeparation.java 2006-05-26 15:58:40 UTC (rev 7263) @@ -30,7 +30,6 @@ import org.foray.fotree.PropertyList; import org.foray.fotree.value.DtLength; import org.foray.fotree.value.DtLengthBPIPDirection; -import org.foray.fotree.value.DtWritingMode; import org.foray.fotree.value.PropertyKeyword; import org.foray.fotre... [truncated message content] |
|
From: <vic...@us...> - 2006-05-26 15:04:23
|
Revision: 7262 Author: victormote Date: 2006-05-26 08:04:07 -0700 (Fri, 26 May 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=7262&view=rev Log Message: ----------- Use new capabilities from FOTree to compute the location of the baseline. Modified Paths: -------------- trunk/foray/foray-areatree/src/java/org/foray/area/Area.java trunk/foray/foray-areatree/src/java/org/foray/area/LineArea.java Modified: trunk/foray/foray-areatree/src/java/org/foray/area/Area.java =================================================================== --- trunk/foray/foray-areatree/src/java/org/foray/area/Area.java 2006-05-26 15:02:37 UTC (rev 7261) +++ trunk/foray/foray-areatree/src/java/org/foray/area/Area.java 2006-05-26 15:04:07 UTC (rev 7262) @@ -1051,6 +1051,10 @@ return traitGeneratedBy().traitHyphenationCharacter(); } + public short traitDominantBaseline() { + return traitGeneratedBy().traitDominantBaseline(); + } + /** * If this Area should be defined in the output document as a destination, * return the name of that destination. Modified: trunk/foray/foray-areatree/src/java/org/foray/area/LineArea.java =================================================================== --- trunk/foray/foray-areatree/src/java/org/foray/area/LineArea.java 2006-05-26 15:02:37 UTC (rev 7261) +++ trunk/foray/foray-areatree/src/java/org/foray/area/LineArea.java 2006-05-26 15:04:07 UTC (rev 7262) @@ -40,6 +40,7 @@ import org.axsl.foR.fo.Leader; import org.axsl.foR.fo.PageNumber; import org.axsl.foR.fo.PageNumberCitation; +import org.axsl.fontR.Font; import org.axsl.text.line.LineOutput; import java.util.List; @@ -567,20 +568,12 @@ } /** - * Provides the number which would, when added to the before-edge of the - * line-area in the block-progression-dimension, produce the - * alignment-point for text on this line. - * We believe the alignment point, which is defined in XSL-FO Standard 1.0, - * Section 7.8.1, to be the same point which is described in the PDF - * Reference, Second Edition, Section 5.1.3, as the "glyph origin". - * Renderers should rely on this behavior. - * @return The distance, in millipoints, between the before-edge of this - * line-area and a line parallel to it that runs through the - * alignment-point. + * {@inheritDoc} */ public int alignmentPointOffset() { - // TODO: There is much work to do here. See esp. 7.8.1 of XSL-FO 1.0. - return getAscender(); + int baseline = this.traitDominantBaseline(); + Font font = this.getPrimaryFont().getFont(); + return font.baseline(0, baseline, this.traitFontSize()); } public int alignmentPointX() { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <vic...@us...> - 2006-05-26 15:02:48
|
Revision: 7261 Author: victormote Date: 2006-05-26 08:02:37 -0700 (Fri, 26 May 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=7261&view=rev Log Message: ----------- Return the resolved value. Modified Paths: -------------- trunk/foray/foray-fotree/src/java/org/foray/fotree/FObj.java Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/FObj.java =================================================================== --- trunk/foray/foray-fotree/src/java/org/foray/fotree/FObj.java 2006-05-26 14:37:43 UTC (rev 7260) +++ trunk/foray/foray-fotree/src/java/org/foray/fotree/FObj.java 2006-05-26 15:02:37 UTC (rev 7261) @@ -32,6 +32,8 @@ import org.axsl.foR.FOTreeException; import org.axsl.foR.ShadowEffect; import org.axsl.foR.Shape; +import org.axsl.foR.WritingMode; +import org.axsl.fontR.Font; import org.axsl.fontR.FontConsumer; import org.axsl.fontR.FontUse; import org.axsl.graphicR.Graphic; @@ -1768,9 +1770,76 @@ * {@inheritDoc} */ public short traitDominantBaseline() { - return propertyList.traitDominantBaseline(); + short rawValue = propertyList.traitDominantBaseline(); + switch (rawValue) { + case Constants.FOVAL_AUTO: { + if (this.isBlockLevelFO()) { + String script = this.traitScript(); + WritingMode writingMode = this.getWritingMode(); + if (script.equals("auto")) { + if (writingMode.getAbsoluteAxis(WritingMode.AXIS_IP) + == WritingMode.AXIS_HORIZONTAL) { + /* The writing mode is horizontal. */ + return Constants.BASELINE_ALPHABETIC; + } else { + /* The writing mode is vertical. */ + return Constants.BASELINE_CENTRAL; + } + } else { + return this.getBaselineFromScript(); + } + } else { + return this.getFObjParent().traitDominantBaseline(); + } + } + case Constants.FOVAL_USE_SCRIPT: { + return this.getBaselineFromScript(); + } + case Constants.FOVAL_NO_CHANGE: { + return this.getFObjParent().traitDominantBaseline(); + } + case Constants.FOVAL_RESET_SIZE: { + return this.getFObjParent().traitDominantBaseline(); + } + case Constants.FOVAL_IDEOGRAPHIC: { + return Constants.BASELINE_IDEOGRAPHIC; + } + case Constants.FOVAL_ALPHABETIC: { + return Constants.BASELINE_ALPHABETIC; + } + case Constants.FOVAL_HANGING: { + return Constants.BASELINE_HANGING; + } + case Constants.FOVAL_MATHEMATICAL: { + return Constants.BASELINE_MATHEMATICAL; + } + case Constants.FOVAL_CENTRAL: { + return Constants.BASELINE_CENTRAL; + } + case Constants.FOVAL_MIDDLE: { + return Constants.BASELINE_MIDDLE; + } + case Constants.FOVAL_TEXT_AFTER_EDGE: { + return Constants.BASELINE_TEXT_AFTER_EDGE; + } + case Constants.FOVAL_TEXT_BEFORE_EDGE: { + return Constants.BASELINE_TEXT_BEFORE_EDGE; + } + default: { + /* This should never happen as inheritance and defaults have been + * handled upstream, but if it does, just return a reasonable + * value. */ + return Constants.BASELINE_ALPHABETIC; + } + } } - + + private short getBaselineFromScript() { + Font font = this.getPrimaryFont().getFont(); + String script = this.traitScript(); + return (short) font.baseline(script); + } + /** * {@inheritDoc} */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |