Search in sources :

Example 16 with PortfolioElementRow

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

the class AbstractPageListController method disposeRows.

protected void disposeRows() {
    List<PortfolioElementRow> rows = model.getObjects();
    if (rows != null && rows.size() > 0) {
        for (PortfolioElementRow row : rows) {
            if (row.getPoster() != null) {
                row.getPoster().dispose();
                row.setPoster(null);
            }
        }
    }
}
Also used : PortfolioElementRow(org.olat.modules.portfolio.ui.model.PortfolioElementRow)

Example 17 with PortfolioElementRow

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

the class AbstractPageListController method getComponents.

@Override
public final Iterable<Component> getComponents(int row, Object rowObject) {
    PortfolioElementRow elRow = model.getObject(row);
    List<Component> components = new ArrayList<>(4);
    if (elRow.getNewEntryLink() != null) {
        components.add(elRow.getNewEntryLink().getComponent());
    }
    if (elRow.getNewFloatingEntryLink() != null) {
        components.add(elRow.getNewFloatingEntryLink().getComponent());
    }
    if (elRow.getNewAssignmentLink() != null) {
        components.add(elRow.getNewAssignmentLink().getComponent());
    }
    if (elRow.getOpenFormItem() != null) {
        components.add(elRow.getOpenFormItem().getComponent());
    }
    if (elRow.getReopenSectionLink() != null) {
        components.add(elRow.getReopenSectionLink().getComponent());
    }
    if (elRow.getCloseSectionLink() != null) {
        components.add(elRow.getCloseSectionLink().getComponent());
    }
    if (elRow.getEditAssignmentLink() != null) {
        components.add(elRow.getEditAssignmentLink().getComponent());
    }
    if (elRow.getDeleteAssignmentLink() != null) {
        components.add(elRow.getDeleteAssignmentLink().getComponent());
    }
    if (elRow.getUpAssignmentLink() != null) {
        components.add(elRow.getUpAssignmentLink().getComponent());
    }
    if (elRow.getDownAssignmentLink() != null) {
        components.add(elRow.getDownAssignmentLink().getComponent());
    }
    if (elRow.getMoveAssignmentLink() != null) {
        components.add(elRow.getMoveAssignmentLink().getComponent());
    }
    if (elRow.getInstantiateAssignmentLink() != null) {
        components.add(elRow.getInstantiateAssignmentLink().getComponent());
    }
    if (elRow.getCommentFormLink() != null) {
        components.add(elRow.getCommentFormLink().getComponent());
    }
    if (elRow.getPoster() != null) {
        components.add(elRow.getPoster());
    }
    if (elRow.getStartSelection() != null) {
        components.add(elRow.getStartSelection().getComponent());
    }
    return components;
}
Also used : PortfolioElementRow(org.olat.modules.portfolio.ui.model.PortfolioElementRow) ArrayList(java.util.ArrayList) Component(org.olat.core.gui.components.Component) ImageComponent(org.olat.core.gui.components.image.ImageComponent)

Example 18 with PortfolioElementRow

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

the class AbstractPageListController 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 ("Page".equalsIgnoreCase(resName) || "Entry".equalsIgnoreCase(resName)) {
        Long resId = entries.get(0).getOLATResourceable().getResourceableId();
        PortfolioElementRow activatedRow = null;
        for (PortfolioElementRow row : model.getObjects()) {
            if (row.getKey() != null && row.getKey().equals(resId)) {
                activatedRow = row;
                break;
            }
        }
        if (activatedRow != null) {
            doOpenRow(ureq, activatedRow, false);
        }
    } else if ("Section".equalsIgnoreCase(resName)) {
        Long resId = entries.get(0).getOLATResourceable().getResourceableId();
        for (PortfolioElementRow row : model.getObjects()) {
            if (row.getSection() != null && row.getSection().getKey().equals(resId)) {
                // doOpenPage(ureq, row);
                break;
            }
        }
    }
}
Also used : PortfolioElementRow(org.olat.modules.portfolio.ui.model.PortfolioElementRow)

