net.sf.jasperreports.engine.fill
Class JRFillElement

java.lang.Object
  extended bynet.sf.jasperreports.engine.fill.JRFillElement
All Implemented Interfaces:
JRChild, JRElement
Direct Known Subclasses:
JRFillChart, JRFillGraphicElement, JRFillSubreport, JRFillTextElement

public abstract class JRFillElement
extends java.lang.Object
implements JRElement

Version:
$Id: JRFillElement.java,v 1.17 2005/07/20 16:12:13 lucianc Exp $
Author:
Teodor Danciu (teodord@users.sourceforge.net)

Field Summary
protected  JRFillBand band
           
protected  JRFillElementGroup elementGroup
           
protected  JRBaseFiller filler
           
protected  JRElement parent
           
protected  JRGroup printWhenGroupChanges
           
protected  JRTemplateElement template
           
 
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
 
Constructor Summary
protected JRFillElement(JRBaseFiller filler, JRElement element, JRFillObjectFactory factory)
          private JRElement topElementInGroup = null; private JRElement bottomElementInGroup = null; /**
 
Method Summary
protected  void addDependantElement(JRElement element)
           
protected abstract  void evaluate(byte evaluation)
           
protected  void evaluatePrintWhenExpression(byte evaluation)
           
protected abstract  JRPrintElement fill()
           
 java.awt.Color getBackcolor()
           
protected  JRFillBand getBand()
           
protected  int getBandBottomY()
           
protected  java.util.Collection getDependantElements()
          protected void setGroupElements(Collection groupElements) { this.groupElements = groupElements; } /** protected void addGroupElement(JRFElement element) { this.groupElements.add(element); } /**
 JRElementGroup getElementGroup()
          Indicates the logical group that the element belongs to.
 java.awt.Color getForecolor()
           
protected  JRElement[] getGroupElements()
           
 int getHeight()
           
 java.lang.String getKey()
          Returns the string value that uniquely identifies the element.
 byte getMode()
          Returns the element transparency mode.
 byte getPositionType()
          Returns the position type for the element
 JRExpression getPrintWhenExpression()
          Gets the the expression that is evaluated in order to decide if the element should be displayed.
 JRGroup getPrintWhenGroupChanges()
          Returns the group for which an element with a printRepeatedValues attribute set to true will be redisplayed even if the value has not changed.
protected  int getRelativeY()
           
protected  int getStretchHeight()
           
 byte getStretchType()
          Returns the stretch type for the element
 int getWidth()
           
 int getX()
          Gets the the section relative horizontal offset of the element top left corner.
 int getY()
          Gets the the section relative vertical offset of the element top left corner.
protected  boolean isAlreadyPrinted()
           
 boolean isPrintInFirstWholeBand()
          Returns true if an element with a printRepeatedValues attribute set to true will be redisplayed for every new page or column that is not an overflow from a previous page or column.
 boolean isPrintRepeatedValues()
          Specifies if the element value will be printed for every iteration, even if its value has not changed.
 boolean isPrintWhenDetailOverflows()
          If this is set to true, the element will be reprinted on the next page if the band does not fit in the current page.
protected  boolean isPrintWhenExpressionNull()
           
protected  boolean isPrintWhenTrue()
           
 boolean isRemoveLineWhenBlank()
          Returns true if the remaining blank space appearing when the value is not printed will be removed.
protected  boolean isReprinted()
           
protected  boolean isToPrint()
           
protected  void moveDependantElements()
           
protected  boolean prepare(int availableStretchHeight, boolean isOverflow)
           
protected  void reset()
           
protected abstract  void resolveElement(JRPrintElement element, byte evaluation)
          Resolves an element.
protected abstract  void rewind()
           
protected  void setAlreadyPrinted(boolean isAlreadyPrinted)
           
 void setBackcolor(java.awt.Color backcolor)
           
protected  void setBand(JRFillBand band)
           
protected  void setBandBottomY(int bandBottomY)
           
 void setForecolor(java.awt.Color forecolor)
           
 void setMode(byte mode)
          Returns the element transparency mode.
 void setPositionType(byte positionType)
          Sets the position type for the element.
 void setPrintInFirstWholeBand(boolean isPrint)
          Specifies whether an element with a printRepeatedValues attribute set to true should be redisplayed for every new page or column that is not an overflow from a previous page or column.
 void setPrintRepeatedValues(boolean isPrintRepeatedValues)
           
 void setPrintWhenDetailOverflows(boolean isPrint)
          If this is set to true, the element will be reprinted on the next page if the band does not fit in the current page.
protected  void setPrintWhenExpressionNull(boolean isPrintWhenExpressionNull)
           
protected  void setPrintWhenTrue(boolean isPrintWhenTrue)
           
protected  void setRelativeY(int relativeY)
           
 void setRemoveLineWhenBlank(boolean isRemoveLine)
          Specifies whether the remaining blank space appearing when the value is not printed will be removed.
protected  void setReprinted(boolean isReprinted)
           
protected  void setStretchHeight(int stretchHeight)
           
 void setStretchType(byte stretchType)
          Sets the stretch type for the element.
protected  void setToPrint(boolean isToPrint)
           
 void setWidth(int width)
           
 void setX(int x)
          Sets the the section relative horizontal offset of the element top left corner.
protected  void stretchElement(int bandStretch)
           
 
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.JRElement
collectExpressions
 
Methods inherited from interface net.sf.jasperreports.engine.JRChild
getCopy, writeXml
 

Field Detail

parent

protected JRElement parent

template

protected JRTemplateElement template

filler

protected JRBaseFiller filler

printWhenGroupChanges

protected JRGroup printWhenGroupChanges

elementGroup

protected JRFillElementGroup elementGroup

band

protected JRFillBand band
Constructor Detail

JRFillElement

protected JRFillElement(JRBaseFiller filler,
                        JRElement element,
                        JRFillObjectFactory factory)
private JRElement topElementInGroup = null; private JRElement bottomElementInGroup = null; /**

Method Detail

getKey

public java.lang.String getKey()
Description copied from interface: JRElement
Returns the string value that uniquely identifies the element.

Specified by:
getKey in interface JRElement

getPositionType

public byte getPositionType()
Description copied from interface: JRElement
Returns the position type for the element

Specified by:
getPositionType in interface JRElement
Returns:
a byte value representing one of the position type constants in this class

setPositionType

public void setPositionType(byte positionType)
Description copied from interface: JRElement
Sets the position type for the element.

Specified by:
setPositionType in interface JRElement
Parameters:
positionType - a byte value that must be one of the position type constants in this class

getStretchType

public byte getStretchType()
Description copied from interface: JRElement
Returns the stretch type for the element

Specified by:
getStretchType in interface JRElement
Returns:
a byte value representing one of the strech type constants in this class

setStretchType

public void setStretchType(byte stretchType)
Description copied from interface: JRElement
Sets the stretch type for the element.

Specified by:
setStretchType in interface JRElement
Parameters:
stretchType - a byte value that must be one of the stretch type constants in this class

isPrintRepeatedValues

public boolean isPrintRepeatedValues()
Description copied from interface: JRElement
Specifies if the element value will be printed for every iteration, even if its value has not changed.

Specified by:
isPrintRepeatedValues in interface JRElement
See Also:
JRElement.isRemoveLineWhenBlank(), JRElement.isPrintInFirstWholeBand()

setPrintRepeatedValues

public void setPrintRepeatedValues(boolean isPrintRepeatedValues)
Specified by:
setPrintRepeatedValues in interface JRElement

getMode

public byte getMode()
Description copied from interface: JRElement
Returns the element transparency mode. The default value depends on the type of the report element. Graphic elements like rectangles and lines are opaque by default, but the images are transparent. Both static texts and text fields are transparent by default, and so are the subreport elements.

Specified by:
getMode in interface JRElement
Returns:
MODE_OPAQUE or MODE_TRANSPARENT

setMode

public void setMode(byte mode)
Description copied from interface: JRElement
Returns the element transparency mode. The default value depends on the type of the report element. Graphic elements like rectangles and lines are opaque by default, but the images are transparent. Both static texts and text fields are transparent by default, and so are the subreport elements.

Specified by:
setMode in interface JRElement

getX

public int getX()
Description copied from interface: JRElement
Gets the the section relative horizontal offset of the element top left corner.

Specified by:
getX in interface JRElement

setX

public void setX(int x)
Description copied from interface: JRElement
Sets the the section relative horizontal offset of the element top left corner.

Specified by:
setX in interface JRElement

getY

public int getY()
Description copied from interface: JRElement
Gets the the section relative vertical offset of the element top left corner.

Specified by:
getY in interface JRElement

getWidth

public int getWidth()
Specified by:
getWidth in interface JRElement

setWidth

public void setWidth(int width)
Specified by:
setWidth in interface JRElement

getHeight

public int getHeight()
Specified by:
getHeight in interface JRElement

isRemoveLineWhenBlank

public boolean isRemoveLineWhenBlank()
Description copied from interface: JRElement
Returns true if the remaining blank space appearing when the value is not printed will be removed. Under certain circumstances (the element has an empty string as its value or contains a repeated value that is supressed) the space reserved for the current element remains empty. If this method returns true, it means the engine will try to suppress the blank line, but will only succeed if no other elements occupy the same vertical space.

Specified by:
isRemoveLineWhenBlank in interface JRElement

setRemoveLineWhenBlank

public void setRemoveLineWhenBlank(boolean isRemoveLine)
Description copied from interface: JRElement
Specifies whether the remaining blank space appearing when the value is not printed will be removed. Under certain circumstances (the element has an empty string as its value or contains a repeated value that is supressed) the space reserved for the current element remains empty. If the parameter is set to true, it means the engine will try to suppress the blank line, but will only succeed if no other elements occupy the same vertical space.

Specified by:
setRemoveLineWhenBlank in interface JRElement

isPrintInFirstWholeBand

public boolean isPrintInFirstWholeBand()
Description copied from interface: JRElement
Returns true if an element with a printRepeatedValues attribute set to true will be redisplayed for every new page or column that is not an overflow from a previous page or column.

Specified by:
isPrintInFirstWholeBand in interface JRElement
See Also:
JRElement.isPrintRepeatedValues()

setPrintInFirstWholeBand

public void setPrintInFirstWholeBand(boolean isPrint)
Description copied from interface: JRElement
Specifies whether an element with a printRepeatedValues attribute set to true should be redisplayed for every new page or column that is not an overflow from a previous page or column.

Specified by:
setPrintInFirstWholeBand in interface JRElement
See Also:
JRElement.isPrintRepeatedValues()

isPrintWhenDetailOverflows

public boolean isPrintWhenDetailOverflows()
Description copied from interface: JRElement
If this is set to true, the element will be reprinted on the next page if the band does not fit in the current page. Actually if there is at least one element with this attribute, the band is redisplayed from the beginning, except those elements that fitted in the current page and have isPrintWhenDetailOverflow set to false.

Specified by:
isPrintWhenDetailOverflows in interface JRElement

setPrintWhenDetailOverflows

public void setPrintWhenDetailOverflows(boolean isPrint)
Description copied from interface: JRElement
If this is set to true, the element will be reprinted on the next page if the band does not fit in the current page. Actually if there is at least one element with this attribute, the band is redisplayed from the beginning, except those elements that fitted in the current page and have isPrintWhenDetailOverflow set to false.

Specified by:
setPrintWhenDetailOverflows in interface JRElement

getForecolor

public java.awt.Color getForecolor()
Specified by:
getForecolor in interface JRElement

setForecolor

public void setForecolor(java.awt.Color forecolor)
Specified by:
setForecolor in interface JRElement

getBackcolor

public java.awt.Color getBackcolor()
Specified by:
getBackcolor in interface JRElement

setBackcolor

public void setBackcolor(java.awt.Color backcolor)
Specified by:
setBackcolor in interface JRElement

getPrintWhenExpression

public JRExpression getPrintWhenExpression()
Description copied from interface: JRElement
Gets the the expression that is evaluated in order to decide if the element should be displayed. The print expression always returns a boolean value.

Specified by:
getPrintWhenExpression in interface JRElement

getPrintWhenGroupChanges

public JRGroup getPrintWhenGroupChanges()
Description copied from interface: JRElement
Returns the group for which an element with a printRepeatedValues attribute set to true will be redisplayed even if the value has not changed.

Specified by:
getPrintWhenGroupChanges in interface JRElement
See Also:
JRElement.isPrintRepeatedValues()

getElementGroup

public JRElementGroup getElementGroup()
Description copied from interface: JRElement
Indicates the logical group that the element belongs to. More elements can be grouped in order to get the height of the tallest one.

Specified by:
getElementGroup in interface JRElement
See Also:
JRElement.STRETCH_TYPE_RELATIVE_TO_TALLEST_OBJECT

isPrintWhenExpressionNull

protected boolean isPrintWhenExpressionNull()

setPrintWhenExpressionNull

protected void setPrintWhenExpressionNull(boolean isPrintWhenExpressionNull)

isPrintWhenTrue

protected boolean isPrintWhenTrue()

setPrintWhenTrue

protected void setPrintWhenTrue(boolean isPrintWhenTrue)

isToPrint

protected boolean isToPrint()

setToPrint

protected void setToPrint(boolean isToPrint)

isReprinted

protected boolean isReprinted()

setReprinted

protected void setReprinted(boolean isReprinted)

isAlreadyPrinted

protected boolean isAlreadyPrinted()

setAlreadyPrinted

protected void setAlreadyPrinted(boolean isAlreadyPrinted)

getGroupElements

protected JRElement[] getGroupElements()

getDependantElements

protected java.util.Collection getDependantElements()
protected void setGroupElements(Collection groupElements) { this.groupElements = groupElements; } /** protected void addGroupElement(JRFElement element) { this.groupElements.add(element); } /**


addDependantElement

protected void addDependantElement(JRElement element)

getRelativeY

protected int getRelativeY()

setRelativeY

protected void setRelativeY(int relativeY)

getStretchHeight

protected int getStretchHeight()

setStretchHeight

protected void setStretchHeight(int stretchHeight)

getBandBottomY

protected int getBandBottomY()

setBandBottomY

protected void setBandBottomY(int bandBottomY)

getBand

protected JRFillBand getBand()

setBand

protected void setBand(JRFillBand band)

reset

protected void reset()

evaluate

protected abstract void evaluate(byte evaluation)
                          throws JRException
Throws:
JRException

evaluatePrintWhenExpression

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

rewind

protected abstract void rewind()
                        throws JRException
Throws:
JRException

fill

protected abstract JRPrintElement fill()
                                throws JRException
Throws:
JRException

prepare

protected boolean prepare(int availableStretchHeight,
                          boolean isOverflow)

stretchElement

protected void stretchElement(int bandStretch)

moveDependantElements

protected void moveDependantElements()

resolveElement

protected abstract void resolveElement(JRPrintElement element,
                                       byte evaluation)
                                throws JRException
Resolves an element.

Parameters:
element - the element
evaluation - the evaluation type
Throws:
JRException


© 2001-2005 JasperSoft Corporation www.jaspersoft.com