Search in sources :

Example 16 with Screen

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

the class WebSuggestionPickerField method showSuggestions.

protected void showSuggestions(List<V> suggestions, boolean userOriginated) {
    FrameOwner frameOwner = getFrame().getFrameOwner();
    Collection<Screen> dialogScreens = UiControllerUtils.getScreenContext(frameOwner).getScreens().getOpenedScreens().getDialogScreens();
    Screen lastDialog = null;
    for (Screen dialogScreen : dialogScreens) {
        lastDialog = dialogScreen;
    }
    if (frameOwner instanceof ScreenFragment) {
        frameOwner = ComponentsHelper.getScreen((ScreenFragment) frameOwner);
    }
    if (lastDialog == null || Objects.equals(frameOwner, lastDialog)) {
        getComponent().showSuggestions(suggestions, userOriginated);
    }
}
Also used : FrameOwner(com.haulmont.cuba.gui.screen.FrameOwner) ScreenFragment(com.haulmont.cuba.gui.screen.ScreenFragment) Screen(com.haulmont.cuba.gui.screen.Screen)

Example 17 with Screen

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

the class WebUserActionsButton method openSettings.

protected void openSettings() {
    Screen settingsScreen = AppUI.getCurrent().getScreens().create("settings", OpenMode.NEW_TAB);
    settingsScreen.show();
}
Also used : Screen(com.haulmont.cuba.gui.screen.Screen)

Example 18 with Screen

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

the class WebUserActionsButton method defaultLogin.

protected void defaultLogin() {
    AppUI ui = ((AppUI) component.getUI());
    if (ui == null) {
        throw new IllegalStateException("Logout button is not attached to UI");
    }
    String loginScreenId = beanLocator.get(Configuration.class).getConfig(WebConfig.class).getLoginScreenId();
    Screen loginScreen = ui.getScreens().create(loginScreenId, OpenMode.ROOT);
    loginScreen.show();
}
Also used : Screen(com.haulmont.cuba.gui.screen.Screen) WebConfig(com.haulmont.cuba.web.WebConfig) AppUI(com.haulmont.cuba.web.AppUI)

Example 19 with Screen

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

the class WebDataLoadCoordinator method configureAutomatically.

private void configureAutomatically(DataLoader loader, FrameOwner frameOwner) {
    List<String> queryParameters = DataLoadersHelper.getQueryParameters(loader);
    List<String> allParameters = new ArrayList<>(queryParameters);
    allParameters.addAll(getConditionParameters(loader));
    // add triggers on container/component events
    for (String parameter : allParameters) {
        if (parameter.startsWith(containerPrefix)) {
            InstanceContainer container = UiControllerUtils.getScreenData(frameOwner).getContainer(parameter.substring(containerPrefix.length()));
            addOnContainerItemChangedLoadTrigger(loader, container, parameter);
        } else if (parameter.startsWith(componentPrefix)) {
            String componentId = parameter.substring(componentPrefix.length());
            Component component = frameOwner instanceof Screen ? ((Screen) frameOwner).getWindow().getComponentNN(componentId) : ((ScreenFragment) frameOwner).getFragment().getComponentNN(componentId);
            LikeClause likeClause = findLikeClause(loader, parameter);
            addOnComponentValueChangedLoadTrigger(loader, component, parameter, likeClause);
        }
    }
    // if the loader has no parameters in query, add trigger on BeforeShowEvent/AttachEvent
    if (queryParameters.isEmpty()) {
        Class eventClass = frameOwner instanceof Screen ? Screen.BeforeShowEvent.class : ScreenFragment.AttachEvent.class;
        addOnFrameOwnerEventLoadTrigger(loader, eventClass);
    }
}
Also used : ScreenFragment(com.haulmont.cuba.gui.screen.ScreenFragment) Screen(com.haulmont.cuba.gui.screen.Screen) ArrayList(java.util.ArrayList) InstanceContainer(com.haulmont.cuba.gui.model.InstanceContainer) Component(com.haulmont.cuba.gui.components.Component)

Example 20 with Screen

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

the class WebScreens method openLookup.

@SuppressWarnings({ "deprecation", "IncorrectCreateGuiComponent", "unchecked" })
@Override
public Window.Lookup openLookup(WindowInfo windowInfo, Window.Lookup.Handler handler, OpenType openType) {
    Map<String, Object> params = createParametersMap(windowInfo, Collections.emptyMap());
    MapScreenOptions options = new MapScreenOptions(params);
    Screen screen = createScreen(windowInfo, openType.getOpenMode(), options);
    applyOpenTypeParameters(screen.getWindow(), openType);
    ((LookupScreen) screen).setSelectHandler(new SelectHandlerAdapter(handler));
    show(screen);
    return screen instanceof Window.Lookup ? (Window.Lookup) screen : new ScreenLookupWrapper(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) SelectHandlerAdapter(com.haulmont.cuba.gui.components.compatibility.SelectHandlerAdapter)

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