Search in sources :

Example 1 with TableEvent

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;
            }
        }
    }
}
Also used : TableEvent(org.olat.core.gui.components.table.TableEvent)

Example 2 with TableEvent

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());
            }
        }
    }
}
Also used : TableEvent(org.olat.core.gui.components.table.TableEvent) BusinessGroup(org.olat.group.BusinessGroup) ArrayList(java.util.ArrayList) List(java.util.List) BusinessGroupModifiedEvent(org.olat.group.ui.edit.BusinessGroupModifiedEvent)

Example 3 with TableEvent

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;
    }
}
Also used : OpenSubDetailsEvent(org.olat.course.assessment.OpenSubDetailsEvent) TableEvent(org.olat.core.gui.components.table.TableEvent) IQRetrievedEvent(org.olat.modules.iq.IQRetrievedEvent)

Example 4 with TableEvent

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);
}
Also used : CourseStatEntry(org.olat.modules.coach.model.CourseStatEntry) TableEvent(org.olat.core.gui.components.table.TableEvent)

Example 5 with TableEvent

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);
}
Also used : TableEvent(org.olat.core.gui.components.table.TableEvent) GroupStatEntry(org.olat.modules.coach.model.GroupStatEntry)

Aggregations

TableEvent (org.olat.core.gui.components.table.TableEvent)114 ArrayList (java.util.ArrayList)42 List (java.util.List)40 TableMultiSelectEvent (org.olat.core.gui.components.table.TableMultiSelectEvent)40 CloseableModalController (org.olat.core.gui.control.generic.closablewrapper.CloseableModalController)16 Identity (org.olat.core.id.Identity)16 BitSet (java.util.BitSet)12 WindowControl (org.olat.core.gui.control.WindowControl)12 SingleIdentityChosenEvent (org.olat.basesecurity.events.SingleIdentityChosenEvent)10 UserRequest (org.olat.core.gui.UserRequest)10 ControllerCreator (org.olat.core.gui.control.creator.ControllerCreator)10 PopupBrowserWindow (org.olat.core.gui.control.generic.popup.PopupBrowserWindow)10 MultiIdentityChosenEvent (org.olat.basesecurity.events.MultiIdentityChosenEvent)8 BusinessGroup (org.olat.group.BusinessGroup)8 RepositoryEntry (org.olat.repository.RepositoryEntry)8 AssertException (org.olat.core.logging.AssertException)6 UserInfoMainController (org.olat.user.UserInfoMainController)6 KalendarEvent (org.olat.commons.calendar.model.KalendarEvent)4 LayoutMain3ColsController (org.olat.core.commons.fullWebApp.LayoutMain3ColsController)4 Subscriber (org.olat.core.commons.services.notifications.Subscriber)4