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 2007/05/30 17:45:34 UTC

svn commit: r542847 - in /tapestry/tapestry5/trunk/tapestry-core/src: main/java/org/apache/tapestry/corelib/components/ main/java/org/apache/tapestry/internal/services/ main/resources/org/apache/tapestry/corelib/components/ site/apt/guide/ test/app1/WE...

Author: hlship
Date: Wed May 30 08:45:32 2007
New Revision: 542847

URL: http://svn.apache.org/viewvc?view=rev&rev=542847
Log:
TAPESTRY-1485: Remove the Any component --- not necessary because of expansions in attributes

Removed:
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/components/Any.java
    tapestry/tapestry5/trunk/tapestry-core/src/test/app1/WEB-INF/AnyDemo.html
    tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/app1/pages/AnyDemo.java
Modified:
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/PageLoaderProcessor.java
    tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry/corelib/components/GridRows.html
    tapestry/tapestry5/trunk/tapestry-core/src/site/apt/guide/event.apt
    tapestry/tapestry5/trunk/tapestry-core/src/site/apt/guide/templates.apt
    tapestry/tapestry5/trunk/tapestry-core/src/test/app1/WEB-INF/RenderComponentDemo.html
    tapestry/tapestry5/trunk/tapestry-core/src/test/app1/WEB-INF/Start.html
    tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/IntegrationTests.java
    tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/app1/pages/RenderComponentDemo.java
    tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry/integration/app2/pages/TestPageForAsset.html

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/PageLoaderProcessor.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/PageLoaderProcessor.java?view=diff&rev=542847&r1=542846&r2=542847
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/PageLoaderProcessor.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/PageLoaderProcessor.java Wed May 30 08:45:32 2007
@@ -609,17 +609,9 @@
         }
 
         if (isBlank(embeddedType) && isBlank(embeddedComponentClassName))
