//
} else if (actionid.equals(COMMAND_SELECTUSER)) {
int rowid = te.getRowId();
Identity identity = identitiesTableModel.getIdentityAt(rowid);
// TODO whats this??
fireEvent(ureq, new SingleIdentityChosenEvent(identity));
}
} else if (event.getCommand().equals(Table.COMMAND_MULTISELECT)) {
// Multiselect events
TableMultiSelectEvent tmse = (TableMultiSelectEvent) event;
if (tmse.getAction().equals(COMMAND_REMOVEUSER)) {
if(tmse.getSelection().isEmpty()){
//empty selection
content.setDirty(true);
showWarning("msg.selectionempty");
return;
}
int size = identitiesTableModel.getObjects().size();
toRemove = identitiesTableModel.getIdentities(tmse.getSelection());
// list is never null, but can be empty
if (keepAtLeastOne && (size == 1 || size - toRemove.size() == 0)) {
//at least one must be kept
//do not delete the last one => ==1
//do not allow to delete all => size - selectedCnt == 0
content.setDirty(true);
showError("msg.atleastone");
} else {
//valid selection to be deleted.
if (removeUserMailDefaultTempl == null) {
doBuildConfirmDeleteDialog(ureq);
} else {
if (addUserMailCtr != null) addUserMailCtr.dispose();
removeUserMailCtr = new MailNotificationEditController(getWindowControl(), ureq, removeUserMailDefaultTempl, true);
this.listenTo(removeUserMailCtr);
cmc = new CloseableModalController(getWindowControl(), translate("close"), removeUserMailCtr.getInitialComponent());
cmc.activate();
}
}
}
}
} else if (sourceController == removeUserMailCtr) {
if (event == Event.DONE_EVENT) {
removeUserMailCustomTempl = removeUserMailCtr.getMailTemplate();
cmc.deactivate();
doBuildConfirmDeleteDialog(ureq);
} else if (event == Event.CANCELLED_EVENT) {
cmc.deactivate();
} else {
throw new RuntimeException("unknown event ::" + event.getCommand());
}
} else if (sourceController == usc) {
if (event == Event.CANCELLED_EVENT) {
cmc.deactivate();
} else {
if (event instanceof SingleIdentityChosenEvent) {
SingleIdentityChosenEvent singleEvent = (SingleIdentityChosenEvent) event;
Identity choosenIdentity = singleEvent.getChosenIdentity();
if (choosenIdentity == null) {
showError("msg.selectionempty");
return;
}
toAdd = new ArrayList<Identity>();