Search in sources :

Example 21 with StaticFlexiCellRenderer

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

the class SharedBindersController method initForm.

@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
    FlexiTableColumnModel columnsModel = FlexiTableDataModelFactory.createFlexiTableColumnModel();
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(false, ShareItemCols.binderKey, "select"));
    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(ShareItemCols.binderName, "select"));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(ShareItemCols.courseName, "select"));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(ShareItemCols.lastModified));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(ShareItemCols.recentLaunch));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(ShareItemCols.openSections, "select"));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(ShareItemCols.selectSections, new SelectSectionsCellRenderer()));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(ShareItemCols.newlyPublishedPage));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(false, ShareItemCols.draftPage));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(false, ShareItemCols.inRevisionPage));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(false, ShareItemCols.closedPage));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(ShareItemCols.grading, new AssessmentEntryCellRenderer(getTranslator())));
    StaticFlexiCellRenderer selectRenderer = new StaticFlexiCellRenderer(translate("select"), "select");
    selectRenderer.setIconRightCSS("o_icon-sw o_icon_start");
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(true, true, "select", -1, "select", false, null, FlexiColumnModel.ALIGNMENT_LEFT, selectRenderer));
    StaticFlexiCellRenderer leaveRenderer = new StaticFlexiCellRenderer(translate("leave"), "leave");
    leaveRenderer.setIconRightCSS("o_icon-sw o_icon_delete");
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(false, false, "leave", -2, "leave", false, null, FlexiColumnModel.ALIGNMENT_LEFT, leaveRenderer));
    model = new SharedBindersDataModel(columnsModel, getLocale());
    tableEl = uifactory.addTableElement(getWindowControl(), "table", model, 20, false, getTranslator(), formLayout);
    tableEl.setSearchEnabled(true);
    tableEl.setCustomizeColumns(true);
    tableEl.setElementCssClass("o_binder_shared_items_listing");
    tableEl.setEmtpyTableMessageKey("table.sEmptyTable");
    tableEl.setPageSize(24);
    tableEl.setAndLoadPersistedPreferences(ureq, "shared-items");
    FlexiTableSortOptions options = new FlexiTableSortOptions();
    if (defaultSortKey != null) {
        options.setDefaultOrderBy(defaultSortKey);
    }
    tableEl.setSortSettings(options);
    List<FlexiTableFilter> tableFilters = new ArrayList<>();
    tableFilters.add(new FlexiTableFilter(translate("filter.sections.empty"), SharedBindersDataModel.EMPTY_SECTIONS, true));
    tableFilters.add(FlexiTableFilter.SPACER);
    tableFilters.add(new FlexiTableFilter(translate("filter.show.all"), "all", true));
    tableEl.setFilters("Filters", tableFilters, false);
    tableEl.setSelectedFilterKey(SharedBindersDataModel.EMPTY_SECTIONS);
}
Also used : FlexiTableSortOptions(org.olat.core.gui.components.form.flexible.elements.FlexiTableSortOptions) SelectSectionsCellRenderer(org.olat.modules.portfolio.ui.renderer.SelectSectionsCellRenderer) ArrayList(java.util.ArrayList) SortKey(org.olat.core.commons.persistence.SortKey) StaticFlexiCellRenderer(org.olat.core.gui.components.form.flexible.impl.elements.table.StaticFlexiCellRenderer) AssessmentEntryCellRenderer(org.olat.modules.portfolio.ui.renderer.AssessmentEntryCellRenderer) 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 22 with StaticFlexiCellRenderer

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

the class BusinessGroupListController method initColumnModel.

@Override
protected FlexiTableColumnModel initColumnModel() {
    FlexiTableColumnModel columnsModel = super.initColumnModel();
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(Cols.allowDelete.i18n(), Cols.allowDelete.ordinal(), TABLE_ACTION_DELETE, new BooleanCellRenderer(new StaticFlexiCellRenderer(translate("table.header.delete"), TABLE_ACTION_DELETE), null)));
    return columnsModel;
}
Also used : 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) DefaultFlexiColumnModel(org.olat.core.gui.components.form.flexible.impl.elements.table.DefaultFlexiColumnModel)

Example 23 with StaticFlexiCellRenderer

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

the class LifecycleAdminController method initForm.

@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
    // add the table
    FlexiTableColumnModel columnsModel = FlexiTableDataModelFactory.createFlexiTableColumnModel();
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(LCCols.softkey.i18nKey(), LCCols.softkey.ordinal()));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(LCCols.label.i18nKey(), LCCols.label.ordinal()));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(LCCols.validFrom.i18nKey(), LCCols.validFrom.ordinal()));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(LCCols.validTo.i18nKey(), LCCols.validTo.ordinal()));
    FlexiCellRenderer delRenderer = new BooleanCellRenderer(new StaticFlexiCellRenderer(translate("delete"), "delete-cycle"), null);
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel("delete", LCCols.delete.ordinal(), "delete-cycle", delRenderer));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel("edit", translate(LCCols.edit.i18nKey()), "edit-lifecycle"));
    model = new LifecycleDataModel(columnsModel);
    tableEl = uifactory.addTableElement(getWindowControl(), "cycles", model, getTranslator(), formLayout);
    tableEl.setRendererType(FlexiTableRendererType.classic);
    tableEl.setCustomizeColumns(false);
    createLifeCycle = uifactory.addFormLink("create.lifecycle", formLayout, Link.BUTTON);
}
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) FlexiCellRenderer(org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiCellRenderer) BooleanCellRenderer(org.olat.core.gui.components.form.flexible.impl.elements.table.BooleanCellRenderer) FlexiTableColumnModel(org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableColumnModel) DefaultFlexiColumnModel(org.olat.core.gui.components.form.flexible.impl.elements.table.DefaultFlexiColumnModel)

