public abstract class DraggableAjaxBehavior
extends org.apache.wicket.ajax.AbstractDefaultAjaxBehavior
Sets the attached component draggable and receives ajax event when dragging has stopped.
onStop(Component, AjaxRequestTarget) is
called by an Ajax request.onStart(Component, AjaxRequestTarget) is
called by an Ajax request.onDrag(Component, AjaxRequestTarget) is
called by an Ajax request. Be careful with this as it could cause a lot of ajax requests.| Modifier and Type | Class and Description |
|---|---|
static class |
DraggableAjaxBehavior.DraggableEvent |
| Modifier and Type | Field and Description |
|---|---|
protected static String |
DRAG_STATUS
Drag status (valid / invalid)
|
protected static String |
DRAG_TYPE
Drag type into the request
|
static org.apache.wicket.markup.html.resources.JavascriptResourceReference |
wiQueryDraggableJs
ResourceReference for the wiQuery Draggable javascript
|
| Constructor and Description |
|---|
DraggableAjaxBehavior()
Default constructor
|
DraggableAjaxBehavior(boolean enableAjaxOnInvalid)
Constructor
|
DraggableAjaxBehavior(boolean enableAjaxOnInvalid,
DraggableAjaxBehavior.DraggableEvent... callbacks)
Constructor
|
DraggableAjaxBehavior(DraggableAjaxBehavior.DraggableEvent... callbacks)
Constructor
|
| Modifier and Type | Method and Description |
|---|---|
void |
contribute(WiQueryResourceManager wiQueryResourceManager) |
JsStatement |
destroy()
Method to destroy the draggable
This will return the element back to its pre-init state.
|
void |
destroy(org.apache.wicket.ajax.AjaxRequestTarget ajaxRequestTarget)
Method to destroy the draggable within the ajax request
|
JsStatement |
disable()
Method to disable the draggable
|
void |
disable(org.apache.wicket.ajax.AjaxRequestTarget ajaxRequestTarget)
Method to disable the draggable within the ajax request
|
JsStatement |
enable()
Method to enable the draggable
|
void |
enable(org.apache.wicket.ajax.AjaxRequestTarget ajaxRequestTarget)
Method to enable the draggable within the ajax request
|
String |
getAppendTo() |
DraggableBehavior.AxisEnum |
getAxis() |
protected CharSequence |
getCallbackScript(boolean onlyTargetActivePage,
String dragType)
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 |
getCallbackStopEventScript(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 |
getConnectToSortable() |
DraggableContainment |
getContainment() |
String |
getCursor() |
ListItemOptions<DraggableCursorAt> |
getCursorAtComplex() |
int |
getDelay() |
int |
getDistance() |
DraggableBehavior |
getDraggableBehavior() |
ICollectionItemOptions |
getGrid() |
String |
getHandle() |
DraggableHelper |
getHelper() |
DraggableIframeFix |
getIframeFix() |
float |
getOpacity() |
DraggableRevert |
getRevert() |
int |
getRevertDuration() |
String |
getScope() |
int |
getScrollSensitivity() |
int |
getScrollSpeed() |
DraggableSnap |
getSnap() |
DraggableBehavior.SnapModeEnum |
getSnapMode()
Returns the snapMode option
|
int |
getSnapTolerance() |
String |
getStack() |
int |
getZIndex() |
boolean |
isAddClasses() |
boolean |
isDisabled() |
boolean |
isRefreshPositions() |
boolean |
isScroll() |
protected void |
onBind() |
void |
onDrag(org.apache.wicket.ajax.AjaxRequestTarget target)
For framework internal use only.
|
abstract void |
onDrag(org.apache.wicket.Component component,
org.apache.wicket.ajax.AjaxRequestTarget ajaxRequestTarget)
onDrag is called back when the drag event has been fired.
|
void |
onInvalid(org.apache.wicket.Component component,
org.apache.wicket.ajax.AjaxRequestTarget ajaxRequestTarget)
onInvalid is called back when the drag stop event has been fired and if
the drag was invalid.
|
abstract void |
onStart(org.apache.wicket.Component component,
org.apache.wicket.ajax.AjaxRequestTarget ajaxRequestTarget)
onStart is called back when the drag start event has been fired.
|
abstract void |
onStop(org.apache.wicket.Component draggedComponent,
org.apache.wicket.ajax.AjaxRequestTarget ajaxRequestTarget)
onStop is called back when the drag stop event has been fired.
|
void |
onValid(org.apache.wicket.Component component,
org.apache.wicket.ajax.AjaxRequestTarget ajaxRequestTarget)
onInvalid is called back when the drag stop event has been fired and if
the drag was valid.
|
protected void |
respond(org.apache.wicket.ajax.AjaxRequestTarget target) |
DraggableAjaxBehavior |
setAddClasses(boolean addClasses)
If set to false, will prevent the ui-draggable class from being added.
|
DraggableAjaxBehavior |
setAppendTo(String appendTo)
The element passed to or selected by the appendTo option will be used as
the draggable helper's container during dragging.
|
DraggableAjaxBehavior |
setAxis(DraggableBehavior.AxisEnum axis)
Constrains dragging to either the horizontal (x) or vertical (y) axis.
|
DraggableAjaxBehavior |
setCancel(String cancel)
Set's the prevent selecting if you start on elements matching the selector
|
DraggableAjaxBehavior |
setConnectToSortable(String connectToSortable)
Allows the draggable to be dropped onto the specified sortables.
|
DraggableAjaxBehavior |
setContainment(DraggableContainment containment)
Set's the constrains dragging to within the bounds of the specified element
or region.
|
DraggableAjaxBehavior |
setCursor(String cursor)
Set the css cursor during the drag operation.
|
DraggableAjaxBehavior |
setCursorAt(ListItemOptions<DraggableCursorAt> cusorAt)
Moves the dragging helper so the cursor always appears to drag from the same
position.
|
DraggableAjaxBehavior |
setDelay(int delay)
Time in milliseconds after mousedown until dragging should start.
|
DraggableAjaxBehavior |
setDisabled(boolean disabled)
Disables (true) or enables (false) the draggable.
|
DraggableAjaxBehavior |
setDistance(int distance)
Set's the distance in pixels after mousedown the mouse must move before
dragging should start.
|
DraggableAjaxBehavior |
setGrid(int x,
int y)
Snaps the dragging helper to a grid, every x and y pixels.
|
DraggableAjaxBehavior |
setHandle(String handle)
Restricts sort start click to the specified element.
|
DraggableAjaxBehavior |
setHelper(DraggableHelper helper)
Allows for a helper element to be used for dragging display.
|
DraggableAjaxBehavior |
setIframeFix(DraggableIframeFix iframeFix)
Prevent iframes from capturing the mousemove events during a drag.
|
DraggableAjaxBehavior |
setOpacity(float opacity)
Set's the opacity for the helper while being dragged.
|
DraggableAjaxBehavior |
setRefreshPositions(boolean refreshPositions)
If set to true, all droppable positions are calculated on every mousemove.
|
DraggableAjaxBehavior |
setRevert(DraggableRevert revert)
If set to true, the element will return to its start position when dragging
stops.
|
DraggableAjaxBehavior |
setRevertDuration(int revertDuration)
Set's the duration of the revert animation, in milliseconds.
|
DraggableAjaxBehavior |
setScope(String scope)
Used to group sets of draggable and droppable items, in addition to
droppable's accept option.
|
DraggableAjaxBehavior |
setScroll(boolean scroll)
If set to true, container auto-scrolls while dragging.
|
DraggableAjaxBehavior |
setScrollSensitivity(int scrollSensitivity)
Set's the distance in pixels from the edge of the viewport after which the
viewport should scroll.
|
DraggableAjaxBehavior |
setScrollSpeed(int scrollSpeed)
Set's speed at which the window should scroll once the mouse pointer gets
within the scrollSensitivity distance.
|
DraggableAjaxBehavior |
setSnap(DraggableSnap snap)
If set to a selector or to true (equivalent to '.ui-draggable'), the
draggable will snap to the edges of the selected elements when near an
edge of the element.
|
DraggableAjaxBehavior |
setSnapMode(DraggableBehavior.SnapModeEnum snapMode)
Sets the edges of snap elements the draggable will snap to.
|
DraggableAjaxBehavior |
setSnapTolerance(int snapTolerance)
Set's distance in pixels from the snap element edges at which snapping
should occur.
|
DraggableAjaxBehavior |
setStack(String stack)
Controls the z-Index of the defined group (key 'group' in the hash,
accepts jQuery selector) automatically, always brings to front the dragged
item.
|
DraggableAjaxBehavior |
setZIndex(int zIndex)
Set's the starting z-index
|
protected JsStatement |
statement() |
JsStatement |
widget()
Method to returns the .ui-draggable element
|
void |
widget(org.apache.wicket.ajax.AjaxRequestTarget ajaxRequestTarget)
Method to returns the .ui-draggable 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 static final org.apache.wicket.markup.html.resources.JavascriptResourceReference wiQueryDraggableJs
protected static final String DRAG_TYPE
protected static final String DRAG_STATUS
public DraggableAjaxBehavior()
public DraggableAjaxBehavior(boolean enableAjaxOnInvalid)
enableAjaxOnInvalid - If true, when a drag is invalid
an ajax request will be send. Otherwise, onStop(Component, AjaxRequestTarget),
onValid(Component, AjaxRequestTarget) and
onInvalid(Component, AjaxRequestTarget) will be never called.public DraggableAjaxBehavior(boolean enableAjaxOnInvalid,
DraggableAjaxBehavior.DraggableEvent... callbacks)
enableAjaxOnInvalid - If true, when a drag is invalid
an ajax request will be send. Otherwise, onStop(Component, AjaxRequestTarget),
onValid(Component, AjaxRequestTarget) and
onInvalid(Component, AjaxRequestTarget) will be never called.callbacks - Ajax callbacks to enablepublic DraggableAjaxBehavior(DraggableAjaxBehavior.DraggableEvent... callbacks)
callbacks - Ajax callbacks to enablepublic void contribute(WiQueryResourceManager wiQueryResourceManager)
public DraggableBehavior getDraggableBehavior()
protected void onBind()
onBind in class org.apache.wicket.ajax.AbstractDefaultAjaxBehaviorAbstractDefaultAjaxBehavior.onBind()public final void onDrag(org.apache.wicket.ajax.AjaxRequestTarget target)
public abstract void onDrag(org.apache.wicket.Component component,
org.apache.wicket.ajax.AjaxRequestTarget ajaxRequestTarget)
draggedComponent - the dragged ComponentajaxRequestTarget - the Ajax targetpublic void onInvalid(org.apache.wicket.Component component,
org.apache.wicket.ajax.AjaxRequestTarget ajaxRequestTarget)
onStop(Component, AjaxRequestTarget) is called before
this event.
Override this method to listen the invalid eventdraggedComponent - the dragged ComponentajaxRequestTarget - the Ajax targetpublic abstract void onStart(org.apache.wicket.Component component,
org.apache.wicket.ajax.AjaxRequestTarget ajaxRequestTarget)
draggedComponent - the dragged ComponentajaxRequestTarget - the Ajax targetpublic abstract void onStop(org.apache.wicket.Component draggedComponent,
org.apache.wicket.ajax.AjaxRequestTarget ajaxRequestTarget)
onValid(Component, AjaxRequestTarget)
and before onInvalid(Component, AjaxRequestTarget)draggedComponent - the dragged ComponentajaxRequestTarget - the Ajax targetpublic void onValid(org.apache.wicket.Component component,
org.apache.wicket.ajax.AjaxRequestTarget ajaxRequestTarget)
onStop(Component, AjaxRequestTarget) is called before
this event.
Override this method to listen the invalid eventdraggedComponent - the dragged 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()protected CharSequence getCallbackStopEventScript(boolean onlyTargetActivePage)
onlyTargetActivePage - dragType - protected CharSequence getCallbackScript(boolean onlyTargetActivePage, String dragType)
onlyTargetActivePage - dragType - public DraggableAjaxBehavior setAddClasses(boolean addClasses)
addClasses - public boolean isAddClasses()
public DraggableAjaxBehavior setAppendTo(String appendTo)
appendTo - public String getAppendTo()
public DraggableAjaxBehavior setAxis(DraggableBehavior.AxisEnum axis)
axis - public DraggableBehavior.AxisEnum getAxis()
public DraggableAjaxBehavior setCancel(String cancel)
cancel - Selector (default : ':input,option')public String getCancel()
public DraggableAjaxBehavior setConnectToSortable(String connectToSortable)
connectToSortable - public String getConnectToSortable()
public DraggableAjaxBehavior setContainment(DraggableContainment containment)
containment - public DraggableContainment getContainment()
public DraggableAjaxBehavior setCursor(String cursor)
cursor - public String getCursor()
public DraggableAjaxBehavior setCursorAt(ListItemOptions<DraggableCursorAt> cusorAt)
cusorAt - public ListItemOptions<DraggableCursorAt> getCursorAtComplex()
public DraggableAjaxBehavior setDelay(int delay)
delay - public int getDelay()
public DraggableAjaxBehavior setDisabled(boolean disabled)
disabled - public boolean isDisabled()
public DraggableAjaxBehavior setDistance(int distance)
distance - public int getDistance()
public DraggableAjaxBehavior setGrid(int x, int y)
x - y - public ICollectionItemOptions getGrid()
public DraggableAjaxBehavior setHandle(String handle)
handle - public String getHandle()
public DraggableAjaxBehavior setHelper(DraggableHelper helper)
helper - public DraggableHelper getHelper()
public DraggableAjaxBehavior setIframeFix(DraggableIframeFix iframeFix)
iframeFix - public DraggableIframeFix getIframeFix()
public DraggableAjaxBehavior setOpacity(float opacity)
opacity - public float getOpacity()
public DraggableAjaxBehavior setRefreshPositions(boolean refreshPositions)
refreshPositions - public boolean isRefreshPositions()
public DraggableAjaxBehavior setRevert(DraggableRevert revert)
revert - public DraggableRevert getRevert()
public DraggableAjaxBehavior setRevertDuration(int revertDuration)
revertDuration - public int getRevertDuration()
public DraggableAjaxBehavior setScope(String scope)
scope - public String getScope()
public DraggableAjaxBehavior setScroll(boolean scroll)
scroll - public boolean isScroll()
public DraggableAjaxBehavior setScrollSensitivity(int scrollSensitivity)
scrollSensitivity - public int getScrollSensitivity()
public DraggableAjaxBehavior setScrollSpeed(int scrollSpeed)
scrollSpeed - public int getScrollSpeed()
public DraggableAjaxBehavior setSnap(DraggableSnap snap)
snap - public DraggableSnap getSnap()
public DraggableAjaxBehavior setSnapMode(DraggableBehavior.SnapModeEnum snapMode)
snapMode - public DraggableBehavior.SnapModeEnum getSnapMode()
public DraggableAjaxBehavior setSnapTolerance(int snapTolerance)
snapTolerance - public int getSnapTolerance()
public DraggableAjaxBehavior setStack(String stack)
stack - public String getStack()
public DraggableAjaxBehavior setZIndex(int zIndex)
zIndex - public int getZIndex()
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 widget()
public void widget(org.apache.wicket.ajax.AjaxRequestTarget ajaxRequestTarget)
ajaxRequestTarget - Copyright © 2009-2012. All Rights Reserved.