Search in sources :

Example 21 with FlexiTableSortOptions

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

the class ParticipantListRepositoryController method initForm.

@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
    if (formLayout instanceof FormLayoutContainer && !printView) {
        FormLayoutContainer layoutCont = (FormLayoutContainer) formLayout;
        layoutCont.contextPut("winid", "w" + layoutCont.getFormItemComponent().getDispatchID());
        layoutCont.getFormItemComponent().addListener(this);
        layoutCont.getFormItemComponent().contextPut("withPrint", Boolean.TRUE);
    }
    FlexiTableSortOptions options = new FlexiTableSortOptions();
    FlexiTableColumnModel columnsModel = FlexiTableDataModelFactory.createFlexiTableColumnModel();
    if (isAdministrativeUser) {
        columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(ParticipantsCols.username));
        options.setDefaultOrderBy(new SortKey(ParticipantsCols.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));
        }
    }
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(ParticipantsCols.plannedLectures));
    if (rollCallEnabled) {
        columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(ParticipantsCols.attendedLectures));
        if (authorizedAbsenceEnabled) {
            columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(ParticipantsCols.unauthorizedAbsenceLectures));
            columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(ParticipantsCols.authorizedAbsenceLectures));
        } else {
            columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(ParticipantsCols.absentLectures, new LongCellRenderer("o_sel_absences")));
        }
        FlexiColumnModel progressCol = new DefaultFlexiColumnModel(ParticipantsCols.progress, new LectureStatisticsCellRenderer());
        progressCol.setExportable(false);
        columnsModel.addFlexiColumnModel(progressCol);
    }
    if (rateEnabled) {
        FlexiColumnModel warningCol = new DefaultFlexiColumnModel(ParticipantsCols.rateWarning, new RateWarningCellRenderer(getTranslator()));
        warningCol.setExportable(false);
        columnsModel.addFlexiColumnModel(warningCol);
        columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(ParticipantsCols.rate, new PercentCellRenderer()));
    }
    FlexiColumnModel infoCol = new DefaultFlexiColumnModel(ParticipantsCols.infos, new ParticipantInfosRenderer(getTranslator(), defaultRate));
    infoCol.setExportable(false);
    columnsModel.addFlexiColumnModel(infoCol);
    if (!printView) {
        DefaultFlexiColumnModel editColumn = new DefaultFlexiColumnModel("table.header.edit", -1, "edit", new StaticFlexiCellRenderer("", "edit", "o_icon o_icon-lg o_icon_edit", translate("edit"), null));
        editColumn.setExportable(false);
        editColumn.setAlwaysVisible(true);
        columnsModel.addFlexiColumnModel(editColumn);
    }
    tableModel = new ParticipantListDataModel(columnsModel, getTranslator(), getLocale());
    tableEl = uifactory.addTableElement(getWindowControl(), "table", tableModel, 20, false, getTranslator(), formLayout);
    tableEl.setExportEnabled(!printView);
    tableEl.setEmtpyTableMessageKey("empty.table.participant.list");
    tableEl.setSortSettings(options);
    tableEl.setAndLoadPersistedPreferences(ureq, "participant-list-repo-entry");
}
Also used : FlexiTableSortOptions(org.olat.core.gui.components.form.flexible.elements.FlexiTableSortOptions) LongCellRenderer(org.olat.modules.lecture.ui.component.LongCellRenderer) DefaultFlexiColumnModel(org.olat.core.gui.components.form.flexible.impl.elements.table.DefaultFlexiColumnModel) FlexiColumnModel(org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiColumnModel) RateWarningCellRenderer(org.olat.modules.lecture.ui.component.RateWarningCellRenderer) FormLayoutContainer(org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer) SortKey(org.olat.core.commons.persistence.SortKey) ParticipantInfosRenderer(org.olat.modules.lecture.ui.component.ParticipantInfosRenderer) PercentCellRenderer(org.olat.modules.lecture.ui.component.PercentCellRenderer) LectureStatisticsCellRenderer(org.olat.modules.lecture.ui.component.LectureStatisticsCellRenderer) StaticFlexiCellRenderer(org.olat.core.gui.components.form.flexible.impl.elements.table.StaticFlexiCellRenderer) 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)

Example 22 with FlexiTableSortOptions

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

the class GoToMeetingsController method initForm.

