Search in sources :

Example 61 with FlexiTableColumnModel

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

the class ValidationStepForm method initForm.

@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
    AssessableCourseNode courseNode = (AssessableCourseNode) getFromRunContext("courseNode");
    BulkAssessmentSettings settings = new BulkAssessmentSettings(courseNode);
    FlexiTableColumnModel tableColumnModel = FlexiTableDataModelFactory.createFlexiTableColumnModel();
    tableColumnModel.addFlexiColumnModel(new DefaultFlexiColumnModel("table.header.identifier", Cols.identifier.ordinal()));
    tableColumnModel.addFlexiColumnModel(new DefaultFlexiColumnModel("table.header.lastName", Cols.lastName.ordinal()));
    tableColumnModel.addFlexiColumnModel(new DefaultFlexiColumnModel("table.header.firstName", Cols.firstName.ordinal()));
    if (settings.isHasScore()) {
        tableColumnModel.addFlexiColumnModel(new DefaultFlexiColumnModel("table.header.score", Cols.score.ordinal(), new ScoreCellRenderer(settings)));
    }
    if (settings.isHasPassed() && settings.getCut() == null) {
        tableColumnModel.addFlexiColumnModel(new DefaultFlexiColumnModel("table.header.passed", Cols.passed.ordinal(), new PassedCellRenderer()));
    }
    if (settings.isHasUserComment()) {
        tableColumnModel.addFlexiColumnModel(new DefaultFlexiColumnModel("table.header.comment", Cols.comment.ordinal()));
    }
    if (settings.isHasReturnFiles()) {
        tableColumnModel.addFlexiColumnModel(new DefaultFlexiColumnModel("table.header.numOfReturnFiles", Cols.numOfReturnFiles.ordinal()));
    }
    validModel = new ValidDataModel(Collections.<UserData>emptyList());
    validModel.setTableColumnModel(tableColumnModel);
    validTableEl = uifactory.addTableElement(getWindowControl(), "validList", validModel, getTranslator(), formLayout);
    validTableEl.setCustomizeColumns(false);
    invalidModel = new ValidDataModel(Collections.<UserData>emptyList());
    invalidModel.setTableColumnModel(tableColumnModel);
    invalidTableEl = uifactory.addTableElement(getWindowControl(), "notFoundList", invalidModel, getTranslator(), formLayout);
    invalidTableEl.setCustomizeColumns(false);
    flc.contextPut("settings", settings);
}
Also used : AssessableCourseNode(org.olat.course.nodes.AssessableCourseNode) FlexiTableColumnModel(org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableColumnModel) BulkAssessmentSettings(org.olat.course.assessment.model.BulkAssessmentSettings) DefaultFlexiColumnModel(org.olat.core.gui.components.form.flexible.impl.elements.table.DefaultFlexiColumnModel)

Example 62 with FlexiTableColumnModel

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

the class AssessmentModeAdminListController method initForm.

@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
    // search form
    FormLayoutContainer searchLeftForm = FormLayoutContainer.createDefaultFormLayout("left_1", getTranslator());
    searchLeftForm.setRootForm(mainForm);
    formLayout.add("left_1", searchLeftForm);
    idAndRefsEl = uifactory.addTextElement("mode.id", "assessment.mode.id", 128, null, searchLeftForm);
    nameEl = uifactory.addTextElement("mode.name", "assessment.mode.name", 128, null, searchLeftForm);
    FormLayoutContainer searchRightForm = FormLayoutContainer.createDefaultFormLayout("right_1", getTranslator());
    searchRightForm.setRootForm(mainForm);
    formLayout.add("right_1", searchRightForm);
    dateEl = uifactory.addDateChooser("assessment.mode.date", null, searchRightForm);
    dateEl.setDateChooserTimeEnabled(true);
    // search button
    FormLayoutContainer searchButtons = FormLayoutContainer.createButtonLayout("button_layout", getTranslator());
    searchButtons.setRootForm(mainForm);
    formLayout.add("button_layout", searchButtons);
    searchButton = uifactory.addFormLink("search", searchButtons, Link.BUTTON);
    searchButton.setPrimary(true);
    // add the table
    FlexiTableColumnModel columnsModel = FlexiTableDataModelFactory.createFlexiTableColumnModel();
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(Cols.status.i18nKey(), Cols.status.ordinal(), true, Cols.status.name(), new ModeStatusCellRenderer()));
    FlexiCellRenderer renderer = new StaticFlexiCellRenderer("select", new TextFlexiCellRenderer());
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(Cols.course.i18nKey(), Cols.course.ordinal(), "select", true, Cols.course.name(), renderer));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(false, Cols.externalId.i18nKey(), Cols.externalId.ordinal(), true, Cols.externalId.name()));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(false, Cols.externalRef.i18nKey(), Cols.externalRef.ordinal(), true, Cols.externalRef.name()));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(Cols.name.i18nKey(), Cols.name.ordinal(), true, Cols.name.name()));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(Cols.begin.i18nKey(), Cols.begin.ordinal(), true, Cols.begin.name()));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(Cols.end.i18nKey(), Cols.end.ordinal(), true, Cols.end.name()));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(Cols.leadTime.i18nKey(), Cols.leadTime.ordinal(), true, Cols.leadTime.name(), new TimeCellRenderer(getTranslator())));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(Cols.followupTime.i18nKey(), Cols.followupTime.ordinal(), true, Cols.followupTime.name(), new TimeCellRenderer(getTranslator())));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(Cols.target.i18nKey(), Cols.target.ordinal(), true, Cols.target.name(), new TargetAudienceCellRenderer(getTranslator())));
    model = new AssessmentModeListModel(columnsModel, getTranslator(), assessmentModeCoordinationService);
    tableEl = uifactory.addTableElement(getWindowControl(), "table", model, 20, false, getTranslator(), formLayout);
    tableEl.setMultiSelect(false);
    tableEl.setAndLoadPersistedPreferences(ureq, "assessment-mode-admin");
}
Also used : StaticFlexiCellRenderer(org.olat.core.gui.components.form.flexible.impl.elements.table.StaticFlexiCellRenderer) StaticFlexiCellRenderer(org.olat.core.gui.components.form.flexible.impl.elements.table.StaticFlexiCellRenderer) TextFlexiCellRenderer(org.olat.core.gui.components.form.flexible.impl.elements.table.TextFlexiCellRenderer) FlexiCellRenderer(org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiCellRenderer) 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)

