use of org.olat.core.gui.components.table.TableEvent in project OpenOLAT by OpenOLAT.
the class StatisticDisplayController method event.
@Override
protected void event(UserRequest ureq, Controller source, Event event) {
if (source == tableCtr_ && event instanceof TableEvent) {
TableEvent tableEvent = (TableEvent) event;
if (CLICK_NODE_ACTION.equals(tableEvent.getActionId())) {
int rowId = tableEvent.getRowId();
Graph graph = calculateNodeGraph(ureq, rowId);
generateCharts(graph);
} else if (tableEvent.getActionId().startsWith(CLICK_TOTAL_ACTION)) {
try {
int columnId = Integer.parseInt(tableEvent.getActionId().substring(CLICK_TOTAL_ACTION.length()));
Graph graph = calculateTotalGraph(ureq, columnId);
generateCharts(graph);
} catch (NumberFormatException e) {
log_.warn("event: Could not convert event into columnId for rendering graph: " + tableEvent.getActionId());
return;
}
}
}
}
use of org.olat.core.gui.components.table.TableEvent in project OpenOLAT by OpenOLAT.
the class ENRunController 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) {
String cmd = event.getCommand();
if (source == tableCtr) {
if (cmd.equals(Table.COMMANDLINK_ROWACTION_CLICKED)) {
TableEvent te = (TableEvent) event;
String actionid = te.getActionId();
int rowid = te.getRowId();
EnrollmentRow row = groupListModel.getObject(rowid);
Long choosenGroupKey = row.getKey();
if (actionid.equals(CMD_ENROLL_IN_GROUP)) {
BusinessGroup choosenGroup = businessGroupService.loadBusinessGroup(choosenGroupKey);
addLoggingResourceable(LoggingResourceable.wrap(choosenGroup));
if (log.isDebug()) {
log.debug("CMD_ENROLL_IN_GROUP ureq.getComponentID()=" + ureq.getComponentID() + " ureq.getComponentTimestamp()=" + ureq.getComponentTimestamp());
}
EnrollStatus enrollStatus = enrollmentManager.doEnroll(ureq.getIdentity(), ureq.getUserSession().getRoles(), choosenGroup, enNode, coursePropertyManager, getWindowControl(), getTranslator(), enrollableGroupKeys, enrollableAreaKeys, courseGroupManager);
if (enrollStatus.isEnrolled() || enrollStatus.isInWaitingList()) {
// OK
} else {
getWindowControl().setError(enrollStatus.getErrorMessage());
}
// events are already fired BusinessGroupManager level :: BusinessGroupModifiedEvent.fireModifiedGroupEvents(BusinessGroupModifiedEvent.IDENTITY_ADDED_EVENT, choosenGroup, ureq.getIdentity());
// but async
// fire event to indicate runmaincontroller that the menuview is to update
doEnrollView(updateModel());
if (enrollStatus.isEnrolled()) {
fireEvent(ureq, new BusinessGroupModifiedEvent(BusinessGroupModifiedEvent.IDENTITY_ADDED_EVENT, choosenGroup, getIdentity()));
} else {
fireEvent(ureq, Event.DONE_EVENT);
}
} else if (actionid.equals(CMD_ENROLLED_CANCEL)) {
BusinessGroup choosenGroup = businessGroupService.loadBusinessGroup(choosenGroupKey);
addLoggingResourceable(LoggingResourceable.wrap(choosenGroup));
List<String> roles = businessGroupService.getIdentityRolesInBusinessGroup(getIdentity(), choosenGroup);
if (roles.contains(GroupRoles.waiting.name())) {
enrollmentManager.doCancelEnrollmentInWaitingList(ureq.getIdentity(), choosenGroup, enNode, coursePropertyManager, getWindowControl(), getTranslator());
} else if (roles.contains(GroupRoles.participant.name())) {
enrollmentManager.doCancelEnrollment(ureq.getIdentity(), choosenGroup, enNode, coursePropertyManager, getWindowControl(), getTranslator());
}
// fire event to indicate runmaincontroller that the menuview is to update
fireEvent(ureq, new BusinessGroupModifiedEvent(BusinessGroupModifiedEvent.IDENTITY_REMOVED_EVENT, choosenGroup, getIdentity()));
// events are already fired BusinessGroupManager level :: BusinessGroupModifiedEvent.fireModifiedGroupEvents(BusinessGroupModifiedEvent.IDENTITY_REMOVED_EVENT, group, ureq.getIdentity());
// but async
doEnrollView(updateModel());
} else if (CMD_VISIT_CARD.equals(actionid)) {
List<String> roles = businessGroupService.getIdentityRolesInBusinessGroup(getIdentity(), row);
String businessPath;
if (roles.contains(GroupRoles.coach.name()) || roles.contains(GroupRoles.participant.name())) {
businessPath = "[BusinessGroup:" + choosenGroupKey + "]";
} else {
businessPath = "[GroupCard:" + choosenGroupKey + "]";
}
NewControllerFactory.getInstance().launch(businessPath, ureq, getWindowControl());
}
}
}
}
use of org.olat.core.gui.components.table.TableEvent in project OpenOLAT by OpenOLAT.
the class QTI12ResultDetailsController 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 == tableCtr) {
TableEvent tEvent = (TableEvent) event;
if (tEvent.getActionId().equals("sel")) {
QTIResultSet resultSet = tableModel.getObject(tEvent.getRowId());
try {
removeAsListenerAndDispose(xsltDetailsCtr);
xsltDetailsCtr = new QTI12XSLTResultDetailsController(ureq, getWindowControl(), assessedIdentity, type, resultSet);
listenTo(xsltDetailsCtr);
fireEvent(ureq, new OpenSubDetailsEvent(xsltDetailsCtr));
} catch (Exception e) {
logError("", e);
showError("error.resreporting.na");
}
} else if (tEvent.getActionId().equals("ret")) {
updateTableModel();
if (tableModel.isTestRunning()) {
String fullname = UserManager.getInstance().getUserDisplayName(assessedIdentity);
String title = translate("retrievetest.confirm.title");
String text = translate("retrievetest.confirm.text", new String[] { fullname });
retrieveConfirmationCtr = activateYesNoDialog(ureq, title, text, retrieveConfirmationCtr);
}
}
} else if (source == retrieveConfirmationCtr) {
if (DialogBoxUIFactory.isYesEvent(event)) {
if (tableModel.isTestRunning()) {
IQRetrievedEvent retrieveEvent = new IQRetrievedEvent(assessedIdentity, courseResourceableId, nodeIdent);
CoordinatorManager.getInstance().getCoordinator().getEventBus().fireEventToListenersOf(retrieveEvent, retrieveEvent);
doRetrieveTest();
}
updateTableModel();
}
removeAsListenerAndDispose(retrieveConfirmationCtr);
retrieveConfirmationCtr = null;
}
}
use of org.olat.core.gui.components.table.TableEvent in project OpenOLAT by OpenOLAT.
the class CourseListController method event.
@Override
protected void event(UserRequest ureq, Controller source, Event event) {
if (source == tableCtr) {
if (event instanceof TableEvent) {
TableEvent e = (TableEvent) event;
if ("select".equals(e.getActionId())) {
CourseStatEntry courseStat = (CourseStatEntry) tableCtr.getTableDataModel().getObject(e.getRowId());
selectCourse(ureq, courseStat);
}
}
} else if (source == courseCtrl) {
if (event == Event.CHANGED_EVENT) {
hasChanged = true;
} else if ("next.course".equals(event.getCommand())) {
nextCourse(ureq);
} else if ("previous.course".equals(event.getCommand())) {
previousCourse(ureq);
}
}
super.event(ureq, source, event);
}
use of org.olat.core.gui.components.table.TableEvent in project OpenOLAT by OpenOLAT.
the class GroupListController method event.
@Override
protected void event(UserRequest ureq, Controller source, Event event) {
if (source == tableCtr) {
if (event instanceof TableEvent) {
TableEvent e = (TableEvent) event;
if ("select".equals(e.getActionId())) {
GroupStatEntry groupStatistic = (GroupStatEntry) tableCtr.getTableDataModel().getObject(e.getRowId());
selectGroup(ureq, groupStatistic);
}
}
} else if (source == groupCtrl) {
if (event == Event.CHANGED_EVENT) {
hasChanged = true;
} else if ("next.group".equals(event.getCommand())) {
nextGroup(ureq);
} else if ("previous.group".equals(event.getCommand())) {
previousGroup(ureq);
}
}
super.event(ureq, source, event);
}
Aggregations