You can implement by adding DraggableBehavior *and* DroppableBehavior to
each item,
something like this:

add(new DraggableBehavior() {
    {
        setName("someName");
        setRevert(DraggableBehavior.DragRevertMode.ALWAYS);
        setRevertDuration(0);
        setHelper(DragHelperMode.CLONE);
        setOpacity(Opacity.LOW);
    }
});
add(new DroppableBehavior() {
    {//{
        setHoverClass("resequencerHover");
        setTolerance(DropTolerance.POINTER);
        setDraggablesAcceptedByDroppable(new
DraggablesAcceptedByDroppable("someName"));
    }//}
    @Override
    protected void onDrop(AjaxRequestTarget target, final Component
component, final SpecialKeys keys) {
        // get seqnum (sequence number)
        // if source and target seqnum are the same then ignore
        // update data (maybe even in persistent store, AKA database)
        // refresh container containing your list
(target.addComponent(listContainer);)
    }
});
add(new AttributeAppender("class", true, new AbstractReadOnlyModel<String>()
{
    @Override
    public String getObject() {
        return "resequencer";
    }
}, " "));

CSS:
.resequencer {
    border-top: 3px solid transparent;
}
.resequencerHover {
    border-top: 3px solid #000000;
}

This is just the rough idea (my case is more complicated).

Istvan (aka Stefan)


On Mon, Jun 7, 2010 at 12:26 PM, DerBernd <beha...@web.de> wrote:

>
> Hi,
> another question of mine:
> Is there any implementation of an "Sortable" where I can change order of
> <li> items within an <ul> by dragging and dropping. Or what would even be
> better: change order of Components in an RepeatingView.
>
>
> I found the org.wicketstuff.jquery.dnd.DnDSortableHandler. But do not
> really
> know how to make it work, cause I found no examples on the web.
>
> Thanks a lot
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/drag-and-drop-tp1881857p2245708.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>

Reply via email to