edu.rice.cs.drjava.model.print
Class PagePrinter

java.lang.Object
  extended by edu.rice.cs.drjava.model.print.PagePrinter
All Implemented Interfaces:
Printable

public class PagePrinter
extends Object
implements Printable

Class which represents a Printable object for a given page of the print job.

Version:
$Id: PagePrinter.java 4447 2008-04-18 16:06:34Z rcartwright $

Field Summary
 
Fields inherited from interface java.awt.print.Printable
NO_SUCH_PAGE, PAGE_EXISTS
 
Constructor Summary
PagePrinter(int page, String fileName, DrJavaBook parent)
          Constructs a PagePrinter for a given page number (which is ignored!), a given filename, and parent.
 
Method Summary
 void add(TextLayout text, TextLayout lineNumber)
          Method which adds a TextLayout (and lineNumber) to this page.
 int print(Graphics graphics, PageFormat format, int pageIndex)
          Method to support the Printable interface.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PagePrinter

public PagePrinter(int page,
                   String fileName,
                   DrJavaBook parent)
Constructs a PagePrinter for a given page number (which is ignored!), a given filename, and parent.

Method Detail

add

public void add(TextLayout text,
                TextLayout lineNumber)
Method which adds a TextLayout (and lineNumber) to this page. This is designed to represent a physical line of text to be printed on the document (as opposed to a real line number.

Parameters:
text - The text of the given line.
lineNumber - The Text to write in the lineNumber location.

print

public int print(Graphics graphics,
                 PageFormat format,
                 int pageIndex)
Method to support the Printable interface. It prints the contents of this PagePrinter onto the Graphics object.

Specified by:
print in interface Printable
Parameters:
graphics - The Graphics object to print to.
format - The PageFormat to use.
pageIndex - The page number to print.