Package net.sf.jasperreports.engine.fill
Class JRTemplatePrintElement
- java.lang.Object
-
- net.sf.jasperreports.engine.fill.JRTemplatePrintElement
-
- All Implemented Interfaces:
java.io.Serializable,JRCommonElement,JRIdentifiable,JRPrintElement,JRPropertiesHolder,JRStyleContainer,VirtualizationSerializable
- Direct Known Subclasses:
JRTemplateGenericPrintElement,JRTemplatePrintFrame,JRTemplatePrintGraphicElement,JRTemplatePrintText
public class JRTemplatePrintElement extends java.lang.Object implements JRPrintElement, java.io.Serializable, VirtualizationSerializable
Base implementation ofJRPrintElementthat uses aJRTemplateElementinstance to store common attributes.- Author:
- Teodor Danciu (teodord@users.sourceforge.net)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringEXCEPTION_MESSAGE_KEY_TEMPLATE_NOT_FOUNDprotected JRTemplateElementtemplate-
Fields inherited from interface net.sf.jasperreports.engine.JRPrintElement
UNSET_PRINT_ELEMENT_ID, UNSET_SOURCE_ELEMENT_ID
-
-
Constructor Summary
Constructors Modifier Constructor Description JRTemplatePrintElement()protectedJRTemplatePrintElement(JRTemplateElement element, PrintElementOriginator originator)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> voidaccept(PrintElementVisitor<T> visitor, T arg)Accepts a print element visitor.java.awt.ColorgetBackcolor()java.awt.ColorgetDefaultLineColor()JRDefaultStyleProvidergetDefaultStyleProvider()java.awt.ColorgetForecolor()intgetHeight()java.lang.StringgetKey()Returns a string key that can be used to identify the element.ModeEnumgetModeValue()Returns the element transparency mode.JROrigingetOrigin()java.awt.ColorgetOwnBackcolor()java.awt.ColorgetOwnForecolor()ModeEnumgetOwnModeValue()JRPropertiesHoldergetParentProperties()Returns the parent properties holder, whose properties are used as defaults for this object.intgetPrintElementId()Returns a numerical Id that together withJRPrintElement.getSourceElementId()uniquely identifies a print element.JRPropertiesMapgetPropertiesMap()Returns this object's properties map.intgetSourceElementId()Returns a numerical Id associated to the fill element that generated this print element.JRStylegetStyle()Returns this object's style.java.lang.StringgetStyleNameReference()Returns null as external style references are not allowed for print objects.JRTemplateElementgetTemplate()java.util.UUIDgetUUID()intgetWidth()intgetX()intgetY()booleanhasProperties()Checks whether the object has any properties.voidreadVirtualized(VirtualizationInput in)voidsetBackcolor(java.awt.Color color)voidsetForecolor(java.awt.Color color)voidsetHeight(int height)voidsetMode(ModeEnum modeValue)Sets the element transparency mode.voidsetSourceElementId(int sourceElementId)Sets the source/fill element Id for the print element.voidsetStyle(JRStyle style)voidsetTemplate(JRTemplateElement template)voidsetUUID(java.util.UUID uuid)voidsetWidth(int width)voidsetX(int x)voidsetY(int y)protected voidupdateElementTemplate(JRTemplateElement elementTemplate)Updates the template used by this element.voidwriteVirtualized(VirtualizationOutput out)
-
-
-
Field Detail
-
EXCEPTION_MESSAGE_KEY_TEMPLATE_NOT_FOUND
public static final java.lang.String EXCEPTION_MESSAGE_KEY_TEMPLATE_NOT_FOUND
- See Also:
- Constant Field Values
-
template
protected JRTemplateElement template
-
-
Constructor Detail
-
JRTemplatePrintElement
public JRTemplatePrintElement()
-
JRTemplatePrintElement
protected JRTemplatePrintElement(JRTemplateElement element, PrintElementOriginator originator)
- Parameters:
element-originator-
-
-
Method Detail
-
updateElementTemplate
protected void updateElementTemplate(JRTemplateElement elementTemplate)
Updates the template used by this element.- Parameters:
elementTemplate- the new element template
-
getDefaultStyleProvider
public JRDefaultStyleProvider getDefaultStyleProvider()
- Specified by:
getDefaultStyleProviderin interfaceJRStyleContainer
-
getUUID
public java.util.UUID getUUID()
- Specified by:
getUUIDin interfaceJRIdentifiable
-
setUUID
public void setUUID(java.util.UUID uuid)
- Specified by:
setUUIDin interfaceJRPrintElement
-
getOrigin
public JROrigin getOrigin()
- Specified by:
getOriginin interfaceJRPrintElement
-
getStyle
public JRStyle getStyle()
Description copied from interface:JRStyleContainerReturns this object's style.- Specified by:
getStylein interfaceJRStyleContainer- Returns:
- this object's style
-
setStyle
public void setStyle(JRStyle style)
- Specified by:
setStylein interfaceJRPrintElement
-
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()
- Specified by:
getXin interfaceJRPrintElement
-
setX
public void setX(int x)
- Specified by:
setXin interfaceJRPrintElement
-
getY
public int getY()
- Specified by:
getYin interfaceJRPrintElement
-
setY
public void setY(int y)
- Specified by:
setYin interfaceJRPrintElement
-
getWidth
public int getWidth()
- Specified by:
getWidthin interfaceJRCommonElement- Specified by:
getWidthin interfaceJRPrintElement
-
setWidth
public void setWidth(int width)
- Specified by:
setWidthin interfaceJRPrintElement
-
getHeight
public int getHeight()
- Specified by:
getHeightin interfaceJRCommonElement- Specified by:
getHeightin interfaceJRPrintElement
-
setHeight
public void setHeight(int height)
- Specified by:
setHeightin interfaceJRPrintElement
-
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 color)
- 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 color)
- Specified by:
setBackcolorin interfaceJRCommonElement
-
getTemplate
public JRTemplateElement getTemplate()
-
setTemplate
public void setTemplate(JRTemplateElement template)
-
getKey
public java.lang.String getKey()
Description copied from interface:JRPrintElementReturns a string key that can be used to identify the element.When filling a report, the
report element keyis copied to all print elements generated by a report element. Note that this means that multiple elements having the same key can appear on the same page/filled report.- Specified by:
getKeyin interfaceJRCommonElement- Specified by:
getKeyin interfaceJRPrintElement
-
getStyleNameReference
public java.lang.String getStyleNameReference()
Returns null as external style references are not allowed for print objects.- Specified by:
getStyleNameReferencein interfaceJRStyleContainer- Returns:
- the name of an external style
-
getDefaultLineColor
public java.awt.Color getDefaultLineColor()
-
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
-
accept
public <T> void accept(PrintElementVisitor<T> visitor, T arg)
Description copied from interface:JRPrintElementAccepts a print element visitor.The element calls the method that corresponds to the element type on the visitor.
- Specified by:
acceptin interfaceJRPrintElement- Type Parameters:
T- the type of the argument passed to the visit operation- Parameters:
visitor- the visitor objectsarg- the argument passed to the visit operation
-
getSourceElementId
public int getSourceElementId()
Description copied from interface:JRPrintElementReturns a numerical Id associated to the fill element that generated this print element.- Specified by:
getSourceElementIdin interfaceJRPrintElement- Returns:
- the Id of the fill element that generated this element
-
getPrintElementId
public int getPrintElementId()
Description copied from interface:JRPrintElementReturns a numerical Id that together withJRPrintElement.getSourceElementId()uniquely identifies a print element.- Specified by:
getPrintElementIdin interfaceJRPrintElement- Returns:
- a print Id for the element
- See Also:
PrintElementId
-
setSourceElementId
public void setSourceElementId(int sourceElementId)
Sets the source/fill element Id for the print element.- Parameters:
sourceElementId-- See Also:
getSourceElementId()
-
writeVirtualized
public void writeVirtualized(VirtualizationOutput out) throws java.io.IOException
- Specified by:
writeVirtualizedin interfaceVirtualizationSerializable- Throws:
java.io.IOException
-
readVirtualized
public void readVirtualized(VirtualizationInput in) throws java.io.IOException
- Specified by:
readVirtualizedin interfaceVirtualizationSerializable- Throws:
java.io.IOException
-
-