use of org.olat.core.util.event.MultiUserEvent in project openolat by klemens.
the class ENEditGroupAreaFormController method event.
@Override
protected void event(UserRequest ureq, Controller source, Event event) {
subm.setEnabled(true);
if (source == groupChooseC) {
if (event == Event.DONE_EVENT) {
cmc.deactivate();
KeysAndNames c = getGroupKeysAndNames(groupChooseC.getSelectedKeys());
easyGroupList.setValue(c.getDecoratedNames());
easyGroupList.setUserObject(c);
easyGroupList.getRootForm().submit(ureq);
chooseGroupsLink.setI18nKey("choose");
} else if (Event.CANCELLED_EVENT == event) {
cmc.deactivate();
}
} else if (source == areaChooseC) {
if (event == Event.DONE_EVENT) {
cmc.deactivate();
KeysAndNames c = getAreaKeysAndNames(areaChooseC.getSelectedKeys());
easyAreaList.setValue(c.getDecoratedNames());
easyAreaList.setUserObject(c);
easyAreaList.getRootForm().submit(ureq);
chooseAreasLink.setI18nKey("choose");
} else if (event == Event.CANCELLED_EVENT) {
cmc.deactivate();
}
} else if (source == groupCreateCntrllr) {
easyGroupList.setEnabled(true);
cmc.deactivate();
if (event == Event.DONE_EVENT) {
List<Long> c = new ArrayList<Long>();
c.addAll(getKeys(easyGroupList));
if (fixGroupError != null && fixGroupError.getUserObject() != null) {
String[] keyArr = (String[]) fixGroupError.getUserObject();
if (keyArr != null && keyArr.length > 0) {
List<Long> fixedKeys = toKeys(keyArr[0]);
c.removeAll(fixedKeys);
}
}
c.addAll(groupCreateCntrllr.getCreatedGroupKeys());
KeysAndNames keysAndNames = getGroupKeysAndNames(c);
easyGroupList.setValue(keysAndNames.getDecoratedNames());
easyGroupList.setUserObject(keysAndNames);
if (groupCreateCntrllr.getCreatedGroupNames().size() > 0 && !hasGroups) {
chooseGroupsLink.setLinkTitle("select");
singleUserEventCenter.fireEventToListenersOf(new MultiUserEvent("changed"), groupConfigChangeEventOres);
}
easyGroupList.getRootForm().submit(ureq);
}
} else if (source == areaCreateCntrllr) {
easyAreaList.setEnabled(true);
cmc.deactivate();
if (event == Event.DONE_EVENT) {
List<Long> c = new ArrayList<Long>();
c.addAll(getKeys(easyAreaList));
if (fixAreaError != null && fixAreaError.getUserObject() != null) {
String[] keyArr = (String[]) fixAreaError.getUserObject();
if (keyArr != null && keyArr.length > 0) {
List<Long> fixedKeys = toKeys(keyArr[0]);
c.removeAll(fixedKeys);
}
}
c.addAll(areaCreateCntrllr.getCreatedAreaKeys());
KeysAndNames keysAndNames = getAreaKeysAndNames(c);
easyAreaList.setValue(keysAndNames.getDecoratedNames());
easyAreaList.setUserObject(keysAndNames);
if (areaCreateCntrllr.getCreatedAreaNames().size() > 0 && !hasAreas) {
chooseAreasLink.setLinkTitle("select");
singleUserEventCenter.fireEventToListenersOf(new MultiUserEvent("changed"), groupConfigChangeEventOres);
}
easyAreaList.getRootForm().submit(ureq);
}
}
}
use of org.olat.core.util.event.MultiUserEvent in project openolat by klemens.
the class ConditionConfigEasyController method event.
@Override
protected void event(UserRequest ureq, Controller source, org.olat.core.gui.control.Event event) {
if (source == groupChooseC) {
if (Event.DONE_EVENT == event) {
cmc.deactivate();
List<Long> groupKeys = groupChooseC.getSelectedKeys();
easyGroupList.setUserObject(groupKeys);
easyGroupList.setValue(getGroupNames(groupKeys));
validateGroupFields();
easyGroupList.getRootForm().submit(ureq);
} else if (event == Event.CANCELLED_EVENT) {
cmc.deactivate();
} else if (event == Event.CHANGED_EVENT) {
// a group was created within from within the chooser
}
} else if (source == areaChooseC) {
if (event == Event.DONE_EVENT) {
cmc.deactivate();
List<Long> areaKeys = areaChooseC.getSelectedKeys();
easyAreaList.setUserObject(areaKeys);
easyAreaList.setValue(this.getAreaNames(areaKeys));
validateGroupFields();
easyAreaList.getRootForm().submit(ureq);
} else if (event == Event.CANCELLED_EVENT) {
cmc.deactivate();
} else if (event == Event.CHANGED_EVENT) {
// an area was created within from within the chooser
}
} else if (source == groupCreateCtlr) {
cmc.deactivate();
if (event == Event.DONE_EVENT) {
List<Long> c = new ArrayList<Long>();
c.addAll(getKeys(easyGroupList));
if (fixGroupError != null && fixGroupError.getUserObject() != null) {
c.removeAll(Arrays.asList((String[]) fixGroupError.getUserObject()));
}
c.addAll(groupCreateCtlr.getCreatedGroupKeys());
easyGroupList.setValue(getGroupNames(c));
easyGroupList.setUserObject(c);
easyGroupList.getRootForm().submit(ureq);
validateGroupFields();
if (!groupCreateCtlr.getCreatedGroupKeys().isEmpty()) {
singleUserEventCenter.fireEventToListenersOf(new MultiUserEvent("changed"), groupConfigChangeEventOres);
}
}
} else if (source == areaCreateCtlr) {
cmc.deactivate();
if (event == Event.DONE_EVENT) {
List<Long> c = new ArrayList<Long>();
c.addAll(getKeys(easyAreaList));
if (fixAreaError != null && fixAreaError.getUserObject() != null) {
c.removeAll(Arrays.asList((String[]) fixAreaError.getUserObject()));
}
c.addAll(areaCreateCtlr.getCreatedAreaKeys());
easyAreaList.setValue(getAreaNames(c));
easyAreaList.setUserObject(c);
easyAreaList.getRootForm().submit(ureq);
validateGroupFields();
if (!areaCreateCtlr.getCreatedAreaKeys().isEmpty()) {
singleUserEventCenter.fireEventToListenersOf(new MultiUserEvent("changed"), groupConfigChangeEventOres);
}
}
}
}
use of org.olat.core.util.event.MultiUserEvent in project openolat by klemens.
the class ProjectGroupManagerImpl method sendGroupChangeEvent.
@Override
public void sendGroupChangeEvent(Project project, Long courseResourceableId, Identity identity) {
ICourse course = CourseFactory.loadCourse(courseResourceableId);
RepositoryEntry ores = course.getCourseEnvironment().getCourseGroupManager().getCourseEntry();
MultiUserEvent modifiedEvent = new BusinessGroupModifiedEvent(BusinessGroupModifiedEvent.IDENTITY_ADDED_EVENT, project.getProjectGroup(), identity);
CoordinatorManager.getInstance().getCoordinator().getEventBus().fireEventToListenersOf(modifiedEvent, ores);
}
Aggregations