Search in sources :

Example 1 with TabWindowImpl

use of io.jmix.ui.component.impl.TabWindowImpl in project jmix by jmix-framework.

the class ScreensImpl method removeNewTabWindow.

protected void removeNewTabWindow(Screen screen) {
    TabWindowImpl window = (TabWindowImpl) screen.getWindow();
    com.vaadin.ui.Component windowComposition = window.unwrapComposition(com.vaadin.ui.Component.class);
    TabWindowContainer windowContainer = (TabWindowContainer) windowComposition.getParent();
    windowContainer.removeComponent(windowComposition);
    AppWorkAreaImpl 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(State.INITIAL_LAYOUT);
    }
}
Also used : AppWorkAreaImpl(io.jmix.ui.component.impl.AppWorkAreaImpl) io.jmix.ui(io.jmix.ui) CssLayout(com.vaadin.ui.CssLayout) Layout(com.vaadin.ui.Layout) TabWindowImpl(io.jmix.ui.component.impl.TabWindowImpl)

Aggregations

CssLayout (com.vaadin.ui.CssLayout)1 Layout (com.vaadin.ui.Layout)1 io.jmix.ui (io.jmix.ui)1 AppWorkAreaImpl (io.jmix.ui.component.impl.AppWorkAreaImpl)1 TabWindowImpl (io.jmix.ui.component.impl.TabWindowImpl)1