Search in sources :

Example 1 with Event

use of org.olat.core.gui.control.Event in project OpenOLAT by OpenOLAT.

the class AbstractComponent method getAndClearLatestFiredEvent.

/**
 * only for debugging reasons!!!
 *
 * @return Returns the latestFiredEvent.
 */
public Event getAndClearLatestFiredEvent() {
    Event tmp = latestFiredEvent;
    // gc
    latestFiredEvent = null;
    return tmp;
}
Also used : Event(org.olat.core.gui.control.Event)

Example 2 with Event

use of org.olat.core.gui.control.Event in project OpenOLAT by OpenOLAT.

the class SegmentViewComponent method doDispatchRequest.

@Override
protected void doDispatchRequest(UserRequest ureq) {
    Event e = null;
    String cmd = ureq.getParameter(VelocityContainer.COMMAND_ID);
    int count = 0;
    for (Component segment : segments) {
        if (segment.getComponentName().equals(cmd)) {
            boolean selected = selectedSegments.contains(segment);
            if (selected) {
                if (isAllowNoSelection() || selectedSegments.size() > 1) {
                    e = new SegmentViewEvent(SegmentViewEvent.DESELECTION_EVENT, segment.getComponentName(), count);
                    selectedSegments.remove(segment);
                } else if (isReselect()) {
                    e = new SegmentViewEvent(SegmentViewEvent.SELECTION_EVENT, segment.getComponentName(), count);
                }
            } else {
                if (!isAllowMultipleSelection()) {
                    deselectAllSegments();
                }
                e = new SegmentViewEvent(SegmentViewEvent.SELECTION_EVENT, segment.getComponentName(), count);
                selectSegment(segment);
            }
            break;
        }
        count++;
    }
    if (e != null) {
        setDirty(true);
        fireEvent(ureq, e);
    }
}
Also used : Event(org.olat.core.gui.control.Event) Component(org.olat.core.gui.components.Component) AbstractComponent(org.olat.core.gui.components.AbstractComponent)

Example 3 with Event

use of org.olat.core.gui.control.Event in project OpenOLAT by OpenOLAT.

the class VelocityContainer method doDispatchRequest.

/**
 * @see org.olat.core.gui.components.Component#dispatchRequest(org.olat.core.gui.UserRequest)
 */
@Override
protected void doDispatchRequest(UserRequest ureq) {
    // called when a page-link is clicked ($r.renderCommand)
    String commandString = ureq.getParameter(COMMAND_ID);
    // WAS: set component dirty by default.
    // if you are in ajax mode, and the link resulted in a external mediaresource, then you can (in your controller) manually reset dirty to false.
    // we decided that there are only very few cases for this, and otherwise that the chance that a developers forgets to call vc.setDirty(true) is
    // much higher
    // now: normal links are created using the Link component, which takes care of setting dirty itself (everytime it is dispatched)
    // setDirty(true);
    // notify listening controllers
    fireEvent(ureq, new Event(commandString));
}
Also used : Event(org.olat.core.gui.control.Event)

Example 4 with Event

use of org.olat.core.gui.control.Event in project OpenOLAT by OpenOLAT.

the class AssessmentModeGuardController method continueAfterAssessmentMode.

private void continueAfterAssessmentMode(UserRequest ureq, ResourceGuard selectedGuard) {
    List<ResourceGuard> lastGuards = new ArrayList<ResourceGuard>();
    for (ResourceGuard currentGuard : guards.getList()) {
        if (currentGuard != selectedGuard) {
            lastGuards.add(currentGuard);
        }
    }
    guards.setList(lastGuards);
    boolean canContinue = guards.getSize() == 0;
    if (canContinue) {
        cmc.deactivate();
        // make sure to see the navigation bar
        ChiefController cc = Windows.getWindows(ureq).getChiefController();
        cc.getScreenMode().setMode(Mode.standard);
        fireEvent(ureq, new Event("continue"));
        String businessPath = "[MyCoursesSite:0]";
        NewControllerFactory.getInstance().launch(businessPath, ureq, getWindowControl());
    } else {
        mainVC.setDirty(true);
    }
}
Also used : ArrayList(java.util.ArrayList) Event(org.olat.core.gui.control.Event) AssessmentModeNotificationEvent(org.olat.course.assessment.AssessmentModeNotificationEvent) ChiefController(org.olat.core.gui.control.ChiefController)

