use of com.haulmont.cuba.web.widgets.addons.dragdroplayouts.events.LayoutBoundTransferable in project cuba by cuba-platform.
the class DefaultTabSheetDropHandler method handleDropFromLayout.
@Override
protected void handleDropFromLayout(DragAndDropEvent event) {
LayoutBoundTransferable transferable = (LayoutBoundTransferable) event.getTransferable();
TabSheetTargetDetails details = (TabSheetTargetDetails) event.getTargetDetails();
DDTabSheet tabSheet = (DDTabSheet) details.getTarget();
Component c = transferable.getComponent();
HorizontalDropLocation location = details.getDropLocation();
int idx = details.getOverIndex();
ComponentContainer source = (ComponentContainer) transferable.getSourceComponent();
// Detach from old source
if (source instanceof ComponentContainer) {
((ComponentContainer) source).removeComponent(c);
} else if (source instanceof SingleComponentContainer) {
((SingleComponentContainer) source).setContent(null);
}
if (location == HorizontalDropLocation.LEFT) {
tabSheet.addTab(c, idx);
} else if (location == HorizontalDropLocation.RIGHT) {
tabSheet.addTab(c, idx + 1);
}
}
use of com.haulmont.cuba.web.widgets.addons.dragdroplayouts.events.LayoutBoundTransferable 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);
}
}
Aggregations