net.sf.jasperreports.engine
Interface JRImage

All Superinterfaces:
JRAlignment, JRAnchor, JRChild, JRElement, JRGraphicElement, JRHyperlink
All Known Implementing Classes:
JRBaseImage, JRDesignImage, JRFillImage

public interface JRImage
extends JRGraphicElement, JRAnchor, JRHyperlink, JRAlignment

An abstract representation of a graphic element representing an image. Images can be aligned and scaled. They can also contain hyperlinks or be anchors for other hyperlinks.

Version:
$Id: JRImage.java,v 1.15 2005/10/07 10:20:00 teodord Exp $
Author:
Teodor Danciu (teodord@users.sourceforge.net)

Field Summary
static byte ON_ERROR_TYPE_BLANK
          A constant used for specifying that the engine should display blank space if the image is not found.
static byte ON_ERROR_TYPE_ERROR
          A constant used for specifying that the engine should raise an exception if the image is not found.
static byte ON_ERROR_TYPE_ICON
          A constant used for specifying that the engine should display a replacement icon if the image is not found.
static byte SCALE_IMAGE_CLIP
          A constant value specifying that if the actual image is larger than the image element size, it will be cut off so that it keeps its original resolution, and only the region that fits the specified size will be displayed.
static byte SCALE_IMAGE_FILL_FRAME
          A constant value specifying that if the dimensions of the actual image do not fit those specified for the image element that displays it, the image can be forced to obey them and stretch itself so that it fits in the designated output area.
static byte SCALE_IMAGE_RETAIN_SHAPE
          A constant value specifying that if the actual image does not fit into the image element, it can be adapted to those dimensions without needing to change its original proportions.
 
Fields inherited from interface net.sf.jasperreports.engine.JRGraphicElement
FILL_SOLID, PEN_1_POINT, PEN_2_POINT, PEN_4_POINT, PEN_DOTTED, PEN_NONE, PEN_THIN
 
Fields inherited from interface net.sf.jasperreports.engine.JRElement
MODE_OPAQUE, MODE_TRANSPARENT, POSITION_TYPE_FIX_RELATIVE_TO_BOTTOM, POSITION_TYPE_FIX_RELATIVE_TO_TOP, POSITION_TYPE_FLOAT, STRETCH_TYPE_NO_STRETCH, STRETCH_TYPE_RELATIVE_TO_BAND_HEIGHT, STRETCH_TYPE_RELATIVE_TO_TALLEST_OBJECT
 
Fields inherited from interface net.sf.jasperreports.engine.JRAnchor
NO_BOOKMARK
 
Fields inherited from interface net.sf.jasperreports.engine.JRHyperlink
HYPERLINK_TARGET_BLANK, HYPERLINK_TARGET_SELF, HYPERLINK_TYPE_LOCAL_ANCHOR, HYPERLINK_TYPE_LOCAL_PAGE, HYPERLINK_TYPE_NONE, HYPERLINK_TYPE_REFERENCE, HYPERLINK_TYPE_REMOTE_ANCHOR, HYPERLINK_TYPE_REMOTE_PAGE
 
Fields inherited from interface net.sf.jasperreports.engine.JRAlignment
HORIZONTAL_ALIGN_CENTER, HORIZONTAL_ALIGN_JUSTIFIED, HORIZONTAL_ALIGN_LEFT, HORIZONTAL_ALIGN_RIGHT, VERTICAL_ALIGN_BOTTOM, VERTICAL_ALIGN_JUSTIFIED, VERTICAL_ALIGN_MIDDLE, VERTICAL_ALIGN_TOP
 
