net.sf.jasperreports.engine.base
Class JRBaseImage

java.lang.Object
  extended bynet.sf.jasperreports.engine.base.JRBaseElement
      extended bynet.sf.jasperreports.engine.base.JRBaseGraphicElement
          extended bynet.sf.jasperreports.engine.base.JRBaseImage
All Implemented Interfaces:
JRAlignment, JRAnchor, JRChild, JRElement, JRGraphicElement, JRHyperlink, JRImage, java.io.Serializable

public class JRBaseImage
extends JRBaseGraphicElement
implements JRImage

The actual implementation of a graphic element representing an image.

Version:
$Id: JRBaseImage.java,v 1.34 2005/09/07 13:58:25 teodord Exp $
Author:
Teodor Danciu (teodord@users.sourceforge.net)
See Also:
Serialized Form

Field Summary
protected  JRExpression anchorNameExpression
           
protected  int bookmarkLevel
          The bookmark level for the anchor associated with this image.
protected  JRBox box
           
protected  JRGroup evaluationGroup
           
protected  byte evaluationTime
           
protected  JRExpression expression
           
protected  byte horizontalAlignment
           
protected  JRExpression hyperlinkAnchorExpression
           
protected  JRExpression hyperlinkPageExpression
           
protected  JRExpression hyperlinkReferenceExpression
           
protected  byte hyperlinkTarget
           
protected  byte hyperlinkType
           
protected  boolean isLazy
           
protected  java.lang.Boolean isUsingCache
           
protected  byte onErrorType
           
protected  byte scaleImage
           
protected  byte verticalAlignment
           
 
Fields inherited from class net.sf.jasperreports.engine.base.JRBaseGraphicElement
fill, pen
 
Fields inherited from class net.sf.jasperreports.engine.base.JRBaseElement
backcolor, elementGroup, forecolor, height, isPrintInFirstWholeBand, isPrintRepeatedValues, isPrintWhenDetailOverflows, isRemoveLineWhenBlank, key, mode, positionType, printWhenExpression, printWhenGroupChanges, stretchType, width, x, y
 
Fields inherited from interface net.sf.jasperreports.engine.JRImage
ON_ERROR_TYPE_BLANK, ON_ERROR_TYPE_ERROR, ON_ERROR_TYPE_ICON, SCALE_IMAGE_CLIP, SCALE_IMAGE_FILL_FRAME, SCALE_IMAGE_RETAIN_SHAPE
 
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
 
Constructor Summary
protected JRBaseImage()
           
protected JRBaseImage(JRImage image, JRBaseObjectFactory factory)
          Initializes properties that are specific to images.
 
Method Summary
 void collectExpressions(JRExpressionCollector collector)
           
 JRExpression getAnchorNameExpression()
          Returns an expression whose value represents the anchor name.
 int getBookmarkLevel()
          Returns the level of the bookmark corresponding to the anchor.
 JRBox getBox()
          Returns an object containing all border and padding properties for this text element
 JRChild getCopy(JRAbstractObjectFactory factory)
           
 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.
 JRExpression getHyperlinkAnchorExpression()
          Returns the expression whose value represents the anchor.
 JRExpression getHyperlinkPageExpression()
          Returns an integer representing the page index of the link.
 JRExpression getHyperlinkReferenceExpression()
          Returns the expression whose value represents the hyperlink reference.
 byte getHyperlinkTarget()
          Retrieves the hyperlink target for the element.
 byte getHyperlinkType()
          Retrieves the hyperlink type for 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.
 void writeXml(JRXmlWriter xmlWriter)
           
 
Methods inherited from class net.sf.jasperreports.engine.base.JRBaseGraphicElement
getFill, getPen, setFill, setPen
 
Methods inherited from class net.sf.jasperreports.engine.base.JRBaseElement
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 class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface net.sf.jasperreports.engine.JRGraphicElement
getFill, getPen, setFill, setPen
 
Methods inherited from interface net.sf.jasperreports.engine.JRElement
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
 

Field Detail

scaleImage

protected byte scaleImage

horizontalAlignment

protected byte horizontalAlignment

verticalAlignment

protected byte verticalAlignment

isUsingCache

protected java.lang.Boolean isUsingCache

isLazy

protected boolean isLazy

onErrorType

protected byte onErrorType

evaluationTime

protected byte evaluationTime

hyperlinkType

protected byte hyperlinkType

hyperlinkTarget

protected byte hyperlinkTarget

box

protected JRBox box

evaluationGroup

protected JRGroup evaluationGroup

expression

protected JRExpression expression

anchorNameExpression

protected JRExpression anchorNameExpression

hyperlinkReferenceExpression

protected JRExpression hyperlinkReferenceExpression

hyperlinkAnchorExpression

protected JRExpression hyperlinkAnchorExpression

hyperlinkPageExpression

protected JRExpression hyperlinkPageExpression

bookmarkLevel

protected int bookmarkLevel
The bookmark level for the anchor associated with this image.

See Also:
JRAnchor.getBookmarkLevel()
Constructor Detail

JRBaseImage

protected JRBaseImage()

JRBaseImage

protected JRBaseImage(JRImage image,
                      JRBaseObjectFactory factory)
Initializes properties that are specific to images. Common properties are initialized by its parent constructors.

Parameters:
image - an element whose properties are copied to this element. Usually it is a JRDesignImage that must be transformed into an JRBaseImage at compile time.
factory - a factory used in the compile process
Method Detail

getScaleImage

public byte getScaleImage()
Description copied from interface: JRImage
Gets the image scale type.

Specified by:
getScaleImage in interface JRImage
Returns:
one of the scale constants in this class

