setValues(getSelectedGroup());
}
public void setValues(Group group) throws Exception
{
PageList pageList = null;
if (group == null)
{
pageList = EmptySerializablePageList.get();
}
else
{
OrganizationService service = getApplicationComponent(OrganizationService.class);
MembershipHandler handler = service.getMembershipHandler();
List<?> memberships = (List<?>)handler.findMembershipsByGroup(group);
pageList = new FindMembershipByGroupPageList(group.getId(), 10);
}
UIGridUser uiGrid = getChild(UIGridUser.class);
pageList.setPageSize(5);
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 **/