use of org.olat.core.gui.components.table.TableEvent in project openolat by klemens.
the class UserAuthenticationsEditorController method event.
/**
* @see org.olat.core.gui.control.DefaultController#event(org.olat.core.gui.UserRequest, org.olat.core.gui.control.Controller, org.olat.core.gui.control.Event)
*/
@Override
public void event(UserRequest ureq, Controller source, Event event) {
if (source == confirmationDialog) {
if (DialogBoxUIFactory.isYesEvent(event)) {
Authentication auth = (Authentication) confirmationDialog.getUserObject();
securityManager.deleteAuthentication(auth);
getWindowControl().setInfo(getTranslator().translate("authedit.delete.success", new String[] { auth.getProvider(), changeableIdentity.getName() }));
authTableModel.setObjects(securityManager.getAuthentications(changeableIdentity));
tableCtr.modelChanged();
}
} else if (source == tableCtr) {
if (event.getCommand().equals(Table.COMMANDLINK_ROWACTION_CLICKED)) {
TableEvent te = (TableEvent) event;
String actionid = te.getActionId();
if (actionid.equals("delete")) {
int rowid = te.getRowId();
Authentication auth = authTableModel.getObject(rowid);
String fullname = userManager.getUserDisplayName(changeableIdentity);
String msg = translate("authedit.delete.confirm", new String[] { auth.getProvider(), fullname });
confirmationDialog = activateYesNoDialog(ureq, null, msg, confirmationDialog);
confirmationDialog.setUserObject(auth);
}
}
}
}
use of org.olat.core.gui.components.table.TableEvent in project openolat by klemens.
the class UserSearchController method event.
/**
* @see org.olat.core.gui.control.DefaultController#event(org.olat.core.gui.UserRequest,
* org.olat.core.gui.control.Controller, org.olat.core.gui.control.Event)
*/
public void event(UserRequest ureq, Controller source, Event event) {
if (source == tableCtr) {
if (event.getCommand().equals(Table.COMMANDLINK_ROWACTION_CLICKED)) {
TableEvent te = (TableEvent) event;
if (te.getActionId().equals(ACTION_SINGLESELECT_CHOOSE)) {
int rowid = te.getRowId();
Identity foundIdentity = tdm.getObject(rowid);
foundIdentities.add(foundIdentity);
// Tell parentController that a subject has been found
fireEvent(ureq, new SingleIdentityChosenEvent(foundIdentity));
}
} else if (event.getCommand().equals(Table.COMMAND_MULTISELECT)) {
TableMultiSelectEvent tmse = (TableMultiSelectEvent) event;
if (tmse.getAction().equals(ACTION_MULTISELECT_CHOOSE)) {
foundIdentities = tdm.getObjects(tmse.getSelection());
fireEvent(ureq, new MultiIdentityChosenEvent(foundIdentities));
}
}
} else if (source == autocompleterC) {
if (event instanceof EntriesChosenEvent) {
EntriesChosenEvent ece = (EntriesChosenEvent) event;
List<String> res = ece.getEntries();
// if we get the event, we have a result or an incorrect selection see OLAT-5114 -> check for empty
String mySel = res.isEmpty() ? null : (String) res.get(0);
if ((mySel == null) || mySel.trim().equals("")) {
getWindowControl().setWarning(translate("error.search.form.notempty"));
return;
}
// default not found
Long key = -1l;
try {
key = Long.valueOf(mySel);
if (key > 0) {
Identity chosenIdent = BaseSecurityManager.getInstance().loadIdentityByKey(key);
// No need to check for null, exception is thrown when identity does not exist which really
// should not happen at all.
// Tell that an identity has been chosen
fireEvent(ureq, new SingleIdentityChosenEvent(chosenIdent));
}
} catch (NumberFormatException e) {
getWindowControl().setWarning(translate("error.no.user.found"));
return;
}
}
} else if (source == searchform) {
if (event == Event.DONE_EVENT) {
// form validation was ok
doSearch(ureq);
} else if (event == Event.CANCELLED_EVENT) {
fireEvent(ureq, Event.CANCELLED_EVENT);
}
}
}
use of org.olat.core.gui.components.table.TableEvent in project openolat by klemens.
the class GroupOverviewController method event.
/**
* @see org.olat.core.gui.control.DefaultController#event(org.olat.core.gui.UserRequest, org.olat.core.gui.control.Controller, org.olat.core.gui.control.Event)
*/
@Override
protected void event(UserRequest ureq, Controller source, Event event) {
super.event(ureq, source, event);
if (source == groupListCtr) {
if (event.getCommand().equals(Table.COMMANDLINK_ROWACTION_CLICKED)) {
TableEvent te = (TableEvent) event;
GroupOverviewRow item = tableDataModel.getObject(te.getRowId());
BusinessGroup currBusinessGroup = businessGroupService.loadBusinessGroup(item.getKey());
if (currBusinessGroup == null) {
// group seems to be removed meanwhile, reload table and show error
showError("group.removed");
updateModel();
} else if (TABLE_ACTION_LAUNCH.equals(te.getActionId())) {
NewControllerFactory.getInstance().launch("[BusinessGroup:" + currBusinessGroup.getKey() + "]", ureq, getWindowControl());
} else if (TABLE_ACTION_UNSUBSCRIBE.equals(te.getActionId())) {
doLeave(ureq, Collections.singletonList(currBusinessGroup));
}
} else if (event instanceof TableMultiSelectEvent) {
TableMultiSelectEvent mse = (TableMultiSelectEvent) event;
List<GroupOverviewRow> items = tableDataModel.getObjects(mse.getSelection());
if (TABLE_ACTION_UNSUBSCRIBE.equals(mse.getAction())) {
List<BusinessGroup> groups = toBusinessGroups(items);
doLeave(ureq, groups);
}
}
} else if (source == groupsCtrl && event instanceof AddToGroupsEvent) {
AddToGroupsEvent groupsEv = (AddToGroupsEvent) event;
if (groupsEv.isEmpty()) {
// no groups selected
showWarning("group.add.result.none");
} else {
if (cmc != null) {
cmc.deactivate();
}
boolean mailMandatory = groupModule.isMandatoryEnrolmentEmail(ureq.getUserSession().getRoles());
if (mailMandatory) {
doAddToGroups(groupsEv, true);
updateModel();
} else {
confirmSendMailBox = activateYesNoDialog(ureq, null, translate("dialog.modal.bg.send.mail"), confirmSendMailBox);
confirmSendMailBox.setUserObject(groupsEv);
}
}
cleanUpPopups();
} else if (source == confirmSendMailBox) {
boolean sendMail = DialogBoxUIFactory.isYesEvent(event) || DialogBoxUIFactory.isOkEvent(event);
AddToGroupsEvent groupsEv = (AddToGroupsEvent) confirmSendMailBox.getUserObject();
doAddToGroups(groupsEv, sendMail);
updateModel();
} else if (source == removeFromGrpDlg) {
if (event == Event.DONE_EVENT) {
boolean sendMail = removeFromGrpDlg.isSendMail();
List<BusinessGroup> groupsToDelete = removeFromGrpDlg.getGroupsToDelete();
List<BusinessGroup> groupsToLeave = removeFromGrpDlg.getGroupsToLeave();
removeUserFromGroup(ureq, groupsToLeave, groupsToDelete, sendMail);
}
cmc.deactivate();
cleanUpPopups();
} else if (source == cmc) {
cleanUpPopups();
}
}
use of org.olat.core.gui.components.table.TableEvent in project openolat by klemens.
the class OrphanVersionsController method event.
@Override
protected void event(UserRequest ureq, Controller source, Event event) {
if (source == tableCtr) {
if (event.getCommand().equals(Table.COMMANDLINK_ROWACTION_CLICKED)) {
TableEvent te = (TableEvent) event;
String actionid = te.getActionId();
int rowid = te.getRowId();
OrphanVersion orphan = (OrphanVersion) tableCtr.getTableDataModel().getObject(rowid);
if (actionid.equals(CMD_DELETE)) {
VersionsManager.getInstance().delete(orphan);
orphans.remove(orphan);
tableCtr.modelChanged();
}
} else if (event.getCommand().equals(Table.COMMAND_MULTISELECT)) {
// Multiselect events
TableMultiSelectEvent tmse = (TableMultiSelectEvent) event;
BitSet selectedOrphans = tmse.getSelection();
String actionid = tmse.getAction();
if (CMD_DELETE.equals(actionid)) {
List<OrphanVersion> toRemove = new ArrayList<OrphanVersion>();
for (int i = selectedOrphans.nextSetBit(0); i >= 0; i = selectedOrphans.nextSetBit(i + 1)) {
int rowCount = tableCtr.getTableDataModel().getRowCount();
if (i >= 0 && i < rowCount) {
OrphanVersion orphan = (OrphanVersion) tableCtr.getTableDataModel().getObject(i);
VersionsManager.getInstance().delete(orphan);
toRemove.add(orphan);
}
}
for (OrphanVersion orphan : toRemove) {
orphans.remove(orphan);
}
tableCtr.setTableDataModel(new OrphanTableModel(orphans));
tableCtr.modelChanged();
}
}
}
}
use of org.olat.core.gui.components.table.TableEvent in project openolat by klemens.
the class StatusController method event.
/**
* @see org.olat.core.gui.control.DefaultController#event(org.olat.core.gui.UserRequest,
* org.olat.core.gui.control.Controller, org.olat.core.gui.control.Event)
*/
public void event(UserRequest ureq, Controller source, Event event) {
if (source == tableCtr) {
if (event.getCommand().equals(Table.COMMANDLINK_ROWACTION_CLICKED)) {
TableEvent te = (TableEvent) event;
if (te.getActionId().equals(ACTION_SINGLESELECT_CHOOSE)) {
int rowid = te.getRowId();
Identity foundIdentity = tdm.getObject(rowid);
UserDeletionManager.getInstance().setIdentityAsActiv(foundIdentity);
updateUserList();
}
}
}
}
Aggregations