Search in sources :

Example 1 with MediaRow

use of org.olat.modules.portfolio.ui.model.MediaRow in project OpenOLAT by OpenOLAT.

the class MediaDataModel method filter.

@Override
public void filter(List<FlexiTableFilter> filters) {
    String key = filters == null || filters.isEmpty() || filters.get(0) == null ? null : filters.get(0).getFilter();
    if (StringHelper.containsNonWhitespace(key) && !"showall".equals(key)) {
        List<MediaRow> filteredRows = new ArrayList<>();
        for (MediaRow row : backups) {
            if (key.equals(row.getType())) {
                filteredRows.add(row);
            }
        }
        super.setObjects(filteredRows);
    } else {
        super.setObjects(backups);
    }
}
Also used : ArrayList(java.util.ArrayList) MediaRow(org.olat.modules.portfolio.ui.model.MediaRow)

Example 2 with MediaRow

use of org.olat.modules.portfolio.ui.model.MediaRow in project OpenOLAT by OpenOLAT.

the class MediaCenterController method formInnerEvent.

@Override
protected void formInnerEvent(UserRequest ureq, FormItem source, FormEvent event) {
    if (source == tableEl) {
        if (event instanceof SelectionEvent) {
            SelectionEvent se = (SelectionEvent) event;
            String cmd = se.getCommand();
            MediaRow row = model.getObject(se.getIndex());
            if ("select".equals(cmd)) {
                if (select) {
                    doSelect(ureq, row.getKey());
                } else {
                    Activateable2 activateable = doOpenMedia(ureq, row.getKey());
                    if (activateable != null) {
                        activateable.activate(ureq, null, null);
                    }
                }
            }
        } else if (event instanceof FlexiTableSearchEvent) {
            loadModel();
        }
    } else if (newMediaCallout == source) {
        doOpenNewMediaCallout(ureq, newMediaCallout);
    } else if (source instanceof FormLink) {
        FormLink link = (FormLink) source;
        String cmd = link.getCmd();
        if ("select".equals(cmd)) {
            MediaRow row = (MediaRow) link.getUserObject();
            if (select) {
                doSelect(ureq, row.getKey());
            } else {
                Activateable2 activateable = doOpenMedia(ureq, row.getKey());
                if (activateable != null) {
                    activateable.activate(ureq, null, null);
                }
            }
        } else if ("tag".equals(cmd)) {
            doToggleCategory(link);
        }
    }
    super.formInnerEvent(ureq, source, event);
}
Also used : Activateable2(org.olat.core.gui.control.generic.dtabs.Activateable2) SelectionEvent(org.olat.core.gui.components.form.flexible.impl.elements.table.SelectionEvent) MediaSelectionEvent(org.olat.modules.portfolio.ui.event.MediaSelectionEvent) FlexiTableSearchEvent(org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableSearchEvent) FormLink(org.olat.core.gui.components.form.flexible.elements.FormLink) MediaRow(org.olat.modules.portfolio.ui.model.MediaRow)

Example 3 with MediaRow

use of org.olat.modules.portfolio.ui.model.MediaRow in project OpenOLAT by OpenOLAT.

the class MediaTypeCellRenderer method render.

@Override
public void render(Renderer renderer, StringOutput target, Object cellValue, int row, FlexiTableComponent source, URLBuilder ubu, Translator translator) {
    if (cellValue instanceof MediaRow) {
        MediaRow mRow = (MediaRow) cellValue;
        MediaHandler handler = handlersMap.get(mRow.getType());
        if (handler != null) {
            target.append("<i class='o_icon o_icon-lg ").append(handler.getIconCssClass(mRow)).append("'> </i>");
        }
    }
}
Also used : MediaHandler(org.olat.modules.portfolio.MediaHandler) MediaRow(org.olat.modules.portfolio.ui.model.MediaRow)

Example 4 with MediaRow

use of org.olat.modules.portfolio.ui.model.MediaRow in project openolat by klemens.

the class MediaCenterController method getComponents.

@Override
public Iterable<Component> getComponents(int row, Object rowObject) {
    MediaRow mediaRow = model.getObject(row);
    List<Component> components = new ArrayList<>(2);
    if (mediaRow.getOpenFormItem() != null) {
        components.add(mediaRow.getOpenFormItem().getComponent());
    }
    return components;
}
Also used : ArrayList(java.util.ArrayList) Component(org.olat.core.gui.components.Component) MediaRow(org.olat.modules.portfolio.ui.model.MediaRow)

Example 5 with MediaRow

use of org.olat.modules.portfolio.ui.model.MediaRow in project openolat by klemens.

the class MediaDataModel method filter.

@Override
public void filter(List<FlexiTableFilter> filters) {
    String key = filters == null || filters.isEmpty() || filters.get(0) == null ? null : filters.get(0).getFilter();
    if (StringHelper.containsNonWhitespace(key) && !"showall".equals(key)) {
        List<MediaRow> filteredRows = new ArrayList<>();
        for (MediaRow row : backups) {
            if (key.equals(row.getType())) {
                filteredRows.add(row);
            }
        }
        super.setObjects(filteredRows);
    } else {
        super.setObjects(backups);
    }
}
Also used : ArrayList(java.util.ArrayList) MediaRow(org.olat.modules.portfolio.ui.model.MediaRow)

Aggregations

MediaRow (org.olat.modules.portfolio.ui.model.MediaRow)10 ArrayList (java.util.ArrayList)6 Component (org.olat.core.gui.components.Component)4 FormLink (org.olat.core.gui.components.form.flexible.elements.FormLink)4 FlexiTableSearchEvent (org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableSearchEvent)4 SelectionEvent (org.olat.core.gui.components.form.flexible.impl.elements.table.SelectionEvent)4 Activateable2 (org.olat.core.gui.control.generic.dtabs.Activateable2)4 MediaSelectionEvent (org.olat.modules.portfolio.ui.event.MediaSelectionEvent)4 HashSet (java.util.HashSet)2 List (java.util.List)2 Map (java.util.Map)2 Set (java.util.Set)2 Collectors (java.util.stream.Collectors)2 HttpServletRequest (javax.servlet.http.HttpServletRequest)2 SortKey (org.olat.core.commons.persistence.SortKey)2 Size (org.olat.core.commons.services.image.Size)2 Mapper (org.olat.core.dispatcher.mapper.Mapper)2 UserRequest (org.olat.core.gui.UserRequest)2 FormItem (org.olat.core.gui.components.form.flexible.FormItem)2 FormItemContainer (org.olat.core.gui.components.form.flexible.FormItemContainer)2