public RoleDeAllocatePanel(String id, List<UserSpaceRole> userSpaceRoles) {
super(id);
add(new ListView("roleKeys", userSpaceRoles) {
protected void populateItem(ListItem roleKeyItem) {
final UserSpaceRole usr = (UserSpaceRole) roleKeyItem.getModelObject();
roleKeyItem.add(new Label("roleKey", usr.getRoleKey()));
Button deallocate = new Button("deallocate") {
@Override
public void onSubmit() {
// avoid lazy loading problem
UserSpaceRole temp = getJtrac().loadUserSpaceRole(usr.getId());
if(temp == null) {
// very rare chance that this is a user in "guest mode"
return;
}
getJtrac().removeUserSpaceRole(temp);
JtracSession.get().refreshPrincipalIfSameAs(temp.getUser());
// TODO have some nice interface for this
if(getPage() instanceof UserAllocatePage) {
UserAllocatePage page = (UserAllocatePage) getPage();
setResponsePage(new UserAllocatePage(page.getUserId(), page.getPrevious()));
} else if(getPage() instanceof SpaceAllocatePage) {