Search in sources :

Example 46 with Screen

use of com.haulmont.cuba.gui.screen.Screen 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 47 with Screen

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

the class WebUrlRouting method buildScreenRoute.

protected String buildScreenRoute(Screen screen) {
    List<Screen> screens = new ArrayList<>(ui.getScreens().getOpenedScreens().getCurrentBreadcrumbs());
    if (screens.isEmpty() || screens.get(0) != screen) {
        log.debug("Current breadcrumbs doesn't contain the given screen '{}'", screen.getId());
        return "";
    }
    Collections.reverse(screens);
    StringBuilder state = new StringBuilder();
    String prevSubRoute = null;
    for (int i = 0; i < screens.size() && i < MAX_NESTING; i++) {
        String subRoute = buildSubRoute(prevSubRoute, screens.get(i));
        if (StringUtils.isNotEmpty(state) && StringUtils.isNotEmpty(subRoute)) {
            state.append('/');
        }
        state.append(subRoute);
        prevSubRoute = subRoute;
    }
    return state.toString();
}
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) Preconditions.checkNotEmptyString(com.haulmont.bali.util.Preconditions.checkNotEmptyString)

Example 48 with Screen

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

the class WebScreens method openEditor.

@SuppressWarnings({ "deprecation", "IncorrectCreateGuiComponent", "unchecked" })
@Override
public Window.Editor openEditor(WindowInfo windowInfo, Entity item, OpenType openType) {
    Map<String, Object> params = createParametersMap(windowInfo, Collections.singletonMap(WindowParams.ITEM.name(), item));
    MapScreenOptions options = new MapScreenOptions(params);
    Screen screen = createScreen(windowInfo, openType.getOpenMode(), options);
    applyOpenTypeParameters(screen.getWindow(), openType);
    EditorScreen editorScreen = (EditorScreen) screen;
    editorScreen.setEntityToEdit(item);
    show(screen);
    return screen instanceof Window.Editor ? (Window.Editor) screen : new ScreenEditorWrapper(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 49 with Screen

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

the class WebScreens method openEditor.

@SuppressWarnings({ "deprecation", "IncorrectCreateGuiComponent", "unchecked" })
@Override
public Window.Editor openEditor(WindowInfo windowInfo, Entity item, OpenType openType, Datasource parentDs) {
    Map<String, Object> params = createParametersMap(windowInfo, Collections.singletonMap(WindowParams.ITEM.name(), item));
    MapScreenOptions options = new MapScreenOptions(params);
    Screen screen = createScreen(windowInfo, openType.getOpenMode(), options);
    applyOpenTypeParameters(screen.getWindow(), openType);
    EditorScreen editorScreen = (EditorScreen) screen;
    if (editorScreen instanceof AbstractEditor) {
        ((AbstractEditor) editorScreen).setParentDs(parentDs);
    }
    editorScreen.setEntityToEdit(item);
    show(screen);
    return screen instanceof Window.Editor ? (Window.Editor) screen : new ScreenEditorWrapper(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 50 with Screen

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

the class WebScreens method saveScreenSettings.

public void saveScreenSettings() {
    Screen rootScreen = getOpenedScreens().getRootScreen();
    saveSettings(rootScreen);
    getOpenedWorkAreaScreensStream().forEach(UiControllerUtils::saveSettings);
    getDialogScreensStream().forEach(UiControllerUtils::saveSettings);
}
Also used : Screen(com.haulmont.cuba.gui.screen.Screen) UiControllerUtils(com.haulmont.cuba.gui.screen.UiControllerUtils)

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