Search in sources :

Example 81 with StaticFlexiCellRenderer

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

the class GTACoachedGroupGradingController method initForm.

@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
    assessmentFormButton = uifactory.addFormLink("coach.assessment", "coach.assessment", null, formLayout, Link.BUTTON);
    assessmentFormButton.setCustomEnabledLinkCSS("btn btn-primary");
    assessmentFormButton.setIconLeftCSS("o_icon o_icon o_icon_submit");
    assessmentFormButton.setElementCssClass("o_sel_course_gta_assessment_button");
    assessmentFormButton.setVisible(!coachCourseEnv.isCourseReadOnly() && (assignedTask == null || assignedTask.getTaskStatus() != TaskProcess.graded));
    reopenButton = uifactory.addFormLink("coach.reopen", "coach.reopen", null, formLayout, Link.BUTTON);
    reopenButton.setElementCssClass("o_sel_course_gta_reopen_button");
    reopenButton.setVisible(!coachCourseEnv.isCourseReadOnly() && assignedTask != null && assignedTask.getTaskStatus() == TaskProcess.graded);
    if (formLayout instanceof FormLayoutContainer) {
        ModuleConfiguration config = gtaNode.getModuleConfiguration();
        FormLayoutContainer layoutCont = (FormLayoutContainer) formLayout;
        layoutCont.contextPut(MSCourseNode.CONFIG_KEY_HAS_SCORE_FIELD, config.get(MSCourseNode.CONFIG_KEY_HAS_SCORE_FIELD));
        layoutCont.contextPut(MSCourseNode.CONFIG_KEY_HAS_PASSED_FIELD, config.get(MSCourseNode.CONFIG_KEY_HAS_PASSED_FIELD));
        layoutCont.contextPut(MSCourseNode.CONFIG_KEY_PASSED_CUT_VALUE, AssessmentHelper.getRoundedScore(config.getFloatEntry(MSCourseNode.CONFIG_KEY_PASSED_CUT_VALUE)));
        layoutCont.contextPut(MSCourseNode.CONFIG_KEY_SCORE_MIN, AssessmentHelper.getRoundedScore(config.getFloatEntry(MSCourseNode.CONFIG_KEY_SCORE_MIN)));
        layoutCont.contextPut(MSCourseNode.CONFIG_KEY_SCORE_MAX, AssessmentHelper.getRoundedScore(config.getFloatEntry(MSCourseNode.CONFIG_KEY_SCORE_MAX)));
        if (config.getBooleanSafe(MSCourseNode.CONFIG_KEY_HAS_SCORE_FIELD, false)) {
            HighScoreRunController highScoreCtr = new HighScoreRunController(ureq, getWindowControl(), coachCourseEnv, gtaNode);
            if (highScoreCtr.isViewHighscore()) {
                Component highScoreComponent = highScoreCtr.getInitialComponent();
                layoutCont.put("highScore", highScoreComponent);
            }
        }
    }
    FlexiTableColumnModel columnsModel = FlexiTableDataModelFactory.createFlexiTableColumnModel();
    if (isAdministrativeUser) {
        columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(Cols.username.i18nKey(), Cols.username.ordinal()));
    }
    int i = 0;
    for (UserPropertyHandler userPropertyHandler : userPropertyHandlers) {
        int colIndex = GTACoachedGroupGradingController.USER_PROPS_OFFSET + i++;
        if (userPropertyHandler == null)
            continue;
        String propName = userPropertyHandler.getName();
        boolean visible = userManager.isMandatoryUserProperty(GTACoachedGroupGradingController.USER_PROPS_ID, userPropertyHandler);
        if (visible) {
            FlexiColumnModel col;
            if (UserConstants.FIRSTNAME.equals(propName) || UserConstants.LASTNAME.equals(propName)) {
                col = new DefaultFlexiColumnModel(userPropertyHandler.i18nColumnDescriptorLabelKey(), colIndex, userPropertyHandler.getName(), true, propName, new StaticFlexiCellRenderer(userPropertyHandler.getName(), new TextFlexiCellRenderer()));
            } else {
                col = new DefaultFlexiColumnModel(true, userPropertyHandler.i18nColumnDescriptorLabelKey(), colIndex, true, propName);
            }
            columnsModel.addFlexiColumnModel(col);
        }
    }
    if (withPassed) {
        columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(Cols.passedVal.i18nKey(), Cols.passedVal.ordinal(), new PassedCellRenderer()));
    }
    if (withScore) {
        columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(Cols.scoreVal.i18nKey(), Cols.scoreVal.ordinal()));
    }
    if (withComment) {
        columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(Cols.commentVal.i18nKey(), Cols.commentVal.ordinal()));
    }
    model = new GroupAssessmentModel(gtaNode, userPropertyHandlers, getLocale(), columnsModel);
    table = uifactory.addTableElement(getWindowControl(), "group-list", model, getTranslator(), formLayout);
    table.setCustomizeColumns(true);
    table.setAndLoadPersistedPreferences(ureq, "gtagroup-assessment");
}
Also used : ModuleConfiguration(org.olat.modules.ModuleConfiguration) DefaultFlexiColumnModel(org.olat.core.gui.components.form.flexible.impl.elements.table.DefaultFlexiColumnModel) FlexiColumnModel(org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiColumnModel) FormLayoutContainer(org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer) HighScoreRunController(org.olat.course.highscore.ui.HighScoreRunController) StaticFlexiCellRenderer(org.olat.core.gui.components.form.flexible.impl.elements.table.StaticFlexiCellRenderer) FlexiTableColumnModel(org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableColumnModel) TextFlexiCellRenderer(org.olat.core.gui.components.form.flexible.impl.elements.table.TextFlexiCellRenderer) Component(org.olat.core.gui.components.Component) PassedCellRenderer(org.olat.course.assessment.bulk.PassedCellRenderer) DefaultFlexiColumnModel(org.olat.core.gui.components.form.flexible.impl.elements.table.DefaultFlexiColumnModel) UserPropertyHandler(org.olat.user.propertyhandlers.UserPropertyHandler)

