org.wicketstuff.jquery.dnd
Class DnDSortableBehavior
java.lang.Object
org.apache.wicket.behavior.AbstractBehavior
org.apache.wicket.behavior.AbstractAjaxBehavior
org.apache.wicket.ajax.AbstractDefaultAjaxBehavior
org.wicketstuff.jquery.JQueryBehavior
org.wicketstuff.jquery.dnd.DnDSortableBehavior
- All Implemented Interfaces:
- Serializable, org.apache.wicket.behavior.IBehavior, org.apache.wicket.behavior.IBehaviorListener, org.apache.wicket.behavior.IComponentConfigurationBehavior, org.apache.wicket.IClusterable, org.apache.wicket.IRequestListener, org.apache.wicket.markup.html.IHeaderContributor
public class DnDSortableBehavior
- extends JQueryBehavior
- implements org.apache.wicket.behavior.IBehaviorListener
- See Also:
- Serialized Form
| Fields inherited from class org.apache.wicket.ajax.AbstractDefaultAjaxBehavior |
INDICATOR |
| Fields inherited from interface org.apache.wicket.behavior.IBehaviorListener |
INTERFACE |
| Methods inherited from class org.apache.wicket.ajax.AbstractDefaultAjaxBehavior |
findIndicatorId, generateCallbackScript, getAjaxCallDecorator, getCallbackScript, getCallbackScript, getChannelName, getFailureScript, getPreconditionScript, getSuccessScript, onBind, onRequest, throttleScript |
| Methods inherited from class org.apache.wicket.behavior.AbstractAjaxBehavior |
bind, getCallbackUrl, getCallbackUrl, getComponent, getImplementationId, getStatelessHint, onComponentRendered, onComponentTag, onComponentTag, onRendered, onRenderHeadContribution, onRenderHeadInitContribution |
| Methods inherited from class org.apache.wicket.behavior.AbstractBehavior |
afterRender, beforeRender, cleanup, detach, detachModel, exception, isEnabled, isTemporary, onConfigure, onException, rendered |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.apache.wicket.behavior.IBehaviorListener |
onRequest |
DNDSORTABLEBEHAVIOR_JS
public static final org.apache.wicket.markup.html.resources.CompressedResourceReference DNDSORTABLEBEHAVIOR_JS
options_
protected Options options_
containers_
protected ArrayList<org.apache.wicket.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(org.apache.wicket.markup.html.IHeaderResponse response)
- Specified by:
renderHead in interface org.apache.wicket.markup.html.IHeaderContributor- 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(org.apache.wicket.ajax.AjaxRequestTarget target)
- Overrides:
respond in class JQueryBehavior
onDnD
public void onDnD(org.apache.wicket.ajax.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(org.apache.wicket.ajax.AjaxRequestTarget target,
org.apache.wicket.MarkupContainer srcContainer,
int srcPos,
org.apache.wicket.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(org.apache.wicket.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(org.apache.wicket.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 © 2012. All Rights Reserved.