Class PrintHelper
java.lang.Object
net.simplace.ui.service.PrintHelper
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intDocument type HTML (currently unused)static final intDocument type PDF (currently unused)static final intDocument type RTF (currently unused)Fields inherited from interface Printable
NO_SUCH_PAGE, PAGE_EXISTS -
Method Summary
Modifier and TypeMethodDescriptionstatic voidPrints a GUI component on a printer.static voidPrints a GUI component on a printer.intprint(Graphics g, PageFormat pf, int pageIndex) Renders one page of the component.voidrun()Handles the whole printing process.
-
Field Details
-
TYPE_PDF
public static final int TYPE_PDFDocument type PDF (currently unused)- See Also:
-
TYPE_RTF
public static final int TYPE_RTFDocument type RTF (currently unused)- See Also:
-
TYPE_HTML
public static final int TYPE_HTMLDocument type HTML (currently unused)- See Also:
-
-
Method Details
-
print
public static void print(Component aComponent, net.simplace.core.FWObservable aObservable) throws PrinterException Prints a GUI component on a printer. Before printing is started, a cross-platform dialog appears to the user who can select the desired printer and customise the print properties. If the print dialog is canceled, no print job will start.- Parameters:
aComponent- a GUI component to be printedaObservable- not used- Throws:
PrinterException- if the print thread could not be started- See Also:
-
print
Prints a GUI component on a printer. Printing runs in a separate thread. Before printing is started, a cross-platform dialog appears to the user who can select the desired printer and customise the print properties. If the print dialog is canceled, no print job will start. The component is scaled to the page width and split over as many pages as needed.Errors in the print thread (no print service available, print job aborted) are thrown as
RuntimeExceptionin that thread and do not reach the caller.- Parameters:
aComponent- a GUI component to be printed- Throws:
PrinterException- if the print thread could not be started (e.g. aComponent isnull)
-
run
public void run()Handles the whole printing process.
Note: it's implemented in a new thread because looking up the printing device takes a lot of time- Specified by:
runin interfaceRunnable- Throws:
RuntimeException- if no print service is available or the print job fails
-
print
Renders one page of the component. The component is scaled to the imageable page width and split vertically into pages.
-