Search in sources :

Example 1 with CategoriesCellRenderer

use of org.olat.modules.portfolio.ui.component.CategoriesCellRenderer in project OpenOLAT by OpenOLAT.

the class AbstractPageListController method initForm.

@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
    timelineEl = new TimelineElement("timeline");
    timelineEl.setContainerId("o_portfolio_entries_timeline_" + timelineEl.getComponent().getDispatchID());
    formLayout.add("timeline", timelineEl);
    initTimeline();
    if (portfolioV2Module.isEntriesTimelineEnabled() && config.isTimeline()) {
        timelineSwitchOnButton = uifactory.addFormLink("timeline.switch.on", formLayout, Link.BUTTON_SMALL);
        timelineSwitchOnButton.setIconLeftCSS("o_icon o_icon-sm o_icon_toggle_on");
        timelineSwitchOnButton.setElementCssClass("o_sel_timeline_on");
        timelineSwitchOffButton = uifactory.addFormLink("timeline.switch.off", formLayout, Link.BUTTON_SMALL);
        timelineSwitchOffButton.setIconLeftCSS("o_icon o_icon-sm o_icon_toggle_off");
        timelineSwitchOffButton.setElementCssClass("o_sel_timeline_off");
        doSwitchTimelineOn();
    } else {
        flc.contextPut("timelineSwitch", Boolean.FALSE);
    }
    FlexiTableColumnModel columnsModel = FlexiTableDataModelFactory.createFlexiTableColumnModel();
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(false, PageCols.key, "select-page"));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(PageCols.title, "select-page", new PortfolioElementCellRenderer()));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(PageCols.date, "select-page"));
    if (secCallback.canPageUserInfosStatus()) {
        columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(PageCols.viewerStatus, new SharedPageStatusCellRenderer(getTranslator())));
        columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(PageCols.pageStatus, new StatusCellRenderer(getTranslator())));
    } else {
        columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(PageCols.status, new StatusCellRenderer(getTranslator())));
    }
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(PageCols.publicationDate, "select-page"));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(PageCols.categories, new CategoriesCellRenderer()));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(false, PageCols.section, /*, "select-section"*/
    null));
    if (secCallback.canNewAssignment()) {
        columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel("table.header.up", PageCols.up.ordinal(), "up", new BooleanCellRenderer(new StaticFlexiCellRenderer(translate("up"), "up"), null)));
        columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel("table.header.down", PageCols.down.ordinal(), "down", new BooleanCellRenderer(new StaticFlexiCellRenderer(translate("down"), "down"), null)));
    }
    if (!secCallback.canNewAssignment()) {
        columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(PageCols.comment));
    }
    model = new PageListDataModel(columnsModel, getLocale());
    String mapperThumbnailUrl = registerCacheableMapper(ureq, "page-list", new PageImageMapper(model, portfolioService));
    tableEl = uifactory.addTableElement(getWindowControl(), "table", model, 20, false, getTranslator(), formLayout);
    if (portfolioV2Module.isEntriesListEnabled() && portfolioV2Module.isEntriesTableEnabled()) {
        tableEl.setAvailableRendererTypes(FlexiTableRendererType.custom, FlexiTableRendererType.classic);
    } else if (portfolioV2Module.isEntriesTableEnabled()) {
        tableEl.setAvailableRendererTypes(FlexiTableRendererType.classic);
    } else {
        tableEl.setAvailableRendererTypes(FlexiTableRendererType.custom);
    }
    tableEl.setSearchEnabled(portfolioV2Module.isEntriesSearchEnabled());
    tableEl.setCustomizeColumns(true);
    tableEl.setElementCssClass("o_binder_page_listing");
    tableEl.setEmtpyTableMessageKey("table.sEmptyTable");
    tableEl.setPageSize(24);
    // sets its own DOM id in velocity container
    rowVC.setDomReplacementWrapperRequired(false);
    rowVC.contextPut("mapperThumbnailUrl", mapperThumbnailUrl);
    tableEl.setRowRenderer(rowVC, this);
    tableEl.setCssDelegate(new DefaultFlexiTableCssDelegate());
    tableEl.setAndLoadPersistedPreferences(ureq, "page-list");
    FlexiTableRendererType renderType = portfolioV2Module.isEntriesListEnabled() ? FlexiTableRendererType.custom : FlexiTableRendererType.classic;
    tableEl.setRendererType(renderType);
}
Also used : PortfolioElementCellRenderer(org.olat.modules.portfolio.ui.renderer.PortfolioElementCellRenderer) FlexiTableRendererType(org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableRendererType) DefaultFlexiTableCssDelegate(org.olat.core.gui.components.form.flexible.impl.elements.table.DefaultFlexiTableCssDelegate) StatusCellRenderer(org.olat.modules.portfolio.ui.renderer.StatusCellRenderer) SharedPageStatusCellRenderer(org.olat.modules.portfolio.ui.renderer.SharedPageStatusCellRenderer) TimelineElement(org.olat.modules.portfolio.ui.component.TimelineElement) 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) FlexiTableColumnModel(org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableColumnModel) CategoriesCellRenderer(org.olat.modules.portfolio.ui.component.CategoriesCellRenderer) DefaultFlexiColumnModel(org.olat.core.gui.components.form.flexible.impl.elements.table.DefaultFlexiColumnModel)

