Package net.sf.jasperreports.engine
Class ElementDecorator
- java.lang.Object
-
- net.sf.jasperreports.engine.ElementDecorator
-
- All Implemented Interfaces:
Cloneable
,JRChild
,JRCloneable
,JRCommonElement
,JRElement
,JRIdentifiable
,JRPropertiesHolder
,JRStyleContainer
,JRVisitable
- Direct Known Subclasses:
SubreportElementAdapter
public abstract class ElementDecorator extends Object implements JRElement
- Author:
- Lucian Chirita (lucianc@users.sourceforge.net)
-
-
Field Summary
-
Fields inherited from interface net.sf.jasperreports.engine.JRElement
PROPERTY_ELEMENT_TEMPLATE_POPULATE_STYLE
-
-
Constructor Summary
Constructors Constructor Description ElementDecorator(JRElement decorated)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Object
clone()
Object
clone(JRElementGroup parentGroup)
JRElement
clone(JRElementGroup parentGroup, int y)
void
collectExpressions(JRExpressionCollector collector)
Color
getBackcolor()
JRDefaultStyleProvider
getDefaultStyleProvider()
JRElementGroup
getElementGroup()
Indicates the logical group that the element belongs to.Color
getForecolor()
int
getHeight()
String
getKey()
Returns the string value that uniquely identifies the element.ModeEnum
getMode()
Returns the element transparency mode.Color
getOwnBackcolor()
Color
getOwnForecolor()
ModeEnum
getOwnMode()
JRPropertiesHolder
getParentProperties()
Returns the parent properties holder, whose properties are used as defaults for this object.PositionTypeEnum
getPositionType()
Returns the position type for the elementJRExpression
getPrintWhenExpression()
Gets the expression that is evaluated in order to decide if the element should be displayed.String
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.JRPropertiesMap
getPropertiesMap()
Returns this object's properties map.JRPropertyExpression[]
getPropertyExpressions()
Returns the list of dynamic/expression-based properties for this report element.StretchTypeEnum
getStretchType()
Indicates the stretch type for the elementJRStyle
getStyle()
Returns this object's style.JRExpression
getStyleExpression()
Gets the expression that is evaluated in order to obtain the runtime style name to be used for the element.String
getStyleNameReference()
Returns the name of an external style which is to be used by this object.UUID
getUUID()
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
hasProperties()
Checks whether the object has any properties.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(Color backcolor)
void
setForecolor(Color forecolor)
void
setMode(ModeEnum mode)
Sets the element transparency mode.void
setPositionType(PositionTypeEnum 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(StretchTypeEnum stretchTypeEnum)
Specifies how the engine should treat a missing image.void
setWidth(int width)
void
setX(int x)
Sets the the section relative horizontal offset of the element top left corner.void
visit(JRVisitor visitor)
-
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface net.sf.jasperreports.engine.JRStyleContainer
getStyleName
-
-
-
-
Constructor Detail
-
ElementDecorator
public ElementDecorator(JRElement decorated)
-
-
Method Detail
-
clone
public Object clone()
- Specified by:
clone
in interfaceJRCloneable
- Overrides:
clone
in classObject
-
collectExpressions
public void collectExpressions(JRExpressionCollector collector)
- Specified by:
collectExpressions
in interfaceJRElement
-
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 make some of them stretch relative to the height of their parent group.- Specified by:
getElementGroup
in interfaceJRElement
- See Also:
StretchTypeEnum
-
getUUID
public UUID getUUID()
- Specified by:
getUUID
in interfaceJRIdentifiable
-
getKey
public String getKey()
Description copied from interface:JRCommonElement
Returns the string value that uniquely identifies the element.- Specified by:
getKey
in interfaceJRCommonElement
-
getPositionType
public PositionTypeEnum getPositionType()
Description copied from interface:JRElement
Returns the position type for the element- Specified by:
getPositionType
in interfaceJRElement
- Returns:
- the position type
-
getPrintWhenExpression
public JRExpression getPrintWhenExpression()
Description copied from interface:JRElement
Gets the expression that is evaluated in order to decide if the element should be displayed. This expression always returns a boolean value.- Specified by:
getPrintWhenExpression
in interfaceJRElement
-
getPrintWhenGroupChanges
public String 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 interfaceJRElement
- See Also:
JRElement.isPrintRepeatedValues()
-
getPropertyExpressions
public JRPropertyExpression[] getPropertyExpressions()
Description copied from interface:JRElement
Returns the list of dynamic/expression-based properties for this report element.- Specified by:
getPropertyExpressions
in interfaceJRElement
- Returns:
- an array containing the expression-based properties of this report element
-
getStretchType
public StretchTypeEnum getStretchType()
Description copied from interface:JRElement
Indicates the stretch type for the element- Specified by:
getStretchType
in interfaceJRElement
- Returns:
- a value representing one of the stretch type constants in
StretchTypeEnum
-
getX
public int getX()
Description copied from interface:JRElement
Gets the the section relative horizontal offset of the element top left corner.
-
getY
public int getY()
Description copied from interface:JRElement
Gets the the section relative vertical offset of the element top left corner.
-
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 interfaceJRElement
- See Also:
JRElement.isPrintRepeatedValues()
-
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 interfaceJRElement
- See Also:
JRElement.isRemoveLineWhenBlank()
,JRElement.isPrintInFirstWholeBand()
-
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 interfaceJRElement
-
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 interfaceJRElement
-
setPositionType
public void setPositionType(PositionTypeEnum positionType)
Description copied from interface:JRElement
Sets the position type for the element.- Specified by:
setPositionType
in interfaceJRElement
- Parameters:
positionType
- the position type
-
setPrintInFirstWholeBand
public void setPrintInFirstWholeBand(boolean isPrintInFirstWholeBand)
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 interfaceJRElement
- See Also:
JRElement.isPrintRepeatedValues()
-
setPrintRepeatedValues
public void setPrintRepeatedValues(boolean isPrintRepeatedValues)
- Specified by:
setPrintRepeatedValues
in interfaceJRElement
-
setPrintWhenDetailOverflows
public void setPrintWhenDetailOverflows(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:
setPrintWhenDetailOverflows
in interfaceJRElement
-
setRemoveLineWhenBlank
public void setRemoveLineWhenBlank(boolean isRemoveLineWhenBlank)
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 interfaceJRElement
-
setStretchType
public void setStretchType(StretchTypeEnum stretchTypeEnum)
Description copied from interface:JRElement
Specifies how the engine should treat a missing image.- Specified by:
setStretchType
in interfaceJRElement
- Parameters:
stretchTypeEnum
- a value representing one of the stretch type constants inStretchTypeEnum
-
setX
public void setX(int x)
Description copied from interface:JRElement
Sets the the section relative horizontal offset of the element top left corner.
-
clone
public Object clone(JRElementGroup parentGroup)
-
clone
public JRElement clone(JRElementGroup parentGroup, int y)
-
visit
public void visit(JRVisitor visitor)
- Specified by:
visit
in interfaceJRVisitable
-
getBackcolor
public Color getBackcolor()
- Specified by:
getBackcolor
in interfaceJRCommonElement
-
getForecolor
public Color getForecolor()
- Specified by:
getForecolor
in interfaceJRCommonElement
-
getHeight
public int getHeight()
- Specified by:
getHeight
in interfaceJRCommonElement
-
getMode
public ModeEnum getMode()
Description copied from interface:JRCommonElement
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 interfaceJRCommonElement
-
getOwnBackcolor
public Color getOwnBackcolor()
- Specified by:
getOwnBackcolor
in interfaceJRCommonElement
-
getOwnForecolor
public Color getOwnForecolor()
- Specified by:
getOwnForecolor
in interfaceJRCommonElement
-
getOwnMode
public ModeEnum getOwnMode()
- Specified by:
getOwnMode
in interfaceJRCommonElement
-
getWidth
public int getWidth()
- Specified by:
getWidth
in interfaceJRCommonElement
-
setBackcolor
public void setBackcolor(Color backcolor)
- Specified by:
setBackcolor
in interfaceJRCommonElement
-
setForecolor
public void setForecolor(Color forecolor)
- Specified by:
setForecolor
in interfaceJRCommonElement
-
setMode
public void setMode(ModeEnum mode)
Description copied from interface:JRCommonElement
Sets the element transparency mode.- Specified by:
setMode
in interfaceJRCommonElement
-
getDefaultStyleProvider
public JRDefaultStyleProvider getDefaultStyleProvider()
- Specified by:
getDefaultStyleProvider
in interfaceJRStyleContainer
-
getStyle
public JRStyle getStyle()
Description copied from interface:JRStyleContainer
Returns this object's style.- Specified by:
getStyle
in interfaceJRStyleContainer
- Returns:
- this object's style
-
getStyleNameReference
public String getStyleNameReference()
Description copied from interface:JRStyleContainer
Returns the name of an external style which is to be used by this object. External styles are defined intemplates
and are resolved at fill time. This attribute is only effective if no direct style (as returned bygetStyle()
is specified for this object.- Specified by:
getStyleNameReference
in interfaceJRStyleContainer
- Returns:
- the name of an external style
-
getStyleExpression
public JRExpression getStyleExpression()
Description copied from interface:JRElement
Gets the expression that is evaluated in order to obtain the runtime style name to be used for the element. When used, this expression takes precedence over theJRStyleContainer.getStyle()
orJRStyleContainer.getStyleNameReference()
.- Specified by:
getStyleExpression
in interfaceJRElement
-
getParentProperties
public JRPropertiesHolder getParentProperties()
Description copied from interface:JRPropertiesHolder
Returns the parent properties holder, whose properties are used as defaults for this object.- Specified by:
getParentProperties
in interfaceJRPropertiesHolder
- Returns:
- the parent properties holder, or
null
if no parent
-
getPropertiesMap
public JRPropertiesMap getPropertiesMap()
Description copied from interface:JRPropertiesHolder
Returns this object's properties map.- Specified by:
getPropertiesMap
in interfaceJRPropertiesHolder
- Returns:
- this object's properties map
-
hasProperties
public boolean hasProperties()
Description copied from interface:JRPropertiesHolder
Checks whether the object has any properties.- Specified by:
hasProperties
in interfaceJRPropertiesHolder
- Returns:
- whether the object has any properties
-
-