Package net.sf.jasperreports.engine.base
Class JRBaseElement
- java.lang.Object
-
- net.sf.jasperreports.engine.base.JRBaseElement
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Cloneable,JRChangeEventsSupport,JRChild,JRCloneable,JRCommonElement,JRElement,JRIdentifiable,JRPropertiesHolder,JRStyleContainer,JRVisitable
- Direct Known Subclasses:
JRBaseBreak,JRBaseChart,JRBaseComponentElement,JRBaseCrosstab,JRBaseFrame,JRBaseGenericElement,JRBaseGraphicElement,JRBaseSubreport,JRBaseTextElement,JRDesignElement
public abstract class JRBaseElement extends java.lang.Object implements JRElement, java.io.Serializable, JRChangeEventsSupport
This class provides a skeleton implementation for a report element. It mostly provides internal variables, representing the most common element properties, and their getter/setter methods. It also has a constructor for initializing these properties.- Author:
- Teodor Danciu (teodord@users.sourceforge.net)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected java.awt.Colorbackcolorprotected JRDefaultStyleProviderdefaultStyleProviderprotected JRElementGroupelementGroupprotected java.awt.Colorforecolorprotected intheightprotected booleanisPrintInFirstWholeBandprotected booleanisPrintRepeatedValuesprotected booleanisPrintWhenDetailOverflowsprotected booleanisRemoveLineWhenBlankprotected java.lang.Stringkeyprotected ModeEnummodeValueprotected JRStyleparentStyleprotected java.lang.StringparentStyleNameReferenceprotected PositionTypeEnumpositionTypeValueprotected JRExpressionprintWhenExpressionprotected JRGroupprintWhenGroupChangesstatic java.lang.StringPROPERTY_POSITION_TYPEstatic java.lang.StringPROPERTY_PRINT_IN_FIRST_WHOLE_BANDstatic java.lang.StringPROPERTY_PRINT_REPEATED_VALUESstatic java.lang.StringPROPERTY_PRINT_WHEN_DETAIL_OVERFLOWSstatic java.lang.StringPROPERTY_REMOVE_LINE_WHEN_BLANKstatic java.lang.StringPROPERTY_STRETCH_TYPEstatic java.lang.StringPROPERTY_WIDTHstatic java.lang.StringPROPERTY_Xprotected StretchTypeEnumstretchTypeValueprotected JRExpressionstyleExpressionprotected java.util.UUIDuuidprotected intwidthprotected intxprotected inty-
Fields inherited from interface net.sf.jasperreports.engine.JRElement
PROPERTY_ELEMENT_TEMPLATE_POPULATE_STYLE
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedJRBaseElement(JRDefaultStyleProvider defaultStyleProvider)protectedJRBaseElement(JRElement element, JRBaseObjectFactory factory)Initializes basic properties of the element.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Objectclone()java.lang.Objectclone(JRElementGroup parentGroup)JRElementclone(JRElementGroup parentGroup, int y)java.awt.ColorgetBackcolor()protected JRStylegetBaseStyle()JRDefaultStyleProvidergetDefaultStyleProvider()JRElementGroupgetElementGroup()Indicates the logical group that the element belongs to.JRPropertyChangeSupportgetEventSupport()Returns the property change support object for this instance.java.awt.ColorgetForecolor()intgetHeight()java.lang.StringgetKey()Returns the string value that uniquely identifies the element.ModeEnumgetModeValue()Returns the element transparency mode.java.awt.ColorgetOwnBackcolor()java.awt.ColorgetOwnForecolor()ModeEnumgetOwnModeValue()JRPropertiesHoldergetParentProperties()Returns the parent properties holder, whose properties are used as defaults for this object.PositionTypeEnumgetPositionTypeValue()Returns the position type for the elementJRExpressiongetPrintWhenExpression()Gets the expression that is evaluated in order to decide if the element should be displayed.JRGroupgetPrintWhenGroupChanges()Returns the group for which an element with a printRepeatedValues attribute set to true will be redisplayed even if the value has not changed.JRPropertiesMapgetPropertiesMap()Returns this object's properties map.JRPropertyExpression[]getPropertyExpressions()Returns the list of dynamic/expression-based properties for this report element.StretchTypeEnumgetStretchTypeValue()Indicates the stretch type for the elementJRStylegetStyle()Returns this object's style.JRExpressiongetStyleExpression()Gets the expression that is evaluated in order to obtain the runtime style name to be used for the element.java.lang.StringgetStyleNameReference()Returns the name of an external style which is to be used by this object.protected StyleResolvergetStyleResolver()java.util.UUIDgetUUID()intgetWidth()intgetX()Gets the the section relative horizontal offset of the element top left corner.intgetY()Gets the the section relative vertical offset of the element top left corner.booleanhasProperties()Checks whether the object has any properties.booleanisPrintInFirstWholeBand()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.booleanisPrintRepeatedValues()Specifies if the element value will be printed for every iteration, even if its value has not changed.booleanisPrintWhenDetailOverflows()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.booleanisRemoveLineWhenBlank()Returns true if the remaining blank space appearing when the value is not printed will be removed.voidsetBackcolor(java.awt.Color backcolor)voidsetForecolor(java.awt.Color forecolor)voidsetMode(ModeEnum modeValue)Sets the element transparency mode.voidsetPositionType(PositionTypeEnum positionTypeValue)Sets the position type for the element.voidsetPrintInFirstWholeBand(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.voidsetPrintRepeatedValues(boolean isPrintRepeatedValues)voidsetPrintWhenDetailOverflows(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.voidsetRemoveLineWhenBlank(boolean isRemoveLine)Specifies whether the remaining blank space appearing when the value is not printed will be removed.voidsetStretchType(StretchTypeEnum stretchTypeValue)Specifies how the engine should treat a missing image.voidsetUUID(java.util.UUID uuid)voidsetWidth(int width)voidsetX(int x)Sets the the section relative horizontal offset of the element top left corner.-
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.JRElement
collectExpressions
-
Methods inherited from interface net.sf.jasperreports.engine.JRVisitable
visit
-
-
-
-
Field Detail
-
PROPERTY_POSITION_TYPE
public static final java.lang.String PROPERTY_POSITION_TYPE
- See Also:
- Constant Field Values
-
PROPERTY_PRINT_IN_FIRST_WHOLE_BAND
public static final java.lang.String PROPERTY_PRINT_IN_FIRST_WHOLE_BAND
- See Also:
- Constant Field Values
-
PROPERTY_PRINT_REPEATED_VALUES
public static final java.lang.String PROPERTY_PRINT_REPEATED_VALUES
- See Also:
- Constant Field Values
-
PROPERTY_PRINT_WHEN_DETAIL_OVERFLOWS
public static final java.lang.String PROPERTY_PRINT_WHEN_DETAIL_OVERFLOWS
- See Also:
- Constant Field Values
-
PROPERTY_REMOVE_LINE_WHEN_BLANK
public static final java.lang.String PROPERTY_REMOVE_LINE_WHEN_BLANK
- See Also:
- Constant Field Values
-
PROPERTY_STRETCH_TYPE
public static final java.lang.String PROPERTY_STRETCH_TYPE
- See Also:
- Constant Field Values
-
PROPERTY_WIDTH
public static final java.lang.String PROPERTY_WIDTH
- See Also:
- Constant Field Values
-
PROPERTY_X
public static final java.lang.String PROPERTY_X
- See Also:
- Constant Field Values
-
uuid
protected java.util.UUID uuid
-
key
protected java.lang.String key
-
positionTypeValue
protected PositionTypeEnum positionTypeValue
-
stretchTypeValue
protected StretchTypeEnum stretchTypeValue
-
isPrintRepeatedValues
protected boolean isPrintRepeatedValues
-
modeValue
protected ModeEnum modeValue
-
x
protected int x
-
y
protected int y
-
width
protected int width
-
height
protected int height
-
isRemoveLineWhenBlank
protected boolean isRemoveLineWhenBlank
-
isPrintInFirstWholeBand
protected boolean isPrintInFirstWholeBand
-
isPrintWhenDetailOverflows
protected boolean isPrintWhenDetailOverflows
-
forecolor
protected java.awt.Color forecolor
-
backcolor
protected java.awt.Color backcolor
-
printWhenExpression
protected JRExpression printWhenExpression
-
printWhenGroupChanges
protected JRGroup printWhenGroupChanges
-
elementGroup
protected JRElementGroup elementGroup
-
defaultStyleProvider
protected final JRDefaultStyleProvider defaultStyleProvider
-
parentStyle
protected JRStyle parentStyle
-
parentStyleNameReference
protected java.lang.String parentStyleNameReference
-
styleExpression
protected JRExpression styleExpression
-
-
Constructor Detail
-
JRBaseElement
protected JRBaseElement(JRDefaultStyleProvider defaultStyleProvider)
-
JRBaseElement
protected JRBaseElement(JRElement element, JRBaseObjectFactory factory)
Initializes basic properties of the element.- Parameters:
element- an element whose properties are copied to this element. Usually it is aJRDesignElementthat must be transformed into an JRBaseElement at compile time.factory- a factory used in the compile process
-
-
Method Detail
-
getDefaultStyleProvider
public JRDefaultStyleProvider getDefaultStyleProvider()
- Specified by:
getDefaultStyleProviderin interfaceJRStyleContainer
-
getStyleResolver
protected StyleResolver getStyleResolver()
-
getBaseStyle
protected JRStyle getBaseStyle()
-
getUUID
public java.util.UUID getUUID()
- Specified by:
getUUIDin interfaceJRIdentifiable
-
setUUID
public void setUUID(java.util.UUID uuid)
-
getKey
public java.lang.String getKey()
Description copied from interface:JRElementReturns the string value that uniquely identifies the element.- Specified by:
getKeyin interfaceJRCommonElement- Specified by:
getKeyin interfaceJRElement
-
getPositionTypeValue
public PositionTypeEnum getPositionTypeValue()
Description copied from interface:JRElementReturns the position type for the element- Specified by:
getPositionTypeValuein interfaceJRElement- Returns:
- the position type
-
setPositionType
public void setPositionType(PositionTypeEnum positionTypeValue)
Description copied from interface:JRElementSets the position type for the element.- Specified by:
setPositionTypein interfaceJRElement- Parameters:
positionTypeValue- the position type
-
getStretchTypeValue
public StretchTypeEnum getStretchTypeValue()
Description copied from interface:JRElementIndicates the stretch type for the element- Specified by:
getStretchTypeValuein interfaceJRElement- Returns:
- a value representing one of the stretch type constants in
StretchTypeEnum
-
setStretchType
public void setStretchType(StretchTypeEnum stretchTypeValue)
Description copied from interface:JRElementSpecifies how the engine should treat a missing image.- Specified by:
setStretchTypein interfaceJRElement- Parameters:
stretchTypeValue- a value representing one of the stretch type constants inStretchTypeEnum
-
isPrintRepeatedValues
public boolean isPrintRepeatedValues()
Description copied from interface:JRElementSpecifies if the element value will be printed for every iteration, even if its value has not changed.- Specified by:
isPrintRepeatedValuesin interfaceJRElement- See Also:
JRElement.isRemoveLineWhenBlank(),JRElement.isPrintInFirstWholeBand()
-
setPrintRepeatedValues
public void setPrintRepeatedValues(boolean isPrintRepeatedValues)
- Specified by:
setPrintRepeatedValuesin interfaceJRElement
-
getModeValue
public ModeEnum getModeValue()
Description copied from interface:JRCommonElementReturns 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:
getModeValuein interfaceJRCommonElement
-
getOwnModeValue
public ModeEnum getOwnModeValue()
- Specified by:
getOwnModeValuein interfaceJRCommonElement
-
setMode
public void setMode(ModeEnum modeValue)
Description copied from interface:JRCommonElementSets the element transparency mode.- Specified by:
setModein interfaceJRCommonElement
-
getX
public int getX()
Description copied from interface:JRElementGets the the section relative horizontal offset of the element top left corner.
-
setX
public void setX(int x)
Description copied from interface:JRElementSets the the section relative horizontal offset of the element top left corner.
-
getY
public int getY()
Description copied from interface:JRElementGets the the section relative vertical offset of the element top left corner.
-
getWidth
public int getWidth()
- Specified by:
getWidthin interfaceJRCommonElement
-
getHeight
public int getHeight()
- Specified by:
getHeightin interfaceJRCommonElement
-
isRemoveLineWhenBlank
public boolean isRemoveLineWhenBlank()
Description copied from interface:JRElementReturns 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:
isRemoveLineWhenBlankin interfaceJRElement
-
setRemoveLineWhenBlank
public void setRemoveLineWhenBlank(boolean isRemoveLine)
Description copied from interface:JRElementSpecifies 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:
setRemoveLineWhenBlankin interfaceJRElement
-
isPrintInFirstWholeBand
public boolean isPrintInFirstWholeBand()
Description copied from interface:JRElementReturns 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:
isPrintInFirstWholeBandin interfaceJRElement- See Also:
JRElement.isPrintRepeatedValues()
-
setPrintInFirstWholeBand
public void setPrintInFirstWholeBand(boolean isPrint)
Description copied from interface:JRElementSpecifies 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:
setPrintInFirstWholeBandin interfaceJRElement- See Also:
JRElement.isPrintRepeatedValues()
-
isPrintWhenDetailOverflows
public boolean isPrintWhenDetailOverflows()
Description copied from interface:JRElementIf 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:
isPrintWhenDetailOverflowsin interfaceJRElement
-
setPrintWhenDetailOverflows
public void setPrintWhenDetailOverflows(boolean isPrint)
Description copied from interface:JRElementIf 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:
setPrintWhenDetailOverflowsin interfaceJRElement
-
getForecolor
public java.awt.Color getForecolor()
- Specified by:
getForecolorin interfaceJRCommonElement
-
getOwnForecolor
public java.awt.Color getOwnForecolor()
- Specified by:
getOwnForecolorin interfaceJRCommonElement
-
setForecolor
public void setForecolor(java.awt.Color forecolor)
- Specified by:
setForecolorin interfaceJRCommonElement
-
getBackcolor
public java.awt.Color getBackcolor()
- Specified by:
getBackcolorin interfaceJRCommonElement
-
getOwnBackcolor
public java.awt.Color getOwnBackcolor()
- Specified by:
getOwnBackcolorin interfaceJRCommonElement
-
setBackcolor
public void setBackcolor(java.awt.Color backcolor)
- Specified by:
setBackcolorin interfaceJRCommonElement
-
getPrintWhenExpression
public JRExpression getPrintWhenExpression()
Description copied from interface:JRElementGets the expression that is evaluated in order to decide if the element should be displayed. This expression always returns a boolean value.- Specified by:
getPrintWhenExpressionin interfaceJRElement
-
getPrintWhenGroupChanges
public JRGroup getPrintWhenGroupChanges()
Description copied from interface:JRElementReturns 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:
getPrintWhenGroupChangesin interfaceJRElement- See Also:
JRElement.isPrintRepeatedValues()
-
getElementGroup
public JRElementGroup getElementGroup()
Description copied from interface:JRElementIndicates 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:
getElementGroupin interfaceJRElement- See Also:
StretchTypeEnum
-
getStyle
public JRStyle getStyle()
Description copied from interface:JRStyleContainerReturns this object's style.- Specified by:
getStylein interfaceJRStyleContainer- Returns:
- this object's style
-
getStyleNameReference
public java.lang.String getStyleNameReference()
Description copied from interface:JRStyleContainerReturns the name of an external style which is to be used by this object. External styles are defined intemplatesand are resolved at fill time. This attribute is only effective if no direct style (as returned bygetStyle()is specified for this object.- Specified by:
getStyleNameReferencein interfaceJRStyleContainer- Returns:
- the name of an external style
-
getStyleExpression
public JRExpression getStyleExpression()
Description copied from interface:JRElementGets 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:
getStyleExpressionin interfaceJRElement
-
getEventSupport
public JRPropertyChangeSupport getEventSupport()
Description copied from interface:JRChangeEventsSupportReturns the property change support object for this instance.- Specified by:
getEventSupportin interfaceJRChangeEventsSupport- Returns:
- the property change support object for this instance
-
clone
public java.lang.Object clone()
- Specified by:
clonein interfaceJRCloneable- Overrides:
clonein classjava.lang.Object
-
clone
public java.lang.Object clone(JRElementGroup parentGroup)
-
clone
public JRElement clone(JRElementGroup parentGroup, int y)
-
hasProperties
public boolean hasProperties()
Description copied from interface:JRPropertiesHolderChecks whether the object has any properties.- Specified by:
hasPropertiesin interfaceJRPropertiesHolder- Returns:
- whether the object has any properties
-
getPropertiesMap
public JRPropertiesMap getPropertiesMap()
Description copied from interface:JRPropertiesHolderReturns this object's properties map.- Specified by:
getPropertiesMapin interfaceJRPropertiesHolder- Returns:
- this object's properties map
-
getParentProperties
public JRPropertiesHolder getParentProperties()
Description copied from interface:JRPropertiesHolderReturns the parent properties holder, whose properties are used as defaults for this object.- Specified by:
getParentPropertiesin interfaceJRPropertiesHolder- Returns:
- the parent properties holder, or
nullif no parent
-
getPropertyExpressions
public JRPropertyExpression[] getPropertyExpressions()
Description copied from interface:JRElementReturns the list of dynamic/expression-based properties for this report element.- Specified by:
getPropertyExpressionsin interfaceJRElement- Returns:
- an array containing the expression-based properties of this report element
-
-