My favorites | Sign in
Project Home Downloads Wiki Issues Source
READ-ONLY: This project has been archived. For more information see this post.
Search
for
  Advanced search   Search tips   Subscriptions
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
Status:  Fixed
Owner:  ----
Closed:  Oct 2008


 
Reported by bgo...@e1b.org, Sep 12, 2008
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.
 
expressions.zip
916 KB   Download
Sep 14, 2008
Project Member #1 jeff.johnston.mn@gmail.com
Thanks! It is gong to take me a week or two to include the patches just because of my
schedule right now. Looking forward to checking this out though!
Status: Accepted
Sep 14, 2008
Project Member #2 jeff.johnston.mn@gmail.com
(No comment was entered for this change.)
Labels: -Type-Defect Type-Enhancement
Oct 19, 2008
Project Member #3 jeff.johnston.mn@gmail.com
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
Project Member #4 jeff.johnston.mn@gmail.com
(No comment was entered for this change.)
Status: Fixed

Powered by Google Project Hosting