Search in sources :

Example 21 with Screen

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

the class WebScreens method afterScreenRemove.

protected void afterScreenRemove(Screen screen) {
    if (screen.getWindow() instanceof RootWindow) {
        return;
    }
    Screen currentScreen = getAnyCurrentScreen();
    if (currentScreen != null) {
        NavigationState resolvedState = ((WebWindow) currentScreen.getWindow()).getResolvedState();
        if (resolvedState != null) {
            String currentScreenRoute = resolvedState.asRoute();
            urlTools.replaceState(currentScreenRoute, ui);
        }
    }
}
Also used : Screen(com.haulmont.cuba.gui.screen.Screen) NavigationState(com.haulmont.cuba.gui.navigation.NavigationState) WebWindow(com.haulmont.cuba.web.gui.WebWindow)

Example 22 with Screen

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

the class WebScreens method createEditor.

// used only for legacy screens
@Override
public Screen createEditor(WindowInfo windowInfo, Entity item, OpenType openType, @Nullable Map<String, Object> params) {
    params = createParametersMap(windowInfo, params);
    params.put(WindowParams.ITEM.name(), item);
    MapScreenOptions options = new MapScreenOptions(params);
    Screen screen = createScreen(windowInfo, openType.getOpenMode(), options);
    applyOpenTypeParameters(screen.getWindow(), openType);
    EditorScreen editorScreen = (EditorScreen) screen;
    // noinspection unchecked
    editorScreen.setEntityToEdit(item);
    return screen;
}
Also used : Screen(com.haulmont.cuba.gui.screen.Screen)

Example 23 with Screen

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

the class WebScreens method hasUnsavedChanges.

@Override
public boolean hasUnsavedChanges() {
    Screen rootScreen = getRootScreenOrNull();
    if (rootScreen instanceof ChangeTracker && ((ChangeTracker) rootScreen).hasUnsavedChanges()) {
        return true;
    }
    Predicate<Screen> hasUnsavedChanges = screen -> screen instanceof ChangeTracker && ((ChangeTracker) screen).hasUnsavedChanges();
    return getDialogScreensStream().anyMatch(hasUnsavedChanges) || getOpenedWorkAreaScreensStream().anyMatch(hasUnsavedChanges);
}
Also used : com.haulmont.cuba.gui.sys(com.haulmont.cuba.gui.sys) Datasource(com.haulmont.cuba.gui.data.Datasource) OperationResult(com.haulmont.cuba.gui.util.OperationResult) ReflectionHelper(com.haulmont.bali.util.ReflectionHelper) PermissionType(com.haulmont.cuba.security.entity.PermissionType) LoggerFactory(org.slf4j.LoggerFactory) CubaIcon(com.haulmont.cuba.gui.icons.CubaIcon) Settings(com.haulmont.cuba.gui.settings.Settings) Screen(com.haulmont.cuba.gui.screen.Screen) WebAppWorkArea(com.haulmont.cuba.web.gui.components.mainwindow.WebAppWorkArea) Icons(com.haulmont.cuba.gui.icons.Icons) StringUtils(org.apache.commons.lang3.StringUtils) ParametersAreNonnullByDefault(javax.annotation.ParametersAreNonnullByDefault) DatasourceImplementation(com.haulmont.cuba.gui.data.impl.DatasourceImplementation) IconResolver(com.haulmont.cuba.web.gui.icons.IconResolver) com.haulmont.cuba.gui(com.haulmont.cuba.gui) DsContextImplementation(com.haulmont.cuba.gui.data.impl.DsContextImplementation) UrlTools(com.haulmont.cuba.web.sys.navigation.UrlTools) UIPerformanceLogger.createStopWatch(com.haulmont.cuba.gui.logging.UIPerformanceLogger.createStopWatch) AppUI(com.haulmont.cuba.web.AppUI) ScreenClosedEvent(com.haulmont.cuba.gui.screen.event.ScreenClosedEvent) BaseAction(com.haulmont.cuba.gui.components.actions.BaseAction) Preconditions.checkNotNullArgument(com.haulmont.bali.util.Preconditions.checkNotNullArgument) com.haulmont.cuba.gui.components(com.haulmont.cuba.gui.components) WindowInfo(com.haulmont.cuba.gui.config.WindowInfo) NotificationType(com.haulmont.cuba.gui.Notifications.NotificationType) LayoutLoader(com.haulmont.cuba.gui.xml.layout.LayoutLoader) com.haulmont.cuba.web.widgets(com.haulmont.cuba.web.widgets) Predicate(java.util.function.Predicate) GenericDataSupplier(com.haulmont.cuba.gui.data.impl.GenericDataSupplier) App(com.haulmont.cuba.web.App) SettingsImpl(com.haulmont.cuba.gui.settings.SettingsImpl) Collectors(java.util.stream.Collectors) WINDOW_CLOSE_ACTION(com.haulmont.cuba.gui.screen.FrameOwner.WINDOW_CLOSE_ACTION) WindowImplementation(com.haulmont.cuba.gui.components.sys.WindowImplementation) InvocationTargetException(java.lang.reflect.InvocationTargetException) ScreenXmlLoader(com.haulmont.cuba.gui.xml.layout.ScreenXmlLoader) MessageDialogBuilder(com.haulmont.cuba.gui.Dialogs.MessageDialogBuilder) WindowMode(com.haulmont.cuba.gui.components.DialogWindow.WindowMode) ComponentLoaderContext(com.haulmont.cuba.gui.xml.layout.loaders.ComponentLoaderContext) ScreenDataImpl(com.haulmont.cuba.gui.model.impl.ScreenDataImpl) OptionDialogBuilder(com.haulmont.cuba.gui.Dialogs.OptionDialogBuilder) Stream(java.util.stream.Stream) WebConfig(com.haulmont.cuba.web.WebConfig) ThemeConstants(com.haulmont.cuba.gui.theme.ThemeConstants) ClientConfig(com.haulmont.cuba.client.ClientConfig) DataSupplier(com.haulmont.cuba.gui.data.DataSupplier) GuiDialogWindow(com.haulmont.cuba.web.gui.components.WebDialogWindow.GuiDialogWindow) java.util(java.util) CssLayout(com.vaadin.ui.CssLayout) com.haulmont.cuba.gui.screen.compatibility(com.haulmont.cuba.gui.screen.compatibility) com.haulmont.cuba.core.global(com.haulmont.cuba.core.global) HasWorkArea(com.haulmont.cuba.gui.components.Window.HasWorkArea) Inject(javax.inject.Inject) UnknownOperationResult(com.haulmont.cuba.gui.util.UnknownOperationResult) com.haulmont.cuba.gui.screen(com.haulmont.cuba.gui.screen) LegacyFragmentAdapter(com.haulmont.cuba.gui.components.compatibility.LegacyFragmentAdapter) DsContextLoader(com.haulmont.cuba.gui.xml.data.DsContextLoader) Nonnull(javax.annotation.Nonnull) DsContext(com.haulmont.cuba.gui.data.DsContext) Nullable(javax.annotation.Nullable) Mode(com.haulmont.cuba.web.widgets.CubaManagedTabSheet.Mode) ScreenOpenedEvent(com.haulmont.cuba.gui.screen.event.ScreenOpenedEvent) UserActionsLogger(com.haulmont.cuba.gui.logging.UserActionsLogger) AppWorkArea(com.haulmont.cuba.gui.components.mainwindow.AppWorkArea) NavigationState(com.haulmont.cuba.gui.navigation.NavigationState) ComponentLoader(com.haulmont.cuba.gui.xml.layout.ComponentLoader) ConstructorUtils.invokeConstructor(org.apache.commons.lang3.reflect.ConstructorUtils.invokeConstructor) StopWatch(org.perf4j.StopWatch) Disposable(com.haulmont.cuba.gui.components.Component.Disposable) Layout(com.vaadin.ui.Layout) Mode(com.haulmont.cuba.gui.components.mainwindow.AppWorkArea.Mode) WindowConfig(com.haulmont.cuba.gui.config.WindowConfig) WebWindow(com.haulmont.cuba.web.gui.WebWindow) Element(org.dom4j.Element) SelectHandlerAdapter(com.haulmont.cuba.gui.components.compatibility.SelectHandlerAdapter) ScreenLifeCycle(com.haulmont.cuba.gui.logging.ScreenLifeCycle) ScreenProfilerImpl(com.haulmont.cuba.web.ScreenProfilerImpl) Entity(com.haulmont.cuba.core.entity.Entity) WebTabWindow(com.haulmont.cuba.web.gui.components.WebTabWindow) UiControllerUtils(com.haulmont.cuba.gui.screen.UiControllerUtils) Screen(com.haulmont.cuba.gui.screen.Screen)

