Class JRTemplateText
- java.lang.Object
-
- net.sf.jasperreports.engine.fill.JRTemplateElement
-
- net.sf.jasperreports.engine.fill.JRTemplateText
-
- All Implemented Interfaces:
java.io.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 java.lang.StringfontNameprotected java.lang.Floatfontsizeprotected java.lang.StringformatFactoryClassprotected java.lang.BooleanisBoldprotected java.lang.BooleanisItalicprotected java.lang.BooleanisPdfEmbeddedprotected java.lang.BooleanisStrikeThroughprotected java.lang.BooleanisUnderlineprotected JRLineBoxlineBoxprotected java.lang.StringlocaleCodeprotected JRParagraphparagraphprotected java.lang.Stringpatternprotected java.lang.StringpdfEncodingprotected java.lang.StringpdfFontNameprotected java.lang.StringtimeZoneIdprotected java.lang.StringvalueClassName-
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.protectedJRTemplateText(JROrigin origin, JRDefaultStyleProvider defaultStyleProvider, JRStaticText staticText)protectedJRTemplateText(JROrigin origin, JRDefaultStyleProvider defaultStyleProvider, JRTextField textField)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcopyLineBox(JRLineBox box)Copies box attributes.voidcopyParagraph(JRParagraph prg)Copies paragraph attributes.java.awt.ColorgetDefaultLineColor()java.lang.StringgetFontName()floatgetFontsize()java.lang.StringgetFormatFactoryClass()intgetHashCode()Returns a hash code to be used for the deduplicate map.HorizontalTextAlignEnumgetHorizontalTextAlign()Gets the text horizontal alignment.HyperlinkTargetEnumgetHyperlinkTargetValue()Retrieves the hyperlink target name for the element.HyperlinkTypeEnumgetHyperlinkTypeValue()Retrieves the hyperlink type for the element.JRLineBoxgetLineBox()java.lang.StringgetLinkTarget()Returns the hyperlink target name.java.lang.StringgetLinkType()Returns the hyperlink type.java.lang.StringgetLocaleCode()java.lang.StringgetMarkup()Returns the text markup.ModeEnumgetModeValue()Returns the element transparency mode.java.lang.StringgetOwnFontName()java.lang.FloatgetOwnFontsize()HorizontalTextAlignEnumgetOwnHorizontalTextAlign()java.lang.StringgetOwnMarkup()java.lang.StringgetOwnPdfEncoding()java.lang.StringgetOwnPdfFontName()RotationEnumgetOwnRotationValue()Gets the text own rotation.VerticalTextAlignEnumgetOwnVerticalTextAlign()JRParagraphgetParagraph()java.lang.StringgetPattern()java.lang.StringgetPdfEncoding()java.lang.StringgetPdfFontName()RotationEnumgetRotationValue()Gets the text rotation.JRStylegetStyle()Returns this object's style.java.lang.StringgetTimeZoneId()java.lang.StringgetValueClassName()VerticalTextAlignEnumgetVerticalTextAlign()Gets the text vertical alignment.booleanisBold()booleanisIdentical(java.lang.Object object)Determines if this instance is identical to another object.booleanisItalic()java.lang.BooleanisOwnBold()java.lang.BooleanisOwnItalic()java.lang.BooleanisOwnPdfEmbedded()java.lang.BooleanisOwnStrikeThrough()java.lang.BooleanisOwnUnderline()booleanisPdfEmbedded()booleanisStrikeThrough()booleanisUnderline()voidpopulateStyle()voidsetBold(java.lang.Boolean isBold)Alternative setBold method which allows also to reset the "own" isBold property.voidsetFontName(java.lang.String fontName)voidsetFontSize(java.lang.Float fontSize)Method which allows also to reset the "own" size property.voidsetFormatFactoryClass(java.lang.String formatFactoryClass)voidsetHorizontalTextAlign(HorizontalTextAlignEnum horizontalTextAlign)Sets the text horizontal alignment.voidsetItalic(java.lang.Boolean isItalic)Alternative setItalic method which allows also to reset the "own" isItalic property.protected voidsetLinkTarget(java.lang.String linkTarget)voidsetLinkType(java.lang.String linkType)Sets the hyperlink type.voidsetLocaleCode(java.lang.String localeCode)voidsetMarkup(java.lang.String markup)Sets the text markup attribute.voidsetPattern(java.lang.String pattern)voidsetPdfEmbedded(java.lang.Boolean isPdfEmbedded)Alternative setPdfEmbedded method which allows also to reset the "own" isPdfEmbedded property.voidsetPdfEncoding(java.lang.String pdfEncoding)voidsetPdfFontName(java.lang.String pdfFontName)voidsetRotation(RotationEnum rotationValue)Sets the text rotation.protected voidsetStaticText(JRStaticText staticText)voidsetStrikeThrough(java.lang.Boolean isStrikeThrough)Alternative setStrikeThrough method which allows also to reset the "own" isStrikeThrough property.protected voidsetTextElement(JRTextElement textElement)protected voidsetTextField(JRTextField textField)voidsetTextFormat(TextFormat textFormat)voidsetTimeZoneId(java.lang.String timeZoneId)voidsetUnderline(java.lang.Boolean isUnderline)Alternative setUnderline method which allows also to reset the "own" isUnderline property.voidsetValueClassName(java.lang.String valueClassName)voidsetVerticalTextAlign(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, getOwnModeValue, 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, getOwnModeValue, getWidth, setBackcolor, setForecolor, setMode
-
Methods inherited from interface net.sf.jasperreports.engine.JRStyleContainer
getDefaultStyleProvider, getStyleNameReference
-
-
-
-
Field Detail
-
lineBox
protected JRLineBox lineBox
-
paragraph
protected JRParagraph paragraph
-
fontName
protected java.lang.String fontName
-
isBold
protected java.lang.Boolean isBold
-
isItalic
protected java.lang.Boolean isItalic
-
isUnderline
protected java.lang.Boolean isUnderline
-
isStrikeThrough
protected java.lang.Boolean isStrikeThrough
-
fontsize
protected java.lang.Float fontsize
-
pdfFontName
protected java.lang.String pdfFontName
-
pdfEncoding
protected java.lang.String pdfEncoding
-
isPdfEmbedded
protected java.lang.Boolean isPdfEmbedded
-
valueClassName
protected java.lang.String valueClassName
-
pattern
protected java.lang.String pattern
-
formatFactoryClass
protected java.lang.String formatFactoryClass
-
localeCode
protected java.lang.String localeCode
-
timeZoneId
protected java.lang.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
-
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- Overrides:
getModeValuein classJRTemplateElement
-
getHorizontalTextAlign
public HorizontalTextAlignEnum getHorizontalTextAlign()
Description copied from interface:JRTextAlignmentGets the text horizontal alignment.- Specified by:
getHorizontalTextAlignin interfaceJRTextAlignment- Returns:
- a value representing one of the horizontal text alignment constants in
HorizontalTextAlignEnum
-
getOwnHorizontalTextAlign
public HorizontalTextAlignEnum getOwnHorizontalTextAlign()
- Specified by:
getOwnHorizontalTextAlignin interfaceJRTextAlignment
-
setHorizontalTextAlign
public void setHorizontalTextAlign(HorizontalTextAlignEnum horizontalTextAlign)
Description copied from interface:JRTextAlignmentSets the text horizontal alignment.- Specified by:
setHorizontalTextAlignin interfaceJRTextAlignment- Parameters:
horizontalTextAlign- a value representing one of the horizontal text alignment constants inHorizontalTextAlignEnum
-
getVerticalTextAlign
public VerticalTextAlignEnum getVerticalTextAlign()
Description copied from interface:JRTextAlignmentGets the text vertical alignment.- Specified by:
getVerticalTextAlignin interfaceJRTextAlignment- Returns:
- a value representing one of the vertical text alignment constants in
VerticalTextAlignEnum
-
getOwnVerticalTextAlign
public VerticalTextAlignEnum getOwnVerticalTextAlign()
- Specified by:
getOwnVerticalTextAlignin interfaceJRTextAlignment
-
setVerticalTextAlign
public void setVerticalTextAlign(VerticalTextAlignEnum verticalTextAlign)
Description copied from interface:JRTextAlignmentGets the text vertical alignment.- Specified by:
setVerticalTextAlignin interfaceJRTextAlignment- Parameters:
verticalTextAlign- a value representing one of the vertical text alignment constants inVerticalTextAlignEnum
-
getRotationValue
public RotationEnum getRotationValue()
Description copied from interface:JRCommonTextGets the text rotation.- Specified by:
getRotationValuein interfaceJRCommonText- Returns:
- a value representing one of the text rotation constants in
RotationEnum
-
getOwnRotationValue
public RotationEnum getOwnRotationValue()
Description copied from interface:JRCommonTextGets the text own rotation.- Specified by:
getOwnRotationValuein interfaceJRCommonText- Returns:
- a value representing one of the text rotation constants in
RotationEnum
-
setRotation
public void setRotation(RotationEnum rotationValue)
Sets the text rotation.- Specified by:
setRotationin interfaceJRCommonText- Parameters:
rotationValue- one of values, ornullif this template should not specify a rotation attribute of its own
-
getMarkup
public java.lang.String getMarkup()
Description copied from interface:JRCommonTextReturns the text markup.- Specified by:
getMarkupin interfaceJRCommonText
-
getOwnMarkup
public java.lang.String getOwnMarkup()
- Specified by:
getOwnMarkupin interfaceJRCommonText
-
setMarkup
public void setMarkup(java.lang.String markup)
Sets the text markup attribute.- Specified by:
setMarkupin interfaceJRCommonText- Parameters:
markup- the markup attribute- See Also:
getMarkup()
-
getLineBox
public JRLineBox getLineBox()
- Specified by:
getLineBoxin interfaceJRBoxContainer
-
getParagraph
public JRParagraph getParagraph()
- Specified by:
getParagraphin interfaceJRParagraphContainer
-
getHyperlinkTypeValue
public HyperlinkTypeEnum getHyperlinkTypeValue()
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,CUSTOMis returned.- Returns:
- one of the hyperlink type constants
- See Also:
getLinkType()
-
getHyperlinkTargetValue
public HyperlinkTargetEnum getHyperlinkTargetValue()
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,CUSTOMis returned.- Returns:
- one of the hyperlink target name constants
- See Also:
getLinkTarget()
-
getFontName
public java.lang.String getFontName()
- Specified by:
getFontNamein interfaceJRFont
-
getOwnFontName
public java.lang.String getOwnFontName()
- Specified by:
getOwnFontNamein interfaceJRFont
-
setFontName
public void setFontName(java.lang.String fontName)
- Specified by:
setFontNamein interfaceJRFont
-
setBold
public void setBold(java.lang.Boolean isBold)
Alternative setBold method which allows also to reset the "own" isBold property.
-
isOwnItalic
public java.lang.Boolean isOwnItalic()
- Specified by:
isOwnItalicin interfaceJRFont
-
setItalic
public void setItalic(java.lang.Boolean isItalic)
Alternative setItalic method which allows also to reset the "own" isItalic property.
-
isUnderline
public boolean isUnderline()
- Specified by:
isUnderlinein interfaceJRFont
-
isOwnUnderline
public java.lang.Boolean isOwnUnderline()
- Specified by:
isOwnUnderlinein interfaceJRFont
-
setUnderline
public void setUnderline(java.lang.Boolean isUnderline)
Alternative setUnderline method which allows also to reset the "own" isUnderline property.- Specified by:
setUnderlinein interfaceJRFont
-
isStrikeThrough
public boolean isStrikeThrough()
- Specified by:
isStrikeThroughin interfaceJRFont
-
isOwnStrikeThrough
public java.lang.Boolean isOwnStrikeThrough()
- Specified by:
isOwnStrikeThroughin interfaceJRFont
-
setStrikeThrough
public void setStrikeThrough(java.lang.Boolean isStrikeThrough)
Alternative setStrikeThrough method which allows also to reset the "own" isStrikeThrough property.- Specified by:
setStrikeThroughin interfaceJRFont
-
getFontsize
public float getFontsize()
- Specified by:
getFontsizein interfaceJRCommonText- Specified by:
getFontsizein interfaceJRFont
-
getOwnFontsize
public java.lang.Float getOwnFontsize()
- Specified by:
getOwnFontsizein interfaceJRFont
-
setFontSize
public void setFontSize(java.lang.Float fontSize)
Method which allows also to reset the "own" size property.- Specified by:
setFontSizein interfaceJRFont
-
getPdfFontName
public java.lang.String getPdfFontName()
- Specified by:
getPdfFontNamein interfaceJRFont
-
getOwnPdfFontName
public java.lang.String getOwnPdfFontName()
- Specified by:
getOwnPdfFontNamein interfaceJRFont
-
setPdfFontName
public void setPdfFontName(java.lang.String pdfFontName)
- Specified by:
setPdfFontNamein interfaceJRFont
-
getPdfEncoding
public java.lang.String getPdfEncoding()
- Specified by:
getPdfEncodingin interfaceJRFont
-
getOwnPdfEncoding
public java.lang.String getOwnPdfEncoding()
- Specified by:
getOwnPdfEncodingin interfaceJRFont
-
setPdfEncoding
public void setPdfEncoding(java.lang.String pdfEncoding)
- Specified by:
setPdfEncodingin interfaceJRFont
-
isPdfEmbedded
public boolean isPdfEmbedded()
- Specified by:
isPdfEmbeddedin interfaceJRFont
-
isOwnPdfEmbedded
public java.lang.Boolean isOwnPdfEmbedded()
- Specified by:
isOwnPdfEmbeddedin interfaceJRFont
-
setPdfEmbedded
public void setPdfEmbedded(java.lang.Boolean isPdfEmbedded)
Alternative setPdfEmbedded method which allows also to reset the "own" isPdfEmbedded property.- Specified by:
setPdfEmbeddedin interfaceJRFont
-
getStyle
public JRStyle getStyle()
Description copied from interface:JRStyleContainerReturns this object's style.- Specified by:
getStylein interfaceJRStyleContainer- Overrides:
getStylein classJRTemplateElement- Returns:
- this object's style
-
getPattern
public java.lang.String getPattern()
- Specified by:
getPatternin interfaceTextFormat
-
setPattern
public void setPattern(java.lang.String pattern)
-
getValueClassName
public java.lang.String getValueClassName()
- Specified by:
getValueClassNamein interfaceTextFormat
-
setValueClassName
public void setValueClassName(java.lang.String valueClassName)
-
getFormatFactoryClass
public java.lang.String getFormatFactoryClass()
- Specified by:
getFormatFactoryClassin interfaceTextFormat
-
setFormatFactoryClass
public void setFormatFactoryClass(java.lang.String formatFactoryClass)
-
getLocaleCode
public java.lang.String getLocaleCode()
- Specified by:
getLocaleCodein interfaceTextFormat
-
setLocaleCode
public void setLocaleCode(java.lang.String localeCode)
-
getTimeZoneId
public java.lang.String getTimeZoneId()
- Specified by:
getTimeZoneIdin interfaceTextFormat
-
setTimeZoneId
public void setTimeZoneId(java.lang.String timeZoneId)
-
getLinkType
public java.lang.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(java.lang.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(java.lang.String linkTarget)
-
getLinkTarget
public java.lang.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 java.awt.Color getDefaultLineColor()
- Specified by:
getDefaultLineColorin interfaceJRBoxContainer
-
getHashCode
public int getHashCode()
Description copied from interface:DeduplicableReturns 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:
getHashCodein interfaceDeduplicable- Returns:
- deduplication hash code
-
isIdentical
public boolean isIdentical(java.lang.Object object)
Description copied from interface:DeduplicableDetermines if this instance is identical to another object.- Specified by:
isIdenticalin interfaceDeduplicable- Parameters:
object- the object to compare with this instance- Returns:
trueif the two objects are identical and can be deduplicated
-
populateStyle
public void populateStyle()
- Overrides:
populateStylein classJRTemplateElement
-
-