net.sf.jasperreports.engine
Interface JRElement

All Superinterfaces:
JRChild
All Known Subinterfaces:
JRChart, JREllipse, JRGraphicElement, JRImage, JRLine, JRRectangle, JRStaticText, JRSubreport, JRTextElement, JRTextField
All Known Implementing Classes:
JRBaseChart, JRBaseElement, JRBaseEllipse, JRBaseGraphicElement, JRBaseImage, JRBaseLine, JRBaseRectangle, JRBaseStaticText, JRBaseSubreport, JRBaseTextElement, JRBaseTextField, JRDesignChart, JRDesignEllipse, JRDesignGraphicElement, JRDesignImage, JRDesignLine, JRDesignRectangle, JRDesignStaticText, JRDesignSubreport, JRDesignTextElement, JRDesignTextField, JRFillChart, JRFillElement, JRFillEllipse, JRFillGraphicElement, JRFillImage, JRFillLine, JRFillRectangle, JRFillStaticText, JRFillSubreport, JRFillTextElement, JRFillTextField

public interface JRElement
extends JRChild

An abstract representation of a report element. All report elements implement this interface. The interface contains constants and methods that apply to all report elements.

Version:
$Id: JRElement.java,v 1.13 2005/07/14 10:35:24 teodord Exp $
Author:
Teodor Danciu (teodord@users.sourceforge.net)

Field Summary
static byte MODE_OPAQUE
          Specifies that the element is opaque.
static byte MODE_TRANSPARENT
          Specifies that the element is transparent.
static byte POSITION_TYPE_FIX_RELATIVE_TO_BOTTOM
          If the height of the parent report section is affected by elements that stretch, the current element will try to conserve the original distance between its bottom margin and the bottom of the band.
static byte POSITION_TYPE_FIX_RELATIVE_TO_TOP
          The element will simply ignore what happens to the other section elements and tries to conserve the y offset measured from the top of its parent report section.
static byte POSITION_TYPE_FLOAT
          The element will float in its parent section if it is pushed downwards by other elements fount above it.
static byte STRETCH_TYPE_NO_STRETCH
          The element preserves its original specified height.
static byte STRETCH_TYPE_RELATIVE_TO_BAND_HEIGHT
          The graphic element will adapt its height to match the new height of the report section it placed on, which has been affected by stretch.
static byte STRETCH_TYPE_RELATIVE_TO_TALLEST_OBJECT
          Users have the possibility to group the elements of a report section in multiple imbricate groups.
 
Method Summary
 void collectExpressions(JRExpressionCollector collector)
           
 java.awt.Color getBackcolor()
           
 JRElementGroup getElementGroup()
          Indicates the logical group that the element belongs to.
 java.awt.Color getForecolor()
           
 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.
 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.
 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.
 boolean isRemoveLineWhenBlank()
          Returns true if the remaining blank space appearing when the value is not printed will be removed.
 void setBackcolor(java.awt.Color backcolor)
           
 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 isPrintInFirstWholeBand)
          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 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.
 void setRemoveLineWhenBlank(boolean isRemoveLineWhenBlank)
          Specifies whether the remaining blank space appearing when the value is not printed will be removed.
 void setStretchType(byte stretchType)
          Sets the stretch type for the element.
 void setWidth(int width)
           
 void setX(int x)
          Sets the the section relative horizontal offset of the element top left corner.
 
Methods inherited from interface net.sf.jasperreports.engine.JRChild
getCopy, writeXml
 

Field Detail

POSITION_TYPE_FLOAT

public static final byte POSITION_TYPE_FLOAT
The element will float in its parent section if it is pushed downwards by other elements fount above it. It will try to conserve the distance between it and the neighboring elements placed immediately above.

See Also:
Constant Field Values

POSITION_TYPE_FIX_RELATIVE_TO_TOP

public static final byte POSITION_TYPE_FIX_RELATIVE_TO_TOP
The element will simply ignore what happens to the other section elements and tries to conserve the y offset measured from the top of its parent report section.

See Also:
Constant Field Values

POSITION_TYPE_FIX_RELATIVE_TO_BOTTOM

