use of com.servoy.j2db.BasicFormManager in project servoy-client by Servoy.
the class FormLayoutGenerator method generateRecordViewForm.
public static void generateRecordViewForm(PrintWriter writer, Form form, String realFormName, IServoyDataConverterContext context, boolean design) {
generateFormStartTag(writer, form, realFormName, false, design);
Iterator<Part> it = form.getParts();
if (design) {
while (it.hasNext()) {
Part part = it.next();
if (!Part.rendersOnlyInPrint(part.getPartType())) {
writer.print("<div ng-style=\"");
writer.print(PartWrapper.getName(part));
writer.print("Style\"");
String partClass = "svy-" + PartWrapper.getName(part);
if (part.getStyleClass() != null) {
partClass += " " + part.getStyleClass();
}
writer.print(" class=\"");
writer.print(partClass);
writer.print("\">");
generateEndDiv(writer);
}
}
}
Map<IPersist, FormElement> cachedElementsMap = new HashMap<IPersist, FormElement>();
if (context != null && context.getApplication() != null) {
IFormController controller = ((BasicFormManager) context.getApplication().getFormManager()).getCachedFormController(realFormName);
if (controller != null && controller.getFormUI() instanceof WebFormUI) {
List<FormElement> cachedFormElements = ((WebFormUI) controller.getFormUI()).getFormElements();
for (FormElement fe : cachedFormElements) {
if (fe.getPersistIfAvailable() != null) {
cachedElementsMap.put(fe.getPersistIfAvailable(), fe);
}
}
}
}
it = form.getParts();
while (it.hasNext()) {
Part part = it.next();
if (!Part.rendersOnlyInPrint(part.getPartType())) {
if (!design) {
writer.print("<div svy-ng-style=\"");
writer.print(PartWrapper.getName(part));
writer.print("Style\"");
String partClass = "svy-" + PartWrapper.getName(part);
if (part.getStyleClass() != null) {
partClass += " " + part.getStyleClass();
}
writer.print(" class=\"");
writer.print(partClass);
writer.print("\">");
}
for (IFormElement bc : PartWrapper.getBaseComponents(part, form, context, design, false)) {
FormElement fe = null;
if (cachedElementsMap.containsKey(bc)) {
fe = cachedElementsMap.get(bc);
}
if (fe == null) {
fe = FormElementHelper.INSTANCE.getFormElement(bc, context.getSolution(), null, design);
}
generateFormElementWrapper(writer, fe, form, form.isResponsiveLayout());
generateFormElement(writer, fe, form);
generateEndDiv(writer);
}
if (!design)
generateEndDiv(writer);
}
}
generateFormEndTag(writer, design);
}
Aggregations