Search in sources :

Example 1 with DropTarget

use of com.vaadin.event.dd.DropTarget in project cuba by cuba-platform.

the class AbstractDefaultLayoutDropHandler method drop.

public void drop(DragAndDropEvent event) {
    // Get information about the drop
    TargetDetails details = event.getTargetDetails();
    DropTarget layout = details.getTarget();
    Component source = event.getTransferable().getSourceComponent();
    if (event.getTransferable().getData("html5Data") != null) {
        handleHTML5Drop(event);
    } else if (layout == source) {
        handleComponentReordering(event);
    } else if (event.getTransferable() instanceof LayoutBoundTransferable) {
        LayoutBoundTransferable transferable = (LayoutBoundTransferable) event.getTransferable();
        Component comp = transferable.getComponent();
        if (comp == layout) {
            if (comp.getParent() instanceof DDAbsoluteLayout) {
                handleDropFromAbsoluteParentLayout(event);
            }
        } else {
            handleDropFromLayout(event);
        }
    }
}
Also used : DDAbsoluteLayout(com.haulmont.cuba.web.widgets.addons.dragdroplayouts.DDAbsoluteLayout) LayoutBoundTransferable(com.haulmont.cuba.web.widgets.addons.dragdroplayouts.events.LayoutBoundTransferable) TargetDetails(com.vaadin.event.dd.TargetDetails) DropTarget(com.vaadin.event.dd.DropTarget) Component(com.vaadin.ui.Component)

Aggregations

DDAbsoluteLayout (com.haulmont.cuba.web.widgets.addons.dragdroplayouts.DDAbsoluteLayout)1 LayoutBoundTransferable (com.haulmont.cuba.web.widgets.addons.dragdroplayouts.events.LayoutBoundTransferable)1 DropTarget (com.vaadin.event.dd.DropTarget)1 TargetDetails (com.vaadin.event.dd.TargetDetails)1 Component (com.vaadin.ui.Component)1