1 |
| |
2 |
| |
3 |
| |
4 |
| |
5 |
| |
6 |
| |
7 |
| |
8 |
| |
9 |
| |
10 |
| |
11 |
| |
12 |
| |
13 |
| |
14 |
| |
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 |
| |
24 |
| |
25 |
| |
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 |
0
| public OgnlTableColumnEvaluator(String strExpression, ExpressionEvaluator expressionEvaluator)
|
39 |
| { |
40 |
0
| m_strExpression = strExpression;
|
41 |
0
| _expressionEvaluator = expressionEvaluator;
|
42 |
| } |
43 |
| |
44 |
| |
45 |
| |
46 |
| |
47 |
| |
48 |
0
| public synchronized Object getColumnValue(ITableColumn objColumn, Object objRow)
|
49 |
| { |
50 |
| |
51 |
0
| if (m_strExpression == null || m_strExpression.equals(""))
|
52 |
0
| return "";
|
53 |
| |
54 |
0
| try
|
55 |
| { |
56 |
0
| return _expressionEvaluator.read(objRow, m_strExpression);
|
57 |
| } |
58 |
| catch (Exception e) |
59 |
| { |
60 |
0
| LOG.error("Cannot use column expression '" + m_strExpression + "' in row", e);
|
61 |
0
| return "";
|
62 |
| } |
63 |
| } |
64 |
| } |