Search in sources :

Example 26 with Screen

use of io.jmix.ui.screen.Screen in project jmix by jmix-framework.

the class AbstractSuggestionField method showSuggestions.

protected void showSuggestions(List<I> 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)) {
        component.showSuggestions(suggestions, userOriginated);
    }
}
Also used : FrameOwner(io.jmix.ui.screen.FrameOwner) ScreenFragment(io.jmix.ui.screen.ScreenFragment) Screen(io.jmix.ui.screen.Screen)

Example 27 with Screen

use of io.jmix.ui.screen.Screen in project jmix by jmix-framework.

the class AppUI method restoreRouteState.

/*
    * During AppUI initialization process the initial URL is replaced
    * with the created Root Window route. In case the requested state
    * contains parameters for the root window, we need to restore it
    * to keep in sync the browser URL and params that can be obtained
    * from UrlParamsChangedEvent
    */
protected void restoreRouteState(NavigationState requestedState) {
    // Check that the requested state doesn't contain nested route
    // that will be handled by navigation handlers and that there
    // are parameters to restore in the browser URL.
    Map<String, String> requestedParams = requestedState.getParams();
    if (!Strings.isNullOrEmpty(requestedState.getNestedRoute()) || MapUtils.isEmpty(requestedParams)) {
        return;
    }
    RootWindow topLevelWindow = getTopLevelWindow();
    if (topLevelWindow instanceof WindowImpl) {
        Screen frameOwner = topLevelWindow.getFrameOwner();
        NavigationState resolvedState = ((WindowImpl) topLevelWindow).getResolvedState();
        if (resolvedState == null) {
            return;
        }
        // Check that the actual Root Window and the requested Root Window is the same
        if (Objects.equals(requestedState.getRoot(), resolvedState.getRoot())) {
            urlRouting.replaceState(frameOwner, requestedParams);
            // Because of usage of 'urlRouting.replaceState' UrlParamsChangedEvent
            // won't be fired for the Root Window by ParamsNavigationHandler, hence
            // we need to do it here.
            UiControllerUtils.fireEvent(frameOwner, UrlParamsChangedEvent.class, new UrlParamsChangedEvent(frameOwner, requestedParams));
        }
    }
}
Also used : WindowImpl(io.jmix.ui.component.impl.WindowImpl) Screen(io.jmix.ui.screen.Screen) RootWindow(io.jmix.ui.component.RootWindow)

Example 28 with Screen

use of io.jmix.ui.screen.Screen in project jmix by jmix-framework.

the class CubaScreens method openLookup.

@Override
public com.haulmont.cuba.gui.components.Window.Lookup openLookup(WindowInfo windowInfo, com.haulmont.cuba.gui.components.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 com.haulmont.cuba.gui.components.Window.Lookup ? (com.haulmont.cuba.gui.components.Window.Lookup) screen : new ScreenLookupWrapper(screen);
}
Also used : LookupScreen(io.jmix.ui.screen.LookupScreen) LookupScreen(io.jmix.ui.screen.LookupScreen) EditorScreen(io.jmix.ui.screen.EditorScreen) Screen(io.jmix.ui.screen.Screen) ScreenLookupWrapper(com.haulmont.cuba.gui.screen.compatibility.ScreenLookupWrapper) MapScreenOptions(io.jmix.ui.screen.MapScreenOptions) SelectHandlerAdapter(com.haulmont.cuba.gui.components.compatibility.SelectHandlerAdapter)

Example 29 with Screen

use of io.jmix.ui.screen.Screen in project jmix by jmix-framework.

the class CubaScreens method openEditor.

@Override
public com.haulmont.cuba.gui.components.Window.Editor openEditor(WindowInfo windowInfo, Entity item, OpenType openType, Map<String, Object> params) {
    Screen editor = createEditor(windowInfo, item, openType, params);
    editor.show();
    return editor instanceof com.haulmont.cuba.gui.components.Window.Editor ? (com.haulmont.cuba.gui.components.Window.Editor) editor : new ScreenEditorWrapper(editor);
}
Also used : LookupScreen(io.jmix.ui.screen.LookupScreen) EditorScreen(io.jmix.ui.screen.EditorScreen) Screen(io.jmix.ui.screen.Screen) ScreenEditorWrapper(com.haulmont.cuba.gui.screen.compatibility.ScreenEditorWrapper)

Example 30 with Screen

use of io.jmix.ui.screen.Screen in project jmix by jmix-framework.

the class CubaScreens method selectWindowTab.

@Override
public void selectWindowTab(Window window) {
    AppWorkAreaImpl workArea = getConfiguredWorkArea();
    Collection<WindowStack> workAreaStacks = getWorkAreaStacks(workArea);
    Screen screen = window.getFrameOwner();
    workAreaStacks.stream().filter(ws -> ws.getBreadcrumbs().contains(screen)).findFirst().ifPresent(WindowStack::select);
}
Also used : AppWorkAreaImpl(io.jmix.ui.component.impl.AppWorkAreaImpl) LookupScreen(io.jmix.ui.screen.LookupScreen) EditorScreen(io.jmix.ui.screen.EditorScreen) Screen(io.jmix.ui.screen.Screen)

Aggregations

Screen (io.jmix.ui.screen.Screen)82 EditorScreen (io.jmix.ui.screen.EditorScreen)20 LookupScreen (io.jmix.ui.screen.LookupScreen)15 MapScreenOptions (io.jmix.ui.screen.MapScreenOptions)11 Nullable (javax.annotation.Nullable)9 Messages (io.jmix.core.Messages)6 WindowImpl (io.jmix.ui.component.impl.WindowImpl)6 Screens (io.jmix.ui.Screens)5 io.jmix.ui.component (io.jmix.ui.component)5 NavigationState (io.jmix.ui.navigation.NavigationState)5 FrameOwner (io.jmix.ui.screen.FrameOwner)5 UiControllerUtils (io.jmix.ui.screen.UiControllerUtils)5 java.util (java.util)5 Collectors (java.util.stream.Collectors)5 LoggerFactory (org.slf4j.LoggerFactory)5 Autowired (org.springframework.beans.factory.annotation.Autowired)5 LegacyFrame (com.haulmont.cuba.gui.screen.compatibility.LegacyFrame)4 ScreenEditorWrapper (com.haulmont.cuba.gui.screen.compatibility.ScreenEditorWrapper)4 MetaClass (io.jmix.core.metamodel.model.MetaClass)4 BaseAction (io.jmix.ui.action.BaseAction)4