Search in sources :

Example 11 with Screen

use of com.haulmont.cuba.gui.screen.Screen in project cuba by cuba-platform.

the class UiControllerPropertyInjector method findComponent.

@Nullable
protected Component findComponent(String componentId) {
    Component component = null;
    Window window = null;
    if (sourceScreen != null) {
        window = sourceScreen.getWindow();
    } else if (frameOwner instanceof ScreenFragment) {
        FrameOwner host = ((ScreenFragment) frameOwner).getHostController();
        if (host instanceof Screen) {
            window = ((Screen) host).getWindow();
        }
    } else if (frameOwner instanceof Screen) {
        window = ((Screen) frameOwner).getWindow();
    }
    if (window != null) {
        component = window.getComponent(componentId);
    }
    return component;
}
Also used : Window(com.haulmont.cuba.gui.components.Window) ScreenFragment(com.haulmont.cuba.gui.screen.ScreenFragment) FrameOwner(com.haulmont.cuba.gui.screen.FrameOwner) Screen(com.haulmont.cuba.gui.screen.Screen) Component(com.haulmont.cuba.gui.components.Component) Nullable(javax.annotation.Nullable)

Example 12 with Screen

use of com.haulmont.cuba.gui.screen.Screen in project cuba by cuba-platform.

the class WebTimer method addDetachListener.

private void addDetachListener(Frame owner) {
    Screen screen = UiControllerUtils.getScreen(owner.getFrameOwner());
    UiControllerUtils.addAfterDetachListener(screen, event -> detachTimerExtension());
}
Also used : Screen(com.haulmont.cuba.gui.screen.Screen)

Example 13 with Screen

use of com.haulmont.cuba.gui.screen.Screen in project cuba by cuba-platform.

the class WebAppWorkArea method initTabShortcuts.

protected void initTabShortcuts() {
    Screen rootScreen = ComponentsHelper.getWindowNN(this).getFrameOwner();
    RootWindow topLevelWindow = (RootWindow) rootScreen.getWindow();
    topLevelWindow.withUnwrapped(CubaOrderedActionsLayout.class, actionsLayout -> {
        if (getMode() == Mode.TABBED) {
            actionsLayout.addShortcutListener(createNextWindowTabShortcut(topLevelWindow));
            actionsLayout.addShortcutListener(createPreviousWindowTabShortcut(topLevelWindow));
        }
        actionsLayout.addShortcutListener(createCloseShortcut(topLevelWindow));
    });
}
Also used : Screen(com.haulmont.cuba.gui.screen.Screen)

Example 14 with Screen

use of com.haulmont.cuba.gui.screen.Screen in project cuba by cuba-platform.

the class WebAppWorkArea method closeWindowStack.

protected boolean closeWindowStack(WindowStack windowStack) {
    boolean closed = true;
    Collection<Screen> tabScreens = windowStack.getBreadcrumbs();
    for (Screen screen : tabScreens) {
        if (isNotCloseable(screen.getWindow())) {
            continue;
        }
        if (isWindowClosePrevented(screen.getWindow(), CloseOriginType.CLOSE_BUTTON)) {
            closed = false;
            // focus tab
            windowStack.select();
            break;
        }
        OperationResult closeResult = screen.close(FrameOwner.WINDOW_CLOSE_ACTION);
        if (closeResult.getStatus() != OperationResult.Status.SUCCESS) {
            closed = false;
            // focus tab
            windowStack.select();
            break;
        }
    }
    return closed;
}
Also used : Screen(com.haulmont.cuba.gui.screen.Screen) OperationResult(com.haulmont.cuba.gui.util.OperationResult)

Example 15 with Screen

use of com.haulmont.cuba.gui.screen.Screen in project cuba by cuba-platform.

the class WebAppWorkArea method reflectTabChangeToUrl.

protected void reflectTabChangeToUrl(boolean userOriginated) {
    if (!userOriginated) {
        return;
    }
    Component selectedTab = tabbedContainer.getTabSheetBehaviour().getSelectedTab();
    if (selectedTab == null) {
        return;
    }
    Window selectedWindow = ((TabWindowContainer) selectedTab).getBreadCrumbs().getCurrentWindow();
    WebWindow webWindow = (WebWindow) selectedWindow;
    NavigationState resolvedState = webWindow.getResolvedState();
    if (resolvedState != null) {
        int stateMark = generateUrlStateMark();
        NavigationState newState = new NavigationState(resolvedState.getRoot(), String.valueOf(stateMark), resolvedState.getNestedRoute(), resolvedState.getParams());
        webWindow.setResolvedState(newState);
        Screen screen = selectedWindow.getFrameOwner();
        UrlRouting urlRouting = UiControllerUtils.getScreenContext(screen).getUrlRouting();
        urlRouting.pushState(screen, newState.getParams());
    }
}
Also used : WebWindow(com.haulmont.cuba.web.gui.WebWindow) NavigationState(com.haulmont.cuba.gui.navigation.NavigationState) Screen(com.haulmont.cuba.gui.screen.Screen) WebAbstractComponent(com.haulmont.cuba.web.gui.components.WebAbstractComponent) Component(com.vaadin.ui.Component) UrlRouting(com.haulmont.cuba.gui.UrlRouting) WebWindow(com.haulmont.cuba.web.gui.WebWindow)

Aggregations

Screen (com.haulmont.cuba.gui.screen.Screen)66 WebWindow (com.haulmont.cuba.web.gui.WebWindow)18 NotFoundScreen (com.haulmont.cuba.web.app.ui.navigation.notfoundwindow.NotFoundScreen)11 GuiDialogWindow (com.haulmont.cuba.web.gui.components.WebDialogWindow.GuiDialogWindow)10 WebTabWindow (com.haulmont.cuba.web.gui.components.WebTabWindow)10 EditorScreen (com.haulmont.cuba.gui.screen.EditorScreen)9 NavigationState (com.haulmont.cuba.gui.navigation.NavigationState)8 Nullable (javax.annotation.Nullable)8 Screens (com.haulmont.cuba.gui.Screens)6 WindowInfo (com.haulmont.cuba.gui.config.WindowInfo)6 WebAppWorkArea (com.haulmont.cuba.web.gui.components.mainwindow.WebAppWorkArea)6 FrameOwner (com.haulmont.cuba.gui.screen.FrameOwner)5 AppUI (com.haulmont.cuba.web.AppUI)5 Entity (com.haulmont.cuba.core.entity.Entity)4 com.haulmont.cuba.core.global (com.haulmont.cuba.core.global)4 SelectHandlerAdapter (com.haulmont.cuba.gui.components.compatibility.SelectHandlerAdapter)4 WindowConfig (com.haulmont.cuba.gui.config.WindowConfig)4 OpenMode (com.haulmont.cuba.gui.screen.OpenMode)4 ScreenFragment (com.haulmont.cuba.gui.screen.ScreenFragment)4 UiControllerUtils (com.haulmont.cuba.gui.screen.UiControllerUtils)4