use of com.vaadin.flow.component.icon.VaadinIcon.TRASH in project furms by unity-idm.
the class GroupMembersView method fillPage.
private void fillPage(String communityId, GenericGroupId groupId, String groupName) {
getContent().removeAll();
ViewHeaderLayout viewHeaderLayout = new ViewHeaderLayout(groupName + " " + getTranslation("view.community-admin.groups.members.half.header"));
Supplier<List<FURMSUser>> fetchCurrentUsersAction = () -> genericGroupService.findAll(communityId, groupId).stream().map(x -> x.furmsUser).collect(Collectors.toList());
AddGroupComponent addGroupComponent = new AddGroupComponent(() -> communityService.findAllUsers(communityId).stream().filter(user -> user.fenixUserId.isPresent()).collect(Collectors.toList()), fetchCurrentUsersAction);
addGroupComponent.addAddingAction(event -> doAddAction(addGroupComponent, groupId));
UserContextMenuFactory userContextMenuFactory = UserContextMenuFactory.builder().addCustomContextMenuItem(UserGroupGridItem -> new MenuButton(getTranslation("view.community-admin.groups.members.menu.delete"), TRASH), (UserGroupGridItem userGridItem) -> {
genericGroupService.deleteMembership(communityId, groupId, userGridItem.getFenixUserId().get());
addGroupComponent.reload();
grid.reloadGrid();
showSuccessNotification(getTranslation("group.membership.successful.removed"));
}).build();
UserGrid.Builder userGrid = UserGrid.builder().withFullNameColumn().withEmailColumn().withCustomColumn((UserGroupGridItem x) -> x.getMemberSince().format(dateTimeFormatter), getTranslation("view.community-admin.groups.members.member.since")).withContextMenuColumn(userContextMenuFactory);
grid = UsersGridComponent.init(() -> genericGroupService.findAll(communityId, groupId).stream().map(groupAssignmentWithUser -> new UserGroupGridItem(groupAssignmentWithUser.furmsUser, convertToZoneTime(groupAssignmentWithUser.membership.utcMemberSince, browserZoneId))).collect(Collectors.toList()), userGrid);
getContent().add(viewHeaderLayout, addGroupComponent, grid);
}
Aggregations