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;
}
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);
}
}
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();
}
}
Aggregations