Search in sources :

Example 61 with Screen

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

the class WebScreens method openWindow.

@SuppressWarnings({ "IncorrectCreateGuiComponent", "deprecation" })
@Override
public Window openWindow(WindowInfo windowInfo, OpenType openType, Map<String, Object> params) {
    params = createParametersMap(windowInfo, params);
    MapScreenOptions options = new MapScreenOptions(params);
    Screen screen = createScreen(windowInfo, openType.getOpenMode(), options);
    applyOpenTypeParameters(screen.getWindow(), openType);
    show(screen);
    return screen instanceof Window ? (Window) screen : new ScreenWrapper(screen);
}
Also used : GuiDialogWindow(com.haulmont.cuba.web.gui.components.WebDialogWindow.GuiDialogWindow) WebWindow(com.haulmont.cuba.web.gui.WebWindow) WebTabWindow(com.haulmont.cuba.web.gui.components.WebTabWindow) Screen(com.haulmont.cuba.gui.screen.Screen)

Example 62 with Screen

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

the class WebScreens method openLookup.

@SuppressWarnings({ "deprecation", "IncorrectCreateGuiComponent", "unchecked" })
@Override
public Window.Lookup openLookup(WindowInfo windowInfo, Window.Lookup.Handler handler, OpenType openType, Map<String, Object> params) {
    params = createParametersMap(windowInfo, params);
    MapScreenOptions options = new MapScreenOptions(params);
    Screen screen = createScreen(windowInfo, openType.getOpenMode(), options);
    applyOpenTypeParameters(screen.getWindow(), openType);
    ((LookupScreen) screen).setSelectHandler(new SelectHandlerAdapter(handler));
    show(screen);
    return screen instanceof Window.Lookup ? (Window.Lookup) screen : new ScreenLookupWrapper(screen);
}
Also used : GuiDialogWindow(com.haulmont.cuba.web.gui.components.WebDialogWindow.GuiDialogWindow) WebWindow(com.haulmont.cuba.web.gui.WebWindow) WebTabWindow(com.haulmont.cuba.web.gui.components.WebTabWindow) Screen(com.haulmont.cuba.gui.screen.Screen) SelectHandlerAdapter(com.haulmont.cuba.gui.components.compatibility.SelectHandlerAdapter)

Example 63 with Screen

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

the class WebScreens method selectWindowTab.

@Override
public void selectWindowTab(Window window) {
    WebAppWorkArea workArea = getConfiguredWorkArea();
    Collection<WindowStack> workAreaStacks = getWorkAreaStacks(workArea);
    Screen screen = window.getFrameOwner();
    workAreaStacks.stream().filter(ws -> ws.getBreadcrumbs().contains(screen)).findFirst().ifPresent(WindowStack::select);
}
Also used : WebAppWorkArea(com.haulmont.cuba.web.gui.components.mainwindow.WebAppWorkArea) Screen(com.haulmont.cuba.gui.screen.Screen)

Example 64 with Screen

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

the class UrlChangeHandler method isCurrentRootState.

protected boolean isCurrentRootState(NavigationState requestedState) {
    if (!isRootState(requestedState)) {
        return false;
    }
    Screen rootScreen = ui.getScreens().getOpenedScreens().getRootScreenOrNull();
    if (rootScreen == null) {
        return false;
    }
    RouteDefinition routeDefinition = UiControllerUtils.getScreenContext(rootScreen).getWindowInfo().getRouteDefinition();
    return routeDefinition != null && routeDefinition.isRoot() && StringUtils.equals(routeDefinition.getPath(), requestedState.getRoot());
}
Also used : RouteDefinition(com.haulmont.cuba.gui.sys.RouteDefinition) Screen(com.haulmont.cuba.gui.screen.Screen)

Example 65 with Screen

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

the class HistoryNavigator method findPreviousState.

protected NavigationState findPreviousState(NavigationState requestedState) {
    if (urlChangeHandler.isRootState(requestedState)) {
        return requestedState;
    }
    if (Objects.equals(requestedState, history.getNow())) {
        requestedState = history.getPrevious();
    }
    NavigationState prevState;
    Screen prevStateScreen = urlChangeHandler.findScreenByState(requestedState);
    if (prevStateScreen == null && !urlChangeHandler.isRootState(requestedState)) {
        while (history.getPrevious() != null) {
            history.backward();
            NavigationState previousState = history.getPrevious();
            if (urlChangeHandler.findActiveScreenByState(previousState) != null || urlChangeHandler.isRootState(previousState)) {
                break;
            }
        }
        prevState = history.getPrevious();
    } else {
        prevState = requestedState;
    }
    return prevState;
}
Also used : NavigationState(com.haulmont.cuba.gui.navigation.NavigationState) Screen(com.haulmont.cuba.gui.screen.Screen)

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