public class DraggableBehavior extends AbstractDragDropBehavior
Component
to make it
draggable. An instance of this class can be added to one and only one
Component
. Another Component
that should have exactly the
same draggable behavior needs it's own instance.Modifier and Type | Class and Description |
---|---|
static class |
DraggableBehavior.DragHelperMode |
static class |
DraggableBehavior.DragRevertMode |
static class |
DraggableBehavior.DragSnapMode |
AbstractDragDropBehavior.EventType
JQueryAjaxBehavior.JsAjaxCallbackFunction, JQueryAjaxBehavior.JsBuilder, JQueryAjaxBehavior.JsFunction
Modifier and Type | Field and Description |
---|---|
static JQueryResourceReference |
jQueryUiDraggableJs |
jQueryUiAccordionCss, jQueryUiBaseCss, jQueryUiCoreJs, jQueryUiCss, jQueryUiCustomCss, jQueryUiMouseJs, jQueryUiPositionJs, jQueryUiThemeCss, jQueryUiWidgetJs
rendered
rawOptions
Constructor and Description |
---|
DraggableBehavior() |
Modifier and Type | Method and Description |
---|---|
void |
disable(org.apache.wicket.ajax.AjaxRequestTarget target)
Disable the dragging
|
void |
enable(org.apache.wicket.ajax.AjaxRequestTarget target)
Enable the dragging
|
protected JQueryAjaxBehavior.JsBuilder |
getJsBuilder() |
String |
getName()
Get the name of this draggable
|
protected void |
onDrag(org.apache.wicket.ajax.AjaxRequestTarget target,
SpecialKeys specialKeys)
If you have set
setWantOnDragNotification(boolean) to true
this method is called whenever ths mouse moves during the drag operation. |
protected void |
onDragStart(org.apache.wicket.ajax.AjaxRequestTarget target,
SpecialKeys specialKeys)
If you have set
setWantOnDragStartNotification(boolean) to true
this method is called when the drag operation starts. |
protected void |
onDragStop(org.apache.wicket.ajax.AjaxRequestTarget target,
SpecialKeys specialKeys)
If you have set
setWantOnDragStopNotification(boolean) to true
this method is called when the drag operation stops. |
protected void |
respond(org.apache.wicket.ajax.AjaxRequestTarget target)
handles the event processing during dragging.
|
DraggableBehavior |
setAddClasses(org.apache.wicket.ajax.AjaxRequestTarget target,
boolean value) |
DraggableBehavior |
setAddClasses(boolean value)
Sets the 'addClasses' property for this draggable.
|
DraggableBehavior |
setAxis(org.apache.wicket.ajax.AjaxRequestTarget target,
char value) |
DraggableBehavior |
setAxis(char value)
Sets the 'axis' property for this draggable.
|
DraggableBehavior |
setCursor(org.apache.wicket.ajax.AjaxRequestTarget target,
CssCursor value) |
DraggableBehavior |
setCursor(CssCursor value)
Sets the 'cursor' property for this draggable.
|
DraggableBehavior |
setCursorAt(org.apache.wicket.ajax.AjaxRequestTarget target,
CssPosition position,
int offset) |
DraggableBehavior |
setCursorAt(org.apache.wicket.ajax.AjaxRequestTarget target,
CssPosition position1,
int offset1,
CssPosition position2,
int offset2) |
DraggableBehavior |
setCursorAt(CssPosition position,
int offset)
Sets the 'cursorAt' property for this draggable.
|
DraggableBehavior |
setCursorAt(CssPosition position1,
int offset1,
CssPosition position2,
int offset2)
Sets the 'cursorAt' property for this draggable.
|
DraggableBehavior |
setDelay(org.apache.wicket.ajax.AjaxRequestTarget target,
int value) |
DraggableBehavior |
setDelay(int value)
Sets the 'delay' property for this draggable.
|
DraggableBehavior |
setDistance(org.apache.wicket.ajax.AjaxRequestTarget target,
int value) |
DraggableBehavior |
setDistance(org.apache.wicket.ajax.AjaxRequestTarget target,
String value) |
DraggableBehavior |
setDistance(int value)
Sets the 'distance' property for this draggable.
|
DraggableBehavior |
setDistance(String value)
Sets the 'helper' property for this draggable.
|
DraggableBehavior |
setGrid(org.apache.wicket.ajax.AjaxRequestTarget target,
int x,
int y) |
DraggableBehavior |
setGrid(int x,
int y)
Sets the 'grid' property for this draggable.
|
DraggableBehavior |
setHelper(org.apache.wicket.ajax.AjaxRequestTarget target,
DraggableBehavior.DragHelperMode value) |
DraggableBehavior |
setHelper(org.apache.wicket.ajax.AjaxRequestTarget target,
String function) |
DraggableBehavior |
setHelper(DraggableBehavior.DragHelperMode value)
Sets the 'helper' property for this draggable to either "original"
or "clone".
|
DraggableBehavior |
setHelper(String function)
Sets the 'helper' property for this draggable with a function.
|
DraggableBehavior |
setIframeFix(org.apache.wicket.ajax.AjaxRequestTarget target,
boolean value) |
DraggableBehavior |
setIframeFix(boolean value)
Sets the 'iframeFix' property for this draggable.
|
DraggableBehavior |
setName(String value)
Sets the name of this draggable.
|
DraggableBehavior |
setOpacity(org.apache.wicket.ajax.AjaxRequestTarget target,
double value) |
DraggableBehavior |
setOpacity(double value)
Sets the 'opacity' property for this draggable.
|
DraggableBehavior |
setRefreshPositions(org.apache.wicket.ajax.AjaxRequestTarget target,
boolean value) |
DraggableBehavior |
setRefreshPositions(boolean value)
Sets the 'refreshPositions' property for this draggable.
|
DraggableBehavior |
setRevert(org.apache.wicket.ajax.AjaxRequestTarget target,
DraggableBehavior.DragRevertMode value) |
DraggableBehavior |
setRevert(DraggableBehavior.DragRevertMode value)
Sets the 'revert' property for this draggable.
|
DraggableBehavior |
setRevertDuration(org.apache.wicket.ajax.AjaxRequestTarget target,
int value) |
DraggableBehavior |
setRevertDuration(int value)
Sets the 'revertDuration' property for this draggable.
|
DraggableBehavior |
setScroll(org.apache.wicket.ajax.AjaxRequestTarget target,
boolean value) |
DraggableBehavior |
setScroll(boolean value)
Sets the 'scroll' property for this draggable.
|
DraggableBehavior |
setScrollSensitivity(org.apache.wicket.ajax.AjaxRequestTarget target,
int value) |
DraggableBehavior |
setScrollSensitivity(int value)
Sets the 'scrollSensitivity' property for this draggable.
|
DraggableBehavior |
setScrollSpeed(org.apache.wicket.ajax.AjaxRequestTarget target,
int value) |
DraggableBehavior |
setScrollSpeed(int value)
Sets the 'scrollSpeed' property for this draggable.
|
DraggableBehavior |
setSnap(org.apache.wicket.ajax.AjaxRequestTarget target,
boolean value) |
DraggableBehavior |
setSnap(boolean value)
Sets the 'snap' property for this draggable.
|
DraggableBehavior |
setSnapMode(org.apache.wicket.ajax.AjaxRequestTarget target,
DraggableBehavior.DragSnapMode value) |
DraggableBehavior |
setSnapMode(DraggableBehavior.DragSnapMode value)
Sets the 'snapMode' property for this draggable.
|
DraggableBehavior |
setSnapTolerance(org.apache.wicket.ajax.AjaxRequestTarget target,
int value) |
DraggableBehavior |
setSnapTolerance(int value)
Sets the 'snapTolerance' property for this draggable.
|
DraggableBehavior |
setWantOnDragNotification(boolean value)
If set to
true , the callback-Method onDrag(AjaxRequestTarget, SpecialKeys)
is called every time the mouse moves during the drag operation. |
DraggableBehavior |
setWantOnDragStartNotification(boolean value)
If set to
true , the callback-Method onDragStart(AjaxRequestTarget, SpecialKeys)
is called when the drag operation starts. |
DraggableBehavior |
setWantOnDragStopNotification(boolean value)
If set to
true , the callback-Method onDragStop(AjaxRequestTarget, SpecialKeys)
is called when the drag operation ends. |
DraggableBehavior |
setZIndex(org.apache.wicket.ajax.AjaxRequestTarget target,
int value) |
DraggableBehavior |
setZIndex(long value)
Sets the 'zIndex' property for this draggable.
|
isAlreadyRendered, renderHead, setRestoreAfterRedraw, updateBehavior
addCssResources, addUserProvidedResourceReferences, addUserProvidedResourceReferences, getUserProvidedResourceReferences, printParameters, printParameters, setRawOptions
findIndicatorId, getAttributes, getCallbackFunction, getCallbackFunctionBody, getCallbackScript, getCallbackScript, onBind, onRequest, postprocessConfiguration, renderAjaxAttributes, renderAjaxAttributes, updateAjaxAttributes
afterRender, bind, getCallbackUrl, getComponent, onComponentRendered, onComponentTag, onComponentTag, onUnbind, unbind
public static final JQueryResourceReference jQueryUiDraggableJs
protected void respond(org.apache.wicket.ajax.AjaxRequestTarget target)
respond
in class JQueryAjaxBehavior
public DraggableBehavior setName(String value)
value
- the namepublic String getName()
public DraggableBehavior setAddClasses(boolean value)
value
- true
or false
.public DraggableBehavior setAddClasses(org.apache.wicket.ajax.AjaxRequestTarget target, boolean value)
public DraggableBehavior setAxis(char value)
value
- 'x'
or 'y'
.public DraggableBehavior setAxis(org.apache.wicket.ajax.AjaxRequestTarget target, char value)
public DraggableBehavior setCursor(CssCursor value)
value
- a CssCursor
public DraggableBehavior setCursor(org.apache.wicket.ajax.AjaxRequestTarget target, CssCursor value)
public DraggableBehavior setCursorAt(CssPosition position, int offset)
position
- a CssPosition
public DraggableBehavior setCursorAt(org.apache.wicket.ajax.AjaxRequestTarget target, CssPosition position, int offset)
public DraggableBehavior setCursorAt(CssPosition position1, int offset1, CssPosition position2, int offset2)
position1
- a CssPosition
offset1
- the offset from position1
position2
- a CssPosition
offset2
- the offset from position2
public DraggableBehavior setCursorAt(org.apache.wicket.ajax.AjaxRequestTarget target, CssPosition position1, int offset1, CssPosition position2, int offset2)
public DraggableBehavior setDelay(int value)
value
- the delay in mspublic DraggableBehavior setDelay(org.apache.wicket.ajax.AjaxRequestTarget target, int value)
public DraggableBehavior setDistance(int value)
value
- the value of this property.public DraggableBehavior setDistance(org.apache.wicket.ajax.AjaxRequestTarget target, int value)
public DraggableBehavior setGrid(int x, int y)
x
- the stepping along the x axisy
- the stepping along the y axispublic DraggableBehavior setGrid(org.apache.wicket.ajax.AjaxRequestTarget target, int x, int y)
public DraggableBehavior setDistance(String value)
value
- original
or clone
public DraggableBehavior setDistance(org.apache.wicket.ajax.AjaxRequestTarget target, String value)
public DraggableBehavior setIframeFix(boolean value)
value
- true
or false
.public DraggableBehavior setIframeFix(org.apache.wicket.ajax.AjaxRequestTarget target, boolean value)
public DraggableBehavior setOpacity(double value)
value
- the opacity between 0 (transparent) and 1 (not transparent).public DraggableBehavior setOpacity(org.apache.wicket.ajax.AjaxRequestTarget target, double value)
public DraggableBehavior setRefreshPositions(boolean value)
value
- true
or false
.public DraggableBehavior setRefreshPositions(org.apache.wicket.ajax.AjaxRequestTarget target, boolean value)
public DraggableBehavior setRevert(DraggableBehavior.DragRevertMode value)
value
- the revert behaviorpublic DraggableBehavior setRevert(org.apache.wicket.ajax.AjaxRequestTarget target, DraggableBehavior.DragRevertMode value)
public DraggableBehavior setRevertDuration(int value)
value
- the duration of the revert animationpublic DraggableBehavior setRevertDuration(org.apache.wicket.ajax.AjaxRequestTarget target, int value)
public DraggableBehavior setScroll(boolean value)
value
- true
or false
.public DraggableBehavior setScroll(org.apache.wicket.ajax.AjaxRequestTarget target, boolean value)
public DraggableBehavior setScrollSensitivity(int value)
value
- the scroll sensitivity in pxpublic DraggableBehavior setScrollSensitivity(org.apache.wicket.ajax.AjaxRequestTarget target, int value)
public DraggableBehavior setScrollSpeed(int value)
value
- the scroll speed in pxpublic DraggableBehavior setScrollSpeed(org.apache.wicket.ajax.AjaxRequestTarget target, int value)
public DraggableBehavior setSnap(boolean value)
value
- true
or false
.public DraggableBehavior setSnap(org.apache.wicket.ajax.AjaxRequestTarget target, boolean value)
public DraggableBehavior setHelper(String function)
function
- public DraggableBehavior setHelper(org.apache.wicket.ajax.AjaxRequestTarget target, String function)
public DraggableBehavior setHelper(DraggableBehavior.DragHelperMode value)
value
- public DraggableBehavior setHelper(org.apache.wicket.ajax.AjaxRequestTarget target, DraggableBehavior.DragHelperMode value)
public DraggableBehavior setSnapMode(DraggableBehavior.DragSnapMode value)
value
- the revert behaviorpublic DraggableBehavior setSnapMode(org.apache.wicket.ajax.AjaxRequestTarget target, DraggableBehavior.DragSnapMode value)
public DraggableBehavior setSnapTolerance(int value)
value
- the scroll speed in pxpublic DraggableBehavior setSnapTolerance(org.apache.wicket.ajax.AjaxRequestTarget target, int value)
public DraggableBehavior setZIndex(long value)
value
- the scroll speed in pxpublic DraggableBehavior setZIndex(org.apache.wicket.ajax.AjaxRequestTarget target, int value)
public DraggableBehavior setWantOnDragStopNotification(boolean value)
true
, the callback-Method onDragStop(AjaxRequestTarget, SpecialKeys)
is called when the drag operation ends.
Be careful when using this in conjunction with DroppableBehavior.onDrop(AjaxRequestTarget, Component, SpecialKeys)
.
The Ajax calls issued by jQuery are processed asynchronous. So it my happen that the
onDrop event reaches Wicket before the onDragStop event. This will cause
an Exception in Wicket's internal processing if you replaced the dragged component with a new one
in your onDrop handler becaus the dragged component no longer exists in wickets store when
the onDragStop event is processed by Wicket.value
- true
or false
.public DraggableBehavior setWantOnDragNotification(boolean value)
true
, the callback-Method onDrag(AjaxRequestTarget, SpecialKeys)
is called every time the mouse moves during the drag operation.
Be careful using this callback because it can generate a lot of Ajax calls.
See {@link #setWantOnDragStartNotification(boolean) for a serious warning!value
- true
or false
.public DraggableBehavior setWantOnDragStartNotification(boolean value)
true
, the callback-Method onDragStart(AjaxRequestTarget, SpecialKeys)
is called when the drag operation starts.value
- true
or false
.protected void onDragStart(org.apache.wicket.ajax.AjaxRequestTarget target, SpecialKeys specialKeys)
setWantOnDragStartNotification(boolean)
to true
this method is called when the drag operation starts. You can override this
method to perform some action when dragging starts.target
- the AjaxRequestTarget of the drag operation.specialKeys
- the special keys that were pressed when the event occursprotected void onDrag(org.apache.wicket.ajax.AjaxRequestTarget target, SpecialKeys specialKeys)
setWantOnDragNotification(boolean)
to true
this method is called whenever ths mouse moves during the drag operation.
You can override this method to perform some action during the drag operation.target
- the AjaxRequestTarget of the drag operation.specialKeys
- the special keys that were pressed when the event occursprotected void onDragStop(org.apache.wicket.ajax.AjaxRequestTarget target, SpecialKeys specialKeys)
setWantOnDragStopNotification(boolean)
to true
this method is called when the drag operation stops. You can override this
method to perform some action when dragging stops.target
- the AjaxRequestTarget of the drag operation.specialKeys
- the special keys that were pressed when the event occurspublic void disable(org.apache.wicket.ajax.AjaxRequestTarget target)
target
- An AjaxRequestTargetpublic void enable(org.apache.wicket.ajax.AjaxRequestTarget target)
target
- An AjaxRequestTargetprotected JQueryAjaxBehavior.JsBuilder getJsBuilder()
getJsBuilder
in class JQueryDurableAjaxBehavior
Copyright © 2015. All rights reserved.