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 of
JRPrintElement that uses
a JRTemplateElement instance to
store common attributes.- Author:
- Teodor Danciu (teodord@users.sourceforge.net)
- See Also:
-
Field Summary
FieldsFields inherited from interface net.sf.jasperreports.engine.JRPrintElement
UNSET_PRINT_ELEMENT_ID, UNSET_SOURCE_ELEMENT_ID -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedJRTemplatePrintElement(JRTemplateElement element, PrintElementOriginator originator) -
Method Summary
Modifier and TypeMethodDescription<T> voidaccept(PrintElementVisitor<T> visitor, T arg) Accepts a print element visitor.intgetKey()Returns a string key that can be used to identify the element.getMode()Returns the element transparency mode.Returns the parent properties holder, whose properties are used as defaults for this object.intReturns a numerical Id that together withJRPrintElement.getSourceElementId()uniquely identifies a print element.Returns this object's properties map.intReturns a numerical Id associated to the fill element that generated this print element.getStyle()Returns this object's style.Returns null as external style references are not allowed for print objects.getUUID()intgetWidth()intgetX()intgetY()booleanChecks whether the object has any properties.voidvoidsetBackcolor(Color color) voidsetForecolor(Color color) voidsetHeight(int height) voidSets the element transparency mode.voidsetSourceElementId(int sourceElementId) Sets the source/fill element Id for the print element.voidvoidsetTemplate(JRTemplateElement template) voidvoidsetWidth(int width) voidsetX(int x) voidsetY(int y) protected voidupdateElementTemplate(JRTemplateElement elementTemplate) Updates the template used by this element.voidMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.sf.jasperreports.engine.JRStyleContainer
getStyleName
-
Field Details
-
EXCEPTION_MESSAGE_KEY_TEMPLATE_NOT_FOUND
- See Also:
-
template
-
-
Constructor Details
-
JRTemplatePrintElement
public JRTemplatePrintElement() -
JRTemplatePrintElement
- Parameters:
element-originator-
-
-
Method Details
-
updateElementTemplate
Updates the template used by this element.- Parameters:
elementTemplate- the new element template
-
getDefaultStyleProvider
- Specified by:
getDefaultStyleProviderin interfaceJRStyleContainer
-
getUUID
- Specified by:
getUUIDin interfaceJRIdentifiable
-
setUUID
- Specified by:
setUUIDin interfaceJRPrintElement
-
getOrigin
- Specified by:
getOriginin interfaceJRPrintElement
-
getStyle
Description copied from interface:JRStyleContainerReturns this object's style.- Specified by:
getStylein interfaceJRStyleContainer- Returns:
- this object's style
-
setStyle
- Specified by:
setStylein interfaceJRPrintElement
-
getMode
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:
getModein interfaceJRCommonElement
-
getOwnMode
- Specified by:
getOwnModein interfaceJRCommonElement
-
setMode
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
- Specified by:
getForecolorin interfaceJRCommonElement
-
getOwnForecolor
- Specified by:
getOwnForecolorin interfaceJRCommonElement
-
setForecolor
- Specified by:
setForecolorin interfaceJRCommonElement
-
getBackcolor
- Specified by:
getBackcolorin interfaceJRCommonElement
-
getOwnBackcolor
- Specified by:
getOwnBackcolorin interfaceJRCommonElement
-
setBackcolor
- Specified by:
setBackcolorin interfaceJRCommonElement
-
getTemplate
-
setTemplate
-
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
Returns null as external style references are not allowed for print objects.- Specified by:
getStyleNameReferencein interfaceJRStyleContainer- Returns:
- the name of an external style
-
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
Description copied from interface:JRPropertiesHolderReturns this object's properties map.- Specified by:
getPropertiesMapin interfaceJRPropertiesHolder- Returns:
- this object's properties map
-
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
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:
-
setSourceElementId
public void setSourceElementId(int sourceElementId) Sets the source/fill element Id for the print element.- Parameters:
sourceElementId-- See Also:
-
writeVirtualized
- Specified by:
writeVirtualizedin interfaceVirtualizationSerializable- Throws:
IOException
-
readVirtualized
- Specified by:
readVirtualizedin interfaceVirtualizationSerializable- Throws:
IOException
-