Search in sources :

Example 26 with FlexiColumnModel

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

the class CorrectionIdentityListController method initForm.

@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
    FlexiTableColumnModel columnsModel = FlexiTableDataModelFactory.createFlexiTableColumnModel();
    if (anonymous) {
        columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(IdentityCols.user, "select"));
    } else {
        if (isAdministrativeUser) {
            columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(IdentityCols.username, "select"));
        }
        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, "select", true, propName);
            columnsModel.addFlexiColumnModel(col);
            colPos++;
        }
    }
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(IdentityCols.score, new ScoreCellRenderer()));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(IdentityCols.answered));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(IdentityCols.notAnswered));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(IdentityCols.autoCorrected, new CorrectedFlexiCellRenderer()));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(IdentityCols.corrected, new CorrectedFlexiCellRenderer()));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(IdentityCols.notCorrected, new NotCorrectedFlexiCellRenderer()));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(IdentityCols.toReview, new ToReviewFlexiCellRenderer()));
    tableModel = new CorrectionIdentityTableModel(columnsModel, getLocale());
    tableEl = uifactory.addTableElement(getWindowControl(), "table", tableModel, getTranslator(), formLayout);
    tableEl.setExportEnabled(true);
    tableEl.setMultiSelect(true);
    tableEl.setSelectAllEnable(true);
    saveTestsButton = uifactory.addFormLink("save.tests", formLayout, Link.BUTTON);
}
Also used : CorrectedFlexiCellRenderer(org.olat.ims.qti21.ui.assessment.components.CorrectedFlexiCellRenderer) NotCorrectedFlexiCellRenderer(org.olat.ims.qti21.ui.assessment.components.NotCorrectedFlexiCellRenderer) ScoreCellRenderer(org.olat.modules.assessment.ui.ScoreCellRenderer) ToReviewFlexiCellRenderer(org.olat.ims.qti21.ui.assessment.components.ToReviewFlexiCellRenderer) DefaultFlexiColumnModel(org.olat.core.gui.components.form.flexible.impl.elements.table.DefaultFlexiColumnModel) FlexiColumnModel(org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiColumnModel) FlexiTableColumnModel(org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableColumnModel) NotCorrectedFlexiCellRenderer(org.olat.ims.qti21.ui.assessment.components.NotCorrectedFlexiCellRenderer) DefaultFlexiColumnModel(org.olat.core.gui.components.form.flexible.impl.elements.table.DefaultFlexiColumnModel) UserPropertyHandler(org.olat.user.propertyhandlers.UserPropertyHandler)

Example 27 with FlexiColumnModel

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

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 28 with FlexiColumnModel

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

the class CourseSendReminderListController method initForm.

@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
    FlexiTableColumnModel columnsModel = FlexiTableDataModelFactory.createFlexiTableColumnModel();
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(SendCols.status.i18nKey(), SendCols.status.ordinal(), true, SendCols.status.name(), new StatusCellRenderer()));
    if (isAdministrativeUser) {
        columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(SendCols.username.i18nKey(), SendCols.username.ordinal(), true, SendCols.username.name()));
    }
    int i = 0;
    for (UserPropertyHandler userPropertyHandler : userPropertyHandlers) {
        int colIndex = USER_PROPS_OFFSET + i++;
        if (userPropertyHandler == null)
            continue;
        String propName = userPropertyHandler.getName();
        boolean visible = userManager.isMandatoryUserProperty(USER_PROPS_ID, userPropertyHandler);
        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(visible, userPropertyHandler.i18nColumnDescriptorLabelKey(), colIndex, true, propName);
        }
        columnsModel.addFlexiColumnModel(col);
    }
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(SendCols.sendTime.i18nKey(), SendCols.sendTime.ordinal(), true, SendCols.sendTime.name()));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel("resend", translate("resend"), "resend"));
    tableModel = new CourseSendReminderTableModel(columnsModel);
    tableEl = uifactory.addTableElement(getWindowControl(), "table", tableModel, 20, false, getTranslator(), formLayout);
    tableEl.setElementCssClass("o_sel_course_sent_reminder_list");
    updateModel();
}
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) 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 29 with FlexiColumnModel

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

the class TeacherRollCallController method initForm.

