@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 actionPerform(Component component) { Set selected = entitiesTable.getSelected(); if (selected.size() != 1) return; Entity item = (Entity) selected.iterator().next(); Window window = openWindow("entityInspector.edit", WINDOW_OPEN_TYPE, ParamsMap.of("item", item)); window.addCloseListener(actionId -> { entitiesDs.refresh(); entitiesTable.focus(); }); } }
@Override public void actionPerform(Component component) { loggedEntityDs.refresh(); disableControls(); loggedEntityTable.setEnabled(true); loggedEntityTable.focus(); } }
public void copySettings() { Set<User> selected = usersTable.getSelected(); if (!selected.isEmpty()) { Window copySettingsWindow = openWindow( "sec$User.copySettings", OpenType.DIALOG, ParamsMap.of("users", selected) ); copySettingsWindow.addCloseListener(actionId -> usersTable.focus() ); } }
@Override public void actionPerform(Component component) { ReportTemplate template = (ReportTemplate) target.getSingleSelected(); if (template != null) { getItem().setDefaultTemplate(template); } refreshState(); templatesTable.focus(); }
public void changePasswordAtLogon() { if (!usersTable.getSelected().isEmpty()) { ResetPasswordsDialog resetPasswordsDialog = (ResetPasswordsDialog) openWindow("sec$User.resetPasswords", OpenType.DIALOG); resetPasswordsDialog.addCloseListener(actionId -> { if (Window.COMMIT_ACTION_ID.equals(actionId)) { boolean sendEmails = resetPasswordsDialog.getSendEmails(); boolean generatePasswords = resetPasswordsDialog.getGeneratePasswords(); Set<User> users = usersTable.getSelected(); resetPasswords(users, sendEmails, generatePasswords); } usersTable.focus(); }); } }
public void message() { Set<UserSessionEntity> selected = sessionsTable.getSelected(); Set<UserSessionEntity> all = new HashSet<>(sessionsDs.getItems()); SessionMessageWindow window = (SessionMessageWindow) openWindow("sessionMessageWindow", OpenType.DIALOG, ParamsMap.of("selectedSessions", selected, "allSessions", all)); window.addCloseListener(actionId -> { String result = window.getResult(); if (!StringUtils.isBlank(result)) { showNotification(result, NotificationType.TRAY); sessionsTable.focus(); } }); }
@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(); }); } }
@Override public void actionPerform(Component component) { Set<CategoryAttribute> selected = categoryAttrsTable.getSelected(); if (!selected.isEmpty()) { AttributeEditor editor = (AttributeEditor) openEditor( "sys$CategoryAttribute.edit", selected.iterator().next(), OpenType.DIALOG, categoryAttrsTable.getDatasource()); editor.addCloseListener(actionId -> { categoryAttrsTable.getDatasource().refresh(); categoryAttrsTable.focus(); // restore selection from ds categoryAttrsTable.setSelected(categoryAttrsDs.getItem()); }); } } }
@Override public void actionPerform(Component component) { if (rolesDs.getItem() == null) return; Window window = openEditor("sec$Role.edit", rolesDs.getItem().getRole(), OpenType.THIS_TAB); window.addCloseListener(actionId -> { if (Window.COMMIT_ACTION_ID.equals(actionId)) { rolesDs.refresh(); } rolesTable.focus(); }); } }
@Override public void actionPerform(Component component) { Window window = openWindow("entityInspector.edit", WINDOW_OPEN_TYPE, ParamsMap.of("metaClass", selectedMeta.getName())); window.addCloseListener(actionId -> { entitiesDs.refresh(); entitiesTable.focus(); }); } }
@Override public void actionPerform(Component component) { if (substitutionsDs.getItem() != null) { Window editor = openEditor(substitutionsDs.getItem(), OpenType.DIALOG, ParamsMap.empty(), substitutionsDs); editor.addCloseListener(actionId -> { substTable.focus(); }); } } }
public void changePassword() { final User selectedUser = usersTable.getSingleSelected(); if (selectedUser != null) { Window changePasswordDialog = openWindow("sec$User.changePassword", OpenType.DIALOG, ParamsMap.of("user", selectedUser)); changePasswordDialog.addCloseListener(actionId -> { if (COMMIT_ACTION_ID.equals(actionId)) { usersDs.updateItem(dataSupplier.reload(selectedUser, usersDs.getView())); } usersTable.focus(); }); } }
@Override public void actionPerform(Component component) { UserSubstitution substitution = metadata.create(UserSubstitution.class); substitution.setUser(userDs.getItem()); Window editor = openEditor(substitution, OpenType.DIALOG, ParamsMap.empty(), substitutionsDs); editor.addCloseListener(actionId -> { substTable.focus(); }); } }
protected void disconnectSession(Set<UserSessionEntity> selected) { for (UserSessionEntity session : selected) { if (!session.getId().equals(userSessionSource.getUserSession().getId())) { uss.killSession(session.getId()); } else { showNotification(getMessage("killUnavailable"), NotificationType.WARNING); } } sessionsTable.getDatasource().refresh(); sessionsTable.focus(); } }
usersDs.refresh(); usersTable.focus(); });
protected void showRestoreDialog() { final Set<Entity> entityList = entitiesTable.getSelected(); Entity entity = entitiesDs.getItem(); if (entityList != null && entity != null && entityList.size() > 0) { if (entity instanceof SoftDelete) { showOptionDialog( getMessage("dialogs.Confirmation"), getMessage("dialogs.Message"), MessageType.CONFIRMATION, new Action[]{ new DialogAction(Type.OK).withHandler(event -> { restoreService.restoreEntities(entityList); entitiesTable.refresh(); entitiesTable.focus(); }), new DialogAction(Type.CANCEL, Status.PRIMARY).withHandler(event -> { entitiesTable.focus(); }) } ); } } else { showNotification(getMessage("entityRestore.restoreMsg")); } }
protected void initTable() { entitiesTable = uiComponents.create(Table.class); entitiesTable.setId("table"); entitiesTable.setDatasource(entitiesDs); entitiesTable.setSizeFull(); Boolean multiSelect = WindowParams.MULTI_SELECT.get(getContext()); entitiesTable.setMultiSelect(multiSelect != null ? multiSelect : true); RowsCount rowsCount = uiComponents.create(RowsCount.class); rowsCount.setRowsCountTarget(entitiesTable); entitiesTable.setRowsCount(rowsCount); entitiesTable.focus(); }
@Override public void actionPerform(Component component) { LoggedEntity selectedEntity = loggedEntityTable.getSelected().iterator().next(); Set<LoggedAttribute> enabledAttributes = selectedEntity.getAttributes(); for (Component c : attributesBoxScroll.getComponents()) { CheckBox currentCheckBox = (CheckBox) c; if (currentCheckBox.getId().equals(SELECT_ALL_CHECK_BOX)) continue; Boolean currentCheckBoxValue = currentCheckBox.getValue(); if (currentCheckBoxValue && !isEntityHaveAttribute(currentCheckBox.getId(), enabledAttributes)) { //add attribute if checked and not exist in table LoggedAttribute newLoggedAttribute = metadata.create(LoggedAttribute.class); newLoggedAttribute.setName(currentCheckBox.getId()); newLoggedAttribute.setEntity(selectedEntity); loggedAttrDs.addItem(newLoggedAttribute); } if (!currentCheckBoxValue && isEntityHaveAttribute(currentCheckBox.getId(), enabledAttributes)) { //remove attribute if unchecked and exist in table LoggedAttribute removeAtr = getLoggedAttribute(currentCheckBox.getId(), enabledAttributes); if (removeAtr != null) loggedAttrDs.removeItem(removeAtr); } } getDsContext().commit(); loggedEntityDs.refresh(); disableControls(); loggedEntityTable.setEnabled(true); loggedEntityTable.focus(); logService.invalidateCache(); } }
@Override public void actionPerform(Component component) { final CategoryAttribute attribute = metadata.create(CategoryAttribute.class); attribute.setCategory((Category) categoryDs.getItem()); assignNextOrderNo(attribute); AttributeEditor editor = (AttributeEditor) openEditor( "sys$CategoryAttribute.edit", attribute, OpenType.DIALOG, categoryAttrsTable.getDatasource()); editor.addCloseListener(actionId -> { categoryAttrsTable.getDatasource().refresh(); categoryAttrsTable.focus(); // restore selection from ds categoryAttrsTable.setSelected(categoryAttrsDs.getItem()); }); } }