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);
}
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);
}
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;
}
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);
}
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);
}
Aggregations