Drag and Drop in Vaadin with order

I have a problem in Vaadin7.

I want to create a drag and drop between Task and List (Task dragable, List dropable).

My code is working but task is always dropped on the very bottom of the list.

I know that I’m adding the task to the end of layout, but how can I know where on the list, the Task was dropped?

I will be very grateful is someone could help me :slight_smile:

This is my code (drop handler):

@Override
public AcceptCriterion getAcceptCriterion() {
    return AcceptAll.get();
}

@Override
public void drop(DragAndDropEvent event) {
    DragAndDropWrapper dd = (DragAndDropWrapper)event.getTransferable().getSourceComponent();
    Task t= (Task) dd.getData();
    DragAndDropWrapper dd2 = (DragAndDropWrapper)event.getTargetDetails().getTarget();
    List targetList = (List)dd2.getData();
    String currentDraggedTaskId = t.getTask_id();
    final int targetListId = Integer.parseInt( targetList.getId_list() );
    try {
        taskService.moveTask(currentDraggedTaskId, targetListId);
        List targetListObj = (List)CollectionUtils.find(allLists, new Predicate() {
            @Override
            public boolean evaluate(Object object) {
                List l = (List)(object);
                return l.getId_list().equals(targetListId+"");
            }
        });
        List oldList = (List)t.getParent().getParent();
        oldList.removeComponent(t.getParent());
        targetListObj.addComponent(t.getParent());

    } catch (UnsupportedOperationException | SQLException e) {
        Notification.show("err");
    }
}

You should use this addon: https://vaadin.com/directory#addon/dragdroplayouts:vaadin

Thank you, I done this and now is all ok.