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 TypeMethodDescriptionvoidexportTable(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 intgetImageFormatIndex(String selectedFilterExt) Get the image format index by the filter extension.getOutputStream(org.eclipse.swt.widgets.Shell shell) Get theOutputStreamto 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:
getResultin 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:
exportTablein interfaceITableExporter- Parameters:
shell- The parent shelllayer- The layer to be exportedconfigRegistry- The configure registry of the nattableprogressBar- TheProgressBarthat can be used to report the export progress to the user.outputStream- TheOutputStreamto 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:IExporterGet theOutputStreamto which the export should be written to.- Specified by:
getOutputStreamin interfaceIExporter- Parameters:
shell- TheShellto which theILayerto export is connected to. Necessary to support user interactions via dialogs on configuring the output location.- Returns:
- The
OutputStreamto write the export to.
-