com.sas.awt.print
Class PrintJob

java.lang.Object
  |
  +--com.sas.awt.print.PrintJob
All Implemented Interfaces:

public abstract class PrintJob
extends java.lang.Object
implements java.awt.print.Printable

The PrintJob class is the principal class that controls printing. An application calls methods in this class to set up a job, optionally to invoke a print dialog with the user, and then to print the pages of the job. A PrintJob is only valid for a single job; it cannot be reused.


Fields inherited from interface java.awt.print.Printable
NO_SUCH_PAGE, PAGE_EXISTS
 
Constructor Summary
PrintJob()
          A PrintJob object should be created using the static getPrintJob method.
 
Method Summary
 PageFormat defaultPage()
          Creates a new PageFormat instance and sets it to a default size and orientation.
abstract  PageFormat defaultPage(PageFormat page)
          Clones the PageFormat argument and alters the clone to describe a default page size and orientation.
static PrintJob getPrintJob(PrintGraphics g)
          Creates and returns a PrintJob.
static PageFormat pageDialog(PageFormat page)
          Displays a dialog that allows modification of a PageFormat instance.
static PageFormat pageDialog(PageFormat page, Frame parent)
          Displays a dialog that allows modification of a PageFormat instance.
static PageFormat pageDialog(PageFormat page, Frame parent, OrderedCollection annotations, OrderedCollection toolbarAnnotations)
           
static PageFormat pageDialog(PageFormat page, Frame appFrame, Window parent, OrderedCollection annotations, OrderedCollection toolbarAnnotations)
          Displays a dialog that allows modification of a PageFormat instance.
abstract  void print()
          Calls the PrintableInterface or PageableInterface set to actually print the set of pages
abstract  void setPageable(PageableInterface document)
          Queries document for the number of pages and the PageFormat and PrintableInterface for each page held in the PageableInterface instance, document.
abstract  void setPrintable(PrintableInterface printable)
          Sets printable to render the pages.
abstract  void setPrintable(PrintableInterface printable, PageFormat format)
          Sets printable to render the pages in the specified format.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.awt.print.Printable
print
 

Constructor Detail

PrintJob

public PrintJob()
A PrintJob object should be created using the static getPrintJob method.
Method Detail

getPrintJob

public static PrintJob getPrintJob(PrintGraphics g)
Creates and returns a PrintJob.
Returns:
a new PrintJob.

setPrintable

public abstract void setPrintable(PrintableInterface printable)
Sets printable to render the pages. The pages in the document to be printed by this PrintJob are rendered by the PrintableInterface object, printable. The PageFormat for each page is the default page format.
Parameters:
printable - the PrintableInterface that renders each page of the document.

setPrintable

public abstract void setPrintable(PrintableInterface printable,
                                  PageFormat format)
Sets printable to render the pages in the specified format. The pages in the document to be printed by this PrintJob are rendered by the PrintableInterface object, printable. The PageFormat of each page is format.
Parameters:
printable - the PrintableInterface called to render each page of the document
format - the size and orientation of each page to be printed

setPageable

public abstract void setPageable(PageableInterface document)
                          throws NullPointerException
Queries document for the number of pages and the PageFormat and PrintableInterface for each page held in the PageableInterface instance, document.
Parameters:
document - the pages to be printed. It can not be null.
Throws:
NullPointerException - the PageableInterface passed in was null.
See Also:
PageFormat, PrintableInterface

pageDialog

public static PageFormat pageDialog(PageFormat page)
Displays a dialog that allows modification of a PageFormat instance. The page argument is used to initialize controls in the page setup dialog. If the user cancels the dialog then this method returns the original page object unmodified. If the user okays the dialog then this method returns a new PageFormat object with the indicated changes. In either case, the original page object is not modified.
Parameters:
page - the default PageFormat presented to the user for modification
Returns:
the original page object if the dialog is cancelled; a new PageFormat object containing the format indicated by the user if the dialog is acknowledged.

print

public abstract void print()
                    throws PrintException
Calls the PrintableInterface or PageableInterface set to actually print the set of pages
See Also:
Book, PageableInterface, PrintableInterface

pageDialog

public static PageFormat pageDialog(PageFormat page,
                                    Frame parent)
Displays a dialog that allows modification of a PageFormat instance. The page argument is used to initialize controls in the page setup dialog. If the user cancels the dialog then this method returns the original page object unmodified. If the user okays the dialog then this method returns a new PageFormat object with the indicated changes. In either case, the original page object is not modified.
Parameters:
page - the default PageFormat presented to the user for modification
parent - the parent frame; if non-null, the dialog will be centered over this
Returns:
the original page object if the dialog is cancelled; a new PageFormat object containing the format indicated by the user if the dialog is acknowledged.

pageDialog

public static PageFormat pageDialog(PageFormat page,
                                    Frame parent,
                                    OrderedCollection annotations,
                                    OrderedCollection toolbarAnnotations)

pageDialog

public static PageFormat pageDialog(PageFormat page,
                                    Frame appFrame,
                                    Window parent,
                                    OrderedCollection annotations,
                                    OrderedCollection toolbarAnnotations)
Displays a dialog that allows modification of a PageFormat instance. The page argument is used to initialize controls in the page setup dialog. If the user cancels the dialog then this method returns the original page object unmodified. If the user okays the dialog then this method returns a new PageFormat object with the indicated changes. In either case, the original page object is not modified.
Parameters:
page - the default PageFormat presented to the user for modification
parentFrame - the parent frame; if non-null, the dialog will be centered over this if no secondary window passed in parent parm
parent - the alternate parent window; if null, the parent frame is used for cursor changes and to center this dialog
annotations - an OrderedCollection of AnnotationInterface objects that define custom annotations for the Page Setup dialog
toolbarAnnotations - an OrderedCollection of Pair objects that define custom toolbar elements for the Custom Header/Footer dialog invoked by the Page Setup Dialog; the first item in each Pair specifies the text to be displayed, and the second item in each Pair specifies an IconInterface object that is displayed on the toolbar
Returns:
the original page object if the dialog is cancelled; a new PageFormat object containing the format indicated by the user if the dialog is acknowledged.
See Also:
OrderedCollection, IconInterface

defaultPage

public abstract PageFormat defaultPage(PageFormat page)
Clones the PageFormat argument and alters the clone to describe a default page size and orientation.
Parameters:
page - the PageFormat to be cloned and altered
Returns:
clone of page, altered to describe a default PageFormat.

defaultPage

public PageFormat defaultPage()
Creates a new PageFormat instance and sets it to a default size and orientation.
Returns:
a PageFormat set to a default size and orientation.




Copyright © 2005 SAS Institute Inc. All Rights Reserved.
javadoc generated Thu, 16 Feb 2006 01:47:35