use of io.imunity.furms.api.invitations.InviteeService in project furms by unity-idm.
the class InvitationsView method createMainContextMenu.
private Component createMainContextMenu(InviteeService inviteeService, Map<InvitationId, Checkbox> checkboxes) {
GridActionMenu contextMenu = new GridActionMenu();
contextMenu.addItem(new MenuButton(getTranslation("view.user-settings.invitations.main.context-menu.confirm"), CHECK_CIRCLE), event -> {
try {
checkboxes.entrySet().stream().filter(x -> x.getValue().getValue()).forEach(x -> inviteeService.acceptBy(x.getKey()));
} catch (InvitationNotExistingException e) {
showErrorNotification(getTranslation("invitation.already.removed"));
} catch (Exception e) {
LOG.warn("Could not accept Invitations. ", e);
showErrorNotification(getTranslation("base.error.message"));
}
loadGrid();
});
contextMenu.addItem(new MenuButton(getTranslation("view.user-settings.invitations.main.context-menu.reject"), CLOSE_CIRCLE), event -> {
if (checkboxes.entrySet().stream().anyMatch(x -> x.getValue().getValue()))
createMainConfirmDialog(checkboxes).open();
});
return contextMenu.getTarget();
}
Aggregations