Class GanttChartPrintJob
- java.lang.Object
-
- org.eclipse.nebula.widgets.ganttchart.print.GanttChartPrintJob
-
- All Implemented Interfaces:
java.lang.Runnable
public class GanttChartPrintJob extends java.lang.Object implements java.lang.Runnable
Runnable to print one ore more GanttCharts.
-
-
Field Summary
Fields Modifier and Type Field Description private boolean
disposePrinter
private GanttChart[]
ganttCharts
private java.lang.String
jobName
private org.eclipse.swt.printing.Printer
printer
-
Constructor Summary
Constructors Constructor Description GanttChartPrintJob(org.eclipse.swt.printing.Printer printer, java.lang.String jobName, boolean disposePrinter, GanttChart... charts)
Creates a new GanttChartPrintJob that uses the given printer and print job name to print the specified GanttChart(s).GanttChartPrintJob(org.eclipse.swt.printing.Printer printer, java.lang.String jobName, GanttChart... charts)
Creates a new GanttChartPrintJob that uses the given printer and print job name to print the specified GanttChart(s).
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
printFooter(org.eclipse.swt.graphics.GC gc, GanttChart ganttChart, int currentPage, org.eclipse.swt.graphics.Rectangle printBounds)
Render the footer to a print page.void
run()
void
setDisposePrinter(boolean dispose)
private boolean
shouldPrint(org.eclipse.swt.printing.PrinterData printerData, int currentPage)
Checks if a given page number should be printed.
-
-
-
Field Detail
-
printer
private final org.eclipse.swt.printing.Printer printer
-
jobName
private final java.lang.String jobName
-
ganttCharts
private final GanttChart[] ganttCharts
-
disposePrinter
private boolean disposePrinter
-
-
Constructor Detail
-
GanttChartPrintJob
public GanttChartPrintJob(org.eclipse.swt.printing.Printer printer, java.lang.String jobName, GanttChart... charts)
Creates a new GanttChartPrintJob that uses the given printer and print job name to print the specified GanttChart(s). If not changed afterwards, running this job will dispose the given printer when it is done.- Parameters:
printer
- The printer to use.jobName
- The job name to use for the print job.charts
- The GanttCharts that should be printed.
-
GanttChartPrintJob
public GanttChartPrintJob(org.eclipse.swt.printing.Printer printer, java.lang.String jobName, boolean disposePrinter, GanttChart... charts)
Creates a new GanttChartPrintJob that uses the given printer and print job name to print the specified GanttChart(s).- Parameters:
printer
- The printer to use.jobName
- The job name to use for the print job.charts
- The GanttCharts that should be printed.disposePrinter
- Flag to configure whether the given printer should be disposed after the print job is done. Default istrue
. Only set this parameter tofalse
if the printer should be reused for additional print jobs. You need to ensure that the printer will get disposed yourself in that case!
-
-
Method Detail
-
run
public void run()
- Specified by:
run
in interfacejava.lang.Runnable
-
printFooter
private void printFooter(org.eclipse.swt.graphics.GC gc, GanttChart ganttChart, int currentPage, org.eclipse.swt.graphics.Rectangle printBounds)
Render the footer to a print page.- Parameters:
gc
- The graphical context that is used for printingganttChart
- The GanttChart which is currently printed.currentPage
- The number of the current page that is printedprintBounds
- The bounds of the print area
-
shouldPrint
private boolean shouldPrint(org.eclipse.swt.printing.PrinterData printerData, int currentPage)
Checks if a given page number should be printed. Page is allowed to print if: User asked to print all pages or page in a specified range- Parameters:
printerData
- The printer settings made by the user. Needed to determine if a page should be printed dependent to the scopecurrentPage
- The page that should be checked- Returns:
true
if the given page should be printed,false
if not
-
setDisposePrinter
public void setDisposePrinter(boolean dispose)
- Parameters:
dispose
-true
if the printer that is set to this GanttChartPrintJob should be disposed after the print job is done,false
if it should not be disposed so the printer can be reused for additional tasks.
-
-