use of org.olat.core.gui.components.table.TableEvent in project OpenOLAT by OpenOLAT.
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 OpenOLAT.
the class OrderDetailController 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();
OrderItemWrapper wrapper = (OrderItemWrapper) tableCtr.getTableDataModel().getObject(rowid);
if (CMD_SELECT.equals(actionid)) {
popupTransactionDetails(ureq, wrapper);
}
}
} else if (source == detailsCtlr) {
cmc.deactivate();
removeAsListenerAndDispose(detailsCtlr);
removeAsListenerAndDispose(cmc);
detailsCtlr = null;
cmc = null;
}
}
use of org.olat.core.gui.components.table.TableEvent in project OpenOLAT by OpenOLAT.
the class PropTableDataModel 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;
String actionid = te.getActionId();
if (actionid.equals("choose")) {
int rowid = te.getRowId();
foundProp = tdm.getObject(rowid);
// Tell parentController that a subject has been found
fireEvent(ureq, new PropFoundEvent(foundProp));
} else // fxdiff FXOLAT-149
if (actionid.equals("delete")) {
int rowid = te.getRowId();
foundProp = tdm.getObject(rowid);
String fullName = CoreSpringFactory.getImpl(UserManager.class).getUserDisplayName(displayedIdentity);
activateYesNoDialog(ureq, translate("propdelete.yesno.title"), translate("propdelete.yesno.text", new String[] { foundProp.getName(), fullName }), null);
}
}
} else // fxdiff FXOLAT-149
if (DialogBoxUIFactory.isYesEvent(event) && foundProp != null) {
PropertyManager.getInstance().deleteProperty(foundProp);
tdm.getObjects().remove(foundProp);
tableCtr.modelChanged();
foundProp = null;
}
}
use of org.olat.core.gui.components.table.TableEvent in project OpenOLAT by OpenOLAT.
the class UsrPropContextCfgTableController method event.
@Override
protected void event(UserRequest ureq, Controller source, Event event) {
if (source.equals(contextTableCtr)) {
TableEvent tblEvent = (TableEvent) event;
Entry<String, UserPropertyUsageContext> contextRow = contTblModel.getObject(tblEvent.getRowId());
removeAsListenerAndDispose(editBox);
removeAsListenerAndDispose(contextEditCtr);
contextEditCtr = new UsrPropContextEditController(ureq, getWindowControl(), contextRow.getValue(), contextRow.getKey());
editBox = new CloseableModalController(getWindowControl(), translate("close"), contextEditCtr.getInitialComponent(), true, translate("upc.context.edit") + " :: " + contextRow.getKey(), true);
listenTo(editBox);
editBox.activate();
} else if (source.equals(contextEditCtr)) {
// nothing to do
} else if (source.equals(editBox)) {
if (event.equals(CloseableModalController.CLOSE_MODAL_EVENT)) {
// edit-popup was closed, refresh our table
refreshView();
}
}
}
use of org.olat.core.gui.components.table.TableEvent in project OpenOLAT by OpenOLAT.
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();
}
}
Aggregations