Search in sources :

Example 11 with FlexiCellRenderer

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

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 12 with FlexiCellRenderer

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

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 13 with FlexiCellRenderer

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

the class AbstractMemberListController method initColumns.

private SortKey initColumns(FlexiTableColumnModel columnsModel) {
    SortKey defaultSortKey = null;
    String editAction = readOnly ? null : TABLE_ACTION_EDIT;
    if (chatEnabled) {
        DefaultFlexiColumnModel chatCol = new DefaultFlexiColumnModel(Cols.online.i18n(), Cols.online.ordinal());
        chatCol.setExportable(false);
        columnsModel.addFlexiColumnModel(chatCol);
    }
    if (isAdministrativeUser) {
        FlexiCellRenderer renderer = new StaticFlexiCellRenderer(editAction, new TextFlexiCellRenderer());
        columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(Cols.username.i18n(), Cols.username.ordinal(), editAction, true, Cols.username.name(), renderer));
        defaultSortKey = new SortKey(Cols.username.name(), 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;
        if (UserConstants.FIRSTNAME.equals(propName) || UserConstants.LASTNAME.equals(propName)) {
            col = new DefaultFlexiColumnModel(userPropertyHandler.i18nColumnDescriptorLabelKey(), colPos, editAction, true, propName, new StaticFlexiCellRenderer(editAction, new TextFlexiCellRenderer()));
        } else {
            col = new DefaultFlexiColumnModel(visible, userPropertyHandler.i18nColumnDescriptorLabelKey(), colPos, true, propName);
        }
        columnsModel.addFlexiColumnModel(col);
        colPos++;
        if (defaultSortKey == null) {
            defaultSortKey = new SortKey(propName, true);
        }
    }
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(Cols.firstTime.i18n(), Cols.firstTime.ordinal(), true, Cols.firstTime.name()));
    if (isLastVisitVisible) {
        columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(Cols.lastTime.i18n(), Cols.lastTime.ordinal(), true, Cols.lastTime.name()));
    }
    CourseRoleCellRenderer roleRenderer = new CourseRoleCellRenderer(getLocale());
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(Cols.role.i18n(), Cols.role.ordinal(), true, Cols.role.name(), roleRenderer));
    if (repoEntry != null) {
        GroupCellRenderer groupRenderer = new GroupCellRenderer();
        columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(Cols.groups.i18n(), Cols.groups.ordinal(), true, Cols.groups.name(), groupRenderer));
    }
    DefaultFlexiColumnModel toolsCol = new DefaultFlexiColumnModel(Cols.tools.i18n(), Cols.tools.ordinal());
    toolsCol.setExportable(false);
    toolsCol.setAlwaysVisible(true);
    columnsModel.addFlexiColumnModel(toolsCol);
    return defaultSortKey;
}
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) DefaultFlexiColumnModel(org.olat.core.gui.components.form.flexible.impl.elements.table.DefaultFlexiColumnModel) FlexiColumnModel(org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiColumnModel) SortKey(org.olat.core.commons.persistence.SortKey) 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 14 with FlexiCellRenderer

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

the class IQIdentityListCourseNodeController method initStatusColumns.

@Override
protected void initStatusColumns(FlexiTableColumnModel columnsModel) {
    super.initStatusColumns(columnsModel);
    IQTESTCourseNode testCourseNode = (IQTESTCourseNode) courseNode;
    if (testCourseNode != null && testCourseNode.hasCompletion()) {
        columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(IdentityCourseElementCols.currentCompletion));
    }
    RepositoryEntry qtiTestEntry = getReferencedRepositoryEntry();
    if (testCourseNode != null && testCourseNode.hasQTI21TimeLimit(qtiTestEntry)) {
        int timeLimitInSeconds = testCourseNode.getQTI21TimeLimitMaxInSeconds(qtiTestEntry);
        boolean suspendEnabled = isSuspendEnable();
        FlexiCellRenderer renderer = new ExtraTimeCellRenderer(!suspendEnabled, timeLimitInSeconds, getLocale());
        String header = suspendEnabled ? "table.header.extra.time" : "table.header.end.date";
        columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(header, IdentityCourseElementCols.details.ordinal(), renderer));
    }
}
Also used : IQTESTCourseNode(org.olat.course.nodes.IQTESTCourseNode) FlexiCellRenderer(org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiCellRenderer) RepositoryEntry(org.olat.repository.RepositoryEntry) DefaultFlexiColumnModel(org.olat.core.gui.components.form.flexible.impl.elements.table.DefaultFlexiColumnModel)

Example 15 with FlexiCellRenderer

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

the class SharedPagesController method initForm.

