You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by hl...@apache.org on 2005/05/02 16:18:38 UTC

cvs commit: jakarta-tapestry/framework/src/java/org/apache/tapestry/form Form.jwc

hlship      2005/05/02 07:18:38

  Modified:    .        status.xml
               src/documentation/content/xdocs/UsersGuide spec.xml
                        components.xml
               framework/src/java/org/apache/tapestry/spec
                        ParameterSpecification.java
                        IParameterSpecification.java
               framework/src/java/org/apache/tapestry/valid
                        RenderString.java ValidatorException.java
                        FieldLabel.java IFieldTracking.java
               framework/src/test/org/apache/tapestry/junit/parse
                        Parameter.jwc Parameter_3_0.jwc
                        TestSpecificationParser.java
               framework/src/java/org/apache/tapestry IComponent.java
               framework/src/test/org/apache/tapestry/enhance
                        TestParameterPropertyWorker.java
               framework/src/java/org/apache/tapestry/parse
                        SpecificationParser.java Tapestry_4_0.dtd
               contrib/src/java/org/apache/tapestry/contrib/table/components
                        TableColumns.jwc TableValues.jwc
               framework/src/java/org/apache/tapestry/enhance
                        ParameterPropertyWorker.java
               framework/src/java/org/apache/tapestry/util/io
                        ComponentAddressAdaptor.java
               src/documentation/content/xdocs site.xml index.xml
               framework/src/java/org/apache/tapestry/util
                        ComponentAddress.java
               framework/src/test/org/apache/tapestry/junit/utils
                        TestDataSqueezer.java
               framework/src/java/org/apache/tapestry/wml Go.jwc
               framework/src/java/org/apache/tapestry/form Form.jwc
  Log:
  Added cache attribute to <parameter> element.
  
  Revision  Changes    Path
  1.91      +1 -0      jakarta-tapestry/status.xml
  
  Index: status.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/status.xml,v
  retrieving revision 1.90
  retrieving revision 1.91
  diff -u -r1.90 -r1.91
  --- status.xml	29 Apr 2005 14:58:09 -0000	1.90
  +++ status.xml	2 May 2005 14:18:37 -0000	1.91
  @@ -71,6 +71,7 @@
         <action type="add" dev="HLS"> Add DirectServiceEncoder. </action>
         <action type="fix" dev="EH" fixes-bug="TAPESTRY-303">Add quotes around attribute values in contrib:Table &lt;table&gt; elements.</action>
         <action type="update" dev="HLS"> Upgrade to HiveMind 1.0-beta-1. </action>
  +      <action type="add" dev="HLS">Add cache attribute to &lt;parameter&gt; element.</action>
       </release>
       <release version="3.0.3" date="Mar 26 2005">
         <action type="fix" dev="PF" fixes-bug="TAPESTRY-278"> Fixes security flaw in asset service. </action>
  
  
  
  1.23      +15 -1     jakarta-tapestry/src/documentation/content/xdocs/UsersGuide/spec.xml
  
  Index: spec.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/src/documentation/content/xdocs/UsersGuide/spec.xml,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- spec.xml	18 Apr 2005 17:09:03 -0000	1.22
  +++ spec.xml	2 May 2005 14:18:37 -0000	1.23
  @@ -141,7 +141,7 @@
     <li>Added the property attribute to the &spec.component; and &spec.bean; elements.</li>
     <li>Removed the type attribute from the &spec.configure; element.</li>
     <li>Added many more options for <link href="#spec.boolean-types">boolean attributes</link>.</li>
  -  <li>Added the default-binding attribute to the &spec.parameter; element.</li>
  +  <li>Added the cache and default-binding attributes to the &spec.parameter; element.</li>
   </ul>
   
   <p>
  @@ -1381,6 +1381,20 @@
   	</td>
   </tr>
   
  +<tr>
  +  <td>cache</td>
  +  <td>boolean</td>
  +  <td>no</td>
  +  <td>true</td>
  +  <td>
  +    If true (the default), then the parameter property will cache the parameter property for the
  +    duration of the components' render.  if false, then the parameter property will not cache the value, and each 
  +    access to the property will result in re-obtaining the value via the binding object.
  +    Note that invariant bindings (most bindings except for "ognl") will always be accessed just once
  +    and cached.
  +  </td>
  +</tr>
  +
   </table>
   
   <p>
  
  
  
  1.10      +36 -3     jakarta-tapestry/src/documentation/content/xdocs/UsersGuide/components.xml
  
  Index: components.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/src/documentation/content/xdocs/UsersGuide/components.xml,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- components.xml	18 Apr 2005 17:09:03 -0000	1.9
  +++ components.xml	2 May 2005 14:18:37 -0000	1.10
  @@ -256,7 +256,8 @@
   </p>
   
   <p>
  -A component parameter has a unique name and a type (a Java class, interface, or primitive type name).	
  +A formal component parameter has a unique name, and may be optional or required.  Optional parameters
  +may have a default value.
   The &spec.parameter; component specification element is used to define formal component parameters.
   </p>
   
  @@ -339,18 +340,20 @@
   </p>
   
   <source><![CDATA[
  -  <parameter name="title" default-value="Link to current thread"/>]]>
  +  <parameter name="title" default-binding="literal" default-value="Link to current thread"/>]]>
   </source>
   
   
   <p>
  +Using a default-binding of "literal" means that, by default, bindings for the parameter (including
  +the default-value), will be interpreted as literal strings. This can always be overriden using a binding prefix.
   Of course, the best practice for this type of example, where the value is a string that will be presented 
   to the user, is to store the message in the component's message catalog, and access it from there.  Default
   values are actually converted into bindings, and the value may be prefixed as with a binding:
   </p>
   
   <source><![CDATA[
  -  <parameter name="title" default-value="message:link-title"/>]]>  
  +  <parameter name="title" default-binding="literal" default-value="message:link-title"/>]]>  
   </source>
   
   <source>
  @@ -424,6 +427,36 @@
     . . .
   }
   </source>
  +
  +<p>
  +When Tapestry enhances a class to add a component property, it (by default) caches the value of the binding for the duration of the component's render.
  +That is, while a component is rendering, it will (at most) use the parameter's binding once, and store the result internally, clearing the cached value
  +as the component finishes rendering.  The parameter property <em>can be accessed when the component is not rendering</em> (an important improvement 
  +from Tapestry 3.0), the result simply is not cached (each access to the property when the component is not rendering is another access via the
  +binding object).
  +</p>
  +
  +<p>
  +This caching behavior is not always desired; in some cases, the component operates best with caching disabled. The &spec.parameter; element's
  +cache parameter can be set to "false" to defeat this caching.
  +</p>
  +
  +
  +<p>
  +However, for the majority of binding types (most types except for "ognl"), the value obtained is invariant ... it will always be the same value. Values
  +obtained from invariant bindings are <em>always</em> cached <em>indefinately</em> (not just for the component's render). In other words, literal string values,
  +localized messages and so forth are accessed via the binding just once.
  +</p>
  +
  +<p>
  +On the other hand, <em>informal parameters</em> are not cached at all; the values for such parameters are always re-obtained from the
  +binding object on each use.
  +</p>
  +
  +<note>
  +When using 3.0 DTDs with Tapestry 4.0, parameters with direction "auto" are <em>not cached</em>.  Other direction types (or no direction
  +specified) are cached. There is no real support for direction "custom" in 4.0 ... all parameters will be realized as parameter properties.
  +</note>
       
   </section> <!-- components.parameters -->
   
  
  
  
  1.9       +17 -2     jakarta-tapestry/framework/src/java/org/apache/tapestry/spec/ParameterSpecification.java
  
  Index: ParameterSpecification.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/java/org/apache/tapestry/spec/ParameterSpecification.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- ParameterSpecification.java	18 Apr 2005 17:06:40 -0000	1.8
  +++ ParameterSpecification.java	2 May 2005 14:18:37 -0000	1.9
  @@ -43,6 +43,9 @@
       /** @since 4.0 */
       private String _defaultBindingType;
   
  +    /** @since 4.0 */
  +    private boolean _cache = true;
  +
       /**
        * Returns the class name of the expected type of the parameter. The default value is
        * <code>java.lang.Object</code> which matches anything.
  @@ -134,15 +137,27 @@
           _defaultValue = defaultValue;
       }
   
  -    /** @since 1.1 */
  +    /** @since 4.0 */
       public String getDefaultBindingType()
       {
           return _defaultBindingType;
       }
   
  -    /** @since 1.1 */
  +    /** @since 4.0 */
       public void setDefaultBindingType(String defaultBindingType)
       {
           _defaultBindingType = defaultBindingType;
       }
  +
  +    /** @since 4.0 */
  +    public boolean getCache()
  +    {
  +        return _cache;
  +    }
  +
  +    /** @since 4.0 */
  +    public void setCache(boolean cache)
  +    {
  +        _cache = cache;
  +    }
   }
  \ No newline at end of file
  
  
  
  1.7       +13 -0     jakarta-tapestry/framework/src/java/org/apache/tapestry/spec/IParameterSpecification.java
  
  Index: IParameterSpecification.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/java/org/apache/tapestry/spec/IParameterSpecification.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- IParameterSpecification.java	18 Apr 2005 17:06:40 -0000	1.6
  +++ IParameterSpecification.java	2 May 2005 14:18:37 -0000	1.7
  @@ -95,6 +95,19 @@
   
       public void setDefaultBindingType(String bindingType);
   
  +    /** @since 4.0 */
       public String getDefaultBindingType();
   
  +    /**
  +     * Returns true if the parameter proeprty should cache the result of the binding.
  +     * 
  +     * @since 4.0
  +     */
  +
  +    public boolean getCache();
  +
  +    /** @since 4.0 */
  +
  +    public void setCache(boolean cache);
  +
   }
  \ No newline at end of file
  
  
  
  1.4       +22 -29    jakarta-tapestry/framework/src/java/org/apache/tapestry/valid/RenderString.java
  
  Index: RenderString.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/java/org/apache/tapestry/valid/RenderString.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- RenderString.java	6 Jan 2005 02:17:23 -0000	1.3
  +++ RenderString.java	2 May 2005 14:18:37 -0000	1.4
  @@ -14,23 +14,21 @@
   
   package org.apache.tapestry.valid;
   
  -import org.apache.commons.lang.builder.ToStringBuilder;
   import org.apache.tapestry.IMarkupWriter;
   import org.apache.tapestry.IRender;
   import org.apache.tapestry.IRequestCycle;
   
   /**
  - *  A wrapper around {@link String} that allows the String to
  - *  be renderred.  This is primarily used to present
  - *  error messages.
  - *
  - *  @author Howard Lewis Ship
  - *
  - **/
  + * A wrapper around {@link String}that allows the String to be renderred. This is primarily used to
  + * present error messages.
  + * 
  + * @author Howard Lewis Ship
  + */
   
   public class RenderString implements IRender
   {
       private String _string;
  +
       private boolean _raw = false;
   
       public RenderString(String string)
  @@ -39,11 +37,12 @@
       }
   
       /**
  -     *  @param string the string to render
  -     *  @param raw if true, the String is rendered as-is, with no filtering.
  -     *  If false (the default), the String is filtered.
  -     *
  -     **/
  +     * @param string
  +     *            the string to render
  +     * @param raw
  +     *            if true, the String is rendered as-is, with no filtering. If false (the default),
  +     *            the String is filtered.
  +     */
   
       public RenderString(String string, boolean raw)
       {
  @@ -52,22 +51,16 @@
       }
   
       /**
  -     *  Renders the String to the writer.  Does nothing if the string is null.
  -     *  If raw is true, uses {@link IMarkupWriter#printRaw(String)}, otherwise
  -     *  {@link IMarkupWriter#print(String)}.
  -     * 
  -     *
  -     **/
  +     * Renders the String to the writer. Does nothing if the string is null. If raw is true, uses
  +     * {@link IMarkupWriter#printRaw(String)}, otherwise {@link IMarkupWriter#print(String)}.
  +     */
   
       public void render(IMarkupWriter writer, IRequestCycle cycle)
       {
           if (_string == null)
               return;
   
  -        if (_raw)
  -            writer.printRaw(_string);
  -        else
  -            writer.print(_string);
  +        writer.print(_string, _raw);
       }
   
       public String getString()
  @@ -80,12 +73,12 @@
           return _raw;
       }
   
  +    /**
  +     * Returns the string that would be rendered.
  +     */
  +
       public String toString()
       {
  -        ToStringBuilder builder = new ToStringBuilder(this);
  -        builder.append("string", _string);
  -        builder.append("raw", _raw);
  -
  -        return builder.toString();
  +        return _string;
       }
  -}
  +}
  \ No newline at end of file
  
  
  
  1.4       +26 -18    jakarta-tapestry/framework/src/java/org/apache/tapestry/valid/ValidatorException.java
  
  Index: ValidatorException.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/java/org/apache/tapestry/valid/ValidatorException.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ValidatorException.java	6 Jan 2005 02:17:23 -0000	1.3
  +++ ValidatorException.java	2 May 2005 14:18:37 -0000	1.4
  @@ -17,16 +17,16 @@
   import org.apache.tapestry.IRender;
   
   /**
  - *  Thrown by a {@link IValidator} when submitted input is not valid.
  - *
  - *  @author Howard Lewis Ship
  - *  @since 1.0.8
  - *
  - **/
  + * Thrown by a {@link IValidator}when submitted input is not valid.
  + * 
  + * @author Howard Lewis Ship
  + * @since 1.0.8
  + */
   
   public class ValidatorException extends Exception
   {
       private IRender _errorRenderer;
  +
       private ValidationConstraint _constraint;
   
       public ValidatorException(String errorMessage)
  @@ -40,19 +40,23 @@
       }
   
       /**
  -     *  Creates a new instance.
  -     *  @param errorMessage the default error message to be used (this may be
  -     *  overriden by the {@link IValidationDelegate})
  -     *  @param errorRenderer to use to render the error message (may be null)
  -     *  @param constraint a validation constraint that has been compromised, or
  -     *  null if no constraint is applicable
  +     * Creates a new instance.
        * 
  -     **/
  +     * @param errorMessage
  +     *            the default error message to be used (this may be overriden by the
  +     *            {@link IValidationDelegate})
  +     * @param errorRenderer
  +     *            to use to render the error message (may be null). This is used with custom
  +     *            validators that create renderers that produce rich markup (such as icons or links
  +     *            to help pages). Such renderes are expected to implement a <code>toString()</code>
  +     *            that returns a simple error message (without any markup).
  +     * @param constraint
  +     *            a validation constraint that has been compromised, or null if no constraint is
  +     *            applicable
  +     */
   
  -    public ValidatorException(
  -        String errorMessage,
  -        IRender errorRenderer,
  -        ValidationConstraint constraint)
  +    public ValidatorException(String errorMessage, IRender errorRenderer,
  +            ValidationConstraint constraint)
       {
           super(errorMessage);
   
  @@ -65,7 +69,11 @@
           return _constraint;
       }
   
  -    /** @since 3.0 **/
  +    /**
  +     * Returns the error renderer for this exception, which may be null.
  +     * 
  +     * @since 3.0 *
  +     */
   
       public IRender getErrorRenderer()
       {
  
  
  
  1.5       +14 -19    jakarta-tapestry/framework/src/java/org/apache/tapestry/valid/FieldLabel.java
  
  Index: FieldLabel.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/java/org/apache/tapestry/valid/FieldLabel.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- FieldLabel.java	25 Mar 2005 21:18:38 -0000	1.4
  +++ FieldLabel.java	2 May 2005 14:18:37 -0000	1.5
  @@ -17,35 +17,30 @@
   import org.apache.hivemind.ApplicationRuntimeException;
   import org.apache.tapestry.AbstractComponent;
   import org.apache.tapestry.BindingException;
  +import org.apache.tapestry.FormSupport;
   import org.apache.tapestry.IForm;
   import org.apache.tapestry.IMarkupWriter;
   import org.apache.tapestry.IRequestCycle;
   import org.apache.tapestry.Tapestry;
  +import org.apache.tapestry.TapestryUtils;
   import org.apache.tapestry.form.Form;
   import org.apache.tapestry.form.IFormComponent;
   
   /**
  - *  Used to label an {@link IFormComponent}.  Because such fields
  - *  know their displayName (user-presentable name), there's no reason
  - *  to hard code the label in a page's HTML template (this also helps
  - *  with localization).
  - *
  - *  [<a href="../../../../../ComponentReference/FieldLabel.html">Component Reference</a>]
  -
  - *
  - *  @author Howard Lewis Lewis Ship
  + * Used to label an {@link IFormComponent}. Because such fields know their displayName
  + * (user-presentable name), there's no reason to hard code the label in a page's HTML template (this
  + * also helps with localization). [ <a
  + * href="../../../../../ComponentReference/FieldLabel.html">Component Reference </a>]
    * 
  - **/
  + * @author Howard Lewis Lewis Ship
  + */
   
   public abstract class FieldLabel extends AbstractComponent
   {
       /**
  -    *  Gets the {@link IFormComponent}
  -    *  and {@link IValidationDelegate delegate},
  -    *  then renders the label obtained from the field.  Does nothing
  -    *  when rewinding.
  -    *
  -    **/
  +     * Gets the {@link IFormComponent}and {@link IValidationDelegate delegate}, then renders the
  +     * label obtained from the field. Does nothing when rewinding.
  +     */
   
       protected void renderComponent(IMarkupWriter writer, IRequestCycle cycle)
       {
  @@ -83,8 +78,8 @@
   
           if (delegate == null)
           {
  -            String msg =
  -                Tapestry.format("FieldLabel.no-delegate", getExtendedId(), form.getExtendedId());
  +            String msg = Tapestry.format("FieldLabel.no-delegate", getExtendedId(), form
  +                    .getExtendedId());
   
               throw new ApplicationRuntimeException(msg, this, null, null);
           }
  @@ -101,4 +96,4 @@
       public abstract IFormComponent getField();
   
       public abstract boolean getRaw();
  -}
  +}
  \ No newline at end of file
  
  
  
  1.5       +3 -1      jakarta-tapestry/framework/src/java/org/apache/tapestry/valid/IFieldTracking.java
  
  Index: IFieldTracking.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/java/org/apache/tapestry/valid/IFieldTracking.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- IFieldTracking.java	30 Apr 2005 15:06:47 -0000	1.4
  +++ IFieldTracking.java	2 May 2005 14:18:37 -0000	1.5
  @@ -50,8 +50,10 @@
       public IFormComponent getComponent();
   
       /**
  -     * Returns an object that will render the error message.
  +     * Returns an object that will render the error message. The renderer <em>must</em> implement
  +     * a simple <code>toString()</code> that does not produce markup, but is a simple message.
        * 
  +     * @see ValidatorException#ValidatorException(String, IRender, ValidationConstraint)
        * @since 1.0.9
        */
   
  
  
  
  1.5       +1 -0      jakarta-tapestry/framework/src/test/org/apache/tapestry/junit/parse/Parameter.jwc
  
  Index: Parameter.jwc
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/test/org/apache/tapestry/junit/parse/Parameter.jwc,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- Parameter.jwc	18 Apr 2005 17:07:52 -0000	1.4
  +++ Parameter.jwc	2 May 2005 14:18:37 -0000	1.5
  @@ -25,6 +25,7 @@
       <parameter name="literalDefault" default-value="literal-value"/>
       <parameter name="expressionDefault" default-value="ognl:an.expression"/>
       <parameter name="defaultBindingType" default-binding="ognl"/>
  +    <parameter name="noCache" cache="false"/>
       
   </component-specification>
   
  
  
  
  1.3       +3 -0      jakarta-tapestry/framework/src/test/org/apache/tapestry/junit/parse/Parameter_3_0.jwc
  
  Index: Parameter_3_0.jwc
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/test/org/apache/tapestry/junit/parse/Parameter_3_0.jwc,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Parameter_3_0.jwc	5 Jan 2005 23:17:15 -0000	1.2
  +++ Parameter_3_0.jwc	2 May 2005 14:18:37 -0000	1.3
  @@ -30,5 +30,8 @@
       </parameter>
       <parameter name="altName" property-name="altNameParameter"/>
       
  +    <parameter name="directionIn" direction="in"/>
  +    <parameter name="directionAuto" direction="auto"/>
  +    
   </component-specification>
   
  
  
  
  1.14      +12 -2     jakarta-tapestry/framework/src/test/org/apache/tapestry/junit/parse/TestSpecificationParser.java
  
  Index: TestSpecificationParser.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/test/org/apache/tapestry/junit/parse/TestSpecificationParser.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- TestSpecificationParser.java	18 Apr 2005 17:07:52 -0000	1.13
  +++ TestSpecificationParser.java	2 May 2005 14:18:37 -0000	1.14
  @@ -999,6 +999,12 @@
   
           ps = spec.getParameter("altName");
           assertEquals("altNameParameter", ps.getPropertyName());
  +
  +        ps = spec.getParameter("directionIn");
  +        assertEquals(true, ps.getCache());
  +
  +        ps = spec.getParameter("directionAuto");
  +        assertEquals(false, ps.getCache());
       }
   
       /**
  @@ -1008,7 +1014,7 @@
        * @since 4.0
        */
   
  -    public void testParameters() throws Exception
  +    public void testParameter() throws Exception
       {
           IComponentSpecification spec = parseComponent("Parameter.jwc");
   
  @@ -1016,6 +1022,7 @@
   
           assertNull(ps.getDefaultValue());
           assertNull(ps.getDefaultBindingType());
  +        assertEquals(true, ps.getCache());
   
           ps = spec.getParameter("literalDefault");
   
  @@ -1026,8 +1033,11 @@
           assertEquals("ognl:an.expression", ps.getDefaultValue());
   
           ps = spec.getParameter("defaultBindingType");
  -        
  +
           assertEquals("ognl", ps.getDefaultBindingType());
  +
  +        ps = spec.getParameter("noCache");
  +        assertEquals(false, ps.getCache());
       }
   
       /**
  
  
  
  1.11      +3 -1      jakarta-tapestry/framework/src/java/org/apache/tapestry/IComponent.java
  
  Index: IComponent.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/java/org/apache/tapestry/IComponent.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- IComponent.java	18 Apr 2005 17:06:42 -0000	1.10
  +++ IComponent.java	2 May 2005 14:18:37 -0000	1.11
  @@ -133,7 +133,9 @@
   
       /**
        * Returns a string identifying the name of the page and the id path of the reciever within the
  -     * page. Pages simply return their name.
  +     * page (seperated by a slash). Note that this extended id is indetned primarily for identifying
  +     * the component to the user (since slashes are legal characters within page names). Pages
  +     * simply return their name.
        * 
        * @see #getIdPath()
        */
  
  
  
  1.10      +45 -1     jakarta-tapestry/framework/src/test/org/apache/tapestry/enhance/TestParameterPropertyWorker.java
  
  Index: TestParameterPropertyWorker.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/test/org/apache/tapestry/enhance/TestParameterPropertyWorker.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- TestParameterPropertyWorker.java	7 Feb 2005 17:50:27 -0000	1.9
  +++ TestParameterPropertyWorker.java	2 May 2005 14:18:37 -0000	1.10
  @@ -340,7 +340,51 @@
                   boolean.class,
                   "_$fred",
                   "_$fred$Default",
  -                "_$fred$Cached");
  +                "_$fred$Cached",
  +                true);
  +
  +        verifyControls();
  +    }
  +
  +    public void testParameterCacheDisabled()
  +    {
  +        MockControl opc = newControl(EnhancementOperation.class);
  +        EnhancementOperation op = (EnhancementOperation) opc.getMock();
  +
  +        BodyBuilder builder = new BodyBuilder();
  +        builder.begin();
  +        builder.addln("if (_$fred$Cached) return _$fred;");
  +        builder.addln("org.apache.tapestry.IBinding binding = getBinding(\"barney\");");
  +        builder.addln("if (binding == null) return _$fred$Default;");
  +        builder.add("boolean result = ");
  +        builder.addln(EnhanceUtils.class.getName() + ".toBoolean(binding);");
  +        builder.addln("if (binding.isInvariant())");
  +        builder.begin();
  +        builder.addln("_$fred = result;");
  +        builder.addln("_$fred$Cached = true;");
  +        builder.end();
  +        builder.addln("return result;");
  +        builder.end();
  +
  +        op.getAccessorMethodName("fred");
  +        opc.setReturnValue("isFred");
  +
  +        op.addMethod(
  +                Modifier.PUBLIC,
  +                new MethodSignature(boolean.class, "isFred", null, null),
  +                builder.toString());
  +
  +        replayControls();
  +
  +        new ParameterPropertyWorker().buildAccessor(
  +                op,
  +                "barney",
  +                "fred",
  +                boolean.class,
  +                "_$fred",
  +                "_$fred$Default",
  +                "_$fred$Cached",
  +                false);
   
           verifyControls();
       }
  
  
  
  1.25      +11 -0     jakarta-tapestry/framework/src/java/org/apache/tapestry/parse/SpecificationParser.java
  
  Index: SpecificationParser.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/java/org/apache/tapestry/parse/SpecificationParser.java,v
  retrieving revision 1.24
  retrieving revision 1.25
  diff -u -r1.24 -r1.25
  --- SpecificationParser.java	18 Apr 2005 17:06:43 -0000	1.24
  +++ SpecificationParser.java	2 May 2005 14:18:37 -0000	1.25
  @@ -1321,6 +1321,17 @@
   
           ps.setDefaultBindingType(getAttribute("default-binding"));
   
  +        if (!_DTD_4_0)
  +        {
  +            String direction = getAttribute("direction");
  +            ps.setCache(!"auto".equals(direction));
  +        }
  +        else
  +        {
  +            boolean cache = getBooleanAttribute("cache", true);
  +            ps.setCache(cache);
  +        }
  +
           // type will only be specified in a 3.0 DTD.
   
           String type = getAttribute("type");
  
  
  
  1.2       +9 -4      jakarta-tapestry/framework/src/java/org/apache/tapestry/parse/Tapestry_4_0.dtd
  
  Index: Tapestry_4_0.dtd
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/java/org/apache/tapestry/parse/Tapestry_4_0.dtd,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Tapestry_4_0.dtd	18 Apr 2005 17:06:43 -0000	1.1
  +++ Tapestry_4_0.dtd	2 May 2005 14:18:37 -0000	1.2
  @@ -35,14 +35,14 @@
   - <property> persistent attribute is now called "persist", and is a string, not a boolean
   - Added <inject>
   - Removed the direction and type attributes from <parameter>
  -- Consoliated <context-asset>, <private-asset> and <external-asset> into <asset>
  +- Consolidated <context-asset>, <private-asset> and <external-asset> into <asset>
   - Consolidated <set-property> and <set-message-property> into <set>
   - More flexibility on the order of elements
   - Added <inject-state>
   - Added property attribute to <component>, <bean> and <asset>
   - Removed the type attribute from the <configure> element
  -- Add many alternatives to 'yes' and 'no' for boolean attributes.
  -- Add default-binding attribute to <parameter>
  +- Added many alternatives to 'yes' and 'no' for boolean attributes.
  +- Added default-binding and cache attributes to <parameter>
   -->
   <!-- =======================================================
   Entity: attribute-flag
  @@ -407,9 +407,13 @@
       then the parameter is optional.
     property-name: The name to use, instead of the parameter name, for the
       JavaBean property connected to this parameter.
  -  default-value: Specifies the default value for the parameter, if not bound.
  +  default-value: Specifies the default value for the parameter, if not bound,
  +  as a binding reference.
     default-binding: The default binding type for parameters (when a binding
      is specified without a parameter). 
  +  cache: If true (the default), then the parameter property will cache the binding value
  +  If false, then each access to the property will re-acquire the the current value
  +  for the binding on each access (though invariant bindings may still be cached).
   -->
   <!ELEMENT parameter (description?)>
   <!ATTLIST parameter
  @@ -418,6 +422,7 @@
   	property-name CDATA #IMPLIED
   	default-value CDATA #IMPLIED
     default-binding CDATA #IMPLIED
  +  cache %attribute-flag; "yes"
   >
   <!-- =======================================================
   Element: property
  
  
  
  1.7       +1 -1      jakarta-tapestry/contrib/src/java/org/apache/tapestry/contrib/table/components/TableColumns.jwc
  
  Index: TableColumns.jwc
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/contrib/src/java/org/apache/tapestry/contrib/table/components/TableColumns.jwc,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- TableColumns.jwc	18 Apr 2005 17:08:19 -0000	1.6
  +++ TableColumns.jwc	2 May 2005 14:18:37 -0000	1.7
  @@ -31,7 +31,7 @@
           <description>The column currently being rendered [out]</description>
       </parameter>
   
  -	<parameter name="element" default-value="th">
  +	<parameter name="element" default-value="literal:th">
           <description>The tag to use to wrap the column headers.</description>
       </parameter>
   
  
  
  
  1.7       +1 -1      jakarta-tapestry/contrib/src/java/org/apache/tapestry/contrib/table/components/TableValues.jwc
  
  Index: TableValues.jwc
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/contrib/src/java/org/apache/tapestry/contrib/table/components/TableValues.jwc,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- TableValues.jwc	18 Apr 2005 17:08:19 -0000	1.6
  +++ TableValues.jwc	2 May 2005 14:18:37 -0000	1.7
  @@ -32,7 +32,7 @@
           <description>The current column being rendered</description>
       </parameter>
   
  -	<parameter name="element" default-value="td">
  +	<parameter name="element" default-value="literal:td">
           <description>The tag to use to wrap the values in, 'td' by default.</description>
       </parameter>
   
  
  
  
  1.13      +12 -7     jakarta-tapestry/framework/src/java/org/apache/tapestry/enhance/ParameterPropertyWorker.java
  
  Index: ParameterPropertyWorker.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/java/org/apache/tapestry/enhance/ParameterPropertyWorker.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- ParameterPropertyWorker.java	18 Apr 2005 17:06:34 -0000	1.12
  +++ ParameterPropertyWorker.java	2 May 2005 14:18:38 -0000	1.13
  @@ -94,7 +94,8 @@
                   propertyType,
                   fieldName,
                   defaultFieldName,
  -                cachedFieldName);
  +                cachedFieldName,
  +                ps.getCache());
   
           buildMutator(
                   op,
  @@ -205,7 +206,8 @@
       // Package private for testing
   
       void buildAccessor(EnhancementOperation op, String parameterName, String propertyName,
  -            Class propertyType, String fieldName, String defaultFieldName, String cachedFieldName)
  +            Class propertyType, String fieldName, String defaultFieldName, String cachedFieldName,
  +            boolean cache)
       {
           BodyBuilder builder = new BodyBuilder();
           builder.begin();
  @@ -218,17 +220,20 @@
   
           String javaTypeName = ClassFabUtils.getJavaClassName(propertyType);
   
  -        builder.addln("{0} result = {1};", javaTypeName, 
  -                EnhanceUtils.createUnwrapExpression(
  +        builder.addln("{0} result = {1};", javaTypeName, EnhanceUtils.createUnwrapExpression(
                   op,
                   "binding",
                   propertyType));
   
           // Values read via the binding are cached during the render of
  -        // the component, or when the binding is invariant
  -        // (such as a StringBinding or MessageBinding).
  +        // the component (if the parameter defines cache to be true, which
  +        // is the default), or any time the binding is invariant
  +        // (such as most bindings besides ExpressionBinding.
  +
  +        String expression = cache ? "isRendering() || binding.isInvariant()"
  +                : "binding.isInvariant()";
   
  -        builder.addln("if (isRendering() || binding.isInvariant())");
  +        builder.addln("if ({0})", expression);
           builder.begin();
           builder.addln("{0} = result;", fieldName);
           builder.addln("{0} = true;", cachedFieldName);
  
  
  
  1.5       +11 -11    jakarta-tapestry/framework/src/java/org/apache/tapestry/util/io/ComponentAddressAdaptor.java
  
  Index: ComponentAddressAdaptor.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/java/org/apache/tapestry/util/io/ComponentAddressAdaptor.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- ComponentAddressAdaptor.java	6 Jan 2005 02:17:14 -0000	1.4
  +++ ComponentAddressAdaptor.java	2 May 2005 14:18:38 -0000	1.5
  @@ -21,18 +21,18 @@
   import org.apache.tapestry.util.ComponentAddress;
   
   /**
  - *  Squeezes a org.apache.tapestry.ComponentAddress.
  + * Squeezes a org.apache.tapestry.ComponentAddress.
    * 
  - *  @author mindbridge
  - *  @since 2.2
  - * 
  - **/
  + * @author mindbridge
  + * @since 2.2
  + */
   
   public class ComponentAddressAdaptor implements ISqueezeAdaptor
   {
       private static final String PREFIX = "A";
  -    private static final char SEPARATOR = '/';
  -    
  +
  +    private static final char SEPARATOR = ',';
  +
       public String squeeze(DataSqueezer squeezer, Object data) throws IOException
       {
           ComponentAddress address = (ComponentAddress) data;
  @@ -40,7 +40,7 @@
           // a 'null' id path is encoded as an empty string
           String idPath = address.getIdPath();
           if (idPath == null)
  -        	idPath = "";
  +            idPath = "";
   
           return PREFIX + address.getPageName() + SEPARATOR + idPath;
       }
  @@ -48,13 +48,13 @@
       public Object unsqueeze(DataSqueezer squeezer, String string) throws IOException
       {
           int separator = string.indexOf(SEPARATOR);
  -        if (separator < 0) 
  +        if (separator < 0)
               throw new IOException(Tapestry.getMessage("ComponentAddressAdaptor.no-separator"));
   
           String pageName = string.substring(1, separator);
           String idPath = string.substring(separator + 1);
           if (idPath.equals(""))
  -        	idPath = null;
  +            idPath = null;
   
           return new ComponentAddress(pageName, idPath);
       }
  @@ -64,4 +64,4 @@
           squeezer.register(PREFIX, ComponentAddress.class, this);
       }
   
  -}
  +}
  \ No newline at end of file
  
  
  
  1.27      +1 -0      jakarta-tapestry/src/documentation/content/xdocs/site.xml
  
  Index: site.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/src/documentation/content/xdocs/site.xml,v
  retrieving revision 1.26
  retrieving revision 1.27
  diff -u -r1.26 -r1.27
  --- site.xml	13 Apr 2005 22:38:46 -0000	1.26
  +++ site.xml	2 May 2005 14:18:38 -0000	1.27
  @@ -134,6 +134,7 @@
       
       <project label="Project">
           <item label="Mailing Lists"     href="http://jakarta.apache.org/site/mail2.html#tapestry"/>
  +        <item label="Forums"            href="http://www.tapestryforums.com/"/>
           <item label="Bug Database"     href="http://issues.apache.org/jira/secure/BrowseProject.jspa?id=10573"/>
           <item label="CVS Access"      href="cvs.html"/>    
           <item label="Downloads" href="downloads.html"/>
  
  
  
  1.8       +2 -2      jakarta-tapestry/src/documentation/content/xdocs/index.xml
  
  Index: index.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/src/documentation/content/xdocs/index.xml,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- index.xml	18 Apr 2005 17:09:04 -0000	1.7
  +++ index.xml	2 May 2005 14:18:38 -0000	1.8
  @@ -82,9 +82,9 @@
     <title>Status</title>
     
   <p>
  -Work has begun on Tapestry 4.0, which is currently in an early alpha stage.  Documentation is being converted
  +Work has begun on Tapestry 4.0, which is currently in a late alpha stage.  Documentation is being converted
   from the old DocBook format, to the new Forrest format, leaving many temporary gaps. Only the framework and the contrib
  -library is being built, example code is not.
  +library is being built, most example code is not.
   </p>
   
   <p>
  
  
  
  1.4       +43 -33    jakarta-tapestry/framework/src/java/org/apache/tapestry/util/ComponentAddress.java
  
  Index: ComponentAddress.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/java/org/apache/tapestry/util/ComponentAddress.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ComponentAddress.java	6 Jan 2005 02:17:20 -0000	1.3
  +++ ComponentAddress.java	2 May 2005 14:18:38 -0000	1.4
  @@ -16,38 +16,38 @@
   
   import java.io.Serializable;
   
  +import org.apache.hivemind.util.Defense;
   import org.apache.tapestry.IComponent;
   import org.apache.tapestry.INamespace;
   import org.apache.tapestry.IPage;
   import org.apache.tapestry.IRequestCycle;
   
   /**
  - * The ComponentAddress class contains the path to a component, allowing it to  
  - * locate an instance of that component in a different 
  - * {@link org.apache.tapestry.IRequestCycle}.
  - * 
  - * <p>This class needs to be used mostly when working with components
  - * accessed via the {@link org.apache.tapestry.IRender} interface. 
  - * It allows those components to serialize and
  - * pass as a service parameter information about what component they have to 
  - * talk to if control returns back to them. 
  - * 
  - * <p>This situation often occurs when the component used via IRender contains
  - * Direct or Action links.
  + * The ComponentAddress class contains the path to a component, allowing it to locate an instance of
  + * that component in a different {@link org.apache.tapestry.IRequestCycle}.
  + * <p>
  + * This class needs to be used mostly when working with components accessed via the
  + * {@link org.apache.tapestry.IRender}interface. It allows those components to serialize and pass
  + * as a service parameter information about what component they have to talk to if control returns
  + * back to them.
  + * <p>
  + * This situation often occurs when the component used via IRender contains Direct or Action links.
    * 
    * @author mindbridge
    * @since 2.2
  - * 
    */
   public class ComponentAddress implements Serializable
   {
       private String _pageName;
  +
       private String _idPath;
   
       /**
  -     * Creates a new ComponentAddress object that carries the identification 
  -     * information of the given component (the page name and the ID path).
  -     * @param component the component to get the address of
  +     * Creates a new ComponentAddress object that carries the identification information of the
  +     * given component (the page name and the ID path).
  +     * 
  +     * @param component
  +     *            the component to get the address of
        */
       public ComponentAddress(IComponent component)
       {
  @@ -56,33 +56,41 @@
   
       /**
        * Creates a new ComponentAddress using the given Page Name and ID Path
  -     * @param pageName the name of the page that contains the component
  -     * @param idPath the ID Path of the component
  +     * 
  +     * @param pageName
  +     *            the name of the page that contains the component
  +     * @param idPath
  +     *            the ID Path of the component (which may be null)
        */
       public ComponentAddress(String pageName, String idPath)
       {
  +        Defense.notNull(pageName, "pageName");
  +
           _pageName = pageName;
           _idPath = idPath;
       }
   
       /**
  -     * Creates a new ComponentAddress using the given Page Name and ID Path
  -     * relative on the provided Namespace
  -     * @param namespace the namespace of the page that contains the component
  -     * @param pageName the name of the page that contains the component
  -     * @param idPath the ID Path of the component
  -     */
  -    public ComponentAddress(
  -        INamespace namespace,
  -        String pageName,
  -        String idPath)
  +     * Creates a new ComponentAddress using the given Page Name and ID Path relative on the provided
  +     * Namespace
  +     * 
  +     * @param namespace
  +     *            the namespace of the page that contains the component
  +     * @param pageName
  +     *            the name of the page that contains the component
  +     * @param idPath
  +     *            the ID Path of the component
  +     */
  +    public ComponentAddress(INamespace namespace, String pageName, String idPath)
       {
           this(namespace.constructQualifiedName(pageName), idPath);
       }
   
       /**
        * Finds a component with the current address using the given RequestCycle.
  -     * @param cycle the RequestCycle to use to locate the component
  +     * 
  +     * @param cycle
  +     *            the RequestCycle to use to locate the component
        * @return IComponent a component that has been initialized for the given RequestCycle
        */
       public IComponent findComponent(IRequestCycle cycle)
  @@ -93,7 +101,9 @@
   
       /**
        * Returns the idPath of the component.
  -     * @return String the ID path of the component
  +     * 
  +     * @return String the ID path of the component, or null if the address references a page, not a
  +     *         component within a page.
        */
       public String getIdPath()
       {
  @@ -102,6 +112,7 @@
   
       /**
        * Returns the Page Name of the component.
  +     * 
        * @return String the Page Name of the component
        */
       public String getPageName()
  @@ -137,8 +148,7 @@
   
           String idPath1 = getIdPath();
           String idPath2 = objAddress.getIdPath();
  -        return (idPath1 == idPath2)
  -            || (idPath1 != null && idPath1.equals(idPath2));
  +        return (idPath1 == idPath2) || (idPath1 != null && idPath1.equals(idPath2));
       }
   
  -}
  +}
  \ No newline at end of file
  
  
  
  1.6       +2 -2      jakarta-tapestry/framework/src/test/org/apache/tapestry/junit/utils/TestDataSqueezer.java
  
  Index: TestDataSqueezer.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/test/org/apache/tapestry/junit/utils/TestDataSqueezer.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- TestDataSqueezer.java	27 Mar 2005 17:42:23 -0000	1.5
  +++ TestDataSqueezer.java	2 May 2005 14:18:38 -0000	1.6
  @@ -144,10 +144,10 @@
       {
           ComponentAddress objAddress = new ComponentAddress("framework:DirectLink",
                   "component.subcomponent");
  -        attempt(objAddress, "Aframework:DirectLink/component.subcomponent");
  +        attempt(objAddress, "Aframework:DirectLink,component.subcomponent");
   
           objAddress = new ComponentAddress("framework:DirectLink", null);
  -        attempt(objAddress, "Aframework:DirectLink/");
  +        attempt(objAddress, "Aframework:DirectLink,");
       }
   
       public void testArray() throws IOException
  
  
  
  1.10      +2 -0      jakarta-tapestry/framework/src/java/org/apache/tapestry/wml/Go.jwc
  
  Index: Go.jwc
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/java/org/apache/tapestry/wml/Go.jwc,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- Go.jwc	18 Apr 2005 17:06:44 -0000	1.9
  +++ Go.jwc	2 May 2005 14:18:38 -0000	1.10
  @@ -25,6 +25,8 @@
           The go element declares a go task, indicating navigation to a URI.
       </description>
   
  +    <bean name="defaultDelegate" class="org.apache.tapestry.valid.ValidationDelegate"/>
  +
       <parameter name="method" default-value="post" default-binding="literal">
           <description>
               The method used by the form when it is submitted, defaults to POST.
  
  
  
  1.10      +7 -2      jakarta-tapestry/framework/src/java/org/apache/tapestry/form/Form.jwc
  
  Index: Form.jwc
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/java/org/apache/tapestry/form/Form.jwc,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- Form.jwc	18 Apr 2005 17:06:41 -0000	1.9
  +++ Form.jwc	2 May 2005 14:18:38 -0000	1.10
  @@ -21,10 +21,14 @@
     
   <component-specification class="org.apache.tapestry.form.Form">
   
  +  <!-- Note: remember to keep Go.jwc synchronized with any changes here! -->  
  +    
     <description>
     Used to implement an HTML form.
     </description>
   
  +  <bean name="defaultDelegate" class="org.apache.tapestry.valid.ValidationDelegate"/>
  +  
     <parameter name="method" default-value="post" default-binding="literal">
       <description>
       The method used by the form when it is submitted, defaults to POST.
  @@ -53,9 +57,10 @@
       </description>
     </parameter>
     
  -  <parameter name="delegate" default-binding="ognl">
  +  <parameter name="delegate" default-binding="ognl" default-value="bean:defaultDelegate">
       <description>
  -    Specifies the delegate to be used by fields to track input errors.
  +    Specifies the delegate to be used by fields to track input errors. If not specified, the
  +        Form provides a default instance of org.apache.tapestry.valid.ValidationDelegate.
       </description>
     </parameter>
   
  
  
  

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