@Override public void init(Map<String, Object> params) { super.init(params); }
@Override public void actionPerform(Component component) { Set<Category> selected = categoryTable.getSelected(); if (!selected.isEmpty()) { Category category = selected.iterator().next(); Editor editor = openEditor("sys$Category.edit", category, OpenType.THIS_TAB); ((AbstractWindow) editor).addCloseListener(actionId -> { categoriesDs.refresh(); categoryTable.focus(); }); } } }
@Override public void applySettings(Settings settings) { super.applySettings(settings); String visible = settings.get(hintBox.getId()).attributeValue("visible"); if (visible != null) hintBox.setVisible(Boolean.parseBoolean(visible)); } }
protected boolean handleValidationErrors(ValidationErrors errors) { postValidate(errors); if (errors.isEmpty()) return true; ScreenValidation screenValidation = getBeanLocator().get(ScreenValidation.class); screenValidation.showValidationErrors(this, errors); return false; }
@Override public void init(Map<String, Object> params) { lookupFrame = openWindow(lookupWindowId, WindowManager.OpenType.DIALOG, widgetRepository.getWidgetParams(widget)); for (ListComponent c : findListComponents(lookupFrame)) { c.getDatasource().addItemChangeListener(e -> events.publish(new ItemsSelectedEvent(widget, c.getSelected()))); } lookupFrame.close(Window.CLOSE_ACTION_ID, true); lookupFrame.setSizeFull(); scroll.add(lookupFrame.getFrame()); }
@Override protected boolean preClose(String actionId) { if (!taskHandler.cancel()) { return false; } return super.preClose(actionId); } }
((StandardCloseAction) closeAction).getActionId() : UNKNOWN_CLOSE_ACTION_ID; boolean close = preClose(actionId); if (closeAction instanceof ChangeTrackerCloseAction && ((ChangeTrackerCloseAction) closeAction).isCheckForUnsavedChanges() && hasUnsavedChanges()) { Configuration configuration = getBeanLocator().get(Configuration.NAME); ClientConfig clientConfig = configuration.getConfig(ClientConfig.class); ScreenValidation screenValidation = getBeanLocator().get(ScreenValidation.NAME); .onDiscard(() -> result.resolveWith(closeWithDiscard())) .onCancel(result::fail); } else { screenValidation.showUnsavedChangesDialog(this, closeAction) .onDiscard(() -> result.resolveWith(closeWithDiscard())) .onCancel(result::fail);
@Order(Events.HIGHEST_PLATFORM_PRECEDENCE + 10) @Subscribe protected void afterShow(AfterShowEvent event) { ready(); }
@Override public boolean hasUnsavedChanges() { if (this instanceof Committable) { return ((Committable) this).isModified(); } return getDsContext() != null && getDsContext().isModified(); }
@Override protected void postValidate(ValidationErrors errors) { super.postValidate(errors); if (fileUpload.getFileId() == null) { errors.add(getMessage("reportException.noFile")); return; } String extension = FilenameUtils.getExtension(fileUpload.getFileName()); if (!StringUtils.equalsIgnoreCase(extension, ExportFormat.ZIP.getFileExt())) { errors.add(formatMessage("reportException.wrongFileType", extension)); } } }
/** * Ignores the unsaved changes and closes the screen with {@link #WINDOW_DISCARD_AND_CLOSE_ACTION} action. * * @return result of close request */ public OperationResult closeWithDiscard() { return close(WINDOW_DISCARD_AND_CLOSE_ACTION); }
protected int getScreenHashCode(Screen screen) { ScreenContext screenContext = UiControllerUtils.getScreenContext(screen); WindowInfo windowInfo = screenContext.getWindowInfo(); Map<String, Object> params = getFrame().getContext().getParams(); return windowInfo.hashCode() + (params != null ? params.hashCode() : 0); }
@Override protected boolean preClose(String actionId) { connectionTaskWrapper.cancel(); return super.preClose(actionId); }
@Override public void ready() { super.ready(); inputParametersFrame.initTemplateAndOutputSelect(); }
@Override public void refresh(DashboardEvent dashboardEvent) { lookupFrame.getDsContext().refresh(); }
@Override protected void postValidate(ValidationErrors errors) { super.postValidate(errors); String password = passwField.getValue(); if (errors.isEmpty()) { String currentPassword = currentPasswordField.getValue(); String passwordConfirmation = confirmPasswField.getValue(); UUID targetUserId; if (user == null) { targetUserId = userSession.getUser().getId(); } else { targetUserId = user.getId(); } if (currentPasswordRequired && !userManagementService.checkPassword(targetUserId, currentPassword)) { errors.add(currentPasswordField, getMessage("wrongCurrentPassword")); } else if (userManagementService.checkPassword(targetUserId, password)) { errors.add(passwField, getMessage("currentPasswordWarning")); } else if (!Objects.equals(password, passwordConfirmation)) { errors.add(confirmPasswField, getMessage("passwordsDoNotMatch")); } else { if (clientConfig.getPasswordPolicyEnabled()) { String regExp = clientConfig.getPasswordPolicyRegExp(); if (!password.matches(regExp)) { errors.add(passwField, getMessage("simplePassword")); } } } } }
@Override public void init(Map<String, Object> params) { super.init(params); configDir = Paths.get(configuration.getConfig(GlobalConfig.class).getConfDir()).getParent(); }
@Override protected boolean preClose(String actionId) { if (actionId.equals(CLOSE_ACTION_ID)) { cancelChanges(); return false; } return super.preClose(actionId); }
@Override public void ready() { super.ready(); setFocus(); }
@Override public void actionPerform(Component component) { Category category = metadata.create(Category.class); Editor editor = openEditor("sys$Category.edit", category, OpenType.THIS_TAB); ((AbstractWindow) editor).addCloseListener(actionId -> { categoriesDs.refresh(); categoryTable.focus(); }); } }