Method Summary
 JRBox getBox()
          Returns an object containing all border and padding properties for this text element
 JRGroup getEvaluationGroup()
          Indicates the evaluation time for this image.
 byte getEvaluationTime()
          Indicates the evaluation time for this image.
 JRExpression getExpression()
          Gets the evaluation group for this text field.
 byte getHorizontalAlignment()
          Gets the horizontal alignment of the element.
 byte getOnErrorType()
          Indicates how the engine will treat a missing image.
 byte getScaleImage()
          Gets the image scale type.
 byte getVerticalAlignment()
          Gets the vertical alignment of the element.
 boolean isLazy()
          Indicates if the images will be loaded lazily or not.
 java.lang.Boolean isOwnUsingCache()
          Indicates if the engine is loading the current image from cache.
 boolean isUsingCache()
          Indicates if the engine is loading the current image from cache.
 void setHorizontalAlignment(byte horizontalAlignment)
          Sets the horizontal alignment of the element.
 void setLazy(boolean isLazy)
          Gives control over when the images are retrieved from their specified location.
 void setOnErrorType(byte onErrorType)
          Specifies how the engine should treat a missing image.
 void setScaleImage(byte scaleImage)
          Sets the image scale type.
 void setUsingCache(boolean isUsingCache)
          Specifies if the engine should be loading the current image from cache.
 void setUsingCache(java.lang.Boolean isUsingCache)
          Specifies if the engine should be loading the current image from cache.
 void setVerticalAlignment(byte verticalAlignment)
          Sets the vertical alignment of the element.
 
Methods inherited from interface net.sf.jasperreports.engine.JRGraphicElement
getFill, getPen, setFill, setPen
 
Methods inherited from interface net.sf.jasperreports.engine.JRElement
collectExpressions, getBackcolor, getElementGroup, getForecolor, getHeight, getKey, getMode, getPositionType, getPrintWhenExpression, getPrintWhenGroupChanges, getStretchType, getWidth, getX, getY, isPrintInFirstWholeBand, isPrintRepeatedValues, isPrintWhenDetailOverflows, isRemoveLineWhenBlank, setBackcolor, setForecolor, setMode, setPositionType, setPrintInFirstWholeBand, setPrintRepeatedValues, setPrintWhenDetailOverflows, setRemoveLineWhenBlank, setStretchType, setWidth, setX
 
Methods inherited from interface net.sf.jasperreports.engine.JRChild
getCopy, writeXml
 
Methods inherited from interface net.sf.jasperreports.engine.JRAnchor
getAnchorNameExpression, getBookmarkLevel
 
Methods inherited from interface net.sf.jasperreports.engine.JRHyperlink
getHyperlinkAnchorExpression, getHyperlinkPageExpression, getHyperlinkReferenceExpression, getHyperlinkTarget, getHyperlinkType
 

Field Detail

SCALE_IMAGE_CLIP

public static final byte SCALE_IMAGE_CLIP
A constant value specifying that if the actual image is larger than the image element size, it will be cut off so that it keeps its original resolution, and only the region that fits the specified size will be displayed.

See Also:
Constant Field Values

SCALE_IMAGE_FILL_FRAME

public static final byte SCALE_IMAGE_FILL_FRAME
A constant value specifying that if the dimensions of the actual image do not fit those specified for the image element that displays it, the image can be forced to obey them and stretch itself so that it fits in the designated output area.

See Also:
Constant Field Values

SCALE_IMAGE_RETAIN_SHAPE

public static final byte SCALE_IMAGE_RETAIN_SHAPE
A constant value specifying that if the actual image does not fit into the image element, it can be adapted to those dimensions without needing to change its original proportions.

See Also:
Constant Field Values

ON_ERROR_TYPE_ERROR

public static final byte ON_ERROR_TYPE_ERROR
A constant used for specifying that the engine should raise an exception if the image is not found.

See Also:
Constant Field Values

ON_ERROR_TYPE_BLANK

public static final byte ON_ERROR_TYPE_BLANK
A constant used for specifying that the engine should display blank space if the image is not found.

See Also:
Constant Field Values

ON_ERROR_TYPE_ICON

public static final byte ON_ERROR_TYPE_ICON
A constant used for specifying that the engine should display a replacement icon if the image is not found.

See Also:
Constant Field Values
Method Detail

getScaleImage

public byte getScaleImage()
Gets the image scale type.