@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
    if (formLayout instanceof FormLayoutContainer) {
        FormLayoutContainer layoutCont = (FormLayoutContainer) formLayout;
        StringBuilder sb = new StringBuilder();
        List<Identity> teachers = lectureService.getTeachers(lectureBlock);
        for (Identity teacher : teachers) {
            if (sb.length() > 0)
                sb.append(", ");
            sb.append(StringHelper.escapeHtml(userManager.getUserDisplayName(teacher)));
        }
        Formatter formatter = Formatter.getInstance(getLocale());
        String date = formatter.formatDate(lectureBlock.getStartDate());
        String startTime = formatter.formatTimeShort(lectureBlock.getStartDate());
        String endTime = formatter.formatTimeShort(lectureBlock.getEndDate());
        String[] args = new String[] { // {0}
        lectureBlock.getTitle(), // {1}
        sb.toString(), // {2}
        date, // {3}
        startTime, // {4}
        endTime };
        layoutCont.contextPut("date", date);
        layoutCont.contextPut("startTime", startTime);
        layoutCont.contextPut("endTime", endTime);
        layoutCont.contextPut("dateAndTime", translate("lecture.block.dateAndTime", args));
        layoutCont.contextPut("teachers", sb.toString());
        layoutCont.contextPut("lectureBlockTitle", StringHelper.escapeHtml(lectureBlock.getTitle()));
        layoutCont.contextPut("lectureBlockExternalId", StringHelper.escapeHtml(lectureBlock.getExternalId()));
        StringBuilder description = Formatter.stripTabsAndReturns(Formatter.formatURLsAsLinks(lectureBlock.getDescription()));
        layoutCont.contextPut("lectureBlockDescription", StringHelper.xssScan(description));
        StringBuilder preparation = Formatter.stripTabsAndReturns(Formatter.formatURLsAsLinks(lectureBlock.getPreparation()));
        layoutCont.contextPut("lectureBlockPreparation", StringHelper.xssScan(preparation));
        layoutCont.contextPut("lectureBlockLocation", StringHelper.escapeHtml(lectureBlock.getLocation()));
        layoutCont.contextPut("lectureBlock", lectureBlock);
        layoutCont.contextPut("lectureBlockOptional", !lectureBlock.isCompulsory());
        layoutCont.setFormTitle(translate("lecture.block", args));
        layoutCont.setFormDescription(StringHelper.escapeJavaScript(lectureBlock.getDescription()));
    }
    // table
    FlexiTableSortOptions options = new FlexiTableSortOptions();
    FlexiTableColumnModel columnsModel = FlexiTableDataModelFactory.createFlexiTableColumnModel();
    if (isAdministrativeUser) {
        columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(RollCols.username));
        options.setDefaultOrderBy(new SortKey(RollCols.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));
        }
    }
    if (lectureBlock.isCompulsory()) {
        columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(RollCols.status));
        for (int i = 0; i < numOfLectures; i++) {
            DefaultFlexiColumnModel col = new DefaultFlexiColumnModel("table.header.lecture." + (i + 1), i + CHECKBOX_OFFSET, true, "lecture." + (i + 1));
            col.setAlwaysVisible(true);
            columnsModel.addFlexiColumnModel(col);
        }
        // all button
        DefaultFlexiColumnModel allCol = new DefaultFlexiColumnModel("all", RollCols.all.ordinal(), "all", new BooleanCellRenderer(new StaticFlexiCellRenderer(translate("all"), "all", null, null, translate("all.desc")), null));
        allCol.setAlwaysVisible(true);
        columnsModel.addFlexiColumnModel(allCol);
        if (secCallback.canViewAuthorizedAbsences() || secCallback.canEditAuthorizedAbsences()) {
            DefaultFlexiColumnModel authorizedCol = new DefaultFlexiColumnModel(RollCols.authorizedAbsence);
            authorizedCol.setAlwaysVisible(true);
            columnsModel.addFlexiColumnModel(authorizedCol);
        }
    }
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(RollCols.comment));
    tableModel = new TeacherRollCallDataModel(columnsModel, secCallback, getLocale());
    tableEl = uifactory.addTableElement(getWindowControl(), "table", tableModel, 20, false, getTranslator(), formLayout);
    tableEl.setCustomizeColumns(true);
    tableEl.setSortSettings(options);
    tableEl.setAndLoadPersistedPreferences(ureq, "teacher-roll-call");
    // buttons
    uifactory.addFormCancelButton("cancel", formLayout, ureq, getWindowControl());
    quickSaveButton = uifactory.addFormSubmitButton("save", "save.temporary", formLayout);
    quickSaveButton.setElementCssClass("o_sel_lecture_quick_save");
    closeLectureBlocksButton = uifactory.addFormLink("close.lecture.blocks", formLayout, Link.BUTTON);
    closeLectureBlocksButton.setElementCssClass("o_sel_lecture_close");
    if (lectureModule.isStatusCancelledEnabled()) {
        cancelLectureBlockButton = uifactory.addFormLink("cancel.lecture.blocks", formLayout, Link.BUTTON);
    }
    reopenButton = uifactory.addFormLink("reopen.lecture.blocks", formLayout, Link.BUTTON);
    reopenButton.setElementCssClass("o_sel_lecture_reopen");
    updateUI();
}
Also used : FlexiTableSortOptions(org.olat.core.gui.components.form.flexible.elements.FlexiTableSortOptions) Formatter(org.olat.core.util.Formatter) 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) 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) FlexiTableColumnModel(org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableColumnModel) Identity(org.olat.core.id.Identity) DefaultFlexiColumnModel(org.olat.core.gui.components.form.flexible.impl.elements.table.DefaultFlexiColumnModel) UserPropertyHandler(org.olat.user.propertyhandlers.UserPropertyHandler)

