Class AbstractDataExporter
- java.lang.Object
-
- org.apache.wicket.extensions.markup.html.repeater.data.table.export.AbstractDataExporter
-
- All Implemented Interfaces:
Serializable
,IDataExporter
,IClusterable
- Direct Known Subclasses:
CSVDataExporter
public abstract class AbstractDataExporter extends Object implements IDataExporter
An abstract helper implementation ofIDataExporter
.- Author:
- Jesse Long
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description AbstractDataExporter(IModel<String> dataFormatNameModel, String contentType, String fileNameExtension)
Creates a new instance with the data format name model, content type and file name extensions provided.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getContentType()
Returns the MIME content type of the export data type.IModel<String>
getDataFormatNameModel()
Returns a model of the exported data format name.String
getFileNameExtension()
Returns the file name extensions for the exported data, without the ".".AbstractDataExporter
setContentType(String contentType)
Sets the MIME contentType for the data export format.AbstractDataExporter
setDataFormatNameModel(IModel<String> dataFormatNameModel)
Sets the data format name model.AbstractDataExporter
setFileNameExtension(String fileNameExtension)
Sets the file name extension to be used in the exported file name.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.wicket.extensions.markup.html.repeater.data.table.export.IDataExporter
exportData
-
-
-
-
Constructor Detail
-
AbstractDataExporter
public AbstractDataExporter(IModel<String> dataFormatNameModel, String contentType, String fileNameExtension)
Creates a new instance with the data format name model, content type and file name extensions provided.- Parameters:
dataFormatNameModel
- The model of the exported data format name.contentType
- The MIME content type of the exported data type.fileNameExtension
- The file name extensions to use in the file name for the exported data.
-
-
Method Detail
-
getDataFormatNameModel
public 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
.- Specified by:
getDataFormatNameModel
in interfaceIDataExporter
- Returns:
- a model of the exported data format name.
-
getContentType
public 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.- Specified by:
getContentType
in interfaceIDataExporter
- Returns:
- the MIME content type of the export data type.
-
getFileNameExtension
public 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".- Specified by:
getFileNameExtension
in interfaceIDataExporter
- Returns:
- the file name extensions for the exported data, without the ".".
-
setContentType
public AbstractDataExporter setContentType(String contentType)
Sets the MIME contentType for the data export format.- Parameters:
contentType
- The MIME contentType for the data export format.- Returns:
this
, for chaining.
-
setDataFormatNameModel
public AbstractDataExporter setDataFormatNameModel(IModel<String> dataFormatNameModel)
Sets the data format name model.- Parameters:
dataFormatNameModel
- the data format name model.- Returns:
this
, for chaining.
-
setFileNameExtension
public AbstractDataExporter setFileNameExtension(String fileNameExtension)
Sets the file name extension to be used in the exported file name.- Parameters:
fileNameExtension
- the file name extension to be used in the exported file name.- Returns:
this
, for chaining.
-
-