Example 19 with PortfolioElementRow

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

the class BinderOnePageController method loadSection.

private void loadSection(Section section) {
    String id = "section_" + (++counter);
    VelocityContainer rowVC = createVelocityContainer(id, "portfolio_element_row");
    AssessmentSection assessmentSection = null;
    PortfolioElementRow row = new PortfolioElementRow(section, assessmentSection, false, false);
    rowVC.contextPut("row", row);
    rowVC.contextPut("rowIndex", 0);
    mainVC.put(id, rowVC);
    components.add(id);
}
Also used : PortfolioElementRow(org.olat.modules.portfolio.ui.model.PortfolioElementRow) AssessmentSection(org.olat.modules.portfolio.AssessmentSection) VelocityContainer(org.olat.core.gui.components.velocity.VelocityContainer)

Example 20 with PortfolioElementRow

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

the class DeletedPageListController method loadModel.

@Override
protected void loadModel(UserRequest ureq, String searchString) {
    Map<Long, Long> numberOfCommentsMap = portfolioService.getNumberOfCommentsOnOwnedPage(getIdentity());
    List<CategoryToElement> categorizedElements = portfolioService.getCategorizedOwnedPages(getIdentity());
    Map<OLATResourceable, List<Category>> categorizedElementMap = new HashMap<>();
    for (CategoryToElement categorizedElement : categorizedElements) {
        List<Category> categories = categorizedElementMap.get(categorizedElement.getCategorizedResource());
        if (categories == null) {
            categories = new ArrayList<>();
            categorizedElementMap.put(categorizedElement.getCategorizedResource(), categories);
        }
        categories.add(categorizedElement.getCategory());
    }
    List<Page> pages = portfolioService.searchDeletedPages(getIdentity(), searchString);
    List<PortfolioElementRow> rows = new ArrayList<>(pages.size());
    for (Page page : pages) {
        rows.add(forgePageRow(ureq, page, null, null, categorizedElementMap, numberOfCommentsMap, true));
    }
    // clean up the posters
    disposeRows();
    model.setObjects(rows);
    tableEl.reset();
    tableEl.reloadData();
    deleteButton.setVisible(tableEl.getRendererType() == FlexiTableRendererType.classic && model.getRowCount() > 0);
}
Also used : PortfolioElementRow(org.olat.modules.portfolio.ui.model.PortfolioElementRow) Category(org.olat.modules.portfolio.Category) OLATResourceable(org.olat.core.id.OLATResourceable) HashMap(java.util.HashMap) CategoryToElement(org.olat.modules.portfolio.CategoryToElement) ArrayList(java.util.ArrayList) Page(org.olat.modules.portfolio.Page) ArrayList(java.util.ArrayList) List(java.util.List)

Aggregations

PortfolioElementRow (org.olat.modules.portfolio.ui.model.PortfolioElementRow)48 ArrayList (java.util.ArrayList)16 FormLink (org.olat.core.gui.components.form.flexible.elements.FormLink)14 AssessmentSection (org.olat.modules.portfolio.AssessmentSection)12 Section (org.olat.modules.portfolio.Section)12 SelectionEvent (org.olat.core.gui.components.form.flexible.impl.elements.table.SelectionEvent)10 OLATResourceable (org.olat.core.id.OLATResourceable)10 List (java.util.List)8 Assignment (org.olat.modules.portfolio.Assignment)8 Category (org.olat.modules.portfolio.Category)8 Page (org.olat.modules.portfolio.Page)8 HashMap (java.util.HashMap)6 Component (org.olat.core.gui.components.Component)6 FlexiTableRenderEvent (org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableRenderEvent)6 VelocityContainer (org.olat.core.gui.components.velocity.VelocityContainer)6 ContextEntry (org.olat.core.id.context.ContextEntry)6 CategoryToElement (org.olat.modules.portfolio.CategoryToElement)6 TimelinePoint (org.olat.modules.portfolio.ui.component.TimelinePoint)6 Map (java.util.Map)4 Set (java.util.Set)4