Package megameklab.printing
Class RecordSheetTask
- All Implemented Interfaces:
Runnable,Future<Void>,RunnableFuture<Void>
Renders one or more record sheets as a background task. The task is created using
createPrintTask(List, PrinterJob, PrintRequestAttributeSet, PageFormat) for output to a printer and
createExportTask(List, PageFormat, String) for export to a PDF file.
Executing the task with execute(boolean) allows showing a popup dialog with a progress bar.
-
Nested Class Summary
Nested classes/interfaces inherited from class javax.swing.SwingWorker
SwingWorker.StateValueNested classes/interfaces inherited from interface java.util.concurrent.Future
Future.State -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic RecordSheetTaskcreateExportTask(List<PrintRecordSheet> sheets, PageFormat pageFormat, String pathName) Creates a task for rendering a list of record sheets as a print job.static RecordSheetTaskcreatePrintTask(List<PrintRecordSheet> sheets, PrinterJob job, PrintRequestAttributeSet printRequestAttributeSet, PageFormat pageFormat) Creates a task for rendering a list of record sheets as a print jobprotected voiddone()voidexecute(boolean showProgressBar) Begins execution with the option to show a progress bar.protected abstract Stringprotected voidMethods inherited from class javax.swing.SwingWorker
addPropertyChangeListener, cancel, doInBackground, execute, firePropertyChange, get, get, getProgress, getPropertyChangeSupport, getState, isCancelled, isDone, publish, removePropertyChangeListener, run, setProgressMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.concurrent.Future
exceptionNow, resultNow, state
-
Field Details
-
sheets
-
-
Method Details
-
createPrintTask
public static RecordSheetTask createPrintTask(List<PrintRecordSheet> sheets, PrinterJob job, PrintRequestAttributeSet printRequestAttributeSet, PageFormat pageFormat) Creates a task for rendering a list of record sheets as a print job- Parameters:
sheets- The sheets to render The contents are removed as each sheet is processed to avoid running out of memory on large jobs.job- The print jobprintRequestAttributeSet- A set of attributes to use for printingpageFormat- The page format- Returns:
- A
SwingWorkertask
-
createExportTask
public static RecordSheetTask createExportTask(List<PrintRecordSheet> sheets, PageFormat pageFormat, String pathName) Creates a task for rendering a list of record sheets as a print job.- Parameters:
sheets- The sheets to render. The contents are removed as each sheet is processed to avoid running out of memory on large jobs.pageFormat- The page formatpathName- The path to the PDF output file- Returns:
- A
SwingWorkertask
-
execute
public void execute(boolean showProgressBar) Begins execution with the option to show a progress bar.- Parameters:
showProgressBar- Whether to show the progress popup dialog
-
popupLabel
-
process
- Overrides:
processin classSwingWorker<Void,Integer>
-
done
protected void done()- Overrides:
donein classSwingWorker<Void,Integer>
-