use of org.olat.portfolio.ui.artefacts.view.EPArtefactChoosenEvent in project openolat by klemens.
the class EPArtefactPoolRunController 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
protected void event(UserRequest ureq, Controller source, Event event) {
super.event(ureq, source, event);
if (source == addArtefactCtrl) {
// some artefacts were added, refresh view
if (event.equals(Event.DONE_EVENT)) {
initTPAllView(ureq);
fireEvent(ureq, event);
}
} else if (event instanceof EPArtefactChoosenEvent || event instanceof EPArtefactListChoosenEvent) {
// an artefact was choosen, pass through the event until top
fireEvent(ureq, event);
} else if (source == filterSelectCtrl) {
if (event instanceof PortfolioFilterChangeEvent) {
PortfolioFilterChangeEvent pFEvent = (PortfolioFilterChangeEvent) event;
filterSettings = pFEvent.getFilterList();
} else if (event instanceof PortfolioFilterEditEvent) {
PortfolioFilterEditEvent editEvent = (PortfolioFilterEditEvent) event;
filterSettings = editEvent.getFilterList();
}
if (source instanceof EPFilterSelectController) {
if (event == Event.CHANGED_EVENT) {
initTPFilterView(ureq);
} else if (event instanceof PortfolioFilterChangeEvent) {
// preset search was selected, apply it, but stay within first segment
initTPFilterView(ureq);
initFilterPanel(ureq, Filter.read_only);
} else if (event instanceof PortfolioFilterEditEvent) {
initTPFilterView(ureq);
initFilterPanel(ureq, Filter.extended);
segmentView.select(searchLink);
}
} else if (source instanceof EPTagBrowseController) {
if (event instanceof EPTagBrowseEvent) {
EPTagBrowseEvent found = (EPTagBrowseEvent) event;
initMultiArtefactCtrl(ureq, found.getArtefacts());
setSegmentContent(artCtrl);
}
} else if (source instanceof PortfolioFilterController) {
if (event instanceof PortfolioFilterChangeEvent) {
initTPFilterView(ureq);
}
}
} else if (source == viewModeCtrl && event.getCommand().equals(EPViewModeController.VIEWMODE_CHANGED_EVENT_CMD)) {
initMultiArtefactCtrl(ureq, previousArtefactsList);
setSegmentContent(artCtrl);
} else if (event instanceof EPArtefactDeletedEvent) {
EPArtefactDeletedEvent epDelEv = (EPArtefactDeletedEvent) event;
previousArtefactsList.remove(epDelEv.getArtefact());
initMultiArtefactCtrl(ureq, previousArtefactsList);
setSegmentContent(artCtrl);
}
}
use of org.olat.portfolio.ui.artefacts.view.EPArtefactChoosenEvent in project OpenOLAT by OpenOLAT.
the class EPArtefactPoolRunController 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
protected void event(UserRequest ureq, Controller source, Event event) {
super.event(ureq, source, event);
if (source == addArtefactCtrl) {
// some artefacts were added, refresh view
if (event.equals(Event.DONE_EVENT)) {
initTPAllView(ureq);
fireEvent(ureq, event);
}
} else if (event instanceof EPArtefactChoosenEvent || event instanceof EPArtefactListChoosenEvent) {
// an artefact was choosen, pass through the event until top
fireEvent(ureq, event);
} else if (source == filterSelectCtrl) {
if (event instanceof PortfolioFilterChangeEvent) {
PortfolioFilterChangeEvent pFEvent = (PortfolioFilterChangeEvent) event;
filterSettings = pFEvent.getFilterList();
} else if (event instanceof PortfolioFilterEditEvent) {
PortfolioFilterEditEvent editEvent = (PortfolioFilterEditEvent) event;
filterSettings = editEvent.getFilterList();
}
if (source instanceof EPFilterSelectController) {
if (event == Event.CHANGED_EVENT) {
initTPFilterView(ureq);
} else if (event instanceof PortfolioFilterChangeEvent) {
// preset search was selected, apply it, but stay within first segment
initTPFilterView(ureq);
initFilterPanel(ureq, Filter.read_only);
} else if (event instanceof PortfolioFilterEditEvent) {
initTPFilterView(ureq);
initFilterPanel(ureq, Filter.extended);
segmentView.select(searchLink);
}
} else if (source instanceof EPTagBrowseController) {
if (event instanceof EPTagBrowseEvent) {
EPTagBrowseEvent found = (EPTagBrowseEvent) event;
initMultiArtefactCtrl(ureq, found.getArtefacts());
setSegmentContent(artCtrl);
}
} else if (source instanceof PortfolioFilterController) {
if (event instanceof PortfolioFilterChangeEvent) {
initTPFilterView(ureq);
}
}
} else if (source == viewModeCtrl && event.getCommand().equals(EPViewModeController.VIEWMODE_CHANGED_EVENT_CMD)) {
initMultiArtefactCtrl(ureq, previousArtefactsList);
setSegmentContent(artCtrl);
} else if (event instanceof EPArtefactDeletedEvent) {
EPArtefactDeletedEvent epDelEv = (EPArtefactDeletedEvent) event;
previousArtefactsList.remove(epDelEv.getArtefact());
initMultiArtefactCtrl(ureq, previousArtefactsList);
setSegmentContent(artCtrl);
}
}
use of org.olat.portfolio.ui.artefacts.view.EPArtefactChoosenEvent in project OpenOLAT by OpenOLAT.
the class EPAddElementsController 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
protected void event(UserRequest ureq, Controller source, Event event) {
super.event(ureq, source, event);
if (source == artefactPoolCtrl) {
if (event instanceof EPArtefactChoosenEvent) {
// finally an artefact was choosen
EPArtefactChoosenEvent artCEv = (EPArtefactChoosenEvent) event;
artefactBox.deactivate();
AbstractArtefact choosenArtefact = artCEv.getArtefact();
// check for a yet existing link to this artefact
if (ePFMgr.isArtefactInStructure(choosenArtefact, portfolioStructure)) {
showWarning("artefact.already.in.structure");
} else {
boolean successfullLink = ePFMgr.addArtefactToStructure(getIdentity(), choosenArtefact, portfolioStructure);
if (successfullLink) {
getWindowControl().setInfo(getTranslator().translate("artefact.choosen", new String[] { choosenArtefact.getTitle(), portfolioStructure.getTitle() }));
ThreadLocalUserActivityLogger.addLoggingResourceInfo(LoggingResourceable.wrapPortfolioOres(choosenArtefact));
ThreadLocalUserActivityLogger.log(EPLoggingAction.EPORTFOLIO_ARTEFACT_SELECTED, getClass());
} else {
showError("restrictions.not.conform");
}
fireEvent(ureq, new EPStructureChangeEvent(EPStructureChangeEvent.ADDED, portfolioStructure));
}
} else if (event == Event.DONE_EVENT) {
artefactBox.deactivate();
fireEvent(ureq, new EPStructureChangeEvent(EPStructureChangeEvent.ADDED, portfolioStructure));
}
}
}
use of org.olat.portfolio.ui.artefacts.view.EPArtefactChoosenEvent in project OpenOLAT by OpenOLAT.
the class MediaCenterController method event.
@Override
public void event(UserRequest ureq, Controller source, Event event) {
if (mediaUploadCtrl == source || textUploadCtrl == source || citationUploadCtrl == source) {
if (event == Event.DONE_EVENT) {
loadModel();
tableEl.reloadData();
}
cmc.deactivate();
cleanUp();
if (select || event == Event.DONE_EVENT) {
if (mediaUploadCtrl == source) {
doSelect(ureq, mediaUploadCtrl.getMediaReference().getKey());
} else if (textUploadCtrl == source) {
doSelect(ureq, textUploadCtrl.getMediaReference().getKey());
} else if (citationUploadCtrl == source) {
doSelect(ureq, citationUploadCtrl.getMediaReference().getKey());
}
}
} else if (importArtefactv1Ctrl == source) {
Media media = null;
if (event instanceof EPArtefactChoosenEvent) {
EPArtefactChoosenEvent cEvent = (EPArtefactChoosenEvent) event;
media = doImportArtefactV1(cEvent.getArtefact());
loadModel();
tableEl.reloadData();
} else if (event instanceof EPArtefactListChoosenEvent) {
EPArtefactListChoosenEvent cmEvent = (EPArtefactListChoosenEvent) event;
for (AbstractArtefact artefact : cmEvent.getArtefacts()) {
media = doImportArtefactV1(artefact);
}
if (cmEvent.getArtefacts().size() > 1) {
// only auto select a single media
media = null;
}
loadModel();
tableEl.reloadData();
showInfo("message.imported.successfully", new String[] { Integer.toString(cmEvent.getArtefacts().size()) });
}
cmc.deactivate();
cleanUp();
if (select && media != null) {
doSelect(ureq, media.getKey());
}
} else if (newMediasCtrl == source) {
newMediasCalloutCtrl.deactivate();
if ("add.file".equals(event.getCommand())) {
doAddMedia(ureq, "add.file");
} else if ("add.media".equals(event.getCommand())) {
doAddMedia(ureq, "add.media");
} else if ("add.text".equals(event.getCommand())) {
doAddTextMedia(ureq);
} else if ("add.citation".equals(event.getCommand())) {
doAddCitationMedia(ureq);
} else if ("import.artefactV1".equals(event.getCommand())) {
doChooseArtefactV1(ureq);
}
} else if (detailsCtrl == source) {
if (event instanceof MediaEvent) {
MediaEvent me = (MediaEvent) event;
if (MediaEvent.DELETED.equals(me.getCommand())) {
stackPanel.popUpToController(this);
loadModel();
tableEl.reset(false, true, true);
}
}
} else if (cmc == source) {
cleanUp();
}
super.event(ureq, source, event);
}
use of org.olat.portfolio.ui.artefacts.view.EPArtefactChoosenEvent in project openolat by klemens.
the class EPAddElementsController 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
protected void event(UserRequest ureq, Controller source, Event event) {
super.event(ureq, source, event);
if (source == artefactPoolCtrl) {
if (event instanceof EPArtefactChoosenEvent) {
// finally an artefact was choosen
EPArtefactChoosenEvent artCEv = (EPArtefactChoosenEvent) event;
artefactBox.deactivate();
AbstractArtefact choosenArtefact = artCEv.getArtefact();
// check for a yet existing link to this artefact
if (ePFMgr.isArtefactInStructure(choosenArtefact, portfolioStructure)) {
showWarning("artefact.already.in.structure");
} else {
boolean successfullLink = ePFMgr.addArtefactToStructure(getIdentity(), choosenArtefact, portfolioStructure);
if (successfullLink) {
getWindowControl().setInfo(getTranslator().translate("artefact.choosen", new String[] { choosenArtefact.getTitle(), portfolioStructure.getTitle() }));
ThreadLocalUserActivityLogger.addLoggingResourceInfo(LoggingResourceable.wrapPortfolioOres(choosenArtefact));
ThreadLocalUserActivityLogger.log(EPLoggingAction.EPORTFOLIO_ARTEFACT_SELECTED, getClass());
} else {
showError("restrictions.not.conform");
}
fireEvent(ureq, new EPStructureChangeEvent(EPStructureChangeEvent.ADDED, portfolioStructure));
}
} else if (event == Event.DONE_EVENT) {
artefactBox.deactivate();
fireEvent(ureq, new EPStructureChangeEvent(EPStructureChangeEvent.ADDED, portfolioStructure));
}
}
}
Aggregations