[FOray-commit] SF.net SVN: foray: [9124] trunk/foray/foray-app/src/java/org/foray/app
Modular XSL-FO Implementation for Java.
Status: Alpha
Brought to you by:
victormote
|
From: <vic...@us...> - 2007-04-06 01:41:37
|
Revision: 9124
http://svn.sourceforge.net/foray/?rev=9124&view=rev
Author: victormote
Date: 2007-04-05 18:41:37 -0700 (Thu, 05 Apr 2007)
Log Message:
-----------
Convert static method to enum instance method.
Modified Paths:
--------------
trunk/foray/foray-app/src/java/org/foray/app/OutputTargetFactory.java
trunk/foray/foray-app/src/java/org/foray/app/OutputTargetType.java
trunk/foray/foray-app/src/java/org/foray/app/ant/FOrayAntTask.java
Modified: trunk/foray/foray-app/src/java/org/foray/app/OutputTargetFactory.java
===================================================================
--- trunk/foray/foray-app/src/java/org/foray/app/OutputTargetFactory.java 2007-04-06 01:35:05 UTC (rev 9123)
+++ trunk/foray/foray-app/src/java/org/foray/app/OutputTargetFactory.java 2007-04-06 01:41:37 UTC (rev 9124)
@@ -169,34 +169,4 @@
return null;
}
- /**
- * Returns the mime extension for a given renderer type.
- * @param rendererType The renderer type for which the mime extension is
- * needed.
- * @return The mime extension.
- */
- public static String getMimeExtension(final OutputTargetType rendererType) {
- switch (rendererType) {
- case PDF: {
- return ".pdf";
- }
- case PS: {
- return ".ps";
- }
- case MIF: {
- return ".mif";
- }
- case PCL: {
- return ".pcl";
- }
- case TXT: {
- return ".txt";
- }
- case XML: {
- return ".xml";
- }
- }
- return null;
- }
-
}
Modified: trunk/foray/foray-app/src/java/org/foray/app/OutputTargetType.java
===================================================================
--- trunk/foray/foray-app/src/java/org/foray/app/OutputTargetType.java 2007-04-06 01:35:05 UTC (rev 9123)
+++ trunk/foray/foray-app/src/java/org/foray/app/OutputTargetType.java 2007-04-06 01:41:37 UTC (rev 9124)
@@ -34,42 +34,48 @@
public enum OutputTargetType {
/** Render to PDF. */
- PDF(true),
+ PDF(true, ".pdf"),
/** Render to a GUI window. */
- AWT(false),
+ AWT(false, null),
/** Render to MIF. */
- MIF(true),
+ MIF(true, ".mif"),
/** Render to XML. */
- XML(true),
+ XML(true, ".xml"),
/** Render to PRINT. */
- PRINT(false),
+ PRINT(false, null),
/** Render to PCL. */
- PCL(true),
+ PCL(true, ".pcl"),
/** Render to Postscript. */
- PS(true),
+ PS(true, ".ps"),
/** Render to Text. */
- TXT(true),
+ TXT(true, ".txt"),
/** Render to SVG. */
- SVG(true);
+ SVG(true, ".svg");
/** Indicates whether this output target requires an output stream. */
private boolean requiresOutputStream;
+ /** The file extension used for this output target type. */
+ private String fileExtension;
+
/**
* Constructor.
* @param requiresOutputStream Indicates whether this output target
* requires an output stream.
+ * @param fileExtension The file extension used for this output target type.
*/
- private OutputTargetType(final boolean requiresOutputStream) {
+ private OutputTargetType(final boolean requiresOutputStream,
+ final String fileExtension) {
this.requiresOutputStream = requiresOutputStream;
+ this.fileExtension = fileExtension;
}
/**
@@ -80,4 +86,12 @@
return this.requiresOutputStream;
}
+ /**
+ * Returns the file extension used for this output target type.
+ * @return The file extension used for this output target type.
+ */
+ public String getFileExtension() {
+ return this.fileExtension;
+ }
+
}
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 2007-04-06 01:35:05 UTC (rev 9123)
+++ trunk/foray/foray-app/src/java/org/foray/app/ant/FOrayAntTask.java 2007-04-06 01:41:37 UTC (rev 9124)
@@ -323,8 +323,7 @@
*/
protected String getFileExtension() {
final OutputTargetType rendererType = getRendererType();
- final String extension = OutputTargetFactory.getMimeExtension(
- rendererType);
+ final String extension = rendererType.getFileExtension();
return extension;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|