Search in sources :

Example 51 with StaticFlexiCellRenderer

use of org.olat.core.gui.components.form.flexible.impl.elements.table.StaticFlexiCellRenderer in project openolat by klemens.

the class GTAAvailableTaskController method initForm.

@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
    FlexiTableColumnModel columnsModel = FlexiTableDataModelFactory.createFlexiTableColumnModel();
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(ATDCols.title.i18nKey(), ATDCols.title.ordinal()));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(ATDCols.description.i18nKey(), ATDCols.description.ordinal(), new DescriptionWithTooltipCellRenderer()));
    boolean preview = gtaNode.getModuleConfiguration().getBooleanSafe(GTACourseNode.GTASK_PREVIEW);
    if (preview) {
        columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(ATDCols.preview.i18nKey(), ATDCols.preview.ordinal()));
    }
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel("select", -1, "select", new StaticFlexiCellRenderer(translate("select"), "select", "btn btn-primary", "o_icon o_icon_submit")));
    taskModel = new AvailableTaskTableModel(columnsModel);
    tableEl = uifactory.addTableElement(getWindowControl(), "table", taskModel, getTranslator(), formLayout);
    tableEl.setCustomizeColumns(false);
    tableEl.setNumOfRowsEnabled(false);
    formLayout.add("table", tableEl);
    loadModel();
}
Also used : StaticFlexiCellRenderer(org.olat.core.gui.components.form.flexible.impl.elements.table.StaticFlexiCellRenderer) FlexiTableColumnModel(org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableColumnModel) DefaultFlexiColumnModel(org.olat.core.gui.components.form.flexible.impl.elements.table.DefaultFlexiColumnModel) DescriptionWithTooltipCellRenderer(org.olat.course.nodes.gta.ui.component.DescriptionWithTooltipCellRenderer)

Example 52 with StaticFlexiCellRenderer

use of org.olat.core.gui.components.form.flexible.impl.elements.table.StaticFlexiCellRenderer in project openolat by klemens.

the class AbstractAssignmentEditController method initForm.

@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
    // tasks
    String tasksPage = velocity_root + "/edit_task_list.html";
    FormLayoutContainer tasksCont = FormLayoutContainer.createCustomFormLayout("tasks", getTranslator(), tasksPage);
    tasksCont.setRootForm(mainForm);
    formLayout.add(tasksCont);
    addTaskLink = uifactory.addFormLink("add.task", tasksCont, Link.BUTTON);
    addTaskLink.setElementCssClass("o_sel_course_gta_add_task");
    addTaskLink.setIconLeftCSS("o_icon o_icon_upload");
    addTaskLink.setVisible(!readOnly);
    createTaskLink = uifactory.addFormLink("create.task", tasksCont, Link.BUTTON);
    createTaskLink.setElementCssClass("o_sel_course_gta_create_task");
    createTaskLink.setIconLeftCSS("o_icon o_icon_edit");
    createTaskLink.setVisible(!readOnly);
    FlexiTableColumnModel columnsModel = FlexiTableDataModelFactory.createFlexiTableColumnModel();
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(TDCols.title.i18nKey(), TDCols.title.ordinal()));
    fileExistsRenderer = new WarningFlexiCellRenderer();
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(TDCols.file.i18nKey(), TDCols.file.ordinal(), fileExistsRenderer));
    if (!readOnly) {
        columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel("table.header.edit", TDCols.edit.ordinal(), "edit", new BooleanCellRenderer(new StaticFlexiCellRenderer(translate("edit"), "edit"), new StaticFlexiCellRenderer(translate("replace"), "edit"))));
        columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel("table.header.edit", translate("delete"), "delete"));
    }
    taskModel = new TaskDefinitionTableModel(columnsModel);
    taskDefTableEl = uifactory.addTableElement(getWindowControl(), "taskTable", taskModel, getTranslator(), tasksCont);
    taskDefTableEl.setExportEnabled(true);
    updateModel();
}
Also used : StaticFlexiCellRenderer(org.olat.core.gui.components.form.flexible.impl.elements.table.StaticFlexiCellRenderer) BooleanCellRenderer(org.olat.core.gui.components.form.flexible.impl.elements.table.BooleanCellRenderer) 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)

