use of org.apache.ofbiz.widget.model.ModelSingleForm in project ofbiz-framework by apache.
the class MacroFormRenderer method renderMultiFormClose.
public void renderMultiFormClose(Appendable writer, Map<String, Object> context, ModelForm modelForm) throws IOException {
// FIXME copy from HtmlFormRenderer.java (except for the closing form tag itself, that is now converted)
Iterator<ModelFormField> submitFields = modelForm.getMultiSubmitFields().iterator();
while (submitFields.hasNext()) {
ModelFormField submitField = submitFields.next();
if (submitField != null && submitField.shouldUse(context)) {
// Threw this in that as a hack to keep the submit button from expanding the first field
// Needs a more rugged solution
// WARNING: this method (renderMultiFormClose) must be called after the
// table that contains the list has been closed (to avoid validation errors) so
// we cannot call here the methods renderFormatItemRowCell*: for this reason
// they are now commented.
// this.renderFormatItemRowCellOpen(writer, context, modelForm, submitField);
// this.renderFormatItemRowCellClose(writer, context, modelForm, submitField);
// this.renderFormatItemRowCellOpen(writer, context, modelForm, submitField);
submitField.renderFieldString(writer, context, this);
// this.renderFormatItemRowCellClose(writer, context, modelForm, submitField);
}
}
StringWriter sr = new StringWriter();
sr.append("<@renderMultiFormClose />");
executeMacro(writer, sr.toString());
// see if there is anything that needs to be added outside of the multi-form
Map<String, Object> wholeFormContext = UtilGenerics.checkMap(context.get("wholeFormContext"));
Appendable postMultiFormWriter = wholeFormContext != null ? (Appendable) wholeFormContext.get("postMultiFormWriter") : null;
if (postMultiFormWriter != null) {
writer.append(postMultiFormWriter.toString());
}
if (modelForm instanceof ModelSingleForm) {
renderEndingBoundaryComment(writer, "Form Widget - Form Element", modelForm);
} else {
renderEndingBoundaryComment(writer, "Grid Widget - Grid Element", modelForm);
}
}
Aggregations