use of org.olat.core.gui.components.table.TableEvent in project openolat by klemens.
the class ScormResultDetailsController method event.
@Override
public void event(UserRequest ureq, Controller source, Event event) {
if (source == summaryTableCtr) {
TableEvent tEvent = (TableEvent) event;
if (tEvent.getActionId().equals("sel")) {
TableGuiConfiguration tableConfig = new TableGuiConfiguration();
tableConfig.setPreferencesOffered(true, "scormAssessmentDetails");
removeAsListenerAndDispose(cmiTableCtr);
cmiTableCtr = new TableController(tableConfig, ureq, getWindowControl(), getTranslator());
listenTo(cmiTableCtr);
cmiTableCtr.addColumnDescriptor(new DefaultColumnDescriptor("cmis.column.header.itemId", 0, null, ureq.getLocale()));
cmiTableCtr.addColumnDescriptor(new DefaultColumnDescriptor("cmis.column.header.translatedKey", 1, null, ureq.getLocale()));
cmiTableCtr.addColumnDescriptor(new DefaultColumnDescriptor("cmis.column.header.key", 2, null, ureq.getLocale()));
cmiTableCtr.addColumnDescriptor(new DefaultColumnDescriptor("cmis.column.header.value", 3, null, ureq.getLocale()));
// <BPS-252> BPS-252_3
int rowId = tEvent.getRowId();
List<CmiData> data = ((SummaryTableDataModelMultiResults) summaryTableCtr.getTableDataModel()).getObject(rowId);
cmiTableCtr.setTableDataModel(new CmiTableDataModel(getTranslator(), data));
// </BPS-252> BPS-252_3
removeAsListenerAndDispose(cmc);
cmc = new CloseableModalController(getWindowControl(), translate("close"), cmiTableCtr.getInitialComponent());
listenTo(cmc);
cmc.activate();
}
} else if (source == resetConfirmationBox) {
if (DialogBoxUIFactory.isOkEvent(event)) {
// delete scorm
String username = assessedUserCourseEnv.getIdentityEnvironment().getIdentity().getName();
CourseEnvironment courseEnv = assessedUserCourseEnv.getCourseEnvironment();
ScormAssessmentManager.getInstance().deleteResults(username, courseEnv, node);
fireEvent(ureq, Event.DONE_EVENT);
}
}
}
use of org.olat.core.gui.components.table.TableEvent in project openolat by klemens.
the class NotesPortletRunController 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)
*/
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();
final NotePortletEntry pe = (NotePortletEntry) notesListModel.getObject(rowid);
final Note note = pe.getValue();
// will not be disposed on course run dispose, popus up as new browserwindow
ControllerCreator ctrlCreator = new ControllerCreator() {
public Controller createController(UserRequest lureq, WindowControl lwControl) {
Controller nc = new NoteController(lureq, lwControl, note);
// use on column layout
LayoutMain3ColsController layoutCtr = new LayoutMain3ColsController(lureq, lwControl, nc);
// dispose content on layout dispose
layoutCtr.addDisposableChildController(nc);
return layoutCtr;
}
};
// wrap the content controller into a full header layout
ControllerCreator layoutCtrlr = BaseFullWebappPopupLayoutFactory.createAuthMinimalPopupLayout(ureq, ctrlCreator);
// open in new browser window
PopupBrowserWindow pbw = getWindowControl().getWindowBackOffice().getWindowManager().createNewPopupBrowserWindowFor(ureq, layoutCtrlr);
pbw.open(ureq);
//
}
}
}
}
use of org.olat.core.gui.components.table.TableEvent in project openolat by klemens.
the class RepositorySearchController 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 urequest, Controller source, Event event) {
if (source == tableCtr) {
// process table actions
if (event instanceof TableEvent) {
TableEvent te = (TableEvent) event;
int rowId = te.getRowId();
if (te.getActionId().equals(RepositoryTableModel.TABLE_ACTION_INFOS)) {
RepositoryEntry entry = (RepositoryEntry) tableCtr.getTableDataModel().getObject(rowId);
int row = tableCtr.getIndexOfSortedObject(entry);
doOpenInfos(urequest, entry, row);
} else if (te.getActionId().equals(RepositoryTableModel.TABLE_ACTION_SELECT_LINK)) {
selectedEntry = (RepositoryEntry) tableCtr.getTableDataModel().getObject(rowId);
fireEvent(urequest, new Event(RepositoryTableModel.TABLE_ACTION_SELECT_LINK));
selectedEntries = null;
}
} else if (event instanceof TableMultiSelectEvent) {
TableMultiSelectEvent mse = (TableMultiSelectEvent) event;
if (!mse.getSelection().isEmpty()) {
selectedEntry = null;
BitSet objectMarkers = mse.getSelection();
selectedEntries = new ArrayList<>(objectMarkers.size());
for (int i = objectMarkers.nextSetBit(0); i >= 0; i = objectMarkers.nextSetBit(i + 1)) {
RepositoryEntry entry = (RepositoryEntry) tableCtr.getTableDataModel().getObject(i);
selectedEntries.add(entry);
}
fireEvent(urequest, new Event(RepositoryTableModel.TABLE_ACTION_SELECT_ENTRIES));
}
} else if (TableController.EVENT_FILTER_SELECTED.equals(event)) {
TypeFilter typeFilter = (TypeFilter) tableCtr.getActiveFilter();
if (searchType == SearchType.byOwner) {
doSearchByOwnerLimitTypeInternal(typeFilter.getOwner(), new String[] { typeFilter.getType() }, false);
} else if (searchType == SearchType.myAsStudent) {
doSearchMyCoursesStudent(urequest, typeFilter.getType(), false);
} else if (searchType == SearchType.myAsTeacher) {
doSearchMyCoursesTeacher(urequest, typeFilter.getType(), false);
} else if (searchType == SearchType.searchForm) {
if (enableSearchforAllInSearchForm != null) {
doSearchAllReferencables(urequest, typeFilter.getType(), false);
} else {
doSearch(urequest, typeFilter.getType(), false);
}
}
} else if (TableController.EVENT_NOFILTER_SELECTED.equals(event)) {
if (searchType == SearchType.byOwner) {
doSearchByOwnerLimitTypeInternal(getIdentity(), new String[] {}, false);
} else if (searchType == SearchType.myAsStudent) {
doSearchMyCoursesStudent(urequest);
} else if (searchType == SearchType.myAsTeacher) {
doSearchMyCoursesTeacher(urequest);
} else if (searchType == SearchType.searchForm) {
if (enableSearchforAllInSearchForm != null) {
doSearchAllReferencables(urequest, null, false);
} else {
doSearch(urequest, null, false);
}
}
}
} else if (event instanceof EntryChangedEvent) {
// remove deleted entry
EntryChangedEvent ecv = (EntryChangedEvent) event;
if (ecv.getChange() == Change.deleted) {
List<RepositoryEntry> newEntries = new ArrayList<RepositoryEntry>();
for (int i = 0; i < repoTableModel.getRowCount(); i++) {
RepositoryEntry foo = repoTableModel.getObject(i);
if (!foo.getKey().equals(ecv.getRepositoryEntryKey())) {
newEntries.add(foo);
}
}
repoTableModel.setObjects(newEntries);
tableCtr.modelChanged();
} else if (ecv.getChange() == Change.added) {
doSearchByOwner(urequest.getIdentity());
}
} else if (source == searchForm) {
// process search form events
if (event == Event.DONE_EVENT) {
if (searchForm.hasId()) {
doSearchById(searchForm.getId(), searchForm.getRestrictedTypes());
} else if (enableSearchforAllInSearchForm != null) {
doSearchAllReferencables(urequest, null, true);
} else {
doSearch(urequest, null, true);
}
} else if (event == Event.CANCELLED_EVENT) {
fireEvent(urequest, Event.CANCELLED_EVENT);
}
} else if (calloutCtrl == source) {
removeAsListenerAndDispose(calloutCtrl);
removeAsListenerAndDispose(infosCtrl);
calloutCtrl = null;
infosCtrl = null;
}
}
use of org.olat.core.gui.components.table.TableEvent in project openolat by klemens.
the class ViteroBookingsAdminController 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();
ViteroBooking booking = (ViteroBooking) tableCtr.getTableDataModel().getObject(row);
if ("delete".equals(e.getActionId())) {
confirmDeleteVitero(ureq, booking);
} else if ("infos".equals(e.getActionId())) {
openInfoBox(ureq, booking);
} else if ("resource".equals(e.getActionId())) {
openResource(ureq, booking);
}
}
} else if (source == dialogCtr) {
if (DialogBoxUIFactory.isOkEvent(event)) {
ViteroBooking booking = (ViteroBooking) dialogCtr.getUserObject();
deleteBooking(booking);
}
} 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 ViteroUserToGroupController 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();
Identity identity = (Identity) tableCtr.getTableDataModel().getObject(row);
if ("signin".equals(e.getActionId())) {
signIn(Collections.singletonList(identity));
} else if ("signout".equals(e.getActionId())) {
signOut(Collections.singletonList(identity));
}
} else if (event instanceof TableMultiSelectEvent) {
TableMultiSelectEvent e = (TableMultiSelectEvent) event;
List<Identity> identities = new ArrayList<Identity>();
for (int i = e.getSelection().nextSetBit(0); i >= 0; i = e.getSelection().nextSetBit(i + 1)) {
Identity identity = (Identity) tableCtr.getTableDataModel().getObject(i);
identities.add(identity);
}
if ("signin".equals(e.getAction())) {
signIn(identities);
} else if ("signout".equals(e.getAction())) {
signOut(identities);
} else if ("reload".equals(e.getAction())) {
loadModel();
}
}
}
super.event(ureq, source, event);
}
Aggregations