Search in sources :

Example 6 with RootWindow

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

the class WebUrlRouting method notAttachedToUi.

protected boolean notAttachedToUi(Screen screen) {
    boolean notAttached;
    Screens.OpenedScreens openedScreens = ui.getScreens().getOpenedScreens();
    if (screen.getWindow() instanceof RootWindow) {
        Screen rootScreen = openedScreens.getRootScreenOrNull();
        notAttached = rootScreen == null || rootScreen != screen;
    } else if (screen.getWindow() instanceof DialogWindow) {
        notAttached = !openedScreens.getDialogScreens().contains(screen);
    } else {
        notAttached = !openedScreens.getActiveScreens().contains(screen);
    }
    return notAttached;
}
Also used : Screen(com.haulmont.cuba.gui.screen.Screen) EditorScreen(com.haulmont.cuba.gui.screen.EditorScreen) NotFoundScreen(com.haulmont.cuba.web.app.ui.navigation.notfoundwindow.NotFoundScreen) RootWindow(com.haulmont.cuba.gui.components.RootWindow) Screens(com.haulmont.cuba.gui.Screens) DialogWindow(com.haulmont.cuba.gui.components.DialogWindow)

Example 7 with RootWindow

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

the class RedirectHandler method schedule.

public void schedule(NavigationState redirect) {
    UrlHandlingMode urlHandlingMode = webConfig.getUrlHandlingMode();
    if (UrlHandlingMode.URL_ROUTES != urlHandlingMode) {
        log.debug("RedirectHandler is disabled for {} URL handling mode", urlHandlingMode);
        return;
    }
    Preconditions.checkNotNullArgument(redirect);
    RouteDefinition notFoundScreenRouteDef = windowConfig.getWindowInfo(NotFoundScreen.ID).getRouteDefinition();
    if (Objects.equals(notFoundScreenRouteDef.getPath(), redirect.getNestedRoute())) {
        return;
    }
    this.redirect = redirect;
    String nestedRoute = redirect.getNestedRoute();
    if (StringUtils.isEmpty(nestedRoute)) {
        return;
    }
    Map<String, String> params = new LinkedHashMap<>();
    params.put(REDIRECT_PARAM, nestedRoute);
    if (redirect.getParams() != null) {
        params.putAll(redirect.getParams());
    }
    RootWindow rootWindow = ui.getTopLevelWindow();
    if (rootWindow != null) {
        ui.getUrlRouting().replaceState(rootWindow.getFrameOwner(), params);
    }
}
Also used : RouteDefinition(com.haulmont.cuba.gui.sys.RouteDefinition) UrlHandlingMode(com.haulmont.cuba.web.gui.UrlHandlingMode) RootWindow(com.haulmont.cuba.gui.components.RootWindow) LinkedHashMap(java.util.LinkedHashMap)

Example 8 with RootWindow

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

the class HistoryNavigator method handleRootBackNavigation.

protected void handleRootBackNavigation(NavigationState previousState) {
    WindowInfo rootWindowInfo = urlChangeHandler.windowConfig.findWindowInfoByRoute(previousState.getRoot());
    if (rootWindowInfo == null) {
        log.debug("Unable to find registered root screen with route: '{}'", previousState.getRoot());
        urlChangeHandler.revertNavigationState();
        return;
    }
    Class<? extends FrameOwner> requestedScreenClass = rootWindowInfo.getControllerClass();
    RootWindow topLevelWindow = AppUI.getCurrent().getTopLevelWindow();
    Class<? extends FrameOwner> currentScreenClass = topLevelWindow != null ? topLevelWindow.getFrameOwner().getClass() : null;
    if (currentScreenClass != null && requestedScreenClass.isAssignableFrom(currentScreenClass)) {
        if (Window.HasWorkArea.class.isAssignableFrom(requestedScreenClass)) {
            if (closeWorkAreaScreens()) {
                history.backward();
            }
        } else {
            history.backward();
        }
    } else {
        urlChangeHandler.getScreenNavigator().handleScreenNavigation(previousState);
        /*
             * Since back navigation from one root screen to another root screen
             * can be performed only via screen opening we have to trigger history
             * back twice.
             */
        history.backward();
        history.backward();
    }
}
Also used : RootWindow(com.haulmont.cuba.gui.components.RootWindow) Window(com.haulmont.cuba.gui.components.Window) RootWindow(com.haulmont.cuba.gui.components.RootWindow) WindowInfo(com.haulmont.cuba.gui.config.WindowInfo)

Aggregations

RootWindow (com.haulmont.cuba.gui.components.RootWindow)8 Screens (com.haulmont.cuba.gui.Screens)2 NavigationState (com.haulmont.cuba.gui.navigation.NavigationState)2 Screen (com.haulmont.cuba.gui.screen.Screen)2 NotFoundScreen (com.haulmont.cuba.web.app.ui.navigation.notfoundwindow.NotFoundScreen)2 Preconditions.checkNotEmptyString (com.haulmont.bali.util.Preconditions.checkNotEmptyString)1 Dialogs (com.haulmont.cuba.gui.Dialogs)1 DialogAction (com.haulmont.cuba.gui.components.DialogAction)1 DialogWindow (com.haulmont.cuba.gui.components.DialogWindow)1 Window (com.haulmont.cuba.gui.components.Window)1 BaseAction (com.haulmont.cuba.gui.components.actions.BaseAction)1 WindowInfo (com.haulmont.cuba.gui.config.WindowInfo)1 IllegalConcurrentAccessException (com.haulmont.cuba.gui.executors.IllegalConcurrentAccessException)1 Icons (com.haulmont.cuba.gui.icons.Icons)1 EditorScreen (com.haulmont.cuba.gui.screen.EditorScreen)1 MapScreenOptions (com.haulmont.cuba.gui.screen.MapScreenOptions)1 RouteDefinition (com.haulmont.cuba.gui.sys.RouteDefinition)1 UnknownOperationResult (com.haulmont.cuba.gui.util.UnknownOperationResult)1 LoginException (com.haulmont.cuba.security.global.LoginException)1 NoUserSessionException (com.haulmont.cuba.security.global.NoUserSessionException)1