} else {
pageList = new FindMembershipByGroupPageList(group.getId(), 5);
}
UIGridUser uiGrid = getChild(UIGridUser.class);
UIPageIterator pageIterator = uiGrid.getUIPageIterator();
/** We keep the currently selected page index **/
int backupPageIndex = pageIterator.getCurrentPage();
pageIterator.setPageList(pageList);
if (group != null) {
String groupId = group.getId();
String currentUser = Util.getPortalRequestContext().getRemoteUser();
// show action if user is administrator or manager of current group
boolean showAction = GroupManagement.isAdministrator(currentUser)
|| GroupManagement.isManagerOfGroup(currentUser, groupId);
if (!showAction) {
pageList.setPageSize(10);
if (getChild(UIGroupMembershipForm.class) != null)
removeChild(UIGroupMembershipForm.class);
uiGrid.configure("id", USER_BEAN_FIELD, null);
} else {
pageList.setPageSize(5);
uiGrid.configure("id", USER_BEAN_FIELD, USER_ACTION);
if (getChild(UIGroupMembershipForm.class) == null)
addChild(UIGroupMembershipForm.class, null, null);
}
} else {
pageList.setPageSize(10);
if (getChild(UIGroupMembershipForm.class) != null)
removeChild(UIGroupMembershipForm.class);
}
/** Reset the selected page index **/
if (backupPageIndex > pageIterator.getAvailablePage()) {
backupPageIndex = pageIterator.getAvailablePage();
}
pageIterator.setCurrentPage(backupPageIndex);
}