<?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="CsvDataSourceReport" pageWidth="595" pageHeight="842" columnWidth="515" leftMargin="40" rightMargin="40" topMargin="50" bottomMargin="50">
	<style name="Sans_Normal" isDefault="true" fontName="DejaVu Sans" fontSize="12" isBold="false" isItalic="false" isUnderline="false" isStrikeThrough="false"/>
	<style name="Sans_Bold" isDefault="false" fontName="DejaVu Sans" fontSize="12" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false"/>
	<style name="Sans_Italic" isDefault="false" fontName="DejaVu Sans" fontSize="12" isBold="false" isItalic="true" isUnderline="false" isStrikeThrough="false"/>
	<parameter name="ReportTitle" class="java.lang.String"/>
	<parameter name="DataFile" class="java.lang.String"/>
	<parameter name="IncludedStates" class="java.util.Set"/>
	<field name="id" class="java.lang.Integer">
		<fieldDescription><![CDATA[id]]></fieldDescription>
	</field>
	<field name="name" class="java.lang.String">
		<fieldDescription><![CDATA[name]]></fieldDescription>
	</field>
	<field name="address" class="java.lang.String">
		<fieldDescription><![CDATA[street address]]></fieldDescription>
	</field>
	<field name="city" class="java.lang.String">
		<fieldDescription><![CDATA[city]]></fieldDescription>
	</field>
	<field name="state" class="java.lang.String">
		<fieldDescription><![CDATA[state]]></fieldDescription>
	</field>
	<sortField name="city" order="Descending"/>
	<sortField name="name"/>
	<variable name="CityNumber" class="java.lang.Integer" incrementType="Group" incrementGroup="CityGroup" calculation="Count">
		<variableExpression><![CDATA[Boolean.TRUE]]></variableExpression>
	</variable>
	<filterExpression><![CDATA[$P{IncludedStates}.contains($F{state}) ? Boolean.TRUE : Boolean.FALSE]]></filterExpression>
	<group name="CityGroup" minHeightToStartNewPage="60">
		<groupExpression><![CDATA[$F{city}]]></groupExpression>
		<groupHeader>
			<band height="20">
				<textField evaluationTime="Group" evaluationGroup="CityGroup" bookmarkLevel="1">
					<reportElement style="Sans_Bold" mode="Opaque" x="0" y="5" width="515" height="15" backcolor="#C0C0C0"/>
					<box leftPadding="10">
						<bottomPen lineWidth="1.0"/>
					</box>
					<textElement/>
					<textFieldExpression class="java.lang.String"><![CDATA["  " + String.valueOf($V{CityNumber}) + ". " + String.valueOf($F{city})]]></textFieldExpression>
					<anchorNameExpression><![CDATA[String.valueOf($F{city})]]></anchorNameExpression>
				</textField>
			</band>
		</groupHeader>
		<groupFooter>
			<band height="20">
				<staticText>
					<reportElement style="Sans_Bold" x="400" y="1" width="60" height="15"/>
					<textElement textAlignment="Right"/>
					<text><![CDATA[Count :]]></text>
				</staticText>
				<textField>
					<reportElement style="Sans_Bold" x="460" y="1" width="30" height="15"/>
					<textElement textAlignment="Right"/>
					<textFieldExpression class="java.lang.Integer"><![CDATA[$V{CityGroup_COUNT}]]></textFieldExpression>
				</textField>
			</band>
		</groupFooter>
	</group>
	<title>
		<band height="70">
			<line>
				<reportElement x="0" y="0" width="515" height="1"/>
			</line>
			<textField isBlankWhenNull="true" bookmarkLevel="1">
				<reportElement style="Sans_Normal" x="0" y="10" width="515" height="30"/>
				<textElement textAlignment="Center">
					<font size="22"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[$P{ReportTitle}]]></textFieldExpression>
				<anchorNameExpression><![CDATA["Title"]]></anchorNameExpression>
			</textField>
			<textField isBlankWhenNull="true">
				<reportElement style="Sans_Normal" x="0" y="40" width="515" height="20"/>
				<textElement textAlignment="Center">
					<font size="14"/>
				</textElement>
				<textFieldExpression class="java.lang.String"><![CDATA[$P{DataFile}]]></textFieldExpression>
			</textField>
		</band>
	</title>
	<pageHeader>
		<band height="20">
			<staticText>
				<reportElement style="Sans_Bold" mode="Opaque" x="0" y="5" width="55" height="15" forecolor="#FFFFFF" backcolor="#333333"/>
				<textElement textAlignment="Center"/>
				<text><![CDATA[ID]]></text>
			</staticText>
			<staticText>
				<reportElement style="Sans_Bold" mode="Opaque" x="55" y="5" width="205" height="15" forecolor="#FFFFFF" backcolor="#333333"/>
				<textElement/>
				<text><![CDATA[Name]]></text>
			</staticText>
			<staticText>
				<reportElement style="Sans_Bold" mode="Opaque" x="260" y="5" width="255" height="15" forecolor="#FFFFFF" backcolor="#333333"/>
				<textElement/>
				<text><![CDATA[Street]]></text>
			</staticText>
		</band>
	</pageHeader>
	<detail>
		<band height="15">
			<textField bookmarkLevel="2">
				<reportElement x="0" y="0" width="50" height="15"/>
				<box leftPadding="10" rightPadding="10">
					<leftPen lineWidth="0.5"/>
					<bottomPen lineWidth="0.5"/>
				</box>
				<textElement textAlignment="Right"/>
				<textFieldExpression class="java.lang.Integer"><![CDATA[$F{id}]]></textFieldExpression>
				<anchorNameExpression><![CDATA[$F{name} + " (" + $F{id} + ")"]]></anchorNameExpression>
			</textField>
			<textField isStretchWithOverflow="true">
				<reportElement positionType="Float" x="50" y="0" width="200" height="15"/>
				<box leftPadding="10" rightPadding="10">
					<leftPen lineWidth="0.5"/>
					<bottomPen lineWidth="0.5"/>
				</box>
				<textElement/>
				<textFieldExpression class="java.lang.String"><![CDATA[$F{name}]]></textFieldExpression>
			</textField>
			<textField isStretchWithOverflow="true">
				<reportElement positionType="Float" x="250" y="0" width="265" height="15"/>
				<box leftPadding="10" rightPadding="10">
					<leftPen lineWidth="0.5"/>
					<bottomPen lineWidth="0.5"/>
					<rightPen lineWidth="0.5"/>
				</box>
				<textElement/>
				<textFieldExpression class="java.lang.String"><![CDATA[$F{address}]]></textFieldExpression>
			</textField>
		</band>
	</detail>
	<pageFooter>
		<band height="40">
			<line>
				<reportElement x="0" y="10" width="515" height="1"/>
			</line>
			<textField>
				<reportElement x="200" y="20" width="80" height="15"/>
				<textElement textAlignment="Right"/>
				<textFieldExpression class="java.lang.String"><![CDATA["Page " + String.valueOf($V{PAGE_NUMBER}) + " of"]]></textFieldExpression>
			</textField>
			<textField evaluationTime="Report">
				<reportElement x="280" y="20" width="75" height="15"/>
				<textElement/>
				<textFieldExpression class="java.lang.String"><![CDATA[" " + String.valueOf($V{PAGE_NUMBER})]]></textFieldExpression>
			</textField>
		</band>
	</pageFooter>
	<lastPageFooter>
		<band height="60">
			<textField bookmarkLevel="1">
				<reportElement x="0" y="10" width="515" height="15"/>
				<textElement textAlignment="Center"/>
				<textFieldExpression class="java.lang.String"><![CDATA["There were " +
					String.valueOf($V{REPORT_COUNT}) +
					" address records on this report."]]></textFieldExpression>
				<anchorNameExpression><![CDATA["Summary"]]></anchorNameExpression>
			</textField>
			<line>
				<reportElement x="0" y="30" width="515" height="1"/>
			</line>
			<textField>
				<reportElement x="200" y="40" width="80" height="15"/>
				<textElement textAlignment="Right"/>
				<textFieldExpression class="java.lang.String"><![CDATA["Page " + String.valueOf($V{PAGE_NUMBER}) + " of"]]></textFieldExpression>
			</textField>
			<textField evaluationTime="Report">
				<reportElement x="280" y="40" width="75" height="15"/>
				<textElement/>
				<textFieldExpression class="java.lang.String"><![CDATA[" " + String.valueOf($V{PAGE_NUMBER})]]></textFieldExpression>
			</textField>
		</band>
	</lastPageFooter>
</jasperReport>
