@Override public void showNotification(String caption) { ui.getNotifications().create() .withCaption(caption) .show(); }
protected void showNotification(String msg) { ui.getNotifications().create(NotificationType.TRAY) .withCaption(msg) .show(); }
protected void showNoDataWarning() { notifications.create(NotificationType.WARNING) .withCaption(messages.getMainMessage("warningNotification.caption")) .withPosition(Notifications.Position.MIDDLE_CENTER) .show(); }
protected void showWarnNotification() { notifications.create(NotificationType.WARNING) .withCaption(messages.getMainMessage("actions.warningExport.title")) .withDescription(messages.getMainMessage("actions.warningExport.message")) .withPosition(Notifications.Position.MIDDLE_CENTER) .show(); }
protected void showParseErrorNotification(String message) { ScreenContext screenContext = UiControllerUtils.getScreenContext(getFrame().getFrameOwner()); screenContext.getNotifications().create(Notifications.NotificationType.TRAY) .withDescription(message) .show(); } }
/** * Show validation alert with passed errors and first problem UI component. * * @param origin screen controller * @param errors validation error */ public void showValidationErrors(FrameOwner origin, ValidationErrors errors) { checkNotNullArgument(origin); checkNotNullArgument(errors); if (errors.isEmpty()) { return; } StringBuilder buffer = new StringBuilder(); for (ValidationErrors.Item error : errors.getAll()) { buffer.append(error.description).append("\n"); } ClientConfig clientConfig = configuration.getConfig(ClientConfig.class); String validationNotificationType = clientConfig.getValidationNotificationType(); if (validationNotificationType.endsWith("_HTML")) { // HTML validation notification types are not supported validationNotificationType = validationNotificationType.replace("_HTML", ""); } Notifications notifications = getScreenContext(origin).getNotifications(); notifications.create(NotificationType.valueOf(validationNotificationType)) .withCaption(messages.getMainMessage("validationFail.caption")) .withDescription(buffer.toString()) .show(); focusProblemComponent(errors); }
@SuppressWarnings("deprecation") @Override public void showNotification(String caption, Frame.NotificationType type) { ui.getNotifications().create() .withCaption(caption) .withContentMode(Frame.NotificationType.isHTML(type) ? ContentMode.HTML : ContentMode.TEXT) .withType(convertNotificationType(type)) .show(); }
@SuppressWarnings("deprecation") @Override public void showNotification(String caption, String description, Frame.NotificationType type) { ui.getNotifications().create() .withCaption(caption) .withDescription(description) .withContentMode(Frame.NotificationType.isHTML(type) ? ContentMode.HTML : ContentMode.TEXT) .withType(convertNotificationType(type)) .show(); }
Notifications notifications = getScreenContext(origin).getNotifications(); notifications.create(NotificationType.HUMANIZED) .withCaption(messages.getMessage(FtsSearchLauncherImpl.class, "noSearchTerm")) .show(); Notifications notifications = getScreenContext(origin).getNotifications(); notifications.create(NotificationType.HUMANIZED) .withCaption(messages.getMessage(FtsSearchLauncherImpl.class, "notFound")) .show();
/** * Export via {@link ExcelExporter}. */ protected void export(ExportMode exportMode) { ExcelExporter exporter = new ExcelExporter(); exporter.setExportAggregation(exportAggregation); if (listComponent instanceof Table) { Table<Entity> table = (Table<Entity>) listComponent; exporter.exportTable(table, table.getNotCollapsedColumns(), false, display, null, fileName, exportMode); } if (listComponent instanceof DataGrid) { DataGrid<Entity> dataGrid = (DataGrid<Entity>) listComponent; List<DataGrid.Column> columns = dataGrid.getVisibleColumns().stream() .filter(col -> !col.isCollapsed()) .collect(Collectors.toList()); exporter.exportDataGrid(dataGrid, columns, display, null, fileName, exportMode); } if (exporter.isXlsMaxRowNumberExceeded()) { Notifications notifications = getScreenContext(listComponent).getNotifications(); notifications.create(NotificationType.WARNING) .withCaption(messages.getMainMessage("actions.warningExport.title")) .withDescription(messages.getMainMessage("actions.warningExport.message")) .show(); } }
protected void handleDateOutOfRange(V value) { if (getFrame() != null) { Messages messages = beanLocator.get(Messages.NAME); Notifications notifications = ComponentsHelper.getScreenContext(this).getNotifications(); notifications.create() .withCaption(messages.getMainMessage("datePicker.dateOutOfRangeMessage")) .withType(Notifications.NotificationType.TRAY) .show(); } setValueToPresentation(convertToLocalDateTime(value, zoneId)); }
Notifications notifications = ComponentsHelper.getScreenContext(target).getNotifications(); notifications.create(NotificationType.WARNING) .withCaption(messages.getMainMessage("actions.warningExport.title")) .withDescription(messages.getMainMessage("actions.warningExport.message"))
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)); } } }
@Override public void actionPerform(Component component) { if (beforeActionPerformedHandler != null) { if (!beforeActionPerformedHandler.beforeActionPerformed()) return; } Entity entity = editor.getEditedEntity(); if (entity != null) { MetaClass metaClass = entity.getMetaClass(); openRunReportScreen((Screen) editor, entity, metaClass, reportOutputName); } else { Messages messages = AppBeans.get(Messages.NAME); Notifications notifications = UiControllerUtils.getScreenContext((FrameOwner) editor).getNotifications(); notifications.create() .withCaption(messages.getMessage(ReportGuiManager.class, "notifications.noSelectedEntity")) .show(); } } }
@Override protected void afterLookupWindowOpened(Window lookupWindow) { boolean found = ComponentsHelper.walkComponents(lookupWindow, screenComponent -> { if (!(screenComponent instanceof Filter)) { return false; } else { MetaClass actualMetaClass = ((FilterImplementation) screenComponent).getEntityMetaClass(); MetaClass propertyMetaClass = extendedEntities.getEffectiveMetaClass(pickerField.getMetaClass()); if (Objects.equals(actualMetaClass, propertyMetaClass)) { applyFilter(((Filter) screenComponent)); return true; } return false; } }); if (!found) { Notifications notifications = getScreenContext(pickerField).getNotifications(); notifications.create(NotificationType.WARNING) .withCaption(messages.getMainMessage("dynamicAttributes.entity.filter.filterNotFound")) .show(); } AbstractWindow controller = (AbstractWindow) (lookupWindow).getFrameOwner(); ((DsContextImplementation) controller.getDsContext()).resumeSuspended(); }
/** * Pessimistic lock before start of editing, if it is configured for the entity. */ protected boolean lockIfNeeded(Entity entity) { LockService lockService = getBeanLocator().get(LockService.class); LockInfo lockInfo = lockService.lock(getLockName(), entity.getId().toString()); if (lockInfo == null) { justLocked = true; } else if (!(lockInfo instanceof LockNotSupported)) { Messages messages = getBeanLocator().get(Messages.class); DatatypeFormatter datatypeFormatter = getBeanLocator().get(DatatypeFormatter.class); Notifications notifications = getScreenContext().getNotifications(); notifications.create(NotificationType.HUMANIZED) .withCaption(messages.getMainMessage("entityLocked.msg")) .withDescription(String.format(messages.getMainMessage("entityLocked.desc"), lockInfo.getUser().getLogin(), datatypeFormatter.formatDateTime(lockInfo.getSince()))) .show(); return false; } return true; }
ScreenContext screenContext = UiControllerUtils.getScreenContext(event.getSource()); screenContext.getNotifications() .create(Notifications.NotificationType.WARNING) .withCaption(messages.getMainMessage("actions.Related.FilterNotFound")) .show();
@Override public boolean handleTimeoutException() { boolean handled = wrappedTask.handleTimeoutException(); if (handled || wrappedTask.getOwnerScreen() == null) { Screens screens = getScreenContext().getScreens(); screens.remove(screen); } else { Screens screens = getScreenContext().getScreens(); screens.remove(screen); Notifications notifications = getScreenContext().getNotifications(); Messages messages = AppBeans.get(Messages.NAME); notifications.create(Notifications.NotificationType.WARNING) .withCaption(messages.getMessage(LocalizedTaskWrapper.class, "backgroundWorkProgress.timeout")) .withDescription(messages.getMessage(LocalizedTaskWrapper.class, "backgroundWorkProgress.timeoutMessage")) .show(); handled = true; } return handled; }
Notifications notifications = screenContext.getNotifications(); notifications.create(NotificationType.HUMANIZED) .withDescription(messages.getMainMessage("OpenAction.objectIsDeleted")) .show();
DatatypeFormatter datatypeFormatter = getBeanLocator().get(DatatypeFormatter.class); getScreenContext().getNotifications().create(NotificationType.HUMANIZED) .withCaption(messages.getMainMessage("entityLocked.msg")) .withDescription(