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 2006/09/13 18:58:34 UTC

svn commit: r443020 - in /tapestry/tapestry5/tapestry-core/trunk/src: site/apt/guide/templates.apt site/site.xml test/java/org/apache/tapestry/integration/IntegrationTests.java

Author: hlship
Date: Wed Sep 13 09:58:32 2006
New Revision: 443020

URL: http://svn.apache.org/viewvc?view=rev&rev=443020
Log:
Start documentation about component templates

Added:
    tapestry/tapestry5/tapestry-core/trunk/src/site/apt/guide/templates.apt
Modified:
    tapestry/tapestry5/tapestry-core/trunk/src/site/site.xml
    tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/integration/IntegrationTests.java

Added: tapestry/tapestry5/tapestry-core/trunk/src/site/apt/guide/templates.apt
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/site/apt/guide/templates.apt?view=auto&rev=443020
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/site/apt/guide/templates.apt (added)
+++ tapestry/tapestry5/tapestry-core/trunk/src/site/apt/guide/templates.apt Wed Sep 13 09:58:32 2006
@@ -0,0 +1,106 @@
+ ----
+ Component Templates
+ ----
+ 
+Component Templates
+
+  Under Tapestry, component templates are files associated with page or component classes that contain the markup for
+  the component, along with any <embedded components>.
+  
+  In a change from Tapestry 4, under Tapestry 5, component templates are <<well formed XML documents>>. That means
+  that every open tag must have a matching close tag, every attribute must be quoted, and so forth.
+  
+  For the most part, these templates are standard (X)HTML; Tapestry extensions to ordinary markup are provided
+  in the form of a Tapestry namespace.
+  
+  We'll cover the specific content of templates shortly, first a few details about connecting a component to its template.
+  
+Pages vs. Components
+
+  In Tapestry 5, pages and components are virtually identical, the only real difference is that 
+  pages come from a different package. In reality, what we call a "page" is really the page's <root component>.
+  
+Template Location
+
+  Component templates are stored with the component class file.  The files have a ".html" extension, and are stored in
+  the same package as corresponding component class.
+  
+  Under a typical Maven directory structure, the Java class might be src/main/java/org/example/myapp/components/MyComponent.java.
+  The corresponding template will be src/main/resources/org/example/myapp/components/MyComponent.html.  
+  
+  The template and the compiled class will be packaged together in the WEB-INF/classes folder of the application WAR.
+  
+Tapestry Namespace
+
+  Component templates should include the Tapestry namespace, defining it in the root element of the template.
+  
++----+
+<html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
+    <head>
+        <title>Hello World Page</title>
+    </head>
+    <body>
+        <h1>Hello World</h1>
+    </body>
+</html>
++---+  
+
+  This defines the namespace using the standard prefix, "t:".  The examples on this page all assume the use of the standard 
+  prefix.
+  
+Tapestry Elements
+
+  Tapestry elements are elements defined using the Tapestry namespace prefix.
+  
+* \<comp\>
+
+  The \<comp\> element is used to identify an <embedded component> within the template.
+  
+  Embedded components have two parameters:
+  
+  * id: A unique id for the component (within its container).
+  
+  * type: Used to identify the type of the component; this is typically a partial class name (details below).
+  
+  [] 
+  
+  Either id or type must be specified.
+  
+  If the id attribute is ommitted, Tapestry will assign a unique id for the element.  <<Not yet implemented.>>
+  
+  The type attribute is optional; when not specified, Tapestry will expect the class to define
+  the type of the component (with a @Component annotation).  <<Not yet implemented.>>
+  
+  Additional attributes are used to bind parameters of the component.  When parameters are bound
+  in this way, the values are interpreted as literals unless a specific prefix is given.
+  
+  The element defines where, within the containing component's template, the embedded component is active.
+  
+  It also defines the <<body>> of the embedded component, the portion of the template enclosed by the open and close
+  \<comp\> tags.
+  
+  The following example presumes a component, "Loop" that iterates from a minimum value to
+  a maximum value, rendering its body on each iteration:
+  
++----+
+<p>
+    Merry Christmas:
+    <t:comp type="Loop" min="1" max="3">
+        Ho!
+    </t:comp>
+</p>
++---+  
+  
+* \<body\>
+
+  In many cases, a component is designed to integrate its template with its container's
+  template.  
+  
+  The \<body\> element is used to identify where, within a component's template, its
+  body (from the container's template) is to be rendered.
+  
+  Components have control over if, and even how often, its body is rendered.
+   
+  
+  
+  
\ No newline at end of file

Modified: tapestry/tapestry5/tapestry-core/trunk/src/site/site.xml
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/site/site.xml?view=diff&rev=443020&r1=443019&r2=443020
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/site/site.xml (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/site/site.xml Wed Sep 13 09:58:32 2006
@@ -54,7 +54,8 @@
 
         <menu name="User Guide">
             <item name="Component Classes" href="guide/component-classes.html"/>
-            <item name="Component Rendering" href="guide/rendering.html"/>
+            <item name="Component Rendering" href="guide/rendering.html"/>
+            <item name="Component Templates" href="guide/templates.html"/>
             <item name="Injection" href="guide/inject.html"/>
             <item name="Configuration" href="guide/conf.html"/>
             <item name="Request Processing" href="guide/request.html"/>

Modified: tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/integration/IntegrationTests.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/integration/IntegrationTests.java?view=diff&rev=443020&r1=443019&r2=443020
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/integration/IntegrationTests.java (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/integration/IntegrationTests.java Wed Sep 13 09:58:32 2006
@@ -26,6 +26,9 @@
 import com.thoughtworks.selenium.Selenium;
 
 /**
+ * Note: If these tests fail with BindException when starting Jetty, it could be Skype. At least on
+ * my system, Skype is listening on localhost:80.
+ * 
  * @author Howard M. Lewis Ship
  */
 @Test(sequential = true, groups =
@@ -34,7 +37,8 @@
 {
     private static final String BASE_URL = "http://localhost/";
 
-    public static final String PAGE_LOAD_TIMEOUT = "1000";
+    /** 5 seconds */
+    public static final String PAGE_LOAD_TIMEOUT = "5000";
 
     private Selenium _selenium;