|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.tentackle.print.PrintHelper
public class PrintHelper
Utility methods for printing.
| Constructor Summary | |
|---|---|
PrintHelper()
|
|
| Method Summary | |
|---|---|
static boolean |
adjustGraphics2D(Graphics2D g,
PageFormat format)
Adjusts the graphics context according to the given format. The job can be printed in two ways: by job.print() and by job.print(aset). |
static MediaSizeName |
getMediaSizeName()
Gets the media size name. |
static PageFormat |
getPageFormat(PrintRequestAttributeSet aset)
Builds a pageformat from an attribute set. This is the "missing" link between printDialog(aset) and setting the pageFormat without calling pageDialog(). |
static Runnable |
getRunAfterPrint()
Gets the Runnable to be invoked after job.print(aset). |
static Runnable |
getRunBeforePrint()
Gets the Runnable to be invoked before job.print(aset). |
static boolean |
print(Printable printable,
String jobName)
Asks the user for a printer and settings and prints a printable. |
static PageFormat |
print(PrinterJob job,
String jobName,
PrintRequestAttributeSet aset)
Asks the user for a printer and settings and return the pageformat. Does not print! Use printJob(java.awt.print.PrinterJob, javax.print.attribute.PrintRequestAttributeSet, boolean) to print. |
static WorkerThread |
printJob(PrinterJob job,
PrintRequestAttributeSet aset)
Prints a job in separate thread in a modal dialog. |
static WorkerThread |
printJob(PrinterJob job,
PrintRequestAttributeSet aset,
boolean modal)
Prints a job in separate worker thread while displaying a printing worker dialog. Requests are automatically queued in background if jobs are not finished yet. |
static void |
setMediaSizeName(MediaSizeName name)
Sets the media size. |
static void |
setRunAfterPrint(Runnable run)
Sets a Runnable to be invoked after job.print(aset). |
static void |
setRunBeforePrint(Runnable run)
Sets a Runnable to be invoked before job.print(aset). |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public PrintHelper()
| Method Detail |
|---|
public static boolean print(Printable printable,
String jobName)
printable - the printablejobName - the name of the job
public static PageFormat print(PrinterJob job,
String jobName,
PrintRequestAttributeSet aset)
printJob(java.awt.print.PrinterJob, javax.print.attribute.PrintRequestAttributeSet, boolean) to print.
job - is the new printerjobjobName - is the jobname, null = noneaset - is an initialized (and possibly empty) attribute set, must not be null, because its returned!
public static boolean adjustGraphics2D(Graphics2D g,
PageFormat format)
g - the graphics contextformat - the pageformat
public static PageFormat getPageFormat(PrintRequestAttributeSet aset)
aset - the attribute set
public static WorkerThread printJob(PrinterJob job,
PrintRequestAttributeSet aset,
boolean modal)
job - the printer jobaset - the printing attributesmodal - true if modal dialog
public static WorkerThread printJob(PrinterJob job,
PrintRequestAttributeSet aset)
job - the printer jobaset - the printing attributes
printJob(java.awt.print.PrinterJob, javax.print.attribute.PrintRequestAttributeSet, boolean)public static void setMediaSizeName(MediaSizeName name)
name - the MediaSizeNamepublic static MediaSizeName getMediaSizeName()
public static void setRunBeforePrint(Runnable run)
run - the runnablepublic static Runnable getRunBeforePrint()
public static void setRunAfterPrint(Runnable run)
run - the runnablepublic static Runnable getRunAfterPrint()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||