com.dlsc.flexgantt.swing.print
Class AbstractPrintManager

java.lang.Object
  extended by com.dlsc.flexgantt.swing.print.AbstractPrintManager
All Implemented Interfaces:
IPrintManager
Direct Known Subclasses:
SimpleGranularityPrintManager, TimeGranularityPrintManager

public abstract class AbstractPrintManager
extends java.lang.Object
implements IPrintManager

An abstract implementation of a print manager. The only thing missing to make this a concrete implementation is the method, which creates the controls to change the time span for printing. This control is dependend on the currently used dateline model.

Since:
1.0
Author:
Dirk Lemmermann

Constructor Summary
AbstractPrintManager()
           
 
Method Summary
protected  PreviewDialog createPreviewDialog(javax.swing.JComponent parentComponent)
          Creates the preview dialog and uses the given component to look up the window that will own the dialog.
 java.awt.print.PageFormat getPageFormat()
          Returns the currently used page format settings.
 PrintContext getPrintContext()
          Returns the print context that was passed to the print manager from the printing Gantt chart.
 java.awt.print.PrinterJob getPrinterJob()
          Returns the current printer job.
 PrintGanttChart getPrintGanttChart()
          Returns the printable Gantt chart, which will copy its settings from the Gantt chart requested to be printed.
 void print(javax.swing.JComponent parentComponent, PrintContext printContext, boolean preview)
          Invokes the print operation on the manager.
 void setPageFormat(java.awt.print.PageFormat format)
          Specifies the page format settings to use.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.dlsc.flexgantt.swing.print.IPrintManager
createTimelineControl
 

Constructor Detail

AbstractPrintManager

public AbstractPrintManager()
Method Detail

print

public void print(javax.swing.JComponent parentComponent,
                  PrintContext printContext,
                  boolean preview)
Description copied from interface: IPrintManager
Invokes the print operation on the manager.

Specified by:
print in interface IPrintManager
Parameters:
parentComponent - the UI component from which printing was triggered (needed for hooking up the preview dialog)
printContext - the printing context (depends on the Gantt chart, the dual Gantt chart has two different contexts, the upper and the lower part)
preview - a flag signalling whether a preview dialog has to be shown before printing

createPreviewDialog

protected PreviewDialog createPreviewDialog(javax.swing.JComponent parentComponent)
Creates the preview dialog and uses the given component to look up the window that will own the dialog.

Parameters:
parentComponent - the component used to lookup the owning window for the dialog
Returns:
a preview dialog
Since:
1.0

getPageFormat

public java.awt.print.PageFormat getPageFormat()
Description copied from interface: IPrintManager
Returns the currently used page format settings.

Specified by:
getPageFormat in interface IPrintManager
Returns:
the page format settings

getPrinterJob

public java.awt.print.PrinterJob getPrinterJob()
Description copied from interface: IPrintManager
Returns the current printer job. This method can only be invoked after the print method has been called.

Specified by:
getPrinterJob in interface IPrintManager
Returns:
the current printer job

getPrintContext

public PrintContext getPrintContext()
Description copied from interface: IPrintManager
Returns the print context that was passed to the print manager from the printing Gantt chart. A print context is needed so that the printable Gantt chart (a Gantt chart instance managed by the preview dialog) knows from where to copy the various settings.

Specified by:
getPrintContext in interface IPrintManager
Returns:
the print context used for the preview dialog

setPageFormat

public void setPageFormat(java.awt.print.PageFormat format)
Description copied from interface: IPrintManager
Specifies the page format settings to use. The preview dialog might have changed them via the printer setup or page setup dialog.

Specified by:
setPageFormat in interface IPrintManager
Parameters:
format - the page format settings

getPrintGanttChart

public PrintGanttChart getPrintGanttChart()
Description copied from interface: IPrintManager
Returns the printable Gantt chart, which will copy its settings from the Gantt chart requested to be printed.

Specified by:
getPrintGanttChart in interface IPrintManager
Returns:
a Gantt chart used for printing