[PATCH] vegzone color in pdf-export

Wald Commits scm-commit at wald.intevation.org
Mon Oct 22 16:33:14 CEST 2018


# HG changeset patch
# User gernotbelger
# Date 1540218790 -7200
# Node ID c3ed5dcd5e082c5f660bf000af202a2e9e8c9964
# Parent  7f3444cbba5f049d1c34c4d40f6a7bb50a3ce73a
vegzone color in pdf-export

diff -r 7f3444cbba5f -r c3ed5dcd5e08 artifacts/doc/conf/jasper/templates/uinfo.vegetationzones.jrxml
--- a/artifacts/doc/conf/jasper/templates/uinfo.vegetationzones.jrxml	Mon Oct 22 16:26:12 2018 +0200
+++ b/artifacts/doc/conf/jasper/templates/uinfo.vegetationzones.jrxml	Mon Oct 22 16:33:10 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:07 -->
+<!-- Created with Jaspersoft Studio version 6.6.0.final using JasperReports Library version 4.5.0  -->
+<!-- 2018-10-22T16:30:27 -->
 <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"/>
@@ -56,9 +56,11 @@
 	<field name="meta:veg_name" class="java.lang.String"/>
 	<field name="meta:veg_dauervon" class="java.lang.String"/>
 	<field name="meta:veg_dauerbis" class="java.lang.String"/>
+	<field name="meta:color" class="java.lang.String"/>
 	<field name="data:0" class="java.lang.String"/>
 	<field name="data:1" class="java.lang.String"/>
 	<field name="data:2" class="java.lang.String"/>
+	<field name="data:3" class="java.lang.String"/>
 	<background>
 		<band splitType="Stretch"/>
 	</background>
@@ -120,7 +122,7 @@
 	<columnHeader>
 		<band height="25" splitType="Stretch">
 			<textField isStretchWithOverflow="true">
-				<reportElement style="htmlStyle" positionType="Float" stretchType="RelativeToBandHeight" x="0" y="0" width="267" height="24">
+				<reportElement style="htmlStyle" positionType="Float" stretchType="RelativeToBandHeight" x="0" y="0" width="230" height="24">
 					<property name="net.sf.jasperreports.text.hyphenation" value="true"/>
 					<property name="net.sf.jasperreports.text.save.line.breaks" value="true"/>
 					<property name="net.sf.jasperreports.export.xls.wrap.text" value="true"/>
@@ -130,13 +132,13 @@
 				<textFieldExpression><![CDATA[$F{meta:veg_name}]]></textFieldExpression>
 			</textField>
 			<textField isStretchWithOverflow="true">
-				<reportElement style="htmlStyle" positionType="Float" stretchType="RelativeToBandHeight" x="267" y="0" width="140" height="24"/>
+				<reportElement style="htmlStyle" positionType="Float" stretchType="RelativeToBandHeight" x="230" y="0" width="103" height="24"/>
 				<box padding="5"/>
 				<textElement textAlignment="Right" verticalAlignment="Bottom"/>
 				<textFieldExpression><![CDATA[$F{meta:veg_dauervon}]]></textFieldExpression>
 			</textField>
 			<textField isStretchWithOverflow="true">
-				<reportElement key="" style="htmlStyle" positionType="Float" stretchType="RelativeToBandHeight" x="407" y="0" width="140" height="24"/>
+				<reportElement key="" style="htmlStyle" positionType="Float" stretchType="RelativeToBandHeight" x="333" y="0" width="103" height="24"/>
 				<box padding="5"/>
 				<textElement textAlignment="Right" verticalAlignment="Bottom"/>
 				<textFieldExpression><![CDATA[$F{meta:veg_dauerbis}]]></textFieldExpression>
@@ -144,12 +146,18 @@
 			<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="436" y="0" width="103" height="24"/>
+				<box padding="5"/>
+				<textElement textAlignment="Left" verticalAlignment="Bottom"/>
+				<textFieldExpression><![CDATA[$F{meta:color}]]></textFieldExpression>
+			</textField>
 		</band>
 	</columnHeader>
 	<detail>
-		<band height="15" splitType="Prevent">
+		<band height="20" splitType="Prevent">
 			<textField isStretchWithOverflow="true" isBlankWhenNull="true">
-				<reportElement style="htmlStyle" positionType="Float" stretchType="RelativeToBandHeight" x="0" y="0" width="267" height="15"/>
+				<reportElement style="htmlStyle" positionType="Float" stretchType="RelativeToBandHeight" x="0" 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"/>
@@ -160,7 +168,7 @@
 				<textFieldExpression><![CDATA[$F{data:0}]]></textFieldExpression>
 			</textField>
 			<textField isStretchWithOverflow="true" isBlankWhenNull="true">
-				<reportElement style="htmlStyle" positionType="Float" stretchType="RelativeToBandHeight" x="267" y="0" width="140" height="15"/>
+				<reportElement style="htmlStyle" positionType="Float" stretchType="RelativeToBandHeight" x="230" y="0" width="103" 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"/>
@@ -171,7 +179,7 @@
 				<textFieldExpression><![CDATA[$F{data:1}]]></textFieldExpression>
 			</textField>
 			<textField isStretchWithOverflow="true" isBlankWhenNull="true">
-				<reportElement key="" style="htmlStyle" positionType="Float" stretchType="RelativeToBandHeight" x="407" y="0" width="140" height="15"/>
+				<reportElement key="" style="htmlStyle" positionType="Float" stretchType="RelativeToBandHeight" x="333" y="0" width="103" 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"/>
@@ -181,6 +189,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="436" y="0" width="103" 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 7f3444cbba5f -r c3ed5dcd5e08 artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/vegetationzones/VegetationZonesCalculationResult.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/vegetationzones/VegetationZonesCalculationResult.java	Mon Oct 22 16:26:12 2018 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/vegetationzones/VegetationZonesCalculationResult.java	Mon Oct 22 16:33:10 2018 +0200
@@ -75,7 +75,7 @@
         exportContextPDF.addJRMetadata(source, "veg_name", UInfoResultType.vegname);
         exportContextPDF.addJRMetadata(source, "veg_dauervon", UInfoResultType.vegdauervon);
         exportContextPDF.addJRMetadata(source, "veg_dauerbis", UInfoResultType.vegdauerbis);
-        // TODO add color to jasper-template and here
+        exportContextPDF.addJRMetadata(source, "color", UInfoResultType.vegzone_color);
     }
 
     protected String[] formatRow(final IExportContext context, final ResultRow row) {


More information about the Dive4Elements-commits mailing list