Search in sources :

Example 46 with MultiUserEvent

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);
        }
    }
}
Also used : ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List) MultiUserEvent(org.olat.core.util.event.MultiUserEvent)

Example 47 with MultiUserEvent

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);
            }
        }
    }
}
Also used : ArrayList(java.util.ArrayList) List(java.util.List) ArrayList(java.util.ArrayList) MultiUserEvent(org.olat.core.util.event.MultiUserEvent)

Example 48 with MultiUserEvent

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);
}
Also used : ICourse(org.olat.course.ICourse) RepositoryEntry(org.olat.repository.RepositoryEntry) MultiUserEvent(org.olat.core.util.event.MultiUserEvent) BusinessGroupModifiedEvent(org.olat.group.ui.edit.BusinessGroupModifiedEvent)

Aggregations

MultiUserEvent (org.olat.core.util.event.MultiUserEvent)48 OLATResourceable (org.olat.core.id.OLATResourceable)16 EntryChangedEvent (org.olat.repository.controllers.EntryChangedEvent)10 ArrayList (java.util.ArrayList)8 File (java.io.File)6 Date (java.util.Date)6 HashSet (java.util.HashSet)6 Identity (org.olat.core.id.Identity)6 SyncerExecutor (org.olat.core.util.coordinate.SyncerExecutor)6 EventBus (org.olat.core.util.event.EventBus)6 List (java.util.List)4 Locale (java.util.Locale)4 Publisher (org.olat.core.commons.services.notifications.Publisher)4 Subscriber (org.olat.core.commons.services.notifications.Subscriber)4 ICourse (org.olat.course.ICourse)3 IOException (java.io.IOException)2 Collection (java.util.Collection)2 CountDownLatch (java.util.concurrent.CountDownLatch)2 JMSException (javax.jms.JMSException)2 ObjectMessage (javax.jms.ObjectMessage)2