Class AbstractDraggableFactory

  • All Implemented Interfaces:
    Serializable, org.apache.wicket.util.io.IClusterable
    Direct Known Subclasses:
    SelectableDraggableFactory

    public abstract class AbstractDraggableFactory
    extends Object
    implements org.apache.wicket.util.io.IClusterable
    Provides the ability to create a Draggable that is related to another component (defined by its selector).

    The common use case is to have the ability to drag multiple Draggable object.
    To achieve this, the role of the jQuery helper is important (see getHelper(String) implementation in SelectableDraggableFactory)
    Author:
    Sebastien Briquet - sebfz1
    See Also:
    Serialized Form
    • Constructor Detail

      • AbstractDraggableFactory

        public AbstractDraggableFactory()
    • Method Detail

      • getHelper

        protected abstract String getHelper​(String selector)
        Gets the helper that might be used by the Draggable.
        The returned value is supplied to the create(String, String, String) method.
        Parameters:
        selector - the selector
        Returns:
        the helper
      • create

        public final Draggable<?> create​(String id,
                                         String selector)
        Creates the new Draggable for the given selector
        Parameters:
        id - the markup id
        selector - the related component's selector
        Returns:
        the Draggable object
      • create

        protected abstract Draggable<?> create​(String id,
                                               String selector,
                                               String helper)
        Creates the new Draggable by using the selector and/or the helper.

        A typical implementation is:
        
         return new Draggable<String>(id) {
        
                protected void onConfigure(JQueryBehavior behavior)
                {
                        super.onConfigure(behavior);
        
                        behavior.setOption("helper", helper);
                }
         };
         
        Parameters:
        id - the markup id
        selector - the related component's selector
        helper - the jQuery helper
        Returns:
        the Draggable object