Class Sortable<T>
- java.lang.Object
-
- org.apache.wicket.Component
-
- org.apache.wicket.MarkupContainer
-
- org.apache.wicket.markup.html.WebMarkupContainer
-
- com.googlecode.wicket.jquery.core.JQueryContainer
-
- com.googlecode.wicket.jquery.core.JQueryGenericContainer<List<T>>
-
- com.googlecode.wicket.jquery.ui.interaction.sortable.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 sortableJQueryGenericContainer
.
TheSortable
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 theListView
to be used within theSortable
-
Field Summary
Fields Modifier and Type Field Description protected com.googlecode.wicket.jquery.core.Options
options
-
Constructor Summary
Constructors Constructor Description Sortable(String id, List<T> list)
ConstructorSortable(String id, List<T> list, com.googlecode.wicket.jquery.core.Options options)
ConstructorSortable(String id, org.apache.wicket.model.IModel<List<T>> model)
ConstructorSortable(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)
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, theISortableListener.onReceive(AjaxRequestTarget, Object, int)
event will be triggered.boolean
isOnRemoveEnabled()
Indicates whether the 'remove' event is enabled.
If true, theISortableListener.onRemove(AjaxRequestTarget, Object)
event will be triggered.protected abstract Sortable.HashListView<T>
newListView(org.apache.wicket.model.IModel<List<T>> model)
Gets a newSortable.HashListView
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 class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.apache.wicket.IGenericComponent
getDefaultModel, getDefaultModelObject, getModel, getModelObject, setDefaultModel, setDefaultModelObject, setModel, setModelObject
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Constructor Detail
-
Sortable
public Sortable(String id, List<T> list)
Constructor- Parameters:
id
- the markup idlist
- the list theSortable
should observe.
-
Sortable
public Sortable(String id, List<T> list, com.googlecode.wicket.jquery.core.Options options)
Constructor- Parameters:
id
- the markup idlist
- the list theSortable
should observe.options
- theOptions
-
Sortable
public Sortable(String id, org.apache.wicket.model.IModel<List<T>> model)
Constructor- Parameters:
id
- the markup idmodel
- the list theSortable
should observe.
-
-
Method Detail
-
onInitialize
protected void onInitialize()
- Overrides:
onInitialize
in classcom.googlecode.wicket.jquery.core.JQueryContainer
-
onEvent
public void onEvent(org.apache.wicket.event.IEvent<?> event)
- Specified by:
onEvent
in interfaceorg.apache.wicket.event.IEventSink
- Overrides:
onEvent
in classorg.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 interfaceISortableListener<T>
- Parameters:
target
- theAjaxRequestTarget
item
- the item that has been sortedindex
- 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 interfaceISortableListener<T>
- Parameters:
target
- theAjaxRequestTarget
item
- the item that has been receivedindex
- 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 interfaceISortableListener<T>
- Parameters:
target
- theAjaxRequestTarget
item
- the item that has been received
-
isOnReceiveEnabled
public boolean isOnReceiveEnabled()
Description copied from interface:ISortableListener
Indicates whether the 'receive' event is enabled.
If true, theISortableListener.onReceive(AjaxRequestTarget, Object, int)
event will be triggered.- Specified by:
isOnReceiveEnabled
in interfaceISortableListener<T>
- Returns:
- false by default
-
isOnRemoveEnabled
public boolean isOnRemoveEnabled()
Description copied from interface:ISortableListener
Indicates whether the 'remove' event is enabled.
If true, theISortableListener.onRemove(AjaxRequestTarget, Object)
event will be triggered.- Specified by:
isOnRemoveEnabled
in interfaceISortableListener<T>
- Returns:
- false by default
-
connectWith
public Sortable<T> connectWith(Sortable<T> sortable)
- Parameters:
sortable
- theSortable
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 idlist
- 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 interfacecom.googlecode.wicket.jquery.core.IJQueryWidget
-
newListView
protected abstract Sortable.HashListView<T> newListView(org.apache.wicket.model.IModel<List<T>> model)
Gets a newSortable.HashListView
- Parameters:
model
- theIModel
that should be used- Returns:
- the
Sortable.HashListView
-
-