Class SortableBehavior<T>
- java.lang.Object
-
- org.apache.wicket.behavior.Behavior
-
- com.googlecode.wicket.jquery.core.JQueryAbstractBehavior
-
- com.googlecode.wicket.jquery.core.JQueryBehavior
-
- com.googlecode.wicket.jquery.ui.JQueryUIBehavior
-
- com.googlecode.wicket.jquery.ui.interaction.sortable.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
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static class
SortableBehavior.OnReceiveAjaxBehavior
Provides aJQueryAjaxBehavior
that aims to be wired to the 'receive' eventprotected static class
SortableBehavior.OnRemoveAjaxBehavior
Provides aJQueryAjaxBehavior
that aims to be wired to the 'remove' eventprotected static class
SortableBehavior.OnUpdateAjaxBehavior
Provides aJQueryAjaxBehavior
that aims to be wired to the 'update' eventprotected static class
SortableBehavior.ReceiveEvent
Provides an event object that will be broadcasted by theSortableBehavior.OnReceiveAjaxBehavior
callbackprotected static class
SortableBehavior.RemoveEvent
Provides an event object that will be broadcasted by theSortableBehavior.OnRemoveAjaxBehavior
callbackprotected static class
SortableBehavior.SortableEvent
Provides a base class forSortableBehavior
event objectsprotected static class
SortableBehavior.UpdateEvent
Provides an event object that will be broadcasted by theSortableBehavior.OnUpdateAjaxBehavior
callback
-
Constructor Summary
Constructors Constructor Description SortableBehavior(String selector, com.googlecode.wicket.jquery.core.Options options, ISortableListener<T> listener)
ConstructorSortableBehavior(String selector, ISortableListener<T> listener)
Constructor
-
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 sortableprotected abstract List<T>
getItemList()
Gets the reference list of all sortable items.
Usually the model object of the component on which thisSelectableBehavior
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 newJQueryAjaxBehavior
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 newJQueryAjaxBehavior
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 newJQueryAjaxBehavior
that will be wired to the 'update' event, triggered when the user stopped sortingvoid
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.ui.JQueryUIBehavior
destroy, onDestroy, widget, widget, widget, widget
-
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
-
-
-
-
Field Detail
-
METHOD
public static final String METHOD
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
SortableBehavior
public SortableBehavior(String selector, ISortableListener<T> listener)
Constructor- Parameters:
selector
- the html selector (ie: "#myId")listener
- theISortableListener
-
SortableBehavior
public SortableBehavior(String selector, com.googlecode.wicket.jquery.core.Options options, ISortableListener<T> listener)
Constructor- Parameters:
selector
- the html selector (ie: "#myId")options
- theOptions
listener
- theISortableListener
-
-
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 thisSelectableBehavior
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 classorg.apache.wicket.behavior.Behavior
-
bind
public void bind(org.apache.wicket.Component component)
- Overrides:
bind
in classorg.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 idlist
- the list of items- Returns:
- the item with that identifier or
null
if there is no such - See Also:
Sortable.findItem(String, List)
-
onConfigure
public void onConfigure(org.apache.wicket.Component component)
- Overrides:
onConfigure
in classJQueryUIBehavior
-
onAjax
public void onAjax(org.apache.wicket.ajax.AjaxRequestTarget target, com.googlecode.wicket.jquery.core.JQueryEvent event)
- Specified by:
onAjax
in interfacecom.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 newJQueryAjaxBehavior
that will be wired to the 'update' event, triggered when the user stopped sorting- Parameters:
source
- theIJQueryAjaxAware
- 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 newJQueryAjaxBehavior
that will be wired to the 'receive' event, triggered when a connected sortable list has received an item from another list.- Parameters:
source
- theIJQueryAjaxAware
- 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 newJQueryAjaxBehavior
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
- theIJQueryAjaxAware
- Returns:
- a new
OnRemoveAjaxBehavior
by default
-
-