Class SortableBehavior<T>

  • Type Parameters:
    T - the type of the model object
    All Implemented Interfaces:
    com.googlecode.wicket.jquery.core.ajax.IJQueryAjaxAware, JQueryDestroyListener.IDestroyable, Serializable, org.apache.wicket.IComponentAwareEventSink, org.apache.wicket.markup.html.IComponentAwareHeaderContributor, org.apache.wicket.util.io.IClusterable

    public abstract class SortableBehavior<T>
    extends JQueryUIBehavior
    implements com.googlecode.wicket.jquery.core.ajax.IJQueryAjaxAware
    Provides a jQuery sortable behavior
    Author:
    Sebastien Briquet - sebfz1
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static String METHOD  
      • Fields inherited from class com.googlecode.wicket.jquery.core.JQueryBehavior

        method, options, selector
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      void bind​(org.apache.wicket.Component component)  
      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.
      protected List<T> getConnectedList()
      Gets the list of the connected sortable
      protected abstract List<T> getItemList()
      Gets the reference list of all sortable items.
      Usually the model object of the component on which this SelectableBehavior is bound to.
      boolean isEnabled​(org.apache.wicket.Component component)  
      protected com.googlecode.wicket.jquery.core.ajax.JQueryAjaxBehavior newOnReceiveAjaxBehavior​(com.googlecode.wicket.jquery.core.ajax.IJQueryAjaxAware source)
      Gets a new JQueryAjaxBehavior that will be wired to the 'receive' event, triggered when a connected sortable list has received an item from another list.
      protected com.googlecode.wicket.jquery.core.ajax.JQueryAjaxBehavior newOnRemoveAjaxBehavior​(com.googlecode.wicket.jquery.core.ajax.IJQueryAjaxAware source)
      Gets a new JQueryAjaxBehavior that will be wired to the 'remove' event, triggered when a sortable item has been dragged out from the list and into another.
      protected com.googlecode.wicket.jquery.core.ajax.JQueryAjaxBehavior newOnUpdateAjaxBehavior​(com.googlecode.wicket.jquery.core.ajax.IJQueryAjaxAware source)
      Gets a new JQueryAjaxBehavior that will be wired to the 'update' event, triggered when the user stopped sorting
      void onAjax​(org.apache.wicket.ajax.AjaxRequestTarget target, com.googlecode.wicket.jquery.core.JQueryEvent event)  
      void onConfigure​(org.apache.wicket.Component component)  
      • Methods inherited from class com.googlecode.wicket.jquery.core.JQueryBehavior

        $, $, $, $, beforeRender, detach, getMethod, getOption, getOptions, getSelector, off, on, on, register, remove, renderHead, setOption, setOption, setOption, setOptions, setSelector
      • Methods inherited from class com.googlecode.wicket.jquery.core.JQueryAbstractBehavior

        add, getJQueryLibrarySettings, renderOnDomReadyScript, renderPriorityHeaderItem, toString
      • Methods inherited from class org.apache.wicket.behavior.Behavior

        afterRender, canCallListener, detach, getStatelessHint, isTemporary, onAttribute, onComponentTag, onEvent, onException, onRemove, onTag, unbind
    • Constructor Detail

      • SortableBehavior

        public SortableBehavior​(String selector,
                                com.googlecode.wicket.jquery.core.Options options,
                                ISortableListener<T> listener)
        Constructor
        Parameters:
        selector - the html selector (ie: "#myId")
        options - the Options
        listener - the ISortableListener
    • Method Detail

      • getItemList

        protected abstract List<T> getItemList()
        Gets the reference list of all sortable items.
        Usually the model object of the component on which this SelectableBehavior is bound to.
        Returns:
        the List
      • getConnectedList

        protected List<T> getConnectedList()
        Gets the list of the connected sortable
        Returns:
        null by default
      • isEnabled

        public boolean isEnabled​(org.apache.wicket.Component component)
        Overrides:
        isEnabled in class org.apache.wicket.behavior.Behavior
      • bind

        public void bind​(org.apache.wicket.Component component)
        Overrides:
        bind in class org.apache.wicket.behavior.Behavior
      • 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:
        Sortable.findItem(String, List)
      • onAjax

        public void onAjax​(org.apache.wicket.ajax.AjaxRequestTarget target,
                           com.googlecode.wicket.jquery.core.JQueryEvent event)
        Specified by:
        onAjax in interface com.googlecode.wicket.jquery.core.ajax.IJQueryAjaxAware
      • newOnUpdateAjaxBehavior

        protected com.googlecode.wicket.jquery.core.ajax.JQueryAjaxBehavior newOnUpdateAjaxBehavior​(com.googlecode.wicket.jquery.core.ajax.IJQueryAjaxAware source)
        Gets a new JQueryAjaxBehavior that will be wired to the 'update' event, triggered when the user stopped sorting
        Parameters:
        source - the IJQueryAjaxAware
        Returns:
        a new OnUpdateAjaxBehavior by default
      • newOnReceiveAjaxBehavior

        protected com.googlecode.wicket.jquery.core.ajax.JQueryAjaxBehavior newOnReceiveAjaxBehavior​(com.googlecode.wicket.jquery.core.ajax.IJQueryAjaxAware source)
        Gets a new JQueryAjaxBehavior that will be wired to the 'receive' event, triggered when a connected sortable list has received an item from another list.
        Parameters:
        source - the IJQueryAjaxAware
        Returns:
        a new OnReceiveAjaxBehavior by default
      • newOnRemoveAjaxBehavior

        protected com.googlecode.wicket.jquery.core.ajax.JQueryAjaxBehavior newOnRemoveAjaxBehavior​(com.googlecode.wicket.jquery.core.ajax.IJQueryAjaxAware source)
        Gets a new JQueryAjaxBehavior that will be wired to the 'remove' event, triggered when a sortable item has been dragged out from the list and into another.
        Parameters:
        source - the IJQueryAjaxAware
        Returns:
        a new OnRemoveAjaxBehavior by default