cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Antonio Gallardo (JIRA)" <j...@apache.org>
Subject [jira] Assigned: (COCOON-1864) RepeaterJXPathBinding - order of row is inverted
Date Sat, 17 Jun 2006 08:26:31 GMT
     [ http://issues.apache.org/jira/browse/COCOON-1864?page=all ]

Antonio Gallardo reassigned COCOON-1864:
----------------------------------------

    Assign To: Antonio Gallardo

> RepeaterJXPathBinding - order of row is inverted
> ------------------------------------------------
>
>          Key: COCOON-1864
>          URL: http://issues.apache.org/jira/browse/COCOON-1864
>      Project: Cocoon
>         Type: Bug

>   Components: Blocks: Forms
>     Versions: 2.1.8, 2.1.9
>     Reporter: DennisDam
>     Assignee: Antonio Gallardo

>
> I found a bug in the forms block of Cocoon 2.1.8 / 2.1.9. I found that 
> putting a min-size / initial-size attribute on a repeater element in the 
> CForms model, inverts the order of rows upon binding the form. So for 
> example the input document looked like:
> <document>
>   <row>a</row>
>   <row>b</row>
>   <row>c</row>
>   <row>d</row>
> </document>
> and my repeater model element's intial-size was set at 3. After 
> transforming the forms template with the forms transformer, I see the 
> following field instances (pseudocode):
> <field>c</field>
> <field>b</field>
> <field>a</field>
> <field>d</field>
> So what happens? The JXPathbinding for the repeater inverts the order of 
> the elements with index < initial-size! I traced this bug back to the 
> org.apache.cocoon.forms.binding.RepeaterJXPathBinding class, where I 
> found the following code snippet in the doLoad() method:
>             while (rowPointers.hasNext()) {
>                 // create a new row, take that as the frmModelSubContext
>                 Repeater.RepeaterRow thisRow;
>                 if (initialSize > 0) {
>                     thisRow = repeater.getRow(--initialSize);
>                 } else {
>                     thisRow = repeater.addRow();
>                 }
> I changed this into:
>         int currentRow = 0;
>         while (rowPointers.hasNext()) {
>             // create a new row, take that as the frmModelSubContext
>             Repeater.RepeaterRow thisRow;
>             if (currentRow < initialSize) {
>                 thisRow = repeater.getRow(currentRow++);
>             } else {
>                 thisRow = repeater.addRow();
>             }
> and now the binding works correctly / like I want it to work :). I must 
> note that I do NOT use an identity in my repeater binding declaration. 
> But I think it would be logical that leaving out the identity element 
> should result in preservation of the order the elements occur in the 
> input document.
> regards,
> Dennis Dam

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


Mime
View raw message