|
From: <mic...@us...> - 2003-12-02 03:20:10
|
Update of /cvsroot/babeldoc/babeldoc/modules/jfreereports/src/com/babeldoc/jfreereports/pipeline/stage
In directory sc8-pr-cvs1:/tmp/cvs-serv6038/modules/jfreereports/src/com/babeldoc/jfreereports/pipeline/stage
Modified Files:
Tag: TEMP_MIKEA
JFRPipelineStage.java
Log Message:
Made all the jfreereports formatting styles available
Index: JFRPipelineStage.java
===================================================================
RCS file: /cvsroot/babeldoc/babeldoc/modules/jfreereports/src/com/babeldoc/jfreereports/pipeline/stage/Attic/JFRPipelineStage.java,v
retrieving revision 1.1.2.10
retrieving revision 1.1.2.11
diff -C2 -d -r1.1.2.10 -r1.1.2.11
*** JFRPipelineStage.java 1 Dec 2003 08:06:12 -0000 1.1.2.10
--- JFRPipelineStage.java 2 Dec 2003 00:39:02 -0000 1.1.2.11
***************
*** 109,114 ****
--- 109,118 ----
import org.jfree.report.JFreeReport;
+ import org.jfree.report.ReportProcessingException;
import org.jfree.report.modules.parser.base.ReportGenerator;
import org.jfree.report.modules.output.pageable.pdf.PDFReportUtil;
+ import org.jfree.report.modules.output.table.csv.CSVReportUtil;
+ import org.jfree.report.modules.output.table.html.HTMLReportUtil;
+ import org.jfree.report.modules.output.table.rtf.RTFReportUtil;
import org.xml.sax.InputSource;
***************
*** 131,134 ****
--- 135,151 ----
/** constant: Report definition URL attribute/config property */
public final static String REPORT_DEF_URL = "reportDefinitionUrl";
+ /** constant: Report output type property */
+ public final static String REPORT_OUTPUT_FORMAT = "reportOutputFormat";
+
+ /** constant: Report output type HTML */
+ public final static int OUTPUT_FORMAT_HTML = 0;
+ /** constant: Report output type PDF */
+ public final static int OUTPUT_FORMAT_PDF = 1;
+ /** constant: Report output type CSV */
+ public final static int OUTPUT_FORMAT_CSV = 2;
+ /** constant: Report output type Excel */
+ public final static int OUTPUT_FORMAT_XLS = 3;
+ /** constant: Report output type Rich Text Format */
+ public final static int OUTPUT_FORMAT_RTF = 4;
/** instance: Counter for unique file numbers */
***************
*** 155,159 ****
options.add(new ConfigOption(REPORT_DEF_URL, IConfigOptionType.URL,
null, true, I18n.get("jfr.003")));
!
return options;
}
--- 172,178 ----
options.add(new ConfigOption(REPORT_DEF_URL, IConfigOptionType.URL,
null, true, I18n.get("jfr.003")));
! options.add(new ConfigOption(REPORT_OUTPUT_FORMAT, IConfigOptionType.URL,
! null, true, I18n.get("jfr.004")));
!
return options;
}
***************
*** 188,194 ****
report.setData(tm);
log.logDebug("Generate the report output");
! outputFile = getTempFilename() + ".pdf";
! PDFReportUtil.createPDF(report, outputFile);
} catch (java.net.MalformedURLException e1) {
// From new URL()
--- 207,271 ----
report.setData(tm);
+ log.logDebug("Get the required output type");
+ int outputFormat = getOutputFormat();
+
+ outputFile = getTempFilename();
+
log.logDebug("Generate the report output");
! switch (outputFormat) {
! case OUTPUT_FORMAT_PDF: {
! PDFReportUtil.createPDF(report, outputFile);
! break;
! }
! case OUTPUT_FORMAT_HTML: {
! try {
! HTMLReportUtil.createStreamHTML(report, outputFile);
! } catch (org.jfree.report.function.FunctionInitializeException e1) {
! log.logError(e1);
! } catch (java.io.IOException e2) {
! log.logError(e2);
! } catch (org.jfree.report.ReportProcessingException e3) {
! log.logError(e3);
! }
! break;
! }
! case OUTPUT_FORMAT_CSV: {
! try {
! CSVReportUtil.createCSV(report, outputFile);
! } catch (org.jfree.report.function.FunctionInitializeException e1) {
! log.logError(e1);
! } catch (java.io.IOException e2) {
! log.logError(e2);
! } catch (org.jfree.report.ReportProcessingException e3) {
! log.logError(e3);
! }
! break;
! }
! case OUTPUT_FORMAT_RTF: {
! try {
! RTFReportUtil.createRTF(report, outputFile);
! } catch (org.jfree.report.function.FunctionInitializeException e1) {
! log.logError(e1);
! } catch (java.io.IOException e2) {
! log.logError(e2);
! } catch (org.jfree.report.ReportProcessingException e3) {
! log.logError(e3);
! }
! break;
! }
! default: {
! try {
! HTMLReportUtil.createStreamHTML(report, outputFile);
! } catch (org.jfree.report.function.FunctionInitializeException e1) {
! log.logError(e1);
! } catch (java.io.IOException e2) {
! log.logError(e2);
! } catch (org.jfree.report.ReportProcessingException e3) {
! log.logError(e3);
! }
! break;
! }
! }
!
} catch (java.net.MalformedURLException e1) {
// From new URL()
***************
*** 354,357 ****
--- 431,457 ----
private synchronized int getFileCounter() {
return (++tempFileCount);
+ }
+
+ private int getOutputFormat() {
+ int result = OUTPUT_FORMAT_PDF;
+ String strReportOutputFormat = (String) getDocument().get(REPORT_OUTPUT_FORMAT);
+ if ((strReportOutputFormat == null) || (strReportOutputFormat.equals(""))) {
+ strReportOutputFormat = (String) this.getInfo().getOption(REPORT_OUTPUT_FORMAT).getValue();
+ }
+ if (strReportOutputFormat == null) {strReportOutputFormat = ""; }
+ if (strReportOutputFormat.equals("pdf")) {
+ result = OUTPUT_FORMAT_PDF;
+ } else if (strReportOutputFormat.equals("html")) {
+ result = OUTPUT_FORMAT_HTML;
+ } else if (strReportOutputFormat.equals("csv")) {
+ result = OUTPUT_FORMAT_CSV;
+ } else if (strReportOutputFormat.equals("xls")) {
+ result = OUTPUT_FORMAT_XLS;
+ } else if (strReportOutputFormat.equals("rtf")) {
+ result = OUTPUT_FORMAT_RTF;
+ } else {
+ result = OUTPUT_FORMAT_HTML;
+ }
+ return (result);
}
}
|