protected boolean navigationIsNotPermitted(WindowInfo windowInfo) { WindowInfo loginWindowInfo = windowConfig.getWindowInfo("loginWindow"); WindowInfo mainWindowInfo = windowConfig.getWindowInfo("mainWindow"); return loginWindowInfo.equals(windowInfo) || mainWindowInfo.equals(windowInfo); }
protected WindowInfo getScreenInfo(Class<? extends Screen> screenClass) { UiController uiController = screenClass.getAnnotation(UiController.class); if (uiController == null) { throw new IllegalArgumentException("No @UiController annotation for class " + screenClass); } String screenId = UiDescriptorUtils.getInferredScreenId(uiController, screenClass); return windowConfig.getWindowInfo(screenId); }
protected <T extends ScreenFragment> WindowInfo getFragmentInfo(Class<T> fragmentClass) { UiController uiController = fragmentClass.getAnnotation(UiController.class); if (uiController == null) { throw new IllegalArgumentException("No @UiController annotation for class " + fragmentClass); } String screenId = UiDescriptorUtils.getInferredScreenId(uiController, fragmentClass); return windowConfig.getWindowInfo(screenId); }
/** * Open a simple screen. * * @param windowAlias screen ID as defined in {@code screens.xml} * @param openType how to open the screen * @return created window * * @deprecated Use {@link Screens} bean instead. */ @Deprecated default AbstractWindow openWindow(String windowAlias, WindowManager.OpenType openType) { WindowConfig windowConfig = AppBeans.get(WindowConfig.NAME); WindowInfo windowInfo = windowConfig.getWindowInfo(windowAlias); return (AbstractWindow) getWindowManager().openWindow(windowInfo, openType); }
/** * Open a simple screen. * * @param windowAlias screen ID as defined in {@code screens.xml} * @param openType how to open the screen * @param params parameters to pass to {@code init()} method of the screen's controller * @return created window * * @deprecated Use {@link Screens} bean instead. */ @Deprecated default AbstractWindow openWindow(String windowAlias, WindowManager.OpenType openType, Map<String, Object> params) { WindowConfig windowConfig = AppBeans.get(WindowConfig.NAME); WindowInfo windowInfo = windowConfig.getWindowInfo(windowAlias); return (AbstractWindow) getWindowManager().openWindow(windowInfo, openType, params); }
/** * Open an edit screen. * * @param windowAlias screen ID as defined in {@code screens.xml} * @param item entity to edit * @param openType how to open the screen * @return created window * * @deprecated Use {@link ScreenBuilders} bean instead. */ @Deprecated default AbstractEditor openEditor(String windowAlias, Entity item, WindowManager.OpenType openType) { WindowConfig windowConfig = AppBeans.get(WindowConfig.NAME); WindowInfo windowInfo = windowConfig.getWindowInfo(windowAlias); return (AbstractEditor) getWindowManager().openEditor(windowInfo, item, openType); }
protected void openReportParamsDialog(FrameOwner screen, Report report, @Nullable Map<String, Object> parameters, @Nullable ReportInputParameter inputParameter, @Nullable String templateCode, @Nullable String outputFileName, boolean bulkPrint) { Map<String, Object> params = ParamsMap.of( REPORT_PARAMETER, report, PARAMETERS_PARAMETER, parameters, INPUT_PARAMETER, inputParameter, TEMPLATE_CODE_PARAMETER, templateCode, OUTPUT_FILE_NAME_PARAMETER, outputFileName, BULK_PRINT, bulkPrint ); ScreenContext screenContext = UiControllerUtils.getScreenContext(screen); WindowManager wm = (WindowManager) screenContext.getScreens(); WindowInfo windowInfo = AppBeans.get(WindowConfig.class).getWindowInfo("report$inputParameters"); wm.openWindow(windowInfo, OpenType.DIALOG, params); }
/** * Open an edit screen. * * @param windowAlias screen ID as defined in {@code screens.xml} * @param item entity to edit * @param openType how to open the screen * @param params parameters to pass to {@code init()} method of the screen's controller * @return created window * * @deprecated Use {@link ScreenBuilders} bean instead. */ @Deprecated default AbstractEditor openEditor(String windowAlias, Entity item, WindowManager.OpenType openType, Map<String, Object> params) { WindowConfig windowConfig = AppBeans.get(WindowConfig.NAME); WindowInfo windowInfo = windowConfig.getWindowInfo(windowAlias); return (AbstractEditor) getWindowManager().openEditor(windowInfo, item, openType, params); }
public WindowInfo getEditorScreen(Entity entity) { MetaClass metaClass = entity.getMetaClass(); MetaClass originalMetaClass = metadata.getExtendedEntities().getOriginalOrThisMetaClass(metaClass); WindowInfo windowInfo = primaryEditors.get(originalMetaClass.getJavaClass()); if (windowInfo != null) { return windowInfo; } String editorScreenId = getEditorScreenId(metaClass); return getWindowInfo(editorScreenId); }
@Override public void actionPerform(Component component) { WindowInfo windowInfo = windowConfig.getWindowInfo("filterSelect"); FilterSelectWindow window = (FilterSelectWindow) windowManager.openWindow(windowInfo, OpenType.DIALOG, ParamsMap.of("filterEntities", filterEntities)); window.addCloseListener(actionId -> { if (Window.COMMIT_ACTION_ID.equals(actionId)) { FilterEntity selectedEntity = window.getFilterEntity(); setFilterEntity(selectedEntity); } }); }
@Override public ScreenFragment create(FrameOwner parent, String screenFragmentId, ScreenOptions options) { checkNotNullArgument(parent); checkNotNullArgument(screenFragmentId); checkNotNullArgument(options); WindowInfo windowInfo = windowConfig.getWindowInfo(screenFragmentId); return createFragment(parent, windowInfo, options); }
/** * Initialize new TopLevelWindow and replace current. * * @param topLevelWindowId target top level window id * @deprecated Use {@link Screens#create(Class, Screens.LaunchMode)} with {@link OpenMode#ROOT} */ @Deprecated public void navigateTo(String topLevelWindowId) { AppUI ui = AppUI.getCurrent(); WindowInfo windowInfo = windowConfig.getWindowInfo(topLevelWindowId); Screens screens = ui.getScreens(); Screen screen = screens.create(windowInfo.asScreen(), OpenMode.ROOT); screens.show(screen); }
public void showInfo(Entity entity, MetaClass metaClass, Component.BelongToFrame component) { WindowManager wm = (WindowManager) ComponentsHelper.getScreenContext(component).getScreens(); WindowInfo windowInfo = AppBeans.get(WindowConfig.class).getWindowInfo("sysInfoWindow"); wm.openWindow(windowInfo, OpenType.DIALOG, ParamsMap.of( "metaClass", metaClass, "item", entity)); } }
protected void openReportParamsDialog(Report report, FrameOwner screen) { ScreenContext screenContext = UiControllerUtils.getScreenContext(screen); WindowManager wm = (WindowManager) screenContext.getScreens(); WindowInfo windowInfo = AppBeans.get(WindowConfig.class).getWindowInfo("report$inputParameters"); wm.openWindow(windowInfo, OpenType.DIALOG, ParamsMap.of("report", report)); }
@Override public void actionPerform(Component component) { WindowManager windowManager = windowManagerProvider.get(); WindowInfo windowInfo = windowConfig.getWindowInfo("date-interval-editor"); DateIntervalEditor editor = (DateIntervalEditor) windowManager.openWindow(windowInfo, OpenType.DIALOG, Collections.singletonMap("dateIntervalDescription", value.getDescription())); editor.addListener(actionId -> { if (Window.COMMIT_ACTION_ID.equals(actionId)) { value = editor.getDateIntervalValue(); textField.setValue(value.getLocalizedValue()); fireValueChangeListeners(value); } }); }
/** * Get available lookup screen by class of entity * * @param entityClass entity class * @return id of lookup screen * @throws NoSuchScreenException if the screen with specified ID is not registered */ public WindowInfo getLookupScreen(Class<? extends Entity> entityClass) { MetaClass metaClass = metadata.getSession().getClass(entityClass); MetaClass originalMetaClass = metadata.getExtendedEntities().getOriginalOrThisMetaClass(metaClass); WindowInfo windowInfo = primaryLookups.get(originalMetaClass.getJavaClass()); if (windowInfo != null) { return windowInfo; } String lookupScreenId = getAvailableLookupScreenId(metaClass); return getWindowInfo(lookupScreenId); }
@Override public Screen create(String screenId, LaunchMode launchMode, ScreenOptions options) { checkNotNullArgument(screenId); checkNotNullArgument(launchMode); checkNotNullArgument(options); // load screen class only once WindowInfo windowInfo = windowConfig.getWindowInfo(screenId).resolve(); return createScreen(windowInfo, launchMode, options); }
@Override public void handle(ExternalLinkContext linkContext) { String screenName = linkContext.getRequestParams().get("screen"); App app = linkContext.getApp(); final WindowInfo windowInfo = windowConfig.getWindowInfo(screenName); if (windowInfo == null) { log.warn("WindowInfo not found for screen: {}", screenName); return; } try { openWindow(windowInfo, linkContext); } catch (EntityAccessException e) { entityAccessExceptionHandler.handle(e, app.getWindowManager()); } catch (AccessDeniedException e) { accessDeniedHandler.handle(e, app.getWindowManager()); } catch (NoSuchScreenException e) { noSuchScreenHandler.handle(e, app.getWindowManager()); } }
protected void analyzeLayout(Object target) { Window window = findWindow((Layout) target); if (window != null) { LayoutAnalyzer analyzer = new LayoutAnalyzer(); List<LayoutTip> tipsList = analyzer.analyze(window); if (tipsList.isEmpty()) { Notifications notifications = ComponentsHelper.getScreenContext(window).getNotifications(); notifications.create(NotificationType.HUMANIZED) .withCaption("No layout problems found") .show(); } else { WindowManager wm = (WindowManager) ComponentsHelper.getScreenContext(window).getScreens(); WindowInfo windowInfo = AppBeans.get(WindowConfig.class).getWindowInfo("layoutAnalyzer"); wm.openWindow(windowInfo, WindowManager.OpenType.DIALOG, ParamsMap.of("tipsList", tipsList)); } } }
protected void showPivotTable(ShowPivotMode mode) { ParamsMap paramsMap = ParamsMap.of(); if (mode == ALL_ROWS) { paramsMap.pair("dataItems", convertEntitiesToDataItems(target.getDatasource().getItems())); } else { paramsMap.pair("dataItems", convertEntitiesToDataItems(target.getSelected())); } paramsMap.pair("properties", getPropertiesWithLocale()); paramsMap.pair("nativeJson", nativeJson); WindowManager wm = target.getFrame().getWindowManager(); WindowConfig windowConfig = AppBeans.get(WindowConfig.NAME); wm.openWindow(windowConfig.getWindowInfo(SCREEN_ID), WindowManager.OpenType.NEW_TAB, paramsMap.create()); }