use of org.adempiere.model.MViewColumn in project adempiere by adempiere.
the class WBrowserTable method prepareTable.
/**
* preparate Table
* @param fields
* @param multiSelection
* @return
*/
public String prepareTable(List<MBrowseField> fields, boolean multiSelection) {
browserRows = new BrowserRow(this);
StringBuffer sql = new StringBuffer("");
browserFields = fields;
clearColumns();
int col = 0;
// Add columns & sql
for (MBrowseField field : fields) {
MViewColumn columnView = field.getAD_View_Column();
// create sql
if (col > 0 && columnView.getColumnSQL().length() > 0)
sql.append(", ");
if (field.isKey()) {
setKey(col);
field.setName("#");
}
sql.append(columnView.getColumnSQL()).append(" ").append("AS").append(" ").append(columnView.getColumnName());
browserRows.addBrowserField(field, col);
if (field.isDisplayed()) {
// Use get value get from memory entity because field can be calculated
addColumn(field.get_ValueAsString(I_AD_Browse_Field.COLUMNNAME_Name));
}
// BR [ 257 ]
col++;
}
// Set Column Class
col = 0;
for (MBrowseField field : fields) {
if (field.isDisplayed()) {
setColumnClass(col, MBrowseField.createGridFieldVO(field, browser.getWindowNo()), field.getAD_Reference_ID(), field.isReadOnly(), // #845 Bad translation for table column
field.get_Translation(I_AD_Browse_Field.COLUMNNAME_Name));
col++;
}
}
//
return sql.toString();
}
Aggregations