Search in sources :

Example 6 with ShortName

use of org.olat.core.gui.ShortName in project openolat by klemens.

the class RepositorySearchController method updateFilters.

protected void updateFilters(List<RepositoryEntry> entries, Identity owner) {
    List<ShortName> restrictedTypes = new ArrayList<ShortName>();
    Set<String> uniqueTypes = new HashSet<String>();
    for (RepositoryEntry entry : entries) {
        // no red screen for that
        if (entry.getOlatResource() == null)
            continue;
        String type = entry.getOlatResource().getResourceableTypeName();
        if (type != null && !uniqueTypes.contains(type)) {
            String label = translate(type);
            restrictedTypes.add(new TypeFilter(type, label, owner));
            uniqueTypes.add(type);
        }
    }
    if (restrictedTypes.size() > 1) {
        tableCtr.setFilters(restrictedTypes, null);
    } else {
        tableCtr.setFilters(null, null);
    }
}
Also used : ArrayList(java.util.ArrayList) ShortName(org.olat.core.gui.ShortName) RepositoryEntry(org.olat.repository.RepositoryEntry) HashSet(java.util.HashSet)

Aggregations

ShortName (org.olat.core.gui.ShortName)6 ArrayList (java.util.ArrayList)4 HashSet (java.util.HashSet)4 BigDecimal (java.math.BigDecimal)2 Date (java.util.Date)2 HashMap (java.util.HashMap)2 Map (java.util.Map)2 FormLayoutContainer (org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer)2 CustomRenderColumnDescriptor (org.olat.core.gui.components.table.CustomRenderColumnDescriptor)2 DefaultColumnDescriptor (org.olat.core.gui.components.table.DefaultColumnDescriptor)2 StaticColumnDescriptor (org.olat.core.gui.components.table.StaticColumnDescriptor)2 TableController (org.olat.core.gui.components.table.TableController)2 TableGuiConfiguration (org.olat.core.gui.components.table.TableGuiConfiguration)2 User (org.olat.core.id.User)2 Formatter (org.olat.core.util.Formatter)2 DBMailLight (org.olat.core.util.mail.model.DBMailLight)2 RepositoryEntry (org.olat.repository.RepositoryEntry)2