org.formaria.print
Class PrintablePage

java.lang.Object
  extended by org.formaria.print.PrintablePage
All Implemented Interfaces:
java.awt.print.Printable

public class PrintablePage
extends java.lang.Object
implements java.awt.print.Printable

A decoration of the Page to allow printing. The class can also support printing in panels or other containers.

Copyright (c) Formaria Ltd., 2008, This software is licensed under the GNU Public License (GPL), please see license.txt for more details. If you make commercial use of this software you must purchase a commercial license from Formaria.

$Revision: 1.4 $


Field Summary
protected  java.awt.Container currentPage
          The current page or container being printed
protected  Project currentProject
          The owner project and the context in which this object operates.
protected  Printout printout
          The PrintOut class to which this printable page belongs
 
Fields inherited from interface java.awt.print.Printable
NO_SUCH_PAGE, PAGE_EXISTS
 
Constructor Summary
PrintablePage(java.awt.Container page, Printout po)
          Create a new printable page
 
Method Summary
 java.awt.Container getPage()
          Get the page or container wrapped by this class.
 int print(java.awt.Graphics g, java.awt.print.PageFormat pf, int pageIndex)
          Print the page
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

currentPage

protected java.awt.Container currentPage
The current page or container being printed


printout

protected Printout printout
The PrintOut class to which this printable page belongs


currentProject

protected Project currentProject
The owner project and the context in which this object operates.

Constructor Detail

PrintablePage

public PrintablePage(java.awt.Container page,
                     Printout po)
Create a new printable page

Parameters:
page - The page or container to be printed
po - The printout that will 'own' the printable page
Method Detail

print

public int print(java.awt.Graphics g,
                 java.awt.print.PageFormat pf,
                 int pageIndex)
          throws java.awt.print.PrinterException
Print the page

Specified by:
print in interface java.awt.print.Printable
Parameters:
g - The graphics context
pf - the page format
pageIndex - the index of the page within the printout page set
Returns:
Printable.PAGE_EXISTS on success
Throws:
java.awt.print.PrinterException - Some printing exception occured

getPage

public java.awt.Container getPage()
Get the page or container wrapped by this class.

Returns:
the wrapped container