Interface IDataExporter
-
- All Superinterfaces:
org.apache.wicket.util.io.IClusterable,Serializable
- All Known Implementing Classes:
AbstractDataExporter,CSVDataExporter
public interface IDataExporter extends org.apache.wicket.util.io.IClusterable
Exports data provided by aIDataProvideras described byIExportableColumns. This interface is used byExportToolbarto provide the export functionality.- Author:
- Jesse Long
- See Also:
ExportToolbar,IExportableColumn
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description <T> voidexportData(org.apache.wicket.markup.repeater.data.IDataProvider<T> dataProvider, List<IExportableColumn<T,?>> columns, OutputStream outputStream)Exports the data provided by theIDataProviderto theOutputStream.StringgetContentType()Returns the MIME content type of the export data type.org.apache.wicket.model.IModel<String>getDataFormatNameModel()Returns a model of the exported data format name.StringgetFileNameExtension()Returns the file name extensions for the exported data, without the ".".
-
-
-
Method Detail
-
getDataFormatNameModel
org.apache.wicket.model.IModel<String> 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
String 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
String 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(org.apache.wicket.markup.repeater.data.IDataProvider<T> dataProvider, List<IExportableColumn<T,?>> columns, OutputStream outputStream) throws IOException
Exports the data provided by theIDataProviderto theOutputStream.- Type Parameters:
T- The type of each row of data provided by theIDataProvider.- Parameters:
dataProvider- TheIDataProviderfrom which to retrieve the data.columns- TheIExportableColumnto use to describe the data.outputStream- TheOutputStreamto which to write the exported data.- Throws:
IOException- If an error occurs.
-
-