Module org.apache.wicket.extensions
Class ExportToolbar
java.lang.Object
org.apache.wicket.Component
org.apache.wicket.MarkupContainer
org.apache.wicket.markup.html.WebMarkupContainer
org.apache.wicket.markup.html.panel.Panel
org.apache.wicket.extensions.markup.html.repeater.data.table.AbstractToolbar
org.apache.wicket.extensions.markup.html.repeater.data.table.export.ExportToolbar
- All Implemented Interfaces:
Serializable,Iterable<Component>,IEventSink,IEventSource,IFeedbackContributor,IConverterLocator,IMetadataContext<Serializable,,Component> IQueueRegion,IHeaderContributor,IRequestableComponent,org.apache.wicket.util.IHierarchical<Component>,org.apache.wicket.util.io.IClusterable
A toolbar that provides links to download the data represented by all
IExportableColumns in the table
exported to formats supported by the IDataExporters configured.- Author:
- Jesse Long
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classAnIResourceStreamWriterwhich writes the exportable data from a table to an output stream. -
Field Summary
Fields inherited from class org.apache.wicket.Component
ENABLE, FLAG_INITIALIZED, FLAG_RESERVED1, FLAG_RESERVED2, FLAG_RESERVED3, FLAG_RESERVED4, FLAG_RESERVED5, FLAG_RESERVED8, PARENT_PATH, PATH_SEPARATOR, RENDER, RFLAG_CONTAINER_DEQUEING, RFLAG_CONTAINER_HAS_REMOVALS -
Constructor Summary
ConstructorsConstructorDescriptionExportToolbar(DataTable<?, ?> table) Creates a new instance with the default message model.ExportToolbar(DataTable<?, ?> table, IModel<String> fileNameModel) Creates a new instance with the provided data table and file name model.Creates a new instance. -
Method Summary
Modifier and TypeMethodDescriptionaddDataExporter(IDataExporter exporter) Adds aIDataExporterto the list of data exporters to be used in this toolbar.protected voidThis toolbar is only visible if there are rows in the data set and if there are exportable columns in the data table and if there are data exporters added to the toolbar.protected ComponentcreateExportLink(String componentId, IDataExporter dataExporter) Creates a new link to the exported data for the providedIDataExporter.protected DurationHow long should the export be cached.Returns the model of the file name used for the exported data.Returns the model of the export message displayed in the toolbar.protected voidprotected voidonDetach()protected voidsetFileNameModel(IModel<String> fileNameModel) Sets the model of the file name used for the exported data.setMessageModel(IModel<String> messageModel) Sets the models of the export message displayed in the toolbar.Methods inherited from class org.apache.wicket.extensions.markup.html.repeater.data.table.AbstractToolbar
getTableMethods inherited from class org.apache.wicket.markup.html.panel.Panel
getRegionMarkup, newMarkupSourcingStrategyMethods inherited from class org.apache.wicket.markup.html.WebMarkupContainer
getWebApplication, getWebPage, getWebRequest, getWebResponse, getWebSessionMethods inherited from class org.apache.wicket.MarkupContainer
add, addDequeuedComponent, addOrReplace, autoAdd, canDequeueTag, contains, dequeue, dequeue, dequeuePreamble, findChildComponent, findComponentToDequeue, get, getAssociatedMarkup, getAssociatedMarkupStream, getMarkup, getMarkupType, internalAdd, internalInitialize, iterator, iterator, newDequeueContext, onComponentTagBody, onRender, queue, remove, remove, removeAll, renderAll, renderAssociatedMarkup, renderNext, replace, setDefaultModel, size, stream, streamChildren, toString, toString, visitChildren, visitChildrenMethods inherited from class org.apache.wicket.Component
add, addStateChange, beforeRender, canCallListener, canCallListenerAfterExpiry, checkComponentTag, checkComponentTagAttribute, checkHierarchyChange, clearOriginalDestination, configure, continueToOriginalDestination, createConverter, debug, detach, detachModel, detachModels, determineVisibility, error, exceptionMessage, fatal, findMarkupStream, findPage, findParent, findParentWithAssociatedMarkup, getAjaxRegionMarkupId, getApplication, getBehaviorById, getBehaviorId, getBehaviors, getBehaviors, getClassRelativePath, getConverter, getDefaultModel, getDefaultModelObject, getDefaultModelObjectAsString, getDefaultModelObjectAsString, getEscapeModelStrings, getFeedbackMessages, getFlag, getId, getInnermostModel, getInnermostModel, getLocale, getLocalizer, getMarkup, getMarkupAttributes, getMarkupId, getMarkupId, getMarkupIdFromMarkup, getMarkupIdImpl, getMarkupSourcingStrategy, getMarkupTag, getMetaData, getModelComparator, getOutputMarkupId, getOutputMarkupPlaceholderTag, getPage, getPageRelativePath, getParent, getPath, getRenderBodyOnly, getRequest, getRequestCycle, getRequestFlag, getResponse, getSession, getSizeInBytes, getStatelessHint, getString, getString, getString, getStyle, getVariation, hasBeenRendered, hasErrorMessage, hasFeedbackMessage, info, initModel, internalOnModelChanged, internalRenderComponent, internalRenderHead, isActionAuthorized, isAuto, isBehaviorAccepted, isEnableAllowed, isEnabled, isEnabledInHierarchy, isIgnoreAttributeModifier, isInitialized, isRenderAllowed, isRendering, isStateless, isVersioned, isVisibilityAllowed, isVisible, isVisibleInHierarchy, markRendering, modelChanged, modelChanging, onAfterRender, onBeforeRender, onComponentTag, onEvent, onModelChanged, onModelChanging, onReAdd, onRemove, redirectToInterceptPage, remove, remove, render, renderComponentTag, rendered, renderHead, renderPart, renderPlaceholderTag, replaceComponentTagBody, replaceWith, sameInnermostModel, sameInnermostModel, send, setAuto, setDefaultModelObject, setEnabled, setEscapeModelStrings, setFlag, setIgnoreAttributeModifier, setMarkup, setMarkupId, setMarkupIdImpl, setMetaData, setOutputMarkupId, setOutputMarkupPlaceholderTag, setParent, setRenderBodyOnly, setResponsePage, setResponsePage, setResponsePage, setVersioned, setVisibilityAllowed, setVisible, success, urlFor, urlFor, urlFor, urlForListener, urlForListener, visitParents, visitParents, warn, wrapMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.wicket.IQueueRegion
dequeue, newDequeueContextMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
ExportToolbar
Creates a new instance with the default message model. This instance will use "export." as the exported file name prefix.- Parameters:
table- The data table this toolbar belongs to.
-
ExportToolbar
Creates a new instance with the provided data table and file name model.- Parameters:
table- The table to which this toolbar belongs.fileNameModel- The model of the file name. This should exclude the file extensions.
-
ExportToolbar
public ExportToolbar(DataTable<?, ?> table, IModel<String> messageModel, IModel<String> fileNameModel) Creates a new instance.- Parameters:
table- The table to which this toolbar belongs.messageModel- The model of the export message.fileNameModel- The model of the file name. This should exclude the file extensions.
-
-
Method Details
-
setMessageModel
Sets the models of the export message displayed in the toolbar.- Parameters:
messageModel- the models of the export message displayed in the toolbar.- Returns:
this, for chaining.
-
setFileNameModel
Sets the model of the file name used for the exported data.- Parameters:
fileNameModel- The model of the file name used for the exported data.- Returns:
this, for chaining.
-
getFileNameModel
Returns the model of the file name used for the exported data.- Returns:
- the model of the file name used for the exported data.
-
getMessageModel
Returns the model of the export message displayed in the toolbar.- Returns:
- the model of the export message displayed in the toolbar.
-
onInitialize
- Overrides:
onInitializein classMarkupContainer
-
createExportLink
Creates a new link to the exported data for the providedIDataExporter.- Parameters:
componentId- The component of the link.dataExporter- The data exporter to use to export the data.- Returns:
- a new link to the exported data for the provided
IDataExporter.
-
getCacheDuration
How long should the export be cached.- Returns:
- default is
Duration.ZERO
-
onConfigure
- Overrides:
onConfigurein classComponent
-
calculateVisibility
This toolbar is only visible if there are rows in the data set and if there are exportable columns in the data table and if there are data exporters added to the toolbar. -
onDetach
- Overrides:
onDetachin classMarkupContainer
-
addDataExporter
Adds aIDataExporterto the list of data exporters to be used in this toolbar.- Parameters:
exporter- TheIDataExporterto add to the toolbar.- Returns:
this, for chaining.
-