org.formaria.print
Class Printout

java.lang.Object
  extended by org.formaria.print.Printout

public class Printout
extends java.lang.Object

A print engine for printing pages

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.3 $


Field Summary
static int CENTER
          Position the header or footer to the center of the page
static int LEFT
          Position the header or footer to the left of the page
static int RIGHT
          Position the header or footer to the right of the page
 
Constructor Summary
Printout()
          Create a new printout
Printout(java.awt.print.Paper paper)
          Create a new printout
 
Method Summary
 void addFrame(PrintableFrameSet frameset)
          Add a frameset to the printout.
 void addPage(java.awt.Container page)
          Add a page or container to the book being printed
static java.awt.print.PageFormat getDefaultPage()
          Get the default page format
 java.lang.String getHeaderStyle()
          Get the style used in the header and footer
 void print()
          Initiate the printing
 int printDecoration(java.awt.Graphics2D g, java.awt.print.PageFormat pf, boolean top, int position, double x, double y, java.awt.FontMetrics fm)
          Print the header or footer decorations for the document
 void setFooter(java.lang.Object text, int position)
          Set the footer
 void setHeader(java.lang.Object text, int position)
          Set the header
 void setHeaderStyle(java.lang.String styleName)
          Set the style used for the headers and footers
 void setJobName(java.lang.String name)
          Set the name that will appear in the operating system task list
 void setPageNumbers(boolean top, int position, java.lang.String format)
          Set the name that will appear in the operating system task list
 java.awt.print.PageFormat showPageFormat()
          Show the page format dialog.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LEFT

public static final int LEFT
Position the header or footer to the left of the page

See Also:
Constant Field Values

CENTER

public static final int CENTER
Position the header or footer to the center of the page

See Also:
Constant Field Values

RIGHT

public static final int RIGHT
Position the header or footer to the right of the page

See Also:
Constant Field Values
Constructor Detail

Printout

public Printout()
Create a new printout


Printout

public Printout(java.awt.print.Paper paper)
Create a new printout

Parameters:
paper - the paper specification for this printout
Method Detail

getDefaultPage

public static java.awt.print.PageFormat getDefaultPage()
Get the default page format

Returns:
the default page format

addPage

public void addPage(java.awt.Container page)
Add a page or container to the book being printed

Parameters:
page - the page or content

addFrame

public void addFrame(PrintableFrameSet frameset)
Add a frameset to the printout. Each frame in the frameset will be printed

Parameters:
frameset - the frameset

showPageFormat

public java.awt.print.PageFormat showPageFormat()
Show the page format dialog. The dialog allows the setup of the page margins

Returns:
the updated page format

print

public void print()
Initiate the printing


setJobName

public void setJobName(java.lang.String name)
Set the name that will appear in the operating system task list

Parameters:
name - the job name

setHeader

public void setHeader(java.lang.Object text,
                      int position)
Set the header

Parameters:
text - the header text
position - the text postition

setFooter

public void setFooter(java.lang.Object text,
                      int position)
Set the footer

Parameters:
text - the header text
position - the text postition

setPageNumbers

public void setPageNumbers(boolean top,
                           int position,
                           java.lang.String format)
Set the name that will appear in the operating system task list

Parameters:
top - true to add the page numbers to the header, false for the footer
position - the text postition
format - the page number format

printDecoration

public int printDecoration(java.awt.Graphics2D g,
                           java.awt.print.PageFormat pf,
                           boolean top,
                           int position,
                           double x,
                           double y,
                           java.awt.FontMetrics fm)
Print the header or footer decorations for the document

Parameters:
g - the graphics context
pf - the page setup
top - true for header objects
position - the poition withing the header/footer
x - the x starting position of the decoration
y - the y starting position of the decoration
fm - the font metriucs of the header/footer font
Returns:
the decoration height

setHeaderStyle

public void setHeaderStyle(java.lang.String styleName)
Set the style used for the headers and footers

Parameters:
styleName - the style name

getHeaderStyle

public java.lang.String getHeaderStyle()
Get the style used in the header and footer

Returns:
the style name