Package net.sf.jasperreports.engine.fill
Class JRTemplatePrintElement
- java.lang.Object
-
- net.sf.jasperreports.engine.fill.JRTemplatePrintElement
-
- All Implemented Interfaces:
Serializable
,JRCommonElement
,JRIdentifiable
,JRPrintElement
,JRPropertiesHolder
,JRStyleContainer
,VirtualizationSerializable
- Direct Known Subclasses:
JRTemplateGenericPrintElement
,JRTemplatePrintFrame
,JRTemplatePrintGraphicElement
,JRTemplatePrintText
public class JRTemplatePrintElement extends Object implements JRPrintElement, Serializable, VirtualizationSerializable
Base implementation ofJRPrintElement
that uses aJRTemplateElement
instance to store common attributes.- Author:
- Teodor Danciu (teodord@users.sourceforge.net)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static String
EXCEPTION_MESSAGE_KEY_TEMPLATE_NOT_FOUND
protected JRTemplateElement
template
-
Fields inherited from interface net.sf.jasperreports.engine.JRPrintElement
UNSET_PRINT_ELEMENT_ID, UNSET_SOURCE_ELEMENT_ID
-
-
Constructor Summary
Constructors Modifier Constructor Description JRTemplatePrintElement()
protected
JRTemplatePrintElement(JRTemplateElement element, PrintElementOriginator originator)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> void
accept(PrintElementVisitor<T> visitor, T arg)
Accepts a print element visitor.Color
getBackcolor()
Color
getDefaultLineColor()
JRDefaultStyleProvider
getDefaultStyleProvider()
Color
getForecolor()
int
getHeight()
String
getKey()
Returns a string key that can be used to identify the element.ModeEnum
getMode()
Returns the element transparency mode.JROrigin
getOrigin()
Color
getOwnBackcolor()
Color
getOwnForecolor()
ModeEnum
getOwnMode()
JRPropertiesHolder
getParentProperties()
Returns the parent properties holder, whose properties are used as defaults for this object.int
getPrintElementId()
Returns a numerical Id that together withJRPrintElement.getSourceElementId()
uniquely identifies a print element.JRPropertiesMap
getPropertiesMap()
Returns this object's properties map.int
getSourceElementId()
Returns a numerical Id associated to the fill element that generated this print element.JRStyle
getStyle()
Returns this object's style.String
getStyleNameReference()
Returns null as external style references are not allowed for print objects.JRTemplateElement
getTemplate()
UUID
getUUID()
int
getWidth()
int
getX()
int
getY()
boolean
hasProperties()
Checks whether the object has any properties.void
readVirtualized(VirtualizationInput in)
void
setBackcolor(Color color)
void
setForecolor(Color color)
void
setHeight(int height)
void
setMode(ModeEnum mode)
Sets the element transparency mode.void
setSourceElementId(int sourceElementId)
Sets the source/fill element Id for the print element.void
setStyle(JRStyle style)
void
setTemplate(JRTemplateElement template)
void
setUUID(UUID uuid)
void
setWidth(int width)
void
setX(int x)
void
setY(int y)
protected void
updateElementTemplate(JRTemplateElement elementTemplate)
Updates the template used by this element.void
writeVirtualized(VirtualizationOutput out)
-
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.JRStyleContainer
getStyleName
-
-
-
-
Field Detail
-
EXCEPTION_MESSAGE_KEY_TEMPLATE_NOT_FOUND
public static final 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:
getDefaultStyleProvider
in interfaceJRStyleContainer
-
getUUID
public UUID getUUID()
- Specified by:
getUUID
in interfaceJRIdentifiable
-
setUUID
public void setUUID(UUID uuid)
- Specified by:
setUUID
in interfaceJRPrintElement
-
getOrigin
public JROrigin getOrigin()
- Specified by:
getOrigin
in interfaceJRPrintElement
-
getStyle
public JRStyle getStyle()
Description copied from interface:JRStyleContainer
Returns this object's style.- Specified by:
getStyle
in interfaceJRStyleContainer
- Returns:
- this object's style
-
setStyle
public void setStyle(JRStyle style)
- Specified by:
setStyle
in interfaceJRPrintElement
-
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
-
getOwnMode
public ModeEnum getOwnMode()
- Specified by:
getOwnMode
in interfaceJRCommonElement
-
setMode
public void setMode(ModeEnum mode)
Description copied from interface:JRCommonElement
Sets the element transparency mode.- Specified by:
setMode
in interfaceJRCommonElement
-
getX
public int getX()
- Specified by:
getX
in interfaceJRPrintElement
-
setX
public void setX(int x)
- Specified by:
setX
in interfaceJRPrintElement
-
getY
public int getY()
- Specified by:
getY
in interfaceJRPrintElement
-
setY
public void setY(int y)
- Specified by:
setY
in interfaceJRPrintElement
-
getWidth
public int getWidth()
- Specified by:
getWidth
in interfaceJRCommonElement
- Specified by:
getWidth
in interfaceJRPrintElement
-
setWidth
public void setWidth(int width)
- Specified by:
setWidth
in interfaceJRPrintElement
-
getHeight
public int getHeight()
- Specified by:
getHeight
in interfaceJRCommonElement
- Specified by:
getHeight
in interfaceJRPrintElement
-
setHeight
public void setHeight(int height)
- Specified by:
setHeight
in interfaceJRPrintElement
-
getForecolor
public Color getForecolor()
- Specified by:
getForecolor
in interfaceJRCommonElement
-
getOwnForecolor
public Color getOwnForecolor()
- Specified by:
getOwnForecolor
in interfaceJRCommonElement
-
setForecolor
public void setForecolor(Color color)
- Specified by:
setForecolor
in interfaceJRCommonElement
-
getBackcolor
public Color getBackcolor()
- Specified by:
getBackcolor
in interfaceJRCommonElement
-
getOwnBackcolor
public Color getOwnBackcolor()
- Specified by:
getOwnBackcolor
in interfaceJRCommonElement
-
setBackcolor
public void setBackcolor(Color color)
- Specified by:
setBackcolor
in interfaceJRCommonElement
-
getTemplate
public JRTemplateElement getTemplate()
-
setTemplate
public void setTemplate(JRTemplateElement template)
-
getKey
public String getKey()
Description copied from interface:JRPrintElement
Returns a string key that can be used to identify the element.When filling a report, the
report element key
is 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:
getKey
in interfaceJRCommonElement
- Specified by:
getKey
in interfaceJRPrintElement
-
getStyleNameReference
public String getStyleNameReference()
Returns null as external style references are not allowed for print objects.- Specified by:
getStyleNameReference
in interfaceJRStyleContainer
- Returns:
- the name of an external style
-
getDefaultLineColor
public Color getDefaultLineColor()
-
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
-
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
-
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
-
accept
public <T> void accept(PrintElementVisitor<T> visitor, T arg)
Description copied from interface:JRPrintElement
Accepts a print element visitor.The element calls the method that corresponds to the element type on the visitor.
- Specified by:
accept
in 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:JRPrintElement
Returns a numerical Id associated to the fill element that generated this print element.- Specified by:
getSourceElementId
in interfaceJRPrintElement
- Returns:
- the Id of the fill element that generated this element
-
getPrintElementId
public int getPrintElementId()
Description copied from interface:JRPrintElement
Returns a numerical Id that together withJRPrintElement.getSourceElementId()
uniquely identifies a print element.- Specified by:
getPrintElementId
in 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 IOException
- Specified by:
writeVirtualized
in interfaceVirtualizationSerializable
- Throws:
IOException
-
readVirtualized
public void readVirtualized(VirtualizationInput in) throws IOException
- Specified by:
readVirtualized
in interfaceVirtualizationSerializable
- Throws:
IOException
-
-