tiles-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "BR Brett Ryan (3456)" <Brett.R...@johnsands.com.au>
Subject Re: MenuItem EL rendering
Date Fri, 12 Jun 2015 04:12:36 GMT
Alrighty, I've implemented the support just the way I want it, and wondered if I could contribute
it back.

What I've done is created a new interface (ExpressionAware) which provides the following method:

    void evaluateExpressions(AttributeEvaluator, Request)

This is then called from AbstractAttributeEvaluator.evaluate(Attribute, Request) which then
allows the implementor to update expression values or do set new properties etc. I've implemented
this in the MenuItem class to replace its values when called.

I'm yet to write unit-tests, I've tested with the MenuItem and it's working perfectly.

You could take this further by instead of Attribute being wired into the expression awareness
in core, it could also implement ExpressionAware to further abstract the expression evaluation.

If the type is enumerable each item will also have its expressions evaluated (as is the case
with MenuItem.

Patch attached


> On 7 Jun 2015, at 06:15, BR Brett Ryan (3456) <Brett.Ryan@johnsands.com.au> wrote:
> 
> 
>>> I see that the MenuItem support is now in tiles-compat, is there an
>>> alternate (better?) way of achieving this?
>> 
>> 
>> Have you looked into the SimpleMenuItem code?
>> I'd take a stub at implementing what you need there from scratch – it's
>> pretty simple stuff there.
> 
> I did, and was thinking about doing it, but I couldn't find what it was that performs
the EL evaluation. I must admit, it was a Thursday afternoon and I was about to head home
so I didn't look terribly hard ;)I'll give it a better look.

Mime
  • Unnamed multipart/mixed (inline, None, 0 bytes)
View raw message