Search in sources :

Example 6 with FlexiColumnModel

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

the class PFCoachController method initForm.

@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
    if (formLayout instanceof FormLayoutContainer) {
        FormLayoutContainer layoutCont = (FormLayoutContainer) formLayout;
        OLATResource course = courseEnv.getCourseGroupManager().getCourseResource();
        String businessPath = getWindowControl().getBusinessControl().getAsString();
        SubscriptionContext subsContext = new SubscriptionContext(course, pfNode.getIdent());
        PublisherData publisherData = new PublisherData(OresHelper.calculateTypeName(PFCourseNode.class), String.valueOf(course.getResourceableId()), businessPath);
        contextualSubscriptionCtr = new ContextualSubscriptionController(ureq, getWindowControl(), subsContext, publisherData);
        listenTo(contextualSubscriptionCtr);
        layoutCont.put("contextualSubscription", contextualSubscriptionCtr.getInitialComponent());
        backLink = LinkFactory.createLinkBack(layoutCont.getFormItemComponent(), this);
    }
    FlexiTableColumnModel columnsModel = FlexiTableDataModelFactory.createFlexiTableColumnModel();
    int i = 0;
    FlexiTableSortOptions options = new FlexiTableSortOptions();
    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);
        if (!options.hasDefaultOrderBy()) {
            options.setDefaultOrderBy(new SortKey(propName, true));
        } else if (UserConstants.LASTNAME.equals(propName)) {
            options.setDefaultOrderBy(new SortKey(propName, true));
        }
    }
    if (pfNode.hasParticipantBoxConfigured()) {
        columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(DropBoxCols.numberFiles, "drop.box"));
        columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(DropBoxCols.lastUpdate));
    }
    if (pfNode.hasCoachBoxConfigured()) {
        columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(DropBoxCols.numberFilesReturn, "return.box"));
        columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(DropBoxCols.lastUpdateReturn));
    }
    StaticFlexiCellRenderer openCellRenderer = new StaticFlexiCellRenderer(translate("open.box"), "open.box");
    openCellRenderer.setIconRightCSS("o_icon_start o_icon-fw");
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(DropBoxCols.openbox, "open.box", openCellRenderer));
    tableModel = new DropBoxTableModel(columnsModel, getTranslator());
    dropboxTable = uifactory.addTableElement(getWindowControl(), "table", tableModel, getTranslator(), formLayout);
    dropboxTable.setMultiSelect(true);
    dropboxTable.setSelectAllEnable(true);
    dropboxTable.setExportEnabled(true);
    dropboxTable.setSortSettings(options);
    dropboxTable.setAndLoadPersistedPreferences(ureq, "participant-folder_coach_" + pfView.name());
    dropboxTable.setEmtpyTableMessageKey("table.empty");
    FormLayoutContainer buttonGroupLayout = FormLayoutContainer.createButtonLayout("buttons", getTranslator());
    buttonGroupLayout.setElementCssClass("o_button_group");
    formLayout.add(buttonGroupLayout);
    downloadLink = uifactory.addFormLink("download.link", buttonGroupLayout, Link.BUTTON);
    uploadAllLink = uifactory.addFormLink("upload.link", buttonGroupLayout, Link.BUTTON);
}
Also used : PFCourseNode(org.olat.course.nodes.PFCourseNode) FlexiTableSortOptions(org.olat.core.gui.components.form.flexible.elements.FlexiTableSortOptions) 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) OLATResource(org.olat.resource.OLATResource) SortKey(org.olat.core.commons.persistence.SortKey) PublisherData(org.olat.core.commons.services.notifications.PublisherData) ContextualSubscriptionController(org.olat.core.commons.services.notifications.ui.ContextualSubscriptionController) 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) SubscriptionContext(org.olat.core.commons.services.notifications.SubscriptionContext) UserPropertyHandler(org.olat.user.propertyhandlers.UserPropertyHandler) DefaultFlexiColumnModel(org.olat.core.gui.components.form.flexible.impl.elements.table.DefaultFlexiColumnModel)

Example 7 with FlexiColumnModel

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

