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 Details

    • preRender

      protected boolean preRender
      Since:
      1.4
  • Constructor Details

    • 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 - The IConfigRegistry that contains the general print configurations and that should be used to print the given ILayer.
    • 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 - The IConfigRegistry that contains the general print configurations and that should be used to print the given ILayer.
      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 - The IConfigRegistry that contains the general print configurations and that should be used to print the given ILayer.
      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 - The IConfigRegistry that contains the general print configurations and that should be used to print the given ILayer.
      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

      public void addPrintTarget(ILayer layer, IConfigRegistry configRegistry)
      Adds the given ILayer as print target. It can be used to register multiple NatTable or layer stacks in one print job.
      Parameters:
      layer - The ILayer that should be printed together with the main ILayer registered via constructor.
      configRegistry - The IConfigRegistry that should be used to print the given ILayer.
      Since:
      1.5
    • addPrintTarget

      public void addPrintTarget(ILayer layer, ILayer repeatHeaderLayer, IConfigRegistry configRegistry)
      Adds the given ILayer 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 - The ILayer that should be printed together with the main ILayer 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 - The IConfigRegistry that should be used to print the given ILayer.
      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 is false.
      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 - The IConfigRegistry 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 given PrintListener to be able to react on printing events like print start and print finished.
      Parameters:
      listener - The PrintListener to add.
      Since:
      1.6
    • removePrintListener

      public void removePrintListener(PrintListener listener)
      Removes the given PrintListener.
      Parameters:
      listener - The PrintListener to remove.
      Since:
      1.6