Skip to content

Commit

Permalink
Merge branch 'development' of github.com:camptocamp/mapfish-printV3 i…
Browse files Browse the repository at this point in the history
…nto development

Conflicts:
	src/main/resources/mapfish-spring-application-context.xml
  • Loading branch information
Jesse Eichar committed Mar 22, 2014
2 parents f7ed0a2 + 50339ac commit 0b242c9
Show file tree
Hide file tree
Showing 18 changed files with 344 additions and 126 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
/.gradle/
/.project
/.settings/
/examples/*.jasper
17 changes: 17 additions & 0 deletions examples/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,26 @@ templates:
maxDpi: 300
width: 400
height: 200
legend: !legend {}
table: !table {}
tablelist: !tableList {}
processors:
- !reportBuilder
directory: examples
- !createMap
inputMapper: {map: map}
outputMapper: {map: map}
- !prepareLegend
inputMapper: {legend: legend}
outputMapper: {legend: legend}
- !prepareTable
inputMapper: {table: table}
outputMapper: {table: table}
- !prepareTableList
inputMapper: {tablelist: tablelist}
dynamicReport: {}
dynamicReportDirectory: "examples/dynamic"
outputMapper: {tablelist: tablelist}
- !reportBuilder
directory: "examples/dynamic"
iterValue: tablelist
2 changes: 2 additions & 0 deletions examples/dynamic/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*
!.gitignore
26 changes: 26 additions & 0 deletions examples/legend.jrxml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version last-->
<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="legend" columnCount="3" pageWidth="555" pageHeight="802" columnWidth="185" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0" uuid="6b65086b-74e0-4bec-834b-1b74d5ae2d31">
<property name="ireport.zoom" value="2.0"/>
<property name="ireport.x" value="0"/>
<property name="ireport.y" value="0"/>
<field name="name" class="java.lang.String"/>
<field name="icon" class="java.awt.Image"/>
<field name="level" class="java.lang.Integer"/>
<detail>
<band height="15" splitType="Stretch">
<printWhenExpression><![CDATA[!$F{name}.equals("")]]></printWhenExpression>
<textField>
<reportElement x="0" y="0" width="185" height="13" uuid="804c03e8-4edc-4888-8dba-0c683717bfeb"/>
<textFieldExpression><![CDATA[$F{name}]]></textFieldExpression>
</textField>
</band>
<band height="14">
<printWhenExpression><![CDATA[$F{icon} != null]]></printWhenExpression>
<image scaleImage="RealHeight">
<reportElement stretchType="RelativeToTallestObject" x="0" y="0" width="185" height="13" uuid="067c1436-8c32-4bd6-9fd2-db394dc7366a"/>
<imageExpression><![CDATA[$F{icon}]]></imageExpression>
</image>
</band>
</detail>
</jasperReport>
143 changes: 86 additions & 57 deletions examples/simpleReport.jrxml
Original file line number Diff line number Diff line change
@@ -1,58 +1,87 @@
<?xml version="1.0" encoding="UTF-8"?>
<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="report" language="java" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20">
<property name="ireport.zoom" value="1.0"/>
<property name="ireport.x" value="0"/>
<property name="ireport.y" value="0"/>
<parameter name="SUBREPORT_DIR" class="java.lang.String"/>
<parameter name="map_main" class="java.awt.Image"/>
<parameter name="title" class="java.lang.String"/>
<parameter name="srs" class="java.lang.String"/>
<parameter name="units" class="java.lang.String"/>
<parameter name="center_esting" class="java.lang.String"/>
<parameter name="center_northing" class="java.lang.String"/>
<parameter name="scale" class="java.lang.String"/>
<parameter name="comment" class="java.lang.String"/>
<parameter name="rotation" class="java.lang.String"/>
<parameter name="table_table 1" class="net.sf.jasperreports.engine.data.JRTableModelDataSource"/>
<parameter name="table_table 2" class="net.sf.jasperreports.engine.data.JRTableModelDataSource"/>
<parameter name="legend_main" class="net.sf.jasperreports.engine.data.JRTableModelDataSource"/>
<field name="table" class="javax.swing.table.AbstractTableModel"/>
<field name="displayName" class="java.lang.String"/>
<field name="name" class="java.lang.String"/>
<title>
<band height="282" splitType="Stretch">
<staticText>
<reportElement x="0" y="1" width="555" height="50" uuid="3988392b-f1e2-4eda-9cb4-7caa2b3eb0cc"/>
<textElement textAlignment="Center">
<font size="36"/>
</textElement>
<text><![CDATA[The Map]]></text>
</staticText>
<image>
<reportElement x="0" y="51" width="555" height="230" uuid="fa145068-76a5-4834-98ed-ce65b1976b3d"/>
<imageExpression><![CDATA[$P{map_main}]]></imageExpression>
</image>
<break>
<reportElement x="0" y="281" width="100" height="1" uuid="63e34d7f-6ef9-4306-9b19-45d6f38fc760"/>
</break>
</band>
</title>
<detail>
<band height="65" splitType="Stretch">
<textField>
<reportElement x="0" y="0" width="555" height="23" uuid="d07b4b5c-e5f3-45ce-8c22-f020b1473383"/>
<textElement>
<font size="16" isBold="true" isItalic="true"/>
</textElement>
<textFieldExpression><![CDATA[$F{displayName}]]></textFieldExpression>
</textField>
<break>
<reportElement x="0" y="64" width="100" height="1"/>
</break>
</band>
</detail>
<summary>
<band height="65" splitType="Stretch">
</band>
</summary>
</jasperReport>
<!-- Created with Jaspersoft Studio version last-->
<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="report" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="9a3e59f5-6675-48cf-ad74-9c42b5a5b290">
<parameter name="SUBREPORT_DIR" class="java.lang.String"/>
<parameter name="map" class="java.awt.Image"/>
<parameter name="name" class="java.lang.String"/>
<parameter name="description" class="java.lang.String"/>
<parameter name="number" class="java.lang.Integer"/>
<parameter name="length" class="java.lang.Double"/>
<parameter name="table" class="net.sf.jasperreports.engine.data.JRMapCollectionDataSource"/>
<parameter name="legend" class="net.sf.jasperreports.engine.data.JRTableModelDataSource"/>
<field name="dataSource" class="net.sf.jasperreports.engine.data.JRMapCollectionDataSource"/>
<field name="displayName" class="java.lang.String"/>
<field name="name" class="java.lang.String"/>
<title>
<band height="390" splitType="Stretch">
<staticText>
<reportElement x="0" y="1" width="555" height="50" uuid="3988392b-f1e2-4eda-9cb4-7caa2b3eb0cc"/>
<textElement textAlignment="Center">
<font size="36"/>
</textElement>
<text><![CDATA[The Map]]></text>
</staticText>
<image>
<reportElement x="0" y="51" width="555" height="230" uuid="fa145068-76a5-4834-98ed-ce65b1976b3d"/>
<imageExpression><![CDATA[$P{map}]]></imageExpression>
</image>
<textField>
<reportElement x="0" y="280" width="555" height="23" uuid="245a4b0e-d6e2-4c82-a5ec-072b3cc182e4"/>
<textElement>
<font size="16" isBold="true" isItalic="true"/>
</textElement>
<textFieldExpression><![CDATA[$P{name}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="0" y="300" width="555" height="23" uuid="5b59bca0-4d72-4f52-889c-833479a3edc2"/>
<textElement>
<font size="16" isBold="true" isItalic="true"/>
</textElement>
<textFieldExpression><![CDATA[$P{description}]]></textFieldExpression>
</textField>
<subreport>
<reportElement x="0" y="323" width="555" height="57" uuid="c6b99036-9edf-444d-9084-7c6b51ce0b2c"/>
<dataSourceExpression><![CDATA[$P{table}]]></dataSourceExpression>
<subreportExpression><![CDATA["table.jasper"]]></subreportExpression>
</subreport>
<break>
<reportElement x="0" y="360" width="100" height="1" uuid="63e34d7f-6ef9-4306-9b19-45d6f38fc760"/>
</break>
</band>
</title>
<detail>
<band height="65" splitType="Stretch">
<textField>
<reportElement x="0" y="0" width="555" height="23" uuid="d07b4b5c-e5f3-45ce-8c22-f020b1473383"/>
<textElement>
<font size="16" isBold="true" isItalic="true"/>
</textElement>
<textFieldExpression><![CDATA[$F{displayName}]]></textFieldExpression>
</textField>
<subreport>
<reportElement x="0" y="23" width="555" height="42" uuid="b4cae0ad-a520-425e-b790-d6984af7ddc8"/>
<dataSourceExpression><![CDATA[$F{dataSource}]]></dataSourceExpression>
<subreportExpression><![CDATA[$P{SUBREPORT_DIR} + "/dynamic/table_" + $F{name} + ".jasper"]]></subreportExpression>
</subreport>
<break>
<reportElement x="0" y="64" width="100" height="1" uuid="7e3114a8-51b8-438d-94ee-9878ddf894dd"/>
</break>
</band>
</detail>
<summary>
<band height="65" splitType="Stretch">
<textField>
<reportElement x="0" y="0" width="555" height="23" uuid="d07b4b5c-e5f3-45ce-8c22-f020b1473383"/>
<textElement>
<font size="16" isBold="true" isItalic="true"/>
</textElement>
<textFieldExpression><![CDATA["Legend"]]></textFieldExpression>
</textField>
<subreport>
<reportElement x="0" y="23" width="555" height="42" uuid="b4cae0ad-a520-425e-b790-d6984af7ddc8"/>
<dataSourceExpression><![CDATA[$P{legend}]]></dataSourceExpression>
<subreportExpression><![CDATA[$P{SUBREPORT_DIR} + "/legend.jasper"]]></subreportExpression>
</subreport>
</band>
</summary>
</jasperReport>
35 changes: 35 additions & 0 deletions examples/spec.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,41 @@
"name": "Hello",
"description": "Hello every body !",
"length": 45.123,
"table": {
"columns": ["id", "name", "icon"],
"data": [
[1, "blah", "icon_pan"],
[2, "blip", "icon_zoomin"]
]
},
"tablelist": {
"f1": {
"displayName": "Feature 1",
"columns": ["id", "name", "icon"],
"data": [[1, "blah", "icon_pan"], [2, "blip", "icon_zoomin"]]
},
"f2": {
"displayName": "Feature 2",
"columns": ["id", "name", "icon"],
"data": [[10, "blah2", "icon_pan2"], [20, "blip2", "icon_zoomin2"]]
}
},
"legend": {
"name": "",
"classes": [{
"name": "Polling station",
"icons": ["http://mapfish-geoportal.demo-camptocamp.com/demo/wsgi/mapserv_proxy?TRANSPARENT=TRUE&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetLegendGraphic&EXCEPTIONS=application%2Fvnd.ogc.se_xml&LAYER=bureaux_vote&FORMAT=image%2Fpng&SCALE=200000"]
}, {
"name": "Sub-districts",
"icons": ["http://mapfish-geoportal.demo-camptocamp.com/demo/wsgi/mapserv_proxy?TRANSPARENT=TRUE&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetLegendGraphic&EXCEPTIONS=application%2Fvnd.ogc.se_xml&LAYER=sous_quartiers&FORMAT=image%2Fpng&SCALE=200000"]
}, {
"name": "Districts",
"icons": ["http://mapfish-geoportal.demo-camptocamp.com/demo/wsgi/mapserv_proxy?TRANSPARENT=TRUE&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetLegendGraphic&EXCEPTIONS=application%2Fvnd.ogc.se_xml&LAYER=quartiers&FORMAT=image%2Fpng&SCALE=200000"]
}, {
"name": "Area",
"icons": ["http://mapfish-geoportal.demo-camptocamp.com/demo/wsgi/mapserv_proxy?TRANSPARENT=TRUE&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetLegendGraphic&EXCEPTIONS=application%2Fvnd.ogc.se_xml&LAYER=circonscription&FORMAT=image%2Fpng&SCALE=200000"]
}]
},
"map": {
"center": [6, 45.5],
"scale": 40000,
Expand Down
95 changes: 95 additions & 0 deletions examples/table.jrxml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
<?xml version="1.0" encoding="UTF-8"?>
<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="DJR_2141" pageWidth="595" pageHeight="842" columnWidth="595" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0" scriptletClass="ar.com.fdvs.dj.core.DJDefaultScriptlet" whenResourceMissingType="Key" uuid="e034c6ef-7449-4a6a-9b5e-4ce04cc083b2">
<style name="dj_style_1_" mode="Transparent" forecolor="#000000" backcolor="#FFFFFF" radius="0" hAlign="Center" vAlign="Middle" rotation="None" isBlankWhenNull="true" fontName="DejaVu Sans" fontSize="14" isBold="true" isItalic="false" isUnderline="false" isPdfEmbedded="false">
<box padding="2">
<pen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
</box>
</style>
<style name="dj_style_2_" mode="Transparent" forecolor="#000000" backcolor="#FFFFFF" radius="0" hAlign="Left" vAlign="Middle" rotation="None" isBlankWhenNull="true" fontName="DejaVu Sans" fontSize="12" isBold="false" isItalic="false" isUnderline="false" isPdfEmbedded="false">
<box padding="2">
<pen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
</box>
</style>
<style name="DejaVu Sans_for_column_DJR_2141_COLUMN_0_" mode="Transparent" forecolor="#000000" backcolor="#FFFFFF" radius="0" hAlign="Left" vAlign="Middle" rotation="None" isBlankWhenNull="true" fontName="DejaVu Sans" fontSize="12" isBold="false" isItalic="false" isUnderline="false" isPdfEmbedded="false">
<box padding="2">
<pen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
</box>
<conditionalStyle>
<conditionExpression><![CDATA[new java.lang.Boolean(((Number)$V{REPORT_COUNT}).doubleValue() % 2 == 0)]]></conditionExpression>
<style mode="Opaque" backcolor="#E6E6E6"/>
</conditionalStyle>
</style>
<style name="DejaVu Sans_for_column_DJR_2141_COLUMN_1_" mode="Transparent" forecolor="#000000" backcolor="#FFFFFF" radius="0" hAlign="Left" vAlign="Middle" rotation="None" isBlankWhenNull="true" fontName="DejaVu Sans" fontSize="12" isBold="false" isItalic="false" isUnderline="false" isPdfEmbedded="false">
<box padding="2">
<pen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
</box>
<conditionalStyle>
<conditionExpression><![CDATA[new java.lang.Boolean(((Number)$V{REPORT_COUNT}).doubleValue() % 2 == 0)]]></conditionExpression>
<style mode="Opaque" backcolor="#E6E6E6"/>
</conditionalStyle>
</style>
<style name="DejaVu Sans_for_column_DJR_2141_COLUMN_2_" mode="Transparent" forecolor="#000000" backcolor="#FFFFFF" radius="0" hAlign="Left" vAlign="Middle" rotation="None" isBlankWhenNull="true" fontName="DejaVu Sans" fontSize="12" isBold="false" isItalic="false" isUnderline="false" isPdfEmbedded="false">
<box padding="2">
<pen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
</box>
<conditionalStyle>
<conditionExpression><![CDATA[new java.lang.Boolean(((Number)$V{REPORT_COUNT}).doubleValue() % 2 == 0)]]></conditionExpression>
<style mode="Opaque" backcolor="#E6E6E6"/>
</conditionalStyle>
</style>
<parameter name="SUBREPORT_DIR" class="java.lang.String"/>
<parameter name="attribute_center_esting" class="java.lang.String"/>
<parameter name="attribute_scale" class="java.lang.String"/>
<parameter name="attribute_comment" class="java.lang.String"/>
<parameter name="attribute_title" class="java.lang.String"/>
<parameter name="attribute_srs" class="java.lang.String"/>
<parameter name="attribute_center_northing" class="java.lang.String"/>
<parameter name="attribute_rotation" class="java.lang.String"/>
<parameter name="map_main" class="java.awt.image.BufferedImage"/>
<parameter name="attribute_units" class="java.lang.String"/>
<field name="id" class="java.lang.String"/>
<field name="name" class="java.lang.String"/>
<field name="icon" class="java.lang.String"/>
<pageHeader>
<band/>
</pageHeader>
<columnHeader>
<band height="30">
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement key="header_id" style="dj_style_1_" positionType="Float" stretchType="RelativeToTallestObject" x="0" y="0" width="185" height="30" isPrintWhenDetailOverflows="true" uuid="3a4e9d49-3645-4ca7-8e36-abfb35c0f688"/>
<textFieldExpression><![CDATA["id"]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement key="header_name" style="dj_style_1_" positionType="Float" stretchType="RelativeToTallestObject" x="185" y="0" width="185" height="30" isPrintWhenDetailOverflows="true" uuid="9fac5b94-c27f-4ed4-960c-ac48b60d0598"/>
<textFieldExpression><![CDATA["name"]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement key="header_icon" style="dj_style_1_" positionType="Float" stretchType="RelativeToTallestObject" x="370" y="0" width="185" height="30" isPrintWhenDetailOverflows="true" uuid="2f0cd44c-ab66-42b2-9ad4-1636193577a4"/>
<textFieldExpression><![CDATA["icon"]]></textFieldExpression>
</textField>
</band>
</columnHeader>
<detail>
<band height="15" splitType="Immediate">
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement style="DejaVu Sans_for_column_DJR_2141_COLUMN_0_" positionType="Float" stretchType="RelativeToTallestObject" x="0" y="0" width="185" height="15" isPrintWhenDetailOverflows="true" uuid="9b56d8ed-049e-41dc-806e-350ad84a3842"/>
<textFieldExpression><![CDATA[$F{id}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement style="DejaVu Sans_for_column_DJR_2141_COLUMN_1_" positionType="Float" stretchType="RelativeToTallestObject" x="185" y="0" width="185" height="15" isPrintWhenDetailOverflows="true" uuid="1e0ee0ef-22a5-43d5-b8d2-a731fc573055"/>
<textFieldExpression><![CDATA[$F{name}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement style="DejaVu Sans_for_column_DJR_2141_COLUMN_2_" positionType="Float" stretchType="RelativeToTallestObject" x="370" y="0" width="185" height="15" isPrintWhenDetailOverflows="true" uuid="f0579b7e-28ae-4b28-a6ac-95ca1e3a3205"/>
<textFieldExpression><![CDATA[$F{icon}]]></textFieldExpression>
</textField>
</band>
</detail>
<pageFooter>
<band/>
</pageFooter>
<summary>
<band/>
</summary>
</jasperReport>
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public static class LegendAttributeValue {
/**
* TODO Change this to be actual configuration in well typed data.
*/
public final PJsonObject getJson() {
public final PJsonObject getJsonObject() {
return this.json;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import org.mapfish.print.json.PJsonObject;

/**
* The attributes for {@link org.mapfish.print.processor.TableProcessor}.
* The attributes for {@link org.mapfish.print.processor.jasper.TableProcessor}.
*/
public class TableAttribute extends AbstractAttribute<TableAttribute.TableAttributeValue> {

Expand Down
5 changes: 4 additions & 1 deletion src/main/java/org/mapfish/print/config/Template.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,21 @@
import org.mapfish.print.attribute.Attribute;
import org.mapfish.print.processor.Processor;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
* Represents a report template configuration.
*
* @author sbrunner
*/
public class Template implements ConfigurationObject {
private String jasperTemplate;
private Map<String, Attribute<?>> attributes;
private List<Processor> processors;
private String iterValue;
private List<Processor> iterProcessors;
private List<Processor> iterProcessors = new ArrayList<Processor>();

private String jdbcUrl;
private String jdbcUser;
Expand Down
Loading

0 comments on commit 0b242c9

Please sign in to comment.