Returns:
one of the scale constants in this class

setScaleImage

public void setScaleImage(byte scaleImage)
Sets the image scale type.

Parameters:
scaleImage - one of the scale constants in this class

getHorizontalAlignment

public byte getHorizontalAlignment()
Gets the horizontal alignment of the element.

Specified by:
getHorizontalAlignment in interface JRAlignment
Returns:
one of the alignment values defined in JRAlignment

setHorizontalAlignment

public void setHorizontalAlignment(byte horizontalAlignment)
Sets the horizontal alignment of the element.

Specified by:
setHorizontalAlignment in interface JRAlignment
Parameters:
horizontalAlignment - one of the alignment values defined in JRAlignment

getVerticalAlignment

public byte getVerticalAlignment()
Gets the vertical alignment of the element.

Specified by:
getVerticalAlignment in interface JRAlignment
Returns:
one of the alignment values defined in JRAlignment

setVerticalAlignment

public void setVerticalAlignment(byte verticalAlignment)
Sets the vertical alignment of the element.

Specified by:
setVerticalAlignment in interface JRAlignment
Parameters:
verticalAlignment - one of the alignment values defined in JRAlignment

isUsingCache

public boolean isUsingCache()
Indicates if the engine is loading the current image from cache. Implementations of this method rely on default values that depend on the type of the image expression if a value was not explicitly set of this flag.

Returns:
true if the image should be loaded from cache, false otherwise

isOwnUsingCache

public java.lang.Boolean isOwnUsingCache()
Indicates if the engine is loading the current image from cache. Implementations of this method return the actual value for the internal flag that was explicitly set on this image element.

Returns:
Boolean.TRUE if the image should be loaded from cache, Boolean.FALSE otherwise or null in case the flag was never explicitly set on this image element

setUsingCache

public void setUsingCache(boolean isUsingCache)
Specifies if the engine should be loading the current image from cache. If set to true, the reporting engine will try to recognize previously loaded images using their specified source. For example, it will recognize an image if the image source is a file name that it has already loaded, or if it is the same URL.

For image elements that have expressions returning java.lang.String objects as the image source, representing file names, URLs or classpath resources, the default value for this flag is true.


setUsingCache

public void setUsingCache(java.lang.Boolean isUsingCache)
Specifies if the engine should be loading the current image from cache. If set to Boolean.TRUE, the reporting engine will try to recognize previously loaded images using their specified source. For example, it will recognize an image if the image source is a file name that it has already loaded, or if it is the same URL.

If set to null, the engine will rely on some default value which depends on the type of the image expression. The cache is turned on by default only for images that have java.lang.String objects in their expressions.


isLazy

public boolean isLazy()
Indicates if the images will be loaded lazily or not.


setLazy

public void setLazy(boolean isLazy)
Gives control over when the images are retrieved from their specified location. If set to true, the image is loaded from the specified location only when the document is viewed or exported to other formats. Otherwise it is loaded during the report filling process and stored in the resulting document.

Parameters:
isLazy - specifies whether

getOnErrorType

public byte getOnErrorType()
Indicates how the engine will treat a missing image.

Returns:
one of the constants for missing image error types

setOnErrorType

public void setOnErrorType(byte onErrorType)
Specifies how the engine should treat a missing image.

Parameters:
onErrorType - one of the constants for missing image error types

getEvaluationTime

public byte getEvaluationTime()
Indicates the evaluation time for this image.

Returns:
one of the evaluation time constants in JRExpression

getEvaluationGroup

public JRGroup getEvaluationGroup()
Indicates the evaluation time for this image.

Returns:
one of the evaluation time constants in JRExpression

getExpression

public JRExpression getExpression()
Gets the evaluation group for this text field. Used only when evaluation time is group.

See Also:
JRExpression.EVALUATION_TIME_GROUP

getBox

public JRBox getBox()
Returns an object containing all border and padding properties for this text element



© 2001-2005 JasperSoft Corporation www.jaspersoft.com