Class RendererUtil
- java.lang.Object
-
- net.sf.jasperreports.renderers.util.RendererUtil
-
public class RendererUtil extends java.lang.Object
- Author:
- Teodor Danciu (teodord@users.sourceforge.net)
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
EXCEPTION_MESSAGE_KEY_IMAGE_ERROR
static java.lang.String
EXCEPTION_MESSAGE_KEY_RENDERABLE_MUST_IMPLEMENT_INTERFACE
static Renderable
NO_IMAGE_RENDERER
static java.lang.String
SVG_FILE_EXTENSION
static java.lang.String
SVG_MIME_TYPE
protected static java.lang.String
SVG_ROOT_ELEMENT
protected static java.lang.String
SVG_ROOT_ELEMENT_QNAME_SUFFIX
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description DataRenderable
getDataRenderable(Renderable renderer, java.awt.Dimension dimension, java.awt.Color backcolor)
DataRenderable
getImageDataRenderable(RenderersCache renderersCache, Renderable renderer, java.awt.Dimension dimension, java.awt.Color backcolor)
static RendererUtil
getInstance(JasperReportsContext jasperReportsContext)
static RendererUtil
getInstance(RepositoryContext context)
Renderable
getNonLazyRenderable(java.lang.String resourceLocation, OnErrorTypeEnum onErrorType)
Renderable
getOnErrorRenderer(OnErrorTypeEnum onErrorType, JRException e)
Renderable
getOnErrorRenderer(OnErrorTypeEnum onErrorType, JRRuntimeException e)
Renderable
getRenderable(byte[] data)
Renderable
getRenderable(java.awt.Image image, ImageTypeEnum imageType, OnErrorTypeEnum onErrorType)
Creates and returns an instance of the JRImageRenderer class after encoding the image object using an image encoder that supports the supplied image type.Renderable
getRenderable(java.awt.Image img, OnErrorTypeEnum onErrorType)
Renderable
getRenderable(java.io.File file, OnErrorTypeEnum onErrorType)
Renderable
getRenderable(java.io.InputStream is, OnErrorTypeEnum onErrorType)
Renderable
getRenderable(java.net.URL url, OnErrorTypeEnum onErrorType)
static java.lang.String
getResourceLocation(Renderable renderer)
SvgDataSniffer
getSvgDataSniffer()
SvgDataSniffer.SvgInfo
getSvgInfo(byte[] data)
Renderable
handleImageError(java.lang.Exception error, OnErrorTypeEnum onErrorType)
static boolean
isLazy(Renderable renderer)
boolean
isSvgData(byte[] data)
boolean
isSvgData(DataRenderable dataRenderable)
protected boolean
isSvgRootElement(java.lang.String rootElementName)
-
-
-
Field Detail
-
EXCEPTION_MESSAGE_KEY_IMAGE_ERROR
public static final java.lang.String EXCEPTION_MESSAGE_KEY_IMAGE_ERROR
- See Also:
- Constant Field Values
-
EXCEPTION_MESSAGE_KEY_RENDERABLE_MUST_IMPLEMENT_INTERFACE
public static final java.lang.String EXCEPTION_MESSAGE_KEY_RENDERABLE_MUST_IMPLEMENT_INTERFACE
- See Also:
- Constant Field Values
-
NO_IMAGE_RENDERER
public static final Renderable NO_IMAGE_RENDERER
-
SVG_MIME_TYPE
public static final java.lang.String SVG_MIME_TYPE
- See Also:
- Constant Field Values
-
SVG_FILE_EXTENSION
public static final java.lang.String SVG_FILE_EXTENSION
- See Also:
- Constant Field Values
-
SVG_ROOT_ELEMENT
protected static final java.lang.String SVG_ROOT_ELEMENT
- See Also:
- Constant Field Values
-
SVG_ROOT_ELEMENT_QNAME_SUFFIX
protected static final java.lang.String SVG_ROOT_ELEMENT_QNAME_SUFFIX
- See Also:
- Constant Field Values
-
-
Method Detail
-
getInstance
public static RendererUtil getInstance(JasperReportsContext jasperReportsContext)
-
getInstance
public static RendererUtil getInstance(RepositoryContext context)
-
isSvgData
public boolean isSvgData(byte[] data)
-
getSvgInfo
public SvgDataSniffer.SvgInfo getSvgInfo(byte[] data)
-
isSvgRootElement
protected boolean isSvgRootElement(java.lang.String rootElementName)
-
isSvgData
public boolean isSvgData(DataRenderable dataRenderable) throws JRException
- Throws:
JRException
-
getSvgDataSniffer
public SvgDataSniffer getSvgDataSniffer()
-
getNonLazyRenderable
public Renderable getNonLazyRenderable(java.lang.String resourceLocation, OnErrorTypeEnum onErrorType) throws JRException
- Throws:
JRException
-
getRenderable
public Renderable getRenderable(java.awt.Image img, OnErrorTypeEnum onErrorType) throws JRException
- Throws:
JRException
-
getRenderable
public Renderable getRenderable(java.awt.Image image, ImageTypeEnum imageType, OnErrorTypeEnum onErrorType) throws JRException
Creates and returns an instance of the JRImageRenderer class after encoding the image object using an image encoder that supports the supplied image type.- Parameters:
image
- the java.awt.Image object to wrap into a JRImageRenderer instanceimageType
- the type of the image as specified by one of the constants defined in the JRRenderable interfaceonErrorType
- one of the error type constants defined in theOnErrorTypeEnum
.- Returns:
- the image renderer instance
- Throws:
JRException
-
getRenderable
public Renderable getRenderable(byte[] data)
-
getRenderable
public Renderable getRenderable(java.io.InputStream is, OnErrorTypeEnum onErrorType) throws JRException
- Throws:
JRException
-
getRenderable
public Renderable getRenderable(java.net.URL url, OnErrorTypeEnum onErrorType) throws JRException
- Throws:
JRException
-
getRenderable
public Renderable getRenderable(java.io.File file, OnErrorTypeEnum onErrorType) throws JRException
- Throws:
JRException
-
handleImageError
public Renderable handleImageError(java.lang.Exception error, OnErrorTypeEnum onErrorType) throws JRException
- Throws:
JRException
-
getOnErrorRenderer
public Renderable getOnErrorRenderer(OnErrorTypeEnum onErrorType, JRException e) throws JRException
- Throws:
JRException
-
getOnErrorRenderer
public Renderable getOnErrorRenderer(OnErrorTypeEnum onErrorType, JRRuntimeException e) throws JRRuntimeException
- Throws:
JRRuntimeException
-
isLazy
public static boolean isLazy(Renderable renderer)
-
getResourceLocation
public static java.lang.String getResourceLocation(Renderable renderer)
-
getDataRenderable
public DataRenderable getDataRenderable(Renderable renderer, java.awt.Dimension dimension, java.awt.Color backcolor) throws JRException
- Throws:
JRException
-
getImageDataRenderable
public DataRenderable getImageDataRenderable(RenderersCache renderersCache, Renderable renderer, java.awt.Dimension dimension, java.awt.Color backcolor) throws JRException
- Throws:
JRException
-
-