the class ForumMessageListController method initForm.

@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
    List<FlexiTableSort> sorts = new ArrayList<>();
    sorts.add(new FlexiTableSort(translate("natural.sort"), "natural"));
    FlexiTableColumnModel columnsModel = FlexiTableDataModelFactory.createFlexiTableColumnModel();
    if (withType) {
        columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(ForumMessageCols.type, new StatusTypeCellRenderer()));
        sorts.add(new FlexiTableSort(translate(ForumMessageCols.type.i18nHeaderKey()), ForumMessageCols.type.name()));
    }
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(ForumMessageCols.thread, "select", new StaticFlexiCellRenderer("select", new IndentCellRenderer())));
    sorts.add(new FlexiTableSort(translate(ForumMessageCols.thread.i18nHeaderKey()), ForumMessageCols.thread.name()));
    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, "select", true, propName, new StaticFlexiCellRenderer("select", new TextFlexiCellRenderer()));
        } else {
            col = new DefaultFlexiColumnModel(visible, userPropertyHandler.i18nColumnDescriptorLabelKey(), colPos, true, propName);
        }
        sorts.add(new FlexiTableSort(translate(userPropertyHandler.i18nColumnDescriptorLabelKey()), propName));
        columnsModel.addFlexiColumnModel(col);
        colPos++;
    }
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(ForumMessageCols.lastModified));
    sorts.add(new FlexiTableSort(translate(ForumMessageCols.lastModified.i18nHeaderKey()), ForumMessageCols.lastModified.name()));
    dataModel = new ForumMessageDataModel(columnsModel, getTranslator());
    tableEl = uifactory.addTableElement(getWindowControl(), "messages", dataModel, getTranslator(), formLayout);
    tableEl.setCssDelegate(new MessageCssDelegate());
    FlexiTableSortOptions sortOptions = new FlexiTableSortOptions();
    sortOptions.setFromColumnModel(false);
    sortOptions.setSorts(sorts);
    tableEl.setSortSettings(sortOptions);
}
Also used : FlexiTableSortOptions(org.olat.core.gui.components.form.flexible.elements.FlexiTableSortOptions) 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) 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) FlexiTableSort(org.olat.core.gui.components.form.flexible.elements.FlexiTableSort) DefaultFlexiColumnModel(org.olat.core.gui.components.form.flexible.impl.elements.table.DefaultFlexiColumnModel) UserPropertyHandler(org.olat.user.propertyhandlers.UserPropertyHandler)

Example 8 with FlexiColumnModel

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

the class CheckListAssessmentDataModel method export.

@Override
public MediaResource export(FlexiTableComponent ftC) {
    List<CheckListAssessmentRow> currentRows = getObjects();
    setObjects(backupRows);
    FlexiTableColumnModel columnModel = getTableColumnModel();
    int numOfColumns = columnModel.getColumnCount();
    List<FlexiColumnModel> columns = new ArrayList<>(numOfColumns);
    for (int i = 0; i < numOfColumns; i++) {
        FlexiColumnModel column = columnModel.getColumnModel(i);
        String headerKey = column.getHeaderKey();
        if (!"edit.checkbox".equals(headerKey)) {
            columns.add(column);
        }
    }
    CheckListXlsFlexiTableExporter exporter = new CheckListXlsFlexiTableExporter();
    MediaResource resource = exporter.export(ftC, this, columns, ftC.getTranslator());
    // replace the current perhaps filtered rows
    super.setObjects(currentRows);
    return resource;
}
Also used : FlexiColumnModel(org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiColumnModel) ArrayList(java.util.ArrayList) FlexiTableColumnModel(org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableColumnModel) MediaResource(org.olat.core.gui.media.MediaResource)

Example 9 with FlexiColumnModel

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

the class CourseReminderLogsController 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()));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(SendCols.reminder.i18nKey(), SendCols.reminder.ordinal(), "reminder", true, SendCols.reminder.name(), new StaticFlexiCellRenderer("reminder", new TextFlexiCellRenderer())));
    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()));
    // user properties
    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_log_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 10 with FlexiColumnModel

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

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)

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