-        {
-            // non-null means its invisible instrumentation; the Any component
-            // will mimic the actual element, w/ body and informal parameters.
-
-            if (elementName != null)
-                embeddedType = "Any";
-            else
-                throw new TapestryException(ServicesMessages.noTypeForEmbeddedComponent(
-                        embeddedId,
-                        _loadingComponentModel.getComponentClassName()), token, null);
-        }
+            throw new TapestryException(ServicesMessages.noTypeForEmbeddedComponent(
+                    embeddedId,
+                    _loadingComponentModel.getComponentClassName()), token, null);
 
         ComponentPageElement newComponent = _pageElementFactory.newComponentElement(
                 _page,

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry/corelib/components/GridRows.html
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry/corelib/components/GridRows.html?view=diff&rev=542847&r1=542846&r2=542847
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry/corelib/components/GridRows.html (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry/corelib/components/GridRows.html Wed May 30 08:45:32 2007
@@ -1,4 +1,4 @@
-<tr t:id="row" class="prop:rowClass" xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
+<tr class="${rowClass}" xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
     <t:loop source="propertyNames" value="propertyName" volatile="true">
         <td class="${cellClass}">
              <t:gridcell model="columnModel" row="row" resources="componentResources.containerResources"/>

Modified: tapestry/tapestry5/trunk/tapestry-core/src/site/apt/guide/event.apt
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/site/apt/guide/event.apt?view=diff&rev=542847&r1=542846&r2=542847
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/site/apt/guide/event.apt (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/site/apt/guide/event.apt Wed May 30 08:45:32 2007
@@ -124,7 +124,7 @@
   }
 +---+  
   
-  If you event type is named "onAny", it will receive all types of events. This is rarely what you want!
+  If you method is named "onAnyEvent", it will be invoked for all types of events. This is rarely what you want!
     
   Note from Howard: I've found that I prefer the naming convention approach, and reserve the annotation just for situations that don't otherwise fit.  
   

Modified: tapestry/tapestry5/trunk/tapestry-core/src/site/apt/guide/templates.apt
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/site/apt/guide/templates.apt?view=diff&rev=542847&r1=542846&r2=542847
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/site/apt/guide/templates.apt (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/site/apt/guide/templates.apt Wed May 30 08:45:32 2007
@@ -259,10 +259,9 @@
   or in the default namespace. Placing an attribute in the Tapestry namespace is useful when the attribute is not defined for the
   element being instrumented.
     
-  It is valid to specify just the t:id attribute and not supply a specific type in either the template or in the containing class.
-  In this situation, Tapestry will make use of the
-  {{{../apidocs/org/apache/tapestry/corelib/components/Any.html}Any}} component, a kind of placeholder for any kind of element
-  whatsoever.
+  A component <must> have a type, either via the t:type attribute in the template, or by the defining the component in the Java class using the
+  {{{../apidocs/org/apache/tapestry/annotations/Component.html}Component}} annotation (and using the t:id attribute on the element in the template).
+
   
   In <most> cases,it is an aesthetic choice between normal emebedded components, and embedded components via invisible instrumentation.  In a few instances,
   such as the Loop component, the behavior of the component is influenced by your choice.  The Loop component, when included using invisible instrumentation, will

Modified: tapestry/tapestry5/trunk/tapestry-core/src/test/app1/WEB-INF/RenderComponentDemo.html
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/app1/WEB-INF/RenderComponentDemo.html?view=diff&rev=542847&r1=542846&r2=542847
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/app1/WEB-INF/RenderComponentDemo.html (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/app1/WEB-INF/RenderComponentDemo.html Wed May 30 08:45:32 2007
@@ -1,29 +1,22 @@
 <html t:type="Border" xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
-    
+
   <h1>Render Component Demo</h1>
-  
-    <p>
-        This page demonstrates how a component may return a component instance from one of its render phase methods to allow that object to render.
-    </p>
-
-    <t:block>
-        <span t:id="optional">
-            Optional Text
-        </span>
-    </t:block>
-    
-    <t:form>
-        <input t:type="Checkbox" t:id="enabled" onchange="this.form.submit();"/> <label t:type="Label" for="enabled">Enable optional text</label>
-    </t:form>
-    
-    <t:if  test="enabled">
-        Should now show up:
-        <t:parameter name="else">
-            Should be blank:            
-        </t:parameter>
-    </t:if>
-
-    <span id="container">[<t:render value="thing"/>]</span>
-    
-    
+
+  <p> This page demonstrates how a component may return a component instance from one of its render
+    phase methods to allow that object to render. </p>
+
+  <t:block id="optional"> <span>Optional Text</span> </t:block>
+
+  <t:form>
+    <input t:type="Checkbox" t:id="enabled" onchange="this.form.submit();"/>
+    <label t:type="Label" for="enabled">Enable optional text</label>
+  </t:form>
+
+  <t:if test="enabled"> Should now show up: <t:parameter name="else"> Should be blank:
+    </t:parameter>
+  </t:if>
+
+  <span id="container">[<t:render value="thing"/>]</span>
+
+
 </html>

Modified: tapestry/tapestry5/trunk/tapestry-core/src/test/app1/WEB-INF/Start.html
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/app1/WEB-INF/Start.html?view=diff&rev=542847&r1=542846&r2=542847
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/app1/WEB-INF/Start.html (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/app1/WEB-INF/Start.html Wed May 30 08:45:32 2007
@@ -58,8 +58,6 @@
           <li>
             <a t:type="PageLink" page="ValidForm">ValidForm</a> -- server-side input validation</li>
           <li>
-            <a t:type="PageLink" page="AnyDemo">AnyDemo</a> -- test out the Any component </li>
-          <li>
             <a t:type="PageLink" page="PasswordFieldDemo">PasswordFieldDemo</a> -- test for the
             PasswordField component </li>
           <li>
@@ -76,7 +74,7 @@
       <td>
         <ul>
 
-         <li>
+          <li>
             <a t:type="PageLink" page="ToDoList">ToDo List</a> -- Loops and Submit inside Form using
             a primary key encoder </li>
           <li>
@@ -124,19 +122,17 @@
             <t:pagelink page="renderabledemo">Renderable Demo</t:pagelink> -- Shows that render
             phase methods can return a Renderable object </li>
           <li>
-            <t:pagelink page="eventhandlerdemo" context="'clear'">EventHandler Demo</t:pagelink>
-            -- Tests for event handling method order and matching
-          </li>
-          <li>
-            <t:pagelink page="inheritedbindingsdemo">Inherited Bindings Demo</t:pagelink> --
-            Tests for components that inherit bindings from containing components
-          </li>
+            <t:pagelink page="eventhandlerdemo" context="'clear'">EventHandler Demo</t:pagelink> --
+            Tests for event handling method order and matching </li>
+          <li>
+            <t:pagelink page="inheritedbindingsdemo">Inherited Bindings Demo</t:pagelink> -- Tests
+            for components that inherit bindings from containing components </li>
           <li>
-            <t:pagelink page="ClientPersistenceDemo">Client Persistence Demo</t:pagelink> -- component field values persisted on the client side
-          </li>
+            <t:pagelink page="ClientPersistenceDemo">Client Persistence Demo</t:pagelink> --
+            component field values persisted on the client side </li>
           <li>
-            <t:pagelink page="attributeExpansionsDemo">Attribute Expansions Demo</t:pagelink> -- use expansions inside attributes of ordinary elements
-          </li>
+            <t:pagelink page="attributeExpansionsDemo">Attribute Expansions Demo</t:pagelink> -- use
+            expansions inside attributes of ordinary elements </li>
           <li>
             <t:pagelink page="PaletteDemo">Palette Demo</t:pagelink> -- multiple selection component
           </li>

Modified: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/IntegrationTests.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/IntegrationTests.java?view=diff&rev=542847&r1=542846&r2=542847
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/IntegrationTests.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/IntegrationTests.java Wed May 30 08:45:32 2007
@@ -35,22 +35,6 @@
 public class IntegrationTests extends AbstractIntegrationTestSuite
 {
     @Test
-    public void any_component()
-    {
-        open(BASE_URL);
-
-        clickAndWait("link=AnyDemo");
-
-        assertSourcePresent(
-                "<span class=\"title\">Page Title</span>",
-                "<div class=\"heading\">Heading</div>",
-                "<h2 class=\"section\">Section</h2>",
-                "<li id=\"item\">Item (item)</li>",
-                "<li id=\"item_0\">Item (item_0)</li>",
-                "<li id=\"item_1\">Item (item_1)</li>");
-    }
-
-    @Test
     public void assets() throws Exception
     {
         open(BASE_URL);

Modified: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/app1/pages/RenderComponentDemo.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/app1/pages/RenderComponentDemo.java?view=diff&rev=542847&r1=542846&r2=542847
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/app1/pages/RenderComponentDemo.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/app1/pages/RenderComponentDemo.java Wed May 30 08:45:32 2007
@@ -14,17 +14,17 @@
 
 package org.apache.tapestry.integration.app1.pages;
 
-import org.apache.tapestry.annotations.Component;
+import org.apache.tapestry.Block;
+import org.apache.tapestry.annotations.Inject;
 import org.apache.tapestry.annotations.Persist;
-import org.apache.tapestry.corelib.components.Any;
 
 public class RenderComponentDemo
 {
     @Persist
     private boolean _enabled;
 
-    @Component
-    private Any _optional;
+    @Inject
+    private Block _optional;
 
     public boolean isEnabled()
     {

Modified: tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry/integration/app2/pages/TestPageForAsset.html
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry/integration/app2/pages/TestPageForAsset.html?view=diff&rev=542847&r1=542846&r2=542847
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry/integration/app2/pages/TestPageForAsset.html (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry/integration/app2/pages/TestPageForAsset.html Wed May 30 08:45:32 2007
@@ -1,5 +1,5 @@
 <html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
   <head>
-    <link t:type="Any" rel="stylesheet" href="prop:stylePath" />
+    <link rel="stylesheet" href="${stylePath}" />
   </head>
 </html>