org.pentaho.reporting.engine.classic.core.modules.output.pageable.plaintext.driver
Class PlainTextPage

java.lang.Object
  extended by org.pentaho.reporting.engine.classic.core.modules.output.pageable.plaintext.driver.PlainTextPage

public class PlainTextPage
extends 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

Constructor Summary
PlainTextPage(Paper pageFormat, PrinterDriver driver, String defaultEncoding)
          Creates a new PlainTextPage with the given dimensions and the specified PrinterCommandSet.
 
Method Summary
 void addTextChunk(int x, int y, int w, String text, StyleSheet format)
          Adds a new text chunk to this PlainTextPage.
static int correctedDivisionFloor(float c, float d)
          Fixes some floating point errors when calculating positions.
 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
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PlainTextPage

public PlainTextPage(Paper pageFormat,
                     PrinterDriver driver,
                     String defaultEncoding)
Creates a new PlainTextPage with the given dimensions and the specified PrinterCommandSet.

Parameters:
driver - the commandset for printing and formating the text.
Method Detail

correctedDivisionFloor

public static int correctedDivisionFloor(float c,
                                         float d)
Fixes some floating point errors when calculating positions.

Parameters:
c - the divisor
d - the divident
Returns:
the corrected division result.

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,
                         String text,
                         StyleSheet 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 IOException
Writes the contents of the page using the printer command set.

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