org.odlabs.wiquery.ui.sortable

Class SortableBehavior

    • Field Detail

      • UI_HELPER

        public static final String UI_HELPER
        Properties on the ui parameter (use it into callback functions) : The current helper element (most often a clone of the item)
        See Also:
        Constant Field Values
      • UI_POSITION

        public static final String UI_POSITION
        Properties on the ui parameter (use it into callback functions) : The current position of the helper
        See Also:
        Constant Field Values
      • UI_OFFSET

        public static final String UI_OFFSET
        Properties on the ui parameter (use it into callback functions) : The current absolute position of the helper
        See Also:
        Constant Field Values
      • UI_ITEM

        public static final String UI_ITEM
        Properties on the ui parameter (use it into callback functions) : The current dragged element
        See Also:
        Constant Field Values
      • UI_PLACEHOLDER

        public static final String UI_PLACEHOLDER
        Properties on the ui parameter (use it into callback functions) : The placeholder (if you defined one)
        See Also:
        Constant Field Values
      • UI_SENDER

        public static final String UI_SENDER
        Properties on the ui parameter (use it into callback functions) : The sortable where the item comes from (only exists if you move from one connected list to another)
        See Also:
        Constant Field Values
    • Constructor Detail

      • SortableBehavior

        public SortableBehavior()
        Default constructor
    • Method Detail

      • bind

        public void bind(org.apache.wicket.Component component)
        Specified by:
        bind in interface org.apache.wicket.behavior.IBehavior
        Overrides:
        bind in class WiQueryAbstractBehavior
      • detach

        public void detach(org.apache.wicket.Component component)
        Specified by:
        detach in interface org.apache.wicket.behavior.IBehavior
        Overrides:
        detach in class org.apache.wicket.behavior.AbstractBehavior
      • getAppendTo

        public String getAppendTo()
        Returns:
        the appendTo option value
      • getCancel

        public String getCancel()
        Returns:
        the cancel option value
      • getConnectWith

        public String getConnectWith()
        Returns:
        the connectWith option value
      • getContainmentComplex

        public SortableContainment getContainmentComplex()
        Returns:
        the containment option value
      • getCursor

        public String getCursor()
        Returns:
        the cursor option value
      • getDelay

        public int getDelay()
        Returns:
        the delay option value
      • getDistance

        public int getDistance()
        Returns:
        the distance option value
      • getDropOnEmpty

        @Deprecated
        public boolean getDropOnEmpty()
        Deprecated. will be removed in 1.2
        Returns:
        the dropOnEmpty option value
      • getForceHelperSize

        @Deprecated
        public boolean getForceHelperSize()
        Deprecated. will be removed in 1.2
        Returns:
        the forceHelperSize option value
      • getForcePlaceholderSize

        @Deprecated
        public boolean getForcePlaceholderSize()
        Deprecated. will be removed in 1.2
        Returns:
        the forcePlaceholderSize option value
      • getHandle

        public String getHandle()
        Returns:
        the handle option value
      • getHelperComplex

        public SortableHelper getHelperComplex()
        Returns:
        the helper option value
      • getItems

        public String getItems()
        Returns:
        the items option value
      • getOpacity

        public float getOpacity()
        Returns:
        the opacity option value
      • getOptions

        protected Options getOptions()
        Method retrieving the options of the component
        Returns:
        the options
      • getPlaceHolder

        public String getPlaceHolder()
        Returns:
        the placeHolder option value
      • getRevert

        public SortableRevert getRevert()
        Returns:
        the revert option value
      • getScrollSensitivity

        public int getScrollSensitivity()
        Returns:
        the scrollSensitivity option value
      • getScrollSpeed

        public int getScrollSpeed()
        Returns:
        the scrollSpeed option value
      • getZIndex

        public int getZIndex()
        Returns:
        the zIndex option value
      • setDisabled

        public SortableBehavior setDisabled(boolean disabled)
        Disables (true) or enables (false) the sortable. Can be set when initialising (first creating) the sortable.
        Parameters:
        disabled -
        Returns:
        instance of the current behavior
      • isDisabled

        public boolean isDisabled()
        Returns:
        the disabled option
      • isDropOnEmpty

        public boolean isDropOnEmpty()
        Returns:
        the dropOnEmpty option value
      • isForceHelperSize

        public boolean isForceHelperSize()
        Returns:
        the forceHelperSize option value
      • isForcePlaceholderSize

        public boolean isForcePlaceholderSize()
        Returns:
        the forcePlaceholderSize option value
      • isRevert

        @Deprecated
        public boolean isRevert()
        Deprecated. will be changed in 1.2 to return a SortableRevert
        Returns:
        the revert option value
      • isScroll

        public boolean isScroll()
        Returns:
        the scroll option value
      • setAppendTo

        public SortableBehavior 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).
        Parameters:
        appendTo -
        Returns:
        instance of the current behavior
      • setAxis

        public SortableBehavior setAxis(SortableBehavior.AxisEnum axis)
        If defined, the items can be dragged only horizontally or vertically. Possible values:'x', 'y'.
        Parameters:
        axis -
        Returns:
        instance of the current behavior
      • setCancel

        public SortableBehavior setCancel(String cancel)
        Set's the prevent selecting if you start on elements matching the selector
        Parameters:
        cancel - Selector (default : ':input,option')
        Returns:
        instance of the current behavior
      • setConnectWith

        public SortableBehavior setConnectWith(String connectWith)
        Set a jQuery selector with items that also have sortables applied. If used, the sortable is now connected to the other one-way, so you can drag from this sortable to the other.
        Parameters:
        connectWith - Selector
        Returns:
        instance of the current behavior
      • setContainment

        @Deprecated
        public SortableBehavior setContainment(String containment)
        Deprecated. will be removed in 1.2
        Constrains dragging to within the bounds of the specified element - can be a DOM element, 'parent', 'document', 'window', or a jQuery selector.
        Parameters:
        containment -
        Returns:
        instance of the current behavior
      • setContainment

        public SortableBehavior 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.
        Parameters:
        containment -
        Returns:
        instance of the current behavior
      • setCursor

        public SortableBehavior setCursor(String cursor)
        Set the cursor that is being shown while sorting
        Parameters:
        cursor -
        Returns:
        instance of the current behavior
      • setCursorAt

        public SortableBehavior setCursorAt(SortableBehavior.CursorAtEnum cusorAt)
        Moves the sorting element or helper so the cursor always appears to drag from the same position. Coordinates can be given as a hash using a combination of one or two keys: { top, left, right, bottom }
        Parameters:
        cusorAt -
        Returns:
        instance of the current behavior
      • setDelay

        public SortableBehavior setDelay(int delay)
        Set's the delay (in milliseconds) to define when the sorting should start
        Parameters:
        delay -
        Returns:
        instance of the current behavior
      • setDistance

        public SortableBehavior setDistance(int distance)
        Set's the tolerance in pixels
        Parameters:
        distance -
        Returns:
        instance of the current behavior
      • setDropOnEmpty

        public SortableBehavior setDropOnEmpty(boolean dropOnEmpty)
        If empty allows for an item to be dropped from a linked selectable.
        Parameters:
        dropOnEmpty -
        Returns:
        instance of the current behavior
      • setForceHelperSize

        public SortableBehavior setForceHelperSize(boolean forceHelperSize)
        If true, forces the helper to have a size.
        Parameters:
        forceHelperSize -
        Returns:
        instance of the current behavior
      • setForcePlaceholderSize

        public SortableBehavior setForcePlaceholderSize(boolean forcePlaceholderSize)
        If true, forces the placeholder to have a size.
        Parameters:
        forcePlaceholderSize -
        Returns:
        instance of the current behavior
      • setGrid

        public SortableBehavior setGrid(int x,
                               int y)
        Snaps the sorting element or helper to a grid, every x and y pixels. Array values: [x, y]
        Parameters:
        x -
        y -
        Returns:
        instance of the current behavior
      • setHandle

        public SortableBehavior setHandle(String handle)
        Restricts sort start click to the specified element.
        Parameters:
        handle -
        Returns:
        instance of the current behavior
      • setHelper

        @Deprecated
        public SortableBehavior setHelper(String helper)
        Deprecated. will be removed in 1.2
        Allows for a helper element to be used for dragging display. The supplied function receives the event and the element being sorted, and should return a DOMElement to be used as a custom proxy helper. Possible values: 'original', 'clone'
        Parameters:
        helper -
        Returns:
        instance of the current behavior
      • setHelper

        public SortableBehavior setHelper(SortableHelper helper)
        Allows for a helper element to be used for dragging display. The supplied function receives the event and the element being sorted, and should return a DOMElement to be used as a custom proxy helper. Possible values: 'original', 'clone'
        Parameters:
        helper -
        Returns:
        instance of the current behavior
      • setItems

        public SortableBehavior setItems(String items)
        Specifies which items inside the element should be sortable.
        Parameters:
        items - Cursor (default : '> *')
        Returns:
        instance of the current behavior
      • setOpacity

        public SortableBehavior setOpacity(float opacity)
        Set the opacity of the helper while sorting. From 0.01 to 1
        Parameters:
        opacity -
        Returns:
        instance of the current behavior
      • setPlaceholder

        public SortableBehavior setPlaceholder(String placeholder)
        Set's the class that gets applied to the otherwise white space.
        Parameters:
        placeholder -
        Returns:
        instance of the current behavior
      • setRevert

        @Deprecated
        public SortableBehavior setRevert(boolean revert)
        Deprecated. will be removed in 1.2
        If set to true, the item will be reverted to its new DOM position with a smooth animation.
        Parameters:
        revert -
        Returns:
        instance of the current behavior
      • setRevert

        public SortableBehavior setRevert(SortableRevert revert)
        If set to true, the item will be reverted to its new DOM position with a smooth animation.
        Parameters:
        revert -
        Returns:
        instance of the current behavior
      • setScroll

        public SortableBehavior setScroll(boolean scroll)
        If set to true, the page scrolls when coming to an edge.
        Parameters:
        scroll -
        Returns:
        instance of the current behavior
      • setScrollSensitivity

        public SortableBehavior setScrollSensitivity(int scrollSensitivity)
        Defines how near the mouse must be to an edge to start scrolling.
        Parameters:
        scrollSensitivity -
        Returns:
        instance of the current behavior
      • setScrollSpeed

        public SortableBehavior setScrollSpeed(int scrollSpeed)
        The speed at which the window should scroll once the mouse pointer gets within the scrollSensitivity distance.
        Parameters:
        scrollSpeed -
        Returns:
        instance of the current behavior
      • setTolerance

        public SortableBehavior setTolerance(SortableBehavior.ToleranceEnum tolerance)
        Set's the tolerance
        • intersect: draggable overlaps the droppable at least 50%
        • pointer: mouse pointer overlaps the droppable
        Parameters:
        tolerance -
        Returns:
        instance of the current behavior
      • setZIndex

        public SortableBehavior setZIndex(int zIndex)
        Set's Z-index for element/helper while being sorted.
        Parameters:
        zIndex -
        Returns:
        instance of the current behavior
      • setActivateEvent

        public SortableBehavior setActivateEvent(JsScopeUiEvent activate)
        Set's the callback when using connected lists, every connected list on drag start receives it.
        Parameters:
        activate -
        Returns:
        instance of the current behavior
      • setBeforeStopEvent

        public SortableBehavior setBeforeStopEvent(JsScopeUiEvent beforeStop)
        Set's the callback when sorting stops, but when the placeholder/helper is still available.
        Parameters:
        beforeStop -
        Returns:
        instance of the current behavior
      • setChangeEvent

        public SortableBehavior setChangeEvent(JsScopeUiEvent change)
        Set's the callback during sorting, but only when the DOM position has changed.
        Parameters:
        change -
        Returns:
        instance of the current behavior
      • setDeactivateEvent

        public SortableBehavior setDeactivateEvent(JsScopeUiEvent deactivate)
        Set's the callback when sorting was stopped, is propagated to all possible connected lists.
        Parameters:
        deactivate -
        Returns:
        instance of the current behavior
      • setOutEvent

        public SortableBehavior setOutEvent(JsScopeUiEvent out)
        Set's the callback when a sortable item is moved away from a connected list.
        Parameters:
        out -
        Returns:
        instance of the current behavior
      • setOverEvent

        public SortableBehavior setOverEvent(JsScopeUiEvent over)
        Set's the callback when a sortable item is moved into a connected list.
        Parameters:
        over -
        Returns:
        instance of the current behavior
      • setReceiveEvent

        public SortableBehavior setReceiveEvent(JsScopeUiEvent receive)
        Set's the callback when a connected sortable list has received an item from another list.
        Parameters:
        receive -
        Returns:
        instance of the current behavior
      • setRemoveEvent

        public SortableBehavior setRemoveEvent(JsScopeUiEvent remove)
        Set's the callback when a sortable item has been dragged out from the list and into another.
        Parameters:
        remove -
        Returns:
        instance of the current behavior
      • setSortEvent

        public SortableBehavior setSortEvent(JsScopeUiEvent sort)
        Set's the callback during sorting
        Parameters:
        sort -
        Returns:
        instance of the current behavior
      • setStartEvent

        public SortableBehavior setStartEvent(JsScopeUiEvent start)
        Set's the callback when sorting starts
        Parameters:
        start -
        Returns:
        instance of the current behavior
      • setStopEvent

        public SortableBehavior setStopEvent(JsScopeUiEvent stop)
        Set's the callback when sorting has stopped.
        Parameters:
        stop -
        Returns:
        instance of the current behavior
      • setUpdateEvent

        public SortableBehavior setUpdateEvent(JsScopeUiEvent update)
        Set's the callback when the user stopped sorting and the DOM position has changed.
        Parameters:
        update -
        Returns:
        instance of the current behavior
      • cancel

        public JsStatement cancel()
        Method to cancel This will return the element back to its pre-init state.
        Returns:
        the associated JsStatement
      • cancel

        public void cancel(org.apache.wicket.ajax.AjaxRequestTarget ajaxRequestTarget)
        Method to cancel within the ajax request
        Parameters:
        ajaxRequestTarget -
      • destroy

        public JsStatement destroy()
        Method to destroy This will return the element back to its pre-init state.
        Returns:
        the associated JsStatement
      • destroy

        public void destroy(org.apache.wicket.ajax.AjaxRequestTarget ajaxRequestTarget)
        Method to destroy within the ajax request
        Parameters:
        ajaxRequestTarget -
      • disable

        public JsStatement disable()
        Method to disable
        Returns:
        the associated JsStatement
      • disable

        public void disable(org.apache.wicket.ajax.AjaxRequestTarget ajaxRequestTarget)
        Method to disable within the ajax request
        Parameters:
        ajaxRequestTarget -
      • enable

        public JsStatement enable()
        Method to enable
        Returns:
        the associated JsStatement
      • enable

        public void enable(org.apache.wicket.ajax.AjaxRequestTarget ajaxRequestTarget)
        Method to enable within the ajax request
        Parameters:
        ajaxRequestTarget -
      • refresh

        public JsStatement refresh()
        Method to refresh
        Returns:
        the associated JsStatement
      • refresh

        public void refresh(org.apache.wicket.ajax.AjaxRequestTarget ajaxRequestTarget)
        Method to refresh within the ajax request
        Parameters:
        ajaxRequestTarget -
      • refreshPositions

        public JsStatement refreshPositions()
        Method to refresh positions
        Returns:
        the associated JsStatement
      • refreshPositions

        public void refreshPositions(org.apache.wicket.ajax.AjaxRequestTarget ajaxRequestTarget)
        Method to refresh positions within the ajax request
        Parameters:
        ajaxRequestTarget -
      • serialize

        public JsStatement serialize()
        Method to serialize (in default mode)
        Returns:
        the associated JsStatement
      • serialize

        public void serialize(org.apache.wicket.ajax.AjaxRequestTarget ajaxRequestTarget)
        Method to serialize (in default mode) within the ajax request
        Parameters:
        ajaxRequestTarget -
      • toArray

        public JsStatement toArray()
        Method to serializes the sortable's item id's into an array of string
        Returns:
        the associated JsStatement
      • widget

        public JsStatement widget()
        Method to returns the .ui-sortable element
        Returns:
        the associated JsStatement
      • widget

        public void widget(org.apache.wicket.ajax.AjaxRequestTarget ajaxRequestTarget)
        Method to returns the .ui-sortable element within the ajax request
        Parameters:
        ajaxRequestTarget -

Copyright © 2009-2012. All Rights Reserved.