net.sf.jasperreports.engine.fill
Class JRTemplateText

java.lang.Object
  extended by net.sf.jasperreports.engine.fill.JRTemplateElement
      extended by net.sf.jasperreports.engine.fill.JRTemplateText
All Implemented Interfaces:
java.io.Serializable, Deduplicable, TextFormat, JRAlignment, JRBoxContainer, JRCommonElement, JRCommonText, JRFont, JRIdentifiable, JRParagraphContainer, JRPropertiesHolder, JRStyleContainer

public class JRTemplateText
extends JRTemplateElement
implements JRAlignment, JRFont, JRCommonText, TextFormat

Text element information shared by multiple print text objects.

Version:
$Id: JRTemplateText.java 5180 2012-03-29 13:23:12Z teodord $
Author:
Teodor Danciu (teodord@users.sourceforge.net)
See Also:
JRTemplatePrintText, Serialized Form

Field Summary
protected  java.lang.String fontName
           
protected  java.lang.Integer fontSize
           
protected  java.lang.String formatFactoryClass
           
protected  java.lang.Boolean isBold
           
protected  java.lang.Boolean isItalic
           
protected  java.lang.Boolean isPdfEmbedded
           
protected  java.lang.Boolean isStrikeThrough
           
protected  java.lang.Boolean isUnderline
           
protected  JRLineBox lineBox
           
protected  java.lang.String localeCode
           
protected  JRParagraph paragraph
           
protected  java.lang.String pattern
           
protected  java.lang.String pdfEncoding
           
protected  java.lang.String pdfFontName
           
protected  java.lang.String timeZoneId
           
protected  java.lang.String valueClassName
           
 
Fields inherited from class net.sf.jasperreports.engine.fill.JRTemplateElement
defaultStyleProvider, origin, parentStyle
 
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
 
Fields inherited from interface net.sf.jasperreports.engine.JRCommonText
MARKUP_HTML, MARKUP_NONE, MARKUP_RTF, MARKUP_STYLED_TEXT
 
Constructor Summary
  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
 void copyLineBox(JRLineBox box)
          Copies box attributes.
 void copyParagraph(JRParagraph prg)
          Copies paragraph attributes.
 java.awt.Color getDefaultLineColor()
           
 JRFont getFont()
          Deprecated.  
 java.lang.String getFontName()
           
 int getFontSize()
           
 java.lang.String getFormatFactoryClass()
           
 int getHashCode()
          Returns a hash code to be used for the deduplicate map.
 HorizontalAlignEnum getHorizontalAlignmentValue()
          Gets the text horizontal alignment.
 byte getHyperlinkTarget()
          Deprecated.  
 HyperlinkTargetEnum getHyperlinkTargetValue()
          Retrieves the hyperlink target name for the element.
 HyperlinkTypeEnum getHyperlinkTypeValue()
          Retrieves the hyperlink type for the element.
 JRLineBox getLineBox()
           
 LineSpacingEnum getLineSpacingValue()
          Deprecated. Replaced by JRParagraph.getLineSpacing().
 java.lang.String getLinkTarget()
          Returns the hyperlink target name.
 java.lang.String getLinkType()
          Returns the hyperlink type.
 java.lang.String getLocaleCode()
           
 java.lang.String getMarkup()
          Returns the text markup.
 ModeEnum getModeValue()
          Returns the element transparency mode.
 java.lang.String getOwnFontName()
           
 java.lang.Integer getOwnFontSize()
           
 HorizontalAlignEnum getOwnHorizontalAlignmentValue()
           
 LineSpacingEnum getOwnLineSpacingValue()
          Deprecated. Replaced by JRParagraph.getOwnLineSpacing().
 java.lang.String getOwnMarkup()
           
 java.lang.String getOwnPdfEncoding()
           
 java.lang.String getOwnPdfFontName()
           
 RotationEnum getOwnRotationValue()
          Gets the text own rotation.
 VerticalAlignEnum getOwnVerticalAlignmentValue()
           
 JRParagraph getParagraph()
           
 java.lang.String getPattern()
           
 java.lang.String getPdfEncoding()
           
 java.lang.String getPdfFontName()
           
 RotationEnum getRotationValue()
          Gets the text rotation.
 JRStyle getStyle()
          Returns this object's style.
 java.lang.String getTimeZoneId()
           
 java.lang.String getValueClassName()
           
 VerticalAlignEnum getVerticalAlignmentValue()
          Gets the text vertical alignment.
 boolean isBold()
           
 boolean isIdentical(java.lang.Object object)
          Determines if this instance is identical to another object.
 boolean isItalic()
           
 java.lang.Boolean isOwnBold()
           
 java.lang.Boolean isOwnItalic()
           
 java.lang.Boolean isOwnPdfEmbedded()
           
 java.lang.Boolean isOwnStrikeThrough()
           
 java.lang.Boolean isOwnUnderline()
           
 boolean isPdfEmbedded()
           
 boolean isStrikeThrough()
           
 boolean isUnderline()
           
 void setBold(boolean isBold)
           
 void setBold(java.lang.Boolean isBold)
          Alternative setBold method which allows also to reset the "own" isBold property.
 void setFontName(java.lang.String fontName)
           
 void setFontSize(int fontSize)
           
 void setFontSize(java.lang.Integer fontSize)
          Alternative setSize method which allows also to reset the "own" size property.
 void setFormatFactoryClass(java.lang.String formatFactoryClass)
           
 void setHorizontalAlignment(HorizontalAlignEnum horizontalAlignmentValue)
          Sets the text horizontal alignment.
 void setItalic(boolean isItalic)
           
 void setItalic(java.lang.Boolean isItalic)
          Alternative setItalic method which allows also to reset the "own" isItalic property.
 void setLineSpacing(LineSpacingEnum lineSpacing)
          Deprecated. Replaced by JRParagraph.setLineSpacing(LineSpacingEnum).
