[PATCH] flys/issue1628: Adjusted the PDF export

Wald Commits scm-commit at wald.intevation.org
Wed Jun 4 15:34:40 CEST 2014


# HG changeset patch
# User Sascha L. Teichmann <teichmann at intevation.de>
# Date 1401888862 -7200
# Node ID 931dffefc3dd7ace8ee2c00cd48acdc310e625fa
# Parent  db1a2b14c32d81deebfecdb50a6a26291cdf78d1
flys/issue1628: Adjusted the PDF export.

diff -r db1a2b14c32d -r 931dffefc3dd artifacts/doc/conf/jasper/beddifference.jasper
Binary file artifacts/doc/conf/jasper/beddifference.jasper has changed
diff -r db1a2b14c32d -r 931dffefc3dd artifacts/doc/conf/jasper/beddifference.jrxml
--- a/artifacts/doc/conf/jasper/beddifference.jrxml	Wed Jun 04 13:06:52 2014 +0200
+++ b/artifacts/doc/conf/jasper/beddifference.jrxml	Wed Jun 04 15:34:22 2014 +0200
@@ -11,20 +11,22 @@
 	<field name="km" class="java.lang.String"/>
 	<field name="ye_mode" class="java.lang.String"/>
 	<field name="unit" class="java.lang.String"/>
+	<field name="diffpairheader" class="java.lang.String"/>
+	<field name="diffpair" class="java.lang.String"/>
 	<background>
 		<band splitType="Stretch"/>
 	</background>
 	<title>
 		<band height="161" splitType="Stretch">
 			<staticText>
-				<reportElement x="0" y="1" width="155" height="30"/>
+				<reportElement x="0" y="1" width="177" height="30"/>
 				<textElement>
 					<font size="18"/>
 				</textElement>
 				<text><![CDATA[Ergebnisausgabe]]></text>
 			</staticText>
 			<textField>
-				<reportElement x="155" y="0" width="360" height="31"/>
+				<reportElement x="177" y="0" width="338" height="31"/>
 				<textElement>
 					<font size="18"/>
 				</textElement>
@@ -94,10 +96,15 @@
 				<textElement markup="none"/>
 				<textFieldExpression><![CDATA[$F{unit}]]></textFieldExpression>
 			</textField>
+			<textField>
+				<reportElement x="305" y="4" width="140" height="20"/>
+				<textElement/>
+				<textFieldExpression><![CDATA[$F{diffpairheader}]]></textFieldExpression>
+			</textField>
 		</band>
 	</columnHeader>
 	<detail>
-		<band height="14" splitType="Stretch">
+		<band height="18" splitType="Stretch">
 			<textField isBlankWhenNull="true">
 				<reportElement x="0" y="0" width="155" height="14"/>
 				<textElement/>
@@ -108,6 +115,11 @@
 				<textElement/>
 				<textFieldExpression><![CDATA[$F{meter}]]></textFieldExpression>
 			</textField>
+			<textField isBlankWhenNull="true">
+				<reportElement x="305" y="0" width="97" height="14"/>
+				<textElement/>
+				<textFieldExpression><![CDATA[$F{diffpair}]]></textFieldExpression>
+			</textField>
 		</band>
 	</detail>
 	<pageFooter>
diff -r db1a2b14c32d -r 931dffefc3dd artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDifferenceJRDataSource.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDifferenceJRDataSource.java	Wed Jun 04 13:06:52 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDifferenceJRDataSource.java	Wed Jun 04 15:34:22 2014 +0200
@@ -71,6 +71,12 @@
         else if ("meter".equals(fieldName)) {
             value = data.get(index)[1];
         }
+        else if ("diffpair".equals(fieldName)) {
+            value = data.get(index)[2];
+        }
+        else if ("diffpairheader".equals(fieldName)) {
+            value = metaData.get("diffpairheader");
+        }
         return value;
     }
 }
diff -r db1a2b14c32d -r 931dffefc3dd artifacts/src/main/java/org/dive4elements/river/exports/minfo/BedDifferenceExporter.java
--- a/artifacts/src/main/java/org/dive4elements/river/exports/minfo/BedDifferenceExporter.java	Wed Jun 04 13:06:52 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/minfo/BedDifferenceExporter.java	Wed Jun 04 15:34:22 2014 +0200
@@ -30,6 +30,7 @@
 import org.dive4elements.artifacts.CallMeta;
 import org.dive4elements.river.artifacts.D4EArtifact;
 import org.dive4elements.river.artifacts.access.BedDifferencesAccess;
+import org.dive4elements.river.artifacts.access.RiverAccess;
 import org.dive4elements.artifacts.common.utils.Config;
 import org.dive4elements.river.artifacts.resources.Resources;
 import org.dive4elements.river.artifacts.model.CalculationResult;
@@ -38,7 +39,6 @@
 import org.dive4elements.river.artifacts.model.minfo.BedDifferenceJRDataSource;
 import org.dive4elements.river.exports.AbstractExporter;
 import org.dive4elements.river.utils.Formatter;
-import org.dive4elements.river.utils.RiverUtils;
 
 import au.com.bytecode.opencsv.CSVWriter;
 
@@ -137,7 +137,8 @@
 
         D4EArtifact arti = (D4EArtifact) master;
 
-        source.addMetaData ("river", RiverUtils.getRivername(arti));
+        //source.addMetaData ("river", RiverUtils.getRivername(arti));
+        source.addMetaData ("river", new RiverAccess(arti).getRiverName());
 
         Locale locale = Resources.getLocale(meta);
         DateFormat df = DateFormat.getDateInstance(DateFormat.SHORT, locale);
@@ -160,6 +161,8 @@
                 access.getDifferenceArtifactNamePairs(), "\n"));
 
         source.addMetaData("unit", msg(CSV_HEADER_DIFF, "cm"));
+        source.addMetaData("diffpairheader",
+                msg(CSV_HEADER_DIFF_PAIR, "Difference pair"));
     }
 
 
@@ -188,9 +191,12 @@
         NumberFormat mf = Formatter.getMeterFormat(context);
         for (BedDifferencesResult result: results) {
             double[][] kms = result.getDifferencesData();
+            String desc = result.getDiffDescription();
             for (int j = 0; j < kms[0].length; j++) {
                 source.addData(new String[] {
-                    kmf.format(kms[0][j]), mf.format(kms[1][j])});
+                    kmf.format(kms[0][j]),
+                    mf.format(kms[1][j]),
+                    desc });
             }
         }
         return source;
@@ -208,7 +214,7 @@
         String confPath = Config.getConfigDirectory().toString();
 
 
-        Map parameters = new HashMap();
+        Map<String, Object> parameters = new HashMap<String, Object>();
         parameters.put("ReportTitle", Resources.getMsg(
                     context.getMeta(), PDF_TITLE, "Exported Data"));
         try {


More information about the Dive4Elements-commits mailing list