public static final byte POSITION_TYPE_FIX_RELATIVE_TO_BOTTOM
If the height of the parent report section is affected by elements that stretch, the current element will try to conserve the original distance between its bottom margin and the bottom of the band.

See Also:
Constant Field Values

MODE_OPAQUE

public static final byte MODE_OPAQUE
Specifies that the element is opaque.

See Also:
Constant Field Values

MODE_TRANSPARENT

public static final byte MODE_TRANSPARENT
Specifies that the element is transparent.

See Also:
Constant Field Values

STRETCH_TYPE_NO_STRETCH

public static final byte STRETCH_TYPE_NO_STRETCH
The element preserves its original specified height.

See Also:
Constant Field Values

STRETCH_TYPE_RELATIVE_TO_TALLEST_OBJECT

public static final byte STRETCH_TYPE_RELATIVE_TO_TALLEST_OBJECT
Users have the possibility to group the elements of a report section in multiple imbricate groups. The only reason one might have for grouping your report elements is to be able to stretch them to fit the tallest object.

See Also:
Constant Field Values

STRETCH_TYPE_RELATIVE_TO_BAND_HEIGHT

public static final byte STRETCH_TYPE_RELATIVE_TO_BAND_HEIGHT
The graphic element will adapt its height to match the new height of the report section it placed on, which has been affected by stretch.

See Also:
Constant Field Values
Method Detail

getKey

public java.lang.String getKey()
Returns the string value that uniquely identifies the element.


getPositionType

public byte getPositionType()
Returns the position type for the element

Returns:
a byte value representing one of the position type constants in this class

setPositionType

public void setPositionType(byte positionType)
Sets the position type for the element.

Parameters:
positionType - a byte value that must be one of the position type constants in this class

getStretchType

public byte getStretchType()
Returns the stretch type for the element

Returns:
a byte value representing one of the strech type constants in this class

setStretchType

public void setStretchType(byte stretchType)
Sets the stretch type for the element.

Parameters:
stretchType - a byte value that must be one of the stretch type constants in this class

isPrintRepeatedValues

public boolean isPrintRepeatedValues()
Specifies if the element value will be printed for every iteration, even if its value has not changed.

See Also:
isRemoveLineWhenBlank(), isPrintInFirstWholeBand()

setPrintRepeatedValues

public void setPrintRepeatedValues(boolean isPrintRepeatedValues)

getMode

public byte getMode()
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.

Returns:
MODE_OPAQUE or MODE_TRANSPARENT

setMode

public void setMode(byte mode)
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.


getX

public int getX()
Gets the the section relative horizontal offset of the element top left corner.


setX

public void setX(int x)
Sets the the section relative horizontal offset of the element top left corner.


getY

public int getY()
Gets the the section relative vertical offset of the element top left corner.


getWidth

public int getWidth()

setWidth

public void setWidth(int width)

getHeight

public int getHeight()

isRemoveLineWhenBlank

public boolean isRemoveLineWhenBlank()
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.


setRemoveLineWhenBlank

public void setRemoveLineWhenBlank(boolean isRemoveLineWhenBlank)
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.


isPrintInFirstWholeBand

public 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.

See Also:
isPrintRepeatedValues()

setPrintInFirstWholeBand

public void setPrintInFirstWholeBand(boolean isPrintInFirstWholeBand)
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.

See Also:
isPrintRepeatedValues()

isPrintWhenDetailOverflows

public 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. 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.


setPrintWhenDetailOverflows

public void setPrintWhenDetailOverflows(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. 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.


getForecolor

public java.awt.Color getForecolor()

setForecolor

public void setForecolor(java.awt.Color forecolor)

getBackcolor

public java.awt.Color getBackcolor()

setBackcolor

public void setBackcolor(java.awt.Color backcolor)

getPrintWhenExpression

public JRExpression getPrintWhenExpression()
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.


getPrintWhenGroupChanges

public 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.

See Also:
isPrintRepeatedValues()

getElementGroup

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

See Also:
STRETCH_TYPE_RELATIVE_TO_TALLEST_OBJECT

collectExpressions

public void collectExpressions(JRExpressionCollector collector)


© 2001-2005 JasperSoft Corporation www.jaspersoft.com