public class CSVDataExporter extends Object implements IDataExporter
DataTable| Modifier and Type | Class and Description |
|---|---|
static class |
CSVDataExporter.DataExporterResourceStreamWriter
Provides the
IResourceStreamWriter for the CSVDataExporter |
| Constructor and Description |
|---|
CSVDataExporter()
Constructor
|
CSVDataExporter(String contentType)
Constructor
|
| Modifier and Type | Method and Description |
|---|---|
static void |
export(DataTable<?> table,
String filename) |
static void |
export(org.apache.wicket.request.cycle.RequestCycle cycle,
DataTable<?> table,
String filename)
Exports
DataTable data to a CSV file |
static void |
export(org.apache.wicket.request.cycle.RequestCycle cycle,
org.apache.wicket.markup.repeater.data.IDataProvider<?> provider,
List<IExportableColumn> columns,
String filename)
Exports
DataTable data to a CSV file |
<T> void |
exportData(org.apache.wicket.markup.repeater.data.IDataProvider<T> provider,
List<IExportableColumn> columns,
OutputStream output)
Exports all data provided by the
IDataProvider to the OutputStream. |
<T> void |
exportData(org.apache.wicket.markup.repeater.data.IDataProvider<T> provider,
List<IExportableColumn> columns,
OutputStream output,
long first,
long count)
Exports the data provided by the
IDataProvider to the OutputStream. |
String |
getContentType()
Gets the content type
|
boolean |
isExportHeadersEnabled()
Indicates whether headers will be written to the output
|
protected String |
quoteValue(String value)
Quotes a value for export to CSV.
According to RFC4180, this should just duplicate all occurrences of the quote character and wrap the result in the quote character. |
public CSVDataExporter()
public CSVDataExporter(String contentType)
contentType - the content-type, ie: text/csvpublic String getContentType()
getContentType in interface IDataExporterpublic boolean isExportHeadersEnabled()
isExportHeadersEnabled in interface IDataExporterprotected String quoteValue(String value)
value - The value to be quoted.public <T> void exportData(org.apache.wicket.markup.repeater.data.IDataProvider<T> provider,
List<IExportableColumn> columns,
OutputStream output)
throws IOException
IDataProvider to the OutputStream.exportData in interface IDataExporterT - the object typeprovider - the IDataProvidercolumns - the list of IColumnoutput - the OutputStreamIOException - if this could not write the file outpublic <T> void exportData(org.apache.wicket.markup.repeater.data.IDataProvider<T> provider,
List<IExportableColumn> columns,
OutputStream output,
long first,
long count)
throws IOException
IDataProvider to the OutputStream.T - the object typeprovider - the IDataProvidercolumns - the list of IColumnoutput - the OutputStreamfirst - the first row of datacountcount - the number of elements to retrieveIOException - if this could not write the file outpublic static void export(org.apache.wicket.request.cycle.RequestCycle cycle,
DataTable<?> table,
String filename)
DataTable data to a CSV filecycle - the RequestCycletable - the DataTablefilename - the file name of the outputpublic static void export(org.apache.wicket.request.cycle.RequestCycle cycle,
org.apache.wicket.markup.repeater.data.IDataProvider<?> provider,
List<IExportableColumn> columns,
String filename)
DataTable data to a CSV filecycle - the RequestCycleprovider - the IDataProvidercolumns - the list of IExportableColumnfilename - the file name of the outputCopyright © 2021 7thWeb. All rights reserved.