Example 53 with StaticFlexiCellRenderer

use of org.olat.core.gui.components.form.flexible.impl.elements.table.StaticFlexiCellRenderer in project openolat by klemens.

the class ParticipantLectureBlocksController method initForm.

@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
    if (formLayout instanceof FormLayoutContainer) {
        FormLayoutContainer layoutCont = (FormLayoutContainer) formLayout;
        if (withPrint) {
            layoutCont.contextPut("winid", "w" + layoutCont.getFormItemComponent().getDispatchID());
            layoutCont.getFormItemComponent().addListener(this);
            layoutCont.getFormItemComponent().contextPut("withPrint", Boolean.TRUE);
            layoutCont.contextPut("title", StringHelper.escapeHtml(entry.getDisplayname()));
            openCourseButton = uifactory.addFormLink("open.course", formLayout, Link.BUTTON);
            openCourseButton.setIconLeftCSS("o_icon o_CourseModule_icon");
        } else {
            layoutCont.contextPut("title", translate("lectures.repository.print.title", new String[] { StringHelper.escapeHtml(entry.getDisplayname()), StringHelper.escapeHtml(userManager.getUserDisplayName(assessedIdentity)) }));
        }
        layoutCont.contextPut("authorizedAbsenceEnabled", authorizedAbsenceEnabled);
    }
    FlexiTableColumnModel columnsModel = FlexiTableDataModelFactory.createFlexiTableColumnModel();
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(ParticipantCols.date, new DateFlexiCellRenderer(getLocale())));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(ParticipantCols.entry));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(ParticipantCols.lectureBlock));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(ParticipantCols.coach));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(ParticipantCols.plannedLectures, new LecturesCompulsoryRenderer()));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(ParticipantCols.attendedLectures));
    if (authorizedAbsenceEnabled) {
        columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(ParticipantCols.unauthorizedAbsentLectures));
        columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(ParticipantCols.authorizedAbsentLectures));
    } else {
        columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(ParticipantCols.absentLectures));
    }
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(ParticipantCols.status, new LectureBlockRollCallStatusCellRenderer(authorizedAbsenceEnabled, absenceDefaultAuthorized, getTranslator())));
    if (appealEnabled && withAppeal && assessedIdentity.equals(getIdentity())) {
        columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel("appeal", ParticipantCols.appeal.ordinal(), "appeal", new BooleanCellRenderer(new StaticFlexiCellRenderer(translate("appeal"), "appeal"), null)));
    }
    tableModel = new ParticipantLectureBlocksDataModel(columnsModel, authorizedAbsenceEnabled, absenceDefaultAuthorized, getLocale());
    int paging = withPrint ? 20 : -1;
    tableEl = uifactory.addTableElement(getWindowControl(), "table", tableModel, paging, false, getTranslator(), formLayout);
    FlexiTableSortOptions options = new FlexiTableSortOptions();
    options.setDefaultOrderBy(new SortKey(ParticipantCols.date.name(), true));
    tableEl.setSortSettings(options);
    tableEl.setCustomizeColumns(withPrint);
    tableEl.setAndLoadPersistedPreferences(ureq, "participant-roll-call-appeal");
    tableEl.setEmtpyTableMessageKey("empty.repository.entry.lectures");
    List<FlexiTableFilter> filters = new ArrayList<>();
    filters.add(new FlexiTableFilter(translate("filter.showAll"), "showAll", true));
    filters.add(new FlexiTableFilter(translate("filter.mandatory"), "mandatory"));
    tableEl.setFilters("", filters, false);
}
Also used : DateFlexiCellRenderer(org.olat.core.gui.components.form.flexible.impl.elements.table.DateFlexiCellRenderer) FlexiTableSortOptions(org.olat.core.gui.components.form.flexible.elements.FlexiTableSortOptions) ArrayList(java.util.ArrayList) FormLayoutContainer(org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer) SortKey(org.olat.core.commons.persistence.SortKey) StaticFlexiCellRenderer(org.olat.core.gui.components.form.flexible.impl.elements.table.StaticFlexiCellRenderer) BooleanCellRenderer(org.olat.core.gui.components.form.flexible.impl.elements.table.BooleanCellRenderer) FlexiTableFilter(org.olat.core.gui.components.form.flexible.elements.FlexiTableFilter) FlexiTableColumnModel(org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableColumnModel) LecturesCompulsoryRenderer(org.olat.modules.lecture.ui.component.LecturesCompulsoryRenderer) LectureBlockRollCallStatusCellRenderer(org.olat.modules.lecture.ui.component.LectureBlockRollCallStatusCellRenderer) DefaultFlexiColumnModel(org.olat.core.gui.components.form.flexible.impl.elements.table.DefaultFlexiColumnModel)

