org.wicketstuff.jquery.dnd
Class DnDSortableBehavior
java.lang.Object
org.apache.wicket.behavior.Behavior
org.apache.wicket.behavior.AbstractAjaxBehavior
org.apache.wicket.ajax.AbstractDefaultAjaxBehavior
org.wicketstuff.jquery.JQueryBehavior
org.wicketstuff.jquery.dnd.DnDSortableBehavior
- All Implemented Interfaces:
- Serializable, IBehaviorListener, IClusterable, IComponentAwareEventSink, IRequestListener, IComponentAwareHeaderContributor
public class DnDSortableBehavior
- extends JQueryBehavior
- implements IBehaviorListener
- See Also:
- Serialized Form
| Methods inherited from class org.apache.wicket.ajax.AbstractDefaultAjaxBehavior |
findIndicatorId, generateCallbackScript, getAjaxCallDecorator, getCallbackScript, getChannel, getChannelName, getFailureScript, getPreconditionScript, getSuccessScript, onBind, onRequest, throttleScript |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DNDSORTABLEBEHAVIOR_JS
public static final ResourceReference DNDSORTABLEBEHAVIOR_JS
options_
protected Options options_
containers_
protected ArrayList<MarkupContainer> containers_
DnDSortableBehavior
public DnDSortableBehavior()
DnDSortableBehavior
public DnDSortableBehavior(Options options)
- Create a DnDSortableBehavior with default options override.
- options include every optionsof the js component (see http://interface.eyecon.ro/docs/sort for the
base list of options).
- "containerclass" : the CSS' class of every container to be sortable (default is bind
component (handler) + "_dndContainer"
- "startOnLoad" : boolean, true => sortable feature is started on page load (default) else,
the client side must call the JSFunctionName4Start.
- Parameters:
options - the overriden options to use
renderHead
public void renderHead(Component component,
IHeaderResponse response)
- Specified by:
renderHead in interface IComponentAwareHeaderContributor- Overrides:
renderHead in class JQueryBehavior
getRebindScript
public CharSequence getRebindScript()
getOnReadyScript
public String getOnReadyScript()
- Description copied from class:
JQueryBehavior
- to be override by subclass if need to run script when dom is ready. The returned script is
wrapped by caller into <script> tag and the "$(document).ready(function(){...}"
- Overrides:
getOnReadyScript in class JQueryBehavior
- Returns:
- the script to execute when the dom is ready, or null (default)
getJSFunctionName4Start
public CharSequence getJSFunctionName4Start()
- Returns:
- the name of the javascript function to start the behavior on client side.
getJSFunctionName4Stop
public CharSequence getJSFunctionName4Stop()
- Returns:
- the name of the javascript function to stop the behavior on client side.
respond
public final void respond(AjaxRequestTarget target)
- Overrides:
respond in class JQueryBehavior
onDnD
public void onDnD(AjaxRequestTarget target,
String srcContainerId,
int srcPos,
String destContainerId,
int destPos)
- Call when a component has been moved on client side. The default implementation log (as
debug) the incomming parameters, search the component and forward to onDnD(AjaxRequestTarget
target, String itemId, String srcContainerId, int srcPos, String destContainerId, int
destPos).
- Parameters:
target - a target, provide if a response,srcContainerId - the html id of source container from where item come, (null if not previously
registered by via registerContainer(...)).srcPos - the position/index of item into srcContainer before moving.destContainerId - the html id of destination container where item is, (null if not previously
registered by via registerContainer(...)).destPos - the position/index of item into srcContainer after moving.
onDnD
public boolean onDnD(AjaxRequestTarget target,
MarkupContainer srcContainer,
int srcPos,
MarkupContainer destContainer,
int destPos)
- Call when a component has been moved on client side (to be overwrited). The default
implementation log (as debug) the incomming parameters.
- Parameters:
target - a target, provide if a response,srcContainer - the source container from where item come, (null if not previously registered by
via registerContainer(...)).srcPos - the position/index of item into srcContainer before moving.destContainer - the destination container where item is, (null if not previously registered by via
registerContainer(...)).destPos - the position/index of item into srcContainer after moving.
- Returns:
- false if you don't need to keep in sync component, markupId on serverside and client
side, else return true to send to client side the srcContainer and destContainer and
to update the handler (consume more resource, server, network, client).
registerContainer
protected DnDSortableBehavior registerContainer(MarkupContainer v)
- Register a container as a container for draggable/droppable items. (add the css class and
markupId to be find on clientside).
- Parameters:
v - the container to register.
- Returns:
- this
registerItem
protected DnDSortableBehavior registerItem(Component v)
- Register a component as draggable/moveable item. (add the css class and markupId to be find
on clientside).
- Parameters:
v - the component to register.
- Returns:
- this
Copyright © 2013. All Rights Reserved.