if (alreadyAdded) { notifications.create(Notifications.NotificationType.TRAY) .withCaption(messages.getMessage(RegionEditor.class, "elementsAlreadyAdded")) .show(); } else if (entityTree.getSelected().size() != 0) { notifications.create(Notifications.NotificationType.HUMANIZED) .withCaption(messages.getMessage(RegionEditor.class, "selectPropertyFromEntity")) .show(); } else { notifications.create(Notifications.NotificationType.TRAY) .withCaption(messages.getMessage(RegionEditor.class, "elementsWasNotAdded")) .show();
.withCaption(messages.getMainMessage("actions.warningExport.title")) .withDescription(messages.getMainMessage("actions.warningExport.message")) .show();
Messages messages = AppBeans.get(Messages.NAME); context.getNotifications().create(Notifications.NotificationType.HUMANIZED) .withCaption(messages.getMainMessage("OpenAction.objectIsDeleted")) .show(); return;
.withCaption( messages.formatMainMessage("multiupload.filesizeLimitExceed", e.getFileName(), getFileSizeLimitString()) .show(); }); impl.addFileExtensionNotAllowedListener(e -> { .withCaption(messages.formatMainMessage("upload.fileIncorrectExtension.message", e.getFileName())) .show(); });
.withCaption(messages.formatMainMessage("upload.fileTooBig.message", e.getFileName(), getFileSizeLimitString())) .show(); }); impl.addFileExtensionNotAllowedListener(e -> { .withCaption(messages.formatMainMessage("upload.fileIncorrectExtension.message", e.getFileName())) .show(); });
ui.getNotifications() .create(NotificationType.WARNING) .withCaption(messages.formatMainMessage("tooManyOpenTabs.message", maxTabCount)) .show();
.withCaption(messages.getMainMessage("accessDenied.message")) .show(); return; .withCaption(messages.getMainMessage("actions.BulkEdit.emptySelection")) .show();
Notifications notifications = getScreenContext(target.getFrame()).getNotifications(); notifications.create(NotificationType.ERROR) .withCaption(messages.getMainMessage("accessDenied.message")) .show(); return; Notifications notifications = getScreenContext(target.getFrame()).getNotifications(); notifications.create(NotificationType.ERROR) .withCaption(messages.getMainMessage("actions.BulkEdit.emptySelection")) .show(); return;
.withCaption(messages.getMainMessage("entityLocked.msg")) .withDescription( messages.formatMainMessage("entityLocked.desc", lockInfo.getUser().getLogin(), datatypeFormatter.formatDateTime(lockInfo.getSince()) )) .show();
screenContext.getNotifications() .create(Notifications.NotificationType.WARNING) .withCaption(messages.getMainMessage("actions.Related.FilterNotFound")) .show(); });
.withDescription(messages.getMainMessage("OpenAction.objectIsDeleted")) .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); }
/** * 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(); } }
.withCaption(messages.getMessage(FtsSearchLauncherImpl.class, "noSearchTerm")) .show(); } else { String searchTermPreprocessed = searchTerm.trim().toLowerCase(); .withCaption(messages.getMessage(FtsSearchLauncherImpl.class, "notFound")) .show(); } else { WindowInfo windowInfo = windowConfig.getWindowInfo("ftsSearchResults");
@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; }
@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; }
@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(); } } }
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 NotificationBuilder create(NotificationType type) { return create() .withType(type); }