Example 63 with FlexiTableColumnModel

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

the class BulkAssessmentOverviewController method initForm.

@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
    newButton = uifactory.addFormLink("new.bulk", formLayout, Link.BUTTON);
    newButton.setElementCssClass("o_sel_assessment_tool_new_bulk_assessment");
    FlexiTableColumnModel columnsModel = FlexiTableDataModelFactory.createFlexiTableColumnModel();
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel("table.header.taskStatus", Cols.taskStatus.ordinal(), new TaskStatusRenderer()));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel("table.header.scheduledDate", Cols.scheduledDate.ordinal()));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel("table.header.node", Cols.courseNode.ordinal(), new CourseNodeRenderer()));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel("table.header.score", Cols.score.ordinal()));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel("table.header.passed", Cols.status.ordinal()));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel("table.header.comment", Cols.comment.ordinal()));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel("table.header.returnFiles", Cols.returnFile.ordinal()));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel("table.header.numOfAssessedUsers", Cols.numOfAssessedUsers.ordinal()));
    FlexiCellRenderer renderer = new StaticFlexiCellRenderer("select-owner", new TextFlexiCellRenderer());
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel("table.header.owner", Cols.owner.ordinal(), "select-owner", renderer));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel("edit", translate("edit"), "edit"));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel("delete", translate("delete"), "delete"));
    taskModel = new TaskDataModel(Collections.<TaskData>emptyList(), columnsModel);
    taskListEl = uifactory.addTableElement(getWindowControl(), "taskList", taskModel, getTranslator(), formLayout);
    reloadTaskModel();
}
Also used : TaskStatusRenderer(org.olat.core.commons.services.taskexecutor.ui.TaskStatusRenderer) StaticFlexiCellRenderer(org.olat.core.gui.components.form.flexible.impl.elements.table.StaticFlexiCellRenderer) StaticFlexiCellRenderer(org.olat.core.gui.components.form.flexible.impl.elements.table.StaticFlexiCellRenderer) TextFlexiCellRenderer(org.olat.core.gui.components.form.flexible.impl.elements.table.TextFlexiCellRenderer) FlexiCellRenderer(org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiCellRenderer) 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 64 with FlexiTableColumnModel

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

the class ChooseColumnsStepForm method initForm.

