Search in sources :

Example 6 with TabWindowContainer

use of com.haulmont.cuba.web.sys.TabWindowContainer in project cuba by cuba-platform.

the class WebAppWorkArea method getCurrentWindowContainer.

@Nullable
protected TabWindowContainer getCurrentWindowContainer() {
    TabWindowContainer layout;
    if (getMode() == Mode.TABBED) {
        TabSheetBehaviour tabSheetBehaviour = getTabbedWindowContainer().getTabSheetBehaviour();
        layout = (TabWindowContainer) tabSheetBehaviour.getSelectedTab();
    } else {
        CubaSingleModeContainer singleWindowContainer = getSingleWindowContainer();
        layout = (TabWindowContainer) singleWindowContainer.getWindowContainer();
    }
    return layout;
}
Also used : TabWindowContainer(com.haulmont.cuba.web.sys.TabWindowContainer) Nullable(javax.annotation.Nullable)

Example 7 with TabWindowContainer

use of com.haulmont.cuba.web.sys.TabWindowContainer in project cuba by cuba-platform.

the class WebAppWorkArea method moveFocus.

protected void moveFocus(TabSheetBehaviour tabSheet, String tabId) {
    TabWindowContainer windowContainer = (TabWindowContainer) tabSheet.getTabComponent(tabId);
    Window window = windowContainer.getBreadCrumbs().getCurrentWindow();
    if (window != null) {
        boolean focused = false;
        String focusComponentId = window.getFocusComponent();
        if (focusComponentId != null) {
            com.haulmont.cuba.gui.components.Component focusComponent = window.getComponent(focusComponentId);
            if (focusComponent instanceof com.haulmont.cuba.gui.components.Component.Focusable && focusComponent.isEnabledRecursive() && focusComponent.isVisibleRecursive()) {
                ((com.haulmont.cuba.gui.components.Component.Focusable) focusComponent).focus();
                focused = true;
            }
        }
        if (!focused && window instanceof Window.Wrapper) {
            Window.Wrapper wrapper = (Window.Wrapper) window;
            focused = ((WebWindow) wrapper.getWrappedWindow()).findAndFocusChildComponent();
        }
        if (!focused) {
            tabSheet.focus();
        }
    }
}
Also used : TabWindowContainer(com.haulmont.cuba.web.sys.TabWindowContainer) WebWindow(com.haulmont.cuba.web.gui.WebWindow) com.haulmont.cuba.gui.components(com.haulmont.cuba.gui.components)

Example 8 with TabWindowContainer

use of com.haulmont.cuba.web.sys.TabWindowContainer in project cuba by cuba-platform.

the class WebAppWorkArea method getActiveWorkAreaScreensStream.

public Stream<Screen> getActiveWorkAreaScreensStream() {
    if (getMode() == Mode.TABBED) {
        TabSheetBehaviour tabSheetBehaviour = getTabbedWindowContainer().getTabSheetBehaviour();
        return tabSheetBehaviour.getTabComponentsStream().map(c -> {
            TabWindowContainer windowContainer = (TabWindowContainer) c;
            Window currentWindow = windowContainer.getBreadCrumbs().getCurrentWindow();
            return currentWindow.getFrameOwner();
        });
    } else {
        CubaSingleModeContainer singleWindowContainer = getSingleWindowContainer();
        TabWindowContainer windowContainer = (TabWindowContainer) singleWindowContainer.getWindowContainer();
        if (windowContainer != null) {
            Window currentWindow = windowContainer.getBreadCrumbs().getCurrentWindow();
            return Stream.of(currentWindow.getFrameOwner());
        }
    }
    return Stream.empty();
}
Also used : TabWindowContainer(com.haulmont.cuba.web.sys.TabWindowContainer) WebWindow(com.haulmont.cuba.web.gui.WebWindow)

Example 9 with TabWindowContainer

use of com.haulmont.cuba.web.sys.TabWindowContainer in project cuba by cuba-platform.

the class WebAppWorkArea method getCurrentBreadcrumbs.

public Collection<Screen> getCurrentBreadcrumbs() {
    TabWindowContainer layout = getCurrentWindowContainer();
    if (layout != null) {
        WindowBreadCrumbs breadCrumbs = layout.getBreadCrumbs();
        List<Screen> screens = new ArrayList<>(breadCrumbs.getWindows().size());
        Iterator<Window> windowIterator = breadCrumbs.getWindows().descendingIterator();
        while (windowIterator.hasNext()) {
            Screen frameOwner = windowIterator.next().getFrameOwner();
            screens.add(frameOwner);
        }
        return screens;
    }
    return Collections.emptyList();
}
Also used : TabWindowContainer(com.haulmont.cuba.web.sys.TabWindowContainer) WebWindow(com.haulmont.cuba.web.gui.WebWindow) Screen(com.haulmont.cuba.gui.screen.Screen) WindowBreadCrumbs(com.haulmont.cuba.web.sys.WindowBreadCrumbs)

Aggregations

TabWindowContainer (com.haulmont.cuba.web.sys.TabWindowContainer)9 WebWindow (com.haulmont.cuba.web.gui.WebWindow)5 WindowBreadCrumbs (com.haulmont.cuba.web.sys.WindowBreadCrumbs)3 com.haulmont.cuba.gui.components (com.haulmont.cuba.gui.components)1 Screen (com.haulmont.cuba.gui.screen.Screen)1 Component (com.vaadin.ui.Component)1 TabSheet (com.vaadin.ui.TabSheet)1 Nullable (javax.annotation.Nullable)1