You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tapestry.apache.org by jk...@apache.org on 2006/07/28 18:41:05 UTC

svn commit: r426610 - in /tapestry/tapestry4/trunk: src/site/ src/site/apt/ajax/ src/site/xdoc/components/ tapestry-examples/TimeTracker/src/java/org/apache/tapestry/timetracker/page/ tapestry-examples/Workbench/

Author: jkuhnert
Date: Fri Jul 28 09:41:04 2006
New Revision: 426610

URL: http://svn.apache.org/viewvc?rev=426610&view=rev
Log:
Added new documentation on ResponseBuilder. 
Updated timetracker pom settings to exclude taptestry-test.
Updated workbench pom settings to package as a war instead of jar.

Added:
    tapestry/tapestry4/trunk/src/site/apt/ajax/ResponseBuilder.apt
Modified:
    tapestry/tapestry4/trunk/src/site/site.xml
    tapestry/tapestry4/trunk/src/site/xdoc/components/Upload.xml
    tapestry/tapestry4/trunk/tapestry-examples/TimeTracker/src/java/org/apache/tapestry/timetracker/page/TaskEntryPage.java
    tapestry/tapestry4/trunk/tapestry-examples/Workbench/pom.xml

Added: tapestry/tapestry4/trunk/src/site/apt/ajax/ResponseBuilder.apt
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/src/site/apt/ajax/ResponseBuilder.apt?rev=426610&view=auto
==============================================================================
--- tapestry/tapestry4/trunk/src/site/apt/ajax/ResponseBuilder.apt (added)
+++ tapestry/tapestry4/trunk/src/site/apt/ajax/ResponseBuilder.apt Fri Jul 28 09:41:04 2006
@@ -0,0 +1,57 @@
+ ------
+Ajax/DHTML Guide - ResponseBuilder
+ ------
+Jesse Kuhnert
+ ------
+28 July 2006
+ ------
+ 
+Overview
+
+  One of the largest changes made to Tapestry 4.1 was the rendering cycle. Traditionally, responses were made
+  using one basic {{{../tapestry-framework/apidocs/org/apache/tapestry/IMarkupWriter.html}IMarkupWriter}} instance
+  to capture and render output back to the browser. <(this isn't entirely true, NullWriter instances are used 
+  in some instances, like rewinding {{{../components/Form.html}Form}} components)>
+  
+  The new method looks basically the same on the surface, but rendering output is now managed by specific
+  {{{../tapestry-framework/apidocs/org/apache/tapestry/services/ResponseBuilder.html}ResponseBuilder}} instances,
+  depending on the type of request. These classes are responsible for calling 
+  {{{../tapestry-framework/apidocs/org/apache/tapestry/AbstractComponent.html#render(org.apache.tapestry.IMarkupWriter,%20org.apache.tapestry.IRequestCycle)}AbstractComponent.html#render(IMarkupWriter writer, IRequestCycle cycle}}
+  for all component renders. They are also responsible for managing javascript output from script templates.
+  
+  You can always get a reference to the correct {{{../tapestry-framework/apidocs/org/apache/tapestry/services/ResponseBuilder.html}ResponseBuilder}} for 
+  the current request by calling <<<cycle.getResponseBuilder()>>> on your {{{../tapestry-framework/apidocs/org/apache/tapestry/IRequestCycle.html}IRequestCycle}} 
+  instance.
+  
+  <<See also:>> {{{../tapestry-framework/apidocs/org/apache/tapestry/services/ResponseBuilder.html}ResponseBuilder}}, 
+  {{{../tapestry-framework/apidocs/org/apache/tapestry/services/impl/DojoAjaxResponseBuilder.html}DojoAjaxResponseBuilder}},
+  {{{../tapestry-framework/apidocs/org/apache/tapestry/services/impl/JSONResponseBuilder.html}JSONResponseBuilder}}
+  
+* Using ResponseBuilder to dynamically update content
+
+  Based on the type of request made, one of the three available {{{../tapestry-framework/apidocs/org/apache/tapestry/services/ResponseBuilder.html}ResponseBuilder}}s 
+  will be chosen to handle it. In the case of a request made using the {{{EventListener.html}EventListener}} annotation, the
+  builder used will <(not in all cases, if you specify async=false on your annotation the request will be a 
+  normal http post)> be {{{../tapestry-framework/apidocs/org/apache/tapestry/services/impl/DojoAjaxResponseBuilder.html}DojoAjaxResponseBuilder}}.
+  
+  Building on the example started in the {{{EventListener.html}EventListener}} overview, this is how you
+  would dynamically update the contents of a component:
+  
++-----------------------------------------------------------------------
+....
+
+@EventListener(targets = "projectChoose", events = "selectOption",
+          submitForm = "myForm")
+public void projectSelected(IRequestCycle cycle)
+{
+	cycle.getResponseBuilder().updateComponent("myComponentId");
+}
+
+....
++-----------------------------------------------------------------------
+
+  The string value passed in to <<<updateComponent(String componentId)>>> is the component id of the component
+  you would like to update. 
+  
+  Tapestry will correctly manage and render all javascript/form state/etc needed, depending on the component 
+  type you are requesting an update on. 

Modified: tapestry/tapestry4/trunk/src/site/site.xml
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/src/site/site.xml?rev=426610&r1=426609&r2=426610&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/src/site/site.xml (original)
+++ tapestry/tapestry4/trunk/src/site/site.xml Fri Jul 28 09:41:04 2006
@@ -77,6 +77,7 @@
             <item name="XHR/DHTML Guide" href="/ajax/index.html" collapse="true">
                 <item name="Introduction" href="/ajax/index.html" />
                 <item name="EventListener" href="/ajax/EventListener.html" />
+                <item name="ResponseBuilder" href="/ajax/ResponseBuilder.html" />
             </item>
             
             <item name="JavaScript Reference" href="/javascript/index.html" collapse="true">

Modified: tapestry/tapestry4/trunk/src/site/xdoc/components/Upload.xml
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/src/site/xdoc/components/Upload.xml?rev=426610&r1=426609&r2=426610&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/src/site/xdoc/components/Upload.xml (original)
+++ tapestry/tapestry4/trunk/src/site/xdoc/components/Upload.xml Fri Jul 28 09:41:04 2006
@@ -37,7 +37,8 @@
                     href="../tapestry-framework/apidocs/org/apache/tapestry/multipart/MultipartDecoder.html">
                     MultipartDecoder
                 </a>
-                service in hivemind. The default is 10000000(10kb).
+                service in hivemind. The default is 10000000(10mb). The <code>maxSize</code> parameter is 
+                specified in bytes, so you will have to give it the long form.
             </p>
 
             <section name="Example override of default maximum file upload size.">

Modified: tapestry/tapestry4/trunk/tapestry-examples/TimeTracker/src/java/org/apache/tapestry/timetracker/page/TaskEntryPage.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-examples/TimeTracker/src/java/org/apache/tapestry/timetracker/page/TaskEntryPage.java?rev=426610&r1=426609&r2=426610&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-examples/TimeTracker/src/java/org/apache/tapestry/timetracker/page/TaskEntryPage.java (original)
+++ tapestry/tapestry4/trunk/tapestry-examples/TimeTracker/src/java/org/apache/tapestry/timetracker/page/TaskEntryPage.java Fri Jul 28 09:41:04 2006
@@ -57,8 +57,7 @@
     
     @Component(type = "DropdownDatePicker", id = "datePicker",
             bindings = {"value=date", 
-            "displayName=message:task.start.date", 
-            "validators=validators:required"})
+            "displayName=message:task.start.date"})
     public abstract DropdownDatePicker getDatePicker();
     public abstract Date getDate();
     
@@ -77,7 +76,7 @@
     @Component(type = "TextField", id = "descriptionField",
             bindings = { "value=description", 
             "displayName=message:task.description",
-            "validators=validators:required"})
+            "validators=validators:required,maxLength=20"})
     public abstract TextField getDescriptionField();
     public abstract String getDescription();
     