Example 82 with StaticFlexiCellRenderer

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

the class GTASampleSolutionsEditController method initForm.

@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
    addSolutionLink = uifactory.addFormLink("add.solution", formLayout, Link.BUTTON);
    addSolutionLink.setElementCssClass("o_sel_course_gta_add_solution");
    addSolutionLink.setIconLeftCSS("o_icon o_icon_upload");
    addSolutionLink.setVisible(!readOnly);
    createSolutionLink = uifactory.addFormLink("create.solution", formLayout, Link.BUTTON);
    createSolutionLink.setElementCssClass("o_sel_course_gta_create_solution");
    createSolutionLink.setIconLeftCSS("o_icon o_icon_edit");
    createSolutionLink.setVisible(!readOnly);
    FlexiTableColumnModel columnsModel = FlexiTableDataModelFactory.createFlexiTableColumnModel();
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(SolCols.title.i18nKey(), SolCols.title.ordinal()));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(SolCols.file.i18nKey(), SolCols.file.ordinal()));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(SolCols.author.i18nKey(), SolCols.author.ordinal()));
    if (!readOnly) {
        columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel("table.header.edit", SolCols.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"));
    }
    solutionModel = new SolutionTableModel(columnsModel);
    solutionTable = uifactory.addTableElement(getWindowControl(), "table", solutionModel, getTranslator(), formLayout);
    solutionTable.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) 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 83 with StaticFlexiCellRenderer

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

the class GroupAssessmentController method initForm.

