Dragging with Multiple Selections

When a user drag-and-drops a list item or a tree item, the selection status of these items won't be changed. Visually only the dragged item is moved, but you can handle all selected items at once by looking up the set of all selected items as depicted below.

public void onDrop(DropEvent evt) {
    Set selected = ((Listitem)evt.getDragged()).getListbox().getSelectedItems();    
    //then, you can handle the whole set at once    
}

Notice that the dragged item may not be selected. Thus, you may prefer to change the selection to the dragged item for this case, as shown below.

Listitem li = (Listitem)evt.getDragged();
if (li.isSelected()) {
    Set selected = ((Listitem)evt.getDragged()).getListbox().getSelectedItems();    
    //then, you can handle the whole set at once    
} else {
    li.setSelected(true);    
    //handle li only    
}