Modified: tapestry/tapestry4/trunk/tapestry-examples/Workbench/pom.xml
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-examples/Workbench/pom.xml?rev=426610&r1=426609&r2=426610&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-examples/Workbench/pom.xml (original)
+++ tapestry/tapestry4/trunk/tapestry-examples/Workbench/pom.xml Fri Jul 28 09:41:04 2006
@@ -4,7 +4,7 @@
     <modelVersion>4.0.0</modelVersion>
     <groupId>org.apache.tapestry</groupId>
     <artifactId>tapestry-Workbench</artifactId>
-    <packaging>jar</packaging>
+    <packaging>war</packaging>
     <version>4.1.0-SNAPSHOT</version>
     
     <!-- This should change to tapestry-project -->
@@ -31,11 +31,49 @@
             <groupId>org.apache.tapestry</groupId>
             <artifactId>tapestry-contrib</artifactId>
         </dependency>
+        <dependency>
+            <groupId>org.apache.tapestry</groupId>
+            <artifactId>tapestry-test</artifactId>
+            <scope>test</scope>
+        </dependency>
     </dependencies>
     
     <build>
         <sourceDirectory>src/java</sourceDirectory>
         <testSourceDirectory>src/test</testSourceDirectory>
+        
+        <plugins>
+            <plugin>
+                <groupId>org.mortbay.jetty</groupId>
+                <artifactId>maven-jetty6-plugin</artifactId>
+                <version>6.0.0beta17</version>
+                <configuration>
+                    <webAppSourceDirectory>${basedir}/src/context</webAppSourceDirectory>
+                    <scanIntervalSeconds>10</scanIntervalSeconds>
+                </configuration>
+                <dependencies>
+                    <dependency>
+                        <groupId>commons-logging</groupId>
+                        <artifactId>commons-logging</artifactId>
+                        <version>1.0.4</version>
+                    </dependency>
+                    <dependency>
+                        <groupId>log4j</groupId>
+                        <artifactId>log4j</artifactId>
+                        <version>1.2.13</version>
+                    </dependency>
+                </dependencies>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-war-plugin</artifactId>
+                <version>2.0.1-SNAPSHOT</version>
+                <configuration>
+                    <warSourceDirectory>${basedir}/src/context</warSourceDirectory>
+                </configuration>
+            </plugin>
+        </plugins>
+        
     </build>
     
     <reporting>
@@ -53,4 +91,13 @@
             </plugin>
         </plugins>
     </reporting>
-</project>
\ No newline at end of file
+    
+    <pluginRepositories>
+        <pluginRepository>
+            <id>mortbay-repo</id>
+            <name>mortbay-repo</name>
+            <url>http://www.mortbay.org/maven2/snapshot</url>
+        </pluginRepository>
+    </pluginRepositories>
+    
+</project>