Class LayerPrinter
java.lang.Object
org.eclipse.nebula.widgets.nattable.print.LayerPrinter
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
FieldsModifier and TypeFieldDescriptionstatic final intprotected boolean -
Constructor Summary
ConstructorsConstructorDescriptionLayerPrinter(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
Modifier and TypeMethodDescriptionvoidaddPrintListener(PrintListener listener) Add the givenPrintListenerto be able to react on printing events like print start and print finished.voidaddPrintTarget(ILayer layer, IConfigRegistry configRegistry) Adds the givenILayeras print target.voidaddPrintTarget(ILayer layer, ILayer repeatHeaderLayer, IConfigRegistry configRegistry) Adds the givenILayeras print target.voidDisable page count calculation for opening the print dialog.voidDisable in-memory pre-rendering.voidEnable page count calculation for opening the print dialog.voidEnable in-memory pre-rendering.protected intprotected Integer[]getGridLineWidth(IConfigRegistry configRegistry) voidjoinPrintTargets(boolean join) Configure whether multiple print targets should be joined for printing or not.voidprint(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.voidremovePrintListener(PrintListener listener) Removes the givenPrintListener.
-
Field Details
-
FOOTER_HEIGHT_IN_PRINTER_DPI
public static final int FOOTER_HEIGHT_IN_PRINTER_DPI- See Also:
-
preRender
protected boolean preRender- Since:
- 1.4
-
-
Constructor Details
-
LayerPrinter
- Parameters:
layer- The layer to print. Usually the NatTable instance itself or the top most layer in the layer stack.configRegistry- TheIConfigRegistrythat contains the general print configurations and that should be used to print the givenILayer.
-
LayerPrinter
- 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- TheIConfigRegistrythat contains the general print configurations and that should be used to print the givenILayer.- Since:
- 1.5
-
LayerPrinter
- Parameters:
layer- The layer to print. Usually the NatTable instance itself or the top most layer in the layer stack.configRegistry- TheIConfigRegistrythat 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- TheIConfigRegistrythat 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 Details
-
addPrintTarget
Adds the givenILayeras print target. It can be used to register multiple NatTable or layer stacks in one print job.- Parameters:
layer- TheILayerthat should be printed together with the mainILayerregistered via constructor.configRegistry- TheIConfigRegistrythat should be used to print the givenILayer.- Since:
- 1.5
-
addPrintTarget
Adds the givenILayeras 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- TheILayerthat should be printed together with the mainILayerregistered 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- TheIConfigRegistrythat 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-trueif the print targets should be printed consecutively,falseif every print target should start with a new page. Default isfalse.- Since:
- 1.5
-
getGridLineWidth
- Parameters:
configRegistry- TheIConfigRegistryto 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
Add the givenPrintListenerto be able to react on printing events like print start and print finished.- Parameters:
listener- ThePrintListenerto add.- Since:
- 1.6
-
removePrintListener
Removes the givenPrintListener.- Parameters:
listener- ThePrintListenerto remove.- Since:
- 1.6
-