Search in sources :

Example 1 with PanelTargetDetails

use of com.haulmont.cuba.web.widgets.addons.dragdroplayouts.DDPanel.PanelTargetDetails in project cuba by cuba-platform.

the class DefaultPanelDropHandler method handleHTML5Drop.

@Override
protected void handleHTML5Drop(DragAndDropEvent event) {
    PanelTargetDetails details = (PanelTargetDetails) event.getTargetDetails();
    DDPanel panel = (DDPanel) details.getTarget();
    panel.setContent(resolveComponentFromHTML5Drop(event));
}
Also used : DDPanel(com.haulmont.cuba.web.widgets.addons.dragdroplayouts.DDPanel) PanelTargetDetails(com.haulmont.cuba.web.widgets.addons.dragdroplayouts.DDPanel.PanelTargetDetails)

Example 2 with PanelTargetDetails

use of com.haulmont.cuba.web.widgets.addons.dragdroplayouts.DDPanel.PanelTargetDetails in project cuba by cuba-platform.

the class DefaultPanelDropHandler method handleDropFromLayout.

@Override
protected void handleDropFromLayout(DragAndDropEvent event) {
    LayoutBoundTransferable transferable = (LayoutBoundTransferable) event.getTransferable();
    PanelTargetDetails details = (PanelTargetDetails) event.getTargetDetails();
    Component component = transferable.getComponent();
    DDPanel panel = (DDPanel) details.getTarget();
    // Detach from old source
    Component source = transferable.getSourceComponent();
    if (source instanceof ComponentContainer) {
        ((ComponentContainer) source).removeComponent(component);
    } else if (source instanceof SingleComponentContainer) {
        ((SingleComponentContainer) source).setContent(null);
    }
    // Attach to new source
    panel.setContent(component);
}
Also used : DDPanel(com.haulmont.cuba.web.widgets.addons.dragdroplayouts.DDPanel) PanelTargetDetails(com.haulmont.cuba.web.widgets.addons.dragdroplayouts.DDPanel.PanelTargetDetails) LayoutBoundTransferable(com.haulmont.cuba.web.widgets.addons.dragdroplayouts.events.LayoutBoundTransferable) ComponentContainer(com.vaadin.ui.ComponentContainer) SingleComponentContainer(com.vaadin.ui.SingleComponentContainer) SingleComponentContainer(com.vaadin.ui.SingleComponentContainer) Component(com.vaadin.ui.Component)

Aggregations

DDPanel (com.haulmont.cuba.web.widgets.addons.dragdroplayouts.DDPanel)2 PanelTargetDetails (com.haulmont.cuba.web.widgets.addons.dragdroplayouts.DDPanel.PanelTargetDetails)2 LayoutBoundTransferable (com.haulmont.cuba.web.widgets.addons.dragdroplayouts.events.LayoutBoundTransferable)1 Component (com.vaadin.ui.Component)1 ComponentContainer (com.vaadin.ui.ComponentContainer)1 SingleComponentContainer (com.vaadin.ui.SingleComponentContainer)1