Search in sources :

Example 56 with TextFlexiCellRenderer

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

the class GroupSearchController method initForm.

/**
 * @see org.olat.core.gui.components.form.flexible.impl.FormBasicController#initForm(org.olat.core.gui.components.form.flexible.FormItemContainer,
 *      org.olat.core.gui.control.Controller, org.olat.core.gui.UserRequest)
 */
@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
    setFormDescription("group.search.description");
    formLayout.setElementCssClass("o_sel_groups_search");
    search = uifactory.addTextElement("search.field", "search.field", 100, "", formLayout);
    if (isUsedInStepWizzard()) {
        searchLink = uifactory.addFormLink("search", formLayout, Link.BUTTON);
    } else {
        searchButton = uifactory.addFormSubmitButton("search", formLayout);
        uifactory.addSpacerElement("space", formLayout, false);
    }
    errorComp = uifactory.createSimpleErrorText("error", "");
    formLayout.add(errorComp);
    tableCont = FormLayoutContainer.createCustomFormLayout("", getTranslator(), velocity_root + "/resulttable.html");
    tableCont.setRootForm(mainForm);
    formLayout.add(tableCont);
    // group rights
    FlexiTableColumnModel tableColumnModel = FlexiTableDataModelFactory.createFlexiTableColumnModel();
    tableColumnModel.addFlexiColumnModel(new DefaultFlexiColumnModel(Cols.groupName.i18n(), Cols.groupName.ordinal()));
    tableColumnModel.addFlexiColumnModel(new DefaultFlexiColumnModel(true, Cols.description.i18n(), Cols.description.ordinal(), false, null, FlexiColumnModel.ALIGNMENT_LEFT, new TextFlexiCellRenderer(EscapeMode.antisamy)));
    tableColumnModel.addFlexiColumnModel(new DefaultFlexiColumnModel(Cols.courses.i18n(), Cols.courses.ordinal()));
    tableColumnModel.addFlexiColumnModel(new DefaultFlexiColumnModel(Cols.tutor.i18n(), Cols.tutor.ordinal()));
    tableColumnModel.addFlexiColumnModel(new DefaultFlexiColumnModel(Cols.participant.i18n(), Cols.participant.ordinal()));
    tableDataModel = new GroupTableDataModel(Collections.<GroupWrapper>emptyList(), tableColumnModel);
    table = uifactory.addTableElement(getWindowControl(), "groupList", tableDataModel, getTranslator(), tableCont);
    table.setCustomizeColumns(false);
    tableCont.add("groupList", table);
    if (!isUsedInStepWizzard()) {
        saveLink = uifactory.addFormLink("save", formLayout, Link.BUTTON);
    }
}
Also used : 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 57 with TextFlexiCellRenderer

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

the class CheckListAssessmentController method initForm.

