net.sf.jasperreports.engine.fill
Class TextMeasurer

java.lang.Object
  extended by net.sf.jasperreports.engine.fill.TextMeasurer
All Implemented Interfaces:
JRTextMeasurer
Direct Known Subclasses:
JdkGlyphFixTextMeasurer

public class TextMeasurer
extends java.lang.Object
implements JRTextMeasurer

Default text measurer implementation.

Version:
$Id: TextMeasurer.java 5180 2012-03-29 13:23:12Z teodord $
Author:
Teodor Danciu (teodord@users.sourceforge.net)

Nested Class Summary
protected static class TextMeasurer.FontInfo
           
protected static class TextMeasurer.FontKey
           
protected static class TextMeasurer.TextMeasuredState
           
 
Field Summary
protected  JasperReportsContext jasperReportsContext
           
protected  int leftPadding
           
protected  int maxHeight
           
protected  TextMeasurer.TextMeasuredState measuredState
           
protected  TextMeasurer.TextMeasuredState prevMeasuredState
           
static java.lang.String PROPERTY_MEASURE_SIMPLE_TEXTS
           
protected  int rightPadding
           
protected  JRCommonText textElement
           
protected  int width
           
 
Constructor Summary
TextMeasurer(JasperReportsContext jasperReportsContext, JRCommonText textElement)
           
TextMeasurer(JRCommonText textElement)
          Deprecated. Replaced by TextMeasurer(JasperReportsContext, JRCommonText).
 
Method Summary
protected  void appendTruncateSuffix(java.text.AttributedCharacterIterator allParagraphs)
           
 java.awt.font.FontRenderContext getFontRenderContext()
           
protected  JRPropertiesHolder getTextPropertiesHolder()
           
protected  java.lang.String getTruncateSuffix()
           
protected  boolean hasParagraphIndents()
           
protected  void initialize(JRStyledText styledText, int remainingTextStart, int availableStretchHeight, boolean canOverflow)
           
protected  boolean isLeftToRight(java.lang.String text)
           
protected  boolean isToTruncateAtChar()
           
 JRMeasuredText measure(JRStyledText styledText, int remainingTextStart, int availableStretchHeight, boolean canOverflow)
          Fit a text chunk in a given space.
protected  boolean measureSimpleText(JRStyledText styledText, int remainingTextStart)
           
protected  void processLastTruncatedRow(java.text.AttributedCharacterIterator allParagraphs, java.lang.String paragraphText, int paragraphOffset, boolean lineTruncated)
           
protected  boolean renderNextLine(java.awt.font.LineBreakMeasurer lineMeasurer, java.text.AttributedCharacterIterator paragraph, java.util.List<java.lang.Integer> tabIndexes, int[] currentTabHolder, TabStop[] nextTabStopHolder, boolean[] requireNextWordHolder)
           
protected  boolean renderParagraph(java.text.AttributedCharacterIterator allParagraphs, int lastParagraphStart, java.lang.String lastParagraphText)
           
protected  void setAttributes(java.text.AttributedString string, java.text.AttributedCharacterIterator attributes, int stringOffset)
           
protected  void setAttributes(java.text.AttributedString string, java.util.Map<java.text.AttributedCharacterIterator.Attribute,java.lang.Object> attributes, int startIndex, int endIndex)
           
protected  void truncateLastLineAtChar(java.text.AttributedCharacterIterator allParagraphs, java.lang.String paragraphText, int paragraphOffset)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROPERTY_MEASURE_SIMPLE_TEXTS

public static final java.lang.String PROPERTY_MEASURE_SIMPLE_TEXTS
See Also:
Constant Field Values

jasperReportsContext

protected JasperReportsContext jasperReportsContext

textElement

protected JRCommonText textElement

width

protected int width

leftPadding

protected int leftPadding

rightPadding

protected int rightPadding

maxHeight

protected int maxHeight

measuredState

protected TextMeasurer.TextMeasuredState measuredState

prevMeasuredState

protected TextMeasurer.TextMeasuredState prevMeasuredState
Constructor Detail

TextMeasurer

public TextMeasurer(JasperReportsContext jasperReportsContext,
                    JRCommonText textElement)

TextMeasurer

public TextMeasurer(JRCommonText textElement)
Deprecated. Replaced by TextMeasurer(JasperReportsContext, JRCommonText).

Method Detail

initialize

protected void initialize(JRStyledText styledText,
                          int remainingTextStart,
                          int availableStretchHeight,
                          boolean canOverflow)

measure

public JRMeasuredText measure(JRStyledText styledText,
                              int remainingTextStart,
                              int availableStretchHeight,
                              boolean canOverflow)
Description copied from interface: JRTextMeasurer
Fit a text chunk in a given space.

Specified by:
measure in interface JRTextMeasurer
Parameters:
styledText - the full text
remainingTextStart - the start index of the remaining text
availableStretchHeight - the available stretch height
canOverflow - whether the text element is able to overflow
Returns:
text measuring information

measureSimpleText

protected boolean measureSimpleText(JRStyledText styledText,
                                    int remainingTextStart)

isLeftToRight

protected boolean isLeftToRight(java.lang.String text)

hasParagraphIndents

protected boolean hasParagraphIndents()

renderParagraph

protected boolean renderParagraph(java.text.AttributedCharacterIterator allParagraphs,
                                  int lastParagraphStart,
                                  java.lang.String lastParagraphText)

processLastTruncatedRow

protected void processLastTruncatedRow(java.text.AttributedCharacterIterator allParagraphs,
                                       java.lang.String paragraphText,
                                       int paragraphOffset,
                                       boolean lineTruncated)

truncateLastLineAtChar

protected void truncateLastLineAtChar(java.text.AttributedCharacterIterator allParagraphs,
                                      java.lang.String paragraphText,
                                      int paragraphOffset)

appendTruncateSuffix

protected void appendTruncateSuffix(java.text.AttributedCharacterIterator allParagraphs)

isToTruncateAtChar

protected boolean isToTruncateAtChar()

getTruncateSuffix

protected java.lang.String getTruncateSuffix()

renderNextLine

protected boolean renderNextLine(java.awt.font.LineBreakMeasurer lineMeasurer,
                                 java.text.AttributedCharacterIterator paragraph,
                                 java.util.List<java.lang.Integer> tabIndexes,
                                 int[] currentTabHolder,
                                 TabStop[] nextTabStopHolder,
                                 boolean[] requireNextWordHolder)

getTextPropertiesHolder

protected JRPropertiesHolder getTextPropertiesHolder()

setAttributes

protected void setAttributes(java.text.AttributedString string,
                             java.text.AttributedCharacterIterator attributes,
                             int stringOffset)

setAttributes

protected void setAttributes(java.text.AttributedString string,
                             java.util.Map<java.text.AttributedCharacterIterator.Attribute,java.lang.Object> attributes,
                             int startIndex,
                             int endIndex)

getFontRenderContext

public java.awt.font.FontRenderContext getFontRenderContext()


© 2001-2010 Jaspersoft Corporation www.jaspersoft.com