use of com.axelor.meta.schema.views.Field in project axelor-open-suite by axelor.
the class ReportBuilderService method getHtmlTable.
/**
* Create html table string from list of widgets(Items of grd view).
*
* @param fieldName Name of relational field.
* @param widgets List of widgets in reference model's grid view.
* @param refModel Name of reference model.
* @return Html table created.
*/
private String getHtmlTable(String fieldName, List<AbstractWidget> widgets, String refModel) {
String header = "";
String row = "";
for (AbstractWidget widget : widgets) {
if (widget instanceof Field) {
Field field = (Field) widget;
String name = field.getName();
String title = field.getTitle();
MetaField metaField = getMetaField(name, refModel);
if (Strings.isNullOrEmpty(title)) {
title = getFieldTitle(name, metaField);
}
name = processRelational(name, metaField);
header += "<th>" + title + "</th>";
row += "<td>$" + fieldName + "." + name + "$</td>";
}
}
String table = "<td colSpan=\"2\"><table class=\"table table-bordered table-header\">" + "<tr>" + header + "</tr>" + "<tr>" + row + "</tr>" + "</table></td>";
return table;
}
Aggregations