| Issue 145: | Suggest adding support for expression evaluation from Java code | |
| 1 person starred this issue and may be notified of changes. | Back to list |
Attached is a patch against trunk and some additions for the repository
that provide support for run-time expression evaluation using EL, or any
language that supports expression evaluation through the Apache Bean
Scripting Framework. Included are two flavors of CellEditor that provide
this functionality.
Also included are some convenience methods on TableFacade for setting
expressions, and some JUnit tests for each of the components that were
added or modified.
Instructions for using expressions are in the Javadoc comments, or you can
examine the JUnit tests for an example:
TableFacade facade = TableFacadeFactory.createTableFacade("presidents",
request);
facade.setColumnProperties("name", "term", "career");
facade.useExpressions(Languages.EL, "${item.name.firstName}
${item.name.lastName}", null, "(${item.career})");
Using EL has a runtime dependency on commons-el.
Using a language supported by BSF has a runtime dependency on BSF 2.4 and
the JAR file for your language of choice.
Sep 14, 2008
Project Member
#1
jeff.johnston.mn@gmail.com
Status:
Accepted
Sep 14, 2008
(No comment was entered for this change.)
Labels:
-Type-Defect Type-Enhancement
Oct 19, 2008
I have the expressions code checked in now! I took everything but the TableFacade
code. I saw where you were going with that but it didn't fit into the overall
structure of JMesa. The expression code is really just a CellEditor. I also made some
slight tweaks, but overall its your work...nice job :). It really nice getting code
submitted to me that is really quality work.
Here is an example:
CellEditor lastNameCellEditor
= new ExpressionCellEditorFactoryImpl().createCellEditor(new
Expression(Language.JAVASCRIPT, "item", "item.name.firstName + ' ' +
item.name.lastName"));
lastName.getCellRenderer().setCellEditor(lastNameCellEditor);
or
CellEditor lastNameCellEditor = new BsfExpressionCellEditor(new
Expression(Language.JAVASCRIPT, "item", "item.name.firstName + ' ' +
item.name.lastName"));
lastName.getCellRenderer().setCellEditor(lastNameCellEditor);
or
CellEditor lastNameCellEditor = new BsfExpressionCellEditor(Language.JAVASCRIPT,
"item", "item.name.firstName + ' ' + item.name.lastName");
lastName.getCellRenderer().setCellEditor(lastNameCellEditor);
Status:
Started
Oct 21, 2008
(No comment was entered for this change.)
Status:
Fixed
|