@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
    FormLayoutContainer groupGradingCont = FormLayoutContainer.createDefaultFormLayout("groupGrading", getTranslator());
    groupGradingCont.setRootForm(mainForm);
    formLayout.add(groupGradingCont);
    applyToAllEl = uifactory.addCheckboxesHorizontal("applytoall", "group.apply.toall", groupGradingCont, onKeys, onValues);
    applyToAllEl.addActionListener(FormEvent.ONCHANGE);
    applyToAllEl.setElementCssClass("o_sel_course_gta_apply_to_all");
    if (withPassed && cutValue == null) {
        groupPassedEl = uifactory.addCheckboxesHorizontal("checkgroup", "group.passed", groupGradingCont, onKeys, onValues);
        groupPassedEl.setElementCssClass("o_sel_course_gta_group_passed");
    }
    if (withScore) {
        String pointVal = "";
        groupScoreEl = uifactory.addTextElement("pointgroup", "group.score", 5, pointVal, groupGradingCont);
        groupScoreEl.setElementCssClass("o_sel_course_gta_group_score");
    }
    if (withComment) {
        String comment = "";
        groupCommentEl = uifactory.addTextAreaElement("usercomment", "group.comment", 2500, 5, 40, true, comment, groupGradingCont);
        groupCommentEl.setElementCssClass("o_sel_course_gta_group_comment");
    }
    if (withPassed || withScore || withComment) {
        String[] userVisibilityValues = new String[] { translate("user.visibility.visible"), translate("user.visibility.hidden") };
        userVisibilityEl = uifactory.addRadiosHorizontal("user.visibility", "user.visibility", groupGradingCont, userVisibilityKeys, userVisibilityValues);
    }
    FlexiTableColumnModel columnsModel = FlexiTableDataModelFactory.createFlexiTableColumnModel();
    if (isAdministrativeUser) {
        columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(Cols.username.i18nKey(), Cols.username.ordinal()));
    }
    int i = 0;
    for (UserPropertyHandler userPropertyHandler : userPropertyHandlers) {
        int colIndex = GTACoachedGroupGradingController.USER_PROPS_OFFSET + i++;
        if (userPropertyHandler == null)
            continue;
        String propName = userPropertyHandler.getName();
        boolean visible = userManager.isMandatoryUserProperty(GTACoachedGroupGradingController.USER_PROPS_ID, userPropertyHandler);
        if (visible) {
            FlexiColumnModel col;
            if (UserConstants.FIRSTNAME.equals(propName) || UserConstants.LASTNAME.equals(propName)) {
                col = new DefaultFlexiColumnModel(userPropertyHandler.i18nColumnDescriptorLabelKey(), colIndex, userPropertyHandler.getName(), true, propName, new StaticFlexiCellRenderer(userPropertyHandler.getName(), new TextFlexiCellRenderer()));
            } else {
                col = new DefaultFlexiColumnModel(true, userPropertyHandler.i18nColumnDescriptorLabelKey(), colIndex, true, propName);
            }
            columnsModel.addFlexiColumnModel(col);
        }
    }
    if (withPassed && cutValue == null) {
        columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(Cols.passedEl.i18nKey(), Cols.passedEl.ordinal()));
    }
    if (withScore) {
        columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(Cols.scoreEl.i18nKey(), Cols.scoreEl.ordinal()));
    }
    if (withComment) {
        columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(Cols.commentEl.i18nKey(), Cols.commentEl.ordinal()));
    }
    model = new GroupAssessmentModel(gtaNode, userPropertyHandlers, getLocale(), columnsModel);
    table = uifactory.addTableElement(getWindowControl(), "group-list", model, getTranslator(), formLayout);
    table.setCustomizeColumns(true);
    table.setEditMode(true);
    table.setAndLoadPersistedPreferences(ureq, "gtagroup-assessment");
    FormLayoutContainer buttonsCont = FormLayoutContainer.createButtonLayout("buttons", getTranslator());
    formLayout.add(buttonsCont);
    uifactory.addFormSubmitButton("save", buttonsCont);
    saveAndDoneButton = uifactory.addFormLink("save.done", buttonsCont, Link.BUTTON);
    uifactory.addFormCancelButton("cancel", buttonsCont, ureq, getWindowControl());
}
Also used : StaticFlexiCellRenderer(org.olat.core.gui.components.form.flexible.impl.elements.table.StaticFlexiCellRenderer) DefaultFlexiColumnModel(org.olat.core.gui.components.form.flexible.impl.elements.table.DefaultFlexiColumnModel) FlexiColumnModel(org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiColumnModel) FormLayoutContainer(org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer) FlexiTableColumnModel(org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableColumnModel) TextFlexiCellRenderer(org.olat.core.gui.components.form.flexible.impl.elements.table.TextFlexiCellRenderer) DefaultFlexiColumnModel(org.olat.core.gui.components.form.flexible.impl.elements.table.DefaultFlexiColumnModel) UserPropertyHandler(org.olat.user.propertyhandlers.UserPropertyHandler)

Example 84 with StaticFlexiCellRenderer

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

the class CourseReminderListController method initForm.

