Interface JRPrintText
- All Superinterfaces:
JRBoxContainer,JRCommonElement,JRCommonText,JRFont,JRIdentifiable,JRParagraphContainer,JRPrintAnchor,JRPrintElement,JRPrintHyperlink,JRPropertiesHolder,JRStyleContainer,JRTextAlignment,TextFormat
- All Known Implementing Classes:
JRBasePrintText,JRRecordedValuesPrintText,JRTemplatePrintText
- Author:
- Teodor Danciu (teodord@users.sourceforge.net)
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringSpecifies if the first line in a paragraph should be indented.static final StringSpecifies if the last line in a paragraph should be justified.static final short[]Zero-length line break offset array used forgetLineBreakOffsets()when the text does not have any line breaks.Fields inherited from interface net.sf.jasperreports.engine.JRCommonText
MARKUP_HTML, MARKUP_NONE, MARKUP_RTF, MARKUP_STYLED_TEXTFields inherited from interface net.sf.jasperreports.engine.JRFont
DEFAULT_FONT_NAME, DEFAULT_FONT_SIZE, DEFAULT_PDF_EMBEDDED, DEFAULT_PDF_ENCODING, DEFAULT_PDF_FONT_NAMEFields inherited from interface net.sf.jasperreports.engine.JRPrintElement
UNSET_PRINT_ELEMENT_ID, UNSET_SOURCE_ELEMENT_IDFields inherited from interface net.sf.jasperreports.engine.JRPrintHyperlink
PROPERTY_IGNORE_HYPERLINK_SUFFIX -
Method Summary
Modifier and TypeMethodDescriptionReturns the name of the class implementing theFormatFactoryinterface to use with this text element, in case it is not the same as the one for the overall document.getFullStyledText(JRStyledTextAttributeSelector attributeSelector) Returns the full styled text of this object.Returns the full (not truncated) text of this object.floatshort[]Returns the line break offsets for the text if saved during report fill.floatReturns the code of thejava.util.Localewhich was used while formatting the source value of the text.Returns the original text that was set in this object.Returns the pattern used to format a value that was the source of this text.Gets the text run direction.floatReturns the index to which this object's text is to be truncated.Returns the suffix that is to be appended to the truncated text (as returned byJRStyledTextUtil.getTruncatedText(JRPrintText).Returns theIDof thejava.util.TimeZoneused to format this text's date source value.getValue()Returns the type of the value which was used to generate this text.voidsetAverageCharWidth(Float averageCharWidth) voidsetLeadingOffset(float leadingOffset) voidsetLineBreakOffsets(short[] lineBreakOffsets) Sets the line break offsets for the text.voidsetLineSpacingFactor(float lineSpacingFactor) voidsetRunDirection(RunDirectionEnum runDirectionEnum) Sets the text run direction.voidSet the text for this object.voidsetTextFormat(TextFormat textFormat) voidsetTextHeight(float textHeight) voidsetTextTruncateIndex(Integer index) Sets the index to which this object's text is to be truncated.voidsetTextTruncateSuffix(String suffix) Sets the suffix to be appended to the truncated text.voidMethods inherited from interface net.sf.jasperreports.engine.JRBoxContainer
getDefaultLineColor, getLineBoxMethods inherited from interface net.sf.jasperreports.engine.JRCommonElement
getBackcolor, getForecolor, getMode, getOwnBackcolor, getOwnForecolor, getOwnMode, setBackcolor, setForecolor, setModeMethods inherited from interface net.sf.jasperreports.engine.JRCommonText
getFontSize, getMarkup, getOwnMarkup, getOwnRotation, getRotation, setMarkup, setRotationMethods inherited from interface net.sf.jasperreports.engine.JRFont
getFontName, getFontSize, getOwnFontName, getOwnFontSize, getOwnPdfEncoding, getOwnPdfFontName, getPdfEncoding, getPdfFontName, isBold, isItalic, isOwnBold, isOwnItalic, isOwnPdfEmbedded, isOwnStrikeThrough, isOwnUnderline, isPdfEmbedded, isStrikeThrough, isUnderline, setBold, setFontName, setFontSize, setItalic, setPdfEmbedded, setPdfEncoding, setPdfFontName, setStrikeThrough, setUnderlineMethods inherited from interface net.sf.jasperreports.engine.JRIdentifiable
getUUIDMethods inherited from interface net.sf.jasperreports.engine.JRParagraphContainer
getParagraphMethods inherited from interface net.sf.jasperreports.engine.JRPrintAnchor
getAnchorName, getBookmarkLevel, setAnchorName, setBookmarkLevelMethods inherited from interface net.sf.jasperreports.engine.JRPrintElement
accept, getHeight, getKey, getOrigin, getPrintElementId, getSourceElementId, getWidth, getX, getY, setHeight, setStyle, setUUID, setWidth, setX, setYMethods inherited from interface net.sf.jasperreports.engine.JRPrintHyperlink
getHyperlinkAnchor, getHyperlinkPage, getHyperlinkParameters, getHyperlinkReference, getHyperlinkTarget, getHyperlinkTooltip, getHyperlinkType, getLinkTarget, getLinkType, setHyperlinkAnchor, setHyperlinkPage, setHyperlinkParameters, setHyperlinkReference, setHyperlinkTarget, setHyperlinkTooltip, setHyperlinkType, setLinkTarget, setLinkTypeMethods inherited from interface net.sf.jasperreports.engine.JRPropertiesHolder
getParentProperties, getPropertiesMap, hasPropertiesMethods inherited from interface net.sf.jasperreports.engine.JRStyleContainer
getDefaultStyleProvider, getStyle, getStyleName, getStyleNameReferenceMethods inherited from interface net.sf.jasperreports.engine.JRTextAlignment
getHorizontalTextAlign, getOwnHorizontalTextAlign, getOwnVerticalTextAlign, getVerticalTextAlign, setHorizontalTextAlign, setVerticalTextAlign
-
Field Details
-
PROPERTY_AWT_INDENT_FIRST_LINE
Specifies if the first line in a paragraph should be indented.- See Also:
-
PROPERTY_AWT_JUSTIFY_LAST_LINE
Specifies if the last line in a paragraph should be justified.- See Also:
-
ZERO_LINE_BREAK_OFFSETS
static final short[] ZERO_LINE_BREAK_OFFSETSZero-length line break offset array used forgetLineBreakOffsets()when the text does not have any line breaks.
-
-
Method Details
-
setText
Set the text for this object.- Parameters:
text- the text- See Also:
-
getValue
Object getValue() -
setValue
-
getTextTruncateIndex
Integer getTextTruncateIndex()Returns the index to which this object's text is to be truncated. This index is usually set at report fill time when the engine is instructed to keep the full text in the print text object.- Returns:
- the index to which this object's text is to be truncated
- See Also:
-
setTextTruncateIndex
Sets the index to which this object's text is to be truncated. The text is truncated whenJRStyledTextUtil.getTruncatedText(JRPrintText)orgetFullStyledText(JRStyledTextAttributeSelector)are called.- Parameters:
index- the index to which this object's text is to be truncated
-
getTextTruncateSuffix
String getTextTruncateSuffix()Returns the suffix that is to be appended to the truncated text (as returned byJRStyledTextUtil.getTruncatedText(JRPrintText).- Returns:
- the truncated text suffix
- See Also:
-
setTextTruncateSuffix
Sets the suffix to be appended to the truncated text.- Parameters:
suffix- the suffix to be appended to the truncated text- See Also:
-
getFullText
String getFullText()Returns the full (not truncated) text of this object.- Returns:
- the full text of this object
- See Also:
-
getOriginalText
String getOriginalText()Returns the original text that was set in this object.- Returns:
- the original text
-
getFullStyledText
Returns the full styled text of this object.- Parameters:
attributeSelector- the styled text attribute selector- Returns:
- the full styled text of this object
- See Also:
-
setTextFormat
-
getLineSpacingFactor
float getLineSpacingFactor() -
setLineSpacingFactor
void setLineSpacingFactor(float lineSpacingFactor) -
getLeadingOffset
float getLeadingOffset() -
setLeadingOffset
void setLeadingOffset(float leadingOffset) -
getRunDirection
RunDirectionEnum getRunDirection()Gets the text run direction.- Returns:
- a value representing one of the run direction constants in
RunDirectionEnum
-
setRunDirection
Sets the text run direction.- Parameters:
runDirectionEnum- a value representing one of the text run direction constants inRunDirectionEnum
-
getAverageCharWidth
Float getAverageCharWidth() -
setAverageCharWidth
-
getTextHeight
float getTextHeight() -
setTextHeight
void setTextHeight(float textHeight) -
getValueClassName
String getValueClassName()Returns the type of the value which was used to generate this text.Text fieldsthat have a non-Stringexpression save the value type using this attribute. This information can be used by exporters to treat numerical or date texts (for instance) in a special manner.- Specified by:
getValueClassNamein interfaceTextFormat- Returns:
- the type of the original value used to generate the text
-
getPattern
String getPattern()Returns the pattern used to format a value that was the source of this text.The pattern can be used to parse the text back to its source value.
- Specified by:
getPatternin interfaceTextFormat- Returns:
- the pattern used to format this text's source value
- See Also:
-
getFormatFactoryClass
String getFormatFactoryClass()Returns the name of the class implementing theFormatFactoryinterface to use with this text element, in case it is not the same as the one for the overall document.- Specified by:
getFormatFactoryClassin interfaceTextFormat
-
getLocaleCode
String getLocaleCode()Returns the code of thejava.util.Localewhich was used while formatting the source value of the text.The code is created using the
java.util.Locale.toString()convention.When this attribute is null, the locale returned by
JasperPrint.getLocaleCode()is used. This way, the locale is specified in a single place when all the (or many ) texts from a print object were formatted using the same locale.- Specified by:
getLocaleCodein interfaceTextFormat- Returns:
- the code of the
java.util.Localeused when formatting this text's source value
-
getTimeZoneId
String getTimeZoneId()Returns theIDof thejava.util.TimeZoneused to format this text's date source value.When this attribute is null, the time zone returned by
JasperPrint.getTimeZoneId()is used.- Specified by:
getTimeZoneIdin interfaceTextFormat- Returns:
- the
IDof thejava.util.TimeZoneused to format this text's date source value
-
getLineBreakOffsets
short[] getLineBreakOffsets()Returns the line break offsets for the text if saved during report fill.The array of offsets is incremental, each offset adds to the previous value. I.e. the positions at which line breaks occur are
offset[0],offset[0] + offset[1],offset[0] + offset[1] + offset[2]and so on.This array does not include positions for explicit line breaks in the text, i.e. for line breaks that occur due to new line characters in the text. The array only includes line break positions within a paragraph in the text.
If the text was meant to have saved line break offsets but no (non explicit) breaks were detected (e.g. if the text is a single line), this method will return a zero-length array. If the text was not meant to include saved line breaks, the method will return
null.- Returns:
- the line break offsets (possibly zero-length array), or
nullif no line break positions were saved during the fill - See Also:
-
setLineBreakOffsets
void setLineBreakOffsets(short[] lineBreakOffsets) Sets the line break offsets for the text.- Parameters:
lineBreakOffsets- the line break offsets- See Also:
-