org.jfree.report.content
Class TextLine

java.lang.Object
  |
  +--org.jfree.report.content.TextLine

public class TextLine
extends java.lang.Object
implements Content

Represents a line of text.

Author:
Thomas Morgner

Constructor Summary
TextLine(SizeCalculator sizeCalc, long lineheight)
          Creates a new line of text.
 
Method Summary
 StrictBounds getBounds()
          Returns the bounds of the text.
 java.lang.String getContent()
          Returns the text content.
 Content getContentForBounds(StrictBounds bounds)
          Returns the content that fits in the specified bounds.
 ContentType getContentType()
          Returns the content type, in this case ContentType.TEXT.
 long getHeight()
          Returns the height of this text line.
 StrictBounds getMinimumContentSize()
          Return the minimum content size.
 void setContent(java.lang.String content, long x, long y, long width, long height)
          Sets the content for the line of text.
 java.lang.String toString()
          Returns a string representation of this text line.
 void translate(long x, long y)
          Hack-Attack: Used for alignment of the content.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TextLine

public TextLine(SizeCalculator sizeCalc,
                long 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 long getHeight()
Returns the height of this text line. Remember, that this height is an internal (fixed point) value and must be corrected before used in the AWT or other output targets.
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,
                       long x,
                       long y,
                       long width,
                       long 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.

getBounds

public StrictBounds getBounds()
Returns the bounds of the text.
Specified by:
getBounds in interface Content
Returns:
the bounds.

getContentForBounds

public Content getContentForBounds(StrictBounds 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 StrictBounds 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.
Overrides:
toString in class java.lang.Object
Returns:
a string representation.

translate

public void translate(long x,
                      long y)
Hack-Attack: Used for alignment of the content.
Specified by:
translate in interface Content
Parameters:
x - the x translation.
y - the y translation.