org.jfree.report.content
Class TextParagraph

java.lang.Object
  extended byorg.jfree.report.content.ContentContainer
      extended byorg.jfree.report.content.TextParagraph
All Implemented Interfaces:
Content

public class TextParagraph
extends ContentContainer

A paragraph of an given text content. A paragraph consists of one or more TextLines.

Todo: Can the content size be cached?

Author:
Thomas Morgner.

Constructor Summary
TextParagraph(SizeCalculator calc, float lineHeight, java.lang.String reservedLiteral, boolean trimTextContent)
          Creates a new text paragraph using the specified size calculator.
 
Method Summary
protected static java.lang.String clearWhitespaces(java.lang.String text)
          Removes all whitespaces from the given String and replaces them with a space character.
 boolean isTrimTextContent()
          Defines, whether whitespaces were removed from the lines of this paragraph after performing the linebreaking.
 void setContent(java.lang.String content, float x, float y, float width, float height)
          Sets the content.
 
Methods inherited from class org.jfree.report.content.ContentContainer
addContentPart, getBounds, getContentForBounds, getContentPart, getContentPartCount, getContentType, getMinimumContentSize, setBounds, setBounds, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TextParagraph

public TextParagraph(SizeCalculator calc,
                     float lineHeight,
                     java.lang.String reservedLiteral,
                     boolean trimTextContent)
Creates a new text paragraph using the specified size calculator.

Parameters:
calc - the size calculator.
lineHeight - the height of the lines contained in this paragraph.
reservedLiteral - the text that should be appended if the text does not fit into the bounds
trimTextContent - defines, whether to remove whitespaces from the start and end of an line.
Method Detail

setContent

public void setContent(java.lang.String content,
                       float x,
                       float y,
                       float width,
                       float height)
Sets the content.

Parameters:
content - the content.
x - the x coordinates for the bounds.
y - the y coordinates for the bounds.
width - the width of the bounds.
height - the height of the bounds.

isTrimTextContent

public boolean isTrimTextContent()
Defines, whether whitespaces were removed from the lines of this paragraph after performing the linebreaking.

Returns:
true, if whitespaces could have been removed, false otherwise.

clearWhitespaces

protected static java.lang.String clearWhitespaces(java.lang.String text)
Removes all whitespaces from the given String and replaces them with a space character.

Parameters:
text - the string to process.
Returns:
a string with all whitespace replaced by space characters.