Class DataTable<T>

  • Type Parameters:
    T - the model object type
    All Implemented Interfaces:
    com.googlecode.wicket.jquery.core.IJQueryWidget, IDataTableListener, Serializable, org.apache.wicket.event.IEventSink, org.apache.wicket.event.IEventSource, org.apache.wicket.feedback.IFeedbackContributor, org.apache.wicket.IConverterLocator, org.apache.wicket.IGenericComponent<List<IColumn>,​DataTable<T>>, org.apache.wicket.IMetadataContext<Serializable,​org.apache.wicket.Component>, org.apache.wicket.markup.html.IHeaderContributor, org.apache.wicket.request.component.IRequestableComponent, org.apache.wicket.util.IHierarchical<org.apache.wicket.Component>, org.apache.wicket.util.io.IClusterable

    public class DataTable<T>
    extends org.apache.wicket.markup.html.WebComponent
    implements org.apache.wicket.IGenericComponent<List<IColumn>,​DataTable<T>>, com.googlecode.wicket.jquery.core.IJQueryWidget, IDataTableListener
    Provides a Kendo UI data-table
    Author:
    Sebastien Briquet - sebfz1
    See Also:
    Serialized Form
    • Nested Class Summary

      • Nested classes/interfaces inherited from interface com.googlecode.wicket.jquery.core.IJQueryWidget

        com.googlecode.wicket.jquery.core.IJQueryWidget.JQueryWidget
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected com.googlecode.wicket.jquery.core.Options options  
      • 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

      Constructors 
      Constructor Description
      DataTable​(String id, List<IColumn> columns, org.apache.wicket.markup.repeater.data.IDataProvider<T> provider, long rows)
      Constructor
      DataTable​(String id, List<IColumn> columns, org.apache.wicket.markup.repeater.data.IDataProvider<T> provider, long rows, com.googlecode.wicket.jquery.core.Options options)
      Main constructor
      DataTable​(String id, org.apache.wicket.markup.repeater.data.IDataProvider<T> provider, long rows)
      Constructor
      DataTable​(String id, org.apache.wicket.markup.repeater.data.IDataProvider<T> provider, long rows, com.googlecode.wicket.jquery.core.Options options)
      Main constructor
      DataTable​(String id, org.apache.wicket.model.IModel<List<IColumn>> columns, org.apache.wicket.markup.repeater.data.IDataProvider<T> provider, long rows)
      Constructor
      DataTable​(String id, org.apache.wicket.model.IModel<List<IColumn>> columns, org.apache.wicket.markup.repeater.data.IDataProvider<T> provider, long rows, com.googlecode.wicket.jquery.core.Options options)
      Main constructor
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected CharSequence getCallbackUrl()
      Gets the data-provider behavior's url
      List<IColumn> getColumns()
      Gets the read-only List of IColumns
      org.apache.wicket.markup.repeater.data.IDataProvider<T> getDataProvider()
      Gets the IDataProvider
      protected long getRowCount()
      Gets the number of rows per page to be displayed
      protected List<ToolbarButton> getToolbarButtons()
      Gets the List of ToolbarButtons
      void hide​(org.apache.wicket.core.request.handler.IPartialPageRequestHandler handler)
      Hides the DataTable
      boolean isSelectable()
      Indicates whether item(s) can be selected.
      If true, the IDataTableListener.onChange(AjaxRequestTarget, JSONArray) event will be triggered.
      If a CheckboxColumn has been provided, #onChecked(AjaxRequestTarget, Object[]) will be triggered instead.
      protected com.googlecode.wicket.jquery.core.ajax.JQueryAjaxBehavior newCommandAjaxBehavior​(com.googlecode.wicket.jquery.core.ajax.IJQueryAjaxAware source, CommandButton button)
      Gets a new JQueryAjaxBehavior that will be called by the corresponding table's button.
      This method may be overridden to provide additional behaviors
      protected org.apache.wicket.behavior.AbstractAjaxBehavior newDataProviderBehavior​(org.apache.wicket.model.IModel<List<IColumn>> columns, org.apache.wicket.markup.repeater.data.IDataProvider<T> provider)
      com.googlecode.wicket.jquery.core.JQueryBehavior newWidgetBehavior​(String selector)  
      void onBeforeRender​(com.googlecode.wicket.jquery.core.JQueryBehavior behavior)  
      void onCancel​(org.apache.wicket.ajax.AjaxRequestTarget target)
      Triggered when an editing is cancelled
      void onChange​(org.apache.wicket.ajax.AjaxRequestTarget target, com.github.openjson.JSONArray items)
      Triggered when item(s) is/are selected
      void onChecked​(org.apache.wicket.ajax.AjaxRequestTarget target, List<String> selectedKeys)
      Triggered when a checkbox is 'checked'.
      void onClick​(org.apache.wicket.ajax.AjaxRequestTarget target, CommandButton button, String value)
      Triggered when a column button is clicked.
      void onClick​(org.apache.wicket.ajax.AjaxRequestTarget target, ToolbarButton button, List<String> values)
      Triggered when a toolbar button is clicked.
      void onColumnReorder​(org.apache.wicket.ajax.AjaxRequestTarget target, int oldIndex, int newIndex, com.github.openjson.JSONObject column)
      Triggered when the user changes the order of a column.
      void onComponentTagBody​(org.apache.wicket.markup.MarkupStream markupStream, org.apache.wicket.markup.ComponentTag openTag)  
      void onConfigure​(com.googlecode.wicket.jquery.core.JQueryBehavior behavior)  
      protected void onConfigure​(KendoDataSource dataSource)
      Configure the KendoDataSource with additional options
      void onCreate​(org.apache.wicket.ajax.AjaxRequestTarget target, com.github.openjson.JSONObject object)
      Triggered when datasource 'create' function is raised
      void onDelete​(org.apache.wicket.ajax.AjaxRequestTarget target, com.github.openjson.JSONObject object)
      Triggered when datasource 'destroy' function is raised
      void onHide​(org.apache.wicket.core.request.handler.IPartialPageRequestHandler handler)
      Triggered when the DataTable hides
      protected void onInitialize()  
      void onShow​(org.apache.wicket.core.request.handler.IPartialPageRequestHandler handler)
      Triggered when the DataTable shows
      void onUpdate​(org.apache.wicket.ajax.AjaxRequestTarget target, com.github.openjson.JSONObject object)
      Triggered when datasource 'update' function is raised
      If batch mode is used, the object is a JSONArray that might be retrieved this way: object.optJSONArray("models")
      void refresh​(org.apache.wicket.core.request.handler.IPartialPageRequestHandler handler)
      Refreshes the widget by reading from the datasource
      void refresh​(org.apache.wicket.core.request.handler.IPartialPageRequestHandler handler, boolean reset)
      Refreshes the widget by reading from the datasource
      void reload​(org.apache.wicket.core.request.handler.IPartialPageRequestHandler handler)
      Reloads the DataTable
      Equivalent to handler.add(table)
      void reload​(org.apache.wicket.core.request.handler.IPartialPageRequestHandler handler, boolean reset)
      Reloads the DataTable
      If reset is true, equivalent to #reset(IPartialPageRequestHandler) + handler.add(table)
      void renderHead​(org.apache.wicket.markup.head.IHeaderResponse response)  
      void reset​(org.apache.wicket.core.request.handler.IPartialPageRequestHandler handler)
      Resets the dataSource to the first page
      void show​(org.apache.wicket.core.request.handler.IPartialPageRequestHandler handler)
      Shows the DataTable
      String widget()
      Gets the Kendo UI widget
      • Methods inherited from class org.apache.wicket.markup.html.WebComponent

        getWebApplication, getWebPage, getWebRequest, getWebResponse, getWebSession, onRender
      • Methods 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, get, 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, internalInitialize, internalOnModelChanged, internalRenderComponent, internalRenderHead, isActionAuthorized, isAuto, isBehaviorAccepted, isEnableAllowed, isEnabled, isEnabledInHierarchy, isIgnoreAttributeModifier, isInitialized, isRenderAllowed, isRendering, isStateless, isVersioned, isVisibilityAllowed, isVisible, isVisibleInHierarchy, markRendering, modelChanged, modelChanging, newMarkupSourcingStrategy, onAfterRender, onBeforeRender, onComponentTag, onConfigure, onDetach, onEvent, onModelChanged, onModelChanging, onReAdd, onRemove, redirectToInterceptPage, remove, remove, render, renderComponentTag, rendered, renderPart, renderPlaceholderTag, replaceComponentTagBody, replaceWith, sameInnermostModel, sameInnermostModel, send, setAuto, setDefaultModel, setDefaultModelObject, setEnabled, setEscapeModelStrings, setFlag, setIgnoreAttributeModifier, setMarkup, setMarkupId, setMarkupIdImpl, setMetaData, setOutputMarkupId, setOutputMarkupPlaceholderTag, setParent, setRenderBodyOnly, setResponsePage, setResponsePage, setResponsePage, setVersioned, setVisibilityAllowed, setVisible, success, toString, toString, urlFor, urlFor, urlFor, urlForListener, urlForListener, visitParents, visitParents, warn, wrap
      • Methods inherited from interface org.apache.wicket.IGenericComponent

        getDefaultModel, getDefaultModelObject, getModel, getModelObject, setDefaultModel, setDefaultModelObject, setModel, setModelObject
    • Field Detail

      • options

        protected final com.googlecode.wicket.jquery.core.Options options
    • Constructor Detail

      • DataTable

        public DataTable​(String id,
                         org.apache.wicket.markup.repeater.data.IDataProvider<T> provider,
                         long rows)
        Constructor
        Parameters:
        id - the markup id
        provider - the IDataProvider
        rows - the number of rows per page to be displayed
      • DataTable

        public DataTable​(String id,
                         org.apache.wicket.markup.repeater.data.IDataProvider<T> provider,
                         long rows,
                         com.googlecode.wicket.jquery.core.Options options)
        Main constructor
        Parameters:
        id - the markup id
        provider - the IDataProvider
        rows - the number of rows per page to be displayed
        options - the Options
      • DataTable

        public DataTable​(String id,
                         List<IColumn> columns,
                         org.apache.wicket.markup.repeater.data.IDataProvider<T> provider,
                         long rows)
        Constructor
        Parameters:
        id - the markup id
        columns - the list of IColumn
        provider - the IDataProvider
        rows - the number of rows per page to be displayed
      • DataTable

        public DataTable​(String id,
                         List<IColumn> columns,
                         org.apache.wicket.markup.repeater.data.IDataProvider<T> provider,
                         long rows,
                         com.googlecode.wicket.jquery.core.Options options)
        Main constructor
        Parameters:
        id - the markup id
        columns - the list of IColumn
        provider - the IDataProvider
        rows - the number of rows per page to be displayed
        options - the Options
      • DataTable

        public DataTable​(String id,
                         org.apache.wicket.model.IModel<List<IColumn>> columns,
                         org.apache.wicket.markup.repeater.data.IDataProvider<T> provider,
                         long rows)
        Constructor
        Parameters:
        id - the markup id
        columns - the list of IColumn
        provider - the IDataProvider
        rows - the number of rows per page to be displayed
      • DataTable

        public DataTable​(String id,
                         org.apache.wicket.model.IModel<List<IColumn>> columns,
                         org.apache.wicket.markup.repeater.data.IDataProvider<T> provider,
                         long rows,
                         com.googlecode.wicket.jquery.core.Options options)
        Main constructor
        Parameters:
        id - the markup id
        columns - the list of IColumn
        provider - the IDataProvider
        rows - the number of rows per page to be displayed
        options - the Options
    • Method Detail

      • renderHead

        public void renderHead​(org.apache.wicket.markup.head.IHeaderResponse response)
        Specified by:
        renderHead in interface org.apache.wicket.markup.html.IHeaderContributor
        Overrides:
        renderHead in class org.apache.wicket.Component
      • widget

        public String widget()
        Gets the Kendo UI widget
        Returns:
        the jQuery object
      • show

        public final void show​(org.apache.wicket.core.request.handler.IPartialPageRequestHandler handler)
        Shows the DataTable
        Parameters:
        handler - the IPartialPageRequestHandler
      • hide

        public final void hide​(org.apache.wicket.core.request.handler.IPartialPageRequestHandler handler)
        Hides the DataTable
        Parameters:
        handler - the IPartialPageRequestHandler
      • reset

        public void reset​(org.apache.wicket.core.request.handler.IPartialPageRequestHandler handler)
        Resets the dataSource to the first page
        Parameters:
        handler - the IPartialPageRequestHandler
      • reload

        public void reload​(org.apache.wicket.core.request.handler.IPartialPageRequestHandler handler)
        Reloads the DataTable
        Equivalent to handler.add(table)
        Parameters:
        handler - the IPartialPageRequestHandler
        See Also:
        reset(IPartialPageRequestHandler)
      • reload

        public void reload​(org.apache.wicket.core.request.handler.IPartialPageRequestHandler handler,
                           boolean reset)
        Reloads the DataTable
        If reset is true, equivalent to #reset(IPartialPageRequestHandler) + handler.add(table)
        Parameters:
        handler - the IPartialPageRequestHandler
        reset - whether to call reset or not
        See Also:
        reset(IPartialPageRequestHandler)
      • refresh

        public void refresh​(org.apache.wicket.core.request.handler.IPartialPageRequestHandler handler)
        Refreshes the widget by reading from the datasource
        Parameters:
        handler - the IPartialPageRequestHandler
      • refresh

        public void refresh​(org.apache.wicket.core.request.handler.IPartialPageRequestHandler handler,
                            boolean reset)
        Refreshes the widget by reading from the datasource
        Parameters:
        handler - the IPartialPageRequestHandler
        reset - whether to call reset or not
        See Also:
        reset(IPartialPageRequestHandler)
      • getDataProvider

        public org.apache.wicket.markup.repeater.data.IDataProvider<T> getDataProvider()
        Gets the IDataProvider
        Returns:
        the IDataProvider
      • getRowCount

        protected final long getRowCount()
        Gets the number of rows per page to be displayed
        Returns:
        the number of rows per page to be displayed
      • getCallbackUrl

        protected final CharSequence getCallbackUrl()
        Gets the data-provider behavior's url
        Returns:
        the data-provider behavior's url
      • onInitialize

        protected void onInitialize()
        Overrides:
        onInitialize in class org.apache.wicket.Component
      • onConfigure

        public void onConfigure​(com.googlecode.wicket.jquery.core.JQueryBehavior behavior)
        Specified by:
        onConfigure in interface com.googlecode.wicket.jquery.core.IJQueryWidget
      • onBeforeRender

        public void onBeforeRender​(com.googlecode.wicket.jquery.core.JQueryBehavior behavior)
        Specified by:
        onBeforeRender in interface com.googlecode.wicket.jquery.core.IJQueryWidget
      • onComponentTagBody

        public void onComponentTagBody​(org.apache.wicket.markup.MarkupStream markupStream,
                                       org.apache.wicket.markup.ComponentTag openTag)
        Overrides:
        onComponentTagBody in class org.apache.wicket.Component
      • onShow

        public void onShow​(org.apache.wicket.core.request.handler.IPartialPageRequestHandler handler)
        Triggered when the DataTable shows
        Parameters:
        handler - the IPartialPageRequestHandler
      • onHide

        public void onHide​(org.apache.wicket.core.request.handler.IPartialPageRequestHandler handler)
        Triggered when the DataTable hides
        Parameters:
        handler - the IPartialPageRequestHandler
      • onClick

        public void onClick​(org.apache.wicket.ajax.AjaxRequestTarget target,
                            ToolbarButton button,
                            List<String> values)
        Description copied from interface: IDataTableListener
        Triggered when a toolbar button is clicked.
        Specified by:
        onClick in interface IDataTableListener
        Parameters:
        target - the AjaxRequestTarget
        button - the button name
        values - the list of retrieved values
      • onClick

        public void onClick​(org.apache.wicket.ajax.AjaxRequestTarget target,
                            CommandButton button,
                            String value)
        Description copied from interface: IDataTableListener
        Triggered when a column button is clicked.
        Specified by:
        onClick in interface IDataTableListener
        Parameters:
        target - the AjaxRequestTarget
        button - the button being clicked
        value - value retrieved from the row, according to the property supplied to the CommandButton that fired the event
      • onCancel

        public void onCancel​(org.apache.wicket.ajax.AjaxRequestTarget target)
        Description copied from interface: IDataTableListener
        Triggered when an editing is cancelled
        Specified by:
        onCancel in interface IDataTableListener
        Parameters:
        target - the AjaxRequestTarget
      • onChange

        public void onChange​(org.apache.wicket.ajax.AjaxRequestTarget target,
                             com.github.openjson.JSONArray items)
        Description copied from interface: IDataTableListener
        Triggered when item(s) is/are selected
        Specified by:
        onChange in interface IDataTableListener
        Parameters:
        target - the AjaxRequestTarget
        items - the JSONArray of retrieved JSONObjects
      • onChecked

        public void onChecked​(org.apache.wicket.ajax.AjaxRequestTarget target,
                              List<String> selectedKeys)
        Description copied from interface: IDataTableListener
        Triggered when a checkbox is 'checked'.
        Specified by:
        onChecked in interface IDataTableListener
        Parameters:
        target - the AjaxRequestTarget
        selectedKeys - the selected keys
        See Also:
        CheckboxColumn
      • onColumnReorder

        public void onColumnReorder​(org.apache.wicket.ajax.AjaxRequestTarget target,
                                    int oldIndex,
                                    int newIndex,
                                    com.github.openjson.JSONObject column)
        Description copied from interface: IDataTableListener
        Triggered when the user changes the order of a column.
        Specified by:
        onColumnReorder in interface IDataTableListener
        Parameters:
        target - the AjaxRequestTarget
        oldIndex - the old column index
        newIndex - the new column index
        column - the column's JSONObject
      • onCreate

        public void onCreate​(org.apache.wicket.ajax.AjaxRequestTarget target,
                             com.github.openjson.JSONObject object)
        Description copied from interface: IDataTableListener
        Triggered when datasource 'create' function is raised
        Specified by:
        onCreate in interface IDataTableListener
        Parameters:
        target - the AjaxRequestTarget
        object - the JSONObject holding the row data
      • onUpdate

        public void onUpdate​(org.apache.wicket.ajax.AjaxRequestTarget target,
                             com.github.openjson.JSONObject object)
        Description copied from interface: IDataTableListener
        Triggered when datasource 'update' function is raised
        If batch mode is used, the object is a JSONArray that might be retrieved this way: object.optJSONArray("models")
        Specified by:
        onUpdate in interface IDataTableListener
        Parameters:
        target - the AjaxRequestTarget
        object - the JSONObject holding the row data
      • onDelete

        public void onDelete​(org.apache.wicket.ajax.AjaxRequestTarget target,
                             com.github.openjson.JSONObject object)
        Description copied from interface: IDataTableListener
        Triggered when datasource 'destroy' function is raised
        Specified by:
        onDelete in interface IDataTableListener
        Parameters:
        target - the AjaxRequestTarget
        object - the JSONObject holding the row data
      • newWidgetBehavior

        public com.googlecode.wicket.jquery.core.JQueryBehavior newWidgetBehavior​(String selector)
        Specified by:
        newWidgetBehavior in interface com.googlecode.wicket.jquery.core.IJQueryWidget
      • newDataProviderBehavior

        protected org.apache.wicket.behavior.AbstractAjaxBehavior newDataProviderBehavior​(org.apache.wicket.model.IModel<List<IColumn>> columns,
                                                                                          org.apache.wicket.markup.repeater.data.IDataProvider<T> provider)
        Parameters:
        columns - the list of IColumn
        provider - the IDataProvider
        Returns:
        the AbstractAjaxBehavior
      • newCommandAjaxBehavior

        protected com.googlecode.wicket.jquery.core.ajax.JQueryAjaxBehavior newCommandAjaxBehavior​(com.googlecode.wicket.jquery.core.ajax.IJQueryAjaxAware source,
                                                                                                   CommandButton button)
        Gets a new JQueryAjaxBehavior that will be called by the corresponding table's button.
        This method may be overridden to provide additional behaviors
        Parameters:
        source - the IJQueryAjaxAware
        button - the button that is passed to the behavior so it can be retrieved via the CommandAjaxBehavior.CommandClickEvent
        Returns:
        the JQueryAjaxBehavior