Example 5 with Event

use of org.olat.core.gui.control.Event in project OpenOLAT by OpenOLAT.

the class YearNavigationController method event.

/**
 * @see org.olat.core.gui.control.DefaultController#event(org.olat.core.gui.UserRequest,
 *      org.olat.core.gui.components.Component,
 *      org.olat.core.gui.control.Event)
 */
@Override
protected void event(UserRequest ureq, Component source, Event event) {
    if (source == next) {
        model.next();
        createLinks();
        Year year = (Year) yearLink.getUserObject();
        Event navEvent = new NavigationEvent(year.getItems());
        fireEvent(ureq, navEvent);
        yearLink.setCustomEnabledLinkCSS("o_year o_selected");
    } else if (source == previous) {
        model.previous();
        createLinks();
        Year year = (Year) yearLink.getUserObject();
        Event navEvent = new NavigationEvent(year.getItems());
        fireEvent(ureq, navEvent);
        yearLink.setCustomEnabledLinkCSS("o_year o_selected");
    } else if (source == yearLink) {
        // Click on year toggles between year filter and show all filter
        if (showAll) {
            Year year = (Year) yearLink.getUserObject();
            Event navEvent = new NavigationEvent(year.getItems());
            fireEvent(ureq, navEvent);
            // update GUI
            yearLink.setCustomEnabledLinkCSS("o_year o_selected");
            for (Link monthLink : monthLinks) {
                monthLink.setCustomEnabledLinkCSS("o_month");
            }
            showAll = false;
        } else {
            Event navEvent = new NavigationEvent(allObjects);
            fireEvent(ureq, navEvent);
            // update GUI
            yearLink.setCustomEnabledLinkCSS("o_year");
            showAll = true;
        }
    } else if (monthLinks.contains(source)) {
        Link monthLink = (Link) source;
        Month month = (Month) monthLink.getUserObject();
        Event navEvent = new NavigationEvent(month.getItems());
        fireEvent(ureq, navEvent);
        // update GUI
        yearLink.setCustomEnabledLinkCSS("o_year");
        for (Link link : monthLinks) {
            link.setCustomEnabledLinkCSS("o_month");
        }
        monthLink.setCustomEnabledLinkCSS("o_month o_selected");
    }
}
Also used : Event(org.olat.core.gui.control.Event) Link(org.olat.core.gui.components.link.Link)

Aggregations

Event (org.olat.core.gui.control.Event)68 FormEvent (org.olat.core.gui.components.form.flexible.impl.FormEvent)14 WindowControl (org.olat.core.gui.control.WindowControl)12 ArrayList (java.util.ArrayList)10 UserRequest (org.olat.core.gui.UserRequest)10 Controller (org.olat.core.gui.control.Controller)10 Identity (org.olat.core.id.Identity)10 RepositoryEntry (org.olat.repository.RepositoryEntry)10 List (java.util.List)8 Link (org.olat.core.gui.components.link.Link)8 OLATResourceable (org.olat.core.id.OLATResourceable)8 ControllerEventListener (org.olat.core.gui.control.ControllerEventListener)6 GenericQtiNode (org.olat.ims.qti.editor.tree.GenericQtiNode)6 QItemViewEvent (org.olat.modules.qpool.ui.events.QItemViewEvent)6 Component (org.olat.core.gui.components.Component)5 TreeEvent (org.olat.core.gui.components.tree.TreeEvent)5 FormLink (org.olat.core.gui.components.form.flexible.elements.FormLink)4 PopEvent (org.olat.core.gui.components.stack.PopEvent)4 TableEvent (org.olat.core.gui.components.table.TableEvent)4 TableMultiSelectEvent (org.olat.core.gui.components.table.TableMultiSelectEvent)4