protected  void setLinkTarget(java.lang.String linkTarget)
           
 void setLinkType(java.lang.String linkType)
          Sets the hyperlink type.
 void setLocaleCode(java.lang.String localeCode)
           
 void setMarkup(java.lang.String markup)
          Sets the text markup attribute.
 void setPattern(java.lang.String pattern)
           
 void setPdfEmbedded(boolean isPdfEmbedded)
           
 void setPdfEmbedded(java.lang.Boolean isPdfEmbedded)
          Alternative setPdfEmbedded method which allows also to reset the "own" isPdfEmbedded property.
 void setPdfEncoding(java.lang.String pdfEncoding)
           
 void setPdfFontName(java.lang.String pdfFontName)
           
 void setRotation(RotationEnum rotationValue)
          Sets the text rotation.
protected  void setStaticText(JRStaticText staticText)
           
 void setStrikeThrough(boolean isStrikeThrough)
           
 void setStrikeThrough(java.lang.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 setTimeZoneId(java.lang.String timeZoneId)
           
 void setUnderline(boolean isUnderline)
           
 void setUnderline(java.lang.Boolean isUnderline)
          Alternative setUnderline method which allows also to reset the "own" isUnderline property.
 void setValueClassName(java.lang.String valueClassName)
           
 void setVerticalAlignment(VerticalAlignEnum verticalAlignmentValue)
          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, getUUID, 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.JRIdentifiable
getUUID
 
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.Integer 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 template
defaultStyleProvider - 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)

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: 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:
getModeValue in interface JRCommonElement
Overrides:
getModeValue in class JRTemplateElement

getHorizontalAlignmentValue

public HorizontalAlignEnum getHorizontalAlignmentValue()
Description copied from interface: JRAlignment
Gets the text horizontal alignment.

Specified by:
getHorizontalAlignmentValue in interface JRAlignment
Returns:
a value representing one of the horizontal alignment constants in HorizontalAlignEnum

getOwnHorizontalAlignmentValue

public HorizontalAlignEnum getOwnHorizontalAlignmentValue()
Specified by:
getOwnHorizontalAlignmentValue in interface JRAlignment

setHorizontalAlignment

public void setHorizontalAlignment(HorizontalAlignEnum horizontalAlignmentValue)
Description copied from interface: JRAlignment
Sets the text horizontal alignment.

Specified by:
setHorizontalAlignment in interface JRAlignment
Parameters:
horizontalAlignmentValue - a value representing one of the horizontal alignment constants in HorizontalAlignEnum

getVerticalAlignmentValue

public VerticalAlignEnum getVerticalAlignmentValue()
Description copied from interface: JRAlignment
Gets the text vertical alignment.

Specified by:
getVerticalAlignmentValue in interface JRAlignment
Returns:
a value representing one of the vertical alignment constants in VerticalAlignEnum

getOwnVerticalAlignmentValue

public VerticalAlignEnum getOwnVerticalAlignmentValue()
Specified by:
getOwnVerticalAlignmentValue in interface JRAlignment

setVerticalAlignment

