Search in sources :

Example 11 with SingleComponentContainer

use of com.vaadin.ui.SingleComponentContainer 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

LayoutBoundTransferable (com.haulmont.cuba.web.widgets.addons.dragdroplayouts.events.LayoutBoundTransferable)11 Component (com.vaadin.ui.Component)11 ComponentContainer (com.vaadin.ui.ComponentContainer)11 SingleComponentContainer (com.vaadin.ui.SingleComponentContainer)11 VerticalDropLocation (com.vaadin.shared.ui.dd.VerticalDropLocation)4 AbstractOrderedLayout (com.vaadin.ui.AbstractOrderedLayout)3 DDAbsoluteLayout (com.haulmont.cuba.web.widgets.addons.dragdroplayouts.DDAbsoluteLayout)2 DDAccordion (com.haulmont.cuba.web.widgets.addons.dragdroplayouts.DDAccordion)1 DDCssLayout (com.haulmont.cuba.web.widgets.addons.dragdroplayouts.DDCssLayout)1 CssLayoutTargetDetails (com.haulmont.cuba.web.widgets.addons.dragdroplayouts.DDCssLayout.CssLayoutTargetDetails)1 FormLayoutTargetDetails (com.haulmont.cuba.web.widgets.addons.dragdroplayouts.DDFormLayout.FormLayoutTargetDetails)1 DDGridLayout (com.haulmont.cuba.web.widgets.addons.dragdroplayouts.DDGridLayout)1 GridLayoutTargetDetails (com.haulmont.cuba.web.widgets.addons.dragdroplayouts.DDGridLayout.GridLayoutTargetDetails)1 DDHorizontalSplitPanel (com.haulmont.cuba.web.widgets.addons.dragdroplayouts.DDHorizontalSplitPanel)1 HorizontalSplitPanelTargetDetails (com.haulmont.cuba.web.widgets.addons.dragdroplayouts.DDHorizontalSplitPanel.HorizontalSplitPanelTargetDetails)1 DDPanel (com.haulmont.cuba.web.widgets.addons.dragdroplayouts.DDPanel)1 PanelTargetDetails (com.haulmont.cuba.web.widgets.addons.dragdroplayouts.DDPanel.PanelTargetDetails)1 DDTabSheet (com.haulmont.cuba.web.widgets.addons.dragdroplayouts.DDTabSheet)1 TabSheetTargetDetails (com.haulmont.cuba.web.widgets.addons.dragdroplayouts.DDTabSheet.TabSheetTargetDetails)1 VerticalLayoutTargetDetails (com.haulmont.cuba.web.widgets.addons.dragdroplayouts.DDVerticalLayout.VerticalLayoutTargetDetails)1