use of org.olat.core.gui.components.table.TableEvent 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.TableEvent in project OpenOLAT by OpenOLAT.
the class ViteroBookingsController 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 ("start".equals(e.getActionId())) {
openVitero(ureq, booking);
} else if ("signin".equals(e.getActionId())) {
signInVitero(ureq, booking);
} else if ("signout".equals(e.getActionId())) {
signOutVitero(ureq, booking);
} else if ("opengroup".equals(e.getActionId())) {
openGroup(ureq, booking);
}
}
} else if (source == cmc) {
removeAsListenerAndDispose(cmc);
viteroGroupVC = null;
cmc = null;
}
super.event(ureq, source, event);
}
use of org.olat.core.gui.components.table.TableEvent in project OpenOLAT by OpenOLAT.
the class NoteListController 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 row has been clicked
if (source == tableC) {
if (event.getCommand().equals(Table.COMMANDLINK_ROWACTION_CLICKED)) {
TableEvent te = (TableEvent) event;
String actionid = te.getActionId();
int rowid = te.getRowId();
this.chosenN = nLModel.getObject(rowid);
if (actionid.equals("choose")) {
removeAsListenerAndDispose(nc);
nc = new NoteController(ureq, getWindowControl(), chosenN);
listenTo(nc);
removeAsListenerAndDispose(cmc);
cmc = new CloseableModalController(getWindowControl(), translate("close"), nc.getInitialComponent());
listenTo(cmc);
cmc.activate();
} else if (actionid.equals("delete")) {
deleteDialogCtr = activateYesNoDialog(ureq, null, translate("note.delete.confirmation"), deleteDialogCtr);
}
}
} else if (source == deleteDialogCtr) {
if (DialogBoxUIFactory.isYesEvent(event)) {
// delete is ok
nm.deleteNote(chosenN);
// fire local event (for the same user)
// TODO:fj:a make Note (and all persistables) olatresourceables: problem: type is then NoteImpl instead of Note
OLATResourceable ores = OresHelper.createOLATResourceableInstance(Note.class, chosenN.getKey());
ureq.getUserSession().getSingleUserEventCenter().fireEventToListenersOf(new OLATResourceableJustBeforeDeletedEvent(ores), ores);
showInfo("note.delete.successfull");
populateNLTable();
chosenN = null;
} else {
// answer was "no"
chosenN = null;
}
} else if (source == nc) {
if (event == Event.BACK_EVENT) {
cmc.deactivate();
}
}
}
use of org.olat.core.gui.components.table.TableEvent in project OpenOLAT by OpenOLAT.
the class EventsModel 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 == tableController) {
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();
KalendarEvent kalendarEvent = ((EventsModel) tableController.getTableDataModel()).getObject(rowid);
String resourceUrl = "[HomeSite:" + ureq.getIdentity().getKey() + "][calendar:0]" + BusinessControlFactory.getInstance().getContextEntryStringForDate(kalendarEvent.getBegin());
BusinessControl bc = BusinessControlFactory.getInstance().createFromString(resourceUrl);
WindowControl bwControl = BusinessControlFactory.getInstance().createBusinessWindowControl(bc, getWindowControl());
NewControllerFactory.getInstance().launch(ureq, bwControl);
}
}
}
}
use of org.olat.core.gui.components.table.TableEvent 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);
}
Aggregations