Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Apress
committed
Oct 11, 2016
0 parents
commit 44fab8f
Showing
512 changed files
with
100,121 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
<project name="antcompile" default="compile1" basedir="."> | ||
|
||
<description>Shows how multiple JRXML files can be compiled in batch mode using ANT.</description> | ||
|
||
<path id="classpath"> | ||
<pathelement location="../../../build/classes"/> | ||
<fileset dir="../../../lib"> | ||
<include name="**/*.jar"/> | ||
</fileset> | ||
</path> | ||
|
||
<path id="runClasspath"> | ||
<path refid="classpath"/> | ||
<pathelement location="./build/classes"/> | ||
</path> | ||
|
||
<taskdef name="jrc" classname="net.sf.jasperreports.ant.JRAntCompileTask"> | ||
<classpath refid="classpath"/> | ||
</taskdef> | ||
|
||
<target name="javac" description="Compiles the Java source files used in the report designs."> | ||
<mkdir dir="./build/classes"/> | ||
<javac srcdir="./src" destdir="./build/classes" debug="true" optimize="false" deprecation="false"/> | ||
</target> | ||
|
||
<target name="compile1" description="Compiles report designs specified using the "srcdir" in the <jrc> tag. Generated .jasper files keep their relative location and are placed in directory structure similar to the source files structure."> | ||
<mkdir dir="./build/reports"/> | ||
<jrc | ||
srcdir="./reports" | ||
destdir="./build/reports" | ||
tempdir="./build/reports" | ||
keepjava="true" | ||
xmlvalidation="true"> | ||
<classpath refid="runClasspath"/> | ||
<include name="**/*.jrxml"/> | ||
</jrc> | ||
</target> | ||
|
||
<target name="compile2" description="Compiles report designs specified using a <fileset> in the <src> tag. Generated .jasper files lose their relative location and are placed in the same output directory."> | ||
<mkdir dir="./build/reports"/> | ||
<jrc | ||
destdir="./build/reports" | ||
tempdir="./build/reports" | ||
keepjava="true" | ||
xmlvalidation="true"> | ||
<src> | ||
<fileset dir="./reports"> | ||
<include name="**/*.jrxml"/> | ||
</fileset> | ||
</src> | ||
<classpath refid="runClasspath"/> | ||
</jrc> | ||
</target> | ||
|
||
<target name="clean" description="Deletes all the generated files."> | ||
<delete dir="./build" /> | ||
</target> | ||
|
||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
|
||
You need to have the ANT build tool correctly installed on your system | ||
to easily run this sample application. This tool can be downloaded from | ||
this location: http://ant.apache.org/ | ||
Please follow their installing instructions to have ANT working on your | ||
system before trying our sample application. | ||
|
||
Once you have ANT installed, launch "ant -p" from the command line in this directory | ||
to learn more about what tasks you could run to build and test the sample. |
16 changes: 16 additions & 0 deletions
16
Chapter02/demo/samples/antcompile/reports/com/bar/BarReport.jrxml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE jasperReport PUBLIC "-//JasperReports//DTD Report Design//EN" "http://jasperreports.sourceforge.net/dtds/jasperreport.dtd"> | ||
|
||
<jasperReport name="BarReport" pageWidth="595" pageHeight="842" whenNoDataType="AllSectionsNoDetail" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="30" bottomMargin="30"> | ||
<style name="Arial_Normal" isDefault="true" fontName="Arial" fontSize="8" isBold="false" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfFontName="Helvetica" pdfEncoding="Cp1252" isPdfEmbedded="false"/> | ||
<title> | ||
<band height="782"> | ||
<printWhenExpression><![CDATA[com.bar.SomeBarClass.isToPrint()]]></printWhenExpression> | ||
<staticText> | ||
<reportElement mode="Opaque" x="0" y="0" width="555" height="90" backcolor="#dddddd" style="Arial_Normal"/> | ||
<textElement textAlignment="Center" verticalAlignment="Middle"/> | ||
<text><![CDATA[Bar Report]]></text> | ||
</staticText> | ||
</band> | ||
</title> | ||
</jasperReport> |
16 changes: 16 additions & 0 deletions
16
Chapter02/demo/samples/antcompile/reports/com/foo/FooReport.jrxml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE jasperReport PUBLIC "-//JasperReports//DTD Report Design//EN" "http://jasperreports.sourceforge.net/dtds/jasperreport.dtd"> | ||
|
||
<jasperReport name="FooReport" pageWidth="595" pageHeight="842" whenNoDataType="AllSectionsNoDetail" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="30" bottomMargin="30"> | ||
<style name="Arial_Normal" isDefault="true" fontName="Arial" fontSize="8" isBold="false" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfFontName="Helvetica" pdfEncoding="Cp1252" isPdfEmbedded="false"/> | ||
<title> | ||
<band height="782"> | ||
<printWhenExpression><![CDATA[com.foo.SomeFooClass.isToPrint()]]></printWhenExpression> | ||
<staticText> | ||
<reportElement mode="Opaque" x="0" y="0" width="555" height="90" backcolor="#dddddd" style="Arial_Normal"/> | ||
<textElement textAlignment="Center" verticalAlignment="Middle"/> | ||
<text><![CDATA[Foo Report]]></text> | ||
</staticText> | ||
</band> | ||
</title> | ||
</jasperReport> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
This file will be ignored by the report compiler task, since it does not match the file pattern used for searching report templates. |
48 changes: 48 additions & 0 deletions
48
Chapter02/demo/samples/antcompile/src/com/bar/SomeBarClass.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/* | ||
* ============================================================================ | ||
* GNU Lesser General Public License | ||
* ============================================================================ | ||
* | ||
* JasperReports - Free Java report-generating library. | ||
* Copyright (C) 2001-2006 JasperSoft Corporation http://www.jaspersoft.com | ||
* | ||
* This library is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU Lesser General Public | ||
* License as published by the Free Software Foundation; either | ||
* version 2.1 of the License, or (at your option) any later version. | ||
* | ||
* This library is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
* Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public | ||
* License along with this library; if not, write to the Free Software | ||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. | ||
* | ||
* JasperSoft Corporation | ||
* 303 Second Street, Suite 450 North | ||
* San Francisco, CA 94107 | ||
* http://www.jaspersoft.com | ||
*/ | ||
package com.bar; | ||
|
||
|
||
/** | ||
* @author Teodor Danciu (teodord@users.sourceforge.net) | ||
* @version $Id: SomeBarClass.java 1413 2006-09-28 10:47:40Z teodord $ | ||
*/ | ||
public class SomeBarClass | ||
{ | ||
|
||
|
||
/** | ||
* | ||
*/ | ||
public static Boolean isToPrint() | ||
{ | ||
return Boolean.TRUE; | ||
} | ||
|
||
|
||
} |
48 changes: 48 additions & 0 deletions
48
Chapter02/demo/samples/antcompile/src/com/foo/SomeFooClass.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/* | ||
* ============================================================================ | ||
* GNU Lesser General Public License | ||
* ============================================================================ | ||
* | ||
* JasperReports - Free Java report-generating library. | ||
* Copyright (C) 2001-2006 JasperSoft Corporation http://www.jaspersoft.com | ||
* | ||
* This library is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU Lesser General Public | ||
* License as published by the Free Software Foundation; either | ||
* version 2.1 of the License, or (at your option) any later version. | ||
* | ||
* This library is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
* Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public | ||
* License along with this library; if not, write to the Free Software | ||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. | ||
* | ||
* JasperSoft Corporation | ||
* 303 Second Street, Suite 450 North | ||
* San Francisco, CA 94107 | ||
* http://www.jaspersoft.com | ||
*/ | ||
package com.foo; | ||
|
||
|
||
/** | ||
* @author Teodor Danciu (teodord@users.sourceforge.net) | ||
* @version $Id: SomeFooClass.java 1413 2006-09-28 10:47:40Z teodord $ | ||
*/ | ||
public class SomeFooClass | ||
{ | ||
|
||
|
||
/** | ||
* | ||
*/ | ||
public static Boolean isToPrint() | ||
{ | ||
return Boolean.TRUE; | ||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
<project name="beanshell" default="javac" basedir="."> | ||
|
||
<description>Shows how reports could be compiled using a customized compiler that relies on BeanShell for expressions evalution.</description> | ||
|
||
<property name="class.name" value="BeanShellApp" /> | ||
<property name="file.name" value="BeanShellReport" /> | ||
<property name="classes.dir" value="../../../build/classes" /> | ||
<property name="lib.dir" value="../../../lib" /> | ||
<property name="fonts.dir" value="../../fonts" /> | ||
|
||
<path id="classpath"> | ||
<pathelement location="./build/classes"/> | ||
<fileset dir="./lib"> | ||
<include name="**/*.jar"/> | ||
</fileset> | ||
<pathelement location="${classes.dir}" /> | ||
<pathelement location="${fonts.dir}" /> | ||
<fileset dir="${lib.dir}"> | ||
<include name="**/*.jar"/> | ||
</fileset> | ||
</path> | ||
|
||
<target name="javac" description="Compiles the java source files of the test application."> | ||
<mkdir dir="./build/classes"/> | ||
<javac srcdir="./src" destdir="./build/classes" debug="true" optimize="false" deprecation="false"> | ||
<classpath refid="classpath"/> | ||
</javac> | ||
</target> | ||
|
||
<target name="compile" description="Compiles the XML report designs and produces the .jasper files."> | ||
<mkdir dir="./build/reports"/> | ||
<taskdef name="jrc" classname="net.sf.jasperreports.ant.JRAntCompileTask"> | ||
<classpath refid="classpath"/> | ||
</taskdef> | ||
<jrc destdir="./build/reports" compiler="net.sf.jasperreports.compilers.JRBshCompiler"> | ||
<src> | ||
<fileset dir="./reports"> | ||
<include name="**/*.jrxml"/> | ||
</fileset> | ||
</src> | ||
<classpath refid="classpath"/> | ||
</jrc> | ||
</target> | ||
|
||
<target name="fill" description="Fills the compiled report design with data and produces the .jrprint file."> | ||
<java classname="${class.name}" fork="true"> | ||
<arg value="-Tfill"/> | ||
<arg value="-F./build/reports/${file.name}.jasper"/> | ||
<classpath refid="classpath"/> | ||
</java> | ||
</target> | ||
|
||
<target name="view" description="Launches the report viewer to preview the report stored in the .jrprint file."> | ||
<java classname="net.sf.jasperreports.view.JasperViewer" fork="true"> | ||
<arg value="-F./build/reports/${file.name}.jrprint"/> | ||
<classpath refid="classpath"/> | ||
</java> | ||
</target> | ||
|
||
<target name="viewXML" description="Launches the report viewer to preview the generated report stored in an XML file."> | ||
<java classname="net.sf.jasperreports.view.JasperViewer" fork="true"> | ||
<arg value="-XML"/> | ||
<arg value="-F./build/reports/${file.name}.jrpxml"/> | ||
<classpath refid="classpath"/> | ||
</java> | ||
</target> | ||
|
||
<target name="pdf" description="Generates a PDF version of the report by converting the .jrprint file."> | ||
<java classname="${class.name}" fork="true"> | ||
<arg value="-Tpdf"/> | ||
<arg value="-F./build/reports/${file.name}.jrprint"/> | ||
<classpath refid="classpath"/> | ||
</java> | ||
</target> | ||
|
||
<target name="viewDesignXML" description="Launches the design viewer to preview the XML report design."> | ||
<java classname="net.sf.jasperreports.view.JasperDesignViewer" fork="true"> | ||
<arg value="-XML"/> | ||
<arg value="-F./reports/${file.name}.jrxml"/> | ||
<classpath refid="classpath"/> | ||
</java> | ||
</target> | ||
|
||
<target name="viewDesign" description="Launches the design viewer to preview the compiled report design."> | ||
<java classname="net.sf.jasperreports.view.JasperDesignViewer" fork="true"> | ||
<arg value="-F./build/reports/${file.name}.jasper"/> | ||
<classpath refid="classpath"/> | ||
</java> | ||
</target> | ||
|
||
<target name="clean" description="Deletes all the generated files."> | ||
<delete dir="./build" /> | ||
</target> | ||
|
||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/***************************************************************************** | ||
* * | ||
* This file is part of the BeanShell Java Scripting distribution. * | ||
* Documentation and updates may be found at http://www.beanshell.org/ * | ||
* * | ||
* Sun Public License Notice: * | ||
* * | ||
* The contents of this file are subject to the Sun Public License Version * | ||
* 1.0 (the "License"); you may not use this file except in compliance with * | ||
* the License. A copy of the License is available at http://www.sun.com * | ||
* * | ||
* The Original Code is BeanShell. The Initial Developer of the Original * | ||
* Code is Pat Niemeyer. Portions created by Pat Niemeyer are Copyright * | ||
* (C) 2000. All Rights Reserved. * | ||
* * | ||
* GNU Public License Notice: * | ||
* * | ||
* Alternatively, the contents of this file may be used under the terms of * | ||
* the GNU Lesser General Public License (the "LGPL"), in which case the * | ||
* provisions of LGPL are applicable instead of those above. If you wish to * | ||
* allow use of your version of this file only under the terms of the LGPL * | ||
* and not to allow others to use your version of this file under the SPL, * | ||
* indicate your decision by deleting the provisions above and replace * | ||
* them with the notice and other provisions required by the LGPL. If you * | ||
* do not delete the provisions above, a recipient may use your version of * | ||
* this file under either the SPL or the LGPL. * | ||
* * | ||
* Patrick Niemeyer (pat@pat.net) * | ||
* Author of Learning Java, O'Reilly & Associates * | ||
* http://www.pat.net/~pat/ * | ||
* * | ||
*****************************************************************************/ | ||
|
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
|
||
You need to have the ANT build tool correctly installed on your system | ||
to easily run this sample application. This tool can be downloaded from | ||
this location: http://ant.apache.org/ | ||
Please follow their installing instructions to have ANT working on your | ||
system before trying our sample application. | ||
|
||
Once you have ANT installed, launch "ant -p" from the command line in this directory | ||
to learn more about what tasks you could run to build and test the sample. |
Oops, something went wrong.