setScaleImage

public void setScaleImage(byte scaleImage)
Description copied from interface: JRImage
Sets the image scale type.

Specified by:
setScaleImage in interface JRImage
Parameters:
scaleImage - one of the scale constants in this class

getHorizontalAlignment

public byte getHorizontalAlignment()
Description copied from interface: JRImage
Gets the horizontal alignment of the element.

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

setHorizontalAlignment

public void setHorizontalAlignment(byte horizontalAlignment)
Description copied from interface: JRImage
Sets the horizontal alignment of the element.

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

getVerticalAlignment

public byte getVerticalAlignment()
Description copied from interface: JRImage
Gets the vertical alignment of the element.

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

setVerticalAlignment

public void setVerticalAlignment(byte verticalAlignment)
Description copied from interface: JRImage
Sets the vertical alignment of the element.

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

isUsingCache

public boolean isUsingCache()
Description copied from interface: JRImage
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.

Specified by:
isUsingCache in interface JRImage
Returns:
true if the image should be loaded from cache, false otherwise

isOwnUsingCache

public java.lang.Boolean isOwnUsingCache()
Description copied from interface: JRImage
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.

Specified by:
isOwnUsingCache in interface JRImage
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)
Description copied from interface: JRImage
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.

Specified by:
setUsingCache in interface JRImage

setUsingCache

public void setUsingCache(java.lang.Boolean isUsingCache)
Description copied from interface: JRImage
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.

Specified by:
setUsingCache in interface JRImage

isLazy

public boolean isLazy()
Description copied from interface: JRImage
Indicates if the images will be loaded lazily or not.

Specified by:
isLazy in interface JRImage

setLazy

public void setLazy(boolean isLazy)
Description copied from interface: JRImage
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.

Specified by:
setLazy in interface JRImage
Parameters:
isLazy - specifies whether

getOnErrorType

public byte getOnErrorType()
Description copied from interface: JRImage
Indicates how the engine will treat a missing image.

Specified by:
getOnErrorType in interface JRImage
Returns:
one of the constants for missing image error types

setOnErrorType

public void setOnErrorType(byte onErrorType)
Description copied from interface: JRImage
Specifies how the engine should treat a missing image.

Specified by:
setOnErrorType in interface JRImage
Parameters:
onErrorType - one of the constants for missing image error types

getEvaluationTime

public byte getEvaluationTime()
Description copied from interface: JRImage
Indicates the evaluation time for this image.

Specified by:
getEvaluationTime in interface JRImage
Returns:
one of the evaluation time constants in JRExpression

getBox

public JRBox getBox()
Description copied from interface: JRImage
Returns an object containing all border and padding properties for this text element

Specified by:
getBox in interface JRImage

getHyperlinkType

public byte getHyperlinkType()
Description copied from interface: JRHyperlink
Retrieves the hyperlink type for the element.

Specified by:
getHyperlinkType in interface JRHyperlink
Returns:
one of the hyperlink type constants

getHyperlinkTarget

public byte getHyperlinkTarget()
Description copied from interface: JRHyperlink
Retrieves the hyperlink target for the element.

Specified by:
getHyperlinkTarget in interface JRHyperlink
Returns:
one of the hyperlink target constants

getEvaluationGroup

public JRGroup getEvaluationGroup()
Description copied from interface: JRImage
Indicates the evaluation time for this image.

Specified by:
getEvaluationGroup in interface JRImage
Returns:
one of the evaluation time constants in JRExpression

getExpression

public JRExpression getExpression()
Description copied from interface: JRImage
Gets the evaluation group for this text field. Used only when evaluation time is group.

Specified by:
getExpression in interface JRImage
See Also:
JRExpression.EVALUATION_TIME_GROUP

getAnchorNameExpression

public JRExpression getAnchorNameExpression()
Description copied from interface: JRAnchor
Returns an expression whose value represents the anchor name.

Specified by:
getAnchorNameExpression in interface JRAnchor

getHyperlinkReferenceExpression

public JRExpression getHyperlinkReferenceExpression()
Description copied from interface: JRHyperlink
Returns the expression whose value represents the hyperlink reference. It is only used when the hyperlink type is reference or anchor

Specified by:
getHyperlinkReferenceExpression in interface JRHyperlink

getHyperlinkAnchorExpression

public JRExpression getHyperlinkAnchorExpression()
Description copied from interface: JRHyperlink
Returns the expression whose value represents the anchor. It is only used when the hyperlink type is anchor.

Specified by:
getHyperlinkAnchorExpression in interface JRHyperlink

getHyperlinkPageExpression

public JRExpression getHyperlinkPageExpression()
Description copied from interface: JRHyperlink
Returns an integer representing the page index of the link. It is only used when the hyperlink type is page. If the expression does not evaluate to an integer, an exception will be thrown.

Specified by:
getHyperlinkPageExpression in interface JRHyperlink

getCopy

public JRChild getCopy(JRAbstractObjectFactory factory)
Specified by:
getCopy in interface JRChild

collectExpressions

public void collectExpressions(JRExpressionCollector collector)
Specified by:
collectExpressions in interface JRElement

writeXml

public void writeXml(JRXmlWriter xmlWriter)
Specified by:
writeXml in interface JRChild

getBookmarkLevel

public int getBookmarkLevel()
Description copied from interface: JRAnchor
Returns the level of the bookmark corresponding to the anchor.

Specified by:
getBookmarkLevel in interface JRAnchor
Returns:
the level of the bookmark corresponding to the anchor (starting from 1) or NO_BOOKMARK if no bookmark should be created for this anchor


© 2001-2005 JasperSoft Corporation www.jaspersoft.com