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;
}
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);
}
}
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));
}
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);
}
}
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");
}
}
Aggregations