You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by ds...@apache.org on 2005/09/20 00:34:51 UTC

svn commit: r290297 - in /jakarta/tapestry/trunk: doc/src/ComponentReference/Foreach.html framework/src/documentation/content/xdocs/tapestry/ComponentReference/Foreach.xml src/documentation/content/xdocs/links.ent status.xml

Author: dsolis
Date: Mon Sep 19 15:34:42 2005
New Revision: 290297

URL: http://svn.apache.org/viewcvs?rev=290297&view=rev
Log:
Fix bug:TAPESTRY-465. Document Foreach component.

Removed:
    jakarta/tapestry/trunk/doc/src/ComponentReference/Foreach.html
Modified:
    jakarta/tapestry/trunk/framework/src/documentation/content/xdocs/tapestry/ComponentReference/Foreach.xml
    jakarta/tapestry/trunk/src/documentation/content/xdocs/links.ent
    jakarta/tapestry/trunk/status.xml

Modified: jakarta/tapestry/trunk/framework/src/documentation/content/xdocs/tapestry/ComponentReference/Foreach.xml
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/documentation/content/xdocs/tapestry/ComponentReference/Foreach.xml?rev=290297&r1=290296&r2=290297&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/documentation/content/xdocs/tapestry/ComponentReference/Foreach.xml (original)
+++ jakarta/tapestry/trunk/framework/src/documentation/content/xdocs/tapestry/ComponentReference/Foreach.xml Mon Sep 19 15:34:42 2005
@@ -28,13 +28,19 @@
   
   <body>
 
-<p> <strong>THIS PAGE UNDER CONSTRUCTION</strong>
+<p> A component that loops through a set of values, setting a property for each
+	value before rendering its wrapped elements.
 </p>
 
 <p>
-  <strong>See also:</strong> 
+  <strong>See also:</strong> &For;
 </p>
 
+      <warning>
+          This component has been deprecated; Tapestry 4.0 adds the &For; component which
+          replaces Foreach and &ListEdit; components.
+      </warning>
+
 <section>
   <title>Parameters</title>
   
@@ -47,15 +53,68 @@
     <th>Default</th>
     <th>Description</th>
   </tr>
+    <tr>
+        <td>source</td>
+        <td>Iterator, Collection, Object[], or Object</td>
+
+        <td>in</td>
+        <td>yes</td>
+    <td>
+
+    </td>
+        <td>
+    The source of objects to be iterated, which may be a Collection, an Iterator, an array of Objects, or a even a single Object (which is treated as a singleton collection).
+The source parameter may even be null, in which case the Foreach's body is never renderred.
+    </td>
+        </tr>
+    <tr>
+        <td>value</td>
+        <td>Object</td>
+
+        <td>out</td>
+        <td>no</td>
+    <td>
+
+    </td>
+        <td>
+    Used to update the current value on each iteration..
+    </td>
+        </tr>
+    <tr>
+        <td>index</td>
+        <td>int</td>
+
+        <td>out</td>
+        <td>no</td>
+    <td>
+
+    </td>
+        <td>
+    Used to store the index of the current value within the stream of elements provided by the source parameter. The index parameter is explicitly updated before the value parameter..
+    </td>
+        </tr>
+    <tr>
+        <td>element</td>
+        <td>String</td>
+
+        <td>in</td>
+        <td>no</td>
+    <td>
+
+    </td>
+        <td>
+    If specified, then the component acts like an &Any;, emitting an open and close tag before and after each iteration. Most often, the element is "tr" when the Foreach is part of an HTML table. Any informal parameters are applied to the tag. If no element is specified, informal parameters are ignored..
+    </td>
+        </tr>
 
 	</table>
   
 <p>
-  Body: <strong>removed / allowed</strong>
+  Body: <strong>allowed</strong>
 </p>  
 
 <p>
-  Informal parameters: <strong>allowed  / forbidden</strong>
+  Informal parameters: <strong>allowed</strong>
 </p>
 
 <p>
@@ -66,6 +125,62 @@
 
 <section>
   <title>Examples</title>