Example 54 with StaticFlexiCellRenderer

use of org.olat.core.gui.components.form.flexible.impl.elements.table.StaticFlexiCellRenderer in project openolat by klemens.

the class LectureListRepositoryController method initForm.

@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
    if (!lectureManagementManaged) {
        addLectureButton = uifactory.addFormLink("add.lecture", formLayout, Link.BUTTON);
        addLectureButton.setIconLeftCSS("o_icon o_icon_add");
        addLectureButton.setElementCssClass("o_sel_repo_add_lecture");
        deleteLecturesButton = uifactory.addFormLink("delete", formLayout, Link.BUTTON);
    }
    FlexiTableColumnModel columnsModel = FlexiTableDataModelFactory.createFlexiTableColumnModel();
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(false, BlockCols.id));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(BlockCols.title));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(BlockCols.location));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(BlockCols.date, new DateFlexiCellRenderer(getLocale())));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(BlockCols.startTime, new TimeFlexiCellRenderer(getLocale())));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(BlockCols.endTime, new TimeFlexiCellRenderer(getLocale())));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(BlockCols.teachers));
    if (lectureManagementManaged) {
        // edit check it
        columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel("details", translate("details"), "edit"));
    } else {
        DefaultFlexiColumnModel editColumn = new DefaultFlexiColumnModel("table.header.edit", -1, "edit", new StaticFlexiCellRenderer("", "edit", "o_icon o_icon-lg o_icon_edit", translate("edit"), null));
        editColumn.setExportable(false);
        editColumn.setAlwaysVisible(true);
        columnsModel.addFlexiColumnModel(editColumn);
        DefaultFlexiColumnModel toolsColumn = new DefaultFlexiColumnModel(BlockCols.tools);
        toolsColumn.setExportable(false);
        toolsColumn.setAlwaysVisible(true);
        columnsModel.addFlexiColumnModel(toolsColumn);
    }
    tableModel = new LectureListRepositoryDataModel(columnsModel, getLocale());
    tableEl = uifactory.addTableElement(getWindowControl(), "table", tableModel, 20, false, getTranslator(), formLayout);
    tableEl.setExportEnabled(true);
    tableEl.setMultiSelect(true);
    tableEl.setSelectAllEnable(true);
    tableEl.setEmtpyTableMessageKey("empty.table.lectures.blocks.admin");
    FlexiTableSortOptions options = new FlexiTableSortOptions();
    options.setDefaultOrderBy(new SortKey(BlockCols.date.name(), false));
    tableEl.setSortSettings(options);
    tableEl.setAndLoadPersistedPreferences(ureq, "repo-lecture-block-list");
}
Also used : DateFlexiCellRenderer(org.olat.core.gui.components.form.flexible.impl.elements.table.DateFlexiCellRenderer) FlexiTableSortOptions(org.olat.core.gui.components.form.flexible.elements.FlexiTableSortOptions) TimeFlexiCellRenderer(org.olat.core.gui.components.form.flexible.impl.elements.table.TimeFlexiCellRenderer) StaticFlexiCellRenderer(org.olat.core.gui.components.form.flexible.impl.elements.table.StaticFlexiCellRenderer) FlexiTableColumnModel(org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableColumnModel) SortKey(org.olat.core.commons.persistence.SortKey) DefaultFlexiColumnModel(org.olat.core.gui.components.form.flexible.impl.elements.table.DefaultFlexiColumnModel)

