/** * 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); }
@Override protected void doHandle(String className, String message, @Nullable Throwable throwable, WindowManager windowManager) { windowManager.showNotification(message, Frame.NotificationType.ERROR); } }
/** * Show options dialog with title and message. <br> * Message supports line breaks ({@code \n}). * * @param title dialog title * @param message text * @param messageType defines how to display the dialog. * Don't forget to escape data from the database in case of {@code *_HTML} types! * @param actions array of actions that represent options. For standard options consider use of * {@link DialogAction} instances. * * @deprecated Use {@link Dialogs} bean instead. */ @Deprecated default void showOptionDialog(String title, String message, Frame.MessageType messageType, Action[] actions) { getWindowManager().showOptionDialog(title, message, messageType, actions); }
@Override public void handleAction(com.vaadin.event.Action action, Object sender, Object target) { if (initialized) { if (saveSettingsAction == action) { Screen screen = getFrameOwner(); UiControllerUtils.saveSettings(screen); } else if (restoreToDefaultsAction == action) { Screen screen = getFrameOwner(); UiControllerUtils.deleteSettings(screen); } else if (analyzeAction == action) { LayoutAnalyzer analyzer = new LayoutAnalyzer(); List<LayoutTip> tipsList = analyzer.analyze(WebDialogWindow.this); if (tipsList.isEmpty()) { getWindowManager().showNotification("No layout problems found", Frame.NotificationType.HUMANIZED); } else { WindowConfig windowConfig = beanLocator.get(WindowConfig.NAME); WindowInfo windowInfo = windowConfig.getWindowInfo("layoutAnalyzer"); getWindowManager().openWindow(windowInfo, WindowManager.OpenType.DIALOG, ParamsMap.of("tipsList", tipsList)); } } } } }
wm.showOptionDialog(messages.getMessage(ReportGuiManager.class, "notifications.confirmPrintSelectedheader"), messages.getMessage(ReportGuiManager.class, "notifications.confirmPrintSelected"), Frame.MessageType.CONFIRMATION, wm.showOptionDialog(messages.getMessage(ListPrintFormAction.class, "notifications.confirmPrintAllheader"), messages.getMessage(ListPrintFormAction.class, "notifications.confirmPrintAll"), Frame.MessageType.CONFIRMATION, new Action[]{yesAction, cancelAction}); } else { wm.showNotification(messages.getMessage(ReportGuiManager.class, "notifications.noSelectedEntity"), Frame.NotificationType.HUMANIZED);
wm.showNotification(messages.getMainMessage("OpenAction.objectIsDeleted"), Frame.NotificationType.HUMANIZED); return; AbstractEditor editor = (AbstractEditor) wm.openEditor( windowConfig.getWindowInfo(windowAlias), entity,
@Override public void onApplicationEvent(AppLoggedInEvent event) { App app = event.getApp(); Connection connection = app.getConnection(); if (connection.isAuthenticated() && !isLoggedInWithExternalAuth(connection.getSessionNN())) { User user = connection.getSessionNN().getUser(); // Change password on logon if (Boolean.TRUE.equals(user.getChangePasswordAtNextLogon())) { WindowManager wm = app.getWindowManager(); for (Window window : wm.getOpenWindows()) { window.setEnabled(false); } WindowInfo changePasswordDialog = windowConfig.getWindowInfo("sec$User.changePassword"); Window changePasswordWindow = wm.openWindow(changePasswordDialog, WindowManager.OpenType.DIALOG.closeable(false), ParamsMap.of("cancelEnabled", Boolean.FALSE)); changePasswordWindow.addCloseListener(actionId -> { for (Window window : wm.getOpenWindows()) { window.setEnabled(true); } }); } } } }
WindowInfo windowInfo = AppBeans.get(WindowConfig.class).getWindowInfo("report$Report.run"); wm.openLookup(windowInfo, items -> { if (CollectionUtils.isNotEmpty(items)) { Report report = (Report) items.iterator().next(); wm.showNotification( messages.getMessage(ReportGuiManager.class, "report.notFoundReports"), Frame.NotificationType.HUMANIZED);
Screen screen = windowManager.create(screenId, openType.getOpenMode(), new MapScreenOptions(params)); windowManager.showNotification(messages.getMainMessage("actions.Related.FilterNotFound"), Frame.NotificationType.WARNING); windowManager.showNotification(messages.getMainMessage("actions.Related.NotSelected"), Frame.NotificationType.HUMANIZED);
/** * Open an edit screen for entity instance. * * @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(Entity item, WindowManager.OpenType openType) { WindowConfig windowConfig = AppBeans.get(WindowConfig.NAME); WindowInfo editorScreen = windowConfig.getEditorScreen(item); return (AbstractEditor) getWindowManager().openEditor(editorScreen, item, openType); }
/** * Open a lookup screen. * * @param entityClass required class of entity * @param handler is invoked when selection confirmed and the lookup screen closes * @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 AbstractLookup openLookup(Class<? extends Entity> entityClass, Window.Lookup.Handler handler, WindowManager.OpenType openType, Map<String, Object> params) { WindowConfig windowConfig = AppBeans.get(WindowConfig.NAME); WindowInfo lookupScreen = windowConfig.getLookupScreen(entityClass); return (AbstractLookup) getWindowManager().openLookup(lookupScreen, handler, openType, params); }
@Override public void showComponentName(WindowManager windowManager, String title, String message) { windowManager.showMessageDialog(title, message, Frame.MessageType.CONFIRMATION); } }
wm.showNotification( messages.getMainMessage("OpenAction.objectIsDeleted"), Frame.NotificationType.HUMANIZED); AbstractEditor editor = (AbstractEditor) wm.openEditor( windowConfig.getWindowInfo(windowAlias), entity,
/** * 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); }
/** * Open a lookup screen. * * @param entityClass required class of entity * @param handler is invoked when selection confirmed and the lookup screen closes * @param openType how to open the screen * @return created window * * @deprecated Use {@link ScreenBuilders} bean instead. */ @Deprecated default AbstractLookup openLookup(Class<? extends Entity> entityClass, Window.Lookup.Handler handler, WindowManager.OpenType openType) { WindowConfig windowConfig = AppBeans.get(WindowConfig.NAME); WindowInfo lookupScreen = windowConfig.getLookupScreen(entityClass); return (AbstractLookup) getWindowManager().openLookup(lookupScreen, handler, openType); }
/** * Show message dialog with title and message. <br> * Message supports line breaks ({@code \n}). * * @param title dialog title * @param message text * @param messageType defines how to display the dialog. * Don't forget to escape data from the database in case of {@code *_HTML} types! * * @deprecated Use {@link Dialogs} bean instead. */ @Deprecated default void showMessageDialog(String title, String message, Frame.MessageType messageType) { getWindowManager().showMessageDialog(title, message, messageType); }
/** * 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); }
@Override protected void doHandle(String className, String message, @Nullable Throwable throwable, WindowManager windowManager) { String msg = messages.getMessage(getClass(), "accessDenied.message"); windowManager.showNotification(msg, Frame.NotificationType.ERROR); }
/** * Show options dialog with title and message. <br> * Message supports line breaks ({@code \n}). * * @param title dialog title * @param message text * @param messageType defines how to display the dialog. * Don't forget to escape data from the database in case of {@code *_HTML} types! * @param actions list of actions that represent options. For standard options consider use of * {@link DialogAction} instances. * * @deprecated Use {@link Dialogs} bean instead. */ @Deprecated default void showOptionDialog(String title, String message, Frame.MessageType messageType, List<Action> actions) { getWindowManager().showOptionDialog(title, message, messageType, actions.toArray(new Action[0])); }
/** * Open an edit screen for entity instance. * * @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(Entity item, WindowManager.OpenType openType, Map<String, Object> params) { WindowConfig windowConfig = AppBeans.get(WindowConfig.NAME); WindowInfo editorScreen = windowConfig.getEditorScreen(item); return (AbstractEditor) getWindowManager().openEditor(editorScreen, item, openType, params); }