[PATCH] pdf export disabled flag
Wald Commits
scm-commit at wald.intevation.org
Thu Aug 23 16:32:57 CEST 2018
# HG changeset patch
# User gernotbelger
# Date 1535034773 -7200
# Node ID 5f81d3f7b82bc77c9552286d3a2ad421d2102427
# Parent 4cccbd32b680087e8c58f913ceb6b198f95f64ab
pdf export disabled flag
diff -r 4cccbd32b680 -r 5f81d3f7b82b artifacts/src/main/java/org/dive4elements/river/artifacts/bundu/bezugswst/BezugswstMissVolCalculationResult2.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/bundu/bezugswst/BezugswstMissVolCalculationResult2.java Thu Aug 23 16:32:28 2018 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/bundu/bezugswst/BezugswstMissVolCalculationResult2.java Thu Aug 23 16:32:53 2018 +0200
@@ -43,6 +43,11 @@
}
@Override
+ protected boolean pdfExportEnabled() {
+ return false;
+ }
+
+ @Override
protected void writeCSVResultMetadata(final ExportContextCSV exportContextCSV) {
// no metadata
}
diff -r 4cccbd32b680 -r 5f81d3f7b82b artifacts/src/main/java/org/dive4elements/river/artifacts/common/AbstractCalculationExportableResult.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/common/AbstractCalculationExportableResult.java Thu Aug 23 16:32:28 2018 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/common/AbstractCalculationExportableResult.java Thu Aug 23 16:32:53 2018 +0200
@@ -43,6 +43,10 @@
writeCSVRow(exportContextCSV, row);
}
+ protected boolean pdfExportEnabled() {
+ return true;
+ }
+
protected abstract void writeCSVResultMetadata(final ExportContextCSV exportContextCSV);
protected void writeCSVRow(final ExportContextCSV exportContextCSV, final ResultRow row) {
diff -r 4cccbd32b680 -r 5f81d3f7b82b artifacts/src/main/java/org/dive4elements/river/artifacts/common/AbstractCommonExporter.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/common/AbstractCommonExporter.java Thu Aug 23 16:32:28 2018 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/common/AbstractCommonExporter.java Thu Aug 23 16:32:53 2018 +0200
@@ -107,13 +107,16 @@
final JasperReporter reporter = new JasperReporter();
for (final RESULT result : results.getResults()) {
+ if (result.pdfExportEnabled()) { // TODO: only works for multiple result: if singleresult is disabled, ugly errors occur, 'cause no pdf will be
+ // created at all
- final MetaAndTableJRDataSource source = new MetaAndTableJRDataSource();
+ final MetaAndTableJRDataSource source = new MetaAndTableJRDataSource();
- writePDFGlobalMetadata(exportContext, source);
+ writePDFGlobalMetadata(exportContext, source);
- final JasperDesigner design = result.addReport(exportContext, reporter, source);
- configureDesign(result, design);
+ final JasperDesigner design = result.addReport(exportContext, reporter, source);
+ configureDesign(result, design);
+ }
}
reporter.exportPDF(out);
More information about the Dive4Elements-commits
mailing list