changeset 7915:931dffefc3dd

flys/issue1628: Adjusted the PDF export.
author Sascha L. Teichmann <teichmann@intevation.de>
date Wed, 04 Jun 2014 15:34:22 +0200
parents db1a2b14c32d
children c0843a658474
files artifacts/doc/conf/jasper/beddifference.jasper artifacts/doc/conf/jasper/beddifference.jrxml artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDifferenceJRDataSource.java artifacts/src/main/java/org/dive4elements/river/exports/minfo/BedDifferenceExporter.java
diffstat 4 files changed, 31 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
Binary file artifacts/doc/conf/jasper/beddifference.jasper has changed
--- 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>
--- 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;
     }
 }
--- 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 {

http://dive4elements.wald.intevation.org