Example 55 with StaticFlexiCellRenderer

use of org.olat.core.gui.components.form.flexible.impl.elements.table.StaticFlexiCellRenderer in project openolat by klemens.

the class ParticipantListRepositoryController method initForm.

@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
    if (formLayout instanceof FormLayoutContainer && !printView) {
        FormLayoutContainer layoutCont = (FormLayoutContainer) formLayout;
        layoutCont.contextPut("winid", "w" + layoutCont.getFormItemComponent().getDispatchID());
        layoutCont.getFormItemComponent().addListener(this);
        layoutCont.getFormItemComponent().contextPut("withPrint", Boolean.TRUE);
    }
    FlexiTableSortOptions options = new FlexiTableSortOptions();
    FlexiTableColumnModel columnsModel = FlexiTableDataModelFactory.createFlexiTableColumnModel();
    if (isAdministrativeUser) {
        columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(ParticipantsCols.username));
        options.setDefaultOrderBy(new SortKey(ParticipantsCols.username.sortKey(), true));
    }
    int colPos = USER_PROPS_OFFSET;
    for (UserPropertyHandler userPropertyHandler : userPropertyHandlers) {
        if (userPropertyHandler == null)
            continue;
        String propName = userPropertyHandler.getName();
        boolean visible = userManager.isMandatoryUserProperty(USER_PROPS_ID, userPropertyHandler);
        FlexiColumnModel col = new DefaultFlexiColumnModel(visible, userPropertyHandler.i18nColumnDescriptorLabelKey(), colPos, true, propName);
        columnsModel.addFlexiColumnModel(col);
        colPos++;
        if (!options.hasDefaultOrderBy()) {
            options.setDefaultOrderBy(new SortKey(propName, true));
        } else if (UserConstants.LASTNAME.equals(propName)) {
            options.setDefaultOrderBy(new SortKey(propName, true));
        }
    }
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(ParticipantsCols.plannedLectures));
    if (rollCallEnabled) {
        columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(ParticipantsCols.attendedLectures));
        if (authorizedAbsenceEnabled) {
            columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(ParticipantsCols.unauthorizedAbsenceLectures));
            columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(ParticipantsCols.authorizedAbsenceLectures));
        } else {
            columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(ParticipantsCols.absentLectures, new LongCellRenderer("o_sel_absences")));
        }
        FlexiColumnModel progressCol = new DefaultFlexiColumnModel(ParticipantsCols.progress, new LectureStatisticsCellRenderer());
        progressCol.setExportable(false);
        columnsModel.addFlexiColumnModel(progressCol);
    }
    if (rateEnabled) {
        FlexiColumnModel warningCol = new DefaultFlexiColumnModel(ParticipantsCols.rateWarning, new RateWarningCellRenderer(getTranslator()));
        warningCol.setExportable(false);
        columnsModel.addFlexiColumnModel(warningCol);
        columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(ParticipantsCols.rate, new PercentCellRenderer()));
    }
    FlexiColumnModel infoCol = new DefaultFlexiColumnModel(ParticipantsCols.infos, new ParticipantInfosRenderer(getTranslator(), defaultRate));
    infoCol.setExportable(false);
    columnsModel.addFlexiColumnModel(infoCol);
    if (!printView) {
        DefaultFlexiColumnModel editColumn = new DefaultFlexiColumnModel("table.header.edit", -1, "edit", new StaticFlexiCellRenderer("", "edit", "o_icon o_icon-lg o_icon_edit", translate("edit"), null));
        editColumn.setExportable(false);
        editColumn.setAlwaysVisible(true);
        columnsModel.addFlexiColumnModel(editColumn);
    }
    tableModel = new ParticipantListDataModel(columnsModel, getTranslator(), getLocale());
    tableEl = uifactory.addTableElement(getWindowControl(), "table", tableModel, 20, false, getTranslator(), formLayout);
    tableEl.setExportEnabled(!printView);
    tableEl.setEmtpyTableMessageKey("empty.table.participant.list");
    tableEl.setSortSettings(options);
    tableEl.setAndLoadPersistedPreferences(ureq, "participant-list-repo-entry");
}
Also used : FlexiTableSortOptions(org.olat.core.gui.components.form.flexible.elements.FlexiTableSortOptions) LongCellRenderer(org.olat.modules.lecture.ui.component.LongCellRenderer) DefaultFlexiColumnModel(org.olat.core.gui.components.form.flexible.impl.elements.table.DefaultFlexiColumnModel) FlexiColumnModel(org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiColumnModel) RateWarningCellRenderer(org.olat.modules.lecture.ui.component.RateWarningCellRenderer) FormLayoutContainer(org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer) SortKey(org.olat.core.commons.persistence.SortKey) ParticipantInfosRenderer(org.olat.modules.lecture.ui.component.ParticipantInfosRenderer) PercentCellRenderer(org.olat.modules.lecture.ui.component.PercentCellRenderer) LectureStatisticsCellRenderer(org.olat.modules.lecture.ui.component.LectureStatisticsCellRenderer) StaticFlexiCellRenderer(org.olat.core.gui.components.form.flexible.impl.elements.table.StaticFlexiCellRenderer) FlexiTableColumnModel(org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableColumnModel) DefaultFlexiColumnModel(org.olat.core.gui.components.form.flexible.impl.elements.table.DefaultFlexiColumnModel) UserPropertyHandler(org.olat.user.propertyhandlers.UserPropertyHandler)

