cocoon-docs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From stev...@outerthought.org
Subject [WIKI-UPDATE] Snippets XMLFormsRepeat Fri Jun 13 13:00:05 2003
Date Fri, 13 Jun 2003 11:00:05 GMT
Page: http://wiki.cocoondev.org/Wiki.jsp?page=Snippets , version: 21 on Fri Jun 13 10:47:16
2003 by Cranphin

+ !XMLFormsRepeat
+ Some of the more complex ways to use <xf:repeat> in XMLForms


Page: http://wiki.cocoondev.org/Wiki.jsp?page=XMLFormsRepeat , version: 1 on Fri Jun 13 10:45:45
2003 by Cranphin

New page created:
+ I'm putting two mails here on the subject of how to use <xf:repeat> tags to create
+ a form with multiline repeated parts.
+ 
+ My original question:
+ "Greetings :)
+ 
+ A fellow worker of mine is trying to build a form upon xmlforms with a
+ rather complicated makeup,
+ he wants the form to represent a list of users, with each user having some
+ fields for user name,
+ adres and so :)
+ 
+ like this:
+ 
+ User 1
+ name: biggie
+ address: big house
+ 
+ User 2
+ name: little
+ address: lil house
+ 
+ The problem is that there can be 1 , or 1-hundred users :)
+ And he'd like to be able to edit each users info on the form, and also add
+ additional users, all on the same form :)
+ 
+ he uses the current xmlforms implementation of cvs, with a normal java bean
+ as model.
+ 
+ Now I've already been telling him It's hopeless and it aint gonna work, till
+ I suddenly remembered
+ there's the xf:repeat tag, which might or might not just do the trick :)
+ 
+ The problem is the darn thing is hardly documented, and the code isn't
+ really readable to me,
+ so I have some questions regarding this tag :)
+ 
+ Firstly, I've seen the samples in cvs that use the repeat tag, from what I
+ see you reference a field
+ in the model/bean that returns a List, does this have to be a List, or would
+ any Set or Collection do ?
+ what's the datatype that this thing expects ? :)
+ 
+ Secondly, and this is the important bit! Could this List also be a list of
+ beans, and if it is, can we inside
+ the repeat tag reference fields of these beans ?
+ And if we can, how would this look , can someone post an example of how the
+ repeat tag and it's contents would look in such a case ?
+ 
+ Basicly I think it should be able to do this, I believe it so much that if
+ it doesn't someone should get up and make it do it ;) Cause it'd be a cool
+ powerfull feature :)
+ 
+ ofcourse there'd still be the issue of adding new users, but we can handle
+ that by binding actions to some buttons that add to the list in the bean, no
+ problem there :)
+ 
+ Ok, many thanks in advance if anyone could help us with this!! :)
+     Greetings,
+         Jeroen Cranendonk.
+ 
+ (Ohyeah, if this is possible, where is it documented ? :) or isn't it? it
+ should be then really ^-^ )"
+ 
+ 
+ The reply:
+ "On Friday, June 13, 2003, at 08:40 AM, Jeroen Cranendonk wrote:
+ >
+ 
+ <snip/>
+ 
+ > Firstly, I've seen the samples in cvs that use the repeat tag, from 
+ > what I
+ > see you reference a field
+ > in the model/bean that returns a List, does this have to be a List, or 
+ > would
+ > any Set or Collection do ?
+ > what's the datatype that this thing expects ? :)
+ 
+ I have used it successfully with a Set:
+ 
+ public class Coverage {
+ 
+ private Long id;
+ private String name;
+ private String description;
+ private Coverage parent;
+ private Set children; // of type Coverage //
+ private Type type;
+ 
+ // snip //
+ 
+ }
+ 
+ >
+ > Secondly, and this is the important bit! Could this List also be a 
+ > list of
+ > beans, and if it is, can we inside
+ > the repeat tag reference fields of these beans ?
+ > And if we can, how would this look , can someone post an example of 
+ > how the
+ > repeat tag and it's contents would look in such a case ?
+ 
+ here's the main Bean:
+ 
+      <xf:output ref="/name">
+        <xf:label>Name</xf:label>
+      </xf:output>
+ 
+ here's the 'parent' Composite Bean :
+ 
+     <xf:output ref="/parent/name">
+        <xf:label>Parent</xf:label>
+      </xf:output>
+ 
+ Here are the 'sibling' Composite Beans :
+ 
+      <xf:group ref="/parent/children">
+        <xf:label>Siblings</xf:label>
+        <xf:repeat nodeset="name">
+          <xf:output ref="."/>
+        </xf:repeat>
+      </xf:group>
+ 
+ Here are the 'children'  Composite Beans :
+ 
+      <xf:group ref="/children">
+        <xf:label>Children</xf:label>
+        <xf:repeat nodeset="name">
+          <xf:output ref="."/>
+        </xf:repeat>
+      </xf:group>
+ 
+ Here are the 'grand children'  Composite Beans :
+ 
+      <xf:group ref="/children">
+        <xf:label>Grand Children</xf:label>
+        <xf:repeat nodeset="children">
+           <xf:output ref="name"/>
+        </xf:repeat>
+      </xf:group>
+ 
+ hope this helps
+ 
+ regards Jeremy"
+ 
+ 
+ NOTE: Someone please filter out the content from the static in this page!! :)
+ 



Mime
View raw message