Class Sortable<T>

  • Type Parameters:
    T - the type of the model object
    All Implemented Interfaces:
    com.googlecode.wicket.jquery.core.IJQueryWidget, ISortableListener<T>, Serializable, Iterable<org.apache.wicket.Component>, org.apache.wicket.event.IEventSink, org.apache.wicket.event.IEventSource, org.apache.wicket.feedback.IFeedbackContributor, org.apache.wicket.IConverterLocator, org.apache.wicket.IGenericComponent<List<T>,​com.googlecode.wicket.jquery.core.JQueryGenericContainer<List<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 abstract class Sortable<T>
    extends com.googlecode.wicket.jquery.core.JQueryGenericContainer<List<T>>
    implements ISortableListener<T>
    Provides a jQuery UI sortable JQueryGenericContainer.
    The Sortable is usually associated to an <UL> element.
    Author:
    Sebastien Briquet - sebfz1
    See Also:
    Serialized Form
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  Sortable.HashListView<T>
      Provides the ListView to be used within the Sortable
      • 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 com.googlecode.wicket.jquery.core.JQueryContainer

        widgetBehavior
      • 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
      Sortable​(String id, List<T> list)
      Constructor
      Sortable​(String id, List<T> list, com.googlecode.wicket.jquery.core.Options options)
      Constructor
      Sortable​(String id, org.apache.wicket.model.IModel<List<T>> model)
      Constructor
      Sortable​(String id, org.apache.wicket.model.IModel<List<T>> model, com.googlecode.wicket.jquery.core.Options options)
      Constructor
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      Sortable<T> connectWith​(Sortable<T> sortable)
      Connects with another Sortable
      The specified Sortable will keep a reference to the caller (this).
      protected T findItem​(String id, List<T> list)
      Helper method to locate an item in a list by identifier.
      By default, uses item's hashcode as identifier.
      boolean isOnReceiveEnabled()
      Indicates whether the 'receive' event is enabled.
      If true, the ISortableListener.onReceive(AjaxRequestTarget, Object, int) event will be triggered.
      boolean isOnRemoveEnabled()
      Indicates whether the 'remove' event is enabled.
      If true, the ISortableListener.onRemove(AjaxRequestTarget, Object) event will be triggered.
      protected abstract Sortable.HashListView<T> newListView​(org.apache.wicket.model.IModel<List<T>> model)
      com.googlecode.wicket.jquery.core.JQueryBehavior newWidgetBehavior​(String selector)  
      void onEvent​(org.apache.wicket.event.IEvent<?> event)  
      protected void onInitialize()  
      void onReceive​(org.apache.wicket.ajax.AjaxRequestTarget target, T item, int index)
      Triggered when a connected sortable list has received an item from another list.
      void onRemove​(org.apache.wicket.ajax.AjaxRequestTarget target, T item)
      Triggered when a sortable item has been dragged out from the list and into another.
      void onUpdate​(org.apache.wicket.ajax.AjaxRequestTarget target, T item, int index)
      Triggered when the user stopped sorting and the DOM position has changed.
      • Methods inherited from class com.googlecode.wicket.jquery.core.JQueryContainer

        onBeforeRender, onConfigure
      • Methods inherited from class org.apache.wicket.markup.html.WebMarkupContainer

        getWebApplication, getWebPage, getWebRequest, getWebResponse, getWebSession
      • Methods inherited from class org.apache.wicket.MarkupContainer

        add, addDequeuedComponent, addOrReplace, autoAdd, canDequeueTag, contains, dequeue, dequeue, dequeuePreamble, findChildComponent, findComponentToDequeue, get, getAssociatedMarkup, getAssociatedMarkupStream, getMarkup, getMarkupType, getRegionMarkup, internalAdd, internalInitialize, iterator, iterator, newDequeueContext, onComponentTagBody, onDetach, onRender, queue, remove, remove, removeAll, renderAll, renderAssociatedMarkup, renderNext, replace, setDefaultModel, size, stream, streamChildren, toString, toString, visitChildren, visitChildren
      • 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, 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, newMarkupSourcingStrategy, onAfterRender, onBeforeRender, onComponentTag, onConfigure, 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, 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

      • Sortable

        public Sortable​(String id,
                        List<T> list)
        Constructor
        Parameters:
        id - the markup id
        list - the list the Sortable should observe.
      • Sortable

        public Sortable​(String id,
                        List<T> list,
                        com.googlecode.wicket.jquery.core.Options options)
        Constructor
        Parameters:
        id - the markup id
        list - the list the Sortable should observe.
        options - the Options
      • Sortable

        public Sortable​(String id,
                        org.apache.wicket.model.IModel<List<T>> model)
        Constructor
        Parameters:
        id - the markup id
        model - the list the Sortable should observe.
      • Sortable

        public Sortable​(String id,
                        org.apache.wicket.model.IModel<List<T>> model,
                        com.googlecode.wicket.jquery.core.Options options)
        Constructor
        Parameters:
        id - the markup id
        model - the list the Sortable should observe.
        options - the Options
    • Method Detail

      • onInitialize

        protected void onInitialize()
        Overrides:
        onInitialize in class com.googlecode.wicket.jquery.core.JQueryContainer
      • onEvent

        public void onEvent​(org.apache.wicket.event.IEvent<?> event)
        Specified by:
        onEvent in interface org.apache.wicket.event.IEventSink
        Overrides:
        onEvent in class org.apache.wicket.Component
      • onUpdate

        public void onUpdate​(org.apache.wicket.ajax.AjaxRequestTarget target,
                             T item,
                             int index)
        Description copied from interface: ISortableListener
        Triggered when the user stopped sorting and the DOM position has changed.
        Specified by:
        onUpdate in interface ISortableListener<T>
        Parameters:
        target - the AjaxRequestTarget
        item - the item that has been sorted
        index - the item's new index (zero based)
      • onReceive

        public void onReceive​(org.apache.wicket.ajax.AjaxRequestTarget target,
                              T item,
                              int index)
        Description copied from interface: ISortableListener
        Triggered when a connected sortable list has received an item from another list.
        Specified by:
        onReceive in interface ISortableListener<T>
        Parameters:
        target - the AjaxRequestTarget
        item - the item that has been received
        index - the item's new index (zero based)
      • onRemove

        public void onRemove​(org.apache.wicket.ajax.AjaxRequestTarget target,
                             T item)
        Description copied from interface: ISortableListener
        Triggered when a sortable item has been dragged out from the list and into another.
        Specified by:
        onRemove in interface ISortableListener<T>
        Parameters:
        target - the AjaxRequestTarget
        item - the item that has been received
      • connectWith

        public Sortable<T> connectWith​(Sortable<T> sortable)
        Connects with another Sortable
        The specified Sortable will keep a reference to the caller (this).
        Parameters:
        sortable - the Sortable to connect with
        Returns:
        this, for chaining
      • findItem

        protected T findItem​(String id,
                             List<T> list)
        Helper method to locate an item in a list by identifier.
        By default, uses item's hashcode as identifier.
        Parameters:
        id - the item id
        list - the list of items
        Returns:
        the item with that identifier or null if there is no such
        See Also:
        SortableBehavior.findItem(String, List)
      • newWidgetBehavior

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