cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joerg Heinicke <joerg.heini...@gmx.de>
Subject Re: [CForms] Support for multipe unique-row-id in Repeater
Date Fri, 12 Mar 2004 04:06:33 GMT
On 11.03.2004 17:31, Marc Portier wrote:

>> All together we are at:
>>
>> <fb:repeater id="myRepeaterId" parent-path="." row-path="TheRowPath">
>>   <fb:identity>
>>     <fb:value id="myId1" path="myId1"/>
>>     <fb:value id="myId2" path="myId2"/>
>>   </fb:identity>
>>   <fb:on-bind>
>>     <fb:value id="field1" path="field1"/>
>>     <fb:value id="field2" path="field2"/>
>>   </fb:on-bind>
>> </fb:repeater>
>>
> 
> yep, sounds like the best we have ATM

So, I implemented this myself. To be honest, I'm proud of this work. Not 
only that I got it working, I also had the feeling I know what I'm doing 
:) Ok, it took a while to understand all the things in the code, but now 
it works. I tested it with the form2 binding samples.

Some issues:
1. I removed the old attributes and convertor. I will also add this to 
the woody2cforms upgrade task. Obviously this must by solved by a 
stylesheet.
2. The repeater binding has to know stuff (fieldId, xpath, convertor, 
etc.) from its child bindings - and this dependency is bad. With the 
both attributes all details where known to the repeater binding builder 
(therefore it implemented the functionality of a second builder) and so 
to the repeater binding. This is no longer true for the elements. I can 
get the child bindings from the composed binding, but I had to open 
(additional getters) the value binding to get the values no longer 
available to the repeater binding otherwise.

This issue goes on: I expect value bindings as child bindings, nothing 
else (would result in ClassCastException at the moment). I could imagine 
the use of other bindings here too: the simplest is the context binding, 
which seems to be absolutely valid, but not working, because there is no 
chance to get the values from a value binding which is a child of a 
context binding which is a child of the identity binding. The extreme 
would be a repeater binding: imagine a list of persons that have a list 
of biometrical data that constitute the identity of those persons.

All together: there is now a dependency of the repeater binding on its 
child bindings. We can restrict the allowed child elements of 
fb:identity to fb:value that reduces the problem to current minimum, but 
maybe something else is needed.

>> I read all the threads and use cases. And yes, a unification of the 
> 
> pfew, you are a brave man :-)
> I need some time to list all changes, proposals, enhancements that were 
> partially discussed but haven't got into code yet

That would be interesting. I guess while reading I lost at least half of 
the stuff ...

>> Also the unification for binding to bean or XML is a one. This ends at 
>> the latest with the repeater at the moment as the 
>> @parent-path/@row-path is different for beans and XML.
>>
> 
> hm, I've experienced this myself now and then, but I'm afraid this is 
> out of our league, jxpath imposes an XML way of looking at your 
> java-bean that is sometimes 'surprising':

Yes, I know and fear this.

> what most naturally looks like the standard java version of an xml 
> snippet seems (often due to technical limitations that however logic 
> need some thought to grasp) to be behaving different in the jxpath view
> 
> next to this observation however I'ld like to question the real-life 
> relevance: IMHO the advantage of jxpath under the hood of the binding is 
> that it allows for reusing the syntax-metafor of xpath regardless of the 
> backend.  Being the mix of using slashes over dots, not needing 
> parentheses and having a single expression that equally works for 
> getting and setting (LHV/RHV)

When it would work "regardless of the backend" ...

> I don't see it as a common use case that people during the lifetime 
> would want to switch the backend from XML to JavaBeans (or vice versa) 
> and actually expect to have all binding expressions work 'justlikethat'.

While developing we often encoupled the backend from the frontend. The 
interface between both was a simple XML structure. The frontend knows 
what it will get, the backend what it has to deliver when the system is 
running. This allows independent development. Additionally we had static 
test XML files for the frontend, so that "real life" test is possible. 
The switching was just in the sitemap (XML from disk or from backend). 
Now I would have to maintain two binding files.

Joerg

Mime
View raw message