Example 2 with CategoriesCellRenderer

use of org.olat.modules.portfolio.ui.component.CategoriesCellRenderer in project openolat by klemens.

the class MediaCenterController method initForm.

@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
    if (select) {
        newMediaCallout = uifactory.addFormLink("new.medias", formLayout, Link.BUTTON);
        newMediaCallout.setIconRightCSS("o_icon o_icon_caret o_icon-fw");
    }
    FlexiTableColumnModel columnsModel = FlexiTableDataModelFactory.createFlexiTableColumnModel();
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(false, MediaCols.key, "select"));
    Map<String, MediaHandler> handlersMap = portfolioService.getMediaHandlers().stream().collect(Collectors.toMap(h -> h.getType(), h -> h));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(MediaCols.type, new MediaTypeCellRenderer(handlersMap)));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(MediaCols.title, "select"));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(MediaCols.collectionDate, "select"));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(MediaCols.categories, new CategoriesCellRenderer()));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel("select", translate("select"), "select"));
    model = new MediaDataModel(columnsModel, getLocale());
    tableEl = uifactory.addTableElement(getWindowControl(), "table", model, 20, false, getTranslator(), formLayout);
    tableEl.setAvailableRendererTypes(FlexiTableRendererType.custom, FlexiTableRendererType.classic);
    tableEl.setRendererType(FlexiTableRendererType.custom);
    tableEl.setSearchEnabled(true);
    tableEl.setCustomizeColumns(true);
    tableEl.setEmtpyTableMessageKey("table.sEmptyTable");
    tableEl.setPageSize(24);
    VelocityContainer row = createVelocityContainer("media_row");
    // sets its own DOM id in velocity container
    row.setDomReplacementWrapperRequired(false);
    tableEl.setRowRenderer(row, this);
    tableEl.setCssDelegate(new MediaCssDelegate());
    tableEl.setAndLoadPersistedPreferences(ureq, "media-list");
    initSorters(tableEl);
    initFilters(tableEl);
    mapperThumbnailUrl = registerCacheableMapper(ureq, "media-thumbnail", new ThumbnailMapper(model));
    row.contextPut("mapperThumbnailUrl", mapperThumbnailUrl);
}
Also used : FlexiTableElement(org.olat.core.gui.components.form.flexible.elements.FlexiTableElement) EPArtefactListChoosenEvent(org.olat.portfolio.ui.artefacts.view.EPArtefactListChoosenEvent) Activateable2(org.olat.core.gui.control.generic.dtabs.Activateable2) DefaultFlexiColumnModel(org.olat.core.gui.components.form.flexible.impl.elements.table.DefaultFlexiColumnModel) Autowired(org.springframework.beans.factory.annotation.Autowired) MediaResource(org.olat.core.gui.media.MediaResource) OLATResourceable(org.olat.core.id.OLATResourceable) Size(org.olat.core.commons.services.image.Size) Media(org.olat.modules.portfolio.Media) FlexiTableFilter(org.olat.core.gui.components.form.flexible.elements.FlexiTableFilter) OresHelper(org.olat.core.util.resource.OresHelper) MediaRow(org.olat.modules.portfolio.ui.model.MediaRow) Map(java.util.Map) SortKey(org.olat.core.commons.persistence.SortKey) VelocityContainer(org.olat.core.gui.components.velocity.VelocityContainer) CalloutSettings(org.olat.core.gui.control.generic.closablewrapper.CalloutSettings) MediaCols(org.olat.modules.portfolio.ui.MediaDataModel.MediaCols) MediaHandler(org.olat.modules.portfolio.MediaHandler) AbstractArtefact(org.olat.portfolio.model.artefacts.AbstractArtefact) FlexiTableColumnModel(org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableColumnModel) CloseableModalController(org.olat.core.gui.control.generic.closablewrapper.CloseableModalController) VFSLeaf(org.olat.core.util.vfs.VFSLeaf) FlexiTableSort(org.olat.core.gui.components.form.flexible.elements.FlexiTableSort) WindowControl(org.olat.core.gui.control.WindowControl) FlexiTableRendererType(org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableRendererType) PortfolioModule(org.olat.portfolio.PortfolioModule) Set(java.util.Set) MediaEvent(org.olat.modules.portfolio.ui.event.MediaEvent) Component(org.olat.core.gui.components.Component) LinkFactory(org.olat.core.gui.components.link.LinkFactory) Collectors(java.util.stream.Collectors) Mapper(org.olat.core.dispatcher.mapper.Mapper) DefaultFlexiTableCssDelegate(org.olat.core.gui.components.form.flexible.impl.elements.table.DefaultFlexiTableCssDelegate) SelectionEvent(org.olat.core.gui.components.form.flexible.impl.elements.table.SelectionEvent) BasicController(org.olat.core.gui.control.controller.BasicController) List(java.util.List) FormLink(org.olat.core.gui.components.form.flexible.elements.FormLink) Align(org.olat.core.gui.components.stack.TooledStackedPanel.Align) TooledController(org.olat.core.gui.components.stack.TooledController) CloseableCalloutWindowController(org.olat.core.gui.control.generic.closablewrapper.CloseableCalloutWindowController) TooledStackedPanel(org.olat.core.gui.components.stack.TooledStackedPanel) CategoryLight(org.olat.modules.portfolio.model.CategoryLight) CategoriesCellRenderer(org.olat.modules.portfolio.ui.component.CategoriesCellRenderer) FormEvent(org.olat.core.gui.components.form.flexible.impl.FormEvent) CollectCitationMediaController(org.olat.modules.portfolio.ui.media.CollectCitationMediaController) EPArtefactChoosenEvent(org.olat.portfolio.ui.artefacts.view.EPArtefactChoosenEvent) FormItem(org.olat.core.gui.components.form.flexible.FormItem) ArrayList(java.util.ArrayList) HashSet(java.util.HashSet) Event(org.olat.core.gui.control.Event) FormBasicController(org.olat.core.gui.components.form.flexible.impl.FormBasicController) HttpServletRequest(javax.servlet.http.HttpServletRequest) FormItemContainer(org.olat.core.gui.components.form.flexible.FormItemContainer) ContextEntry(org.olat.core.id.context.ContextEntry) EPArtefactPoolRunController(org.olat.portfolio.ui.EPArtefactPoolRunController) StringHelper(org.olat.core.util.StringHelper) StateEntry(org.olat.core.id.context.StateEntry) FlexiTableDataModelFactory(org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableDataModelFactory) PortfolioService(org.olat.modules.portfolio.PortfolioService) OrderBy(org.olat.repository.model.SearchMyRepositoryEntryViewParams.OrderBy) Link(org.olat.core.gui.components.link.Link) FlexiTableComponentDelegate(org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableComponentDelegate) CollectTextMediaController(org.olat.modules.portfolio.ui.media.CollectTextMediaController) FlexiTableSearchEvent(org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableSearchEvent) MediaSelectionEvent(org.olat.modules.portfolio.ui.event.MediaSelectionEvent) Controller(org.olat.core.gui.control.Controller) MediaLight(org.olat.modules.portfolio.MediaLight) EPFrontendManager(org.olat.portfolio.manager.EPFrontendManager) FlexiTableSortOptions(org.olat.core.gui.components.form.flexible.elements.FlexiTableSortOptions) VFSMediaResource(org.olat.core.util.vfs.VFSMediaResource) MediaTypeCellRenderer(org.olat.modules.portfolio.ui.renderer.MediaTypeCellRenderer) UserRequest(org.olat.core.gui.UserRequest) MediaTypeCellRenderer(org.olat.modules.portfolio.ui.renderer.MediaTypeCellRenderer) MediaHandler(org.olat.modules.portfolio.MediaHandler) FlexiTableColumnModel(org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableColumnModel) CategoriesCellRenderer(org.olat.modules.portfolio.ui.component.CategoriesCellRenderer) DefaultFlexiColumnModel(org.olat.core.gui.components.form.flexible.impl.elements.table.DefaultFlexiColumnModel) VelocityContainer(org.olat.core.gui.components.velocity.VelocityContainer)

