net.sf.jasperreports.engine.fill
Class JRFillImage

java.lang.Object
  extended bynet.sf.jasperreports.engine.fill.JRFillElement
      extended bynet.sf.jasperreports.engine.fill.JRFillGraphicElement
          extended bynet.sf.jasperreports.engine.fill.JRFillImage
All Implemented Interfaces:
JRAlignment, JRAnchor, JRChild, JRElement, JRGraphicElement, JRHyperlink, JRImage

public class JRFillImage
extends JRFillGraphicElement
implements JRImage

Version:
$Id: JRFillImage.java,v 1.25 2005/10/07 09:27:31 teodord Exp $
Author:
Teodor Danciu (teodord@users.sourceforge.net)

Field Summary
 
Fields inherited from class net.sf.jasperreports.engine.fill.JRFillElement
band, elementGroup, filler, parent, printWhenGroupChanges, template
 
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 JRFillImage(JRBaseFiller filler, JRImage image, JRFillObjectFactory factory)
           
 
Method Summary
 void collectExpressions(JRExpressionCollector collector)
           
protected  void copy(JRPrintImage printImage)
           
protected  void evaluate(byte evaluation)
           
protected  void evaluateImage(byte evaluation)
           
protected  JRPrintElement fill()
           
protected  java.lang.String getAnchorName()
           
 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.
protected  java.lang.String getHyperlinkAnchor()
           
 JRExpression getHyperlinkAnchorExpression()
          Returns the expression whose value represents the anchor.
protected  java.lang.Integer getHyperlinkPage()
           
 JRExpression getHyperlinkPageExpression()
          Returns an integer representing the page index of the link.
protected  java.lang.String getHyperlinkReference()
           
 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.
protected  JRTemplateImage getJRTemplateImage()
           
 byte getOnErrorType()
          Indicates how the engine will treat a missing image.
protected  JRRenderable getRenderer()
           
 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.
protected  boolean prepare(int availableStretchHeight, boolean isOverflow)
           
protected  void resolveElement(JRPrintElement element, byte evaluation)
          Resolves an element.
 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.fill.JRFillGraphicElement
getFill, getPen, rewind, setFill, setPen
 
Methods inherited from class net.sf.jasperreports.engine.fill.JRFillElement
addDependantElement, evaluatePrintWhenExpression, getBackcolor, getBand, getBandBottomY, getDependantElements, getElementGroup, getForecolor, getGroupElements, getHeight, getKey, getMode, getPositionType, getPrintWhenExpression, getPrintWhenGroupChanges, getRelativeY, getStretchHeight, getStretchType, getWidth, getX, getY, isAlreadyPrinted, isPrintInFirstWholeBand, isPrintRepeatedValues, isPrintWhenDetailOverflows, isPrintWhenExpressionNull, isPrintWhenTrue, isRemoveLineWhenBlank, isReprinted, isToPrint, moveDependantElements, reset, setAlreadyPrinted, setBackcolor, setBand, setBandBottomY, setForecolor, setMode, setPositionType, setPrintInFirstWholeBand, setPrintRepeatedValues, setPrintWhenDetailOverflows, setPrintWhenExpressionNull, setPrintWhenTrue, setRelativeY, setRemoveLineWhenBlank, setReprinted, setStretchHeight, setStretchType, setToPrint, setWidth, setX, stretchElement
 
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
 

Constructor Detail

JRFillImage

protected JRFillImage(JRBaseFiller filler,
                      JRImage image,
                      JRFillObjectFactory factory)
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

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

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

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

getRenderer

protected JRRenderable getRenderer()

getAnchorName

protected java.lang.String getAnchorName()

getHyperlinkReference

protected java.lang.String getHyperlinkReference()

getHyperlinkAnchor

protected java.lang.String getHyperlinkAnchor()

getHyperlinkPage

protected java.lang.Integer getHyperlinkPage()

getJRTemplateImage

protected JRTemplateImage getJRTemplateImage()

evaluate

protected void evaluate(byte evaluation)
                 throws JRException
Specified by:
evaluate in class JRFillElement
Throws:
JRException

evaluateImage

protected void evaluateImage(byte evaluation)
                      throws JRException
Throws:
JRException

prepare

protected boolean prepare(int availableStretchHeight,
                          boolean isOverflow)
Overrides:
prepare in class JRFillGraphicElement

fill

protected JRPrintElement fill()
Specified by:
fill in class JRFillElement

copy

protected void copy(JRPrintImage printImage)

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

resolveElement

protected void resolveElement(JRPrintElement element,
                              byte evaluation)
                       throws JRException
Description copied from class: JRFillElement
Resolves an element.

Specified by:
resolveElement in class JRFillElement
Parameters:
element - the element
evaluation - the evaluation type
Throws:
JRException

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