Class ImageExporter
java.lang.Object
org.eclipse.nebula.widgets.nattable.export.image.ImageExporter
- All Implemented Interfaces:
IExporter
,ITableExporter
This class is used to export a NatTable to different types of image.
Currently, 4 types of image are supported: BMP, JPEG, JPG, PNG. GIF is not
supported due to its limitation on image depth described in the bug 38232.
Warning: Using this class is risky as it could cause severe damage to NatTables that show huge data sets (for example: a table with more than 20k rows).
- Since:
- 1.5
-
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor to create a new image exporter.ImageExporter
(IOutputStreamProvider outputStreamProvider) Create a new ImageExporter that uses the given IOutputStreamProvider for retrieving the OutputStream. -
Method Summary
Modifier and TypeMethodDescriptionvoid
exportTable
(org.eclipse.swt.widgets.Shell shell, org.eclipse.swt.widgets.ProgressBar progressBar, OutputStream outputStream, ILayer layer, IConfigRegistry configRegistry) Export the given layer of the nattable to image.protected int
getImageFormatIndex
(String selectedFilterExt) Get the image format index by the filter extension.getOutputStream
(org.eclipse.swt.widgets.Shell shell) Get theOutputStream
to which the export should be written to.
-
Constructor Details
-
ImageExporter
public ImageExporter()Default constructor to create a new image exporter. -
ImageExporter
Create a new ImageExporter that uses the given IOutputStreamProvider for retrieving the OutputStream.- Parameters:
outputStreamProvider
- The IOutputStreamProvider used to retrieve the OutputStream to write the export to.
-
-
Method Details
-
getResult
- Specified by:
getResult
in interfaceIExporter
- Returns:
- The result that is produced by this
ITableExporter
. Usually the file that is created or written by this exporter.
-
exportTable
public void exportTable(org.eclipse.swt.widgets.Shell shell, org.eclipse.swt.widgets.ProgressBar progressBar, OutputStream outputStream, ILayer layer, IConfigRegistry configRegistry) throws IOException Export the given layer of the nattable to image. This method must be called after the execution of thegetOutputStream(Shell)
method.- Specified by:
exportTable
in interfaceITableExporter
- Parameters:
shell
- The parent shelllayer
- The layer to be exportedconfigRegistry
- The configure registry of the nattableprogressBar
- TheProgressBar
that can be used to report the export progress to the user.outputStream
- TheOutputStream
to write the export to. Typically previously retrieved by callingIExporter.getOutputStream(Shell)
.- Throws:
IOException
- If an error occurs while exporting.
-
getImageFormatIndex
Get the image format index by the filter extension.- Parameters:
selectedFilterExt
- The selected filter extension- Returns:
- The image index or -1 if not found
-
getOutputStream
Description copied from interface:IExporter
Get theOutputStream
to which the export should be written to.- Specified by:
getOutputStream
in interfaceIExporter
- Parameters:
shell
- TheShell
to which theILayer
to export is connected to. Necessary to support user interactions via dialogs on configuring the output location.- Returns:
- The
OutputStream
to write the export to.
-