Search in sources :

Example 1 with MySharedItemRow

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

the class MySharedItemsController method formInnerEvent.

@Override
protected void formInnerEvent(UserRequest ureq, FormItem source, FormEvent event) {
    if (tableEl == source) {
        if (event instanceof SelectionEvent) {
            SelectionEvent se = (SelectionEvent) event;
            String cmd = se.getCommand();
            MySharedItemRow row = model.getObject(se.getIndex());
            if ("select".equals(cmd)) {
                Activateable2 activateable = doSelectBinder(ureq, row);
                if (activateable != null) {
                    activateable.activate(ureq, null, null);
                }
            }
        } else if (event instanceof FlexiTableSearchEvent) {
            FlexiTableSearchEvent se = (FlexiTableSearchEvent) event;
            loadModel(se.getSearch());
        }
    }
    super.formInnerEvent(ureq, source, event);
}
Also used : MySharedItemRow(org.olat.modules.portfolio.model.MySharedItemRow) Activateable2(org.olat.core.gui.control.generic.dtabs.Activateable2) SelectionEvent(org.olat.core.gui.components.form.flexible.impl.elements.table.SelectionEvent) FlexiTableSearchEvent(org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableSearchEvent)

Example 2 with MySharedItemRow

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

the class MySharedItemsController method loadModel.

private void loadModel(String searchString) {
    List<Binder> portfolios = portfolioService.searchSharedBindersBy(getIdentity(), searchString);
    List<MySharedItemRow> rows = new ArrayList<>(portfolios.size());
    for (Binder binder : portfolios) {
        MySharedItemRow row = new MySharedItemRow();
        row.setBinderKey(binder.getKey());
        row.setBinderTitle(binder.getTitle());
        // TODO max()
        row.setLastModified(binder.getLastModified());
        if (binder.getEntry() != null) {
            row.setCourseDisplayName(binder.getEntry().getDisplayname());
        }
        rows.add(row);
    }
    model.setObjects(rows);
    tableEl.reset();
    tableEl.reloadData();
}
Also used : MySharedItemRow(org.olat.modules.portfolio.model.MySharedItemRow) Binder(org.olat.modules.portfolio.Binder) ArrayList(java.util.ArrayList)

Example 3 with MySharedItemRow

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

the class MySharedItemsController method activate.

@Override
public void activate(UserRequest ureq, List<ContextEntry> entries, StateEntry state) {
    if (entries == null || entries.isEmpty())
        return;
    String resName = entries.get(0).getOLATResourceable().getResourceableTypeName();
    if ("Binder".equalsIgnoreCase(resName)) {
        Long resId = entries.get(0).getOLATResourceable().getResourceableId();
        MySharedItemRow activatedRow = null;
        for (MySharedItemRow row : model.getObjects()) {
            if (row.getBinderKey().equals(resId)) {
                activatedRow = row;
                break;
            }
        }
        if (activatedRow != null) {
            Activateable2 activeateable = doSelectBinder(ureq, activatedRow);
            if (activeateable != null) {
                List<ContextEntry> subEntries = entries.subList(1, entries.size());
                activeateable.activate(ureq, subEntries, entries.get(0).getTransientState());
            }
        }
    }
}
Also used : MySharedItemRow(org.olat.modules.portfolio.model.MySharedItemRow) Activateable2(org.olat.core.gui.control.generic.dtabs.Activateable2) ContextEntry(org.olat.core.id.context.ContextEntry)

Example 4 with MySharedItemRow

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

the class MySharedItemsController method formInnerEvent.

@Override
protected void formInnerEvent(UserRequest ureq, FormItem source, FormEvent event) {
    if (tableEl == source) {
        if (event instanceof SelectionEvent) {
            SelectionEvent se = (SelectionEvent) event;
            String cmd = se.getCommand();
            MySharedItemRow row = model.getObject(se.getIndex());
            if ("select".equals(cmd)) {
                Activateable2 activateable = doSelectBinder(ureq, row);
                if (activateable != null) {
                    activateable.activate(ureq, null, null);
                }
            }
        } else if (event instanceof FlexiTableSearchEvent) {
            FlexiTableSearchEvent se = (FlexiTableSearchEvent) event;
            loadModel(se.getSearch());
        }
    }
    super.formInnerEvent(ureq, source, event);
}
Also used : MySharedItemRow(org.olat.modules.portfolio.model.MySharedItemRow) Activateable2(org.olat.core.gui.control.generic.dtabs.Activateable2) SelectionEvent(org.olat.core.gui.components.form.flexible.impl.elements.table.SelectionEvent) FlexiTableSearchEvent(org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableSearchEvent)

Example 5 with MySharedItemRow

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

the class MySharedItemsController method loadModel.

private void loadModel(String searchString) {
    List<Binder> portfolios = portfolioService.searchSharedBindersBy(getIdentity(), searchString);
    List<MySharedItemRow> rows = new ArrayList<>(portfolios.size());
    for (Binder binder : portfolios) {
        MySharedItemRow row = new MySharedItemRow();
        row.setBinderKey(binder.getKey());
        row.setBinderTitle(binder.getTitle());
        // TODO max()
        row.setLastModified(binder.getLastModified());
        if (binder.getEntry() != null) {
            row.setCourseDisplayName(binder.getEntry().getDisplayname());
        }
        rows.add(row);
    }
    model.setObjects(rows);
    tableEl.reset();
    tableEl.reloadData();
}
Also used : MySharedItemRow(org.olat.modules.portfolio.model.MySharedItemRow) Binder(org.olat.modules.portfolio.Binder) ArrayList(java.util.ArrayList)

Aggregations

MySharedItemRow (org.olat.modules.portfolio.model.MySharedItemRow)6 Activateable2 (org.olat.core.gui.control.generic.dtabs.Activateable2)4 ArrayList (java.util.ArrayList)2 FlexiTableSearchEvent (org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableSearchEvent)2 SelectionEvent (org.olat.core.gui.components.form.flexible.impl.elements.table.SelectionEvent)2 ContextEntry (org.olat.core.id.context.ContextEntry)2 Binder (org.olat.modules.portfolio.Binder)2