@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
    // add the table
    FlexiTableColumnModel columnsModel = FlexiTableDataModelFactory.createFlexiTableColumnModel();
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(MeetingsCols.name.i18nHeaderKey(), MeetingsCols.name.ordinal(), true, MeetingsCols.name.name()));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(MeetingsCols.start.i18nHeaderKey(), MeetingsCols.start.ordinal(), true, MeetingsCols.start.name()));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(MeetingsCols.end.i18nHeaderKey(), MeetingsCols.end.ordinal(), true, MeetingsCols.end.name()));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel("select", translate("select"), "select-upcoming"));
    upcomingTableModel = new GoToMeetingTableModel(columnsModel);
    upcomingTableEl = uifactory.addTableElement(getWindowControl(), "upcomingmeetings", upcomingTableModel, getTranslator(), formLayout);
    upcomingTableEl.setEmtpyTableMessageKey("table.empty");
    FlexiTableSortOptions sortOptions = new FlexiTableSortOptions();
    sortOptions.setDefaultOrderBy(new SortKey(MeetingsCols.start.name(), true));
    upcomingTableEl.setSortSettings(sortOptions);
    FlexiTableColumnModel pastColumnsModel = FlexiTableDataModelFactory.createFlexiTableColumnModel();
    pastColumnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(MeetingsCols.name.i18nHeaderKey(), MeetingsCols.name.ordinal(), true, MeetingsCols.name.name()));
    pastColumnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(MeetingsCols.start.i18nHeaderKey(), MeetingsCols.start.ordinal(), true, MeetingsCols.start.name()));
    pastColumnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(MeetingsCols.end.i18nHeaderKey(), MeetingsCols.end.ordinal(), true, MeetingsCols.end.name()));
    pastColumnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel("select", translate("select"), "select-past"));
    pastTableModel = new GoToMeetingTableModel(pastColumnsModel);
    pastTableEl = uifactory.addTableElement(getWindowControl(), "pastmeetings", pastTableModel, getTranslator(), formLayout);
    FlexiTableSortOptions pastSortOptions = new FlexiTableSortOptions();
    pastSortOptions.setDefaultOrderBy(new SortKey(MeetingsCols.start.name(), false));
    pastTableEl.setSortSettings(sortOptions);
    updateModel();
}
Also used : FlexiTableSortOptions(org.olat.core.gui.components.form.flexible.elements.FlexiTableSortOptions) FlexiTableColumnModel(org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableColumnModel) SortKey(org.olat.core.commons.persistence.SortKey) DefaultFlexiColumnModel(org.olat.core.gui.components.form.flexible.impl.elements.table.DefaultFlexiColumnModel)

Example 23 with FlexiTableSortOptions

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

the class AbstractBusinessGroupListController method initForm.

@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
    FlexiTableColumnModel columnModel = initColumnModel();
    groupTableModel = initTableModel(columnModel);
    tableEl = uifactory.addTableElement(getWindowControl(), "table", groupTableModel, 20, false, getTranslator(), formLayout);
    tableEl.setElementCssClass("o_group_list");
    FlexiTableSortOptions options = new FlexiTableSortOptions();
    options.setFromColumnModel(true);
    tableEl.setSortSettings(options);
    tableEl.setAndLoadPersistedPreferences(ureq, "gbg-list-" + prefsKey);
    searchCtrl = new BusinessGroupSearchController(ureq, getWindowControl(), isAdmin(), true, showAdminTools, isAdmin(), mainForm);
    searchCtrl.setEnabled(false);
    listenTo(searchCtrl);
    tableEl.setSearchEnabled(true);
    tableEl.setExtendedSearch(searchCtrl);
    if (startExtendedSearch) {
        tableEl.expandExtendedSearch(ureq);
    }
    initButtons(formLayout, ureq);
}
Also used : FlexiTableSortOptions(org.olat.core.gui.components.form.flexible.elements.FlexiTableSortOptions) FlexiTableColumnModel(org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableColumnModel)

Example 24 with FlexiTableSortOptions

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

the class IdentityListCourseNodeController method initForm.

