use of org.olat.core.gui.components.table.TableEvent in project openolat by klemens.
the class BusinessGroupEditResourceController 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 == repoSearchCtr) {
if (event == ReferencableEntriesSearchController.EVENT_REPOSITORY_ENTRY_SELECTED) {
// repository search controller done
RepositoryEntry re = repoSearchCtr.getSelectedEntry();
removeAsListenerAndDispose(repoSearchCtr);
cmc.deactivate();
if (re != null) {
doAddRepositoryEntry(Collections.singletonList(re));
fireEvent(ureq, Event.CHANGED_EVENT);
}
} else if (event == ReferencableEntriesSearchController.EVENT_REPOSITORY_ENTRIES_SELECTED) {
// repository search controller done
List<RepositoryEntry> res = repoSearchCtr.getSelectedEntries();
removeAsListenerAndDispose(repoSearchCtr);
cmc.deactivate();
if (res != null && !res.isEmpty()) {
doAddRepositoryEntry(res);
fireEvent(ureq, Event.CHANGED_EVENT);
}
}
} else if (source == resourcesCtr) {
if (event.getCommand().equals(Table.COMMANDLINK_ROWACTION_CLICKED)) {
TableEvent te = (TableEvent) event;
String actionid = te.getActionId();
RepositoryEntry re = repoTableModel.getObject(te.getRowId());
if (actionid.equals(RepositoryTableModel.TABLE_ACTION_REMOVE_LINK)) {
// present dialog box if resource should be removed
String text = getTranslator().translate("resource.remove", new String[] { group.getName(), re.getDisplayname() });
confirmRemoveResource = activateYesNoDialog(ureq, null, text, this.confirmRemoveResource);
confirmRemoveResource.setUserObject(re);
} else if (RepositoryTableModel.TABLE_ACTION_INFOS.equals(actionid)) {
int row = resourcesCtr.getIndexOfSortedObject(re);
doOpenInfos(ureq, re, row);
}
}
} else if (source == confirmRemoveResource) {
if (DialogBoxUIFactory.isYesEvent(event)) {
// yes case
RepositoryEntry re = (RepositoryEntry) confirmRemoveResource.getUserObject();
doRemoveResource(re);
fireEvent(ureq, Event.CHANGED_EVENT);
}
}
}
use of org.olat.core.gui.components.table.TableEvent in project openolat by klemens.
the class OpenMeetingsAdminRoomsController 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();
OpenMeetingsRoom room = (OpenMeetingsRoom) tableCtr.getTableDataModel().getObject(row);
if ("delete".equals(e.getActionId())) {
confirmDelete(ureq, room);
} else if ("infos".equals(e.getActionId())) {
openInfoBox(ureq, room);
} else if ("resource".equals(e.getActionId())) {
openResource(ureq, room);
}
}
} else if (source == dialogCtr) {
if (DialogBoxUIFactory.isOkEvent(event)) {
OpenMeetingsRoom room = (OpenMeetingsRoom) dialogCtr.getUserObject();
doDelete(room);
}
} else if (source == cmc) {
removeAsListenerAndDispose(infoController);
removeAsListenerAndDispose(cmc);
} else if (source == infoController) {
cmc.deactivate();
removeAsListenerAndDispose(infoController);
removeAsListenerAndDispose(cmc);
reloadModel();
}
}
use of org.olat.core.gui.components.table.TableEvent in project openolat by klemens.
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 klemens.
the class RevisionListController method event.
@Override
protected void event(UserRequest ureq, Controller source, Event event) {
if (source == revisionListTableCtr) {
if (event instanceof TableEvent) {
TableEvent tEvent = (TableEvent) event;
int row = tEvent.getRowId();
if (CMD_DOWNLOAD.equals(tEvent.getActionId())) {
MediaResource resource;
if (row < versionedFile.getVersions().getRevisions().size()) {
// restore current, do nothing
VFSRevision version = versionedFile.getVersions().getRevisions().get(row);
resource = new VFSRevisionMediaResource(version, true);
} else {
resource = new VFSMediaResource((VFSLeaf) versionedFile);
((VFSMediaResource) resource).setDownloadable(true);
}
ureq.getDispatchResult().setResultingMediaResource(resource);
} else if (CMD_RESTORE.equals(tEvent.getActionId())) {
if (row >= versionedFile.getVersions().getRevisions().size()) {
// restore current, do nothing
status = FolderCommandStatus.STATUS_SUCCESS;
fireEvent(ureq, FolderCommand.FOLDERCOMMAND_FINISHED);
} else {
VFSRevision version = versionedFile.getVersions().getRevisions().get(row);
String comment = translate("version.restore.comment", new String[] { version.getRevisionNr() });
if (versionedFile.getVersions().restore(ureq.getIdentity(), version, comment)) {
status = FolderCommandStatus.STATUS_SUCCESS;
fireEvent(ureq, FolderCommand.FOLDERCOMMAND_FINISHED);
} else {
status = FolderCommandStatus.STATUS_FAILED;
showError("version.restore.failed");
fireEvent(ureq, FolderCommand.FOLDERCOMMAND_FINISHED);
}
}
}
} else if (event instanceof TableMultiSelectEvent) {
TableMultiSelectEvent tEvent = (TableMultiSelectEvent) event;
if (CMD_CANCEL.equals(tEvent.getAction())) {
status = FolderCommandStatus.STATUS_CANCELED;
fireEvent(ureq, FolderCommand.FOLDERCOMMAND_FINISHED);
} else {
List<VFSRevision> selectedVersions = getSelectedRevisions(tEvent.getSelection());
if (!selectedVersions.isEmpty()) {
if (CMD_DELETE.equals(tEvent.getAction())) {
String numOfVersionToDelete = Integer.toString(selectedVersions.size());
confirmDeleteBoxCtr = activateYesNoDialog(ureq, null, translate("version.confirmDelete", new String[] { numOfVersionToDelete }), confirmDeleteBoxCtr);
confirmDeleteBoxCtr.setUserObject(selectedVersions);
}
}
}
}
} else if (source == confirmDeleteBoxCtr) {
if (DialogBoxUIFactory.isYesEvent(event)) {
@SuppressWarnings("unchecked") List<VFSRevision> selectedVersions = (List<VFSRevision>) confirmDeleteBoxCtr.getUserObject();
versionedFile.getVersions().delete(ureq.getIdentity(), selectedVersions);
status = FolderCommandStatus.STATUS_SUCCESS;
} else {
status = FolderCommandStatus.STATUS_CANCELED;
}
fireEvent(ureq, FolderCommand.FOLDERCOMMAND_FINISHED);
}
}
use of org.olat.core.gui.components.table.TableEvent in project openolat by klemens.
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();
}
}
}
}
}
Aggregations