Class GanttChartPrinter

  • Direct Known Subclasses:
    CompoundGanttChartPrinter

    public class GanttChartPrinter
    extends java.lang.Object
    This class is used to print a GanttChart. For this it will use the already existing functionality of rendering the GanttChart to an image.

    There are some configuration parameters that have impact on:

    • The horizontal range to print - If everything should be printed, by default the range from the earliest event start date to the latest event end date (plus possible text) is used. But configuring a period in the ISettings will also take these values into account for calculating the horizontal range.
    • The vertical range to print - If only the selected part should be printed, by default selection means the visible part of the chart horizontally and vertically. This behavior can be modified so that horizontally only the visible part of the chart will be printed but vertically the whole chart gets printed.
    • The name of the print job
    • Whether a footer should be printed or not
    • The name of the page (can be used for localization)
    • The format of the date in the footer
    See Also:
    ISettings.getPeriodStart(), ISettings.getPeriodEnd(), ISettings.printSelectedVerticallyComplete(), ISettings.printFooter(), ISettings.getDateFormat(), ILanguageManager.getPrintJobText(), ILanguageManager.getPrintPageText()
    • Constructor Summary

      Constructors 
      Constructor Description
      GanttChartPrinter​(GanttChart ganttChart)
      Creates a new GanttChartPrinter for the given GanttChart.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected org.eclipse.swt.graphics.Point getFullPageCount​(org.eclipse.swt.printing.Printer printer)
      Calculates the number of horizontal and vertical pages needed to print the entire chart.
      void print()
      First opens the PrintDialog so a user can adjust his print settings and will then print the chart based on the settings made by the user.
      protected org.eclipse.swt.printing.Printer setupPrinter​(org.eclipse.swt.widgets.Shell shell)
      Opens the PrintDialog to let the user specify the printer and print configurations to use.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

    • Constructor Detail

      • GanttChartPrinter

        public GanttChartPrinter​(GanttChart ganttChart)
        Creates a new GanttChartPrinter for the given GanttChart.
        Parameters:
        ganttChart - The GanttChart that should be printed by this GanttChartPrinter.
    • Method Detail

      • print

        public void print()
        First opens the PrintDialog so a user can adjust his print settings and will then print the chart based on the settings made by the user.
      • setupPrinter

        protected org.eclipse.swt.printing.Printer setupPrinter​(org.eclipse.swt.widgets.Shell shell)
        Opens the PrintDialog to let the user specify the printer and print configurations to use.
        Parameters:
        shell - The Shell which should be the parent for the PrintDialog
        Returns:
        The selected printer with the print configuration made by the user.
      • getFullPageCount

        protected org.eclipse.swt.graphics.Point getFullPageCount​(org.eclipse.swt.printing.Printer printer)
        Calculates the number of horizontal and vertical pages needed to print the entire chart.
        Parameters:
        printer - The printer that is used to determine the page count of a full print.
        Returns:
        The number of horizontal and vertical pages that will be printed.