Example 30 with FlexiColumnModel

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

the class TeacherRollCallController method initForm.

@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
    if (formLayout instanceof FormLayoutContainer) {
        FormLayoutContainer layoutCont = (FormLayoutContainer) formLayout;
        StringBuilder sb = new StringBuilder();
        List<Identity> teachers = lectureService.getTeachers(lectureBlock);
        for (Identity teacher : teachers) {
            if (sb.length() > 0)
                sb.append(", ");
            sb.append(StringHelper.escapeHtml(userManager.getUserDisplayName(teacher)));
        }
        Formatter formatter = Formatter.getInstance(getLocale());
        String date = formatter.formatDate(lectureBlock.getStartDate());
        String startTime = formatter.formatTimeShort(lectureBlock.getStartDate());
        String endTime = formatter.formatTimeShort(lectureBlock.getEndDate());
        String[] args = new String[] { // {0}
        lectureBlock.getTitle(), // {1}
        sb.toString(), // {2}
        date, // {3}
        startTime, // {4}
        endTime };
        layoutCont.contextPut("date", date);
        layoutCont.contextPut("startTime", startTime);
        layoutCont.contextPut("endTime", endTime);
        layoutCont.contextPut("dateAndTime", translate("lecture.block.dateAndTime", args));
        layoutCont.contextPut("teachers", sb.toString());
        layoutCont.contextPut("lectureBlockTitle", StringHelper.escapeHtml(lectureBlock.getTitle()));
        layoutCont.contextPut("lectureBlockExternalId", StringHelper.escapeHtml(lectureBlock.getExternalId()));
        StringBuilder description = Formatter.stripTabsAndReturns(Formatter.formatURLsAsLinks(lectureBlock.getDescription()));
        layoutCont.contextPut("lectureBlockDescription", StringHelper.xssScan(description));
        StringBuilder preparation = Formatter.stripTabsAndReturns(Formatter.formatURLsAsLinks(lectureBlock.getPreparation()));
        layoutCont.contextPut("lectureBlockPreparation", StringHelper.xssScan(preparation));
        layoutCont.contextPut("lectureBlockLocation", StringHelper.escapeHtml(lectureBlock.getLocation()));
        layoutCont.contextPut("lectureBlock", lectureBlock);
        layoutCont.contextPut("lectureBlockOptional", !lectureBlock.isCompulsory());
        layoutCont.setFormTitle(translate("lecture.block", args));
        layoutCont.setFormDescription(StringHelper.escapeJavaScript(lectureBlock.getDescription()));
    }
    // table
    FlexiTableSortOptions options = new FlexiTableSortOptions();
    FlexiTableColumnModel columnsModel = FlexiTableDataModelFactory.createFlexiTableColumnModel();
    if (isAdministrativeUser) {
        columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(RollCols.username));
        options.setDefaultOrderBy(new SortKey(RollCols.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));
        }
    }
    if (lectureBlock.isCompulsory()) {
        columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(RollCols.status));
        for (int i = 0; i < numOfLectures; i++) {
            DefaultFlexiColumnModel col = new DefaultFlexiColumnModel("table.header.lecture." + (i + 1), i + CHECKBOX_OFFSET, true, "lecture." + (i + 1));
            col.setAlwaysVisible(true);
            columnsModel.addFlexiColumnModel(col);
        }
        // all button
        DefaultFlexiColumnModel allCol = new DefaultFlexiColumnModel("all", RollCols.all.ordinal(), "all", new BooleanCellRenderer(new StaticFlexiCellRenderer(translate("all"), "all", null, null, translate("all.desc")), null));
        allCol.setAlwaysVisible(true);
        columnsModel.addFlexiColumnModel(allCol);
        if (secCallback.canViewAuthorizedAbsences() || secCallback.canEditAuthorizedAbsences()) {
            DefaultFlexiColumnModel authorizedCol = new DefaultFlexiColumnModel(RollCols.authorizedAbsence);
            authorizedCol.setAlwaysVisible(true);
            columnsModel.addFlexiColumnModel(authorizedCol);
        }
    }
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(RollCols.comment));
    tableModel = new TeacherRollCallDataModel(columnsModel, secCallback, getLocale());
    tableEl = uifactory.addTableElement(getWindowControl(), "table", tableModel, 20, false, getTranslator(), formLayout);
    tableEl.setCustomizeColumns(true);
    tableEl.setSortSettings(options);
    tableEl.setAndLoadPersistedPreferences(ureq, "teacher-roll-call");
    // buttons
    uifactory.addFormCancelButton("cancel", formLayout, ureq, getWindowControl());
    quickSaveButton = uifactory.addFormSubmitButton("save", "save.temporary", formLayout);
    quickSaveButton.setElementCssClass("o_sel_lecture_quick_save");
    closeLectureBlocksButton = uifactory.addFormLink("close.lecture.blocks", formLayout, Link.BUTTON);
    closeLectureBlocksButton.setElementCssClass("o_sel_lecture_close");
    if (lectureModule.isStatusCancelledEnabled()) {
        cancelLectureBlockButton = uifactory.addFormLink("cancel.lecture.blocks", formLayout, Link.BUTTON);
    }
    reopenButton = uifactory.addFormLink("reopen.lecture.blocks", formLayout, Link.BUTTON);
    reopenButton.setElementCssClass("o_sel_lecture_reopen");
    updateUI();
}
Also used : FlexiTableSortOptions(org.olat.core.gui.components.form.flexible.elements.FlexiTableSortOptions) Formatter(org.olat.core.util.Formatter) 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) 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) FlexiTableColumnModel(org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableColumnModel) Identity(org.olat.core.id.Identity) DefaultFlexiColumnModel(org.olat.core.gui.components.form.flexible.impl.elements.table.DefaultFlexiColumnModel) UserPropertyHandler(org.olat.user.propertyhandlers.UserPropertyHandler)

