1 15 package org.apache.tapestry.contrib.table.model.ognl; 16 17 import org.apache.commons.logging.Log; 18 import org.apache.commons.logging.LogFactory; 19 import org.apache.tapestry.contrib.table.model.ITableColumn; 20 import org.apache.tapestry.contrib.table.model.simple.ITableColumnEvaluator; 21 import org.apache.tapestry.services.ExpressionEvaluator; 22 23 26 public class OgnlTableColumnEvaluator implements ITableColumnEvaluator 27 { 28 private static final long serialVersionUID = 1L; 29 30 31 32 private ExpressionEvaluator _expressionEvaluator; 33 34 private static final Log LOG = LogFactory.getLog(OgnlTableColumnEvaluator.class); 35 36 private String m_strExpression; 37 38 public OgnlTableColumnEvaluator(String strExpression, ExpressionEvaluator expressionEvaluator) 39 { 40 m_strExpression = strExpression; 41 _expressionEvaluator = expressionEvaluator; 42 } 43 44 48 public synchronized Object getColumnValue(ITableColumn objColumn, Object objRow) 49 { 50 if (m_strExpression == null || m_strExpression.equals("")) 52 return ""; 53 54 try 55 { 56 return _expressionEvaluator.read(objRow, m_strExpression); 57 } 58 catch (Exception e) 59 { 60 LOG.error("Cannot use column expression '" + m_strExpression + "' in row", e); 61 return ""; 62 } 63 } 64 } | Popular Tags |