Search in sources :

Example 1 with VerticalSplitPanelTargetDetails

use of com.haulmont.cuba.web.widgets.addons.dragdroplayouts.DDVerticalSplitPanel.VerticalSplitPanelTargetDetails in project cuba by cuba-platform.

the class DefaultVerticalSplitPanelDropHandler method handleHTML5Drop.

@Override
protected void handleHTML5Drop(DragAndDropEvent event) {
    VerticalSplitPanelTargetDetails details = (VerticalSplitPanelTargetDetails) event.getTargetDetails();
    DDVerticalSplitPanel panel = (DDVerticalSplitPanel) details.getTarget();
    if (details.getDropLocation() == VerticalDropLocation.TOP) {
        // Dropped in the left area
        panel.setFirstComponent(resolveComponentFromHTML5Drop(event));
    } else if (details.getDropLocation() == VerticalDropLocation.BOTTOM) {
        // Dropped in the right area
        panel.setSecondComponent(resolveComponentFromHTML5Drop(event));
    }
}
Also used : VerticalSplitPanelTargetDetails(com.haulmont.cuba.web.widgets.addons.dragdroplayouts.DDVerticalSplitPanel.VerticalSplitPanelTargetDetails) DDVerticalSplitPanel(com.haulmont.cuba.web.widgets.addons.dragdroplayouts.DDVerticalSplitPanel)

Example 2 with VerticalSplitPanelTargetDetails

use of com.haulmont.cuba.web.widgets.addons.dragdroplayouts.DDVerticalSplitPanel.VerticalSplitPanelTargetDetails in project cuba by cuba-platform.

the class DefaultVerticalSplitPanelDropHandler method handleDropFromLayout.

@Override
protected void handleDropFromLayout(DragAndDropEvent event) {
    LayoutBoundTransferable transferable = (LayoutBoundTransferable) event.getTransferable();
    VerticalSplitPanelTargetDetails details = (VerticalSplitPanelTargetDetails) event.getTargetDetails();
    Component component = transferable.getComponent();
    DDVerticalSplitPanel panel = (DDVerticalSplitPanel) details.getTarget();
    ComponentContainer source = (ComponentContainer) transferable.getSourceComponent();
    // Detach from old source
    if (source instanceof ComponentContainer) {
        ((ComponentContainer) source).removeComponent(component);
    } else if (source instanceof SingleComponentContainer) {
        ((SingleComponentContainer) source).setContent(null);
    }
    if (details.getDropLocation() == VerticalDropLocation.TOP) {
        // Dropped in the left area
        panel.setFirstComponent(component);
    } else if (details.getDropLocation() == VerticalDropLocation.BOTTOM) {
        // Dropped in the right area
        panel.setSecondComponent(component);
    }
}
Also used : VerticalSplitPanelTargetDetails(com.haulmont.cuba.web.widgets.addons.dragdroplayouts.DDVerticalSplitPanel.VerticalSplitPanelTargetDetails) LayoutBoundTransferable(com.haulmont.cuba.web.widgets.addons.dragdroplayouts.events.LayoutBoundTransferable) ComponentContainer(com.vaadin.ui.ComponentContainer) SingleComponentContainer(com.vaadin.ui.SingleComponentContainer) DDVerticalSplitPanel(com.haulmont.cuba.web.widgets.addons.dragdroplayouts.DDVerticalSplitPanel) SingleComponentContainer(com.vaadin.ui.SingleComponentContainer) Component(com.vaadin.ui.Component)

Aggregations

DDVerticalSplitPanel (com.haulmont.cuba.web.widgets.addons.dragdroplayouts.DDVerticalSplitPanel)2 VerticalSplitPanelTargetDetails (com.haulmont.cuba.web.widgets.addons.dragdroplayouts.DDVerticalSplitPanel.VerticalSplitPanelTargetDetails)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