use of org.olat.portfolio.model.EPFilterSettings in project OpenOLAT by OpenOLAT.
the class EPArtefactManager method getArtefactsAndTagCloud.
/**
* This is an optimized method to filter a list of artefact by tags and return
* the tags of this list of artefacts. This prevent to search two times or more the list
* of tags of an artefact.
* @param identity
* @param tags
* @return the filtered artefacts and their tags
*/
protected EPArtefactTagCloud getArtefactsAndTagCloud(Identity identity, List<String> tags) {
List<AbstractArtefact> artefacts = getArtefactPoolForUser(identity);
EPFilterSettings filterSettings = new EPFilterSettings();
filterSettings.setTagFilter(tags);
Set<String> newTags = new HashSet<String>();
filterArtefactsByTags(artefacts, filterSettings, newTags);
return new EPArtefactTagCloud(artefacts, newTags);
}
use of org.olat.portfolio.model.EPFilterSettings in project OpenOLAT by OpenOLAT.
the class EPArtefactPoolRunController method initTPAllView.
private void initTPAllView(UserRequest ureq) {
filterSettings = new EPFilterSettings();
List<AbstractArtefact> artefacts = ePFMgr.getArtefactPoolForUser(getIdentity());
initMultiArtefactCtrl(ureq, artefacts);
initFilterPanel(ureq, Filter.read_only);
setSegmentContent(artCtrl);
addToHistory(ureq, OresHelper.createOLATResourceableType("All"), null);
}
use of org.olat.portfolio.model.EPFilterSettings in project OpenOLAT by OpenOLAT.
the class EPSettingsManager method setSavedFilterSettings.
public void setSavedFilterSettings(Identity ident, List<EPFilterSettings> filterList) {
Property p = propertyManager.findProperty(ident, null, null, EPORTFOLIO_CATEGORY, EPORTFOLIO_FILTER_SETTINGS);
if (p == null) {
p = propertyManager.createUserPropertyInstance(ident, EPORTFOLIO_CATEGORY, EPORTFOLIO_FILTER_SETTINGS, null, null, null, null);
}
// don't persist filters without a name
for (Iterator<EPFilterSettings> iterator = filterList.iterator(); iterator.hasNext(); ) {
EPFilterSettings epFilterSettings = iterator.next();
if (!StringHelper.containsNonWhitespace(epFilterSettings.getFilterName())) {
iterator.remove();
}
}
XStream xStream = XStreamHelper.createXStreamInstance();
xStream.aliasType("EPFilterSettings", EPFilterSettings.class);
String filterListXML = xStream.toXML(filterList);
p.setTextValue(filterListXML);
propertyManager.saveProperty(p);
}
use of org.olat.portfolio.model.EPFilterSettings in project OpenOLAT by OpenOLAT.
the class EPFilterSelectController method formInnerEvent.
/**
* @see org.olat.core.gui.components.form.flexible.impl.FormBasicController#formInnerEvent(org.olat.core.gui.UserRequest, org.olat.core.gui.components.form.flexible.FormItem, org.olat.core.gui.components.form.flexible.impl.FormEvent)
*/
@Override
protected void formInnerEvent(UserRequest ureq, FormItem source, FormEvent event) {
if (source == filterSel) {
int selFilter = filterSel.getSelected();
EPFilterSettings selFilterSet;
if (selFilter != 0) {
selFilterSet = nonEmptyFilters.get(selFilter - 1);
} else {
// all was selected, fire an empty filter
selFilterSet = new EPFilterSettings();
}
fireEvent(ureq, new PortfolioFilterChangeEvent(selFilterSet));
} else if (source == adaptBtn) {
// launch search view
int selFilter = filterSel.getSelected();
if (selFilter > 0) {
EPFilterSettings selFilterSet = nonEmptyFilters.get(selFilter - 1);
fireEvent(ureq, new PortfolioFilterEditEvent(selFilterSet));
}
}
}
use of org.olat.portfolio.model.EPFilterSettings in project OpenOLAT by OpenOLAT.
the class PortfolioFilterController method initFilterList.
private void initFilterList(FormItemContainer formLayout) {
List<EPFilterSettings> existingFilters = ePFMgr.getSavedFilterSettings(getIdentity());
for (Iterator<EPFilterSettings> existingFilterIt = existingFilters.iterator(); existingFilterIt.hasNext(); ) {
if (existingFilterIt.next().isFilterEmpty()) {
existingFilterIt.remove();
}
}
int amount = existingFilters.size() + 1;
nonEmptyFilters = new ArrayList<EPFilterSettings>(amount);
String[] theKeys = new String[amount];
String[] theValues = new String[amount];
String presetFilterIndex = theKeys[0] = "0";
theValues[0] = translate("filter.all");
int i = 1;
String presetFilterID = filterSettings.getFilterId();
for (EPFilterSettings epFilterSettings : existingFilters) {
theKeys[i] = epFilterSettings.getFilterId();
theValues[i] = epFilterSettings.getFilterName();
if (presetFilterID != null && presetFilterID.equals(epFilterSettings.getFilterId())) {
presetFilterIndex = epFilterSettings.getFilterId();
}
nonEmptyFilters.add(epFilterSettings);
i++;
}
// don't show anything if no filter exists
if (!nonEmptyFilters.isEmpty()) {
if (formLayout.getFormComponent("filter.select") == null) {
filterSel = uifactory.addDropdownSingleselect("filter.select", formLayout, theKeys, theValues, null);
filterSel.addActionListener(FormEvent.ONCHANGE);
} else {
filterSel.setKeysAndValues(theKeys, theValues, null);
filterSel.setVisible(true);
}
if (presetFilterIndex != null) {
filterSel.select(presetFilterIndex, true);
}
} else if (formLayout.getFormComponent("filter.select") != null) {
formLayout.getFormComponent("filter.select").setVisible(false);
}
}
Aggregations