Search in sources :

Example 1 with TimelineElement

use of org.olat.modules.portfolio.ui.component.TimelineElement 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 TimelineElement

use of org.olat.modules.portfolio.ui.component.TimelineElement 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

BooleanCellRenderer (org.olat.core.gui.components.form.flexible.impl.elements.table.BooleanCellRenderer)2 DefaultFlexiColumnModel (org.olat.core.gui.components.form.flexible.impl.elements.table.DefaultFlexiColumnModel)2 DefaultFlexiTableCssDelegate (org.olat.core.gui.components.form.flexible.impl.elements.table.DefaultFlexiTableCssDelegate)2 FlexiTableColumnModel (org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableColumnModel)2 FlexiTableRendererType (org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableRendererType)2 StaticFlexiCellRenderer (org.olat.core.gui.components.form.flexible.impl.elements.table.StaticFlexiCellRenderer)2 CategoriesCellRenderer (org.olat.modules.portfolio.ui.component.CategoriesCellRenderer)2 TimelineElement (org.olat.modules.portfolio.ui.component.TimelineElement)2 PortfolioElementCellRenderer (org.olat.modules.portfolio.ui.renderer.PortfolioElementCellRenderer)2 SharedPageStatusCellRenderer (org.olat.modules.portfolio.ui.renderer.SharedPageStatusCellRenderer)2 StatusCellRenderer (org.olat.modules.portfolio.ui.renderer.StatusCellRenderer)2