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

java.lang.Object
  |
  +--edu.rice.cs.drjava.model.print.DrJavaBook
All Implemented Interfaces:
Pageable

public class DrJavaBook
extends Object
implements Pageable

The DrJavaBook class in DrJava's implementation of a Pageable object. It serves as the control class for printing, and is responsible for preparing the print job of previewing or printing given the String representation of the document.

Version:
$Id: DrJavaBook.java,v 1.2 2002/04/02 05:53:44 amislove Exp $

Field Summary
private  String _filename
           
private  PageFormat _format
           
private  Vector _pagePrinters
           
private static FontRenderContext DEFAULT_FRC
           
static Font FOOTER_FONT
           
static Font LINE_FONT
           
 float LINE_NUMBER_WIDTH
           
static Font PRINT_FONT
           
 
Fields inherited from interface java.awt.print.Pageable
UNKNOWN_NUMBER_OF_PAGES
 
Constructor Summary
DrJavaBook(String text, String filename, PageFormat format)
          Constructs a DrJavaBook which a given content text, filename, and pageformat.
 
Method Summary
 int getNumberOfPages()
          Method to comply with the Pageable interface
 PageFormat getPageFormat(int pageIndex)
          Method to comply with the Pageable interface
 Printable getPrintable(int pageIndex)
          Method to comply with the Pageable interface, returns the Printable object for a given page.
private  void setUpPagePrinters(String text)
          Method which creates all of the individual Printable objects given a String text.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

_pagePrinters

private Vector _pagePrinters

_format

private PageFormat _format

_filename

private String _filename

PRINT_FONT

public static Font PRINT_FONT

FOOTER_FONT

public static Font FOOTER_FONT

LINE_FONT

public static Font LINE_FONT

LINE_NUMBER_WIDTH

public float LINE_NUMBER_WIDTH

DEFAULT_FRC

private static FontRenderContext DEFAULT_FRC
Constructor Detail

DrJavaBook

public DrJavaBook(String text,
                  String filename,
                  PageFormat format)
Constructs a DrJavaBook which a given content text, filename, and pageformat.
Method Detail

setUpPagePrinters

private void setUpPagePrinters(String text)
Method which creates all of the individual Printable objects given a String text.
Parameters:
text - The text of the document.

getNumberOfPages

public int getNumberOfPages()
Method to comply with the Pageable interface
Specified by:
getNumberOfPages in interface Pageable
Returns:
The number of pages in this print job.

getPageFormat

public PageFormat getPageFormat(int pageIndex)
Method to comply with the Pageable interface
Specified by:
getPageFormat in interface Pageable
Parameters:
pageIndex - The page number
Returns:
the PageFormat of this print job.

getPrintable

public Printable getPrintable(int pageIndex)
Method to comply with the Pageable interface, returns the Printable object for a given page.
Specified by:
getPrintable in interface Pageable
Parameters:
pageIndex - The page number.
Returns:
The Printable object for the given page.