use of org.olat.core.gui.components.table.TableMultiSelectEvent in project openolat by klemens.
the class GroupChoiceForm method event.
@Override
protected void event(UserRequest ureq, Controller source, Event event) {
if (source == manageChecklistTable) {
if (event.getCommand().equals(Table.COMMANDLINK_ROWACTION_CLICKED)) {
TableEvent tableEvent = (TableEvent) event;
Long identityKey = manageTableData.getParticipantKeyAt(tableEvent.getRowId());
selectedIdentity = securityManager.loadIdentityByKey(identityKey, false);
if (tableEvent.getActionId().equals(EDIT_ACTION)) {
initEditTable(ureq, selectedIdentity);
VelocityContainer vcManageUser = createVelocityContainer("manageUser");
vcManageUser.put("table", editChecklistTable.getInitialComponent());
String name = selectedIdentity.getUser().getProperty(UserConstants.FIRSTNAME, getLocale()) + " " + selectedIdentity.getUser().getProperty(UserConstants.LASTNAME, getLocale());
visitingCardButton = LinkFactory.createLink("cl.manage.user.visitingcard", vcManageUser, this);
visitingCardButton.setCustomDisplayText(name);
removeAsListenerAndDispose(cmc);
cmc = new CloseableModalController(getWindowControl(), translate("cl.close"), vcManageUser, true, translate("cl.edit.title"));
listenTo(cmc);
cmc.activate();
} else if (tableEvent.getActionId().equals(DETAILS_ACTION)) {
openVisitingCard(ureq);
}
}
} else if (source == editChecklistTable) {
if (event instanceof TableMultiSelectEvent) {
TableMultiSelectEvent tmse = (TableMultiSelectEvent) event;
if (tmse.getAction().equals("save")) {
BitSet selection = tmse.getSelection();
updateCheckpointsFor(selectedIdentity, selection);
initManageTable(ureq);
}
cmc.deactivate();
}
} else if (source == groupForm) {
if (event == Event.CHANGED_EVENT) {
initManageTable(ureq);
} else if (event.getCommand().equals(GroupChoiceForm.EXPORT_TABLE)) {
downloadResults(ureq);
}
}
}
use of org.olat.core.gui.components.table.TableMultiSelectEvent 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.TableMultiSelectEvent in project OpenOLAT by OpenOLAT.
the class ViteroAdminBookingMembersController 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();
ViteroUser identity = (ViteroUser) tableCtr.getTableDataModel().getObject(row);
if ("signout".equals(e.getActionId())) {
signOut(Collections.singletonList(identity));
}
} else if (event instanceof TableMultiSelectEvent) {
TableMultiSelectEvent e = (TableMultiSelectEvent) event;
List<ViteroUser> identities = new ArrayList<ViteroUser>();
for (int i = e.getSelection().nextSetBit(0); i >= 0; i = e.getSelection().nextSetBit(i + 1)) {
ViteroUser identity = (ViteroUser) tableCtr.getTableDataModel().getObject(i);
identities.add(identity);
}
if ("signout".equals(e.getAction())) {
signOut(identities);
}
}
}
super.event(ureq, source, event);
}
use of org.olat.core.gui.components.table.TableMultiSelectEvent in project OpenOLAT by OpenOLAT.
the class EPMultipleArtefactsAsTableController method event.
@Override
protected void event(UserRequest ureq, Controller source, Event event) {
if (source == artefactListTblCtrl) {
if (event instanceof TableEvent) {
TableEvent te = (TableEvent) event;
AbstractArtefact artefact = (AbstractArtefact) artefactListTblCtrl.getTableDataModel().getObject(te.getRowId());
String action = te.getActionId();
if (CMD_TITLE.equals(action)) {
popupArtefact(artefact, ureq);
} else if (CMD_REFLEXION.equals(action)) {
EPReflexionWrapperController reflexionCtrl = new EPReflexionWrapperController(ureq, getWindowControl(), secCallback, artefact, struct);
listenTo(reflexionCtrl);
} else if (CMD_CHOOSE.equals(action)) {
fireEvent(ureq, new EPArtefactChoosenEvent(artefact));
} else if (CMD_UNLINK.equals(action)) {
struct = ePFMgr.reloadPortfolioStructure(struct);
ePFMgr.removeArtefactFromStructure(artefact, struct);
artefactListTblCtrl.modelChanged();
fireEvent(ureq, new EPStructureChangeEvent(EPStructureChangeEvent.ADDED, struct));
} else if (CMD_MOVE.equals(action)) {
showMoveTree(ureq, artefact);
} else if (CMD_DELETEARTEFACT.equals(action)) {
String text = translate("delete.artefact.text", StringHelper.escapeHtml(artefact.getTitle()));
deleteDialogController = activateYesNoDialog(ureq, translate("delete.artefact"), text, deleteDialogController);
deleteDialogController.setUserObject(artefact);
}
} else if (event instanceof TableMultiSelectEvent) {
TableMultiSelectEvent tmse = (TableMultiSelectEvent) event;
BitSet objectMarkers = tmse.getSelection();
List<AbstractArtefact> selectedArtefacts = new ArrayList<>(objectMarkers.size());
for (int i = objectMarkers.nextSetBit(0); i >= 0; i = objectMarkers.nextSetBit(i + 1)) {
AbstractArtefact entry = (AbstractArtefact) artefactListTblCtrl.getTableDataModel().getObject(i);
selectedArtefacts.add(entry);
}
fireEvent(ureq, new EPArtefactListChoosenEvent(selectedArtefacts));
}
} else if (source == moveTreeCtrl && event.getCommand().equals(EPStructureChangeEvent.CHANGED)) {
EPStructureChangeEvent epsEv = (EPStructureChangeEvent) event;
PortfolioStructure newStruct = epsEv.getPortfolioStructure();
showInfo("artefact.moved", newStruct.getTitle());
fireEvent(ureq, event);
moveTreeBox.deactivate();
} else if (source == deleteDialogController) {
if (DialogBoxUIFactory.isYesEvent(event)) {
AbstractArtefact artefact2delete = (AbstractArtefact) deleteDialogController.getUserObject();
ePFMgr.deleteArtefact(artefact2delete);
ArtefactTableDataModel model = (ArtefactTableDataModel) artefactListTblCtrl.getTableDataModel();
model.getObjects().remove(artefact2delete);
artefactListTblCtrl.modelChanged();
fireEvent(ureq, new EPStructureChangeEvent(EPStructureChangeEvent.REMOVED, struct));
}
removeAsListenerAndDispose(deleteDialogController);
deleteDialogController = null;
}
super.event(ureq, source, event);
}
use of org.olat.core.gui.components.table.TableMultiSelectEvent in project OpenOLAT by OpenOLAT.
the class BGUserManagementController method event.
@Override
protected void event(UserRequest ureq, Controller source, Event event) {
if (source == cmc) {
cleanupPopup();
} else if (source == addCtrl) {
List<Identity> identitiesToAdd = extractIdentities(event);
BGMembership type = (BGMembership) addCtrl.getUserObject();
switch(type) {
case owner:
userTableModel.addOwners(identitiesToAdd);
break;
case participant:
userTableModel.addParticipants(identitiesToAdd);
break;
case waiting:
userTableModel.addToWaitingList(identitiesToAdd);
break;
}
usersCtrl.modelChanged();
cmc.deactivate();
cleanupPopup();
} else if (source == usersCtrl) {
if (event.getCommand().equals(Table.COMMAND_MULTISELECT)) {
TableMultiSelectEvent tmse = (TableMultiSelectEvent) event;
if (tmse.getAction().equals(COMMAND_REMOVEUSER)) {
List<Identity> toRemove = userTableModel.getObjects(tmse.getSelection());
removeIdentities(toRemove);
}
}
}
super.event(ureq, source, event);
}
Aggregations