Search in sources :

Example 1 with PageCols

use of org.olat.modules.portfolio.ui.PageListDataModel.PageCols in project openolat by klemens.

the class PageListSortableDataModelDelegate method sort.

@Override
protected void sort(List<PortfolioElementRow> rows) {
    Comparator<PortfolioElementRow> comparator = new PageCreationDateComparator();
    if (getOrderBy() != null) {
        int columnIndex = getColumnIndex();
        PageCols column = PageCols.values()[columnIndex];
        switch(column) {
            case key:
                comparator = new PageCreationDateComparator();
                break;
            case status:
                comparator = new StatusComparator();
                break;
            case comment:
                comparator = new CommentsComparator();
                break;
            default:
                comparator = new DefaultComparator();
                break;
        }
    }
    if (!isAsc()) {
        comparator = new ReverseComparator(comparator);
    }
    Collections.sort(rows, new ClassicComparator(comparator));
}
Also used : PortfolioElementRow(org.olat.modules.portfolio.ui.model.PortfolioElementRow) PageCols(org.olat.modules.portfolio.ui.PageListDataModel.PageCols)

Example 2 with PageCols

use of org.olat.modules.portfolio.ui.PageListDataModel.PageCols in project OpenOLAT by OpenOLAT.

the class PageListSortableDataModelDelegate method sort.

@Override
protected void sort(List<PortfolioElementRow> rows) {
    Comparator<PortfolioElementRow> comparator = new PageCreationDateComparator();
    if (getOrderBy() != null) {
        int columnIndex = getColumnIndex();
        PageCols column = PageCols.values()[columnIndex];
        switch(column) {
            case key:
                comparator = new PageCreationDateComparator();
                break;
            case status:
                comparator = new StatusComparator();
                break;
            case comment:
                comparator = new CommentsComparator();
                break;
            default:
                comparator = new DefaultComparator();
                break;
        }
    }
    if (!isAsc()) {
        comparator = new ReverseComparator(comparator);
    }
    Collections.sort(rows, new ClassicComparator(comparator));
}
Also used : PortfolioElementRow(org.olat.modules.portfolio.ui.model.PortfolioElementRow) PageCols(org.olat.modules.portfolio.ui.PageListDataModel.PageCols)

Aggregations

PageCols (org.olat.modules.portfolio.ui.PageListDataModel.PageCols)2 PortfolioElementRow (org.olat.modules.portfolio.ui.model.PortfolioElementRow)2