diff --git a/jasperreports-parent/jasperreports-examples/src/main/java/org/wicketstuff/jasperreports/examples/ReportLinksPage.java b/jasperreports-parent/jasperreports-examples/src/main/java/org/wicketstuff/jasperreports/examples/ReportLinksPage.java
index 31c56381b1..db535f4046 100644
--- a/jasperreports-parent/jasperreports-examples/src/main/java/org/wicketstuff/jasperreports/examples/ReportLinksPage.java
+++ b/jasperreports-parent/jasperreports-examples/src/main/java/org/wicketstuff/jasperreports/examples/ReportLinksPage.java
@@ -12,15 +12,11 @@
*/
package org.wicketstuff.jasperreports.examples;
-import jakarta.servlet.ServletContext;
-
import java.io.File;
-import java.util.HashMap;
import java.util.Map;
import org.apache.wicket.markup.html.WebPage;
import org.apache.wicket.markup.html.link.ResourceLink;
-import org.apache.wicket.protocol.http.WebApplication;
import org.wicketstuff.jasperreports.JRConcreteResource;
import org.wicketstuff.jasperreports.JRImageResource;
import org.wicketstuff.jasperreports.JRResource;
@@ -29,63 +25,65 @@
import org.wicketstuff.jasperreports.handlers.PdfResourceHandler;
import org.wicketstuff.jasperreports.handlers.RtfResourceHandler;
import org.wicketstuff.jasperreports.handlers.TextResourceHandler;
+import org.wicketstuff.jasperreports.handlers.XlsResourceHandler;
/**
* Simple Jasper reports example with PDF output and a jasper reports panel..
- *
+ *
* @author Eelco Hillenius
*/
-public class ReportLinksPage extends WebPage
-{
+public class ReportLinksPage extends WebPage {
private static final long serialVersionUID = 1L;
/**
* Constructor.
*/
- public ReportLinksPage()
- {
- ServletContext context = ((WebApplication)getApplication()).getServletContext();
- final File reportFile = new File(context.getRealPath("/reports/WebappReport.jasper"));
+ public ReportLinksPage() {
+ final File base = new File(System.getProperty("jasperreportsDirectory"));
+ final File reportFile = new File(base, "WebappReport.jasper");
- final Map
parameters = new HashMap();
- parameters.put("BaseDir", new File(context.getRealPath("/reports")));
+ final Map parameters = Map.of("BaseDir", base);
JRResource pdfResource = new JRConcreteResource(reportFile,
- new PdfResourceHandler()).setReportParameters(parameters).setReportDataSource(
- new WebappDataSource());
+ new PdfResourceHandler()).setReportParameters(parameters).setReportDataSource(
+ new WebappDataSource());
add(new ResourceLink("linkToPdf", pdfResource));
JRResource rtfResource = new JRConcreteResource(reportFile,
- new RtfResourceHandler()).setReportParameters(parameters).setReportDataSource(
- new WebappDataSource());
+ new RtfResourceHandler()).setReportParameters(parameters).setReportDataSource(
+ new WebappDataSource());
add(new ResourceLink("linkToRtf", rtfResource));
JRResource htmlResource = new JRConcreteResource(reportFile,
- new HtmlResourceHandler()).setReportParameters(parameters).setReportDataSource(
- new WebappDataSource());
+ new HtmlResourceHandler()).setReportParameters(parameters).setReportDataSource(
+ new WebappDataSource());
add(new ResourceLink("linkToHtml", htmlResource));
JRResource textResource = new JRConcreteResource(reportFile,
- new TextResourceHandler()).setReportParameters(parameters).setReportDataSource(
- new WebappDataSource());
+ new TextResourceHandler()).setReportParameters(parameters).setReportDataSource(
+ new WebappDataSource());
add(new ResourceLink("linkToText", textResource));
JRResource imageResource = new JRImageResource(reportFile).setReportParameters(parameters)
- .setReportDataSource(new WebappDataSource());
+ .setReportDataSource(new WebappDataSource());
add(new ResourceLink("linkToImage", imageResource));
JRResource csvResource = new JRConcreteResource(reportFile,
- new CsvResourceHandler()).setReportParameters(parameters).setReportDataSource(
- new WebappDataSource());
+ new CsvResourceHandler()).setReportParameters(parameters).setReportDataSource(
+ new WebappDataSource());
add(new ResourceLink("linkToCsv", csvResource));
+
+ JRResource xlsResource = new JRConcreteResource(reportFile,
+ new XlsResourceHandler()).setReportParameters(parameters).setReportDataSource(
+ new WebappDataSource());
+ add(new ResourceLink("linkToXls", xlsResource));
}
/**
* @see org.apache.wicket.Component#isVersioned()
*/
@Override
- public boolean isVersioned()
- {
+ public boolean isVersioned() {
return false;
}
}
\ No newline at end of file
diff --git a/jasperreports-parent/jasperreports-examples/src/main/java/org/wicketstuff/jasperreports/examples/SimplePdfPage.html b/jasperreports-parent/jasperreports-examples/src/main/java/org/wicketstuff/jasperreports/examples/SimplePdfPage.html
index dca6c4989b..457fdf2a18 100644
--- a/jasperreports-parent/jasperreports-examples/src/main/java/org/wicketstuff/jasperreports/examples/SimplePdfPage.html
+++ b/jasperreports-parent/jasperreports-examples/src/main/java/org/wicketstuff/jasperreports/examples/SimplePdfPage.html
@@ -3,14 +3,19 @@
xml:lang="en" lang="en">
WicketStuff JasperReports Integration - Embedded PDF
+
Before
-
-
-
+
After
diff --git a/jasperreports-parent/jasperreports-examples/src/main/java/org/wicketstuff/jasperreports/examples/SimplePdfPage.java b/jasperreports-parent/jasperreports-examples/src/main/java/org/wicketstuff/jasperreports/examples/SimplePdfPage.java
index 9478dbe715..5d332dd519 100644
--- a/jasperreports-parent/jasperreports-examples/src/main/java/org/wicketstuff/jasperreports/examples/SimplePdfPage.java
+++ b/jasperreports-parent/jasperreports-examples/src/main/java/org/wicketstuff/jasperreports/examples/SimplePdfPage.java
@@ -12,14 +12,10 @@
*/
package org.wicketstuff.jasperreports.examples;
-import jakarta.servlet.ServletContext;
-
import java.io.File;
-import java.util.HashMap;
import java.util.Map;
import org.apache.wicket.markup.html.WebPage;
-import org.apache.wicket.protocol.http.WebApplication;
import org.wicketstuff.jasperreports.EmbeddedJRReport;
import org.wicketstuff.jasperreports.JRConcreteResource;
import org.wicketstuff.jasperreports.JRResource;
@@ -27,26 +23,22 @@
/**
* Simple Jasper reports example with PDF output and a jasper reports panel..
- *
+ *
* @author Eelco Hillenius
*/
-public class SimplePdfPage extends WebPage
-{
+public class SimplePdfPage extends WebPage {
private static final long serialVersionUID = 1L;
/**
* Constructor.
*/
- public SimplePdfPage()
- {
- ServletContext context = ((WebApplication)getApplication()).getServletContext();
- final File reportFile = new File(context.getRealPath("/reports/WebappReport.jasper"));
+ public SimplePdfPage() {
+ final File base = new File(System.getProperty("jasperreportsDirectory"));
+ final File reportFile = new File(base, "WebappReport.jasper");
- final Map parameters = new HashMap();
- parameters.put("BaseDir", new File(context.getRealPath("/reports")));
- JRResource pdfResource = new JRConcreteResource(reportFile,
- new PdfResourceHandler()).setReportParameters(parameters).setReportDataSource(
- new WebappDataSource());
+ JRResource pdfResource = new JRConcreteResource(reportFile, new PdfResourceHandler())
+ .setReportParameters(Map.of("BaseDir", base))
+ .setReportDataSource(new WebappDataSource());
add(new EmbeddedJRReport("report", pdfResource));
}
@@ -54,8 +46,7 @@ public SimplePdfPage()
* @see org.apache.wicket.Component#isVersioned()
*/
@Override
- public boolean isVersioned()
- {
+ public boolean isVersioned() {
return false;
}
}
\ No newline at end of file
diff --git a/jasperreports-parent/jasperreports-examples/src/main/java/org/wicketstuff/jasperreports/examples/WebappDataSource.java b/jasperreports-parent/jasperreports-examples/src/main/java/org/wicketstuff/jasperreports/examples/WebappDataSource.java
index 9a3f4119c9..56522dff54 100644
--- a/jasperreports-parent/jasperreports-examples/src/main/java/org/wicketstuff/jasperreports/examples/WebappDataSource.java
+++ b/jasperreports-parent/jasperreports-examples/src/main/java/org/wicketstuff/jasperreports/examples/WebappDataSource.java
@@ -5,21 +5,21 @@
*
* JasperReports - Free Java report-generating library.
* Copyright (C) 2001-2009 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
* 539 Bryant Street, Suite 100
* San Francisco, CA 94107
@@ -33,101 +33,84 @@
import net.sf.jasperreports.engine.JRException;
import net.sf.jasperreports.engine.JRField;
-
/**
* @author Teodor Danciu (teodord@users.sourceforge.net)
* @version $Id: WebappDataSource.java 2692 2009-03-24 17:17:32Z teodord $
*/
-public class WebappDataSource implements Serializable, JRDataSource
-{
-
-
+public class WebappDataSource implements Serializable, JRDataSource {
private static final long serialVersionUID = 1L;
/**
*
*/
- private Object[][] data = { { "Berne", new Integer(22), "Bill Ott", "250 - 20th Ave." },
- { "Berne", new Integer(9), "James Schneider", "277 Seventh Av." },
- { "Boston", new Integer(32), "Michael Ott", "339 College Av." },
- { "Boston", new Integer(23), "Julia Heiniger", "358 College Av." },
- { "Chicago", new Integer(39), "Mary Karsen", "202 College Av." },
- { "Chicago", new Integer(35), "George Karsen", "412 College Av." },
- { "Chicago", new Integer(11), "Julia White", "412 Upland Pl." },
- { "Dallas", new Integer(47), "Janet Fuller", "445 Upland Pl." },
- { "Dallas", new Integer(43), "Susanne Smith", "2 Upland Pl." },
- { "Dallas", new Integer(40), "Susanne Miller", "440 - 20th Ave." },
- { "Dallas", new Integer(36), "John Steel", "276 Upland Pl." },
- { "Dallas", new Integer(37), "Michael Clancy", "19 Seventh Av." },
- { "Dallas", new Integer(19), "Susanne Heiniger", "86 - 20th Ave." },
- { "Dallas", new Integer(10), "Anne Fuller", "135 Upland Pl." },
- { "Dallas", new Integer(4), "Sylvia Ringer", "365 College Av." },
- { "Dallas", new Integer(0), "Laura Steel", "429 Seventh Av." },
- { "Lyon", new Integer(38), "Andrew Heiniger", "347 College Av." },
- { "Lyon", new Integer(28), "Susanne White", "74 - 20th Ave." },
- { "Lyon", new Integer(17), "Laura Ott", "443 Seventh Av." },
- { "Lyon", new Integer(2), "Anne Miller", "20 Upland Pl." },
- { "New York", new Integer(46), "Andrew May", "172 Seventh Av." },
- { "New York", new Integer(44), "Sylvia Ott", "361 College Av." },
- { "New York", new Integer(41), "Bill King", "546 College Av." },
- { "Oslo", new Integer(45), "Janet May", "396 Seventh Av." },
- { "Oslo", new Integer(42), "Robert Ott", "503 Seventh Av." },
- { "Paris", new Integer(25), "Sylvia Steel", "269 College Av." },
- { "Paris", new Integer(18), "Sylvia Fuller", "158 - 20th Ave." },
- { "Paris", new Integer(5), "Laura Miller", "294 Seventh Av." },
- { "San Francisco", new Integer(48), "Robert White", "549 Seventh Av." },
- { "San Francisco", new Integer(7), "James Peterson", "231 Upland Pl." } };
+ private Object[][] data = { { "Berne", Integer.valueOf(22), "Bill Ott", "250 - 20th Ave." },
+ { "Berne", Integer.valueOf(9), "James Schneider", "277 Seventh Av." },
+ { "Boston", Integer.valueOf(32), "Michael Ott", "339 College Av." },
+ { "Boston", Integer.valueOf(23), "Julia Heiniger", "358 College Av." },
+ { "Chicago", Integer.valueOf(39), "Mary Karsen", "202 College Av." },
+ { "Chicago", Integer.valueOf(35), "George Karsen", "412 College Av." },
+ { "Chicago", Integer.valueOf(11), "Julia White", "412 Upland Pl." },
+ { "Dallas", Integer.valueOf(47), "Janet Fuller", "445 Upland Pl." },
+ { "Dallas", Integer.valueOf(43), "Susanne Smith", "2 Upland Pl." },
+ { "Dallas", Integer.valueOf(40), "Susanne Miller", "440 - 20th Ave." },
+ { "Dallas", Integer.valueOf(36), "John Steel", "276 Upland Pl." },
+ { "Dallas", Integer.valueOf(37), "Michael Clancy", "19 Seventh Av." },
+ { "Dallas", Integer.valueOf(19), "Susanne Heiniger", "86 - 20th Ave." },
+ { "Dallas", Integer.valueOf(10), "Anne Fuller", "135 Upland Pl." },
+ { "Dallas", Integer.valueOf(4), "Sylvia Ringer", "365 College Av." },
+ { "Dallas", Integer.valueOf(0), "Laura Steel", "429 Seventh Av." },
+ { "Lyon", Integer.valueOf(38), "Andrew Heiniger", "347 College Av." },
+ { "Lyon", Integer.valueOf(28), "Susanne White", "74 - 20th Ave." },
+ { "Lyon", Integer.valueOf(17), "Laura Ott", "443 Seventh Av." },
+ { "Lyon", Integer.valueOf(2), "Anne Miller", "20 Upland Pl." },
+ { "New York", Integer.valueOf(46), "Andrew May", "172 Seventh Av." },
+ { "New York", Integer.valueOf(44), "Sylvia Ott", "361 College Av." },
+ { "New York", Integer.valueOf(41), "Bill King", "546 College Av." },
+ { "Oslo", Integer.valueOf(45), "Janet May", "396 Seventh Av." },
+ { "Oslo", Integer.valueOf(42), "Robert Ott", "503 Seventh Av." },
+ { "Paris", Integer.valueOf(25), "Sylvia Steel", "269 College Av." },
+ { "Paris", Integer.valueOf(18), "Sylvia Fuller", "158 - 20th Ave." },
+ { "Paris", Integer.valueOf(5), "Laura Miller", "294 Seventh Av." },
+ { "San Francisco", Integer.valueOf(48), "Robert White", "549 Seventh Av." },
+ { "San Francisco", Integer.valueOf(7), "James Peterson", "231 Upland Pl." } };
private int index = -1;
-
/**
*
*/
- public WebappDataSource()
- {
+ public WebappDataSource() {
}
-
/**
*
*/
- public boolean next() throws JRException
- {
+ @Override
+ public boolean next() throws JRException {
index++;
return (index < data.length);
}
-
/**
*
*/
- public Object getFieldValue(JRField field) throws JRException
- {
+ @Override
+ public Object getFieldValue(JRField field) throws JRException {
Object value = null;
String fieldName = field.getName();
- if ("City".equals(fieldName))
- {
+ if ("City".equals(fieldName)) {
value = data[index][0];
- }
- else if ("Id".equals(fieldName))
- {
+ } else if ("Id".equals(fieldName)) {
value = data[index][1];
- }
- else if ("Name".equals(fieldName))
- {
+ } else if ("Name".equals(fieldName)) {
value = data[index][2];
- }
- else if ("Street".equals(fieldName))
- {
+ } else if ("Street".equals(fieldName)) {
value = data[index][3];
}
return value;
}
-
-
}
diff --git a/jasperreports-parent/jasperreports-examples/src/main/resources/jasperreports/WebappReport.jasper b/jasperreports-parent/jasperreports-examples/src/main/resources/jasperreports/WebappReport.jasper
new file mode 100644
index 0000000000..1768ab2b7b
Binary files /dev/null and b/jasperreports-parent/jasperreports-examples/src/main/resources/jasperreports/WebappReport.jasper differ
diff --git a/jasperreports-parent/jasperreports-examples/src/main/resources/jasperreports/WebappReport.jrxml b/jasperreports-parent/jasperreports-examples/src/main/resources/jasperreports/WebappReport.jrxml
new file mode 100644
index 0000000000..28a3dc8a09
--- /dev/null
+++ b/jasperreports-parent/jasperreports-examples/src/main/resources/jasperreports/WebappReport.jrxml
@@ -0,0 +1,88 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jasperreports-parent/jasperreports-examples/src/main/jasperreports/WebappReport.jrxml b/jasperreports-parent/jasperreports-examples/src/main/resources/jasperreports/WebappReport_v6.jrxml
similarity index 100%
rename from jasperreports-parent/jasperreports-examples/src/main/jasperreports/WebappReport.jrxml
rename to jasperreports-parent/jasperreports-examples/src/main/resources/jasperreports/WebappReport_v6.jrxml
diff --git a/jasperreports-parent/jasperreports-examples/src/main/webapp/images/jasperreports.gif b/jasperreports-parent/jasperreports-examples/src/main/resources/jasperreports/jasperreports.gif
similarity index 100%
rename from jasperreports-parent/jasperreports-examples/src/main/webapp/images/jasperreports.gif
rename to jasperreports-parent/jasperreports-examples/src/main/resources/jasperreports/jasperreports.gif
diff --git a/jasperreports-parent/jasperreports-examples/src/main/webapp/reports/WebappReport.jasper b/jasperreports-parent/jasperreports-examples/src/main/webapp/reports/WebappReport.jasper
deleted file mode 100644
index 83896dcd87..0000000000
Binary files a/jasperreports-parent/jasperreports-examples/src/main/webapp/reports/WebappReport.jasper and /dev/null differ
diff --git a/jasperreports-parent/jasperreports/pom.xml b/jasperreports-parent/jasperreports/pom.xml
index 08c961ff70..ace0928c51 100644
--- a/jasperreports-parent/jasperreports/pom.xml
+++ b/jasperreports-parent/jasperreports/pom.xml
@@ -28,6 +28,14 @@
net.sf.jasperreports
jasperreports
+
+ net.sf.jasperreports
+ jasperreports-pdf
+
+
+ net.sf.jasperreports
+ jasperreports-excel-poi
+
diff --git a/jasperreports-parent/jasperreports/src/main/java/org/wicketstuff/jasperreports/EmbeddedJRReport.java b/jasperreports-parent/jasperreports/src/main/java/org/wicketstuff/jasperreports/EmbeddedJRReport.java
index bf3868e580..b37608697d 100644
--- a/jasperreports-parent/jasperreports/src/main/java/org/wicketstuff/jasperreports/EmbeddedJRReport.java
+++ b/jasperreports-parent/jasperreports/src/main/java/org/wicketstuff/jasperreports/EmbeddedJRReport.java
@@ -17,30 +17,42 @@
*/
package org.wicketstuff.jasperreports;
-import org.apache.wicket.IRequestListener;
-import org.apache.wicket.Page;
import org.apache.wicket.markup.ComponentTag;
-import org.apache.wicket.markup.html.WebComponent;
-import org.apache.wicket.request.handler.resource.ResourceRequestHandler;
-import org.apache.wicket.request.mapper.parameter.PageParameters;
+import org.apache.wicket.markup.html.WebMarkupContainer;
+import org.apache.wicket.request.cycle.RequestCycle;
+import org.apache.wicket.request.resource.AbstractResource;
+import org.apache.wicket.request.resource.ContentDisposition;
+import org.apache.wicket.request.resource.IResource;
import org.apache.wicket.request.resource.ResourceReference;
/**
* Component for embedding a jasper report in a page. This component must be attached to an
* <object> tag. If you don't want to embed the report, but have a link to it instead, use
* {@link ResourceReference}.
- *
+ *
* @author Justin Lee
*/
-public final class EmbeddedJRReport extends WebComponent implements IRequestListener
-{
+public final class EmbeddedJRReport extends WebMarkupContainer {
private static final long serialVersionUID = 1L;
private final JRResource resource;
+ private final ResourceReference ref = new ResourceReference(EmbeddedJRReport.class, "report") {
+ @Override
+ public IResource getResource() {
+ return new AbstractResource() {
+ @Override
+ protected ResourceResponse newResourceResponse(Attributes attributes) {
+ ResourceResponse resp = resource.newResourceResponse(attributes);
+ resp.setContentDisposition(ContentDisposition.INLINE);
+ return resp;
+ }
+ };
+ }
+ };
/**
* Construct.
- *
+ *
* @param componentID
* component componentID
* @param resource
@@ -52,36 +64,17 @@ public EmbeddedJRReport(String componentID, JRResource resource)
this.resource = resource;
}
- @Override
- public void onRequest()
- {
- PageParameters pageParams = null;
- final Page page = findPage();
- if (page != null)
- pageParams = page.getPageParameters();
-
- ResourceRequestHandler reqh = new ResourceRequestHandler(resource, pageParams);
-
- reqh.respond(getRequestCycle());
- }
-
/**
* Make sure we work only with object tags
- *
+ *
* @param tag
* tag applied to component.
* @see org.apache.wicket.Component#onComponentTag(org.apache.wicket.markup.ComponentTag)
*/
@Override
- protected void onComponentTag(ComponentTag tag)
- {
- if (!"object".equalsIgnoreCase(tag.getName()))
- {
- findMarkupStream().throwMarkupException(
- "Component " + getId() + " must be applied to a tag of type 'object' not " +
- tag.toUserDebugString());
- }
- tag.put("data", getResponse().encodeURL(urlForListener(null)));
+ protected void onComponentTag(ComponentTag tag) {
+ checkComponentTag(tag, "object");
+ tag.put("data", RequestCycle.get().urlFor(ref, null));
tag.put("type", resource.getContentType());
super.onComponentTag(tag);
}
diff --git a/jasperreports-parent/jasperreports/src/main/java/org/wicketstuff/jasperreports/JRConcreteResource.java b/jasperreports-parent/jasperreports/src/main/java/org/wicketstuff/jasperreports/JRConcreteResource.java
index ed35c4613a..42439be913 100644
--- a/jasperreports-parent/jasperreports/src/main/java/org/wicketstuff/jasperreports/JRConcreteResource.java
+++ b/jasperreports-parent/jasperreports/src/main/java/org/wicketstuff/jasperreports/JRConcreteResource.java
@@ -1,14 +1,14 @@
/*
* $Id: JRGenericResource.java 5335 2010-06-14 13:28:39Z cdeal $ $Revision:
* 1.3 $ $Date: 2010-06-14 09:28:39 -0400 (Mon, 14 Jun 2010) $
- *
+ *
* ==============================================================================
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
@@ -19,15 +19,17 @@
import java.io.File;
import java.io.InputStream;
+import java.io.OutputStream;
import java.net.URL;
import net.sf.jasperreports.engine.JRAbstractExporter;
+import net.sf.jasperreports.export.ExporterOutput;
import org.wicketstuff.jasperreports.handlers.IJRResourceHandler;
/**
* A concrete implementation of a JRResource that delegates the common methods to a handler
- *
+ *
* @author cdeal
*/
public class JRConcreteResource extends JRResource
@@ -37,7 +39,7 @@ public class JRConcreteResource extends JRResource
/**
* Constructor for JRConcreteResource
- *
+ *
* @param handler
*/
public JRConcreteResource(H handler)
@@ -48,7 +50,7 @@ public JRConcreteResource(H handler)
/**
* Constructor for JRConcreteResource
- *
+ *
* @param report
* @param handler
*/
@@ -60,7 +62,7 @@ public JRConcreteResource(InputStream report, H handler)
/**
* Constructor for JRConcreteResource
- *
+ *
* @param report
* @param handler
*/
@@ -72,7 +74,7 @@ public JRConcreteResource(URL report, H handler)
/**
* Constructor for JRConcreteResource
- *
+ *
* @param report
* @param handler
*/
@@ -84,7 +86,7 @@ public JRConcreteResource(File report, H handler)
/**
* Constructor for JRConcreteResource
- *
+ *
* @param factory
* @param handler
*/
@@ -121,6 +123,11 @@ public final JRAbstractExporter newExporter()
return handler.newExporter();
}
+ @Override
+ public ExporterOutput newExporterOutput(OutputStream os) {
+ return handler.newExporterOutput(os);
+ }
+
/**
* @return Returns the handler.
*/
diff --git a/jasperreports-parent/jasperreports/src/main/java/org/wicketstuff/jasperreports/JRImageResource.java b/jasperreports-parent/jasperreports/src/main/java/org/wicketstuff/jasperreports/JRImageResource.java
index 9db370ce2b..02cecf860e 100644
--- a/jasperreports-parent/jasperreports/src/main/java/org/wicketstuff/jasperreports/JRImageResource.java
+++ b/jasperreports-parent/jasperreports/src/main/java/org/wicketstuff/jasperreports/JRImageResource.java
@@ -22,6 +22,7 @@
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
+import java.io.OutputStream;
import java.net.URL;
import javax.imageio.ImageIO;
@@ -29,16 +30,18 @@
import net.sf.jasperreports.engine.JRAbstractExporter;
import net.sf.jasperreports.engine.JRException;
-import net.sf.jasperreports.engine.JRExporterParameter;
import net.sf.jasperreports.engine.JasperPrint;
import net.sf.jasperreports.engine.export.JRGraphics2DExporter;
-import net.sf.jasperreports.engine.export.JRGraphics2DExporterParameter;
+import net.sf.jasperreports.export.ExporterOutput;
+import net.sf.jasperreports.export.SimpleExporterInput;
+import net.sf.jasperreports.export.SimpleGraphics2DExporterOutput;
+import net.sf.jasperreports.export.SimpleGraphics2DReportConfiguration;
import org.apache.wicket.WicketRuntimeException;
/**
* Resource class for jasper reports PDF resources.
- *
+ *
* @author Eelco Hillenius
*/
public final class JRImageResource extends JRResource
@@ -70,7 +73,7 @@ public JRImageResource()
/**
* Construct.
- *
+ *
* @param report
* the report input stream
*/
@@ -81,7 +84,7 @@ public JRImageResource(InputStream report)
/**
* Construct.
- *
+ *
* @param report
* the report input stream
*/
@@ -92,7 +95,7 @@ public JRImageResource(URL report)
/**
* Construct.
- *
+ *
* @param report
* the report input stream
*/
@@ -117,22 +120,28 @@ public final JRAbstractExporter newExporter()
}
}
+ @Override
+ public ExporterOutput newExporterOutput(OutputStream os) {
+ return null; // not used
+ }
@Override
protected byte[] getExporterData(JasperPrint print, JRAbstractExporter exporter)
throws JRException
{
// prepare a stream to trap the exporter's output
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- exporter.setParameter(JRExporterParameter.JASPER_PRINT, print);
- exporter.setParameter(JRExporterParameter.OUTPUT_STREAM, baos);
+ exporter.setExporterInput(new SimpleExporterInput(print));
// create an image object
int width = (int)(print.getPageWidth() * getZoomRatio());
int height = (int)(print.getPageHeight() * getZoomRatio());
BufferedImage image = new BufferedImage(width, height, type);
- exporter.setParameter(JRGraphics2DExporterParameter.GRAPHICS_2D, image.getGraphics());
- exporter.setParameter(JRGraphics2DExporterParameter.ZOOM_RATIO, new Float(zoomRatio));
+ SimpleGraphics2DExporterOutput out = new SimpleGraphics2DExporterOutput();
+ out.setGraphics2D(image.createGraphics());
+ exporter.setExporterOutput(out);
+ SimpleGraphics2DReportConfiguration cfg = new SimpleGraphics2DReportConfiguration();
+ cfg.setZoomRatio(zoomRatio);
+ exporter.setConfiguration(cfg);
// execute the export and return the trapped result
exporter.exportReport();
@@ -142,7 +151,7 @@ protected byte[] getExporterData(JasperPrint print, JRAbstractExporter exporter)
/**
* @param image
* The image to turn into data
- *
+ *
* @return The image data for this dynamic image
*/
protected byte[] toImageData(final BufferedImage image)
@@ -179,7 +188,7 @@ public String getContentType()
/**
* Gets the zoom ratio.
- *
+ *
* @return the zoom ratio used for the export. The default value is 1
*/
public float getZoomRatio()
@@ -189,7 +198,7 @@ public float getZoomRatio()
/**
* Sets the zoom ratio.
- *
+ *
* @param ratio
* the zoom ratio used for the export. The default value is 1
*/
@@ -200,7 +209,7 @@ public void setZoomRatio(float ratio)
/**
* Gets the image type.
- *
+ *
* @return the image type. The default value is 'png'
*/
public String getFormat()
@@ -210,7 +219,7 @@ public String getFormat()
/**
* Sets the image type.
- *
+ *
* @param format
* the image type. The default value is 'png'
*/
@@ -221,7 +230,7 @@ public void setFormat(String format)
/**
* Gets type of image (one of BufferedImage.TYPE_*).
- *
+ *
* @return type of image
*/
public int getType()
@@ -231,7 +240,7 @@ public int getType()
/**
* Sets type of image (one of BufferedImage.TYPE_*).
- *
+ *
* @param type
* type of image
*/
diff --git a/jasperreports-parent/jasperreports/src/main/java/org/wicketstuff/jasperreports/JRResource.java b/jasperreports-parent/jasperreports/src/main/java/org/wicketstuff/jasperreports/JRResource.java
index 5f34ae2b09..90f1c74286 100644
--- a/jasperreports-parent/jasperreports/src/main/java/org/wicketstuff/jasperreports/JRResource.java
+++ b/jasperreports-parent/jasperreports/src/main/java/org/wicketstuff/jasperreports/JRResource.java
@@ -19,6 +19,7 @@
import java.io.File;
import java.io.InputStream;
+import java.io.OutputStream;
import java.net.URL;
import java.util.HashMap;
import java.util.Map;
@@ -26,11 +27,12 @@
import net.sf.jasperreports.engine.JRAbstractExporter;
import net.sf.jasperreports.engine.JRDataSource;
import net.sf.jasperreports.engine.JRException;
-import net.sf.jasperreports.engine.JRExporterParameter;
import net.sf.jasperreports.engine.JasperFillManager;
import net.sf.jasperreports.engine.JasperPrint;
import net.sf.jasperreports.engine.JasperReport;
import net.sf.jasperreports.engine.util.JRLoader;
+import net.sf.jasperreports.export.ExporterOutput;
+import net.sf.jasperreports.export.SimpleExporterInput;
import org.apache.wicket.WicketRuntimeException;
import org.apache.wicket.request.resource.AbstractResource;
@@ -41,14 +43,14 @@
/**
* Base class for jasper reports resources.
- *
+ *
* @author Eelco Hillenius
* @author Matej Knopp
* @author Luciano Montebove
*/
-@SuppressWarnings("serial")
-public abstract class JRResource extends AbstractResource
-{
+public abstract class JRResource extends AbstractResource {
+ private static final long serialVersionUID = 1L;
+
/**
* logger.
*/
@@ -65,8 +67,10 @@ public abstract class JRResource extends AbstractResource
private IJasperReportFactory jasperReportFactory;
/**
- * The compiled report this resource references. Made transient as we don't want our report to
- * be serialized while we can recreate it at other servers at will using the factory.
+ * The compiled report this resource references. Made transient as we don't want
+ * our report to
+ * be serialized while we can recreate it at other servers at will using the
+ * factory.
*/
private transient JasperReport jasperReport;
@@ -81,107 +85,90 @@ public abstract class JRResource extends AbstractResource
private JRDataSource reportDataSource;
/**
- * When set, a header 'Content-Disposition: attachment; filename="${fileName}"' will be added to
- * the response, resulting in a download dialog. No magical extensions are added, so you should
+ * When set, a header 'Content-Disposition: attachment; filename="${fileName}"'
+ * will be added to
+ * the response, resulting in a download dialog. No magical extensions are
+ * added, so you should
* make sure the file has the extension you want yourself.
*/
private String fileName;
/**
- * Construct without a report. You must provide a report before you can use this resource.
+ * Construct without a report. You must provide a report before you can use this
+ * resource.
*/
- public JRResource()
- {
+ public JRResource() {
super();
}
/**
* Construct.
- *
+ *
* @param report
- * the report input stream
+ * the report input stream
*/
- public JRResource(final InputStream report)
- {
- this(new IJasperReportFactory()
- {
- public JasperReport newJasperReport() throws JRException
- {
- return (JasperReport)JRLoader.loadObject(report);
+ public JRResource(final InputStream report) {
+ this(new IJasperReportFactory() {
+ public JasperReport newJasperReport() throws JRException {
+ return (JasperReport) JRLoader.loadObject(report);
}
-
- ;
});
}
/**
* Construct.
- *
+ *
* @param report
- * the report input stream
+ * the report input stream
*/
- public JRResource(final URL report)
- {
- this(new IJasperReportFactory()
- {
- public JasperReport newJasperReport() throws JRException
- {
- return (JasperReport)JRLoader.loadObject(report);
+ public JRResource(final URL report) {
+ this(new IJasperReportFactory() {
+ public JasperReport newJasperReport() throws JRException {
+ return (JasperReport) JRLoader.loadObject(report);
}
-
- ;
});
}
/**
* Construct.
- *
+ *
* @param report
- * the report input stream
+ * the report input stream
*/
- public JRResource(final File report)
- {
- this(new IJasperReportFactory()
- {
- public JasperReport newJasperReport() throws JRException
- {
- return (JasperReport)JRLoader.loadObject(report);
+ public JRResource(final File report) {
+ this(new IJasperReportFactory() {
+ public JasperReport newJasperReport() throws JRException {
+ return (JasperReport) JRLoader.loadObject(report);
}
-
- ;
});
}
/**
* Construct.
- *
+ *
* @param factory
- * report factory for lazy initialization
+ * report factory for lazy initialization
*/
- public JRResource(IJasperReportFactory factory)
- {
+ public JRResource(IJasperReportFactory factory) {
super();
jasperReportFactory = factory;
}
/**
- * Gets jasperReport. This implementation uses an internal factory to lazily create the report.
- * After creation the report is cached (set as the jasperReport property). Override this method
+ * Gets jasperReport. This implementation uses an internal factory to lazily
+ * create the report.
+ * After creation the report is cached (set as the jasperReport property).
+ * Override this method
* in case you want to provide some alternative creation/ caching scheme.
- *
+ *
* @return jasperReport
*/
- public JasperReport getJasperReport()
- {
+ public JasperReport getJasperReport() {
// if the report has not yet been initialized and can be, initialize it
- if (jasperReport == null && jasperReportFactory != null)
- {
- try
- {
+ if (jasperReport == null && jasperReportFactory != null) {
+ try {
setJasperReport(jasperReportFactory.newJasperReport());
- }
- catch (JRException e)
- {
+ } catch (JRException e) {
throw new WicketRuntimeException(e);
}
}
@@ -190,189 +177,179 @@ public JasperReport getJasperReport()
/**
* Sets {bjasperReport.
- *
+ *
* @param report
- * report
+ * report
*/
- public final void setJasperReport(JasperReport report)
- {
+ public final void setJasperReport(JasperReport report) {
jasperReport = report;
}
/**
- * Gets the report parameters. Returns a new copy of the reportParameters Map as JasperReports
+ * Gets the report parameters. Returns a new copy of the reportParameters Map as
+ * JasperReports
* modifies it with not serializable objects
- *
+ *
* @return report parameters
*/
- public Map getReportParameters()
- {
+ public Map getReportParameters() {
return new HashMap(reportParameters);
}
/**
* Sets the report parameters.
- *
+ *
* @param params
- * report parameters
- *
+ * report parameters
+ *
* @return This
*/
- public final JRResource setReportParameters(Map params)
- {
+ public final JRResource setReportParameters(Map params) {
reportParameters = params;
return this;
}
/**
* Gets the datasource if any for filling this report.
- *
+ *
* @return the datasource if any for filling this report
*/
- public JRDataSource getReportDataSource()
- {
+ public JRDataSource getReportDataSource() {
return reportDataSource;
}
/**
* Sets the datasource if any for filling this report.
- *
+ *
* @param dataSource
- * the datasource if any for filling this report
- *
+ * the datasource if any for filling this report
+ *
* @return This
*/
- public JRResource setReportDataSource(JRDataSource dataSource)
- {
+ public JRResource setReportDataSource(JRDataSource dataSource) {
reportDataSource = dataSource;
return this;
}
/**
* Gets the connection provider if any for filling this report.
- *
+ *
* @return the connection provider if any for filling this report
*/
- public IDatabaseConnectionProvider getConnectionProvider()
- {
+ public IDatabaseConnectionProvider getConnectionProvider() {
return connectionProvider;
}
/**
* Sets the connection provider if any for filling this report.
- *
+ *
* @param provider
- * the connection provider if any for filling this report
- *
+ * the connection provider if any for filling this report
+ *
* @return This
*/
- public final JRResource setConnectionProvider(IDatabaseConnectionProvider provider)
- {
+ public final JRResource setConnectionProvider(IDatabaseConnectionProvider provider) {
connectionProvider = provider;
return this;
}
/**
* Gets the file name. When set, a header 'Content-Disposition: attachment;
- * filename="${fileName}"' will be added to the response, resulting in a download dialog. No
- * magical extensions are added, so you should make sure the file has the extension you want
+ * filename="${fileName}"' will be added to the response, resulting in a
+ * download dialog. No
+ * magical extensions are added, so you should make sure the file has the
+ * extension you want
* yourself.
- *
+ *
* @return the file name
*/
- public String getFileName()
- {
- if (fileName == null)
- {
+ public String getFileName() {
+ if (fileName == null) {
fileName = getJasperReport().getName() + "." + getExtension();
}
return fileName;
}
/**
- * Sets the file name. When set, a header 'Content-Disposition: attachment; filename="${name}"'
- * will be added to the response, resulting in a download dialog. No magical extensions are
+ * Sets the file name. When set, a header 'Content-Disposition: attachment;
+ * filename="${name}"'
+ * will be added to the response, resulting in a download dialog. No magical
+ * extensions are
* added, so you should make sure the file has the extension you want yourself.
- *
+ *
* @param name
- * the file name
- *
+ * the file name
+ *
* @return This
*/
- public final JRResource setFileName(String name)
- {
+ public final JRResource setFileName(String name) {
fileName = name;
return this;
}
/**
* Called by getData to obtain an exporter instance.
- *
+ *
* @return an exporter instance
*/
public abstract JRAbstractExporter newExporter();
+ /**
+ * Called by getExporterData to obtain an exporter output instance.
+ *
+ * @return an exporter instance
+ */
+ public abstract ExporterOutput newExporterOutput(OutputStream os);
/**
* @return The content type of the reports
*/
public abstract String getContentType();
-
/**
* The default is to return the content as an attachment.
- *
+ *
* @return The content disposition of the reports
*/
- public ContentDisposition getContentDisposition()
- {
+ public ContentDisposition getContentDisposition() {
return ContentDisposition.ATTACHMENT;
}
-
/**
- * Returns the extension for the resource's file. This string should not contain the leading "."
- *
+ * Returns the extension for the resource's file. This string should not contain
+ * the leading "."
+ *
* @return The extension for the resource's file.
*/
public abstract String getExtension();
/**
- * Creates a new {@link JasperPrint} instance. This instance is specific for this render, but it
+ * Creates a new {@link JasperPrint} instance. This instance is specific for
+ * this render, but it
* not yet designated for one output format only.
- *
+ *
* @return a new {@link JasperPrint} instance.
- *
+ *
* @throws JRException
*/
- protected JasperPrint newJasperPrint() throws JRException
- {
+ protected JasperPrint newJasperPrint() throws JRException {
final JasperPrint jasperPrint;
JasperReport report = getJasperReport();
Map params = getReportParameters();
JRDataSource dataSource = getReportDataSource();
- if (dataSource != null)
- {
+ if (dataSource != null) {
jasperPrint = JasperFillManager.fillReport(report, params, dataSource);
- }
- else
- {
+ } else {
IDatabaseConnectionProvider provider = null;
- try
- {
+ try {
provider = getConnectionProvider();
- if (provider == null)
- {
+ if (provider == null) {
throw new IllegalStateException(
- "JasperReportsResources must either have a JRDataSource, "
- + "or a JDBC Connection provided");
+ "JasperReportsResources must either have a JRDataSource, or a JDBC Connection provided");
}
jasperPrint = JasperFillManager.fillReport(report, params, provider.get());
- }
- finally
- {
- if (provider != null)
- {
+ } finally {
+ if (provider != null) {
provider.release();
}
}
@@ -381,23 +358,17 @@ protected JasperPrint newJasperPrint() throws JRException
}
@Override
- protected ResourceResponse newResourceResponse(Attributes attributes)
- {
+ protected ResourceResponse newResourceResponse(Attributes attributes) {
ResourceResponse resp = new ResourceResponse();
resp.disableCaching();
resp.setContentType(getContentType());
resp.setFileName(getFileName());
resp.setContentDisposition(getContentDisposition());
- if (resp.dataNeedsToBeWritten(attributes))
- {
- resp.setWriteCallback(new WriteCallback()
- {
-
+ if (resp.dataNeedsToBeWritten(attributes)) {
+ resp.setWriteCallback(new WriteCallback() {
@Override
- public void writeData(Attributes attributes)
- {
- try
- {
+ public void writeData(Attributes attributes) {
+ try {
long t1 = System.currentTimeMillis();
// get a print instance for exporting
JasperPrint print = newJasperPrint();
@@ -405,19 +376,16 @@ public void writeData(Attributes attributes)
// get a fresh instance of an exporter for this report
JRAbstractExporter exporter = newExporter();
-
final byte[] data = getExporterData(print, exporter);
attributes.getResponse().write(data);
- if (log.isDebugEnabled())
- {
+
+ if (log.isDebugEnabled()) {
long t2 = System.currentTimeMillis();
log.debug("loaded report data; bytes: " + data.length + " in " +
- (t2 - t1) + " miliseconds");
+ (t2 - t1) + " miliseconds");
}
- }
- catch (JRException e)
- {
+ } catch (JRException e) {
throw new WicketRuntimeException(e);
}
}
@@ -427,17 +395,15 @@ public void writeData(Attributes attributes)
}
protected byte[] getExporterData(JasperPrint print, JRAbstractExporter exporter)
- throws JRException
- {
+ throws JRException {
// prepare a stream to trap the exporter's output
ByteArrayOutputStream baos = new ByteArrayOutputStream();
- exporter.setParameter(JRExporterParameter.JASPER_PRINT, print);
- exporter.setParameter(JRExporterParameter.OUTPUT_STREAM, baos);
+ exporter.setExporterInput(new SimpleExporterInput(print));
+ exporter.setExporterOutput(newExporterOutput(baos));
// execute the export and return the trapped result
exporter.exportReport();
return baos.toByteArray();
}
-
-}
\ No newline at end of file
+}
diff --git a/jasperreports-parent/jasperreports/src/main/java/org/wicketstuff/jasperreports/handlers/CsvResourceHandler.java b/jasperreports-parent/jasperreports/src/main/java/org/wicketstuff/jasperreports/handlers/CsvResourceHandler.java
index 90d79abf8f..7fce7c56a5 100644
--- a/jasperreports-parent/jasperreports/src/main/java/org/wicketstuff/jasperreports/handlers/CsvResourceHandler.java
+++ b/jasperreports-parent/jasperreports/src/main/java/org/wicketstuff/jasperreports/handlers/CsvResourceHandler.java
@@ -1,14 +1,14 @@
/*
* $Id: CsvResourceHandler.java 5335 2010-06-14 13:28:39Z cdeal $ $Revision:
* 1.4 $ $Date: 2010-06-14 09:28:39 -0400 (Mon, 14 Jun 2010) $
- *
+ *
* ==============================================================================
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
@@ -17,10 +17,13 @@
*/
package org.wicketstuff.jasperreports.handlers;
+import java.io.OutputStream;
import java.io.Serializable;
import net.sf.jasperreports.engine.JRAbstractExporter;
import net.sf.jasperreports.engine.export.JRCsvExporter;
+import net.sf.jasperreports.export.ExporterOutput;
+import net.sf.jasperreports.export.SimpleWriterExporterOutput;
/**
* @author cdeal
@@ -37,6 +40,11 @@ public JRAbstractExporter newExporter()
return new JRCsvExporter();
}
+ @Override
+ public ExporterOutput newExporterOutput(OutputStream os) {
+ return new SimpleWriterExporterOutput(os);
+ }
+
/**
* @see org.wicketstuff.jasperreports.handlers.IJRResourceHandler#getContentType()
*/
diff --git a/jasperreports-parent/jasperreports/src/main/java/org/wicketstuff/jasperreports/handlers/HtmlResourceHandler.java b/jasperreports-parent/jasperreports/src/main/java/org/wicketstuff/jasperreports/handlers/HtmlResourceHandler.java
index d6cb876e3b..e3523a786d 100644
--- a/jasperreports-parent/jasperreports/src/main/java/org/wicketstuff/jasperreports/handlers/HtmlResourceHandler.java
+++ b/jasperreports-parent/jasperreports/src/main/java/org/wicketstuff/jasperreports/handlers/HtmlResourceHandler.java
@@ -1,14 +1,14 @@
/*
* $Id: HtmlResourceHandler.java 5335 2010-06-14 13:28:39Z cdeal $ $Revision:
* 1.4 $ $Date: 2010-06-14 09:28:39 -0400 (Mon, 14 Jun 2010) $
- *
+ *
* ==============================================================================
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
@@ -17,10 +17,13 @@
*/
package org.wicketstuff.jasperreports.handlers;
+import java.io.OutputStream;
import java.io.Serializable;
import net.sf.jasperreports.engine.JRAbstractExporter;
import net.sf.jasperreports.engine.export.HtmlExporter;
+import net.sf.jasperreports.export.ExporterOutput;
+import net.sf.jasperreports.export.SimpleHtmlExporterOutput;
/**
* @author cdeal
@@ -37,6 +40,11 @@ public JRAbstractExporter newExporter()
return new HtmlExporter();
}
+ @Override
+ public ExporterOutput newExporterOutput(OutputStream os) {
+ return new SimpleHtmlExporterOutput(os);
+ }
+
/**
* @see org.wicketstuff.jasperreports.handlers.IJRResourceHandler#getContentType()
*/
diff --git a/jasperreports-parent/jasperreports/src/main/java/org/wicketstuff/jasperreports/handlers/IJRResourceHandler.java b/jasperreports-parent/jasperreports/src/main/java/org/wicketstuff/jasperreports/handlers/IJRResourceHandler.java
index de485a6a10..407b7f2bfb 100644
--- a/jasperreports-parent/jasperreports/src/main/java/org/wicketstuff/jasperreports/handlers/IJRResourceHandler.java
+++ b/jasperreports-parent/jasperreports/src/main/java/org/wicketstuff/jasperreports/handlers/IJRResourceHandler.java
@@ -1,14 +1,14 @@
/*
* $Id: IJRResourceHandler.java 5335 2010-06-14 13:28:39Z cdeal $ $Revision:
* 1.3 $ $Date: 2010-06-14 09:28:39 -0400 (Mon, 14 Jun 2010) $
- *
+ *
* ==============================================================================
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
@@ -17,7 +17,10 @@
*/
package org.wicketstuff.jasperreports.handlers;
+import java.io.OutputStream;
+
import net.sf.jasperreports.engine.JRAbstractExporter;
+import net.sf.jasperreports.export.ExporterOutput;
/**
* @author cdeal
@@ -38,4 +41,9 @@ public interface IJRResourceHandler
* @see org.wicketstuff.jasperreports.JRResource#newExporter()
*/
public JRAbstractExporter newExporter();
+
+ /**
+ * @see org.wicketstuff.jasperreports.JRResource#newExporterOutput()
+ */
+ public ExporterOutput newExporterOutput(OutputStream os);
}
diff --git a/jasperreports-parent/jasperreports/src/main/java/org/wicketstuff/jasperreports/handlers/PdfResourceHandler.java b/jasperreports-parent/jasperreports/src/main/java/org/wicketstuff/jasperreports/handlers/PdfResourceHandler.java
index d3bdcc1ea0..975f035dff 100644
--- a/jasperreports-parent/jasperreports/src/main/java/org/wicketstuff/jasperreports/handlers/PdfResourceHandler.java
+++ b/jasperreports-parent/jasperreports/src/main/java/org/wicketstuff/jasperreports/handlers/PdfResourceHandler.java
@@ -1,14 +1,14 @@
/*
* $Id: PdfResourceHandler.java 5335 2010-06-14 13:28:39Z cdeal $ $Revision:
* 1.4 $ $Date: 2010-06-14 09:28:39 -0400 (Mon, 14 Jun 2010) $
- *
+ *
* ==============================================================================
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
@@ -17,10 +17,13 @@
*/
package org.wicketstuff.jasperreports.handlers;
+import java.io.OutputStream;
import java.io.Serializable;
import net.sf.jasperreports.engine.JRAbstractExporter;
-import net.sf.jasperreports.engine.export.JRPdfExporter;
+import net.sf.jasperreports.export.ExporterOutput;
+import net.sf.jasperreports.export.SimpleOutputStreamExporterOutput;
+import net.sf.jasperreports.pdf.JRPdfExporter;
/**
* @author cdeal
@@ -37,6 +40,11 @@ public JRAbstractExporter newExporter()
return new JRPdfExporter();
}
+ @Override
+ public ExporterOutput newExporterOutput(OutputStream os) {
+ return new SimpleOutputStreamExporterOutput(os);
+ }
+
/**
* @see org.wicketstuff.jasperreports.handlers.IJRResourceHandler#getContentType()
*/
diff --git a/jasperreports-parent/jasperreports/src/main/java/org/wicketstuff/jasperreports/handlers/RtfResourceHandler.java b/jasperreports-parent/jasperreports/src/main/java/org/wicketstuff/jasperreports/handlers/RtfResourceHandler.java
index 1378946f32..87c120b266 100644
--- a/jasperreports-parent/jasperreports/src/main/java/org/wicketstuff/jasperreports/handlers/RtfResourceHandler.java
+++ b/jasperreports-parent/jasperreports/src/main/java/org/wicketstuff/jasperreports/handlers/RtfResourceHandler.java
@@ -1,14 +1,14 @@
/*
* $Id: RtfResourceHandler.java 5335 2010-06-14 13:28:39Z cdeal $ $Revision:
* 1.4 $ $Date: 2010-06-14 09:28:39 -0400 (Mon, 14 Jun 2010) $
- *
+ *
* ==============================================================================
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
@@ -17,10 +17,13 @@
*/
package org.wicketstuff.jasperreports.handlers;
+import java.io.OutputStream;
import java.io.Serializable;
import net.sf.jasperreports.engine.JRAbstractExporter;
import net.sf.jasperreports.engine.export.JRRtfExporter;
+import net.sf.jasperreports.export.ExporterOutput;
+import net.sf.jasperreports.export.SimpleWriterExporterOutput;
/**
* @author cdeal
@@ -37,6 +40,11 @@ public JRAbstractExporter newExporter()
return new JRRtfExporter();
}
+ @Override
+ public ExporterOutput newExporterOutput(OutputStream os) {
+ return new SimpleWriterExporterOutput(os);
+ }
+
/**
* @see org.wicketstuff.jasperreports.handlers.IJRResourceHandler#getContentType()
*/
diff --git a/jasperreports-parent/jasperreports/src/main/java/org/wicketstuff/jasperreports/handlers/TextResourceHandler.java b/jasperreports-parent/jasperreports/src/main/java/org/wicketstuff/jasperreports/handlers/TextResourceHandler.java
index 6b3bf2e948..befffb47a8 100644
--- a/jasperreports-parent/jasperreports/src/main/java/org/wicketstuff/jasperreports/handlers/TextResourceHandler.java
+++ b/jasperreports-parent/jasperreports/src/main/java/org/wicketstuff/jasperreports/handlers/TextResourceHandler.java
@@ -1,14 +1,14 @@
/*
* $Id: TextResourceHandler.java 5335 2010-06-14 13:28:39Z cdeal $ $Revision:
* 1.4 $ $Date: 2010-06-14 09:28:39 -0400 (Mon, 14 Jun 2010) $
- *
+ *
* ==============================================================================
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
@@ -17,11 +17,14 @@
*/
package org.wicketstuff.jasperreports.handlers;
+import java.io.OutputStream;
import java.io.Serializable;
import net.sf.jasperreports.engine.JRAbstractExporter;
import net.sf.jasperreports.engine.export.JRTextExporter;
-import net.sf.jasperreports.engine.export.JRTextExporterParameter;
+import net.sf.jasperreports.export.ExporterOutput;
+import net.sf.jasperreports.export.SimpleTextReportConfiguration;
+import net.sf.jasperreports.export.SimpleWriterExporterOutput;
/**
* @author cdeal
@@ -42,7 +45,7 @@ public class TextResourceHandler implements IJRResourceHandler, Serializable
/**
* Gets page height.
- *
+ *
* @return an integer representing the page height in characters
*/
public int getPageHeight()
@@ -52,7 +55,7 @@ public int getPageHeight()
/**
* Sets page height.
- *
+ *
* @param height
* an integer representing the page height in characters
*/
@@ -63,7 +66,7 @@ public void setPageHeight(int height)
/**
* Gets page width.
- *
+ *
* @return an integer representing the page width in characters
*/
public int getPageWidth()
@@ -73,7 +76,7 @@ public int getPageWidth()
/**
* Sets page width.
- *
+ *
* @param width
* an integer representing the page width in characters
*/
@@ -88,11 +91,18 @@ public void setPageWidth(int width)
public JRAbstractExporter newExporter()
{
JRTextExporter exporter = new JRTextExporter();
- exporter.setParameter(JRTextExporterParameter.PAGE_WIDTH, Integer.valueOf(pageWidth));
- exporter.setParameter(JRTextExporterParameter.PAGE_HEIGHT, Integer.valueOf(pageHeight));
+ SimpleTextReportConfiguration cfg = new SimpleTextReportConfiguration();
+ cfg.setPageWidthInChars(pageWidth);
+ cfg.setPageHeightInChars(pageHeight);
+ exporter.setConfiguration(cfg);
return exporter;
}
+ @Override
+ public ExporterOutput newExporterOutput(OutputStream os) {
+ return new SimpleWriterExporterOutput(os);
+ }
+
/**
* @see org.wicketstuff.jasperreports.handlers.IJRResourceHandler#getContentType()
*/
diff --git a/jasperreports-parent/jasperreports/src/main/java/org/wicketstuff/jasperreports/handlers/XlsResourceHandler.java b/jasperreports-parent/jasperreports/src/main/java/org/wicketstuff/jasperreports/handlers/XlsResourceHandler.java
index 4d3b6c1755..d51dc82686 100644
--- a/jasperreports-parent/jasperreports/src/main/java/org/wicketstuff/jasperreports/handlers/XlsResourceHandler.java
+++ b/jasperreports-parent/jasperreports/src/main/java/org/wicketstuff/jasperreports/handlers/XlsResourceHandler.java
@@ -1,14 +1,14 @@
/*
* $Id: XlsResourceHandler.java 5335 2010-06-14 13:28:39Z cdeal $ $Revision:
* 1.4 $ $Date: 2010-06-14 09:28:39 -0400 (Mon, 14 Jun 2010) $
- *
+ *
* ==============================================================================
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
@@ -17,10 +17,13 @@
*/
package org.wicketstuff.jasperreports.handlers;
+import java.io.OutputStream;
import java.io.Serializable;
import net.sf.jasperreports.engine.JRAbstractExporter;
-import net.sf.jasperreports.engine.export.JRXlsExporter;
+import net.sf.jasperreports.export.ExporterOutput;
+import net.sf.jasperreports.export.SimpleOutputStreamExporterOutput;
+import net.sf.jasperreports.poi.export.JRXlsExporter;
/**
* @author cdeal
@@ -37,6 +40,11 @@ public JRAbstractExporter newExporter()
return new JRXlsExporter();
}
+ @Override
+ public ExporterOutput newExporterOutput(OutputStream os) {
+ return new SimpleOutputStreamExporterOutput(os);
+ }
+
/**
* @see org.wicketstuff.jasperreports.handlers.IJRResourceHandler#getContentType()
*/
diff --git a/pom.xml b/pom.xml
index 68f5bab93c..eadfd0c76c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -367,7 +367,7 @@
1.13
2.13.2
7.0.14
- 6.21.5
+ 7.0.6
2.14.1
3.11.1
10.0.0
@@ -887,6 +887,16 @@
jasperreports
${jasperreports.version}
+
+ net.sf.jasperreports
+ jasperreports-pdf
+ ${jasperreports.version}
+
+
+ net.sf.jasperreports
+ jasperreports-excel-poi
+ ${jasperreports.version}
+
joda-time
joda-time