Example 3 with CategoriesCellRenderer

use of org.olat.modules.portfolio.ui.component.CategoriesCellRenderer in project OpenOLAT by OpenOLAT.

the class MediaCenterController method initForm.

@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
    if (select) {
        newMediaCallout = uifactory.addFormLink("new.medias", formLayout, Link.BUTTON);
        newMediaCallout.setIconRightCSS("o_icon o_icon_caret o_icon-fw");
    }
    FlexiTableColumnModel columnsModel = FlexiTableDataModelFactory.createFlexiTableColumnModel();
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(false, MediaCols.key, "select"));
    Map<String, MediaHandler> handlersMap = portfolioService.getMediaHandlers().stream().collect(Collectors.toMap(h -> h.getType(), h -> h));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(MediaCols.type, new MediaTypeCellRenderer(handlersMap)));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(MediaCols.title, "select"));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(MediaCols.collectionDate, "select"));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(MediaCols.categories, new CategoriesCellRenderer()));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel("select", translate("select"), "select"));
    model = new MediaDataModel(columnsModel, getLocale());
    tableEl = uifactory.addTableElement(getWindowControl(), "table", model, 20, false, getTranslator(), formLayout);
    tableEl.setAvailableRendererTypes(FlexiTableRendererType.custom, FlexiTableRendererType.classic);
    tableEl.setRendererType(FlexiTableRendererType.custom);
    tableEl.setSearchEnabled(true);
    tableEl.setCustomizeColumns(true);
    tableEl.setEmtpyTableMessageKey("table.sEmptyTable");
    tableEl.setPageSize(24);
    VelocityContainer row = createVelocityContainer("media_row");
    // sets its own DOM id in velocity container
    row.setDomReplacementWrapperRequired(false);
    tableEl.setRowRenderer(row, this);
    tableEl.setCssDelegate(new MediaCssDelegate());
    tableEl.setAndLoadPersistedPreferences(ureq, "media-list");
    initSorters(tableEl);
    initFilters(tableEl);
    mapperThumbnailUrl = registerCacheableMapper(ureq, "media-thumbnail", new ThumbnailMapper(model));
    row.contextPut("mapperThumbnailUrl", mapperThumbnailUrl);
}
Also used : FlexiTableElement(org.olat.core.gui.components.form.flexible.elements.FlexiTableElement) EPArtefactListChoosenEvent(org.olat.portfolio.ui.artefacts.view.EPArtefactListChoosenEvent) Activateable2(org.olat.core.gui.control.generic.dtabs.Activateable2) DefaultFlexiColumnModel(org.olat.core.gui.components.form.flexible.impl.elements.table.DefaultFlexiColumnModel) Autowired(org.springframework.beans.factory.annotation.Autowired) MediaResource(org.olat.core.gui.media.MediaResource) OLATResourceable(org.olat.core.id.OLATResourceable) Size(org.olat.core.commons.services.image.Size) Media(org.olat.modules.portfolio.Media) FlexiTableFilter(org.olat.core.gui.components.form.flexible.elements.FlexiTableFilter) OresHelper(org.olat.core.util.resource.OresHelper) MediaRow(org.olat.modules.portfolio.ui.model.MediaRow) Map(java.util.Map) SortKey(org.olat.core.commons.persistence.SortKey) VelocityContainer(org.olat.core.gui.components.velocity.VelocityContainer) CalloutSettings(org.olat.core.gui.control.generic.closablewrapper.CalloutSettings) MediaCols(org.olat.modules.portfolio.ui.MediaDataModel.MediaCols) MediaHandler(org.olat.modules.portfolio.MediaHandler) AbstractArtefact(org.olat.portfolio.model.artefacts.AbstractArtefact) FlexiTableColumnModel(org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableColumnModel) CloseableModalController(org.olat.core.gui.control.generic.closablewrapper.CloseableModalController) VFSLeaf(org.olat.core.util.vfs.VFSLeaf) FlexiTableSort(org.olat.core.gui.components.form.flexible.elements.FlexiTableSort) WindowControl(org.olat.core.gui.control.WindowControl) FlexiTableRendererType(org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableRendererType) PortfolioModule(org.olat.portfolio.PortfolioModule) Set(java.util.Set) MediaEvent(org.olat.modules.portfolio.ui.event.MediaEvent) Component(org.olat.core.gui.components.Component) LinkFactory(org.olat.core.gui.components.link.LinkFactory) Collectors(java.util.stream.Collectors) Mapper(org.olat.core.dispatcher.mapper.Mapper) DefaultFlexiTableCssDelegate(org.olat.core.gui.components.form.flexible.impl.elements.table.DefaultFlexiTableCssDelegate) SelectionEvent(org.olat.core.gui.components.form.flexible.impl.elements.table.SelectionEvent) BasicController(org.olat.core.gui.control.controller.BasicController) List(java.util.List) FormLink(org.olat.core.gui.components.form.flexible.elements.FormLink) Align(org.olat.core.gui.components.stack.TooledStackedPanel.Align) TooledController(org.olat.core.gui.components.stack.TooledController) CloseableCalloutWindowController(org.olat.core.gui.control.generic.closablewrapper.CloseableCalloutWindowController) TooledStackedPanel(org.olat.core.gui.components.stack.TooledStackedPanel) CategoryLight(org.olat.modules.portfolio.model.CategoryLight) CategoriesCellRenderer(org.olat.modules.portfolio.ui.component.CategoriesCellRenderer) FormEvent(org.olat.core.gui.components.form.flexible.impl.FormEvent) CollectCitationMediaController(org.olat.modules.portfolio.ui.media.CollectCitationMediaController) EPArtefactChoosenEvent(org.olat.portfolio.ui.artefacts.view.EPArtefactChoosenEvent) FormItem(org.olat.core.gui.components.form.flexible.FormItem) ArrayList(java.util.ArrayList) HashSet(java.util.HashSet) Event(org.olat.core.gui.control.Event) FormBasicController(org.olat.core.gui.components.form.flexible.impl.FormBasicController) HttpServletRequest(javax.servlet.http.HttpServletRequest) FormItemContainer(org.olat.core.gui.components.form.flexible.FormItemContainer) ContextEntry(org.olat.core.id.context.ContextEntry) EPArtefactPoolRunController(org.olat.portfolio.ui.EPArtefactPoolRunController) StringHelper(org.olat.core.util.StringHelper) StateEntry(org.olat.core.id.context.StateEntry) FlexiTableDataModelFactory(org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableDataModelFactory) PortfolioService(org.olat.modules.portfolio.PortfolioService) OrderBy(org.olat.repository.model.SearchMyRepositoryEntryViewParams.OrderBy) Link(org.olat.core.gui.components.link.Link) FlexiTableComponentDelegate(org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableComponentDelegate) CollectTextMediaController(org.olat.modules.portfolio.ui.media.CollectTextMediaController) FlexiTableSearchEvent(org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableSearchEvent) MediaSelectionEvent(org.olat.modules.portfolio.ui.event.MediaSelectionEvent) Controller(org.olat.core.gui.control.Controller) MediaLight(org.olat.modules.portfolio.MediaLight) EPFrontendManager(org.olat.portfolio.manager.EPFrontendManager) FlexiTableSortOptions(org.olat.core.gui.components.form.flexible.elements.FlexiTableSortOptions) VFSMediaResource(org.olat.core.util.vfs.VFSMediaResource) MediaTypeCellRenderer(org.olat.modules.portfolio.ui.renderer.MediaTypeCellRenderer) UserRequest(org.olat.core.gui.UserRequest) MediaTypeCellRenderer(org.olat.modules.portfolio.ui.renderer.MediaTypeCellRenderer) MediaHandler(org.olat.modules.portfolio.MediaHandler) FlexiTableColumnModel(org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableColumnModel) CategoriesCellRenderer(org.olat.modules.portfolio.ui.component.CategoriesCellRenderer) DefaultFlexiColumnModel(org.olat.core.gui.components.form.flexible.impl.elements.table.DefaultFlexiColumnModel) VelocityContainer(org.olat.core.gui.components.velocity.VelocityContainer)