@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
    if (formLayout instanceof FormLayoutContainer) {
        FormLayoutContainer layoutCont = (FormLayoutContainer) formLayout;
        layoutCont.contextPut("courseNodeTitle", courseNode.getShortTitle());
        layoutCont.contextPut("courseNodeCssClass", CourseNodeFactory.getInstance().getCourseNodeConfigurationEvenForDisabledBB(courseNode.getType()).getIconCSSClass());
        if (group != null) {
            layoutCont.contextPut("businessGroupName", group.getName());
        }
    }
    ICourse course = CourseFactory.loadCourse(courseEntry);
    String select = isSelectable() ? "select" : null;
    // add the table
    FlexiTableSortOptions options = new FlexiTableSortOptions();
    FlexiTableColumnModel columnsModel = FlexiTableDataModelFactory.createFlexiTableColumnModel();
    if (isAdministrativeUser) {
        options.setDefaultOrderBy(new SortKey(IdentityCourseElementCols.username.sortKey(), true));
        columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(IdentityCourseElementCols.username, select));
    }
    int colIndex = AssessmentToolConstants.USER_PROPS_OFFSET;
    for (int i = 0; i < userPropertyHandlers.size(); i++) {
        UserPropertyHandler userPropertyHandler = userPropertyHandlers.get(i);
        boolean visible = UserManager.getInstance().isMandatoryUserProperty(AssessmentToolConstants.usageIdentifyer, userPropertyHandler);
        columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(visible, userPropertyHandler.i18nColumnDescriptorLabelKey(), colIndex, select, true, "userProp-" + colIndex));
        if (!options.hasDefaultOrderBy()) {
            options.setDefaultOrderBy(new SortKey("userProp-" + colIndex, true));
        }
        colIndex++;
    }
    initAssessmentColumns(columnsModel);
    initStatusColumns(columnsModel);
    initModificationDatesColumns(columnsModel);
    initCalloutColumns(columnsModel);
    AssessableCourseNode assessableNode = courseNode instanceof AssessableCourseNode ? (AssessableCourseNode) courseNode : null;
    usersTableModel = new IdentityListCourseNodeTableModel(columnsModel, assessableNode, getLocale());
    tableEl = uifactory.addTableElement(getWindowControl(), "table", usersTableModel, 20, false, getTranslator(), formLayout);
    tableEl.setExportEnabled(true);
    tableEl.setSearchEnabled(new AssessedIdentityListProvider(getIdentity(), courseEntry, referenceEntry, courseNode.getIdent(), assessmentCallback), ureq.getUserSession());
    tableEl.setMultiSelect(!coachCourseEnv.isCourseReadOnly());
    tableEl.setSortSettings(options);
    tableEl.setSelectAllEnable(true);
    List<FlexiTableFilter> filters = new ArrayList<>();
    filters.add(new FlexiTableFilter(translate("filter.showAll"), "showAll", true));
    filters.add(FlexiTableFilter.SPACER);
    filters.add(new FlexiTableFilter(translate("filter.passed"), "passed"));
    filters.add(new FlexiTableFilter(translate("filter.failed"), "failed"));
    filters.add(new FlexiTableFilter(translate("filter.inProgress"), "inProgress"));
    filters.add(new FlexiTableFilter(translate("filter.inReview"), "inReview"));
    filters.add(new FlexiTableFilter(translate("filter.done"), "done"));
    tableEl.setFilters("", filters, false);
    if (assessmentCallback.canAssessBusinessGoupMembers() && group == null) {
        List<BusinessGroup> coachedGroups = null;
        if (assessmentCallback.isAdmin()) {
            coachedGroups = course.getCourseEnvironment().getCourseGroupManager().getAllBusinessGroups();
        } else {
            coachedGroups = assessmentCallback.getCoachedGroups();
        }
        if (coachedGroups.size() > 0) {
            List<FlexiTableFilter> groupFilters = new ArrayList<>();
            for (BusinessGroup coachedGroup : coachedGroups) {
                String groupName = StringHelper.escapeHtml(coachedGroup.getName());
                groupFilters.add(new FlexiTableFilter(groupName, coachedGroup.getKey().toString(), "o_icon o_icon_group"));
            }
            tableEl.setExtendedFilterButton(translate("filter.groups"), groupFilters);
        }
    }
    tableEl.setAndLoadPersistedPreferences(ureq, getTableId());
}
Also used : FlexiTableSortOptions(org.olat.core.gui.components.form.flexible.elements.FlexiTableSortOptions) BusinessGroup(org.olat.group.BusinessGroup) ArrayList(java.util.ArrayList) FormLayoutContainer(org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer) ICourse(org.olat.course.ICourse) SortKey(org.olat.core.commons.persistence.SortKey) CalculatedAssessableCourseNode(org.olat.course.nodes.CalculatedAssessableCourseNode) AssessableCourseNode(org.olat.course.nodes.AssessableCourseNode) 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)

Example 25 with FlexiTableSortOptions

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

the class SelectThreadStepForm method initForm.

