[PATCH] salix pdf export column added

Wald Commits scm-commit at wald.intevation.org
Wed Aug 15 15:10:07 CEST 2018


# HG changeset patch
# User gernotbelger
# Date 1534338601 -7200
# Node ID 55e3b1a8aa0679ccf53b0cb0789eb27910262ca6
# Parent  34cd4faf43f4321f541f67a9b40cd49cf2e8d468
salix pdf export column added

diff -r 34cd4faf43f4 -r 55e3b1a8aa06 artifacts/doc/conf/jasper/templates/uinfo.salixline.jrxml
--- a/artifacts/doc/conf/jasper/templates/uinfo.salixline.jrxml	Wed Aug 15 14:34:23 2018 +0200
+++ b/artifacts/doc/conf/jasper/templates/uinfo.salixline.jrxml	Wed Aug 15 15:10:01 2018 +0200
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!-- Created with Jaspersoft Studio version 6.5.1.final using JasperReports Library version 4.5.0  -->
-<!-- 2018-07-31T13:54:09 -->
+<!-- 2018-08-15T15:04:44 -->
 <jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="flysreport" language="groovy" pageWidth="595" pageHeight="842" columnWidth="545" leftMargin="30" rightMargin="20" topMargin="20" bottomMargin="20">
 	<property name="ireport.zoom" value="1.0"/>
 	<property name="ireport.x" value="0"/>
@@ -140,6 +140,12 @@
 			<line>
 				<reportElement style="htmlStyle" positionType="FixRelativeToBottom" x="0" y="24" width="550" height="1"/>
 			</line>
+			<textField isStretchWithOverflow="true">
+				<reportElement key="" style="htmlStyle" positionType="Float" stretchType="RelativeToBandHeight" x="310" y="0" width="230" height="24"/>
+				<box padding="5"/>
+				<textElement textAlignment="Left" verticalAlignment="Bottom"/>
+				<textFieldExpression><![CDATA[$F{meta:gauge_header}]]></textFieldExpression>
+			</textField>
 		</band>
 	</columnHeader>
 	<detail>
@@ -177,6 +183,17 @@
 				<textElement textAlignment="Right"/>
 				<textFieldExpression><![CDATA[$F{data:2}]]></textFieldExpression>
 			</textField>
+			<textField isStretchWithOverflow="true" isBlankWhenNull="true">
+				<reportElement key="" style="htmlStyle" positionType="Float" stretchType="RelativeToBandHeight" x="310" y="0" width="230" height="15"/>
+				<box topPadding="2" leftPadding="5" bottomPadding="0" rightPadding="5">
+					<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
+					<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
+					<bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
+					<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
+				</box>
+				<textElement textAlignment="Left"/>
+				<textFieldExpression><![CDATA[$F{data:3}]]></textFieldExpression>
+			</textField>
 		</band>
 	</detail>
 	<pageFooter>
diff -r 34cd4faf43f4 -r 55e3b1a8aa06 artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/salix/SalixLineCalculationResult.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/salix/SalixLineCalculationResult.java	Wed Aug 15 14:34:23 2018 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/salix/SalixLineCalculationResult.java	Wed Aug 15 15:10:01 2018 +0200
@@ -113,7 +113,7 @@
         exportContextPDF.addJRMetadata(source, "salix_delta_mw", UInfoResultType.salix_mw_mnw);
 
         for (int i = 1; i <= this.getScenarioCount(); i++) {
-            // TODO Spaltenueberschriften der Scenarios
+            // TODO Spaltenueberschriften der Scenarios (falls gefordert)
         }
         exportContextPDF.addJRMetadata(source, "gauge_header", GeneralResultType.gaugeLabel);
     }
@@ -125,17 +125,19 @@
         lines.add(context.formatRowValue(row, UInfoResultType.salixline));
         lines.add(context.formatRowValue(row, UInfoResultType.salix_mw_mnw));
 
-        final NumberFormat formatter = ((AbstractExportContext) context).getSalixScenFormatter();
-        final List<SalixScenario> scenarios = (List<SalixScenario>) row.getValue(UInfoResultType.customMultiRowColSalixScenarios);
-        for (int i = 1; i <= this.getScenarioCount(); i++) {
-            if (i > scenarios.size())
-                break;
-            if (scenarios.get(i - 1) != null) {
-                lines.add(scenarios.get(i - 1).getDeltaWFormatted());
-                lines.add(scenarios.get(i - 1).getSalixValueFormatted(formatter));
-            } else {
-                lines.add("");
-                lines.add("");
+        if (context instanceof ExportContextCSV) {
+            final NumberFormat formatter = ((AbstractExportContext) context).getSalixScenFormatter();
+            final List<SalixScenario> scenarios = (List<SalixScenario>) row.getValue(UInfoResultType.customMultiRowColSalixScenarios);
+            for (int i = 1; i <= this.getScenarioCount(); i++) {
+                if (i > scenarios.size())
+                    break;
+                if (scenarios.get(i - 1) != null) {
+                    lines.add(scenarios.get(i - 1).getDeltaWFormatted());
+                    lines.add(scenarios.get(i - 1).getSalixValueFormatted(formatter));
+                } else {
+                    lines.add("");
+                    lines.add("");
+                }
             }
         }
         lines.add(context.formatRowValue(row, GeneralResultType.gaugeLabel));


More information about the Dive4Elements-commits mailing list