<project name="virtualizer" default="test" basedir=".">

	<description>Shows how very large reports could be generated using a report virtualizer to optimize memory consumption.</description>

	<property name="sample.dir" value="virtualizer"/>
	<property name="sample.base.name" value="Virtualizer" />
	<property name="sample.app.name" value="${sample.base.name}App" />
	<property name="sample.report.name" value="${sample.base.name}Report" />
	
	<path id="classpath">
		<pathelement location="build/classes"/>
		<pathelement location="../../../build/classes" />
		<pathelement location="../../fonts" />
		<fileset dir="../../../lib">
			<include name="**/*.jar"/>
		</fileset>
	</path>

	<target name="javac" description="Compiles the java source files of the test application.">
		<ant dir="../" target="javac"/>
	</target>

	<target name="compile" description="Compiles the XML report design and produces the .jasper file.">
		<ant dir="../" target="compile"/>
	</target>

	<target name="view" description="Fills the report and launches the report viewer to preview it.">
		<java classname="net.sf.jasperreports.view.JasperViewer" fork="true">
			<arg value="build/reports/${sample.report.name}.jrprint"/>
			<classpath refid="classpath"/>
		</java>
	</target>

	<target name="print" description="Fills the report and sends it to the printer.">
		<ant dir="../" target="print"/>
	</target>

	<target name="pdf" description="Fills the report and generates a PDF version of it.">
		<ant dir="../" target="pdf"/>
	</target>

	<target name="xml" description="Fills the report and generates a XML version of it.">
		<ant dir="../" target="xml"/>
	</target>

	<target name="xmlEmbed" description="Fills the report and generates a XML version of it.">
		<ant dir="../" target="xmlEmbed"/>
	</target>

	<target name="html" description="Fills the report and generates a HTML version of it.">
		<ant dir="../" target="html"/>
	</target>

	<target name="csv" description="Fills the report and generates a CSV version of it.">
		<ant dir="../" target="csv"/>
	</target>

	<target name="export" description="Fills the report and exports to PDF, XML, HTML and CSV.">
		<java classname="${sample.app.name}" fork="true">
			<arg value="export"/>
			<classpath refid="classpath"/>
		</java>
	</target>
	
	<target name="viewDesignXml" description="Launches the design viewer to preview the XML report design.">
		<ant dir="../" target="viewDesignXml"/>
	</target>

	<target name="viewDesign" description="Launches the design viewer to preview the compiled report design.">
		<ant dir="../" target="viewDesign"/>
	</target>

	<target name="decompile" description="Decompiles a .jasper file into a .jrxml file.">
		<ant dir="../" target="decompile"/>
	</target>

	<target name="writeApi" description="Generates a .java version of the report by converting the .jrxml file.">
		<ant dir="../" target="writeApi"/>
	</target>

	<target name="writeApiXml" description="Generates a .jrxml version of the report by executing the API version of the report design.">
		<ant dir="../" target="writeApiXml"/>
	</target>

	<target name="clean" description="Deletes all the generated files.">
		<ant dir="../" target="clean-sample"/>
	</target>
	
	<target name="test" description="Runs the sample.">
		<echo message="==================================="/>
		<echo message=" Virtualizer Sample"/>
		<echo message="==================================="/>
		<antcall target="clean" />
		<antcall target="javac" />
		<antcall target="compile" />
		<ant dir="../" target="test"/>
	</target>

</project>
