Class JRTemplateText
- java.lang.Object
-
- net.sf.jasperreports.engine.fill.JRTemplateElement
-
- net.sf.jasperreports.engine.fill.JRTemplateText
-
- All Implemented Interfaces:
Serializable
,Deduplicable
,TextFormat
,JRBoxContainer
,JRCommonElement
,JRCommonText
,JRFont
,JRParagraphContainer
,JRPropertiesHolder
,JRStyleContainer
,JRTextAlignment
public class JRTemplateText extends JRTemplateElement implements JRTextAlignment, JRFont, JRCommonText, TextFormat
Text element information shared by multiple print text objects.- Author:
- Teodor Danciu (teodord@users.sourceforge.net)
- See Also:
JRTemplatePrintText
, Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected String
fontName
protected Float
fontSize
protected String
formatFactoryClass
protected Boolean
isBold
protected Boolean
isItalic
protected Boolean
isPdfEmbedded
protected Boolean
isStrikeThrough
protected Boolean
isUnderline
protected JRLineBox
lineBox
protected String
localeCode
protected JRParagraph
paragraph
protected String
pattern
protected String
pdfEncoding
protected String
pdfFontName
protected String
timeZoneId
protected String
valueClassName
-
Fields inherited from class net.sf.jasperreports.engine.fill.JRTemplateElement
defaultStyleProvider, origin, parentStyle
-
Fields inherited from interface net.sf.jasperreports.engine.JRCommonText
MARKUP_HTML, MARKUP_NONE, MARKUP_RTF, MARKUP_STYLED_TEXT
-
Fields inherited from interface net.sf.jasperreports.engine.JRFont
DEFAULT_FONT_NAME, DEFAULT_FONT_SIZE, DEFAULT_PDF_EMBEDDED, DEFAULT_PDF_ENCODING, DEFAULT_PDF_FONT_NAME
-
-
Constructor Summary
Constructors Modifier Constructor Description JRTemplateText(JROrigin origin, JRDefaultStyleProvider defaultStyleProvider)
Creates a template text.protected
JRTemplateText(JROrigin origin, JRDefaultStyleProvider defaultStyleProvider, JRStaticText staticText)
protected
JRTemplateText(JROrigin origin, JRDefaultStyleProvider defaultStyleProvider, JRTextField textField)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
copyLineBox(JRLineBox box)
Copies box attributes.void
copyParagraph(JRParagraph prg)
Copies paragraph attributes.Color
getDefaultLineColor()
String
getFontName()
float
getFontSize()
String
getFormatFactoryClass()
int
getHashCode()
Returns a hash code to be used for the deduplicate map.HorizontalTextAlignEnum
getHorizontalTextAlign()
Gets the text horizontal alignment.HyperlinkTargetEnum
getHyperlinkTarget()
Retrieves the hyperlink target name for the element.HyperlinkTypeEnum
getHyperlinkType()
Retrieves the hyperlink type for the element.JRLineBox
getLineBox()
String
getLinkTarget()
Returns the hyperlink target name.String
getLinkType()
Returns the hyperlink type.String
getLocaleCode()
String
getMarkup()
Returns the text markup.ModeEnum
getMode()
Returns the element transparency mode.String
getOwnFontName()
Float
getOwnFontSize()
HorizontalTextAlignEnum
getOwnHorizontalTextAlign()
String
getOwnMarkup()
String
getOwnPdfEncoding()
String
getOwnPdfFontName()
RotationEnum
getOwnRotation()
Gets the text own rotation.VerticalTextAlignEnum
getOwnVerticalTextAlign()
JRParagraph
getParagraph()
String
getPattern()
String
getPdfEncoding()
String
getPdfFontName()
RotationEnum
getRotation()
Gets the text rotation.JRStyle
getStyle()
Returns this object's style.String
getTimeZoneId()
String
getValueClassName()
VerticalTextAlignEnum
getVerticalTextAlign()
Gets the text vertical alignment.boolean
isBold()
boolean
isIdentical(Object object)
Determines if this instance is identical to another object.boolean
isItalic()
Boolean
isOwnBold()
Boolean
isOwnItalic()
Boolean
isOwnPdfEmbedded()
Boolean
isOwnStrikeThrough()
Boolean
isOwnUnderline()
boolean
isPdfEmbedded()
boolean
isStrikeThrough()
boolean
isUnderline()
void
populateStyle()
void
setBold(Boolean isBold)
Alternative setBold method which allows also to reset the "own" isBold property.void
setFontName(String fontName)
void
setFontSize(Float fontSize)
Method which allows also to reset the "own" size property.void
setFormatFactoryClass(String formatFactoryClass)
void
setHorizontalTextAlign(HorizontalTextAlignEnum horizontalTextAlign)
Sets the text horizontal alignment.void
setItalic(Boolean isItalic)
Alternative setItalic method which allows also to reset the "own" isItalic property.protected void
setLinkTarget(String linkTarget)
void
setLinkType(String linkType)
Sets the hyperlink type.void
setLocaleCode(String localeCode)
void
setMarkup(String markup)
Sets the text markup attribute.void
setPattern(String pattern)
void
setPdfEmbedded(Boolean isPdfEmbedded)
Alternative setPdfEmbedded method which allows also to reset the "own" isPdfEmbedded property.void
setPdfEncoding(String pdfEncoding)
void
setPdfFontName(String pdfFontName)
void
setRotation(RotationEnum rotation)
Sets the text rotation.protected void
setStaticText(JRStaticText staticText)
void
setStrikeThrough(Boolean isStrikeThrough)
Alternative setStrikeThrough method which allows also to reset the "own" isStrikeThrough property.protected void
setTextElement(JRTextElement textElement)
protected void
setTextField(JRTextField textField)
void
setTextFormat(TextFormat textFormat)
void
setTimeZoneId(String timeZoneId)
void
setUnderline(Boolean isUnderline)
Alternative setUnderline method which allows also to reset the "own" isUnderline property.void
setValueClassName(String valueClassName)
void
setVerticalTextAlign(VerticalTextAlignEnum verticalTextAlign)
Gets the text vertical alignment.-
Methods inherited from class net.sf.jasperreports.engine.fill.JRTemplateElement
addTemplateHash, getBackcolor, getBaseStyle, getDefaultStyleProvider, getForecolor, getHeight, getId, getKey, getOrigin, getOwnBackcolor, getOwnForecolor, getOwnMode, getParentProperties, getPropertiesMap, getStyleNameReference, getStyleResolver, getWidth, hasProperties, setBackcolor, setElement, setForecolor, setKey, setMode, setStyle, templateIdentical
-
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.JRCommonElement
getBackcolor, getForecolor, getHeight, getKey, getOwnBackcolor, getOwnForecolor, getOwnMode, getWidth, setBackcolor, setForecolor, setMode
-
Methods inherited from interface net.sf.jasperreports.engine.JRStyleContainer
getDefaultStyleProvider, getStyleName, getStyleNameReference
-
-
-
-
Field Detail
-
lineBox
protected JRLineBox lineBox
-
paragraph
protected JRParagraph paragraph
-
fontName
protected String fontName
-
isBold
protected Boolean isBold
-
isItalic
protected Boolean isItalic
-
isUnderline
protected Boolean isUnderline
-
isStrikeThrough
protected Boolean isStrikeThrough
-
fontSize
protected Float fontSize
-
pdfFontName
protected String pdfFontName
-
pdfEncoding
protected String pdfEncoding
-
isPdfEmbedded
protected Boolean isPdfEmbedded
-
valueClassName
protected String valueClassName
-
pattern
protected String pattern
-
formatFactoryClass
protected String formatFactoryClass
-
localeCode
protected String localeCode
-
timeZoneId
protected String timeZoneId
-
-
Constructor Detail
-
JRTemplateText
protected JRTemplateText(JROrigin origin, JRDefaultStyleProvider defaultStyleProvider, JRStaticText staticText)
-
JRTemplateText
protected JRTemplateText(JROrigin origin, JRDefaultStyleProvider defaultStyleProvider, JRTextField textField)
-
JRTemplateText
public JRTemplateText(JROrigin origin, JRDefaultStyleProvider defaultStyleProvider)
Creates a template text.- Parameters:
origin
- the origin of the elements that will use this templatedefaultStyleProvider
- the default style provider to use for this template
-
-
Method Detail
-
setStaticText
protected void setStaticText(JRStaticText staticText)
-
setTextField
protected void setTextField(JRTextField textField)
-
setTextElement
protected void setTextElement(JRTextElement textElement)
-
setTextFormat
public void setTextFormat(TextFormat textFormat)
-
copyLineBox
public void copyLineBox(JRLineBox box)
Copies box attributes.- Parameters:
box
- the object to copy attributes from
-
copyParagraph
public void copyParagraph(JRParagraph prg)
Copies paragraph attributes.- Parameters:
prg
- the object to copy attributes from
-
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
- Overrides:
getMode
in classJRTemplateElement
-
getHorizontalTextAlign
public HorizontalTextAlignEnum getHorizontalTextAlign()
Description copied from interface:JRTextAlignment
Gets the text horizontal alignment.- Specified by:
getHorizontalTextAlign
in interfaceJRTextAlignment
- Returns:
- a value representing one of the horizontal text alignment constants in
HorizontalTextAlignEnum
-
getOwnHorizontalTextAlign
public HorizontalTextAlignEnum getOwnHorizontalTextAlign()
- Specified by:
getOwnHorizontalTextAlign
in interfaceJRTextAlignment
-
setHorizontalTextAlign
public void setHorizontalTextAlign(HorizontalTextAlignEnum horizontalTextAlign)
Description copied from interface:JRTextAlignment
Sets the text horizontal alignment.- Specified by:
setHorizontalTextAlign
in interfaceJRTextAlignment
- Parameters:
horizontalTextAlign
- a value representing one of the horizontal text alignment constants inHorizontalTextAlignEnum
-
getVerticalTextAlign
public VerticalTextAlignEnum getVerticalTextAlign()
Description copied from interface:JRTextAlignment
Gets the text vertical alignment.- Specified by:
getVerticalTextAlign
in interfaceJRTextAlignment
- Returns:
- a value representing one of the vertical text alignment constants in
VerticalTextAlignEnum
-
getOwnVerticalTextAlign
public VerticalTextAlignEnum getOwnVerticalTextAlign()
- Specified by:
getOwnVerticalTextAlign
in interfaceJRTextAlignment
-
setVerticalTextAlign
public void setVerticalTextAlign(VerticalTextAlignEnum verticalTextAlign)
Description copied from interface:JRTextAlignment
Gets the text vertical alignment.- Specified by:
setVerticalTextAlign
in interfaceJRTextAlignment
- Parameters:
verticalTextAlign
- a value representing one of the vertical text alignment constants inVerticalTextAlignEnum
-
getRotation
public RotationEnum getRotation()
Description copied from interface:JRCommonText
Gets the text rotation.- Specified by:
getRotation
in interfaceJRCommonText
- Returns:
- a value representing one of the text rotation constants in
RotationEnum
-
getOwnRotation
public RotationEnum getOwnRotation()
Description copied from interface:JRCommonText
Gets the text own rotation.- Specified by:
getOwnRotation
in interfaceJRCommonText
- Returns:
- a value representing one of the text rotation constants in
RotationEnum
-
setRotation
public void setRotation(RotationEnum rotation)
Sets the text rotation.- Specified by:
setRotation
in interfaceJRCommonText
- Parameters:
rotation
- one of values, ornull
if this template should not specify a rotation attribute of its own
-
getMarkup
public String getMarkup()
Description copied from interface:JRCommonText
Returns the text markup.- Specified by:
getMarkup
in interfaceJRCommonText
-
getOwnMarkup
public String getOwnMarkup()
- Specified by:
getOwnMarkup
in interfaceJRCommonText
-
setMarkup
public void setMarkup(String markup)
Sets the text markup attribute.- Specified by:
setMarkup
in interfaceJRCommonText
- Parameters:
markup
- the markup attribute- See Also:
getMarkup()
-
getLineBox
public JRLineBox getLineBox()
- Specified by:
getLineBox
in interfaceJRBoxContainer
-
getParagraph
public JRParagraph getParagraph()
- Specified by:
getParagraph
in interfaceJRParagraphContainer
-
getHyperlinkType
public HyperlinkTypeEnum getHyperlinkType()
Retrieves the hyperlink type for the element.The actual hyperlink type is determined by
getLinkType()
. This method can is used to determine whether the hyperlink type is one of the built-in types or a custom type. O * When hyperlink is of custom type,CUSTOM
is returned.- Returns:
- one of the hyperlink type constants
- See Also:
getLinkType()
-
getHyperlinkTarget
public HyperlinkTargetEnum getHyperlinkTarget()
Retrieves the hyperlink target name for the element.The actual hyperlink target name is determined by
getLinkTarget()
. This method is used to determine whether the hyperlink target name is one of the built-in names or a custom one. When hyperlink target has a custom name,CUSTOM
is returned.- Returns:
- one of the hyperlink target name constants
- See Also:
getLinkTarget()
-
getFontName
public String getFontName()
- Specified by:
getFontName
in interfaceJRFont
-
getOwnFontName
public String getOwnFontName()
- Specified by:
getOwnFontName
in interfaceJRFont
-
setFontName
public void setFontName(String fontName)
- Specified by:
setFontName
in interfaceJRFont
-
setBold
public void setBold(Boolean isBold)
Alternative setBold method which allows also to reset the "own" isBold property.
-
isOwnItalic
public Boolean isOwnItalic()
- Specified by:
isOwnItalic
in interfaceJRFont
-
setItalic
public void setItalic(Boolean isItalic)
Alternative setItalic method which allows also to reset the "own" isItalic property.
-
isUnderline
public boolean isUnderline()
- Specified by:
isUnderline
in interfaceJRFont
-
isOwnUnderline
public Boolean isOwnUnderline()
- Specified by:
isOwnUnderline
in interfaceJRFont
-
setUnderline
public void setUnderline(Boolean isUnderline)
Alternative setUnderline method which allows also to reset the "own" isUnderline property.- Specified by:
setUnderline
in interfaceJRFont
-
isStrikeThrough
public boolean isStrikeThrough()
- Specified by:
isStrikeThrough
in interfaceJRFont
-
isOwnStrikeThrough
public Boolean isOwnStrikeThrough()
- Specified by:
isOwnStrikeThrough
in interfaceJRFont
-
setStrikeThrough
public void setStrikeThrough(Boolean isStrikeThrough)
Alternative setStrikeThrough method which allows also to reset the "own" isStrikeThrough property.- Specified by:
setStrikeThrough
in interfaceJRFont
-
getFontSize
public float getFontSize()
- Specified by:
getFontSize
in interfaceJRCommonText
- Specified by:
getFontSize
in interfaceJRFont
-
getOwnFontSize
public Float getOwnFontSize()
- Specified by:
getOwnFontSize
in interfaceJRFont
-
setFontSize
public void setFontSize(Float fontSize)
Method which allows also to reset the "own" size property.- Specified by:
setFontSize
in interfaceJRFont
-
getPdfFontName
public String getPdfFontName()
- Specified by:
getPdfFontName
in interfaceJRFont
-
getOwnPdfFontName
public String getOwnPdfFontName()
- Specified by:
getOwnPdfFontName
in interfaceJRFont
-
setPdfFontName
public void setPdfFontName(String pdfFontName)
- Specified by:
setPdfFontName
in interfaceJRFont
-
getPdfEncoding
public String getPdfEncoding()
- Specified by:
getPdfEncoding
in interfaceJRFont
-
getOwnPdfEncoding
public String getOwnPdfEncoding()
- Specified by:
getOwnPdfEncoding
in interfaceJRFont
-
setPdfEncoding
public void setPdfEncoding(String pdfEncoding)
- Specified by:
setPdfEncoding
in interfaceJRFont
-
isPdfEmbedded
public boolean isPdfEmbedded()
- Specified by:
isPdfEmbedded
in interfaceJRFont
-
isOwnPdfEmbedded
public Boolean isOwnPdfEmbedded()
- Specified by:
isOwnPdfEmbedded
in interfaceJRFont
-
setPdfEmbedded
public void setPdfEmbedded(Boolean isPdfEmbedded)
Alternative setPdfEmbedded method which allows also to reset the "own" isPdfEmbedded property.- Specified by:
setPdfEmbedded
in interfaceJRFont
-
getStyle
public JRStyle getStyle()
Description copied from interface:JRStyleContainer
Returns this object's style.- Specified by:
getStyle
in interfaceJRStyleContainer
- Overrides:
getStyle
in classJRTemplateElement
- Returns:
- this object's style
-
getPattern
public String getPattern()
- Specified by:
getPattern
in interfaceTextFormat
-
setPattern
public void setPattern(String pattern)
-
getValueClassName
public String getValueClassName()
- Specified by:
getValueClassName
in interfaceTextFormat
-
setValueClassName
public void setValueClassName(String valueClassName)
-
getFormatFactoryClass
public String getFormatFactoryClass()
- Specified by:
getFormatFactoryClass
in interfaceTextFormat
-
setFormatFactoryClass
public void setFormatFactoryClass(String formatFactoryClass)
-
getLocaleCode
public String getLocaleCode()
- Specified by:
getLocaleCode
in interfaceTextFormat
-
setLocaleCode
public void setLocaleCode(String localeCode)
-
getTimeZoneId
public String getTimeZoneId()
- Specified by:
getTimeZoneId
in interfaceTextFormat
-
setTimeZoneId
public void setTimeZoneId(String timeZoneId)
-
getLinkType
public String getLinkType()
Returns the hyperlink type.The type can be one of the built-in types (Reference, LocalAnchor, LocalPage, RemoteAnchor, RemotePage), or can be an arbitrary type.
- Returns:
- the hyperlink type
-
setLinkType
public void setLinkType(String linkType)
Sets the hyperlink type.The type can be one of the built-in types (Reference, LocalAnchor, LocalPage, RemoteAnchor, RemotePage), or can be an arbitrary type.
- Parameters:
linkType
- the hyperlink type
-
setLinkTarget
protected void setLinkTarget(String linkTarget)
-
getLinkTarget
public String getLinkTarget()
Returns the hyperlink target name.The target name can be one of the built-in names (Self, Blank, Top, Parent), or can be an arbitrary name.
- Returns:
- the hyperlink type
-
getDefaultLineColor
public Color getDefaultLineColor()
- Specified by:
getDefaultLineColor
in interfaceJRBoxContainer
-
getHashCode
public int getHashCode()
Description copied from interface:Deduplicable
Returns a hash code to be used for the deduplicate map. The returned hash code should be consitent wiwhDeduplicable.isIdentical(Object)
, i.e. if two objects are identical they should have the same hash code.- Specified by:
getHashCode
in interfaceDeduplicable
- Returns:
- deduplication hash code
-
isIdentical
public boolean isIdentical(Object object)
Description copied from interface:Deduplicable
Determines if this instance is identical to another object.- Specified by:
isIdentical
in interfaceDeduplicable
- Parameters:
object
- the object to compare with this instance- Returns:
true
if the two objects are identical and can be deduplicated
-
populateStyle
public void populateStyle()
- Overrides:
populateStyle
in classJRTemplateElement
-
-