Example 4 with CategoriesCellRenderer

use of org.olat.modules.portfolio.ui.component.CategoriesCellRenderer in project openolat by klemens.

the class AbstractPageListController method initForm.

@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
    timelineEl = new TimelineElement("timeline");
    timelineEl.setContainerId("o_portfolio_entries_timeline_" + timelineEl.getComponent().getDispatchID());
    formLayout.add("timeline", timelineEl);
    initTimeline();
    if (portfolioV2Module.isEntriesTimelineEnabled() && config.isTimeline()) {
        timelineSwitchOnButton = uifactory.addFormLink("timeline.switch.on", formLayout, Link.BUTTON_SMALL);
        timelineSwitchOnButton.setIconLeftCSS("o_icon o_icon-sm o_icon_toggle_on");
        timelineSwitchOnButton.setElementCssClass("o_sel_timeline_on");
        timelineSwitchOffButton = uifactory.addFormLink("timeline.switch.off", formLayout, Link.BUTTON_SMALL);
        timelineSwitchOffButton.setIconLeftCSS("o_icon o_icon-sm o_icon_toggle_off");
        timelineSwitchOffButton.setElementCssClass("o_sel_timeline_off");
        doSwitchTimelineOn();
    } else {
        flc.contextPut("timelineSwitch", Boolean.FALSE);
    }
    FlexiTableColumnModel columnsModel = FlexiTableDataModelFactory.createFlexiTableColumnModel();
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(false, PageCols.key, "select-page"));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(PageCols.title, "select-page", new PortfolioElementCellRenderer()));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(PageCols.date, "select-page"));
    if (secCallback.canPageUserInfosStatus()) {
        columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(PageCols.viewerStatus, new SharedPageStatusCellRenderer(getTranslator())));
        columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(PageCols.pageStatus, new StatusCellRenderer(getTranslator())));
    } else {
        columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(PageCols.status, new StatusCellRenderer(getTranslator())));
    }
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(PageCols.publicationDate, "select-page"));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(PageCols.categories, new CategoriesCellRenderer()));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(false, PageCols.section, /*, "select-section"*/
    null));
    if (secCallback.canNewAssignment()) {
        columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel("table.header.up", PageCols.up.ordinal(), "up", new BooleanCellRenderer(new StaticFlexiCellRenderer(translate("up"), "up"), null)));
        columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel("table.header.down", PageCols.down.ordinal(), "down", new BooleanCellRenderer(new StaticFlexiCellRenderer(translate("down"), "down"), null)));
    }
    if (!secCallback.canNewAssignment()) {
        columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(PageCols.comment));
    }
    model = new PageListDataModel(columnsModel, getLocale());
    String mapperThumbnailUrl = registerCacheableMapper(ureq, "page-list", new PageImageMapper(model, portfolioService));
    tableEl = uifactory.addTableElement(getWindowControl(), "table", model, 20, false, getTranslator(), formLayout);
    if (portfolioV2Module.isEntriesListEnabled() && portfolioV2Module.isEntriesTableEnabled()) {
        tableEl.setAvailableRendererTypes(FlexiTableRendererType.custom, FlexiTableRendererType.classic);
    } else if (portfolioV2Module.isEntriesTableEnabled()) {
        tableEl.setAvailableRendererTypes(FlexiTableRendererType.classic);
    } else {
        tableEl.setAvailableRendererTypes(FlexiTableRendererType.custom);
    }
    tableEl.setSearchEnabled(portfolioV2Module.isEntriesSearchEnabled());
    tableEl.setCustomizeColumns(true);
    tableEl.setElementCssClass("o_binder_page_listing");
    tableEl.setEmtpyTableMessageKey("table.sEmptyTable");
    tableEl.setPageSize(24);
    // sets its own DOM id in velocity container
    rowVC.setDomReplacementWrapperRequired(false);
    rowVC.contextPut("mapperThumbnailUrl", mapperThumbnailUrl);
    tableEl.setRowRenderer(rowVC, this);
    tableEl.setCssDelegate(new DefaultFlexiTableCssDelegate());
    tableEl.setAndLoadPersistedPreferences(ureq, "page-list");
    FlexiTableRendererType renderType = portfolioV2Module.isEntriesListEnabled() ? FlexiTableRendererType.custom : FlexiTableRendererType.classic;
    tableEl.setRendererType(renderType);
}
Also used : PortfolioElementCellRenderer(org.olat.modules.portfolio.ui.renderer.PortfolioElementCellRenderer) FlexiTableRendererType(org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableRendererType) DefaultFlexiTableCssDelegate(org.olat.core.gui.components.form.flexible.impl.elements.table.DefaultFlexiTableCssDelegate) StatusCellRenderer(org.olat.modules.portfolio.ui.renderer.StatusCellRenderer) SharedPageStatusCellRenderer(org.olat.modules.portfolio.ui.renderer.SharedPageStatusCellRenderer) TimelineElement(org.olat.modules.portfolio.ui.component.TimelineElement) 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) FlexiTableColumnModel(org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableColumnModel) CategoriesCellRenderer(org.olat.modules.portfolio.ui.component.CategoriesCellRenderer) 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)4 DefaultFlexiTableCssDelegate (org.olat.core.gui.components.form.flexible.impl.elements.table.DefaultFlexiTableCssDelegate)4 FlexiTableColumnModel (org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableColumnModel)4 FlexiTableRendererType (org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableRendererType)4 CategoriesCellRenderer (org.olat.modules.portfolio.ui.component.CategoriesCellRenderer)4 ArrayList (java.util.ArrayList)2 HashSet (java.util.HashSet)2 List (java.util.List)2 Map (java.util.Map)2 Set (java.util.Set)2 Collectors (java.util.stream.Collectors)2 HttpServletRequest (javax.servlet.http.HttpServletRequest)2 SortKey (org.olat.core.commons.persistence.SortKey)2 Size (org.olat.core.commons.services.image.Size)2 Mapper (org.olat.core.dispatcher.mapper.Mapper)2 UserRequest (org.olat.core.gui.UserRequest)2 Component (org.olat.core.gui.components.Component)2 FormItem (org.olat.core.gui.components.form.flexible.FormItem)2 FormItemContainer (org.olat.core.gui.components.form.flexible.FormItemContainer)2 FlexiTableElement (org.olat.core.gui.components.form.flexible.elements.FlexiTableElement)2