Search in sources :

Example 1 with FlexiTableElementImpl

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

the class PageTitleCellRenderer method render.

@Override
public void render(Renderer renderer, StringOutput target, Object cellValue, int row, FlexiTableComponent source, URLBuilder ubu, Translator translator) {
    FlexiTableElementImpl tEl = source.getFlexiTableElement();
    Object rowValue = tEl.getTableDataModel().getObject(row);
    if (rowValue instanceof SharedPageRow) {
        SharedPageRow page = (SharedPageRow) rowValue;
        target.append(StringHelper.escapeHtml(page.getPageTitle()));
    }
}
Also used : FlexiTableElementImpl(org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableElementImpl) SharedPageRow(org.olat.modules.portfolio.ui.shared.SharedPageRow)

Example 2 with FlexiTableElementImpl

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

the class SelectSectionsCellRenderer method render.

@Override
public void render(Renderer renderer, StringOutput target, Object cellValue, int row, FlexiTableComponent source, URLBuilder ubu, Translator trans) {
    if (cellValue instanceof SharedItemRow) {
        SharedItemRow itemRow = (SharedItemRow) cellValue;
        List<AssessedBinderSection> sections = itemRow.getSections();
        if (sections != null && sections.size() > 0) {
            FlexiTableElementImpl ftE = source.getFlexiTableElement();
            String id = source.getFormDispatchId();
            Form rootForm = ftE.getRootForm();
            boolean expand = itemRow.isExpandSections();
            for (int i = 0; i < sections.size(); i++) {
                if (i > 0) {
                    if (expand)
                        target.append("<br />");
                    else
                        target.append(" | ");
                }
                NameValuePair pair1 = new NameValuePair("select-section", Integer.toString(row));
                NameValuePair pair2 = new NameValuePair("section", Integer.toString(i));
                String jsCode = FormJSHelper.getXHRFnCallFor(rootForm, id, 1, true, true, pair1, pair2);
                target.append("<a href=\"javascript:").append(jsCode).append(";\"").append(">");
                if (expand) {
                    target.append(StringHelper.escapeHtml(sections.get(i).getSectionTitle()));
                } else {
                    target.append(i + 1);
                }
                target.append("</a>");
            }
            NameValuePair pair = new NameValuePair("expand-section", Integer.toString(row));
            String jsCode = FormJSHelper.getXHRFnCallFor(rootForm, id, 1, true, true, pair);
            target.append(" <a href=\"javascript:").append(jsCode).append(";\"").append(">");
            if (itemRow.isExpandSections()) {
                target.append("<i class='o_icon o_icon-sm o_icon_expand'> </i>");
            } else {
                target.append("<i class='o_icon o_icon-sm o_icon_compress'> </i>");
            }
            target.append("</a>");
        }
    }
}
Also used : SharedItemRow(org.olat.modules.portfolio.model.SharedItemRow) NameValuePair(org.olat.core.gui.components.form.flexible.impl.NameValuePair) Form(org.olat.core.gui.components.form.flexible.impl.Form) AssessedBinderSection(org.olat.modules.portfolio.model.AssessedBinderSection) FlexiTableElementImpl(org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableElementImpl)

Example 3 with FlexiTableElementImpl

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

the class FormUIFactory method addTableElement.

public FlexiTableElement addTableElement(WindowControl wControl, String name, FlexiTableDataModel<?> tableModel, int pageSize, boolean loadOnInit, Translator translator, FormItemContainer formLayout) {
    FlexiTableElementImpl fte = new FlexiTableElementImpl(wControl, name, translator, tableModel, pageSize, loadOnInit);
    formLayout.add(fte);
    return fte;
}
Also used : FlexiTableElementImpl(org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableElementImpl)

Example 4 with FlexiTableElementImpl

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

the class FormUIFactory method addDownloadLink.

/**
 * Add a download link
 * @param name
 * @param linkTitle
 * @param i18nLabel
 * @param file
 * @param formLayout
 * @return
 */
public DownloadLink addDownloadLink(String name, String linkTitle, String i18nLabel, VFSLeaf file, FlexiTableElement formLayout) {
    DownloadLinkImpl fte = new DownloadLinkImpl(name);
    fte.setLinkText(linkTitle);
    fte.setDownloadItem(file);
    String css = CSSHelper.createFiletypeIconCssClassFor(file.getName());
    fte.setIconLeftCSS("o_icon o_icon-fw " + css);
    setLabelIfNotNull(i18nLabel, fte);
    if (formLayout != null) {
        ((FlexiTableElementImpl) formLayout).addFormItem(fte);
    }
    return fte;
}
Also used : DownloadLinkImpl(org.olat.core.gui.components.form.flexible.impl.elements.DownloadLinkImpl) FlexiTableElementImpl(org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableElementImpl)

Example 5 with FlexiTableElementImpl

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

the class FormUIFactory method addTableElement.

/**
 * @param wControl
 * @param name
 * @param tableModel
 * @param translator
 * @param formLayout
 * @return
 */
public FlexiTableElement addTableElement(WindowControl wControl, String name, FlexiTableDataModel<?> tableModel, Translator translator, FormItemContainer formLayout) {
    FlexiTableElementImpl fte = new FlexiTableElementImpl(wControl, name, translator, tableModel);
    formLayout.add(fte);
    return fte;
}
Also used : FlexiTableElementImpl(org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableElementImpl)

Aggregations

FlexiTableElementImpl (org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableElementImpl)12 DownloadLinkImpl (org.olat.core.gui.components.form.flexible.impl.elements.DownloadLinkImpl)4 Form (org.olat.core.gui.components.form.flexible.impl.Form)2 NameValuePair (org.olat.core.gui.components.form.flexible.impl.NameValuePair)2 AssessedBinderSection (org.olat.modules.portfolio.model.AssessedBinderSection)2 SharedItemRow (org.olat.modules.portfolio.model.SharedItemRow)2 SharedPageRow (org.olat.modules.portfolio.ui.shared.SharedPageRow)2