Class LayerPrinter
- java.lang.Object
-
- org.eclipse.nebula.widgets.nattable.print.LayerPrinter
-
public class LayerPrinter extends Object
This class is used to print a layer. Usually you create an instance by using the top most layer in the layer stack. For grids this is the GridLayer, otherwise the ViewportLayer is a good choice.
-
-
Field Summary
Fields Modifier and Type Field Description static int
FOOTER_HEIGHT_IN_PRINTER_DPI
protected boolean
preRender
-
Constructor Summary
Constructors Constructor Description LayerPrinter(ILayer layer, IConfigRegistry configRegistry)
LayerPrinter(ILayer layer, IConfigRegistry configRegistry, boolean repeat)
LayerPrinter(ILayer layer, ILayer repeatHeaderLayer, IConfigRegistry configRegistry)
LayerPrinter(ILayer layer, ILayer repeatHeaderLayer, IConfigRegistry configRegistry, boolean repeat)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addPrintListener(PrintListener listener)
Add the givenPrintListener
to be able to react on printing events like print start and print finished.void
addPrintTarget(ILayer layer, IConfigRegistry configRegistry)
Adds the givenILayer
as print target.void
addPrintTarget(ILayer layer, ILayer repeatHeaderLayer, IConfigRegistry configRegistry)
Adds the givenILayer
as print target.void
disablePageCountCalculation()
Disable page count calculation for opening the print dialog.void
disablePreRendering()
Disable in-memory pre-rendering.void
enablePageCountCalculation()
Enable page count calculation for opening the print dialog.void
enablePreRendering()
Enable in-memory pre-rendering.protected int
getFooterHeightInPrinterDPI()
protected Integer[]
getGridLineWidth(IConfigRegistry configRegistry)
void
joinPrintTargets(boolean join)
Configure whether multiple print targets should be joined for printing or not.void
print(org.eclipse.swt.widgets.Shell shell)
Will first open the PrintDialog to let a user configure the print job and then starts the print job.void
removePrintListener(PrintListener listener)
Removes the givenPrintListener
.
-
-
-
Field Detail
-
FOOTER_HEIGHT_IN_PRINTER_DPI
public static final int FOOTER_HEIGHT_IN_PRINTER_DPI
- See Also:
- Constant Field Values
-
preRender
protected boolean preRender
- Since:
- 1.4
-
-
Constructor Detail
-
LayerPrinter
public LayerPrinter(ILayer layer, IConfigRegistry configRegistry)
- Parameters:
layer
- The layer to print. Usually the NatTable instance itself or the top most layer in the layer stack.configRegistry
- TheIConfigRegistry
that contains the general print configurations and that should be used to print the givenILayer
.
-
LayerPrinter
public LayerPrinter(ILayer layer, ILayer repeatHeaderLayer, IConfigRegistry configRegistry)
- Parameters:
layer
- The layer to print. Usually the NatTable instance itself or the top most layer in the layer stack.repeatHeaderLayer
- The layer that is part of the layer main layer composition that should be repeated on every page. Typically the column header layer.configRegistry
- TheIConfigRegistry
that contains the general print configurations and that should be used to print the givenILayer
.- Since:
- 1.5
-
LayerPrinter
public LayerPrinter(ILayer layer, IConfigRegistry configRegistry, boolean repeat)
- Parameters:
layer
- The layer to print. Usually the NatTable instance itself or the top most layer in the layer stack.configRegistry
- TheIConfigRegistry
that contains the general print configurations and that should be used to print the givenILayer
.repeat
- Flag to configure whether the given layer should be printed on every page. Needed for example in case an additional header layer is used outside the main table.- Since:
- 1.5
-
LayerPrinter
public LayerPrinter(ILayer layer, ILayer repeatHeaderLayer, IConfigRegistry configRegistry, boolean repeat)
- Parameters:
layer
- The layer to print. Usually the NatTable instance itself or the top most layer in the layer stack.repeatHeaderLayer
- The layer that is part of the layer main layer composition that should be repeated on every page. Typically the column header layer.configRegistry
- TheIConfigRegistry
that contains the general print configurations and that should be used to print the givenILayer
.repeat
- Flag to configure whether the given layer should be printed on every page. Needed for example in case an additional header layer is used outside the main table.- Since:
- 1.5
-
-
Method Detail
-
addPrintTarget
public void addPrintTarget(ILayer layer, IConfigRegistry configRegistry)
Adds the givenILayer
as print target. It can be used to register multiple NatTable or layer stacks in one print job.- Parameters:
layer
- TheILayer
that should be printed together with the mainILayer
registered via constructor.configRegistry
- TheIConfigRegistry
that should be used to print the givenILayer
.- Since:
- 1.5
-
addPrintTarget
public void addPrintTarget(ILayer layer, ILayer repeatHeaderLayer, IConfigRegistry configRegistry)
Adds the givenILayer
as print target. It can be used to register multiple NatTable or layer stacks in one print job. This method also allows to specify the layer that should be repeated on every page, e.g. the column header layer in a grid composition.- Parameters:
layer
- TheILayer
that should be printed together with the mainILayer
registered via constructor.repeatHeaderLayer
- The layer that is part of the layer main layer composition that should be repeated on every page. Typically the column header layer.configRegistry
- TheIConfigRegistry
that should be used to print the givenILayer
.- Since:
- 1.5
-
joinPrintTargets
public void joinPrintTargets(boolean join)
Configure whether multiple print targets should be joined for printing or not.- Parameters:
join
-true
if the print targets should be printed consecutively,false
if every print target should start with a new page. Default isfalse
.- Since:
- 1.5
-
getFooterHeightInPrinterDPI
protected int getFooterHeightInPrinterDPI()
- Returns:
- The footer height in printer DPI that should be used to render the footer.
- Since:
- 1.5
-
getGridLineWidth
protected Integer[] getGridLineWidth(IConfigRegistry configRegistry)
- Parameters:
configRegistry
- TheIConfigRegistry
to retrieve the grid line width from.- Returns:
- Integer array that contains the original configured width at index 0 and the grid line width to use at index 1.
- Since:
- 1.5
-
print
public void print(org.eclipse.swt.widgets.Shell shell)
Will first open the PrintDialog to let a user configure the print job and then starts the print job.- Parameters:
shell
- The shell which should be the parent of the PrintDialog.
-
enablePreRendering
public void enablePreRendering()
Enable in-memory pre-rendering. This is necessary in case content painters are used that are configured for content based auto-resizing.- Since:
- 1.4
-
disablePreRendering
public void disablePreRendering()
Disable in-memory pre-rendering. You should consider to disable pre-rendering if no content painters are used that are configured for content based auto-resizing.- Since:
- 1.4
-
enablePageCountCalculation
public void enablePageCountCalculation()
Enable page count calculation for opening the print dialog. This will show the total page count in the print dialog.- Since:
- 1.5
-
disablePageCountCalculation
public void disablePageCountCalculation()
Disable page count calculation for opening the print dialog. The page count is pre-calculated to show how many pages are printed. This pre-calculation can take some time for more complicated print setups. Therefore it may be useful to disable that pre-calculation to get a better user experience on opening the print dialog.- Since:
- 1.5
-
addPrintListener
public void addPrintListener(PrintListener listener)
Add the givenPrintListener
to be able to react on printing events like print start and print finished.- Parameters:
listener
- ThePrintListener
to add.- Since:
- 1.6
-
removePrintListener
public void removePrintListener(PrintListener listener)
Removes the givenPrintListener
.- Parameters:
listener
- ThePrintListener
to remove.- Since:
- 1.6
-
-