tapestry-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hls...@apache.org
Subject svn commit: r713455 - in /tapestry/tapestry5/trunk: src/site/apt/guide/ tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/ tapestry-core/src/main/java/org/apache/tapestry5/internal/services/ tapestry-core/src/main/java/org/apache/tape...
Date Wed, 12 Nov 2008 19:09:35 GMT
Author: hlship
Date: Wed Nov 12 11:09:24 2008
New Revision: 713455

URL: http://svn.apache.org/viewvc?rev=713455&view=rev
Log:
TAP5-112: Define new namespace, p:, for block parameters

Added:
    tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry5/internal/services/parameter_namespace_element.tml
    tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry5/internal/services/parameter_namespace_with_attributes.tml
Modified:
    tapestry/tapestry5/trunk/src/site/apt/guide/templates.apt
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/BeanDisplay.xdoc
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/BeanEditForm.java
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/BeanEditForm.xdoc
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Grid.xdoc
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/If.xdoc
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/PageLink.xdoc
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/PageLoaderProcessor.java
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/ServicesMessages.java
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/TemplateParserImpl.java
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/structure/BlockImpl.java
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/structure/InternalComponentResourcesImpl.java
    tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/corelib/pages/ExceptionReport.tml
    tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/corelib/pages/ServiceStatus.tml
    tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/internal/services/ServicesStrings.properties
    tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/TemplateParserImplTest.java

Modified: tapestry/tapestry5/trunk/src/site/apt/guide/templates.apt
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/src/site/apt/guide/templates.apt?rev=713455&r1=713454&r2=713455&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/src/site/apt/guide/templates.apt (original)
+++ tapestry/tapestry5/trunk/src/site/apt/guide/templates.apt Wed Nov 12 11:09:24 2008
@@ -190,7 +190,7 @@
 
   Note that the id parameter is <not> placed in the Tapestry namespace (since the element
always <is> in the Tapestry namespace).
 
-* \<parameter\>
+* \<parameter\>             <(deprecated)>
 
   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
@@ -207,6 +207,9 @@
 </t:if>
 +---+
 
+  The parameter element has been deprecated (but is still fully supported, for backwards
compatibility). The name
+  <parameter namespace> is more concise and readable.
+
 
 Expansions
 
@@ -338,8 +341,34 @@
 
   Here, the loop component "merges into" the \<tr\> element.  It will render out a
\<tr\> for each item object in the items list.
   It will write a dynamic class attribute into each \<tr\>.