public void setVerticalAlignment(VerticalAlignEnum verticalAlignmentValue)
Description copied from interface: JRAlignment
Gets the text vertical alignment.

Specified by:
setVerticalAlignment in interface JRAlignment
Parameters:
verticalAlignmentValue - a value representing one of the vertical alignment constants in VerticalAlignEnum

getRotationValue

public RotationEnum getRotationValue()
Description copied from interface: JRCommonText
Gets the text rotation.

Specified by:
getRotationValue in interface JRCommonText
Returns:
a value representing one of the text rotation constants in RotationEnum

getOwnRotationValue

public RotationEnum getOwnRotationValue()
Description copied from interface: JRCommonText
Gets the text own rotation.

Specified by:
getOwnRotationValue in interface JRCommonText
Returns:
a value representing one of the text rotation constants in RotationEnum

setRotation

public void setRotation(RotationEnum rotationValue)
Sets the text rotation.

Specified by:
setRotation in interface JRCommonText
Parameters:
rotationValue - one of values, or null if this template should not specify a rotation attribute of its own

getLineSpacingValue

public LineSpacingEnum getLineSpacingValue()
Deprecated. Replaced by JRParagraph.getLineSpacing().

Specified by:
getLineSpacingValue in interface JRCommonText

getOwnLineSpacingValue

public LineSpacingEnum getOwnLineSpacingValue()
Deprecated. Replaced by JRParagraph.getOwnLineSpacing().

Specified by:
getOwnLineSpacingValue in interface JRCommonText

setLineSpacing

public void setLineSpacing(LineSpacingEnum lineSpacing)
Deprecated. Replaced by JRParagraph.setLineSpacing(LineSpacingEnum).

Specified by:
setLineSpacing in interface JRCommonText

getMarkup

public java.lang.String getMarkup()
Description copied from interface: JRCommonText
Returns the text markup.

Specified by:
getMarkup in interface JRCommonText

getOwnMarkup

public java.lang.String getOwnMarkup()
Specified by:
getOwnMarkup in interface JRCommonText

setMarkup

public void setMarkup(java.lang.String markup)
Sets the text markup attribute.

Specified by:
setMarkup in interface JRCommonText
Parameters:
markup - the markup attribute
See Also:
getMarkup()

getLineBox

public JRLineBox getLineBox()
Specified by:
getLineBox in interface JRBoxContainer

getParagraph

public JRParagraph getParagraph()
Specified by:
getParagraph in interface JRParagraphContainer

getFont

public JRFont getFont()
Deprecated. 


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, CUSTOM is returned.

Returns:
one of the hyperlink type constants
See Also:
getLinkType()

getHyperlinkTarget

public byte getHyperlinkTarget()
Deprecated. 


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, CUSTOM is returned.

Returns:
one of the hyperlink target name constants
See Also:
getLinkTarget()

getFontName

public java.lang.String getFontName()
Specified by:
getFontName in interface JRFont

getOwnFontName

public java.lang.String getOwnFontName()
Specified by:
getOwnFontName in interface JRFont

setFontName

public void setFontName(java.lang.String fontName)
Specified by:
setFontName in interface JRFont

isBold

public boolean isBold()
Specified by:
isBold in interface JRFont

isOwnBold

public java.lang.Boolean isOwnBold()
Specified by:
isOwnBold in interface JRFont

setBold

public void setBold(boolean isBold)
Specified by:
setBold in interface JRFont

setBold

public void setBold(java.lang.Boolean isBold)
Alternative setBold method which allows also to reset the "own" isBold property.

Specified by:
setBold in interface JRFont

isItalic

public boolean isItalic()
Specified by:
isItalic in interface JRFont

isOwnItalic

public java.lang.Boolean isOwnItalic()
Specified by:
isOwnItalic in interface JRFont

setItalic

public void setItalic(boolean isItalic)
Specified by:
setItalic in interface JRFont

setItalic

public void setItalic(java.lang.Boolean isItalic)
Alternative setItalic method which allows also to reset the "own" isItalic property.

Specified by:
setItalic in interface JRFont

isUnderline

public boolean isUnderline()
Specified by:
isUnderline in interface JRFont

isOwnUnderline

public java.lang.Boolean isOwnUnderline()
Specified by:
isOwnUnderline in interface JRFont

setUnderline

public void setUnderline(boolean isUnderline)
Specified by:
setUnderline in interface JRFont

setUnderline

public void setUnderline(java.lang.Boolean isUnderline)
Alternative setUnderline method which allows also to reset the "own" isUnderline property.

