Search in sources :

Example 11 with MViewColumn

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();
}
Also used : MBrowseField(org.adempiere.model.MBrowseField) MViewColumn(org.adempiere.model.MViewColumn)

Aggregations

MViewColumn (org.adempiere.model.MViewColumn)11 MBrowseField (org.adempiere.model.MBrowseField)6 MViewDefinition (org.adempiere.model.MViewDefinition)4 MBrowse (org.adempiere.model.MBrowse)3 I_AD_View_Column (org.adempiere.model.I_AD_View_Column)2 MView (org.adempiere.model.MView)2 PackOut (org.adempiere.pipo.PackOut)2 MColumn (org.compiere.model.MColumn)2 Query (org.compiere.model.Query)2 AttributesImpl (org.xml.sax.helpers.AttributesImpl)2 IOException (java.io.IOException)1 SQLException (java.sql.SQLException)1 ArrayList (java.util.ArrayList)1 AdempiereException (org.adempiere.exceptions.AdempiereException)1 DBException (org.adempiere.exceptions.DBException)1 PackIn (org.adempiere.pipo.PackIn)1 POSaveFailedException (org.adempiere.pipo.exception.POSaveFailedException)1 MLookup (org.compiere.model.MLookup)1 MQuery (org.compiere.model.MQuery)1 MTable (org.compiere.model.MTable)1