membersHeader.addComponent(addButton);
membersHeader.setComponentAlignment(addButton, Alignment.MIDDLE_RIGHT);
addButton.addListener(new ClickListener() {
public void buttonClick(ClickEvent event) {
final SelectUsersPopupWindow selectUsersPopup = new SelectUsersPopupWindow(
i18nManager.getMessage(Messages.GROUP_SELECT_MEMBERS, group.getId()),
true, false, getCurrentMembers());
ExplorerApp.get().getViewManager().showPopupWindow(selectUsersPopup);
// Listen to submit events (that contain the selected users)
selectUsersPopup.addListener(new SubmitEventListener() {
protected void submitted(SubmitEvent event) {
Collection<String> userIds = selectUsersPopup.getSelectedUserIds();
if (!userIds.isEmpty()) {
for (String userId : userIds) {
identityService.createMembership(userId, group.getId());
}
notifyMembershipChanged();