Specified by:
setUnderline in interface JRFont

isStrikeThrough

public boolean isStrikeThrough()
Specified by:
isStrikeThrough in interface JRFont

isOwnStrikeThrough

public java.lang.Boolean isOwnStrikeThrough()
Specified by:
isOwnStrikeThrough in interface JRFont

setStrikeThrough

public void setStrikeThrough(boolean isStrikeThrough)
Specified by:
setStrikeThrough in interface JRFont

setStrikeThrough

public void setStrikeThrough(java.lang.Boolean isStrikeThrough)
Alternative setStrikeThrough method which allows also to reset the "own" isStrikeThrough property.

Specified by:
setStrikeThrough in interface JRFont

getFontSize

public int getFontSize()
Specified by:
getFontSize in interface JRCommonText
Specified by:
getFontSize in interface JRFont

getOwnFontSize

public java.lang.Integer getOwnFontSize()
Specified by:
getOwnFontSize in interface JRFont

setFontSize

public void setFontSize(int fontSize)
Specified by:
setFontSize in interface JRFont

setFontSize

public void setFontSize(java.lang.Integer fontSize)
Alternative setSize method which allows also to reset the "own" size property.

Specified by:
setFontSize in interface JRFont

getPdfFontName

public java.lang.String getPdfFontName()
Specified by:
getPdfFontName in interface JRFont

getOwnPdfFontName

public java.lang.String getOwnPdfFontName()
Specified by:
getOwnPdfFontName in interface JRFont

setPdfFontName

public void setPdfFontName(java.lang.String pdfFontName)
Specified by:
setPdfFontName in interface JRFont

getPdfEncoding

public java.lang.String getPdfEncoding()
Specified by:
getPdfEncoding in interface JRFont

getOwnPdfEncoding

public java.lang.String getOwnPdfEncoding()
Specified by:
getOwnPdfEncoding in interface JRFont

setPdfEncoding

public void setPdfEncoding(java.lang.String pdfEncoding)
Specified by:
setPdfEncoding in interface JRFont

isPdfEmbedded

public boolean isPdfEmbedded()
Specified by:
isPdfEmbedded in interface JRFont

isOwnPdfEmbedded

public java.lang.Boolean isOwnPdfEmbedded()
Specified by:
isOwnPdfEmbedded in interface JRFont

setPdfEmbedded

public void setPdfEmbedded(boolean isPdfEmbedded)
Specified by:
setPdfEmbedded in interface JRFont

setPdfEmbedded

public void setPdfEmbedded(java.lang.Boolean isPdfEmbedded)
Alternative setPdfEmbedded method which allows also to reset the "own" isPdfEmbedded property.

Specified by:
setPdfEmbedded in interface JRFont

getStyle

public JRStyle getStyle()
Description copied from interface: JRStyleContainer
Returns this object's style.

Specified by:
getStyle in interface JRStyleContainer
Overrides:
getStyle in class JRTemplateElement
Returns:
this object's style

getPattern

public java.lang.String getPattern()
Specified by:
getPattern in interface TextFormat

setPattern

public void setPattern(java.lang.String pattern)

getValueClassName

public java.lang.String getValueClassName()
Specified by:
getValueClassName in interface TextFormat

setValueClassName

public void setValueClassName(java.lang.String valueClassName)

getFormatFactoryClass

public java.lang.String getFormatFactoryClass()
Specified by:
getFormatFactoryClass in interface TextFormat

setFormatFactoryClass

public void setFormatFactoryClass(java.lang.String formatFactoryClass)

getLocaleCode

public java.lang.String getLocaleCode()
Specified by:
getLocaleCode in interface TextFormat

setLocaleCode

public void setLocaleCode(java.lang.String localeCode)

getTimeZoneId

public java.lang.String getTimeZoneId()
Specified by:
getTimeZoneId in interface TextFormat

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:
getDefaultLineColor in interface JRBoxContainer

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 wiwh Deduplicable.isIdentical(Object), i.e. if two objects are identical they should have the same hash code.

Specified by:
getHashCode in interface Deduplicable
Returns:
deduplication hash code

isIdentical

public boolean isIdentical(java.lang.Object object)
Description copied from interface: Deduplicable
Determines if this instance is identical to another object.

Specified by:
isIdentical in interface Deduplicable
Parameters:
object - the object to compare with this instance
Returns:
true if the two objects are identical and can be deduplicated


© 2001-2010 Jaspersoft Corporation www.jaspersoft.com