com.jrefinery.report.targets.pageable.output
Class PlainTextPage

java.lang.Object
  |
  +--com.jrefinery.report.targets.pageable.output.PlainTextPage

public class PlainTextPage
extends java.lang.Object

The plain text page is used to buffer a complete page and to write the buffered data when the page is closed.

Author:
Thomas Morgner

Nested Class Summary
protected  class PlainTextPage.TextDataChunk
          A data carrier to collect and store text data for the output.
 
Constructor Summary
PlainTextPage(int w, int h, PrinterCommandSet commandSet)
          Creates a new PlainTextPage with the given dimensions and the specified PrinterCommandSet.
 
Method Summary
 void addTextChunk(int x, int y, int w, java.lang.String text, FontDefinition format)
          Adds a new text chunk to this PlainTextPage.
 int getHeight()
          Returns the page height in lines.
 int getWidth()
          Returns the page width in characters.
 void writePage()
          Writes the contents of the page using the printer command set.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PlainTextPage

public PlainTextPage(int w,
                     int h,
                     PrinterCommandSet commandSet)
Creates a new PlainTextPage with the given dimensions and the specified PrinterCommandSet.

Parameters:
w - the number of columns on the page
h - the number of rows on the page
commandSet - the commandset for printing and formating the text.
Method Detail

getWidth

public int getWidth()
Returns the page width in characters.

Returns:
the page width.

getHeight

public int getHeight()
Returns the page height in lines.

Returns:
the page height.

addTextChunk

public void addTextChunk(int x,
                         int y,
                         int w,
                         java.lang.String text,
                         FontDefinition format)
Adds a new text chunk to this PlainTextPage. A chunk consists of a single line of text.

Parameters:
x - the column of the first character of the text
y - the row where to print the text
w - the number of characters to print.
text - the text that should be printed.
format - the fontdefinition used to format the text.

writePage

public void writePage()
               throws java.io.IOException
Writes the contents of the page using the printer command set.

Throws:
java.io.IOException - if an I/O error occured while writing the page.