Module org.apache.wicket.extensions
Interface IDataExporter
- All Superinterfaces:
IClusterable
,Serializable
- All Known Implementing Classes:
AbstractDataExporter
,CSVDataExporter
Exports data provided by a
IDataProvider
as described by IExportableColumn
s. This interface is used by
ExportToolbar
to provide the export functionality.- Author:
- Jesse Long
- See Also:
-
Method Summary
Modifier and TypeMethodDescription<T> void
exportData
(IDataProvider<T> dataProvider, List<IExportableColumn<T, ?>> columns, OutputStream outputStream) Exports the data provided by theIDataProvider
to theOutputStream
.Returns the MIME content type of the export data type.Returns a model of the exported data format name.Returns the file name extensions for the exported data, without the ".".
-
Method Details
-
getDataFormatNameModel
Returns a model of the exported data format name. This should be something like "CSV" or "Excel" etc. The value of the model returned is displayed as the export type in theExportToolbar
.- Returns:
- a model of the exported data format name.
-
getContentType
Returns the MIME content type of the export data type. This could be something like "text/csv". This is used to provide the correct content type when downloading the exported data.- Returns:
- the MIME content type of the export data type.
-
getFileNameExtension
Returns the file name extensions for the exported data, without the ".". For CSV, this should be "csv". For Excel exports, this should be "xls".- Returns:
- the file name extensions for the exported data, without the ".".
-
exportData
<T> void exportData(IDataProvider<T> dataProvider, List<IExportableColumn<T, ?>> columns, OutputStream outputStream) throws IOExceptionExports the data provided by theIDataProvider
to theOutputStream
.- Type Parameters:
T
- The type of each row of data provided by theIDataProvider
.- Parameters:
dataProvider
- TheIDataProvider
from which to retrieve the data.columns
- TheIExportableColumn
to use to describe the data.outputStream
- TheOutputStream
to which to write the exported data.- Throws:
IOException
- If an error occurs.
-