public interface JRImage extends JRGraphicElement, JREvaluation, JRAnchor, JRHyperlink, JRAlignment, JRImageAlignment, JRCommonImage
JRCommonImage) and the actual image is smaller than its defined size in the report template or does not have the same proportions, the image might not occupy all the space allocated to it in the report template. In such cases, one can align the image inside its predefined report space using the
vAlignattributes, which specify the alignment of the image on the horizontal axis (
Right) and the vertical axis (
Bottom). By default, images are aligned at the top and to the left inside their specified bounds.
isUsingCacheflag attribute 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. This attribute can be accessed using the
getUsingCache()method. The caching functionality is available for image elements whose expressions return objects of any type as the image source. The
isUsingCacheflag is set to true by default for images having
java.lang.Stringexpressions and to false for all other types. The key used for the cache is the value of the image source expression; key comparisons are performed using the standard equals method. As a corollary, for images having a
java.io.InputStreamsource with caching enabled, the input stream is read only once, and subsequently the image will be taken from the cache. The
isUsingCacheflag should not be set in cases when an image has a dynamic source (for example, the image is loaded from a binary database field for each row) because the images would accumulate in the cache and the report filling would rapidly fail due to an out-of-memory error. Obviously, the flag should also not be set when a single source is used to produce different images (for example, a URL that would return a different image each time it's accessed).
isLazyflag attribute (see
isLazy()method) specifies whether the image should be loaded and processed during report filling or during exporting. This can be useful in cases in which the image is loaded from a URL and is not available at report-filling time, but will be available at report-export or display time. For instance, there might be a logo image that has to be loaded from a public web server to which the machine that fills the reports does not have access. However, if the reports will be rendered in HTML, the image can be loaded by the browser from the specified URL at report-display time. In such cases, the
isLazyflag should be set to true (it is false by default) and the image expression should be of type
java.util.String, even if the specified image location is actually a URL, a file, or a classpath resource. When lazy loading an image at fill time, the engine will no longer try to load the image from the specified String location but only store that location inside the generated document. The exporter class is responsible for using that String value to access the image at report-export time.
onErrorTypeattribute available for images allows that. It can take the following values:
Error- An exception is thrown if the engine cannot load the image. This is the default behavior.
Blank- Any image-loading exception is ignored and nothing will appear in the generated document
Icon- If the image does not load successfully, then the engine will put a small icon in the document to indicate that the actual image is missing
getExpression()) is the source for the image to be displayed. The image expression is introduced by the
<imageExpression>element and can return values from only the limited range of classes listed following:
java.lang.Stringvalue, the engine tries to see whether the value represents a URL from which to load the image. If it is not a valid URL representation, it tries to locate a file on disk and load the image from it, assuming that the value represents a file name. If no file is found, it finally assumes that the string value represents the location of a classpath resource and tries to load the image from there. An exception is thrown only if all these attempts fail.
evaluationGroupinherited from the
JREvaluation, are available in the
evaluationTimeattribute can take the following values:
Now- The image expression is evaluated when the current band is filled.
Report- The image expression is evaluated when the end of the report is reached.
Page- The image expression is evaluated when the end of the current page is reached.
Column- The image expression is evaluated when the end of the current column is reached.
Group- The image expression is evaluated when the group specified by the
Auto- Each variable participating in the image expression is evaluated at a time corresponding to its reset type. Fields are evaluated
|Modifier and Type||Method and Description|
Indicates how the engine will treat a missing image.
Indicates if the engine is loading the current image from cache.
Indicates if the images will be loaded lazily or not.
Gives control over when the images are retrieved from their specified location.
Specifies how the engine should treat a missing image.
Specifies if the engine should be loading the current image from cache.
Specifies if the engine should be loading the current image from cache.
clone, collectExpressions, getElementGroup, getKey, getPositionTypeValue, getPrintWhenExpression, getPrintWhenGroupChanges, getPropertyExpressions, getStretchTypeValue, getX, getY, isPrintInFirstWholeBand, isPrintRepeatedValues, isPrintWhenDetailOverflows, isRemoveLineWhenBlank, setPositionType, setPrintInFirstWholeBand, setPrintRepeatedValues, setPrintWhenDetailOverflows, setRemoveLineWhenBlank, setStretchType, setWidth, setX
getParentProperties, getPropertiesMap, hasProperties
getHyperlinkAnchorExpression, getHyperlinkPageExpression, getHyperlinkParameters, getHyperlinkReferenceExpression, getHyperlinkTarget, getHyperlinkTooltipExpression, getHyperlinkTypeValue, getHyperlinkWhenExpression, getLinkTarget, getLinkType
getHorizontalAlignmentValue, getOwnHorizontalAlignmentValue, getOwnVerticalAlignmentValue, getVerticalAlignmentValue, setHorizontalAlignment, setVerticalAlignment
getHorizontalImageAlign, getOwnHorizontalImageAlign, getOwnVerticalImageAlign, getVerticalImageAlign, setHorizontalImageAlign, setVerticalImageAlign
getOwnScaleImageValue, getScaleImageValue, setScaleImage
getFillValue, getLinePen, getOwnFillValue, setFill
getBackcolor, getForecolor, getHeight, getModeValue, getOwnBackcolor, getOwnForecolor, getOwnModeValue, getWidth, setBackcolor, setForecolor, setMode
getDefaultStyleProvider, getStyle, getStyleNameReference
void setUsingCache(boolean isUsingCache)
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.
void setUsingCache(java.lang.Boolean isUsingCache)
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.
void setLazy(boolean isLazy)
isLazy- specifies whether
void setOnErrorType(OnErrorTypeEnum onErrorTypeEnum)
onErrorTypeEnum- a value representing one of the missing image handling constants in
© 2001 - 2017 TIBCO Software Inc. www.jaspersoft.com