Aggregations

FlexiColumnModel (org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiColumnModel)40 DefaultFlexiColumnModel (org.olat.core.gui.components.form.flexible.impl.elements.table.DefaultFlexiColumnModel)36 FlexiTableColumnModel (org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableColumnModel)36 UserPropertyHandler (org.olat.user.propertyhandlers.UserPropertyHandler)34 StaticFlexiCellRenderer (org.olat.core.gui.components.form.flexible.impl.elements.table.StaticFlexiCellRenderer)28 TextFlexiCellRenderer (org.olat.core.gui.components.form.flexible.impl.elements.table.TextFlexiCellRenderer)24 FormLayoutContainer (org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer)16 SortKey (org.olat.core.commons.persistence.SortKey)12 ArrayList (java.util.ArrayList)10 FlexiTableSortOptions (org.olat.core.gui.components.form.flexible.elements.FlexiTableSortOptions)10 FlexiTableFilter (org.olat.core.gui.components.form.flexible.elements.FlexiTableFilter)4 PassedCellRenderer (org.olat.course.assessment.bulk.PassedCellRenderer)4 Checkbox (org.olat.course.nodes.cl.model.Checkbox)4 ScoreCellRenderer (org.olat.modules.assessment.ui.ScoreCellRenderer)4 Calendar (java.util.Calendar)2 PublisherData (org.olat.core.commons.services.notifications.PublisherData)2 SubscriptionContext (org.olat.core.commons.services.notifications.SubscriptionContext)2 ContextualSubscriptionController (org.olat.core.commons.services.notifications.ui.ContextualSubscriptionController)2 Component (org.olat.core.gui.components.Component)2 FlexiTableSort (org.olat.core.gui.components.form.flexible.elements.FlexiTableSort)2