E - Type of component to findpublic abstract class SortableAjaxBehavior<E extends org.apache.wicket.Component>
extends org.apache.wicket.ajax.AbstractDefaultAjaxBehavior
Sets the attached component sortable behavior. When the user finished to
sort some childs components,onReceive(Component, int, Component, AjaxRequestTarget),
or / and onRemove(Component, AjaxRequestTarget) or / and
onUpdate(Component, int, AjaxRequestTarget) is / are called via Ajax.
This behavior contains a SortableBehavior which is used to control
the options of the sortable, including all the options and event of the
behavior. Example:
SortableAjaxBehavior sortable = new SortableAjaxBehavior(SortedEvent.RECEIVE) {
public void onReceive(Component sortedComponent, int index,
Component parentSortedComponent, AjaxRequestTarget ajaxRequestTarget) {
// Only this method will be called
...
}
public void onRemove(Component sortedComponent, AjaxRequestTarget ajaxRequestTarget) {
...
}
public void onUpdate(Component sortedComponent, int index, AjaxRequestTarget ajaxRequestTarget) {
...
}
}
SortableBehavior sb = sortable.getSortableBehavior();
sb.setConnectWith("#anotherSortableList");
sb.setRevert(true);
add(sortable);
| Modifier and Type | Class and Description |
|---|---|
static class |
SortableAjaxBehavior.SortedEvent
Enumeration of sorted ajax callback
|
| Constructor and Description |
|---|
SortableAjaxBehavior()
Default constructor
|
SortableAjaxBehavior(SortableAjaxBehavior.SortedEvent... callbacks)
Constructor
|
| Modifier and Type | Method and Description |
|---|---|
JsStatement |
cancel()
Method to cancel
This will return the element back to its pre-init state.
|
void |
cancel(org.apache.wicket.ajax.AjaxRequestTarget ajaxRequestTarget)
Method to cancel within the ajax request
|
void |
contribute(WiQueryResourceManager wiQueryResourceManager) |
JsStatement |
destroy()
Method to destroy
This will return the element back to its pre-init state.
|
void |
destroy(org.apache.wicket.ajax.AjaxRequestTarget ajaxRequestTarget)
Method to destroy within the ajax request
|
JsStatement |
disable()
Method to disable
|
void |
disable(org.apache.wicket.ajax.AjaxRequestTarget ajaxRequestTarget)
Method to disable within the ajax request
|
JsStatement |
enable()
Method to enable
|
void |
enable(org.apache.wicket.ajax.AjaxRequestTarget ajaxRequestTarget)
Method to enable within the ajax request
|
String |
getAppendTo() |
SortableBehavior.AxisEnum |
getAxis() |
protected CharSequence |
getCallbackScriptReceive(boolean onlyTargetActivePage)
We use standard AbstractDefaultAjaxBehavior machinery to generate script: what way all the logic
regarding IAjaxCallDecorator or indicatorId will be added to the generated script.
|
protected CharSequence |
getCallbackScriptRemove(boolean onlyTargetActivePage)
We use standard AbstractDefaultAjaxBehavior machinery to generate script: what way all the logic
regarding IAjaxCallDecorator or indicatorId will be added to the generated script.
|
protected CharSequence |
getCallbackScriptUpdate(boolean onlyTargetActivePage)
We use standard AbstractDefaultAjaxBehavior machinery to generate script: what way all the logic
regarding IAjaxCallDecorator or indicatorId will be added to the generated script.
|
String |
getCancel() |
String |
getConnectWith() |
SortableContainment |
getContainmentComplex() |
String |
getCursor() |
SortableBehavior.CursorAtEnum |
getCursorAt() |
int |
getDelay() |
int |
getDistance() |
ICollectionItemOptions |
getGrid() |
String |
getHandle() |
SortableHelper |
getHelperComplex() |
String |
getItems() |
float |
getOpacity() |
String |
getPlaceHolder() |
SortableRevert |
getRevert() |
int |
getScrollSensitivity() |
int |
getScrollSpeed() |
SortableBehavior |
getSortableBehavior() |
SortableBehavior.ToleranceEnum |
getTolerance() |
int |
getZIndex() |
boolean |
isDisabled() |
boolean |
isDropOnEmpty() |
boolean |
isForceHelperSize() |
boolean |
isForcePlaceholderSize() |
boolean |
isScroll() |
protected void |
onBind() |
abstract void |
onReceive(E sortedComponent,
int index,
org.apache.wicket.Component parentSortedComponent,
org.apache.wicket.ajax.AjaxRequestTarget ajaxRequestTarget)
onReceive is called back when a connected sortable list has received an item
from another list.
|
abstract void |
onRemove(E sortedComponent,
org.apache.wicket.ajax.AjaxRequestTarget ajaxRequestTarget)
OnRemove is called back when a sortable item has been dragged out from the
list and into another.
|
void |
onSort(org.apache.wicket.ajax.AjaxRequestTarget target)
For framework internal use only.
|
abstract void |
onUpdate(E sortedComponent,
int index,
org.apache.wicket.ajax.AjaxRequestTarget ajaxRequestTarget)
onUpdate is called back when the user stopped sorting and the DOM
position has changed.
|
JsStatement |
refresh()
Method to refresh
|
void |
refresh(org.apache.wicket.ajax.AjaxRequestTarget ajaxRequestTarget)
Method to refresh within the ajax request
|
JsStatement |
refreshPositions()
Method to refresh positions
|
void |
refreshPositions(org.apache.wicket.ajax.AjaxRequestTarget ajaxRequestTarget)
Method to refresh positions within the ajax request
|
protected void |
respond(org.apache.wicket.ajax.AjaxRequestTarget target) |
JsStatement |
serialize()
Method to serialize (in default mode)
|
void |
serialize(org.apache.wicket.ajax.AjaxRequestTarget ajaxRequestTarget)
Method to serialize (in default mode) within the ajax request
|
SortableAjaxBehavior<E> |
setAppendTo(String appendTo)
Defines where the helper that moves with the mouse is being appended to
during the drag (for example, to resolve overlap/zIndex issues).
|
SortableAjaxBehavior<E> |
setAxis(SortableBehavior.AxisEnum axis)
If defined, the items can be dragged only horizontally or vertically.
|
SortableAjaxBehavior<E> |
setCancel(String cancel)
Set's the prevent selecting if you start on elements matching the selector
|
SortableAjaxBehavior<E> |
setConnectWith(String connectWith)
Set a jQuery selector with items that also have sortables applied.
|
SortableAjaxBehavior<E> |
setContainment(SortableContainment containment)
Constrains dragging to within the bounds of the specified element -
can be a DOM element, 'parent', 'document', 'window', or a jQuery selector.
|
SortableAjaxBehavior<E> |
setCursor(String cursor)
Set the cursor that is being shown while sorting
|
SortableAjaxBehavior<E> |
setCursorAt(SortableBehavior.CursorAtEnum cusorAt)
Moves the sorting element or helper so the cursor always appears to drag
from the same position.
|
SortableAjaxBehavior<E> |
setDelay(int delay)
Set's the delay (in milliseconds) to define when the sorting should start
|
SortableAjaxBehavior<E> |
setDisabled(boolean disabled)
Disables (true) or enables (false) the sortable.
|
SortableAjaxBehavior<E> |
setDistance(int distance)
Set's the tolerance in pixels
|
SortableAjaxBehavior<E> |
setDropOnEmpty(boolean dropOnEmpty)
If empty allows for an item to be dropped from a linked selectable.
|
SortableAjaxBehavior<E> |
setForceHelperSize(boolean forceHelperSize)
If true, forces the helper to have a size.
|
SortableAjaxBehavior<E> |
setForcePlaceholderSize(boolean forcePlaceholderSize)
If true, forces the placeholder to have a size.
|
SortableAjaxBehavior<E> |
setGrid(int x,
int y)
Snaps the sorting element or helper to a grid, every x and y pixels.
|
SortableAjaxBehavior<E> |
setHandle(String handle)
Restricts sort start click to the specified element.
|
SortableAjaxBehavior<E> |
setHelper(SortableHelper helper)
Allows for a helper element to be used for dragging display.
|
SortableAjaxBehavior<E> |
setItems(String items)
Specifies which items inside the element should be sortable.
|
SortableAjaxBehavior<E> |
setOpacity(float opacity)
Set the opacity of the helper while sorting.
|
SortableAjaxBehavior<E> |
setPlaceholder(String placeholder)
Set's the class that gets applied to the otherwise white space.
|
SortableAjaxBehavior<E> |
setRevert(SortableRevert revert)
If set to true, the item will be reverted to its new DOM position with
a smooth animation.
|
SortableAjaxBehavior<E> |
setScroll(boolean scroll)
If set to true, the page scrolls when coming to an edge.
|
SortableAjaxBehavior<E> |
setScrollSensitivity(int scrollSensitivity)
Defines how near the mouse must be to an edge to start scrolling.
|
SortableAjaxBehavior<E> |
setScrollSpeed(int scrollSpeed)
The speed at which the window should scroll once the mouse pointer gets
within the scrollSensitivity distance.
|
SortableAjaxBehavior<E> |
setTolerance(SortableBehavior.ToleranceEnum tolerance)
Set's the tolerance
intersect: draggable overlaps the droppable at least 50%
pointer: mouse pointer overlaps the droppable
|
SortableAjaxBehavior<E> |
setZIndex(int zIndex)
Set's Z-index for element/helper while being sorted.
|
protected JsStatement |
statement() |
JsStatement |
toArray()
Method to serializes the sortable's item id's into an array of string
|
JsStatement |
widget()
Method to returns the .ui-sortable element
|
void |
widget(org.apache.wicket.ajax.AjaxRequestTarget ajaxRequestTarget)
Method to returns the .ui-sortable element within the ajax request
|
findIndicatorId, generateCallbackScript, getAjaxCallDecorator, getCallbackScript, getCallbackScript, getChannelName, getFailureScript, getPreconditionScript, getSuccessScript, onRequest, renderHead, throttleScriptbind, getCallbackUrl, getCallbackUrl, getComponent, getImplementationId, getStatelessHint, onComponentRendered, onComponentTag, onComponentTag, onRendered, onRenderHeadContribution, onRenderHeadInitContributionpublic SortableAjaxBehavior()
public SortableAjaxBehavior(SortableAjaxBehavior.SortedEvent... callbacks)
callbacks - Ajax callbacks to enableprotected CharSequence getCallbackScriptReceive(boolean onlyTargetActivePage)
AbstractDefaultAjaxBehavior.getCallbackScript(boolean)protected CharSequence getCallbackScriptRemove(boolean onlyTargetActivePage)
AbstractDefaultAjaxBehavior.getCallbackScript(boolean)protected CharSequence getCallbackScriptUpdate(boolean onlyTargetActivePage)
AbstractDefaultAjaxBehavior.getCallbackScript(boolean)public void contribute(WiQueryResourceManager wiQueryResourceManager)
public SortableBehavior getSortableBehavior()
protected void onBind()
onBind in class org.apache.wicket.ajax.AbstractDefaultAjaxBehaviorAbstractDefaultAjaxBehavior.onBind()public abstract void onReceive(E sortedComponent, int index, org.apache.wicket.Component parentSortedComponent, org.apache.wicket.ajax.AjaxRequestTarget ajaxRequestTarget)
sortedComponent - the sorted ComponentparentSortedComponent - the parent of the sorted Componentindex - Index of the sorted ComponentajaxRequestTarget - the Ajax targetpublic abstract void onRemove(E sortedComponent, org.apache.wicket.ajax.AjaxRequestTarget ajaxRequestTarget)
sortedComponent - the sorted ComponentajaxRequestTarget - the Ajax targetpublic final void onSort(org.apache.wicket.ajax.AjaxRequestTarget target)
public abstract void onUpdate(E sortedComponent, int index, org.apache.wicket.ajax.AjaxRequestTarget ajaxRequestTarget)
sortedComponent - the sorted Componentindex - Index of the sorted ComponentajaxRequestTarget - the Ajax targetprotected void respond(org.apache.wicket.ajax.AjaxRequestTarget target)
respond in class org.apache.wicket.ajax.AbstractDefaultAjaxBehaviorAbstractDefaultAjaxBehavior.respond(org.apache.wicket.ajax.AjaxRequestTarget)protected JsStatement statement()
IWiQueryPlugin.statement()public String getAppendTo()
public SortableBehavior.AxisEnum getAxis()
public String getCancel()
public String getConnectWith()
public SortableContainment getContainmentComplex()
public String getCursor()
public SortableBehavior.CursorAtEnum getCursorAt()
public int getDelay()
public int getDistance()
public ICollectionItemOptions getGrid()
public String getHandle()
public SortableHelper getHelperComplex()
public String getItems()
public float getOpacity()
public String getPlaceHolder()
public SortableRevert getRevert()
public int getScrollSensitivity()
public int getScrollSpeed()
public SortableBehavior.ToleranceEnum getTolerance()
public int getZIndex()
public SortableAjaxBehavior<E> setDisabled(boolean disabled)
disabled - public boolean isDisabled()
public boolean isDropOnEmpty()
public boolean isForceHelperSize()
public boolean isForcePlaceholderSize()
public boolean isScroll()
public SortableAjaxBehavior<E> setAppendTo(String appendTo)
appendTo - public SortableAjaxBehavior<E> setAxis(SortableBehavior.AxisEnum axis)
axis - public SortableAjaxBehavior<E> setCancel(String cancel)
cancel - Selector (default : ':input,option')public SortableAjaxBehavior<E> setConnectWith(String connectWith)
connectWith - Selectorpublic SortableAjaxBehavior<E> setContainment(SortableContainment containment)
containment - public SortableAjaxBehavior<E> setCursor(String cursor)
cursor - public SortableAjaxBehavior<E> setCursorAt(SortableBehavior.CursorAtEnum cusorAt)
cusorAt - public SortableAjaxBehavior<E> setDelay(int delay)
delay - public SortableAjaxBehavior<E> setDistance(int distance)
distance - public SortableAjaxBehavior<E> setDropOnEmpty(boolean dropOnEmpty)
dropOnEmpty - public SortableAjaxBehavior<E> setForceHelperSize(boolean forceHelperSize)
forceHelperSize - public SortableAjaxBehavior<E> setForcePlaceholderSize(boolean forcePlaceholderSize)
forcePlaceholderSize - public SortableAjaxBehavior<E> setGrid(int x, int y)
x - y - public SortableAjaxBehavior<E> setHandle(String handle)
handle - public SortableAjaxBehavior<E> setHelper(SortableHelper helper)
helper - public SortableAjaxBehavior<E> setItems(String items)
items - Cursor (default : '> *')public SortableAjaxBehavior<E> setOpacity(float opacity)
opacity - public SortableAjaxBehavior<E> setPlaceholder(String placeholder)
placeholder - public SortableAjaxBehavior<E> setRevert(SortableRevert revert)
revert - public SortableAjaxBehavior<E> setScroll(boolean scroll)
scroll - public SortableAjaxBehavior<E> setScrollSensitivity(int scrollSensitivity)
scrollSensitivity - public SortableAjaxBehavior<E> setScrollSpeed(int scrollSpeed)
scrollSpeed - public SortableAjaxBehavior<E> setTolerance(SortableBehavior.ToleranceEnum tolerance)
tolerance - public SortableAjaxBehavior<E> setZIndex(int zIndex)
zIndex - public JsStatement cancel()
public void cancel(org.apache.wicket.ajax.AjaxRequestTarget ajaxRequestTarget)
ajaxRequestTarget - public JsStatement destroy()
public void destroy(org.apache.wicket.ajax.AjaxRequestTarget ajaxRequestTarget)
ajaxRequestTarget - public JsStatement disable()
public void disable(org.apache.wicket.ajax.AjaxRequestTarget ajaxRequestTarget)
ajaxRequestTarget - public JsStatement enable()
public void enable(org.apache.wicket.ajax.AjaxRequestTarget ajaxRequestTarget)
ajaxRequestTarget - public JsStatement refresh()
public void refresh(org.apache.wicket.ajax.AjaxRequestTarget ajaxRequestTarget)
ajaxRequestTarget - public JsStatement refreshPositions()
public void refreshPositions(org.apache.wicket.ajax.AjaxRequestTarget ajaxRequestTarget)
ajaxRequestTarget - public JsStatement serialize()
public void serialize(org.apache.wicket.ajax.AjaxRequestTarget ajaxRequestTarget)
ajaxRequestTarget - public JsStatement toArray()
public JsStatement widget()
public void widget(org.apache.wicket.ajax.AjaxRequestTarget ajaxRequestTarget)
ajaxRequestTarget - Copyright © 2009-2012. All Rights Reserved.