Search in sources :

Example 6 with WindowImpl

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

the class WindowBreadCrumbs method isCloseWithCloseButtonPrevented.

protected boolean isCloseWithCloseButtonPrevented(@Nullable Window currentWindow) {
    WindowImpl windowImpl = (WindowImpl) currentWindow;
    if (windowImpl != null) {
        Window.BeforeCloseEvent event = new Window.BeforeCloseEvent(windowImpl, CloseOriginType.CLOSE_BUTTON);
        windowImpl.fireBeforeClose(event);
        return event.isClosePrevented();
    }
    return false;
}
Also used : Window(io.jmix.ui.component.Window) WindowImpl(io.jmix.ui.component.impl.WindowImpl)

Example 7 with WindowImpl

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

the class ScreenNavigationHandler method handle404.

protected void handle404(String route, AppUI ui) {
    MapScreenOptions options = new MapScreenOptions(ParamsMap.of("requestedRoute", route));
    NotFoundScreen notFoundScreen = ui.getScreens().create(NotFoundScreen.class, OpenMode.NEW_TAB, options);
    NavigationState state = new NavigationState(ui.getUrlRouting().getState().getRoot(), "", route, Collections.emptyMap());
    ((WindowImpl) notFoundScreen.getWindow()).setResolvedState(state);
    notFoundScreen.show();
}
Also used : WindowImpl(io.jmix.ui.component.impl.WindowImpl) NotFoundScreen(io.jmix.ui.app.navigation.notfoundwindow.NotFoundScreen)

Example 8 with WindowImpl

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

the class ScreenNavigationHandler method openScreen.

protected void openScreen(NavigationState requestedState, String screenRoute, WindowInfo windowInfo, AppUI ui) {
    UrlChangeHandler urlChangeHandler = ui.getUrlChangeHandler();
    if (!urlChangeHandler.isPermittedToNavigate(requestedState, windowInfo)) {
        return;
    }
    Screen screen = createScreen(requestedState, screenRoute, windowInfo, ui);
    if (screen == null) {
        log.info("Unable to open screen '{}' for requested route '{}'", windowInfo.getId(), requestedState.getNestedRoute());
        urlChangeHandler.revertNavigationState();
        return;
    }
    if (requestedState.getNestedRoute().endsWith(screenRoute)) {
        Map<String, String> params = requestedState.getParams();
        if (MapUtils.isNotEmpty(params)) {
            UiControllerUtils.fireEvent(screen, UrlParamsChangedEvent.class, new UrlParamsChangedEvent(screen, params));
        }
        ((WindowImpl) screen.getWindow()).setResolvedState(requestedState);
    } else {
        ((WindowImpl) screen.getWindow()).setResolvedState(getNestedScreenState(screenRoute, requestedState));
    }
    screen.show();
}
Also used : WindowImpl(io.jmix.ui.component.impl.WindowImpl) NotFoundScreen(io.jmix.ui.app.navigation.notfoundwindow.NotFoundScreen)

Example 9 with WindowImpl

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

the class WebUrlRouting method getStateMark.

protected String getStateMark(Screen screen) {
    WindowImpl windowImpl = (WindowImpl) screen.getWindow();
    NavigationState resolvedState = windowImpl.getResolvedState();
    return resolvedState != null ? resolvedState.getStateMark() : NavigationState.EMPTY.getStateMark();
}
Also used : WindowImpl(io.jmix.ui.component.impl.WindowImpl)

Example 10 with WindowImpl

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

the class UrlChangeHandler method getStateMark.

protected String getStateMark(Screen screen) {
    WindowImpl windowImpl = (WindowImpl) screen.getWindow();
    NavigationState resolvedState = windowImpl.getResolvedState();
    return resolvedState != null ? resolvedState.getStateMark() : NavigationState.EMPTY.getStateMark();
}
Also used : WindowImpl(io.jmix.ui.component.impl.WindowImpl)

Aggregations

WindowImpl (io.jmix.ui.component.impl.WindowImpl)14 TabWindowImpl (io.jmix.ui.component.impl.TabWindowImpl)5 Screen (io.jmix.ui.screen.Screen)4 NotFoundScreen (io.jmix.ui.app.navigation.notfoundwindow.NotFoundScreen)3 GuiDialogWindow (io.jmix.ui.component.impl.DialogWindowImpl.GuiDialogWindow)3 io.jmix.ui (io.jmix.ui)2 RootWindow (io.jmix.ui.component.RootWindow)2 AppWorkAreaImpl (io.jmix.ui.component.impl.AppWorkAreaImpl)2 NavigationState (io.jmix.ui.navigation.NavigationState)2 UrlChangeHandler (io.jmix.ui.navigation.UrlChangeHandler)2 UrlParamsChangedEvent (io.jmix.ui.navigation.UrlParamsChangedEvent)2 CssLayout (com.vaadin.ui.CssLayout)1 Layout (com.vaadin.ui.Layout)1 WindowInfo (io.jmix.ui.WindowInfo)1 Window (io.jmix.ui.component.Window)1