Search in sources :

Example 1 with CustomField

use of org.olat.course.nodes.projectbroker.datamodel.CustomField in project OpenOLAT by OpenOLAT.

the class CustomfieldsFormController method formInnerEvent.

protected void formInnerEvent(UserRequest ureq, FormItem source, FormEvent event) {
    if (source instanceof FormLink) {
        FormLink link = (FormLink) source;
        if (link.getName().equals(ADD_FIELD_LINK)) {
            if (customFields.size() < MAX_NBR_CUSTOM_FIELDS) {
                // Add new custom-field
                int indexNewCustomField = customFields.size();
                customFields.add(new CustomField("", "", false));
                // first remove existing submit button, add it again at the end
                flc.remove(formSubmit);
                createFormElemente(this.flc, indexNewCustomField, customFields.get(indexNewCustomField));
                formSubmit = uifactory.addFormSubmitButton("save", this.flc);
            } else {
                this.showInfo("info.max.nbr.custom.fields");
            }
        } else {
            int deleteElementNumber = ((Integer) link.getUserObject()).intValue();
            getLogger().debug("remove customfield #=" + deleteElementNumber);
            customFields.remove(deleteElementNumber);
            initFormElements(flc);
        }
    }
    this.flc.setDirty(true);
}
Also used : CustomField(org.olat.course.nodes.projectbroker.datamodel.CustomField) FormLink(org.olat.core.gui.components.form.flexible.elements.FormLink)

Example 2 with CustomField

use of org.olat.course.nodes.projectbroker.datamodel.CustomField in project OpenOLAT by OpenOLAT.

the class CustomfieldsFormController method createFormElements.

private void createFormElements(FormItemContainer formLayout) {
    // create form elements
    int i = 0;
    for (Iterator<CustomField> iterator = customFields.iterator(); iterator.hasNext(); ) {
        CustomField customField = iterator.next();
        createFormElemente(formLayout, i++, customField);
    }
    formSubmit = uifactory.addFormSubmitButton("save", formLayout);
}
Also used : CustomField(org.olat.course.nodes.projectbroker.datamodel.CustomField)

Example 3 with CustomField

use of org.olat.course.nodes.projectbroker.datamodel.CustomField in project OpenOLAT by OpenOLAT.

the class ProjectBrokerModuleConfiguration method getCustomFields.

public List<CustomField> getCustomFields() {
    int size = moduleConfiguration.getIntegerSafe(CUSTOM_FIELDS_SIZE, 0);
    List<CustomField> customFields = new ArrayList<CustomField>();
    for (int i = 0; i < size; i++) {
        String name = (String) moduleConfiguration.get(CUSTOM_FIELDS_NAME_ + i);
        log.debug("getCustomFields " + CUSTOM_FIELDS_NAME_ + i + "=" + name);
        String value = (String) moduleConfiguration.get(CUSTOM_FIELDS_VALUE_ + i);
        log.debug("getCustomFields " + CUSTOM_FIELDS_VALUE_ + i + "=" + value);
        boolean tableViewEnabled = moduleConfiguration.getBooleanSafe(CUSTOM_FIELDS_TABLE_VIEW_ENABLED_ + i, true);
        customFields.add(new CustomField(name, value, tableViewEnabled));
    }
    return customFields;
}
Also used : CustomField(org.olat.course.nodes.projectbroker.datamodel.CustomField) ArrayList(java.util.ArrayList)

Example 4 with CustomField

use of org.olat.course.nodes.projectbroker.datamodel.CustomField in project openolat by klemens.

the class CustomfieldsFormController method formInnerEvent.

protected void formInnerEvent(UserRequest ureq, FormItem source, FormEvent event) {
    if (source instanceof FormLink) {
        FormLink link = (FormLink) source;
        if (link.getName().equals(ADD_FIELD_LINK)) {
            if (customFields.size() < MAX_NBR_CUSTOM_FIELDS) {
                // Add new custom-field
                int indexNewCustomField = customFields.size();
                customFields.add(new CustomField("", "", false));
                // first remove existing submit button, add it again at the end
                flc.remove(formSubmit);
                createFormElemente(this.flc, indexNewCustomField, customFields.get(indexNewCustomField));
                formSubmit = uifactory.addFormSubmitButton("save", this.flc);
            } else {
                this.showInfo("info.max.nbr.custom.fields");
            }
        } else {
            int deleteElementNumber = ((Integer) link.getUserObject()).intValue();
            getLogger().debug("remove customfield #=" + deleteElementNumber);
            customFields.remove(deleteElementNumber);
            initFormElements(flc);
        }
    }
    this.flc.setDirty(true);
}
Also used : CustomField(org.olat.course.nodes.projectbroker.datamodel.CustomField) FormLink(org.olat.core.gui.components.form.flexible.elements.FormLink)

Example 5 with CustomField

use of org.olat.course.nodes.projectbroker.datamodel.CustomField in project openolat by klemens.

the class CustomfieldsFormController method createFormElements.

private void createFormElements(FormItemContainer formLayout) {
    // create form elements
    int i = 0;
    for (Iterator<CustomField> iterator = customFields.iterator(); iterator.hasNext(); ) {
        CustomField customField = iterator.next();
        createFormElemente(formLayout, i++, customField);
    }
    formSubmit = uifactory.addFormSubmitButton("save", formLayout);
}
Also used : CustomField(org.olat.course.nodes.projectbroker.datamodel.CustomField)

Aggregations

CustomField (org.olat.course.nodes.projectbroker.datamodel.CustomField)10 ArrayList (java.util.ArrayList)4 Project (org.olat.course.nodes.projectbroker.datamodel.Project)4 File (java.io.File)2 StringTokenizer (java.util.StringTokenizer)2 DateChooser (org.olat.core.gui.components.form.flexible.elements.DateChooser)2 FormLink (org.olat.core.gui.components.form.flexible.elements.FormLink)2 RichTextElement (org.olat.core.gui.components.form.flexible.elements.RichTextElement)2 SingleSelection (org.olat.core.gui.components.form.flexible.elements.SingleSelection)2 StaticTextElement (org.olat.core.gui.components.form.flexible.elements.StaticTextElement)2 TextElement (org.olat.core.gui.components.form.flexible.elements.TextElement)2 FormLayoutContainer (org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer)2 BooleanColumnDescriptor (org.olat.core.gui.components.table.BooleanColumnDescriptor)2 CustomRenderColumnDescriptor (org.olat.core.gui.components.table.CustomRenderColumnDescriptor)2 DefaultColumnDescriptor (org.olat.core.gui.components.table.DefaultColumnDescriptor)2 TableController (org.olat.core.gui.components.table.TableController)2 TableGuiConfiguration (org.olat.core.gui.components.table.TableGuiConfiguration)2 Renderer (org.olat.core.gui.render.Renderer)2 StringOutput (org.olat.core.gui.render.StringOutput)2 Identity (org.olat.core.id.Identity)2