cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sylvain Wallez <sylv...@apache.org>
Subject Re: [RT] Attribute Rendering and CForms Convertors
Date Tue, 09 Nov 2004 10:34:18 GMT
Jonas Ekstedt wrote:

>On Fri, 2004-11-05 at 14:02 +0100, Daniel Fagerstrom wrote:
>  
>
>>>If I would be able to choose convertors I might decide IN VIEW ITSELF 
>>>that that specific model value should be coloured/pretty 
>>>printed/rendered according to some specific logic. As long as this 
>>>logic has read-only access to model and performs steps to produce some 
>>>rendering I do not find it SoC break.
>>>      
>>>
>>Seem like an excelent idea to me. I think it could be analog to the use 
>>of the class attribute in HTML to give hints to CSS about styling.
>>
>>We could have something like:
>>
>>  ${month/balance?class=financialValue}
>>
>>then the finacialValue rule for convertion is used if there is one 
>>otherwise the default rule is used. There is no doubt room for 
>>improvement of the syntax ;)
>>
>>A functional syntax as Sylvain prpoposed would also be possible:
>>
>>  ${convert(month/balance, 'financialValue')}
>>
>>but I percieve the convertor as something that not is part of the 
>>expression language (EL). The convertor is applied to the object that is 
>>returned from the EL engine, and the default convertor should always be 
>>applied on the object, so one shoudn't need to write
>>
>>  ${convert(month/balance)}
>>
>>to get the default conversion.
>>    
>>
>
>Couldn't the above example be done better with tags instead? For
>example:
>
><mytag:date value="${todaysDate}"/>
>  
>

Good idea. Actually, I even already used it that way (but just made the 
connection now with this discussions) by implementing complex 
formattings as JX macros. The use case was presenting an object part of 
a tree as the path from the tree root down to the object (i.e. "foo > 
bar > baz"), with links on each element. Something I definitely wouldn't 
want to do in the controller :-)

So maybe the solution just consists in defining sets of reusable JX macros?

Sylvain

-- 
Sylvain Wallez                                  Anyware Technologies
http://www.apache.org/~sylvain           http://www.anyware-tech.com
{ XML, Java, Cocoon, OpenSource }*{ Training, Consulting, Projects }


Mime
View raw message