@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
    setFormTitle("chooseColumns.title");
    setFormDescription("chooseColumns.description");
    setFormContextHelp("Using Course Tools#bulkassessment_map");
    AssessableCourseNode courseNode = (AssessableCourseNode) getFromRunContext("courseNode");
    BulkAssessmentSettings settings = new BulkAssessmentSettings(courseNode);
    String[] usernameKeys = new String[numOfColumns];
    String[] usernameValues = new String[numOfColumns];
    String[] otherKeys = new String[numOfColumns + 1];
    String[] otherValues = new String[numOfColumns + 1];
    for (int i = 0; i < numOfColumns; i++) {
        usernameKeys[i] = "col" + i;
        usernameValues[i] = translate("column", Integer.toString(i + 1));
        otherKeys[i] = "col" + i;
        otherValues[i] = translate("column", Integer.toString(i + 1));
    }
    otherKeys[otherKeys.length - 1] = "col9999";
    otherValues[otherValues.length - 1] = translate("column.dontuse");
    FormLayoutContainer choosersCont = FormLayoutContainer.createDefaultFormLayout("choosers", getTranslator());
    choosersCont.setElementCssClass("o_sel_bulk_assessment_columns");
    choosersCont.setRootForm(mainForm);
    formLayout.add(choosersCont);
    int pos = 0;
    userNameColumnEl = uifactory.addDropdownSingleselect("table.header.identifier", choosersCont, usernameKeys, usernameValues, null);
    if (columnsSettings != null && columnsSettings.getUsernameColumn() < usernameKeys.length) {
        userNameColumnEl.select(getSelectedKey(pos++, columnsSettings.getUsernameColumn(), usernameKeys), true);
    } else if (usernameKeys.length > 0) {
        userNameColumnEl.select(usernameKeys[Math.min(pos++, usernameKeys.length - 1)], true);
    }
    if (settings.isHasScore()) {
        scoreColumnEl = uifactory.addDropdownSingleselect("table.header.score", choosersCont, otherKeys, otherValues, null);
        if (columnsSettings != null && columnsSettings.getScoreColumn() < otherKeys.length) {
            scoreColumnEl.select(getSelectedKey(pos++, columnsSettings.getScoreColumn(), otherKeys), true);
        } else if (otherKeys.length > 0) {
            scoreColumnEl.select(otherKeys[Math.min(pos++, otherKeys.length - 1)], true);
        }
    }
    if (settings.isHasPassed() && settings.getCut() == null) {
        passedColumnEl = uifactory.addDropdownSingleselect("table.header.passed", choosersCont, otherKeys, otherValues, null);
        if (columnsSettings != null && columnsSettings.getPassedColumn() < otherKeys.length) {
            passedColumnEl.select(getSelectedKey(pos++, columnsSettings.getPassedColumn(), otherKeys), true);
        } else if (otherKeys.length > 0) {
            passedColumnEl.select(otherKeys[Math.min(pos++, otherKeys.length - 1)], true);
        }
    }
    if (settings.isHasUserComment()) {
        commentColumnEl = uifactory.addDropdownSingleselect("table.header.comment", choosersCont, otherKeys, otherValues, null);
        if (columnsSettings != null && columnsSettings.getCommentColumn() < otherKeys.length) {
            commentColumnEl.select(getSelectedKey(pos++, columnsSettings.getCommentColumn(), otherKeys), true);
        } else if (otherKeys.length > 0) {
            commentColumnEl.select(otherKeys[Math.min(pos++, otherKeys.length - 1)], true);
        }
    }
    FlexiTableColumnModel tableColumnModel = FlexiTableDataModelFactory.createFlexiTableColumnModel();
    for (int i = 0; i < numOfColumns; i++) {
        DefaultFlexiColumnModel colModel = new DefaultFlexiColumnModel("ccc" + (i + 1), i);
        tableColumnModel.addFlexiColumnModel(colModel);
    }
    overviewDataModel.setTableColumnModel(tableColumnModel);
    FlexiTableElement tableEl = uifactory.addTableElement(getWindowControl(), "overviewList", overviewDataModel, getTranslator(), formLayout);
    tableEl.setCustomizeColumns(false);
}
Also used : AssessableCourseNode(org.olat.course.nodes.AssessableCourseNode) FormLayoutContainer(org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer) FlexiTableColumnModel(org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableColumnModel) BulkAssessmentSettings(org.olat.course.assessment.model.BulkAssessmentSettings) DefaultFlexiColumnModel(org.olat.core.gui.components.form.flexible.impl.elements.table.DefaultFlexiColumnModel) FlexiTableElement(org.olat.core.gui.components.form.flexible.elements.FlexiTableElement)

Example 65 with FlexiTableColumnModel

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

the class CertificateAndEfficiencyStatementListController method initForm.