@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
    formLayout.setElementCssClass("o_sel_course_reminder_list");
    addButton = uifactory.addFormLink("add.reminder", formLayout, Link.BUTTON);
    addButton.setIconLeftCSS("o_icon o_icon_add");
    addButton.setElementCssClass("o_sel_add_course_reminder");
    FlexiTableColumnModel columnsModel = FlexiTableDataModelFactory.createFlexiTableColumnModel();
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(false, ReminderCols.id.i18nKey(), ReminderCols.id.ordinal(), true, ReminderCols.id.name()));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(ReminderCols.description.i18nKey(), ReminderCols.description.ordinal(), "edit", true, ReminderCols.description.name(), new StaticFlexiCellRenderer("edit", new TextFlexiCellRenderer())));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(ReminderCols.creator.i18nKey(), ReminderCols.creator.ordinal(), true, ReminderCols.creator.name()));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(ReminderCols.creationDate.i18nKey(), ReminderCols.creationDate.ordinal(), true, ReminderCols.creationDate.name()));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(false, ReminderCols.lastModified.i18nKey(), ReminderCols.lastModified.ordinal(), true, ReminderCols.lastModified.name()));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(ReminderCols.send.i18nKey(), ReminderCols.send.ordinal(), true, ReminderCols.send.name()));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(ReminderCols.tools.i18nKey(), ReminderCols.tools.ordinal()));
    tableModel = new CourseReminderTableModel(columnsModel);
    tableEl = uifactory.addTableElement(getWindowControl(), "table", tableModel, 20, false, getTranslator(), formLayout);
    updateModel();
}
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) TextFlexiCellRenderer(org.olat.core.gui.components.form.flexible.impl.elements.table.TextFlexiCellRenderer) DefaultFlexiColumnModel(org.olat.core.gui.components.form.flexible.impl.elements.table.DefaultFlexiColumnModel)

Example 85 with StaticFlexiCellRenderer

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

the class QTI21AssessmentDetailsController method initForm.

@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
    FlexiTableColumnModel columnsModel = FlexiTableDataModelFactory.createFlexiTableColumnModel();
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(TSCols.terminationTime));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(TSCols.lastModified));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(TSCols.duration, new TextFlexiCellRenderer(EscapeMode.none)));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(TSCols.numOfItemSessions, new TextFlexiCellRenderer(EscapeMode.none)));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(TSCols.responded, new TextFlexiCellRenderer(EscapeMode.none)));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(TSCols.corrected, new TextFlexiCellRenderer(EscapeMode.none)));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(TSCols.score, new TextFlexiCellRenderer(EscapeMode.none)));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(TSCols.manualScore, new TextFlexiCellRenderer(EscapeMode.none)));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(TSCols.finalScore, new TextFlexiCellRenderer(EscapeMode.none)));
    if (readOnly) {
        columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel("select", translate("select"), "open"));
    } else {
        columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(TSCols.open.i18nHeaderKey(), TSCols.open.ordinal(), "open", new BooleanCellRenderer(new StaticFlexiCellRenderer(translate("results.report"), "open"), new StaticFlexiCellRenderer(translate("pull"), "open"))));
    }
    if (manualCorrections && !readOnly) {
        columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(TSCols.correction.i18nHeaderKey(), TSCols.correction.ordinal(), "correction", new BooleanCellRenderer(new StaticFlexiCellRenderer(translate("correction"), "correction"), null)));
    }
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel("download.log", translate("download.log"), "log"));
    tableModel = new QTI21AssessmentTestSessionTableModel(columnsModel, getTranslator());
    tableEl = uifactory.addTableElement(getWindowControl(), "sessions", tableModel, 20, false, getTranslator(), formLayout);
    tableEl.setEmtpyTableMessageKey("results.empty");
    if (reSecurity.isEntryAdmin() && !readOnly) {
        resetButton = uifactory.addFormLink("menu.reset.title", formLayout, Link.BUTTON);
        resetButton.setIconLeftCSS("o_icon o_icon_delete_item");
    }
}
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) FlexiTableColumnModel(org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableColumnModel) TextFlexiCellRenderer(org.olat.core.gui.components.form.flexible.impl.elements.table.TextFlexiCellRenderer) DefaultFlexiColumnModel(org.olat.core.gui.components.form.flexible.impl.elements.table.DefaultFlexiColumnModel)

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