You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tapestry.apache.org by hl...@apache.org on 2007/01/13 02:46:55 UTC

svn commit: r495815 - in /tapestry/tapestry5/tapestry-core/trunk/src: main/java/org/apache/tapestry/corelib/components/If.java site/apt/guide/inject.apt site/apt/guide/templates.apt

Author: hlship
Date: Fri Jan 12 17:46:54 2007
New Revision: 495815

URL: http://svn.apache.org/viewvc?view=rev&rev=495815
Log:
Document <block> and <parameter>.

Modified:
    tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/corelib/components/If.java
    tapestry/tapestry5/tapestry-core/trunk/src/site/apt/guide/inject.apt
    tapestry/tapestry5/tapestry-core/trunk/src/site/apt/guide/templates.apt

Modified: tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/corelib/components/If.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/corelib/components/If.java?view=diff&rev=495815&r1=495814&r2=495815
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/corelib/components/If.java (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/corelib/components/If.java Fri Jan 12 17:46:54 2007
@@ -33,8 +33,6 @@
     /**
      * Returns null if the test parameter is true, which allows normal rendering (of the body). If
      * the test parameter is false, returns the else parameter (this may also be null).
-     * 
-     * @return
      */
     Object beginRender()
     {

Modified: tapestry/tapestry5/tapestry-core/trunk/src/site/apt/guide/inject.apt
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/site/apt/guide/inject.apt?view=diff&rev=495815&r1=495814&r2=495815
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/site/apt/guide/inject.apt (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/site/apt/guide/inject.apt Fri Jan 12 17:46:54 2007
@@ -32,7 +32,13 @@
 
   When the field type is
   {{{../apidocs/org/apache/tapestry/Asset.html}Asset}}, the value of the Inject annotation is treated specially, as a path
-  (relative to the component) to an {{{assets.html}asset}}. 
+  (relative to the component) to an {{{assets.html}asset}}.  
+  
+* Block Injection
+
+  For field type {{{../apidoc/org/apache/tapestry/Block.html}Block}}, the value of the Inject annotation is the
+  id of the {{{templates.apt}\<block\> element}}.  If the value is omitted, it is deduced from the field name
+  (by stripping out leading "_" and "$" characters).
   
 * Named Injection
 

Modified: tapestry/tapestry5/tapestry-core/trunk/src/site/apt/guide/templates.apt
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/site/apt/guide/templates.apt?view=diff&rev=495815&r1=495814&r2=495815
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/site/apt/guide/templates.apt (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/site/apt/guide/templates.apt Fri Jan 12 17:46:54 2007
@@ -168,6 +168,31 @@
    Tapestry 4 users will recognize the \<body\> element as a replacement for the
    RenderBody component.
    
+* \<block\>
+
+  A block is a container of a portion of the component template. A block does not normally render; any component or contents you put inside
+  a block will not ordinarily be rendered.  However, by injected the block, you can have precise control over when and if the content renders.   
+  
+  A block may be annonymous, or it may have an id (specified with the id attribute).  Non-annonmyous blocks may be 
+  {{{inject.html}injected}} into the component.
+  
+* \<parameter\>
+
+  A \<parameter\> element is a special kind of block.  It is placed inside the body of an embedded component.  The block defined by the
+  \<parameter\> is passsed to the component.  \<parameter\> includes a mandatory name attribute to identify which parameter of the component
+  to bind.  
+
+  Example:
+    
++---+
+<t:comp type="If" test="loggedIn">
+  Hello, ${userName}!
+  <t:parameter name="else">
+  Click <a t:type="ActionLink" t:id="login">here</a> to log in.
+  </t:parameter>
+</t:comp>
++---+
+   
 Invisible Instrumentation
 
   A favorite feature of Tapestry 4 is <invisible instrumentation>, the ability to mark ordinary HTML elements as components. Invisible instrumentation