@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
    if (linkToCoachingTool) {
        coachingToolButton = uifactory.addFormLink("coaching.tool", formLayout, Link.BUTTON);
    }
    FlexiTableColumnModel tableColumnModel = FlexiTableDataModelFactory.createFlexiTableColumnModel();
    tableColumnModel.addFlexiColumnModel(new DefaultFlexiColumnModel(Cols.displayName));
    tableColumnModel.addFlexiColumnModel(new DefaultFlexiColumnModel(Cols.score));
    tableColumnModel.addFlexiColumnModel(new DefaultFlexiColumnModel(Cols.passed, new PassedCellRenderer()));
    tableColumnModel.addFlexiColumnModel(new DefaultFlexiColumnModel("table.header.show", translate("table.header.show"), CMD_SHOW));
    tableColumnModel.addFlexiColumnModel(new DefaultFlexiColumnModel(Cols.lastModified));
    tableColumnModel.addFlexiColumnModel(new DefaultFlexiColumnModel(Cols.certificate, new DownloadCertificateCellRenderer(assessedIdentity, getLocale())));
    tableColumnModel.addFlexiColumnModel(new DefaultFlexiColumnModel(Cols.recertification, new DateFlexiCellRenderer(getLocale())));
    tableColumnModel.addFlexiColumnModel(new DefaultFlexiColumnModel("table.header.launchcourse", translate("table.header.launchcourse"), CMD_LAUNCH_COURSE));
    DefaultFlexiColumnModel deleteColumn = new DefaultFlexiColumnModel(Cols.deleteEfficiencyStatement.i18nHeaderKey(), Cols.deleteEfficiencyStatement.ordinal(), CMD_DELETE, new BooleanCellRenderer(new StaticFlexiCellRenderer(translate("table.action.delete"), CMD_DELETE), null));
    tableColumnModel.addFlexiColumnModel(deleteColumn);
    // artefact
    if (portfolioV2Module.isEnabled()) {
        tableColumnModel.addFlexiColumnModel(new DefaultFlexiColumnModel("table.header.artefact", Cols.efficiencyStatement.ordinal(), CMD_MEDIA, new StaticFlexiCellRenderer(CMD_MEDIA, new AsArtefactCellRenderer())));
    } else {
        EPArtefactHandler<?> artHandler = portfolioModule.getArtefactHandler(EfficiencyStatementArtefact.ARTEFACT_TYPE);
        if (portfolioModule.isEnabled() && artHandler != null && artHandler.isEnabled() && assessedIdentity.equals(getIdentity())) {
            tableColumnModel.addFlexiColumnModel(new DefaultFlexiColumnModel("table.header.artefact", Cols.efficiencyStatement.ordinal(), CMD_ARTEFACT, new StaticFlexiCellRenderer(CMD_ARTEFACT, new AsArtefactCellRenderer())));
        }
    }
    tableModel = new CertificateAndEfficiencyStatementListModel(tableColumnModel, getLocale());
    loadModel();
    tableEl = uifactory.addTableElement(getWindowControl(), "certificates", tableModel, getTranslator(), formLayout);
    tableEl.setElementCssClass("o_sel_certificates_table");
}
Also used : DateFlexiCellRenderer(org.olat.core.gui.components.form.flexible.impl.elements.table.DateFlexiCellRenderer) 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) PassedCellRenderer(org.olat.course.assessment.bulk.PassedCellRenderer) DefaultFlexiColumnModel(org.olat.core.gui.components.form.flexible.impl.elements.table.DefaultFlexiColumnModel)

Aggregations

FlexiTableColumnModel (org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableColumnModel)266 DefaultFlexiColumnModel (org.olat.core.gui.components.form.flexible.impl.elements.table.DefaultFlexiColumnModel)254 StaticFlexiCellRenderer (org.olat.core.gui.components.form.flexible.impl.elements.table.StaticFlexiCellRenderer)118 FormLayoutContainer (org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer)72 BooleanCellRenderer (org.olat.core.gui.components.form.flexible.impl.elements.table.BooleanCellRenderer)70 UserPropertyHandler (org.olat.user.propertyhandlers.UserPropertyHandler)70 TextFlexiCellRenderer (org.olat.core.gui.components.form.flexible.impl.elements.table.TextFlexiCellRenderer)60 ArrayList (java.util.ArrayList)48 FlexiTableSortOptions (org.olat.core.gui.components.form.flexible.elements.FlexiTableSortOptions)46 SortKey (org.olat.core.commons.persistence.SortKey)44 FlexiColumnModel (org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiColumnModel)36 DateFlexiCellRenderer (org.olat.core.gui.components.form.flexible.impl.elements.table.DateFlexiCellRenderer)26 FlexiTableFilter (org.olat.core.gui.components.form.flexible.elements.FlexiTableFilter)22 FlexiCellRenderer (org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiCellRenderer)22 PassedCellRenderer (org.olat.course.assessment.bulk.PassedCellRenderer)20 CSSIconFlexiCellRenderer (org.olat.core.gui.components.form.flexible.impl.elements.table.CSSIconFlexiCellRenderer)18 ScoreCellRenderer (org.olat.modules.assessment.ui.ScoreCellRenderer)18 VelocityContainer (org.olat.core.gui.components.velocity.VelocityContainer)14 FlexiTableElement (org.olat.core.gui.components.form.flexible.elements.FlexiTableElement)12 Translator (org.olat.core.gui.translator.Translator)12