Example 24 with Screen

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

the class WebScreens method getOpenedWorkAreaScreensStream.

protected Stream<Screen> getOpenedWorkAreaScreensStream() {
    Screen rootScreen = getRootScreenOrNull();
    if (rootScreen == null) {
        return Stream.empty();
    }
    WebAppWorkArea workArea = getConfiguredWorkAreaOrNull();
    if (workArea == null) {
        return Stream.empty();
    }
    return workArea.getOpenedWorkAreaScreensStream();
}
Also used : WebAppWorkArea(com.haulmont.cuba.web.gui.components.mainwindow.WebAppWorkArea) Screen(com.haulmont.cuba.gui.screen.Screen)

Example 25 with Screen

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

the class ScreenNavigationHandler method isScreenChanged.

protected boolean isScreenChanged(NavigationState requestedState, AppUI ui) {
    UrlChangeHandler urlChangeHandler = ui.getUrlChangeHandler();
    if (urlChangeHandler.isEmptyState(requestedState) || urlChangeHandler.isRootState(requestedState)) {
        return false;
    }
    Screen currentScreen = urlChangeHandler.findActiveScreenByState(ui.getHistory().getNow());
    if (currentScreen == null) {
        Iterator<Screen> screensIterator = ui.getScreens().getOpenedScreens().getCurrentBreadcrumbs().iterator();
        currentScreen = screensIterator.hasNext() ? screensIterator.next() : null;
        if (currentScreen == null) {
            return true;
        }
    }
    NavigationState currentState = urlChangeHandler.getResolvedState(currentScreen);
    if (currentState == null) {
        return true;
    }
    return !Objects.equals(currentState.getStateMark(), requestedState.getStateMark()) || !Objects.equals(currentState.getNestedRoute(), requestedState.getNestedRoute());
}
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) NavigationState(com.haulmont.cuba.gui.navigation.NavigationState) UrlChangeHandler(com.haulmont.cuba.web.sys.navigation.UrlChangeHandler)

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