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

java.lang.Object
  |
  +--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,v 1.2 2002/04/02 05:53:44 amislove Exp $

Field Summary
private  String _filename
           
private  Vector _lineNumbers
           
private  int _page
           
private  DrJavaBook _parent
           
private  Vector _textLayouts
           
 
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, 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.
private  void printFooter(Graphics2D g2d, PageFormat format, int page)
          Method which prints the footer onto the document
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

_page

private int _page

_textLayouts

private Vector _textLayouts

_lineNumbers

private Vector _lineNumbers

_filename

private String _filename

_parent

private DrJavaBook _parent
Constructor Detail

PagePrinter

public PagePrinter(int page,
                   String filename,
                   DrJavaBook parent)
Constructs a PagePrinter for a given page number, 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.

printFooter

private void printFooter(Graphics2D g2d,
                         PageFormat format,
                         int page)
Method which prints the footer onto the document
Parameters:
g2d - The Graphics2D object to print the footer to.
format - The PageFormat to use.
page - The page number to print.