@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
    FlexiTableColumnModel columnsModel = FlexiTableDataModelFactory.createFlexiTableColumnModel();
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(SharePageCols.bookmark));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(SharePageCols.userInfosStatus, new SharedPageStatusCellRenderer(getTranslator())));
    FlexiCellRenderer titleRenderer = new BooleanCellRenderer(new StaticFlexiCellRenderer("select", new PageTitleCellRenderer()), new PageTitleCellRenderer());
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(true, true, "select", SharePageCols.pageName.ordinal(), "select", true, SharePageCols.pageName.sortKey(), FlexiColumnModel.ALIGNMENT_LEFT, titleRenderer));
    SortKey defaultSortKey = null;
    if (isAdministrativeUser) {
        columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(ShareItemCols.username));
        defaultSortKey = new SortKey(Cols.username.name(), true);
    }
    // followed by the users fields
    int colPos = USER_PROPS_OFFSET;
    for (int i = 0; i < userPropertyHandlers.size(); i++) {
        UserPropertyHandler userPropertyHandler = userPropertyHandlers.get(i);
        String propName = userPropertyHandler.getName();
        if (defaultSortKey == null && i == 0) {
            defaultSortKey = new SortKey(propName, true);
        } else if (UserConstants.LASTNAME.equals(propName) && !isAdministrativeUser) {
            defaultSortKey = new SortKey(propName, true);
        }
        boolean visible = userManager.isMandatoryUserProperty(USER_PROPS_ID, userPropertyHandler);
        columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(visible, userPropertyHandler.i18nColumnDescriptorLabelKey(), colPos, true, propName));
        colPos++;
    }
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(SharePageCols.lastChanges));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(SharePageCols.pageStatus, new StatusCellRenderer(getTranslator())));
    model = new SharedPagesDataModel(columnsModel, getLocale());
    tableEl = uifactory.addTableElement(getWindowControl(), "table", model, 20, false, getTranslator(), formLayout);
    tableEl.setSearchEnabled(true);
    tableEl.setCustomizeColumns(true);
    tableEl.setElementCssClass("o_binder_shared_bookmark_pages_listing");
    tableEl.setEmtpyTableMessageKey("table.sEmptyTable");
    tableEl.setPageSize(24);
    tableEl.setAndLoadPersistedPreferences(ureq, "shared-bookmark-pages");
    if (filters != null && !filters.isEmpty()) {
        List<FlexiTableFilter> tableFilters = new ArrayList<>(filters.size());
        for (PageStatus status : filters) {
            String label = translate(status.i18nKey());
            tableFilters.add(new FlexiTableFilter(label, status.name(), "o_icon ".concat(status.cssClass())));
        }
        tableFilters.add(FlexiTableFilter.SPACER);
        tableFilters.add(new FlexiTableFilter(translate("filter.show.all"), "all", true));
        tableEl.setFilters("Filters", tableFilters, true);
        if (defaultFilter != null) {
            tableEl.setSelectedFilterKey(defaultFilter.name());
        }
    }
}
Also used : PageStatus(org.olat.modules.portfolio.PageStatus) StaticFlexiCellRenderer(org.olat.core.gui.components.form.flexible.impl.elements.table.StaticFlexiCellRenderer) FlexiCellRenderer(org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiCellRenderer) PageTitleCellRenderer(org.olat.modules.portfolio.ui.renderer.PageTitleCellRenderer) ArrayList(java.util.ArrayList) StatusCellRenderer(org.olat.modules.portfolio.ui.renderer.StatusCellRenderer) SharedPageStatusCellRenderer(org.olat.modules.portfolio.ui.renderer.SharedPageStatusCellRenderer) SortKey(org.olat.core.commons.persistence.SortKey) StaticFlexiCellRenderer(org.olat.core.gui.components.form.flexible.impl.elements.table.StaticFlexiCellRenderer) SharedPageStatusCellRenderer(org.olat.modules.portfolio.ui.renderer.SharedPageStatusCellRenderer) BooleanCellRenderer(org.olat.core.gui.components.form.flexible.impl.elements.table.BooleanCellRenderer) FlexiTableFilter(org.olat.core.gui.components.form.flexible.elements.FlexiTableFilter) FlexiTableColumnModel(org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableColumnModel) 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)26 FlexiCellRenderer (org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiCellRenderer)26 StaticFlexiCellRenderer (org.olat.core.gui.components.form.flexible.impl.elements.table.StaticFlexiCellRenderer)24 FlexiTableColumnModel (org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableColumnModel)22 TextFlexiCellRenderer (org.olat.core.gui.components.form.flexible.impl.elements.table.TextFlexiCellRenderer)20 BooleanCellRenderer (org.olat.core.gui.components.form.flexible.impl.elements.table.BooleanCellRenderer)10 SortKey (org.olat.core.commons.persistence.SortKey)6 ArrayList (java.util.ArrayList)4 FormLayoutContainer (org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer)4 DateFlexiCellRenderer (org.olat.core.gui.components.form.flexible.impl.elements.table.DateFlexiCellRenderer)4 RepositoryEntry (org.olat.repository.RepositoryEntry)4 UserPropertyHandler (org.olat.user.propertyhandlers.UserPropertyHandler)4 HashMap (java.util.HashMap)2 LicenseRenderer (org.olat.core.commons.services.license.ui.LicenseRenderer)2 TaskStatusRenderer (org.olat.core.commons.services.taskexecutor.ui.TaskStatusRenderer)2 FlexiTableFilter (org.olat.core.gui.components.form.flexible.elements.FlexiTableFilter)2 FlexiTableSortOptions (org.olat.core.gui.components.form.flexible.elements.FlexiTableSortOptions)2 FlexiColumnModel (org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiColumnModel)2 IQTESTCourseNode (org.olat.course.nodes.IQTESTCourseNode)2 LanguageConfiguration (org.olat.course.site.model.LanguageConfiguration)2