Example 24 with StaticFlexiCellRenderer

use of org.olat.core.gui.components.form.flexible.impl.elements.table.StaticFlexiCellRenderer 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 25 with StaticFlexiCellRenderer

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

the class AbstractAssignmentEditController method initForm.

@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
    // tasks
    String tasksPage = velocity_root + "/edit_task_list.html";
    FormLayoutContainer tasksCont = FormLayoutContainer.createCustomFormLayout("tasks", getTranslator(), tasksPage);
    tasksCont.setRootForm(mainForm);
    formLayout.add(tasksCont);
    addTaskLink = uifactory.addFormLink("add.task", tasksCont, Link.BUTTON);
    addTaskLink.setElementCssClass("o_sel_course_gta_add_task");
    addTaskLink.setIconLeftCSS("o_icon o_icon_upload");
    addTaskLink.setVisible(!readOnly);
    createTaskLink = uifactory.addFormLink("create.task", tasksCont, Link.BUTTON);
    createTaskLink.setElementCssClass("o_sel_course_gta_create_task");
    createTaskLink.setIconLeftCSS("o_icon o_icon_edit");
    createTaskLink.setVisible(!readOnly);
    FlexiTableColumnModel columnsModel = FlexiTableDataModelFactory.createFlexiTableColumnModel();
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(TDCols.title.i18nKey(), TDCols.title.ordinal()));
    fileExistsRenderer = new WarningFlexiCellRenderer();
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(TDCols.file.i18nKey(), TDCols.file.ordinal(), fileExistsRenderer));
    if (!readOnly) {
        columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel("table.header.edit", TDCols.edit.ordinal(), "edit", new BooleanCellRenderer(new StaticFlexiCellRenderer(translate("edit"), "edit"), new StaticFlexiCellRenderer(translate("replace"), "edit"))));
        columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel("table.header.edit", translate("delete"), "delete"));
    }
    taskModel = new TaskDefinitionTableModel(columnsModel);
    taskDefTableEl = uifactory.addTableElement(getWindowControl(), "taskTable", taskModel, getTranslator(), tasksCont);
    taskDefTableEl.setExportEnabled(true);
    updateModel();
}
Also used : StaticFlexiCellRenderer(org.olat.core.gui.components.form.flexible.impl.elements.table.StaticFlexiCellRenderer) BooleanCellRenderer(org.olat.core.gui.components.form.flexible.impl.elements.table.BooleanCellRenderer) FormLayoutContainer(org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer) FlexiTableColumnModel(org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableColumnModel) DefaultFlexiColumnModel(org.olat.core.gui.components.form.flexible.impl.elements.table.DefaultFlexiColumnModel)

Aggregations

DefaultFlexiColumnModel (org.olat.core.gui.components.form.flexible.impl.elements.table.DefaultFlexiColumnModel)126 StaticFlexiCellRenderer (org.olat.core.gui.components.form.flexible.impl.elements.table.StaticFlexiCellRenderer)126 FlexiTableColumnModel (org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableColumnModel)118 TextFlexiCellRenderer (org.olat.core.gui.components.form.flexible.impl.elements.table.TextFlexiCellRenderer)60 BooleanCellRenderer (org.olat.core.gui.components.form.flexible.impl.elements.table.BooleanCellRenderer)56 UserPropertyHandler (org.olat.user.propertyhandlers.UserPropertyHandler)36 SortKey (org.olat.core.commons.persistence.SortKey)30 FormLayoutContainer (org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer)28 FlexiColumnModel (org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiColumnModel)28 FlexiTableSortOptions (org.olat.core.gui.components.form.flexible.elements.FlexiTableSortOptions)26 FlexiCellRenderer (org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiCellRenderer)24 DateFlexiCellRenderer (org.olat.core.gui.components.form.flexible.impl.elements.table.DateFlexiCellRenderer)18 ArrayList (java.util.ArrayList)16 FlexiTableFilter (org.olat.core.gui.components.form.flexible.elements.FlexiTableFilter)10 PassedCellRenderer (org.olat.course.assessment.bulk.PassedCellRenderer)8 LicenseRenderer (org.olat.core.commons.services.license.ui.LicenseRenderer)4 IndentedNodeRenderer (org.olat.course.assessment.IndentedNodeRenderer)4 ScoreCellRenderer (org.olat.modules.assessment.ui.ScoreCellRenderer)4 SharedPageStatusCellRenderer (org.olat.modules.portfolio.ui.renderer.SharedPageStatusCellRenderer)4 StatusCellRenderer (org.olat.modules.portfolio.ui.renderer.StatusCellRenderer)4