// set access users
{
// Full access users
final FieldsetPanel fs = gridBuilder
.newFieldset(getString("plugins.teamcal.fullAccess"), getString("plugins.teamcal.access.users"));
final UsersProvider usersProvider = new UsersProvider();
final Collection<PFUserDO> fullAccessUsers = new UsersProvider().getSortedUsers(getData().getFullAccessUserIds());
fullAccessUsersListHelper = new MultiChoiceListHelper<PFUserDO>().setComparator(new UsersComparator()).setFullList(
usersProvider.getSortedUsers());
if (fullAccessUsers != null) {
for (final PFUserDO user : fullAccessUsers) {
fullAccessUsersListHelper.addOriginalAssignedItem(user).assignItem(user);
}
}
final Select2MultiChoice<PFUserDO> users = new Select2MultiChoice<PFUserDO>(fs.getSelect2MultiChoiceId(),
new PropertyModel<Collection<PFUserDO>>(this.fullAccessUsersListHelper, "assignedItems"), usersProvider);
fs.add(users);
}
{
// Read-only access users
final FieldsetPanel fs = gridBuilder.newFieldset(getString("plugins.teamcal.readonlyAccess"),
getString("plugins.teamcal.access.users"));
final UsersProvider usersProvider = new UsersProvider();
final Collection<PFUserDO> readOnlyAccessUsers = new UsersProvider().getSortedUsers(getData().getReadonlyAccessUserIds());
readonlyAccessUsersListHelper = new MultiChoiceListHelper<PFUserDO>().setComparator(new UsersComparator()).setFullList(
usersProvider.getSortedUsers());
if (readOnlyAccessUsers != null) {
for (final PFUserDO user : readOnlyAccessUsers) {
readonlyAccessUsersListHelper.addOriginalAssignedItem(user).assignItem(user);
}
}
final Select2MultiChoice<PFUserDO> users = new Select2MultiChoice<PFUserDO>(fs.getSelect2MultiChoiceId(),
new PropertyModel<Collection<PFUserDO>>(this.readonlyAccessUsersListHelper, "assignedItems"), usersProvider);
fs.add(users);
}
{
// Minimal access users
final FieldsetPanel fs = gridBuilder.newFieldset(getString("plugins.teamcal.minimalAccess"),
getString("plugins.teamcal.access.users"));
final UsersProvider usersProvider = new UsersProvider();
final Collection<PFUserDO> minimalAccessUsers = new UsersProvider().getSortedUsers(getData().getMinimalAccessUserIds());
minimalAccessUsersListHelper = new MultiChoiceListHelper<PFUserDO>().setComparator(new UsersComparator()).setFullList(
usersProvider.getSortedUsers());
if (minimalAccessUsers != null) {
for (final PFUserDO user : minimalAccessUsers) {
minimalAccessUsersListHelper.addOriginalAssignedItem(user).assignItem(user);
}
}