use of org.olat.core.gui.components.table.TableEvent in project OpenOLAT by OpenOLAT.
the class BusinessGroupMainRunController 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 == bgEditCntrllr) {
// changes from the admin controller
if (event == Event.CHANGED_EVENT) {
businessGroup = bgEditCntrllr.getBusinessGroup();
chatAvailable = isChatAvailable();
TreeModel trMdl = buildTreeModel();
bgTree.setTreeModel(trMdl);
bgTree.setSelectedNode(nodeAdmin);
} else if (event == Event.CANCELLED_EVENT) {
// could not get lock on business group, back to inital screen
bgTree.setSelectedNodeId(bgTree.getTreeModel().getRootNode().getIdent());
mainPanel.setContent(main);
}
} else if (source == resourcesCtr) {
if (event.getCommand().equals(Table.COMMANDLINK_ROWACTION_CLICKED)) {
TableEvent te = (TableEvent) event;
String actionid = te.getActionId();
int rowid = te.getRowId();
RepositoryTableModel repoTableModel = (RepositoryTableModel) resourcesCtr.getTableDataModel();
if (RepositoryTableModel.TABLE_ACTION_SELECT_LINK.equals(actionid)) {
RepositoryEntry currentRepoEntry = repoTableModel.getObject(rowid);
OLATResource ores = currentRepoEntry.getOlatResource();
if (ores == null)
throw new AssertException("repoEntry had no olatresource, repoKey = " + currentRepoEntry.getKey());
addLoggingResourceable(LoggingResourceable.wrap(ores, OlatResourceableType.genRepoEntry));
String businessPath = "[RepositoryEntry:" + currentRepoEntry.getKey() + "]";
NewControllerFactory.getInstance().launch(businessPath, ureq, getWindowControl());
}
}
} else if (source == sendToChooserForm) {
if (event == Event.DONE_EVENT) {
removeAsListenerAndDispose(collabToolCtr);
collabToolCtr = createContactFormController(ureq);
listenTo(collabToolCtr);
mainPanel.setContent(collabToolCtr.getInitialComponent());
} else if (event == Event.CANCELLED_EVENT) {
// back to group overview
bgTree.setSelectedNodeId(bgTree.getTreeModel().getRootNode().getIdent());
mainPanel.setContent(main);
}
} else if (source == collabToolCtr) {
if (event == Event.CANCELLED_EVENT || event == Event.DONE_EVENT || event == Event.BACK_EVENT || event == Event.FAILED_EVENT) {
// In all cases (success or failure) we
// go back to the group overview page.
bgTree.setSelectedNodeId(bgTree.getTreeModel().getRootNode().getIdent());
mainPanel.setContent(main);
}
} else if (source == accessController) {
if (event.equals(AccessEvent.ACCESS_OK_EVENT)) {
removeAsListenerAndDispose(accessController);
accessController = null;
// check if on waiting list
List<BusinessGroupMembership> memberships = businessGroupService.getBusinessGroupMembership(Collections.singletonList(businessGroup.getKey()), getIdentity());
if (isOnWaitinglist(memberships)) {
Component cmp = getOnWaitingListMessage(ureq, businessGroup);
mainPanel.setContent(cmp);
} else {
mainPanel.setContent(main);
bgTree.setTreeModel(buildTreeModel());
needActivation = false;
}
} else if (event.equals(AccessEvent.ACCESS_FAILED_EVENT)) {
String msg = ((AccessEvent) event).getMessage();
if (StringHelper.containsNonWhitespace(msg)) {
getWindowControl().setError(msg);
} else {
showError("error.accesscontrol");
}
}
}
}
use of org.olat.core.gui.components.table.TableEvent in project OpenOLAT by OpenOLAT.
the class OpenMeetingsRecordingsController method event.
@Override
protected void event(UserRequest ureq, Controller source, Event event) {
if (source == tableCtr) {
if (event instanceof TableEvent) {
TableEvent e = (TableEvent) event;
int row = e.getRowId();
OpenMeetingsRecording recording = (OpenMeetingsRecording) tableCtr.getTableDataModel().getObject(row);
if ("view".equals(e.getActionId())) {
doView(ureq, recording);
} else if ("delete".equals(e.getActionId())) {
String text = getTranslator().translate("recording.remove", new String[] { recording.getFilename() });
confirmRemoveRecording = activateYesNoDialog(ureq, null, text, confirmRemoveRecording);
confirmRemoveRecording.setUserObject(recording);
}
}
} else if (source == confirmRemoveRecording) {
if (DialogBoxUIFactory.isYesEvent(event)) {
// yes case
OpenMeetingsRecording recording = (OpenMeetingsRecording) confirmRemoveRecording.getUserObject();
doDelete(recording);
}
}
}
use of org.olat.core.gui.components.table.TableEvent in project OpenOLAT by OpenOLAT.
the class RepositoryPortletRunController method event.
/**
* @see org.olat.core.gui.control.ControllerEventListener#dispatchEvent(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) {
super.event(ureq, source, event);
if (source == tableCtr) {
if (event.getCommand().equals(Table.COMMANDLINK_ROWACTION_CLICKED)) {
TableEvent te = (TableEvent) event;
String actionid = te.getActionId();
if (actionid.equals(CMD_LAUNCH)) {
int rowId = te.getRowId();
PortletEntry<RepositoryEntryLight> entry = repoEntryListModel.getObject(rowId);
NewControllerFactory.getInstance().launch("[RepositoryEntry:" + entry.getKey() + "]", ureq, getWindowControl());
}
}
}
}
use of org.olat.core.gui.components.table.TableEvent in project OpenOLAT by OpenOLAT.
the class TaskController 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) {
log.debug("Test Controller.event source" + source + " , event=" + event);
if (source == tableCtr) {
if (event.getCommand().equals(Table.COMMANDLINK_ROWACTION_CLICKED)) {
TableEvent ta = (TableEvent) event;
if (ta.getActionId().equals(TaskController.ACTION_PREVIEW)) {
String previewTask = (String) taskTableModel.getValueAt(ta.getRowId(), 0);
doFileDelivery(ureq, previewTask);
} else if (ta.getActionId().equals(TaskController.ACTION_SELECT)) {
// select a task
assignedTask = (String) taskTableModel.getValueAt(ta.getRowId(), 0);
List<String> availableTasks = compileAvailableTasks();
if (!availableTasks.contains(assignedTask)) {
showWarning("task.chosen");
taskTableModel.setObjects(availableTasks);
tableCtr.modelChanged();
if (availableTasks.size() == 0) {
// no more tasks available
myContent.contextPut(VC_NOMORETASKS, translate("task.nomoretasks"));
}
} else {
setAssignedTask(ureq.getIdentity(), assignedTask);
if (!samplingWithReplacement)
markTaskAsSampled(assignedTask);
if (!isDeselectable()) {
pushTaskToVC();
} else {
// if assignedTask selected, and deselectable, update taskTableModel
List<String> allTasks = compileAvailableTasks();
if (!samplingWithReplacement) {
// if assignable to only one user, this means that the assignedTask is no more in the availableTasks, but show it in taskTableModel
allTasks.add(assignedTask);
}
taskTableModel.setObjects(allTasks);
tableCtr.modelChanged();
}
}
} else if (ta.getActionId().equals(TaskController.ACTION_DESELECT)) {
if (assignedTask != null) {
removeAssignedTask(ureq.getIdentity());
List<String> availableTasks = compileAvailableTasks();
taskTableModel.setObjects(availableTasks);
tableCtr.modelChanged();
}
}
}
}
}
use of org.olat.core.gui.components.table.TableEvent in project openolat by klemens.
the class UsermanagerUserSearchForm 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 == searchform) {
if (event == Event.DONE_EVENT) {
// form validation was ok
identitiesList = findIdentitiesFromSearchForm();
initUserListCtr(ureq, identitiesList, null);
userListVC.put("userlist", tableCtr.getInitialComponent());
userListVC.contextPut("emptyList", (identitiesList.size() == 0 ? Boolean.TRUE : Boolean.FALSE));
panel.setContent(userListVC);
// fxdiff BAKS-7 Resume function
ContextEntry currentEntry = getWindowControl().getBusinessControl().getCurrentContextEntry();
if (currentEntry != null) {
currentEntry.setTransientState(searchform.getStateEntry());
}
addToHistory(ureq, tableCtr);
} else if (event == Event.CANCELLED_EVENT) {
fireEvent(ureq, Event.CANCELLED_EVENT);
}
} else if (source == tableCtr) {
if (event.getCommand().equals(Table.COMMANDLINK_ROWACTION_CLICKED)) {
TableEvent te = (TableEvent) event;
String actionid = te.getActionId();
if (actionid.equals(ExtendedIdentitiesTableDataModel.COMMAND_SELECTUSER)) {
int rowid = te.getRowId();
Identity foundIdentity = tdm.getObject(rowid);
// Tell parentController that a subject has been found
fireEvent(ureq, new SingleIdentityChosenEvent(foundIdentity));
} else if (actionid.equals(ExtendedIdentitiesTableDataModel.COMMAND_VCARD)) {
// get identity and open new visiting card controller in new window
int rowid = te.getRowId();
final Identity identity = tdm.getObject(rowid);
ControllerCreator userInfoMainControllerCreator = new ControllerCreator() {
@Override
public Controller createController(UserRequest lureq, WindowControl lwControl) {
return new UserInfoMainController(lureq, lwControl, identity, true, false);
}
};
// wrap the content controller into a full header layout
ControllerCreator layoutCtrlr = BaseFullWebappPopupLayoutFactory.createAuthMinimalPopupLayout(ureq, userInfoMainControllerCreator);
// open in new browser window
PopupBrowserWindow pbw = getWindowControl().getWindowBackOffice().getWindowManager().createNewPopupBrowserWindowFor(ureq, layoutCtrlr);
pbw.open(ureq);
}
}
if (event instanceof TableMultiSelectEvent) {
// Multiselect events
TableMultiSelectEvent tmse = (TableMultiSelectEvent) event;
if (tmse.getAction().equals(CMD_BULKEDIT)) {
if (tmse.getSelection().isEmpty()) {
// empty selection
showWarning("msg.selectionempty");
return;
}
selectedIdentities = tdm.getIdentities(tmse.getSelection());
// valid selection: load in wizard
Step start = new UserBulkChangeStep00(ureq, selectedIdentities);
// callback executed in case wizard is finished.
StepRunnerCallback finish = new StepRunnerCallback() {
public Step execute(UserRequest ureq1, WindowControl wControl1, StepsRunContext runContext) {
// all information to do now is within the runContext saved
boolean hasChanges = false;
try {
if (runContext.containsKey("validChange") && ((Boolean) runContext.get("validChange")).booleanValue()) {
HashMap<String, String> attributeChangeMap = (HashMap<String, String>) runContext.get("attributeChangeMap");
HashMap<String, String> roleChangeMap = (HashMap<String, String>) runContext.get("roleChangeMap");
List<Long> ownGroups = (List<Long>) runContext.get("ownerGroups");
List<Long> partGroups = (List<Long>) runContext.get("partGroups");
// List<Long> mailGroups = (List<Long>) runContext.get("mailGroups");
if (attributeChangeMap.size() != 0 || roleChangeMap.size() != 0 || ownGroups.size() != 0 || partGroups.size() != 0) {
Identity addingIdentity = ureq1.getIdentity();
ubcMan.changeSelectedIdentities(selectedIdentities, attributeChangeMap, roleChangeMap, notUpdatedIdentities, isAdministrativeUser, ownGroups, partGroups, getTranslator(), addingIdentity);
hasChanges = true;
}
}
} catch (Exception any) {
// return new ErrorStep
}
// signal correct completion and tell if changes were made or not.
return hasChanges ? StepsMainRunController.DONE_MODIFIED : StepsMainRunController.DONE_UNCHANGED;
}
};
removeAsListenerAndDispose(userBulkChangeStepsController);
userBulkChangeStepsController = new StepsMainRunController(ureq, getWindowControl(), start, finish, null, translate("bulkChange.title"), "o_sel_user_bulk_change_wizard");
listenTo(userBulkChangeStepsController);
getWindowControl().pushAsModalDialog(userBulkChangeStepsController.getInitialComponent());
} else if (tmse.getAction().equals(CMD_MAIL)) {
if (tmse.getSelection().isEmpty()) {
// empty selection
showWarning("msg.selectionempty");
return;
}
// create e-mail message
ContactMessage cmsg = new ContactMessage(ureq.getIdentity());
selectedIdentities = tdm.getIdentities(tmse.getSelection());
ContactList contacts = new ContactList(translate("mailto.userlist"));
contacts.addAllIdentites(selectedIdentities);
cmsg.addEmailTo(contacts);
// create contact form controller with ContactMessage
removeAsListenerAndDispose(contactCtr);
contactCtr = new ContactFormController(ureq, getWindowControl(), true, false, false, cmsg);
listenTo(contactCtr);
mailVC.put("mailform", contactCtr.getInitialComponent());
panel.setContent(mailVC);
}
}
} else if (source == contactCtr) {
// in any case go back to list (events: done, failed or cancel)
panel.setContent(userListVC);
} else if (source == userBulkChangeStepsController) {
if (event == Event.CANCELLED_EVENT) {
getWindowControl().pop();
} else if (event == Event.CHANGED_EVENT) {
getWindowControl().pop();
Integer selIdentCount = selectedIdentities.size();
if (notUpdatedIdentities.size() > 0) {
Integer notUpdatedIdentCount = notUpdatedIdentities.size();
Integer sucChanges = selIdentCount - notUpdatedIdentCount;
String changeErrors = "";
for (String err : notUpdatedIdentities) {
changeErrors += err + "<br />";
}
getWindowControl().setError(translate("bulkChange.partialsuccess", new String[] { sucChanges.toString(), selIdentCount.toString(), changeErrors }));
} else {
showInfo("bulkChange.success");
}
// update table model - has changed
reloadDataModel(ureq);
} else if (event == Event.DONE_EVENT) {
showError("bulkChange.failed");
}
}
}
Aggregations