Search in sources :

Example 1 with WebTabWindow

use of com.haulmont.cuba.web.gui.components.WebTabWindow in project cuba by cuba-platform.

the class WebScreens method removeNewTabWindow.

protected void removeNewTabWindow(Screen screen) {
    WebTabWindow window = (WebTabWindow) screen.getWindow();
    com.vaadin.ui.Component windowComposition = window.unwrapComposition(com.vaadin.ui.Component.class);
    TabWindowContainer windowContainer = (TabWindowContainer) windowComposition.getParent();
    windowContainer.removeComponent(windowComposition);
    WebAppWorkArea workArea = getConfiguredWorkArea();
    boolean allWindowsRemoved;
    if (workArea.getMode() == Mode.TABBED) {
        TabSheetBehaviour tabSheet = workArea.getTabbedWindowContainer().getTabSheetBehaviour();
        tabSheet.silentCloseTabAndSelectPrevious(windowContainer);
        tabSheet.removeComponent(windowContainer);
        allWindowsRemoved = tabSheet.getComponentCount() == 0;
    } else {
        Layout singleLayout = workArea.getSingleWindowContainer();
        singleLayout.removeComponent(windowContainer);
        allWindowsRemoved = true;
    }
    WindowBreadCrumbs windowBreadCrumbs = windowContainer.getBreadCrumbs();
    if (windowBreadCrumbs != null) {
        windowBreadCrumbs.setWindowNavigateHandler(null);
        windowBreadCrumbs.removeWindow();
    }
    if (allWindowsRemoved) {
        workArea.switchTo(AppWorkArea.State.INITIAL_LAYOUT);
    }
}
Also used : WebAppWorkArea(com.haulmont.cuba.web.gui.components.mainwindow.WebAppWorkArea) WebTabWindow(com.haulmont.cuba.web.gui.components.WebTabWindow) com.haulmont.cuba.gui(com.haulmont.cuba.gui) CssLayout(com.vaadin.ui.CssLayout) Layout(com.vaadin.ui.Layout)

Aggregations

com.haulmont.cuba.gui (com.haulmont.cuba.gui)1 WebTabWindow (com.haulmont.cuba.web.gui.components.WebTabWindow)1 WebAppWorkArea (com.haulmont.cuba.web.gui.components.mainwindow.WebAppWorkArea)1 CssLayout (com.vaadin.ui.CssLayout)1 Layout (com.vaadin.ui.Layout)1