Aggregations

DefaultFlexiColumnModel (org.olat.core.gui.components.form.flexible.impl.elements.table.DefaultFlexiColumnModel)126 StaticFlexiCellRenderer (org.olat.core.gui.components.form.flexible.impl.elements.table.StaticFlexiCellRenderer)126 FlexiTableColumnModel (org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableColumnModel)118 TextFlexiCellRenderer (org.olat.core.gui.components.form.flexible.impl.elements.table.TextFlexiCellRenderer)60 BooleanCellRenderer (org.olat.core.gui.components.form.flexible.impl.elements.table.BooleanCellRenderer)56 UserPropertyHandler (org.olat.user.propertyhandlers.UserPropertyHandler)36 SortKey (org.olat.core.commons.persistence.SortKey)30 FormLayoutContainer (org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer)28 FlexiColumnModel (org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiColumnModel)28 FlexiTableSortOptions (org.olat.core.gui.components.form.flexible.elements.FlexiTableSortOptions)26 FlexiCellRenderer (org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiCellRenderer)24 DateFlexiCellRenderer (org.olat.core.gui.components.form.flexible.impl.elements.table.DateFlexiCellRenderer)18 ArrayList (java.util.ArrayList)16 FlexiTableFilter (org.olat.core.gui.components.form.flexible.elements.FlexiTableFilter)10 PassedCellRenderer (org.olat.course.assessment.bulk.PassedCellRenderer)8 LicenseRenderer (org.olat.core.commons.services.license.ui.LicenseRenderer)4 IndentedNodeRenderer (org.olat.course.assessment.IndentedNodeRenderer)4 ScoreCellRenderer (org.olat.modules.assessment.ui.ScoreCellRenderer)4 SharedPageStatusCellRenderer (org.olat.modules.portfolio.ui.renderer.SharedPageStatusCellRenderer)4 StatusCellRenderer (org.olat.modules.portfolio.ui.renderer.StatusCellRenderer)4