drag & drop with control key

Is it possible to find out if some key is pressed during dragging in vaadin? I would like if user could copy item by dragging with pressed Ctrl.

Hello Adam,

Assuming you are using DragAndDropWrapper as your drop target, you could try something like this in your DropHandler implementation:

MyDropHandler implements DropHandler{
    public void drop(DragAndDropEvent event){
        WrapperTargetDetails targetDetails=(WrapperTargetDetails) event.getTargetDetails();
        MouseEventDetails mouseEvent=targetDetails.getMouseEvent();


Hello Matti,

Thanks for your answer, but I am dropping on tree and TreeTargetDetails don’t have method getMouseEvent(). I found this ticket http://dev.vaadin.com/ticket/13416#no1 so I guess it’s not possible now, or is there any workaround?

Try this

MouseEventDetails.deSerialize((String) treeTargetDetails.getData("mouseEvent"));


This works, thank you.