+  <p> The Foreach component is used to generate a table from a Customer List.</p>
+    <p>Template</p>
+<source><![CDATA[
+<table cellspacing="6">
+  <tr>
+   <td>ID</td>
+   <td>&nbsp;</td>
+   <td>Name</td>
+   <td>&nbsp;</td>
+   <td>Level</td>
+  </tr>
+  <tr>
+   <td colspan="5"><hr></td>
+  </tr>
+  <tr jwcid="@Foreach" source="ognl:customerList" value="ognl:customer" element="tr">
+   <td><span jwcid="@Insert" value="ognl:customer.id"/></td>
+   <td>&nbsp;</td>
+   <td><span jwcid="@Insert" value="ognl:customer.fullName"/></td>
+   <td>&nbsp;</td>
+   <td><span jwcid="@Insert" value="ognl:customer.memberLevel"/></td>
+  </tr>
+</table>
+]]></source>
+    <p>Page Specification</p>
+<source><![CDATA[
+.....
+<property-specification name="customerList" type="java.util.List" persistent="yes"/>
+<property-specification name="customer" type="Customer"/>
+.....
+]]></source>
+    <p>Java</p>
+<source><![CDATA[
+public abstract class SalesPage extends BasePage {
+    public abstract List getCustomerList();
+
+    public abstract void setCustomerList(List value);
+}
+
+public class Customer implements Serializable {
+    private Integer id;
+    private String fullName;
+    private String memberLevel;
+
+    public Customer(Integer id, String fullName, String memberLevel) {
+        this.id = id;
+        this.fullName = fullName;
+        this.memberLevel = memberLevel;
+    }
+
+    public Integer getId() { return id; }
+
+    public String getFullName() { return fullName; }
+
+    public String getMemberLevel() { return memberLevel; }
+}
+]]></source>
 
 </section>
 </body>

Modified: jakarta/tapestry/trunk/src/documentation/content/xdocs/links.ent
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/src/documentation/content/xdocs/links.ent?rev=290297&r1=290296&r2=290297&view=diff
==============================================================================
--- jakarta/tapestry/trunk/src/documentation/content/xdocs/links.ent (original)
+++ jakarta/tapestry/trunk/src/documentation/content/xdocs/links.ent Mon Sep 19 15:34:42 2005
@@ -36,7 +36,7 @@
 <!ENTITY ChangeObserver 			'<link href="&apiroot;/event/ChangeObserver.html">ChangeObserver</link>'>
 <!ENTITY BaseComponent 				'<link href="&apiroot;/BaseComponent.html">BaseComponent</link>'>
 <!ENTITY BaseEngine 				'<link href="&apiroot;/engine/BaseEngine.html">BaseEngine</link>'>
-<!ENTITY BasePage 
+<!ENTITY BasePage
 					'<link href="&apiroot;/html/BasePage.html">BasePage</link>'>
 <!ENTITY BaseSessionStoreOptimized  '<link href="&apiroot;/BaseSessionStoreOptimized.html">BaseSessionStoreOptimized</link>'>
 <!ENTITY ComponentPropertySource	'<link href="&apiroot;/services/ComponentPropertySource.html">ComponentPropertySource</link>'>
@@ -138,6 +138,7 @@
 <!ENTITY Else				'<link href="site:Else">Else</link>'>
 <!ENTITY ExternalLink 		'<link href="site:ExternalLink">ExternalLink</link>'>
 <!ENTITY FieldLabel			'<link href="site:FieldLabel">FieldLabel</link>'>
+<!ENTITY For    			'<link href="site:For">For</link>'>
 <!ENTITY Foreach 			'<link href="site:Foreach">Foreach</link>'>
 <!ENTITY Form 				'<link href="site:Form">Form</link>'>
 <!ENTITY Frame 				'<link href="site:Frame">Frame</link>'>

Modified: jakarta/tapestry/trunk/status.xml
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/status.xml?rev=290297&r1=290296&r2=290297&view=diff
==============================================================================
--- jakarta/tapestry/trunk/status.xml (original)
+++ jakarta/tapestry/trunk/status.xml Mon Sep 19 15:34:42 2005
@@ -51,6 +51,7 @@
   </todo>
   <changes>
     <release version="4.0-beta-8" date="unreleased">
+      <action type="fix" dev="DS" fixes-bug="TAPESTRY-465">Document Foreach component</action>
     </release>
     <release version="4.0-beta-7" date="Sep 17 2005">
       <action type="fix" dev="HLS" fixes-bug="TAPESTRY-341">Need better line-precise reporting for listener method</action>



---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-dev-help@jakarta.apache.org