-        
-   
+
+Parameter Namespace
+
+  Parameter namespaces are a new feature introduced in Tapestry 5.1. They are a more concise
way of passing parameter blocks
+  to components.
+
+  You must define a special namespace, usually given the prefix "p":
+
+---
+<html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd" xmlns:p="tapestry:parameter">
+  . . .
+---
+
+  With the "tapestry:parameter" namespace defined, you can pass block using the "p:" prefix
and an element name
+  that matches the parameter name:
+
+----
+<t:if test="loggedIn">
+  Hello, ${userName}!
+  <p:else>
+    Click <a t:type="actionlink" t:id="login">here</a> to log in.
+  </p:else>
+</t:if>
+----  
+
+  Namespaced parameter elements are not allowed to have any attributes. The element name
itself is used to identify
+  the parameter of the component to bind.
+
 Whitespace in Templates
 
   Tapestry strips out unnecessary whitespace from templates as they are parsed.

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/BeanDisplay.xdoc
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/BeanDisplay.xdoc?rev=713455&r1=713454&r2=713455&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/BeanDisplay.xdoc
(original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/BeanDisplay.xdoc
Wed Nov 12 11:09:24 2008
@@ -87,14 +87,14 @@
 
             <subsection name="ViewUser.tml">
                 <source><![CDATA[
-<html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
+<html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd" xmlns:p="tapestry:parameter">
     <body>
         <h1>View User</h1>
 
         <t:beandisplay object="user">
-            <t:parameter name="lastname">
+            <p:lastName>
                 ${bean.lastname.toUpperCase()}
-            </t:parameter>
+            </p:lastName>
         </t:beandisplay>
     </body>
 </html>
@@ -102,7 +102,7 @@
 
                 <p>
                     The
-                    <code><![CDATA[<t:parameter>]]></code>
+                    <code><![CDATA[<p:lastName>]]></code>
                     element is an
                     <em>override</em>
                     for the property. The name is

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/BeanEditForm.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/BeanEditForm.java?rev=713455&r1=713454&r2=713455&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/BeanEditForm.java
(original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/BeanEditForm.java
Wed Nov 12 11:09:24 2008
@@ -32,9 +32,9 @@
  * annotation), and the order and validation for the properties determined from annotations
on the property's getter and
  * setter methods.
  * <p/>
- * You may add &lt;t:parameter&gt;s to the component; when the name matches (case
insensitive) the name of a property,
- * then the corresponding Block is renderered, rather than any of the built in property editor
blocks. This allows you
- * to override specific properties with your own customized UI, for cases where the default
UI is insufficient, or no
+ * You may add block parameters to the component; when the name matches (case insensitive)
the name of a property, then
+ * the corresponding Block is renderered, rather than any of the built in property editor
blocks. This allows you to
+ * override specific properties with your own customized UI, for cases where the default
UI is insufficient, or no
  * built-in editor type is appropriate.
  *
  * @see org.apache.tapestry5.beaneditor.BeanModel

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/BeanEditForm.xdoc
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/BeanEditForm.xdoc?rev=713455&r1=713454&r2=713455&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/BeanEditForm.xdoc
(original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/BeanEditForm.xdoc
Wed Nov 12 11:09:24 2008
@@ -76,7 +76,7 @@
             <subsection name="CreateUser.tml">
 
                 <source><![CDATA[
-<html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
+<html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd" xmlns:p="tapestry:parameter">
     <body>
         <h1>Create New User</h1>
 
@@ -264,18 +264,18 @@
 
                 <source><![CDATA[
         <t:beaneditform t:id="user" submitlabel="message:create-user">
-            <t:parameter name="age">
+            <p:age>
                 <t:label for="age"/>
                 <t:textfield t:id="age" value="user.age"/>
                 <em>
                     Users must be between 18 and 99.
                 </em>
-            </t:parameter>
+            </p:age>
         </t:beaneditform>]]></source>
 
                 <p>
                     The
-                    <code><![CDATA[<t:parameter>]]></code>
+                    <code><![CDATA[<p:age>]]></code>
                     element
                     is an
                     <em>override</em>

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Grid.xdoc
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Grid.xdoc?rev=713455&r1=713454&r2=713455&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Grid.xdoc
(original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Grid.xdoc
Wed Nov 12 11:09:24 2008
@@ -80,17 +80,17 @@
 
 
                 <source><![CDATA[
-<html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
+<html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd" xmlns:p="tapestry:parameter">
     <body>
         <h1>List Users</h1>
 
         <t:grid source="users" row="user">
-            <t:parameter name="lastnamecell">
+            <p:lastNameCell>
                 <t:pagelink page="user/view" context="user.id">${user.lastname}</t:pagelink>
-            </t:parameter>
-            <t:parameter name="empty">
+            </p:lastNameCell>
+            <p:empty>
               <p>There are no users to display; you can <t:pagelink page="user/add">add
some</a>.</p>
-            </t:parameter>
+            </p:empty>
         </t:grid>
     </body>
 </html>
@@ -98,7 +98,7 @@
 
 
                 <p>
-                    The parameter name
+                    The block parameter name
                     <code><em>property</em>cell
                     </code>
                     is used to override the rendering of cells for one property. As usual,
case is ignored. Here we
@@ -177,20 +177,20 @@
 
 
                 <source><![CDATA[
-<html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
+<html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd" xmlns:p="tapestry:parameter">
     <body>
         <h1>List Users</h1>
 
         <t:grid source="users" row="user" add="delete">
-            <t:parameter name="lastnamecell">
+            <p:lastnamecell>
                 <t:pagelink page="user/view" context="user.id">${user.lastname}</t:pagelink>
-            </t:parameter>
-            <t:parameter name="deletecell">
+            </p:lastnameCell>
+            <p:deletecell>
                 <t:actionlink t:id="delete" context="user.id">Delete</t:actionlink>
-            </t:parameter>
-            <t:parameter name="empty">
+            </p:deletecell>
+            <p:empty>
               <p>There are no users to display; you can <t:pagelink page="user/add">add
some</a>.</p>
-            </t:parameter>
+            </p:empty>
         </t:grid>
     </body>
 </html>

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/If.xdoc
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/If.xdoc?rev=713455&r1=713454&r2=713455&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/If.xdoc
(original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/If.xdoc
Wed Nov 12 11:09:24 2008
@@ -5,16 +5,16 @@
             <subsection name="Start.tml">
 
                 <source><![CDATA[
-<html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
+<html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd" xmlns:p="tapestry:parameter">
     <body>
         <h1>Welcome!</h1>
 
         <t:if test="user">
             Welcome back, ${user.firstName}
-            <t:parameter name="else">
+            <p:else>
                 <t:pagelink name="login">Login</t:pagelink> /
                 <t:pagelink name="register">Register</t:pagelink>
-            </t:parameter>
+            </p:else>
         </t:if>
         
         . . .

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/PageLink.xdoc
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/PageLink.xdoc?rev=713455&r1=713454&r2=713455&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/PageLink.xdoc
(original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/PageLink.xdoc
Wed Nov 12 11:09:24 2008
@@ -27,9 +27,9 @@
             <subsection name="UserList.html (partial)">
                 <source><![CDATA[
         <t:grid source="users" row="user" model="model">
-            <t:parameter name="lastnamecell">
+            <p:lastnamecell>
                 <t:pagelink page="user/view" context="user.id">${user.lastname}</t:pagelink>
-            </t:parameter>
+            </p:lastnamecell>
 
         </t:grid>]]></source>
             </subsection>

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/PageLoaderProcessor.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/PageLoaderProcessor.java?rev=713455&r1=713454&r2=713455&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/PageLoaderProcessor.java
(original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/PageLoaderProcessor.java
Wed Nov 12 11:09:24 2008
@@ -591,7 +591,7 @@
 
         Binding binding = new LiteralBinding("block parameter " + name, block, token.getLocation());
 
-        // TODO: Check that the t:parameter doesn't appear outside of an embedded component.
+        // TODO: Check that the parameter block doesn't appear outside of an embedded component.
 
         element.bindParameter(name, binding);
 
@@ -711,7 +711,7 @@
 
         // If the component was from an embedded @Component annotation, and it is inheritting
informal parameters,
         // and the component in question supports informal parameters, than get those inheritted
informal parameters ...
-        // but later (this helps ensure that <t:parameter> elements that may provide
informal parameters are
+        // but later (this helps ensure that block parameter elements that may provide informal
parameters are
         // visible when the informal parameters are copied to the child component).
 
         if (embeddedModel != null && embeddedModel.getInheritInformalParameters()
&& newComponentModel.getSupportsInformalParameters())

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/ServicesMessages.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/ServicesMessages.java?rev=713455&r1=713454&r2=713455&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/ServicesMessages.java
(original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/ServicesMessages.java
Wed Nov 12 11:09:24 2008
@@ -427,4 +427,9 @@
     {
         return MESSAGES.format("add-new-method-conflict", signature);
     }
+
+    static String parameterElementDoesNotAllowAttributes()
+    {
+        return MESSAGES.get("parameter-element-does-not-allow-attributes");
+    }
 }

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/TemplateParserImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/TemplateParserImpl.java?rev=713455&r1=713454&r2=713455&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/TemplateParserImpl.java
(original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/TemplateParserImpl.java
Wed Nov 12 11:09:24 2008
@@ -57,6 +57,12 @@
      */
     public static final String TAPESTRY_SCHEMA_5_0_0 = "http://tapestry.apache.org/schema/tapestry_5_0_0.xsd";
 
+    /**
+     * Special namespace used to denote Block parameters to components, as a (preferred)
alternative to the t:parameter
+     * element.  The simple element name is the name of the parameter.
+     */
+    public static final String TAPESTRY_PARAMETERS_URI = "tapestry:parameter";
+
     private static final Pattern ID_PATTERN = Pattern.compile("^[a-z]\\w*$", Pattern.CASE_INSENSITIVE);
 
     /**
@@ -76,9 +82,7 @@
     // expansions on the same text line into a single large
     // but invalid expansion.
 
-    private static final String EXPANSION_REGEXP = "\\$\\{\\s*(.*?)\\s*}";
-
-    private static final Pattern EXPANSION_PATTERN = Pattern.compile(EXPANSION_REGEXP);
+    private static final Pattern EXPANSION_PATTERN = Pattern.compile("\\$\\{\\s*(.*?)\\s*}");
 
 
     private XMLReader reader;
@@ -353,6 +357,12 @@
             return;
         }
 
+        if (TAPESTRY_PARAMETERS_URI.equals(uri))
+        {
+            startParameterElement(localName, attributes);
+            return;
+        }
+
         startPossibleComponent(attributes, uri, localName, null);
     }
 
@@ -387,7 +397,7 @@
 
         if (localName.equalsIgnoreCase("parameter"))
         {
-            startParameter(attributes);
+            startClassicParameter(attributes);
             return;
         }
 
@@ -453,7 +463,12 @@
         // TODO: Check for an xml:space attribute
     }
 
-    private void startParameter(Attributes attributes)
+    /**
+     * Starts a t:parameter element which was the only way to demarcate block parameters
in 5.0.
+     *
+     * @param attributes
+     */
+    private void startClassicParameter(Attributes attributes)
     {
         addEndOfElementHandler();
 
@@ -466,6 +481,24 @@
     }
 
     /**
+     * New in 5.1 is the "tapestry:parameter" namespace. Elements in this namespace are the
names of block parameters to
+     * components, replacing the &lt;t:parameter name="foo"&gt; construct used in
5.0.
+     *
+     * @param localName  unqualifed  element name
+     * @param attributes must be zero length
+     */
+    private void startParameterElement(String localName, Attributes attributes)
+    {
+        addEndOfElementHandler();
+
+        if (attributes.getLength() > 0)
+            throw new TapestryException(ServicesMessages.parameterElementDoesNotAllowAttributes(),
getCurrentLocation(),
+                                        null);
+
+        tokens.add(new ParameterToken(localName, getCurrentLocation()));
+    }
+
+    /**
      * Should be called *before* the _compressWhitespace is changed.
      */
     private void addEndOfElementHandler()
@@ -781,6 +814,10 @@
 
         if (uri.equals(TAPESTRY_SCHEMA_5_0_0)) return;
 
+        // Likewise, the special namespace for block parameters.
+
+        if (uri.equals(TAPESTRY_PARAMETERS_URI)) return;
+
         // The prefix may be blank, which happens when the xmlns attribute is used to define
the
         // namespace for the default namespace, and when a document has an explicit DOCTYPE.
 

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/structure/BlockImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/structure/BlockImpl.java?rev=713455&r1=713454&r2=713455&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/structure/BlockImpl.java
(original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/structure/BlockImpl.java
Wed Nov 12 11:09:24 2008
@@ -26,7 +26,7 @@
 
 public class BlockImpl extends BaseLocatable implements Block, BodyPageElement, RenderCommand
 {
-    // We could lazily create this, but for <t:block> and <t:parameter>, the
case
+    // We could lazily create this, but for (parameter) block elements the case
     // for an empty block is extremely rare.
 
     private final List<PageElement> elements = CollectionFactory.newList();

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/structure/InternalComponentResourcesImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/structure/InternalComponentResourcesImpl.java?rev=713455&r1=713454&r2=713455&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/structure/InternalComponentResourcesImpl.java
(original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/structure/InternalComponentResourcesImpl.java
Wed Nov 12 11:09:24 2008
@@ -373,7 +373,7 @@
 
             if (value == null) continue;
 
-            // Because Blocks can be passed in (right from the template, using <t:parameter>),
+            // Because Blocks can be passed in (right from the template),
             // we want to skip those when rending informal parameters.
 
             if (value instanceof Block) continue;

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/corelib/pages/ExceptionReport.tml
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/corelib/pages/ExceptionReport.tml?rev=713455&r1=713454&r2=713455&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/corelib/pages/ExceptionReport.tml
(original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/corelib/pages/ExceptionReport.tml
Wed Nov 12 11:09:24 2008
@@ -1,4 +1,4 @@
-<html xml:space="default" xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
+<html xml:space="default" xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd"
xmlns:p="tapestry:parameter">
     <head>
         <title>Application Exception</title>
     </head>
@@ -7,7 +7,7 @@
 
         <t:if test="productionMode">
             <p>${rootException.message}</p>
-            <t:parameter name="else">
+            <p:else>
                 <t:exceptiondisplay exception="rootException"/>
 
                 <div class="t-env-data">
@@ -40,20 +40,20 @@
                             <dd>
                                 <t:if test="simpleProperty">
                                     ${propertyValue}
-                                    <t:parameter name="else">
+                                    <p:else>
                                         <ul>
                                             <li t:type="loop" source="complexPropertyValue"
value="var:path">
                                                 ${var:path}
                                             </li>
                                         </ul>
-                                    </t:parameter>
+                                    </p:else>
                                 </t:if>
                             </dd>
                         </t:loop>
                     </dl>
 
                 </div>
-            </t:parameter>
+            </p:else>
         </t:if>
     </body>
 

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/corelib/pages/ServiceStatus.tml
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/corelib/pages/ServiceStatus.tml?rev=713455&r1=713454&r2=713455&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/corelib/pages/ServiceStatus.tml
(original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/corelib/pages/ServiceStatus.tml
Wed Nov 12 11:09:24 2008
@@ -1,4 +1,4 @@
-<html xml:space="default" xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
+<html xml:space="default" xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd"
xmlns:p="tapestry:parameter">
     <head>
         <title>Tapestry IoC Services Status</title>
         <style>
@@ -30,9 +30,9 @@
 
             <t:grid rowsperpage="100" model="model" rowClass="row.status" source="activity"
row="row">
 
-                <t:parameter name="serviceInterfaceCell">
+                <p:serviceInterfaceCell>
                     ${row.serviceInterface}
-                </t:parameter>
+                </p:serviceInterfaceCell>
 
             </t:grid>
 
@@ -69,11 +69,11 @@
                 </dl>
             </p>
 
-            <t:parameter name="else">
+            <p:else>
                 <p>
                     <em>${message:service-status-hidden}</em>
                 </p>
-            </t:parameter>
+            </p:else>
         </t:unless>
     </body>
 </html>
\ No newline at end of file

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/internal/services/ServicesStrings.properties
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/internal/services/ServicesStrings.properties?rev=713455&r1=713454&r2=713455&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/internal/services/ServicesStrings.properties
(original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/internal/services/ServicesStrings.properties
Wed Nov 12 11:09:24 2008
@@ -96,4 +96,5 @@
 forbid-instantiate-component-class=Component class %s may not be instantiated directly. 
You should use an @InjectPage or @InjectComponent annotation instead.
 event-not-handled=Request event '%s' (on component %s) was not handled; you must provide
a matching event handler method in the component or in one of its containers.
 document-missing-html-root=The root element of the rendered document was <%s>, not
<html>. A root element of <html> is needed when linking JavaScript and stylesheet
resources.
-add-new-method-conflict=Unable to add new method %s as it already exists.
\ No newline at end of file
+add-new-method-conflict=Unable to add new method %s as it already exists.
+parameter-element-does-not-allow-attributes=A block parameter element does not allow any
additional attributes. The element name defines the parameter name.

Modified: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/TemplateParserImplTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/TemplateParserImplTest.java?rev=713455&r1=713454&r2=713455&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/TemplateParserImplTest.java
(original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/TemplateParserImplTest.java
Wed Nov 12 11:09:24 2008
@@ -576,6 +576,25 @@
         assertEquals(token8.getTokenType(), TokenType.END_ELEMENT);
     }
 
+    /**
+     * TAP5-112
+     */
+    @Test
+    public void parameter_namespace_element()
+    {
+        List<TemplateToken> tokens = tokens("parameter_namespace_element.tml");
+
+        ParameterToken token4 = get(tokens, 4);
+        assertEquals(token4.getName(), "fred");
+
+        CommentToken token6 = get(tokens, 6);
+        assertEquals(token6.getComment(), "fred content");
+
+        TemplateToken token8 = get(tokens, 8);
+
+        assertEquals(token8.getTokenType(), TokenType.END_ELEMENT);
+    }
+
     @Test
     public void complex_component_type()
     {
@@ -631,6 +650,9 @@
                 {"unexpected_attribute_in_block_element.tml",
                         "Element <block> does not support an attribute named 'name'.
The only allowed attribute name is 'id'.",
                         3},
+
+                {"parameter_namespace_with_attributes.tml",
+                        ServicesMessages.parameterElementDoesNotAllowAttributes(), 4}
         };
     }
 

Added: tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry5/internal/services/parameter_namespace_element.tml
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry5/internal/services/parameter_namespace_element.tml?rev=713455&view=auto
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry5/internal/services/parameter_namespace_element.tml
(added)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry5/internal/services/parameter_namespace_element.tml
Wed Nov 12 11:09:24 2008
@@ -0,0 +1,9 @@
+<html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd" xmlns:p="tapestry:parameter"
xml:space="preserve">
+
+    <t:mycomp t:id="foo">
+        <p:fred>
+            <!-- fred content -->
+        </p:fred>
+    </t:mycomp>
+
+</html>

Added: tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry5/internal/services/parameter_namespace_with_attributes.tml
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry5/internal/services/parameter_namespace_with_attributes.tml?rev=713455&view=auto
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry5/internal/services/parameter_namespace_with_attributes.tml
(added)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry5/internal/services/parameter_namespace_with_attributes.tml
Wed Nov 12 11:09:24 2008
@@ -0,0 +1,9 @@
+<html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd" xmlns:p="tapestry:parameter"
xml:space="preserve">
+
+    <t:mycomp t:id="foo">
+        <p:fred name="foo">
+            <!-- fred content -->
+        </p:fred>
+    </t:mycomp>
+
+</html>



Mime
View raw message