org.wicketstuff.jasperreports
Class JRImageResource

java.lang.Object
  extended by org.apache.wicket.Resource
      extended by org.apache.wicket.markup.html.WebResource
          extended by org.apache.wicket.markup.html.DynamicWebResource
              extended by org.wicketstuff.jasperreports.JRResource
                  extended by org.wicketstuff.jasperreports.JRImageResource
All Implemented Interfaces:
java.io.Serializable, org.apache.wicket.IClusterable, org.apache.wicket.IRequestListener, org.apache.wicket.IResourceListener

public final class JRImageResource
extends JRResource

Resource class for jasper reports PDF resources.

Author:
Eelco Hillenius
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class org.apache.wicket.markup.html.DynamicWebResource
org.apache.wicket.markup.html.DynamicWebResource.ResourceState
 
Field Summary
 
Fields inherited from interface org.apache.wicket.IResourceListener
INTERFACE
 
Constructor Summary
JRImageResource()
          Construct without a report.
JRImageResource(java.io.File report)
          Construct.
JRImageResource(java.io.InputStream report)
          Construct.
JRImageResource(java.net.URL report)
          Construct.
 
Method Summary
 java.lang.String getContentType()
           
 java.lang.String getExtension()
          Returns the extension for the resource's file.
 java.lang.String getFormat()
          Gets the image type.
protected  org.apache.wicket.markup.html.DynamicWebResource.ResourceState getResourceState()
          Gets the binary data by getting a new instance of JasperPrint and an exporter for generating the output.
 int getType()
          Gets type of image (one of BufferedImage.TYPE_*).
 float getZoomRatio()
          Gets the zoom ratio.
 net.sf.jasperreports.engine.JRAbstractExporter newExporter()
          Called by getData to obtain an exporter instance.
 void setFormat(java.lang.String format)
          Sets the image type.
 void setType(int type)
          Sets type of image (one of BufferedImage.TYPE_*).
 void setZoomRatio(float ratio)
          Sets the zoom ratio.
protected  byte[] toImageData(java.awt.image.BufferedImage image)
           
 
Methods inherited from class org.wicketstuff.jasperreports.JRResource
getConnectionProvider, getFileName, getJasperReport, getReportDataSource, getReportParameters, newJasperPrint, setConnectionProvider, setFileName, setHeaders, setJasperReport, setReportDataSource, setReportParameters
 
Methods inherited from class org.apache.wicket.markup.html.DynamicWebResource
getLocale, getResourceStream
 
Methods inherited from class org.apache.wicket.markup.html.WebResource
configureResponse, getCacheDuration
 
Methods inherited from class org.apache.wicket.Resource
getParameters, invalidate, isCacheable, onResourceRequested, setCacheable, setParameters
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JRImageResource

public JRImageResource()
Construct without a report. You must provide a report before you can use this resource.


JRImageResource

public JRImageResource(java.io.InputStream report)
Construct.

Parameters:
report - the report input stream

JRImageResource

public JRImageResource(java.net.URL report)
Construct.

Parameters:
report - the report input stream

JRImageResource

public JRImageResource(java.io.File report)
Construct.

Parameters:
report - the report input stream
Method Detail

newExporter

public final net.sf.jasperreports.engine.JRAbstractExporter newExporter()
Description copied from class: JRResource
Called by getData to obtain an exporter instance.

Specified by:
newExporter in class JRResource
Returns:
an exporter instance
See Also:
JRResource.newExporter()

getResourceState

protected org.apache.wicket.markup.html.DynamicWebResource.ResourceState getResourceState()
Description copied from class: JRResource
Gets the binary data by getting a new instance of JasperPrint and an exporter for generating the output.

Overrides:
getResourceState in class JRResource
Returns:
the binary data
See Also:
JRResource.getResourceState()

toImageData

protected byte[] toImageData(java.awt.image.BufferedImage image)
Parameters:
image - The image to turn into data
Returns:
The image data for this dynamic image

getContentType

public java.lang.String getContentType()
Specified by:
getContentType in class JRResource
Returns:
The content type of the reports
See Also:
JRResource.getContentType()

getZoomRatio

public float getZoomRatio()
Gets the zoom ratio.

Returns:
the zoom ratio used for the export. The default value is 1

setZoomRatio

public void setZoomRatio(float ratio)
Sets the zoom ratio.

Parameters:
ratio - the zoom ratio used for the export. The default value is 1

getFormat

public java.lang.String getFormat()
Gets the image type.

Returns:
the image type. The default value is 'png'

setFormat

public void setFormat(java.lang.String format)
Sets the image type.

Parameters:
format - the image type. The default value is 'png'

getType

public int getType()
Gets type of image (one of BufferedImage.TYPE_*).

Returns:
type of image

setType

public void setType(int type)
Sets type of image (one of BufferedImage.TYPE_*).

Parameters:
type - type of image

getExtension

public java.lang.String getExtension()
Description copied from class: JRResource
Returns the extension for the resource's file. This string should not contain the leading "."

Specified by:
getExtension in class JRResource
Returns:
The extension for the resource's file.
See Also:
JRResource.getExtension()


Copyright © 2005-2010 Wicket developers. All Rights Reserved.