org.apache.wicket.extensions.markup.html.repeater.data.table.export
Class ExportToolbar

java.lang.Object
  extended by org.apache.wicket.Component
      extended by org.apache.wicket.MarkupContainer
          extended by org.apache.wicket.markup.html.WebMarkupContainer
              extended by org.apache.wicket.markup.html.panel.Panel
                  extended by org.apache.wicket.extensions.markup.html.repeater.data.table.AbstractToolbar
                      extended by org.apache.wicket.extensions.markup.html.repeater.data.table.export.ExportToolbar
All Implemented Interfaces:
Serializable, Iterable<Component>, IEventSink, IEventSource, IConverterLocator, IHeaderContributor, IRequestableComponent, org.apache.wicket.util.IHierarchical<Component>, org.apache.wicket.util.io.IClusterable

public class ExportToolbar
extends AbstractToolbar

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:
IDataExporter, IExportableColumn, Serialized Form

Nested Class Summary
static class ExportToolbar.DataExportResourceStreamWriter
          An IResourceStreamWriter which writes the exportable data from a table to an output stream.
 
Field Summary
 
Fields inherited from class org.apache.wicket.markup.html.panel.Panel
PANEL
 
Fields inherited from class org.apache.wicket.Component
ENABLE, FLAG_INITIALIZED, FLAG_REMOVING_FROM_HIERARCHY, FLAG_RESERVED1, FLAG_RESERVED2, FLAG_RESERVED3, FLAG_RESERVED4, FLAG_RESERVED5, FLAG_RESERVED8, PARENT_PATH, PATH_SEPARATOR, RENDER
 
Constructor Summary
ExportToolbar(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.
ExportToolbar(DataTable<?,?> table, IModel<String> messageModel, IModel<String> fileNameModel)
          Creates a new instance.
 
Method Summary
 ExportToolbar addDataExporter(IDataExporter exporter)
          Adds a IDataExporter to the list of data exporters to be used in this toolbar.
protected  Component createExportLink(String componentId, IDataExporter dataExporter)
          Creates a new link to the exported data for the provided IDataExporter.
 IModel<String> getFileNameModel()
          Returns the model of the file name used for the exported data.
 IModel<String> getMessageModel()
          Returns the model of the export message displayed in the toolbar.
 boolean isVisible()
          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.
protected  void onDetach()
           
protected  void onInitialize()
          
 ExportToolbar setFileNameModel(IModel<String> fileNameModel)
          Sets the model of the file name used for the exported data.
 ExportToolbar 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
getTable
 
Methods inherited from class org.apache.wicket.markup.html.panel.Panel
newMarkupSourcingStrategy
 
Methods inherited from class org.apache.wicket.markup.html.WebMarkupContainer
getWebApplication, getWebPage, getWebRequest, getWebResponse, getWebSession
 
Methods inherited from class org.apache.wicket.MarkupContainer
add, addOrReplace, autoAdd, contains, get, get, getAssociatedMarkup, getAssociatedMarkupStream, getMarkup, getMarkupType, internalAdd, internalInitialize, iterator, iterator, onAfterRenderChildren, onComponentTagBody, onRender, remove, remove, removeAll, renderAll, renderAssociatedMarkup, renderNext, replace, setDefaultModel, size, swap, toString, toString, visitChildren, visitChildren, visitChildren, visitChildren
 
Methods inherited from class org.apache.wicket.Component
add, addStateChange, afterRender, beforeRender, canCallListenerInterface, checkComponentTag, checkComponentTagAttribute, checkHierarchyChange, clearOriginalDestination, configure, continueToOriginalDestination, 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, 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, internalPrepareForRender, internalRenderComponent, isActionAuthorized, isAuto, isBehaviorAccepted, isEnableAllowed, isEnabled, isEnabledInHierarchy, isIgnoreAttributeModifier, isRenderAllowed, isRendering, isStateless, isVersioned, isVisibilityAllowed, isVisibleInHierarchy, markRendering, modelChanged, modelChanging, onAfterRender, onBeforeRender, onComponentTag, onConfigure, onEvent, onModelChanged, onModelChanging, onReAdd, onRemove, prepareForRender, redirectToInterceptPage, remove, remove, render, renderComponentTag, rendered, renderHead, renderHead, renderHead, renderPlaceholderTag, replaceComponentTagBody, replaceWith, sameInnermostModel, sameInnermostModel, send, setAuto, setDefaultModelObject, setEnabled, setEscapeModelStrings, setFlag, setIgnoreAttributeModifier, setMarkup, setMarkupId, setMarkupIdImpl, setMetaData, setOutputMarkupId, setOutputMarkupPlaceholderTag, setParent, setRenderBodyOnly, setRequestFlag, setResponsePage, setResponsePage, setResponsePage, setVersioned, setVisibilityAllowed, setVisible, success, urlFor, urlFor, urlFor, urlFor, urlFor, visitParents, visitParents, warn, wrap
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ExportToolbar

public ExportToolbar(DataTable<?,?> table)
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

public ExportToolbar(DataTable<?,?> table,
                     IModel<String> fileNameModel)
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 Detail

setMessageModel

public ExportToolbar setMessageModel(IModel<String> messageModel)
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

public ExportToolbar setFileNameModel(IModel<String> fileNameModel)
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

public IModel<String> 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

public IModel<String> getMessageModel()
Returns the model of the export message displayed in the toolbar.

Returns:
the model of the export message displayed in the toolbar.

onInitialize

protected void onInitialize()

Overrides:
onInitialize in class Component

createExportLink

protected Component createExportLink(String componentId,
                                     IDataExporter dataExporter)
Creates a new link to the exported data for the provided IDataExporter.

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.

isVisible

public boolean isVisible()
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.

Overrides:
isVisible in class Component

onDetach

protected void onDetach()
Overrides:
onDetach in class Component

addDataExporter

public ExportToolbar addDataExporter(IDataExporter exporter)
Adds a IDataExporter to the list of data exporters to be used in this toolbar.

Parameters:
exporter - The IDataExporter to add to the toolbar.
Returns:
this, for chaining.


Copyright © 2006–2020 Apache Software Foundation. All rights reserved.