Search in sources :

Example 61 with DefaultFlexiColumnModel

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

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

Example 63 with DefaultFlexiColumnModel

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

the class SubmitDocumentsController method initForm.

@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
    if (config.getBooleanSafe(GTACourseNode.GTASK_EXTERNAL_EDITOR)) {
        uploadDocButton = uifactory.addFormLink("upload.document", formLayout, Link.BUTTON);
        uploadDocButton.setIconLeftCSS("o_icon o_icon_upload");
        uploadDocButton.setElementCssClass("o_sel_course_gta_submit_file");
        uploadDocButton.setVisible(!readOnly);
    }
    if (config.getBooleanSafe(GTACourseNode.GTASK_EMBBEDED_EDITOR)) {
        createDocButton = uifactory.addFormLink("open.editor", formLayout, Link.BUTTON);
        createDocButton.setIconLeftCSS("o_icon o_icon_edit");
        createDocButton.setElementCssClass("o_sel_course_gta_create_doc");
        createDocButton.setI18nKey(docI18nKey + ".open.editor");
        createDocButton.setVisible(!readOnly);
    }
    FlexiTableColumnModel columnsModel = FlexiTableDataModelFactory.createFlexiTableColumnModel();
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(docI18nKey, DocCols.document.ordinal()));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(DocCols.date.i18nKey(), DocCols.date.ordinal()));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(DocCols.uploadedBy.i18nKey(), DocCols.uploadedBy.ordinal()));
    if (!readOnly) {
        columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel("edit", DocCols.edit.ordinal(), "edit", new BooleanCellRenderer(new StaticFlexiCellRenderer(translate("edit"), "edit"), new StaticFlexiCellRenderer(translate("replace"), "edit"))));
        columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel("delete", translate("delete"), "delete"));
    }
    model = new DocumentTableModel(columnsModel);
    tableEl = uifactory.addTableElement(getWindowControl(), "table", model, getTranslator(), formLayout);
    formLayout.add("table", tableEl);
    // configure table to be as slim as possible
    tableEl.setCustomizeColumns(false);
    tableEl.setNumOfRowsEnabled(false);
    tableEl.setElementCssClass("o_table_no_margin");
}
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 64 with DefaultFlexiColumnModel

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

the class VideoAdminTranscodingController method initForm.

@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
    setFormTitle("manage.transcodings.title");
    setFormDescription("manage.transcodings.description");
    setFormContextHelp("Portfolio template: Administration and editing#configuration");
    FlexiTableColumnModel transcodingModel = FlexiTableDataModelFactory.createFlexiTableColumnModel();
    transcodingModel.addFlexiColumnModel(new DefaultFlexiColumnModel(TranscodingCols.resolutions));
    transcodingModel.addFlexiColumnModel(new DefaultFlexiColumnModel(TranscodingCols.sumVideos));
    transcodingModel.addFlexiColumnModel(new DefaultFlexiColumnModel(TranscodingCols.numberTranscodings));
    transcodingModel.addFlexiColumnModel(new DefaultFlexiColumnModel(TranscodingCols.failedTranscodings));
    transcodingModel.addFlexiColumnModel(new DefaultFlexiColumnModel(TranscodingCols.missingTranscodings));
    transcodingModel.addFlexiColumnModel(new DefaultFlexiColumnModel(TranscodingCols.transcode, "quality.transcode", new BooleanCellRenderer(new StaticFlexiCellRenderer(translate("quality.transcode"), "quality.transcode", "", "o_icon o_icon_refresh o_icon-fw"), null)));
    transcodingModel.addFlexiColumnModel(new DefaultFlexiColumnModel(TranscodingCols.delete, "quality.delete", new BooleanCellRenderer(new StaticFlexiCellRenderer(translate("quality.delete"), "quality.delete", "", "o_icon o_icon_delete_item o_icon-fw"), null)));
    tableModel = new TranscodingTableModel(transcodingModel, getTranslator());
    transcodingTable = uifactory.addTableElement(getWindowControl(), "table", tableModel, getTranslator(), formLayout);
    transcodingTable.setCustomizeColumns(false);
    transcodingTable.setNumOfRowsEnabled(false);
    loadTable();
}
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 65 with DefaultFlexiColumnModel

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

the class VideoTrackEditController method initForm.

@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
    FormLayoutContainer generalCont = FormLayoutContainer.createVerticalFormLayout("general", getTranslator());
    generalCont.setFormTitle(translate("tab.video.trackConfig"));
    generalCont.setRootForm(mainForm);
    generalCont.setFormContextHelp("Learning resource: Video#_video_subtitle");
    formLayout.add(generalCont);
    FlexiTableColumnModel columnsModel = FlexiTableDataModelFactory.createFlexiTableColumnModel();
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(true, TrackTableCols.file.i18nKey(), TrackTableCols.file.ordinal(), true, TrackTableCols.file.name()));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(TrackTableCols.language.i18nKey(), TrackTableCols.language.ordinal(), true, TrackTableCols.language.name()));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(true, TrackTableCols.delete.i18nKey(), TrackTableCols.delete.ordinal(), false, TrackTableCols.delete.name()));
    tableModel = new VideoTracksTableModel(columnsModel, getLocale());
    tableEl = uifactory.addTableElement(getWindowControl(), "tracks", tableModel, getTranslator(), generalCont);
    tableEl.setCustomizeColumns(false);
    Map<String, VFSLeaf> tracks = videoManager.getAllTracks(videoResource);
    List<TrackTableRow> rows = new ArrayList<>(tracks.size());
    for (Map.Entry<String, VFSLeaf> entry : tracks.entrySet()) {
        rows.add(forgeRow(entry.getKey(), entry.getValue()));
    }
    tableModel.setObjects(rows);
    tableEl.setEmtpyTableMessageKey("track.notrack");
    addButton = uifactory.addFormLink("add.track", generalCont, Link.BUTTON);
}
Also used : VFSLeaf(org.olat.core.util.vfs.VFSLeaf) ArrayList(java.util.ArrayList) FormLayoutContainer(org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer) FlexiTableColumnModel(org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableColumnModel) Map(java.util.Map) 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)272 FlexiTableColumnModel (org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableColumnModel)254 StaticFlexiCellRenderer (org.olat.core.gui.components.form.flexible.impl.elements.table.StaticFlexiCellRenderer)126 UserPropertyHandler (org.olat.user.propertyhandlers.UserPropertyHandler)74 FormLayoutContainer (org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer)72 BooleanCellRenderer (org.olat.core.gui.components.form.flexible.impl.elements.table.BooleanCellRenderer)72 TextFlexiCellRenderer (org.olat.core.gui.components.form.flexible.impl.elements.table.TextFlexiCellRenderer)64 ArrayList (java.util.ArrayList)44 SortKey (org.olat.core.commons.persistence.SortKey)44 FlexiTableSortOptions (org.olat.core.gui.components.form.flexible.elements.FlexiTableSortOptions)40 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)28 FlexiCellRenderer (org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiCellRenderer)26 FlexiTableFilter (org.olat.core.gui.components.form.flexible.elements.FlexiTableFilter)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