@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
    setFormDescription("coach.desc");
    setFormContextHelp("Assessment#_checklist_manage");
    if (formLayout instanceof FormLayoutContainer) {
        FormLayoutContainer layoutCont = (FormLayoutContainer) formLayout;
        if (dueDate != null) {
            layoutCont.contextPut("dueDate", dueDate);
        }
    }
    FlexiTableSortOptions options = new FlexiTableSortOptions();
    FlexiTableColumnModel columnsModel = FlexiTableDataModelFactory.createFlexiTableColumnModel();
    if (isAdministrativeUser) {
        options.setDefaultOrderBy(new SortKey(Cols.username.name(), true));
        columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(Cols.username.i18nKey(), Cols.username.ordinal(), true, Cols.username.name()));
    }
    int i = 0;
    for (UserPropertyHandler userPropertyHandler : userPropertyHandlers) {
        int colIndex = CheckListAssessmentDataModel.USER_PROPS_OFFSET + i++;
        if (userPropertyHandler == null)
            continue;
        String propName = userPropertyHandler.getName();
        boolean visible = userManager.isMandatoryUserProperty(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 (options.getDefaultOrderBy() == null) {
                options.setDefaultOrderBy(new SortKey(propName, true));
            }
        }
    }
    int numOfCheckbox = checkboxList.getNumOfCheckbox();
    List<Checkbox> boxList = checkboxList.getList();
    int j = 0;
    for (Checkbox box : boxList) {
        int colIndex = CheckListAssessmentDataModel.CHECKBOX_OFFSET + j++;
        String colName = "checkbox_" + colIndex;
        DefaultFlexiColumnModel column = new DefaultFlexiColumnModel(true, colName, colIndex, true, colName);
        column.setHeaderLabel(StringHelper.escapeHtml(box.getTitle()));
        columnsModel.addFlexiColumnModel(column);
    }
    if (withScore) {
        columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(true, Cols.totalPoints.i18nKey(), Cols.totalPoints.ordinal(), true, "points"));
    }
    if (coachCourseEnv.isCourseReadOnly()) {
        columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel("table.header.view.checkbox", translate("table.header.view.checkbox"), "view"));
    } else {
        columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel("table.header.edit.checkbox", translate("table.header.edit.checkbox"), "edit"));
    }
    model = new CheckListAssessmentDataModel(checkboxList, new ArrayList<>(), columnsModel, getLocale());
    table = uifactory.addTableElement(getWindowControl(), "checkbox-list", model, getTranslator(), formLayout);
    if (coachCourseEnv instanceof UserCourseEnvironmentImpl) {
        UserCourseEnvironmentImpl env = (UserCourseEnvironmentImpl) coachCourseEnv;
        List<BusinessGroup> coachedGroups = env.getCoachedGroups();
        List<FlexiTableFilter> filters = new ArrayList<>(coachedGroups.size() + 1);
        filters.add(new FlexiTableFilter(translate("filter.all"), "all"));
        for (int k = 0; k < coachedGroups.size(); k++) {
            BusinessGroup group = coachedGroups.get(k);
            String groupName = StringHelper.escapeHtml(group.getName());
            filters.add(new FlexiTableFilter(groupName, group.getKey().toString()));
        }
        table.setFilters("participants", filters, false);
    }
    table.setExportEnabled(true);
    table.setCustomizeColumns(true);
    FlexiTableSortOptions sortOptions = new FlexiTableSortOptions();
    table.setSortSettings(sortOptions);
    table.setAndLoadPersistedPreferences(ureq, "checklist-assessment");
    pdfExportButton = uifactory.addFormLink("pdf.export", formLayout, Link.BUTTON);
    pdfExportButton.setEnabled(numOfCheckbox > 0);
    checkedPdfExportButton = uifactory.addFormLink("pdf.export.checked", formLayout, Link.BUTTON);
    checkedPdfExportButton.setEnabled(numOfCheckbox > 0);
    editButton = uifactory.addFormLink("edit", formLayout, Link.BUTTON);
    editButton.setEnabled(numOfCheckbox > 0);
    editButton.setVisible(!coachCourseEnv.isCourseReadOnly());
    saveButton = uifactory.addFormSubmitButton("save", formLayout);
    saveButton.getComponent().setSpanAsDomReplaceable(true);
    saveButton.setVisible(false);
    cancelButton = uifactory.addFormCancelButton("cancel", formLayout, ureq, getWindowControl());
    cancelButton.setVisible(false);
    boxAssessmentButton = uifactory.addFormLink("box.assessment", formLayout, Link.BUTTON);
    boxAssessmentButton.setEnabled(numOfCheckbox > 0);
    boxAssessmentButton.setVisible(!coachCourseEnv.isCourseReadOnly());
}
Also used : FlexiTableSortOptions(org.olat.core.gui.components.form.flexible.elements.FlexiTableSortOptions) BusinessGroup(org.olat.group.BusinessGroup) DefaultFlexiColumnModel(org.olat.core.gui.components.form.flexible.impl.elements.table.DefaultFlexiColumnModel) FlexiColumnModel(org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiColumnModel) 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) UserCourseEnvironmentImpl(org.olat.course.run.userview.UserCourseEnvironmentImpl) Checkbox(org.olat.course.nodes.cl.model.Checkbox) FlexiTableFilter(org.olat.core.gui.components.form.flexible.elements.FlexiTableFilter) 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 58 with TextFlexiCellRenderer

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

the class CheckboxAssessmentController method initForm.

