Search in sources :

Example 6 with PercentCellRenderer

use of org.olat.modules.lecture.ui.component.PercentCellRenderer in project openolat by klemens.

the class ParticipantLecturesOverviewController method initForm.

@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
    if (withPrint && formLayout instanceof FormLayoutContainer) {
        FormLayoutContainer layoutCont = (FormLayoutContainer) formLayout;
        layoutCont.contextPut("winid", "w" + layoutCont.getFormItemComponent().getDispatchID());
        layoutCont.getFormItemComponent().addListener(this);
        layoutCont.getFormItemComponent().contextPut("withPrint", Boolean.TRUE);
        if (withTitle) {
            setFormTitle("menu.my.lectures.alt");
        }
    } else if (withTitle) {
        setFormTitle("lectures.print.title", new String[] { StringHelper.escapeHtml(userManager.getUserDisplayName(assessedIdentity)) });
    }
    if (withLog) {
        logButton = uifactory.addFormLink("log", formLayout, Link.BUTTON);
        logButton.setIconLeftCSS("o_icon o_icon_log");
    }
    if (formLayout instanceof FormLayoutContainer) {
        FormLayoutContainer layoutCont = (FormLayoutContainer) formLayout;
        layoutCont.contextPut("authorizedAbsenceEnabled", authorizedAbsenceEnabled);
    }
    FlexiTableColumnModel columnsModel = FlexiTableDataModelFactory.createFlexiTableColumnModel();
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(LecturesCols.externalRef, "details"));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(LecturesCols.entry, "details"));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(LecturesCols.plannedLectures));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(LecturesCols.attendedLectures));
    if (authorizedAbsenceEnabled) {
        columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(LecturesCols.unauthorizedAbsentLectures));
        columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(LecturesCols.authorizedAbsentLectures));
    } else {
        columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(LecturesCols.absentLectures));
    }
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(LecturesCols.progress, new LectureStatisticsCellRenderer()));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(LecturesCols.rateWarning, new RateWarningCellRenderer(getTranslator())));
    DefaultFlexiColumnModel rateColumn = new DefaultFlexiColumnModel(LecturesCols.rate, new PercentCellRenderer());
    rateColumn.setFooterCellRenderer(new PercentCellRenderer());
    columnsModel.addFlexiColumnModel(rateColumn);
    if (withSelect) {
        columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel("details", translate("details"), "details"));
    }
    tableModel = new ParticipantLecturesDataModel(columnsModel, getTranslator(), getLocale());
    int paging = withPrint ? 20 : -1;
    tableEl = uifactory.addTableElement(getWindowControl(), "table", tableModel, paging, false, getTranslator(), formLayout);
    tableEl.setAndLoadPersistedPreferences(ureq, "participant-lectures-overview");
    tableEl.setCustomizeColumns(false);
    tableEl.setEmtpyTableMessageKey("empty.lectures.list");
    tableEl.setFooter(true);
}
Also used : LectureStatisticsCellRenderer(org.olat.modules.lecture.ui.component.LectureStatisticsCellRenderer) RateWarningCellRenderer(org.olat.modules.lecture.ui.component.RateWarningCellRenderer) FormLayoutContainer(org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer) FlexiTableColumnModel(org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableColumnModel) DefaultFlexiColumnModel(org.olat.core.gui.components.form.flexible.impl.elements.table.DefaultFlexiColumnModel) PercentCellRenderer(org.olat.modules.lecture.ui.component.PercentCellRenderer)

Aggregations

DefaultFlexiColumnModel (org.olat.core.gui.components.form.flexible.impl.elements.table.DefaultFlexiColumnModel)6 FlexiTableColumnModel (org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableColumnModel)6 PercentCellRenderer (org.olat.modules.lecture.ui.component.PercentCellRenderer)6 FormLayoutContainer (org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer)4 LectureStatisticsCellRenderer (org.olat.modules.lecture.ui.component.LectureStatisticsCellRenderer)4 RateWarningCellRenderer (org.olat.modules.lecture.ui.component.RateWarningCellRenderer)4 UserPropertyHandler (org.olat.user.propertyhandlers.UserPropertyHandler)4 SortKey (org.olat.core.commons.persistence.SortKey)2 FlexiTableSortOptions (org.olat.core.gui.components.form.flexible.elements.FlexiTableSortOptions)2 FlexiColumnModel (org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiColumnModel)2 StaticFlexiCellRenderer (org.olat.core.gui.components.form.flexible.impl.elements.table.StaticFlexiCellRenderer)2 AggregatedLectureBlocksStatistics (org.olat.modules.lecture.model.AggregatedLectureBlocksStatistics)2 LongCellRenderer (org.olat.modules.lecture.ui.component.LongCellRenderer)2 ParticipantInfosRenderer (org.olat.modules.lecture.ui.component.ParticipantInfosRenderer)2