@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
    FlexiTableColumnModel columnsModel = FlexiTableDataModelFactory.createFlexiTableColumnModel();
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(ThreadListCols.type, new StatusTypeCellRenderer()));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(ThreadListCols.thread, "choose", new StaticFlexiCellRenderer("choose", new StickyCellRenderer())));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(ThreadListCols.creator));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(ThreadListCols.lastModified));
    if (!guestOnly) {
        columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(ThreadListCols.markedMessages, "marked", new StaticFlexiCellRenderer("marked", new TextFlexiCellRenderer())));
        columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(ThreadListCols.unreadMessages, "unread", new StaticFlexiCellRenderer("unread", new TextFlexiCellRenderer())));
    }
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(ThreadListCols.totalMessages));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(ThreadListCols.select, "select", new StaticFlexiCellRenderer(translate("select"), "select", "", "o_icon o_icon_select o_icon-fw")));
    threadTableModel = new ThreadListDataModel(columnsModel, getTranslator());
    threadTable = uifactory.addTableElement(getWindowControl(), "threads", threadTableModel, getTranslator(), formLayout);
    threadTable.setCustomizeColumns(false);
    threadTable.setElementCssClass("o_forum");
    threadTable.setEmtpyTableMessageKey("forum.emtpy");
    FlexiTableSortOptions sortOptions = new FlexiTableSortOptions();
    sortOptions.setDefaultOrderBy(new SortKey(ThreadListCols.lastModified.name(), false));
    threadTable.setSortSettings(sortOptions);
    loadModel();
    newThreadButton = uifactory.addFormLink("link.new.thread", formLayout, Link.BUTTON);
    newThreadButton.setIconLeftCSS("o_icon o_icon-fw o_forum_status_thread_icon");
    newThreadButton.setElementCssClass("o_sel_forum_thread_new");
}
Also used : FlexiTableSortOptions(org.olat.core.gui.components.form.flexible.elements.FlexiTableSortOptions) StaticFlexiCellRenderer(org.olat.core.gui.components.form.flexible.impl.elements.table.StaticFlexiCellRenderer) ThreadListDataModel(org.olat.modules.fo.ui.ThreadListDataModel) StatusTypeCellRenderer(org.olat.modules.fo.ui.StatusTypeCellRenderer) FlexiTableColumnModel(org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableColumnModel) TextFlexiCellRenderer(org.olat.core.gui.components.form.flexible.impl.elements.table.TextFlexiCellRenderer) SortKey(org.olat.core.commons.persistence.SortKey) StickyCellRenderer(org.olat.modules.fo.ui.StickyCellRenderer) DefaultFlexiColumnModel(org.olat.core.gui.components.form.flexible.impl.elements.table.DefaultFlexiColumnModel)

Aggregations

FlexiTableSortOptions (org.olat.core.gui.components.form.flexible.elements.FlexiTableSortOptions)52 SortKey (org.olat.core.commons.persistence.SortKey)48 FlexiTableColumnModel (org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableColumnModel)44 DefaultFlexiColumnModel (org.olat.core.gui.components.form.flexible.impl.elements.table.DefaultFlexiColumnModel)38 StaticFlexiCellRenderer (org.olat.core.gui.components.form.flexible.impl.elements.table.StaticFlexiCellRenderer)26 ArrayList (java.util.ArrayList)18 FormLayoutContainer (org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer)18 UserPropertyHandler (org.olat.user.propertyhandlers.UserPropertyHandler)14 TextFlexiCellRenderer (org.olat.core.gui.components.form.flexible.impl.elements.table.TextFlexiCellRenderer)12 FlexiTableFilter (org.olat.core.gui.components.form.flexible.elements.FlexiTableFilter)10 FlexiColumnModel (org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiColumnModel)10 FlexiTableSort (org.olat.core.gui.components.form.flexible.elements.FlexiTableSort)8 BooleanCellRenderer (org.olat.core.gui.components.form.flexible.impl.elements.table.BooleanCellRenderer)8 DateFlexiCellRenderer (org.olat.core.gui.components.form.flexible.impl.elements.table.DateFlexiCellRenderer)8 LicenseRenderer (org.olat.core.commons.services.license.ui.LicenseRenderer)4 TimeFlexiCellRenderer (org.olat.core.gui.components.form.flexible.impl.elements.table.TimeFlexiCellRenderer)4 Identity (org.olat.core.id.Identity)4 AssessableCourseNode (org.olat.course.nodes.AssessableCourseNode)4 BusinessGroup (org.olat.group.BusinessGroup)4 PublisherData (org.olat.core.commons.services.notifications.PublisherData)2