Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Object-Type Attribute Value Evaluation #4

Open
wants to merge 5 commits into
base: TILES_3_0_X
Choose a base branch
from

Conversation

brettryan
Copy link

Object type attributes such as the <menu /> implementation may now implement o.a.t.awareness.ExpressionAware which causes #evaluateExpressions(AttributeEvaluator,Request) to be called during attribute evaluation.

It is up to the implementation to handle evaluation using the supplied evaluator.

Implementors may return any object type or a duplicated of itself with expressions replaced which will be used for rendering within the view model.

Object type attributes such as the <menu /> implementation may now implement
o.a.t.awareness.ExpressionAware which will be provided the opertunitiy for
 #evaluateExpressions(AttributeEvaluator,Request) to be called.

It is up to the implementation to handle evaluation using the supplied
evaluator.
I mistakenly thought the object instances were per request. It was necessary
to change this to return values instead of updating themselves.
@michaelsembwever
Copy link
Member

discussion on the need for this is in https://permalink.gmane.org/gmane.comp.apache.tiles.devel/743 and https://permalink.gmane.org/gmane.comp.apache.tiles.devel/744

particularly because it introduces changes outside of tiles-compat and we want to think carefully around that.

@brettryan
Copy link
Author

Hey thanks mck, I really am silly and should have signed up to tiles-dev but the thought didn't even cross my mind, sorry for that.

Interestingly though I did ask on the users mailing list before I submitted my solution if there was a way to get <item> to evaluate expressions, I requested if there was a newer alternative, the response was actually from yourself to look at the code as it's fairly simple :)

Anyway, I think your solution would work, I never knew you could nest lists, there's little examples of this except now reading the DTD I see this is supported.

It does seem to not work however, when I add use an expression, i.e. <add-attribute expression="${customer.id}"/> attempts to render the attribute fail with a NPE, however if I use value it renders, but unevaluated.

I'll mention this on the dev mailing list.

@michaelsembwever
Copy link
Member

Interestingly though I did ask on the users mailing list before I
submitted my solution if there was a way to get to evaluate
expressions, I requested if there was a newer alternative, the response was
actually from yourself to look at the code as it's fairly simple :)

Yeah my apologies for that Brett. I didn't catch it, at least too late once
Nick raised concerns about the improvements you need (in the PR) changing
code beyond tiles-compat.

It does seem to not work however, when I add use an expression, i.e.
attempts to render the
attribute fail with a NPE, however if I use value it renders, but
unevaluated.

If this is a bug then a pull request there will of course be of great
value. Things would be more on the tiles-3.0 way of doing things :-)

~mck

@brettryan
Copy link
Author

On 8 Jul 2015, at 21:25, mck [email protected] wrote:

Interestingly though I did ask on the users mailing list before I
submitted my solution if there was a way to get to evaluate
expressions, I requested if there was a newer alternative, the response was
actually from yourself to look at the code as it's fairly simple :)

Yeah my apologies for that Brett. I didn't catch it, at least too late once
Nick raised concerns about the improvements you need (in the PR) changing
code beyond tiles-compat.

It's cool, I'm happy to help where I'm able. If I can I really would like to help with documentation of tiles. It could be me but sometimes I find it a tiny bit sparse :)

It does seem to not work however, when I add use an expression, i.e.
attempts to render the
attribute fail with a NPE, however if I use value it renders, but
unevaluated.

If this is a bug then a pull request there will of course be of great
value. Things would be more on the tiles-3.0 way of doing things :-)

Thanks, I'm just trying to track down the bug, my stacktraces are being swallowed by something else so need to setup a test project to figure out what's going on. My brain's fried at the moment so will look at it later, it seems most of what I can see is pointing at tiles-request so will need to look harder.

@michaelsembwever
Copy link
Member

On 8 July 2015 at 13:39, Brett Ryan [email protected] wrote:

It's cool, I'm happy to help where I'm able. If I can I really would like
to help with documentation of tiles. It could be me but sometimes I find it
a tiny bit sparse :)

Yeah that would be hugely appreciated. Often documentation from a fresh
perspective catches much more.

~mck

@brettryan
Copy link
Author

On 9 Jul 2015, at 01:24, mck [email protected] wrote:

On 8 July 2015 at 13:39, Brett Ryan [email protected] wrote:

It's cool, I'm happy to help where I'm able. If I can I really would like
to help with documentation of tiles. It could be me but sometimes I find it
a tiny bit sparse :)

Yeah that would be hugely appreciated. Often documentation from a fresh
perspective catches much more.

Not a problem, I'll post something on the dev list to talk about where I could best help. I can't say I can put in a huge amount of time, but I can at least contribute a few hours or so a week to support the project. It would also help me get a better understanding/appreciation. I somehow skipped tiles in the struts days.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants