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