@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
    setFormDescription("assessment.checkbox.description");
    FlexiTableColumnModel columnsModel = FlexiTableDataModelFactory.createFlexiTableColumnModel();
    if (isAdministrativeUser) {
        columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(Cols.username.i18nKey(), Cols.username.ordinal(), true, Cols.username.name()));
    }
    int i = 0;
    for (UserPropertyHandler userPropertyHandler : userPropertyHandlers) {
        int colIndex = CheckListAssessmentDataModel.USER_PROPS_OFFSET + i++;
        if (userPropertyHandler == null)
            continue;
        String propName = userPropertyHandler.getName();
        boolean visible = userManager.isMandatoryUserProperty(CheckListAssessmentController.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);
        }
    }
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(Cols.check.i18nKey(), Cols.check.ordinal(), true, Cols.check.name()));
    if (withScore) {
        columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(Cols.points.i18nKey(), Cols.points.ordinal(), true, Cols.points.name()));
    }
    int numOfCheckbox = checkboxList.getList().size();
    String[] keys = new String[numOfCheckbox];
    String[] values = new String[numOfCheckbox];
    List<Checkbox> checkbox = checkboxList.getList();
    for (int j = 0; j < numOfCheckbox; j++) {
        keys[j] = checkbox.get(j).getCheckboxId();
        values[j] = checkbox.get(j).getTitle();
    }
    FormLayoutContainer selectCont = FormLayoutContainer.createDefaultFormLayout("checkbox_sel_cont", getTranslator());
    formLayout.add(selectCont);
    checkboxEl = uifactory.addDropdownSingleselect("checkbox", "select.checkbox", selectCont, keys, values, null);
    checkboxEl.addActionListener(FormEvent.ONCHANGE);
    checkboxEl.select(keys[0], true);
    Checkbox box = checkboxList.getList().get(currentCheckboxIndex);
    boolean hasPoints = box.getPoints() != null && box.getPoints().floatValue() > 0f;
    boxRows = new ArrayList<CheckboxAssessmentRow>(initialRows.size());
    for (CheckListAssessmentRow initialRow : initialRows) {
        Boolean[] checked = new Boolean[numOfCheckbox];
        if (initialRow.getChecked() != null) {
            System.arraycopy(initialRow.getChecked(), 0, checked, 0, initialRow.getChecked().length);
        }
        Float[] scores = new Float[numOfCheckbox];
        if (initialRow.getScores() != null) {
            System.arraycopy(initialRow.getScores(), 0, scores, 0, initialRow.getScores().length);
        }
        CheckboxAssessmentRow row = new CheckboxAssessmentRow(initialRow, checked, scores);
        String name = "box_" + boxRows.size() + "_";
        String pointVal = "";
        if (scores != null && scores.length > currentCheckboxIndex && scores[currentCheckboxIndex] != null) {
            pointVal = AssessmentHelper.getRoundedScore(scores[currentCheckboxIndex]);
        }
        TextElement pointEl = uifactory.addTextElement(name + "point", null, 5, pointVal, formLayout);
        pointEl.setDisplaySize(5);
        MultipleSelectionElement checkEl = uifactory.addCheckboxesHorizontal(name + "check", null, formLayout, onKeys, onValues);
        checkEl.setDomReplacementWrapperRequired(false);
        checkEl.addActionListener(FormEvent.ONCHANGE);
        checkEl.setUserObject(row);
        if (checked != null && checked.length > currentCheckboxIndex && checked[currentCheckboxIndex] != null && checked[currentCheckboxIndex].booleanValue()) {
            checkEl.select(onKeys[0], true);
        }
        pointEl.setVisible(hasPoints);
        row.setCheckedEl(checkEl);
        row.setPointEl(pointEl);
        boxRows.add(row);
    }
    model = new CheckboxAssessmentDataModel(boxRows, columnsModel, getLocale());
    table = uifactory.addTableElement(getWindowControl(), "checkbox-list", model, getTranslator(), formLayout);
    table.setCustomizeColumns(true);
    table.setEditMode(true);
    table.setAndLoadPersistedPreferences(ureq, "checkbox-assessment");
    FormLayoutContainer buttonsCont = FormLayoutContainer.createButtonLayout("buttons", getTranslator());
    formLayout.add(buttonsCont);
    uifactory.addFormSubmitButton("save", buttonsCont);
    selectAllBoxButton = uifactory.addFormLink("selectall", buttonsCont, Link.BUTTON);
    uifactory.addFormCancelButton("cancel", buttonsCont, ureq, getWindowControl());
}
Also used : 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) StaticFlexiCellRenderer(org.olat.core.gui.components.form.flexible.impl.elements.table.StaticFlexiCellRenderer) TextElement(org.olat.core.gui.components.form.flexible.elements.TextElement) MultipleSelectionElement(org.olat.core.gui.components.form.flexible.elements.MultipleSelectionElement) Checkbox(org.olat.course.nodes.cl.model.Checkbox) 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 59 with TextFlexiCellRenderer

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

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 60 with TextFlexiCellRenderer

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

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)

Aggregations

DefaultFlexiColumnModel (org.olat.core.gui.components.form.flexible.impl.elements.table.DefaultFlexiColumnModel)64 TextFlexiCellRenderer (org.olat.core.gui.components.form.flexible.impl.elements.table.TextFlexiCellRenderer)64 FlexiTableColumnModel (org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableColumnModel)60 StaticFlexiCellRenderer (org.olat.core.gui.components.form.flexible.impl.elements.table.StaticFlexiCellRenderer)60 FlexiColumnModel (org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiColumnModel)24 UserPropertyHandler (org.olat.user.propertyhandlers.UserPropertyHandler)24 FlexiCellRenderer (org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiCellRenderer)20 FormLayoutContainer (org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer)18 SortKey (org.olat.core.commons.persistence.SortKey)14 BooleanCellRenderer (org.olat.core.gui.components.form.flexible.impl.elements.table.BooleanCellRenderer)14 FlexiTableSortOptions (org.olat.core.gui.components.form.flexible.elements.FlexiTableSortOptions)12 ArrayList (java.util.ArrayList)6 DateFlexiCellRenderer (org.olat.core.gui.components.form.flexible.impl.elements.table.DateFlexiCellRenderer)6 PassedCellRenderer (org.olat.course.assessment.bulk.PassedCellRenderer)4 Checkbox (org.olat.course.nodes.cl.model.Checkbox)4 HashMap (java.util.HashMap)2 LicenseHandler (org.olat.core.commons.services.license.LicenseHandler)2 LicenseRenderer (org.olat.core.commons.services.license.ui.LicenseRenderer)2 PublisherData (org.olat.core.commons.services.notifications.PublisherData)2 SubscriptionContext (org.olat.core.commons.services.notifications.SubscriptionContext)2