public class CsvTableScrollPaneUtils extends Object
CsvTableScrollPaneUtils
is a class that has methods to export TableScrollPane's content to Character
Separated Values file format.
The export feature will not consider the cell contents conversion but you can use ValueConverter to format the
value if you want. It will also optionally consider table header as part of the export. You could also choose any
character including comma as the separator.
It does NOT support cell span and will LOSE the collapsed rows in TreeTable scenario because of
the CSV format limitation.Constructor and Description |
---|
CsvTableScrollPaneUtils() |
Modifier and Type | Method and Description |
---|---|
static boolean |
export(TableScrollPane scrollPane,
int firstRow,
int firstColumn,
int numberOfRows,
int numberOfColumns,
String fileName,
boolean includeTableHeader,
ValueConverter cellValueConverter,
StringConverter columnNameConverter)
Exports the scrollPane to an CSV file.
|
static boolean |
export(TableScrollPane scrollPane,
int firstRow,
int firstColumn,
int numberOfRows,
int numberOfColumns,
String fileName,
boolean includeTableHeader,
ValueConverter cellValueConverter,
StringConverter columnNameConverter,
char separator)
Exports the scrollPane to an CSV file.
|
static boolean |
export(TableScrollPane scrollPane,
OutputStream out)
Exports the scrollPane to a CSV file output steam.
|
static boolean |
export(TableScrollPane scrollPane,
OutputStream out,
boolean includeTableHeader)
Exports the scrollPane to a CSV file output steam.
|
static boolean |
export(TableScrollPane scrollPane,
OutputStream out,
boolean includeTableHeader,
ValueConverter cellValueConverter)
Exports the scrollPane to a CSV file output steam.
|
static boolean |
export(TableScrollPane scrollPane,
OutputStream out,
boolean includeTableHeader,
ValueConverter cellValueConverter,
StringConverter columnNameConverter)
Exports the scrollPane to a CSV file output steam.
|
static boolean |
export(TableScrollPane scrollPane,
OutputStream out,
CsvTableUtils.CsvTableExportConfig config)
Exports the scrollPane to a CSV file output steam.
|
static boolean |
export(TableScrollPane scrollPane,
OutputStream out,
int firstRow,
int firstColumn,
int numberOfRows,
int numberOfColumns,
boolean includeTableHeader,
ValueConverter cellValueConverter,
StringConverter columnNameConverter)
Exports the scrollPane to a CSV file output steam.
|
static boolean |
export(TableScrollPane scrollPane,
OutputStream out,
int firstRow,
int firstColumn,
int numberOfRows,
int numberOfColumns,
boolean includeTableHeader,
ValueConverter cellValueConverter,
StringConverter columnNameConverter,
char separator)
Exports the scrollPane to a CSV file output steam.
|
static boolean |
export(TableScrollPane scrollPane,
String fileName)
Exports the TableScrollPane to an CSV file.
|
static boolean |
export(TableScrollPane scrollPane,
String fileName,
boolean includeTableHeader)
Exports the scrollPane to an CSV file.
|
static boolean |
export(TableScrollPane scrollPane,
String fileName,
boolean includeTableHeader,
ValueConverter cellValueConverter)
Exports the scrollPane to an CSV file.
|
static boolean |
export(TableScrollPane scrollPane,
String fileName,
boolean includeTableHeader,
ValueConverter cellValueConverter,
StringConverter columnNameConverter)
Exports the scrollPane to an CSV file.
|
public static boolean export(TableScrollPane scrollPane, String fileName) throws IOException
scrollPane
- the scrollPane to be exported.fileName
- the CSV file name. It should be the full path to the file.IOException
- if the write to the file failed.FileNotFoundException
- if the file exists but is a directory rather than a regular file, does not
exist but cannot be created, or cannot be opened for any other reasonpublic static boolean export(TableScrollPane scrollPane, String fileName, boolean includeTableHeader) throws IOException
scrollPane
- the scrollPane to be exported.fileName
- the CSV file name. It should be the full path to the file.includeTableHeader
- whether to include the scrollPane header.IOException
- if the write to the file failed.FileNotFoundException
- if the file exists but is a directory rather than a regular file, does not
exist but cannot be created, or cannot be opened for any other reasonpublic static boolean export(TableScrollPane scrollPane, String fileName, boolean includeTableHeader, ValueConverter cellValueConverter) throws IOException
scrollPane
- the scrollPane to be exported.fileName
- the CSV file name. It should be the full path to the file.includeTableHeader
- whether to include the scrollPane header.cellValueConverter
- the converter to convert cell value to the value that can be set to CSV cell.IOException
- if the write to the file failed.FileNotFoundException
- if the file exists but is a directory rather than a regular file, does not
exist but cannot be created, or cannot be opened for any other reasonpublic static boolean export(TableScrollPane scrollPane, String fileName, boolean includeTableHeader, ValueConverter cellValueConverter, StringConverter columnNameConverter) throws IOException
scrollPane
- the scrollPane to be exported.fileName
- the CSV file name. It should be the full path to the file.includeTableHeader
- whether to include the scrollPane header.cellValueConverter
- the converter to convert cell value to the value that can be set to CSV cell.columnNameConverter
- the converter to convert the column name.IOException
- if the write to the file failed.FileNotFoundException
- if the file exists but is a directory rather than a regular file, does not
exist but cannot be created, or cannot be opened for any other reasonpublic static boolean export(TableScrollPane scrollPane, int firstRow, int firstColumn, int numberOfRows, int numberOfColumns, String fileName, boolean includeTableHeader, ValueConverter cellValueConverter, StringConverter columnNameConverter) throws IOException
scrollPane
- the scrollPane to be exported.firstRow
- the first row to be exportedfirstColumn
- the first row to be exportednumberOfRows
- number of rows to be exported, -1 means all rows.numberOfColumns
- number of columns to be exported. -1 means all columns.fileName
- the CSV file name. It should be the full path to the file.includeTableHeader
- whether to include the scrollPane header.cellValueConverter
- the converter to convert cell value to the value that can be set to CSV cell.columnNameConverter
- the converter to convert the column name.IOException
- if the write to the file failed.FileNotFoundException
- if the file exists but is a directory rather than a regular file, does not
exist but cannot be created, or cannot be opened for any other reasonpublic static boolean export(TableScrollPane scrollPane, int firstRow, int firstColumn, int numberOfRows, int numberOfColumns, String fileName, boolean includeTableHeader, ValueConverter cellValueConverter, StringConverter columnNameConverter, char separator) throws IOException
scrollPane
- the scrollPane to be exported.firstRow
- the first row to be exportedfirstColumn
- the first row to be exportednumberOfRows
- number of rows to be exported, -1 means all rows.numberOfColumns
- number of columns to be exported. -1 means all columns.fileName
- the CSV file name. It should be the full path to the file.includeTableHeader
- whether to include the scrollPane header.cellValueConverter
- the converter to convert cell value to the value that can be set to CSV cell.columnNameConverter
- the converter to convert the column name.separator
- the character used to separate the cells. By default, it is a comma.IOException
- if the write to the file failed.FileNotFoundException
- if the file exists but is a directory rather than a regular file, does not
exist but cannot be created, or cannot be opened for any other reasonpublic static boolean export(TableScrollPane scrollPane, OutputStream out) throws IOException
scrollPane
- the scrollPane to be exported.out
- the output streamIOException
- if the write to the file failed.FileNotFoundException
- if the file exists but is a directory rather than a regular file, does not
exist but cannot be created, or cannot be opened for any other reasonpublic static boolean export(TableScrollPane scrollPane, OutputStream out, boolean includeTableHeader) throws IOException
scrollPane
- the scrollPane to be exported.out
- the output streamincludeTableHeader
- whether to include the scrollPane header.IOException
- if the write to the file failed.FileNotFoundException
- if the file exists but is a directory rather than a regular file, does not
exist but cannot be created, or cannot be opened for any other reasonpublic static boolean export(TableScrollPane scrollPane, OutputStream out, boolean includeTableHeader, ValueConverter cellValueConverter) throws IOException
scrollPane
- the scrollPane to be exported.out
- the output streamincludeTableHeader
- whether to include the scrollPane header.cellValueConverter
- the converter to convert cell value to the value that can be set to CSV cell.IOException
- if the write to the file failed.FileNotFoundException
- if the file exists but is a directory rather than a regular file, does not
exist but cannot be created, or cannot be opened for any other reasonpublic static boolean export(TableScrollPane scrollPane, OutputStream out, boolean includeTableHeader, ValueConverter cellValueConverter, StringConverter columnNameConverter) throws IOException
scrollPane
- the scrollPane to be exported.out
- the output streamincludeTableHeader
- whether to include the scrollPane header.cellValueConverter
- the converter to convert cell value to the value that can be set to CSV cell.columnNameConverter
- the converter to convert the column name.IOException
- if the write to the file failed.FileNotFoundException
- if the file exists but is a directory rather than a regular file, does not
exist but cannot be created, or cannot be opened for any other reasonpublic static boolean export(TableScrollPane scrollPane, OutputStream out, int firstRow, int firstColumn, int numberOfRows, int numberOfColumns, boolean includeTableHeader, ValueConverter cellValueConverter, StringConverter columnNameConverter) throws IOException
scrollPane
- the scrollPane to be exported.out
- the output streamfirstRow
- the first row to be exportedfirstColumn
- the first row to be exportednumberOfRows
- number of rows to be exported, -1 means all rows.numberOfColumns
- number of columns to be exported. -1 means all columns.includeTableHeader
- whether to include the scrollPane header.cellValueConverter
- the converter to convert cell value to the value that can be set to CSV cell.columnNameConverter
- the converter to convert the column name.IOException
- if the write to the file failed.FileNotFoundException
- if the file exists but is a directory rather than a regular file, does not
exist but cannot be created, or cannot be opened for any other reasonpublic static boolean export(TableScrollPane scrollPane, OutputStream out, int firstRow, int firstColumn, int numberOfRows, int numberOfColumns, boolean includeTableHeader, ValueConverter cellValueConverter, StringConverter columnNameConverter, char separator) throws IOException
scrollPane
- the scrollPane to be exported.out
- the output streamfirstRow
- the first row to be exportedfirstColumn
- the first row to be exportednumberOfRows
- number of rows to be exported, -1 means all rows.numberOfColumns
- number of columns to be exported. -1 means all columns.includeTableHeader
- whether to include the scrollPane header.cellValueConverter
- the converter to convert cell value to the value that can be set to CSV cell.columnNameConverter
- the converter to convert the column name.separator
- the character used to separate the cells. By default, it is a comma.IOException
- if the write to the file failed.FileNotFoundException
- if the file exists but is a directory rather than a regular file, does not
exist but cannot be created, or cannot be opened for any other reasonpublic static boolean export(TableScrollPane scrollPane, OutputStream out, CsvTableUtils.CsvTableExportConfig config) throws IOException
scrollPane
- the scrollPane to be exported.out
- the output streamconfig
- a collection of the parameters that could be configured during the export process.IOException
- if the write to the file failed.FileNotFoundException
- if the file exists but is a directory rather than a regular file, does not
exist but cannot be created, or cannot be opened for any other reason