org.jfree.report.content
Class TextLine

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

public class TextLine
extends java.lang.Object
implements Content

Represents a line of text.

Author:
Thomas Morgner

Constructor Summary
TextLine(SizeCalculator sizeCalc, float lineheight)
          Creates a new line of text.
 
Method Summary
 java.awt.geom.Rectangle2D getBounds()
          Returns the bounds of the text.
 java.lang.String getContent()
          Returns the text content.
 Content getContentForBounds(java.awt.geom.Rectangle2D bounds)
          Returns the content that fits in the specified bounds.
 Content getContentPart(int part)
          This class does not store sub-content items, so this method always returns null.
 int getContentPartCount()
          This class does not store sub-content items, so this method always returns zero.
 ContentType getContentType()
          Returns the content type, in this case ContentType.TEXT.
 float getHeight()
          Returns the height of this text line.
 java.awt.geom.Rectangle2D getMinimumContentSize()
          Return the minimum content size.
 void setContent(java.lang.String content, float x, float y, float width, float height)
          Sets the content for the line of text.
 java.lang.String toString()
          Returns a string representation of this text line.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TextLine

public TextLine(SizeCalculator sizeCalc,
                float lineheight)
Creates a new line of text.

Parameters:
sizeCalc - the size calculator.
lineheight - the line height that should be used for this text line.
Method Detail

getHeight

public float getHeight()
Returns the height of this text line.

Returns:
the height of the line of text.

getContentType

public ContentType getContentType()
Returns the content type, in this case ContentType.TEXT.

Specified by:
getContentType in interface Content
Returns:
the content type.

setContent

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

Parameters:
content - the string for this line of text.
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.

getContent

public java.lang.String getContent()
Returns the text content.

Returns:
the text.

getContentPartCount

public int getContentPartCount()
This class does not store sub-content items, so this method always returns zero.

Specified by:
getContentPartCount in interface Content
Returns:
always zero, a text line is atomic.

getContentPart

public Content getContentPart(int part)
This class does not store sub-content items, so this method always returns null.

Specified by:
getContentPart in interface Content
Parameters:
part - ignored.
Returns:
null.

getBounds

public java.awt.geom.Rectangle2D getBounds()
Returns the bounds of the text.

Specified by:
getBounds in interface Content
Returns:
the bounds.

getContentForBounds

public Content getContentForBounds(java.awt.geom.Rectangle2D bounds)
Returns the content that fits in the specified bounds.

This is a single line, so either the content does fit the height, or it doesn't (in that case, return nothing at all).

Specified by:
getContentForBounds in interface Content
Parameters:
bounds - the bounds.
Returns:
the content that fits the specified bounds.

getMinimumContentSize

public java.awt.geom.Rectangle2D getMinimumContentSize()
Return the minimum content size.

Specified by:
getMinimumContentSize in interface Content
Returns:
the minimum size.

toString

public java.lang.String toString()
Returns a string representation of this text line.

Returns:
a string representation.