Package net.sf.jasperreports.engine.fill
Class JRFillTextElement
- java.lang.Object
-
- net.sf.jasperreports.engine.fill.JRFillElement
-
- net.sf.jasperreports.engine.fill.JRFillTextElement
-
- All Implemented Interfaces:
Cloneable
,DynamicPropertiesHolder
,JRFillCloneable
,JRBoxContainer
,JRChild
,JRCloneable
,JRCommonElement
,JRCommonText
,JRElement
,JRFont
,JRIdentifiable
,JRParagraphContainer
,JRPropertiesHolder
,JRStyleContainer
,JRStyleSetter
,JRTextAlignment
,JRTextElement
,JRVisitable
- Direct Known Subclasses:
JRFillStaticText
,JRFillTextField
public abstract class JRFillTextElement extends JRFillElement implements JRTextElement
- Author:
- Teodor Danciu (teodord@users.sourceforge.net)
-
-
Field Summary
Fields Modifier and Type Field Description static String
EXCEPTION_MESSAGE_KEY_INVALID_START_INDEX
protected JRLineBox
initLineBox
protected JRParagraph
initParagraph
protected boolean
keepAverageCharWidth
protected JRLineBox
lineBox
protected JRParagraph
paragraph
static String
PROPERTY_CONSUME_SPACE_ON_OVERFLOW
static String
PROPERTY_CUT_TEXT_MAX_HEIGHT
static String
PROPERTY_LEGACY_TEXT_MEASURING
static String
PROPERTY_SCALE_FONT_STEP_LIMIT
-
Fields inherited from class net.sf.jasperreports.engine.fill.JRFillElement
band, conditionalStylesContainer, currentEvaluation, currentStyle, defaultPopulateTemplateStyle, defaultStyleProvider, delayedEvaluationsMap, dynamicProperties, dynamicTransferProperties, elementGroup, EXCEPTION_MESSAGE_KEY_INVALID_BOOKMARK_LEVEL, expressionEvaluator, exprStyle, fillContainerContext, filler, hasDynamicPopulateTemplateStyle, initStyle, mergedProperties, originProvider, parent, printElementOriginator, printWhenGroupChanges, propertyExpressions, providerStyle, staticProperties, staticTransferProperties, styleProviders, templates
-
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.JRElement
PROPERTY_ELEMENT_TEMPLATE_POPULATE_STYLE
-
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.JRTextElement
PROPERTY_PRINT_KEEP_FULL_TEXT, PROPERTY_SAVE_LINE_BREAKS, PROPERTY_TRUNCATE_AT_CHAR, PROPERTY_TRUNCATE_SUFFIX
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
JRFillTextElement(JRBaseFiller filler, JRTextElement textElement, JRFillObjectFactory factory)
protected
JRFillTextElement(JRFillTextElement textElement, JRFillCloneFactory factory)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract boolean
canOverflow()
protected void
chopTextElement(int availableStretchHeight)
protected int
cutTextMaxHeight()
protected void
ensureTextMeasurer()
protected void
evaluateStyle(byte evaluation)
float
getAverageCharWidth()
Color
getDefaultLineColor()
String
getFontName()
float
getFontSize()
HorizontalTextAlignEnum
getHorizontalTextAlign()
Gets the text horizontal alignment.protected float
getLeadingOffset()
JRLineBox
getLineBox()
protected short[]
getLineBreakOffsets()
protected float
getLineSpacingFactor()
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
getPdfEncoding()
String
getPdfFontName()
protected JRLineBox
getPrintLineBox()
protected JRParagraph
getPrintParagraph()
protected JRStyledText
getProcessedStyledText()
protected String
getRawText()
RotationEnum
getRotation()
Gets the text rotation.RunDirectionEnum
getRunDirection()
protected JRStyledText
getStyledText()
protected Map<AttributedCharacterIterator.Attribute,Object>
getStyledTextAttributes()
protected int
getTextEnd()
protected float
getTextHeight()
protected int
getTextStart()
String
getTextString()
protected String
getTextTruncateSuffix()
float
getTextWidth()
VerticalTextAlignEnum
getVerticalTextAlign()
Gets the text vertical alignment.boolean
isBold()
protected boolean
isConsumeSpaceOnOverflow()
protected boolean
isCutParagraph()
boolean
isItalic()
Boolean
isOwnBold()
Boolean
isOwnItalic()
Boolean
isOwnPdfEmbedded()
Boolean
isOwnStrikeThrough()
Boolean
isOwnUnderline()
boolean
isPdfEmbedded()
boolean
isStrikeThrough()
boolean
isUnderline()
protected boolean
keepFullText()
protected boolean
prepare(int availableHeight, boolean isOverflow)
protected String
processMarkupText(String text)
void
reset()
protected void
resetTextChunk()
void
rewind()
protected float
scaleFontStepLimit()
protected abstract boolean
scaleFontToFit()
protected void
setAverageCharWidth(float averageCharWidth)
void
setBold(Boolean isBold)
Alternative setBold method which allows also to reset the "own" isBold property.protected void
setCutParagraph(boolean isCutParagraph)
void
setFontName(String fontName)
void
setFontSize(Float size)
void
setHeight(int height)
void
setHorizontalTextAlign(HorizontalTextAlignEnum horizontalAlignment)
Sets the text horizontal alignment.void
setItalic(Boolean isItalic)
Alternative setItalic method which allows also to reset the "own" isItalic property.protected void
setLeadingOffset(float leadingOffset)
protected void
setLineBreakOffsets(short[] lineBreakOffsets)
protected void
setLineSpacingFactor(float lineSpacingFactor)
void
setMarkup(String markup)
void
setPdfEmbedded(Boolean isPdfEmbedded)
Alternative setPdfEmbedded method which allows also to reset the "own" isPdfEmbedded property.void
setPdfEncoding(String pdfEncoding)
void
setPdfFontName(String pdfFontName)
protected void
setPrintText(JRPrintText printText)
protected void
setPrintText(JRPrintText printText, String text)
protected void
setRawText(String rawText)
void
setRotation(RotationEnum rotation)
Sets the text rotation.void
setStrikeThrough(Boolean isStrikeThrough)
Alternative setStrikeThrough method which allows also to reset the "own" isStrikeThrough property.protected void
setTextEnd(int textEnd)
protected void
setTextHeight(float textHeight)
protected void
setTextStart(int textStart)
protected void
setTextTruncateSuffix(String textTruncateSuffix)
protected void
setTextWidth(float textWidth)
void
setUnderline(Boolean isUnderline)
Alternative setUnderline method which allows also to reset the "own" isUnderline property.void
setVerticalTextAlign(VerticalTextAlignEnum verticalAlignment)
Gets the text vertical alignment.void
setWidth(int width)
-
Methods inherited from class net.sf.jasperreports.engine.fill.JRFillElement
addDependantElement, addDynamicProperty, clone, clone, clone, collectDelayedEvaluations, collectDelayedEvaluations, collectDelayedEvaluations, collectStyleDelayedEvaluations, collectStyleProviderDelayedEvaluations, createElementTemplate, delayedEvaluate, delayedEvaluationUpdatesTemplate, evaluate, evaluateExpression, evaluatePrintWhenExpression, evaluateProperties, fill, getBackcolor, getBand, getBookmarkLevel, getCollapsedHeightAbove, getCollapsedHeightBelow, getConditionalStylesContainer, getDefaultStyleProvider, getDependantElements, getDynamicProperties, getElementGroup, getElementOrigin, getElementTemplate, getEvaluatedProperties, getEvaluationTime, getField, getFiller, getForecolor, getGroupElements, getHeight, getInitStyle, getKey, getOwnBackcolor, getOwnForecolor, getOwnMode, getParent, getParentProperties, getPositionType, getPrepareHeight, getPrintWhenExpression, getPrintWhenGroupChanges, getPropertiesMap, getPropertyExpressions, getRelativeY, getStretchHeight, getStretchType, getStyle, getStyleExpression, getStyleNameReference, getStyleResolver, getTemplate, getTimeZone, getUUID, getVariable, getWidth, getX, getY, hasDynamicProperties, hasDynamicProperty, hasProperties, initDelayedEvaluationPrint, initDelayedEvaluations, initStyleProviders, isAlreadyPrinted, isAutoEvaluateNow, isDelayedStyleEvaluation, isEvaluateAuto, isEvaluateNow, isPrintInFirstWholeBand, isPrintRepeatedValues, isPrintWhenDetailOverflows, isPrintWhenExpressionNull, isPrintWhenTrue, isRemoveLineWhenBlank, isReprinted, isToPrint, isValueRepeating, moveDependantElements, performDelayedEvaluation, registerTemplate, resolveElement, resolveElement, setAlreadyPrinted, setBackcolor, setBand, setCollapsedHeightAbove, setCollapsedHeightBelow, setConditionalStylesContainer, setCurrentEvaluation, setExpressionEvaluator, setForecolor, setMode, setOriginProvider, setPositionType, setPrepareHeight, setPrintInFirstWholeBand, setPrintRepeatedValues, setPrintWhenDetailOverflows, setPrintWhenExpressionNull, setPrintWhenTrue, setRelativeY, setRemoveLineWhenBlank, setReprinted, setShrinkable, setStretchHeight, setStretchType, setStyle, setStyleNameReference, setToPrint, setValueRepeating, setX, setY, stretchElement, stretchElementToContainer, stretchElementToElementGroup, stretchElementToHeight, toPopulateTemplateStyle, transferProperties, transferProperties
-
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface net.sf.jasperreports.engine.JRCloneable
clone
-
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.JRElement
clone, collectExpressions, getElementGroup, getPositionType, getPrintWhenExpression, getPrintWhenGroupChanges, getPropertyExpressions, getStretchType, getStyleExpression, getX, getY, isPrintInFirstWholeBand, isPrintRepeatedValues, isPrintWhenDetailOverflows, isRemoveLineWhenBlank, setPositionType, setPrintInFirstWholeBand, setPrintRepeatedValues, setPrintWhenDetailOverflows, setRemoveLineWhenBlank, setStretchType, setX
-
Methods inherited from interface net.sf.jasperreports.engine.fill.JRFillCloneable
createClone
-
Methods inherited from interface net.sf.jasperreports.engine.JRIdentifiable
getUUID
-
Methods inherited from interface net.sf.jasperreports.engine.JRPropertiesHolder
getParentProperties, getPropertiesMap, hasProperties
-
Methods inherited from interface net.sf.jasperreports.engine.JRStyleContainer
getDefaultStyleProvider, getStyle, getStyleName, getStyleNameReference
-
Methods inherited from interface net.sf.jasperreports.engine.JRVisitable
visit
-
-
-
-
Field Detail
-
EXCEPTION_MESSAGE_KEY_INVALID_START_INDEX
public static final String EXCEPTION_MESSAGE_KEY_INVALID_START_INDEX
- See Also:
- Constant Field Values
-
PROPERTY_CONSUME_SPACE_ON_OVERFLOW
public static final String PROPERTY_CONSUME_SPACE_ON_OVERFLOW
- See Also:
- Constant Field Values
-
PROPERTY_SCALE_FONT_STEP_LIMIT
public static final String PROPERTY_SCALE_FONT_STEP_LIMIT
- See Also:
- Constant Field Values
-
PROPERTY_CUT_TEXT_MAX_HEIGHT
public static final String PROPERTY_CUT_TEXT_MAX_HEIGHT
- See Also:
- Constant Field Values
-
PROPERTY_LEGACY_TEXT_MEASURING
public static final String PROPERTY_LEGACY_TEXT_MEASURING
- See Also:
- Constant Field Values
-
initLineBox
protected final JRLineBox initLineBox
-
initParagraph
protected final JRParagraph initParagraph
-
lineBox
protected JRLineBox lineBox
-
paragraph
protected JRParagraph paragraph
-
keepAverageCharWidth
protected final boolean keepAverageCharWidth
-
-
Constructor Detail
-
JRFillTextElement
protected JRFillTextElement(JRBaseFiller filler, JRTextElement textElement, JRFillObjectFactory factory)
-
JRFillTextElement
protected JRFillTextElement(JRFillTextElement textElement, JRFillCloneFactory factory)
-
-
Method Detail
-
ensureTextMeasurer
protected void ensureTextMeasurer()
-
evaluateStyle
protected void evaluateStyle(byte evaluation) throws JRException
- Overrides:
evaluateStyle
in classJRFillElement
- Throws:
JRException
-
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 classJRFillElement
-
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 horizontalAlignment)
Description copied from interface:JRTextAlignment
Sets the text horizontal alignment.- Specified by:
setHorizontalTextAlign
in interfaceJRTextAlignment
- Parameters:
horizontalAlignment
- 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 verticalAlignment)
Description copied from interface:JRTextAlignment
Gets the text vertical alignment.- Specified by:
setVerticalTextAlign
in interfaceJRTextAlignment
- Parameters:
verticalAlignment
- 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)
Description copied from interface:JRCommonText
Sets the text rotation.- Specified by:
setRotation
in interfaceJRCommonText
- Parameters:
rotation
- a value representing one of the text rotation constants inRotationEnum
-
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)
- Specified by:
setMarkup
in interfaceJRCommonText
-
getPrintLineBox
protected JRLineBox getPrintLineBox()
-
getLineBox
public JRLineBox getLineBox()
- Specified by:
getLineBox
in interfaceJRBoxContainer
-
getPrintParagraph
protected JRParagraph getPrintParagraph()
-
getParagraph
public JRParagraph getParagraph()
- Specified by:
getParagraph
in interfaceJRParagraphContainer
-
getStyledTextAttributes
protected Map<AttributedCharacterIterator.Attribute,Object> getStyledTextAttributes()
-
getLineSpacingFactor
protected float getLineSpacingFactor()
-
setLineSpacingFactor
protected void setLineSpacingFactor(float lineSpacingFactor)
-
getLeadingOffset
protected float getLeadingOffset()
-
setLeadingOffset
protected void setLeadingOffset(float leadingOffset)
-
getRunDirection
public RunDirectionEnum getRunDirection()
-
getTextWidth
public float getTextWidth()
-
setTextWidth
protected void setTextWidth(float textWidth)
-
getAverageCharWidth
public float getAverageCharWidth()
-
setAverageCharWidth
protected void setAverageCharWidth(float averageCharWidth)
-
getTextHeight
protected float getTextHeight()
-
setTextHeight
protected void setTextHeight(float textHeight)
-
getTextStart
protected int getTextStart()
-
setTextStart
protected void setTextStart(int textStart)
-
getTextEnd
protected int getTextEnd()
-
setTextEnd
protected void setTextEnd(int textEnd)
-
isCutParagraph
protected boolean isCutParagraph()
-
setCutParagraph
protected void setCutParagraph(boolean isCutParagraph)
-
getLineBreakOffsets
protected short[] getLineBreakOffsets()
-
setLineBreakOffsets
protected void setLineBreakOffsets(short[] lineBreakOffsets)
-
resetTextChunk
protected void resetTextChunk()
-
getRawText
protected String getRawText()
-
setRawText
protected void setRawText(String rawText)
-
reset
public void reset()
- Overrides:
reset
in classJRFillElement
-
rewind
public void rewind()
- Specified by:
rewind
in classJRFillElement
-
getStyledText
protected JRStyledText getStyledText()
-
getProcessedStyledText
protected JRStyledText getProcessedStyledText()
-
getTextString
public String getTextString()
-
prepare
protected boolean prepare(int availableHeight, boolean isOverflow) throws JRException
- Overrides:
prepare
in classJRFillElement
- Throws:
JRException
-
chopTextElement
protected void chopTextElement(int availableStretchHeight)
-
isConsumeSpaceOnOverflow
protected boolean isConsumeSpaceOnOverflow()
-
canOverflow
protected abstract boolean canOverflow()
-
scaleFontToFit
protected abstract boolean scaleFontToFit()
-
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 size)
- 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
-
getDefaultLineColor
public Color getDefaultLineColor()
- Specified by:
getDefaultLineColor
in interfaceJRBoxContainer
-
setHeight
public void setHeight(int height)
- Overrides:
setHeight
in classJRFillElement
-
setWidth
public void setWidth(int width)
- Specified by:
setWidth
in interfaceJRElement
- Overrides:
setWidth
in classJRFillElement
-
setPrintText
protected void setPrintText(JRPrintText printText)
-
keepFullText
protected boolean keepFullText()
-
scaleFontStepLimit
protected float scaleFontStepLimit()
-
cutTextMaxHeight
protected int cutTextMaxHeight()
-
setPrintText
protected void setPrintText(JRPrintText printText, String text)
-
getTextTruncateSuffix
protected String getTextTruncateSuffix()
-
setTextTruncateSuffix
protected void setTextTruncateSuffix(String textTruncateSuffix)
-
-