You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by jk...@apache.org on 2006/08/07 00:36:02 UTC

svn commit: r429203 - in /tapestry/tapestry4/trunk: src/site/apt/javascript/ src/site/xdoc/components/ tapestry-framework/src/java/org/apache/tapestry/form/ tapestry-framework/src/java/org/apache/tapestry/link/ tapestry-framework/src/java/org/apache/ta...

Author: jkuhnert
Date: Sun Aug  6 15:36:00 2006
New Revision: 429203

URL: http://svn.apache.org/viewvc?rev=429203&view=rev
Log:
Implemented new submitType parameter for all submit components that allows a more intuitive invocation of cancel/refresh 
listeners on form components by specifying a parameter of  "submit/cancel/refresh" instead of having to know/type in javascript
to invoke the correct client side function.

Added:
    tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/form/SubmitType.script
Modified:
    tapestry/tapestry4/trunk/src/site/apt/javascript/form.apt
    tapestry/tapestry4/trunk/src/site/xdoc/components/ImageSubmit.xml
    tapestry/tapestry4/trunk/src/site/xdoc/components/LinkSubmit.xml
    tapestry/tapestry4/trunk/src/site/xdoc/components/Submit.xml
    tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/form/AbstractSubmit.java
    tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/form/ImageSubmit.java
    tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/form/ImageSubmit.jwc
    tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/form/LinkSubmit.java
    tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/form/LinkSubmit.jwc
    tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/form/LinkSubmit.script
    tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/form/Submit.java
    tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/form/Submit.jwc
    tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/link/DirectLinkWorker.script
    tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/services/impl/ApplicationSpecificationInitializer.java
    tapestry/tapestry4/trunk/tapestry-framework/src/js/tapestry/form.js
    tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/form/LinkSubmitTest.java
    tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/form/TestImageSubmit.java
    tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/form/TestSubmit.java
    tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/services/impl/TestApplicationSpecificationInitializer.java

Modified: tapestry/tapestry4/trunk/src/site/apt/javascript/form.apt
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/src/site/apt/javascript/form.apt?rev=429203&r1=429202&r2=429203&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/src/site/apt/javascript/form.apt (original)
+++ tapestry/tapestry4/trunk/src/site/apt/javascript/form.apt Sun Aug  6 15:36:00 2006
@@ -198,7 +198,7 @@
 </script>
 +-------------------------
 
-* tapestry.form.cancel(form)
+* tapestry.form.cancel(form, submitName)
 
   Submits the form specified, and also sets the hidden form input field controlled by tapestry that
   specifies the <<<submitmode>>> used so that if you have registered a <<<cancel listener>>> on your
@@ -209,8 +209,10 @@
 *----------------------*---------------*------------*----------*----------------------------------------------+
   form 				   | String element id / HTMLForm node |  yes  |          | The element id of the form, or the form html element itself.
 *----------------------*---------------*------------*----------*----------------------------------------------+
+  submitName 		   | String        |   no       |          | Optional submit name string to use when submitting.
+*----------------------*---------------*------------*----------*----------------------------------------------+
 
-* tapestry.form.refresh(form)
+* tapestry.form.refresh(form, submitName)
 
   Submits the form specified, and also sets the hidden form input field controlled by tapestry that
   specifies the <<<submitmode>>> used so that if you have registered a <<<refresh listener>>> on your
@@ -220,6 +222,8 @@
   Parameter            |    Type	   |  Required  | Default  | 		Description
 *----------------------*---------------*------------*----------*----------------------------------------------+
   form 				   | String element id / HTMLForm node |  yes  |          | The element id of the form, or the form html element itself.
+*----------------------*---------------*------------*----------*----------------------------------------------+
+  submitName 		   | String        |   no       |          | Optional submit name string to use when submitting.
 *----------------------*---------------*------------*----------*----------------------------------------------+
 
 * tapestry.form.submitAsync(form, content, submitName, validate)

Modified: tapestry/tapestry4/trunk/src/site/xdoc/components/ImageSubmit.xml
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/src/site/xdoc/components/ImageSubmit.xml?rev=429203&r1=429202&r2=429203&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/src/site/xdoc/components/ImageSubmit.xml (original)
+++ tapestry/tapestry4/trunk/src/site/xdoc/components/ImageSubmit.xml Sun Aug  6 15:36:00 2006
@@ -222,7 +222,20 @@
                             </p>
                         </td>
                     </tr>
-
+                    <tr>
+                        <td>submitType</td>
+                        <td>String - [submit,cancel,refresh]</td>
+                        <td></td>
+                        <td>yes</td>
+                        <td>submit</td>
+                        <td>
+                            Controls the type of submission that this component invokes. Using javascript
+                            this parameter will cause the invocation of the component to be recognized as 
+                            a cancel/refresh/normal form submission depending on the value given. If you 
+                            have a cancel="listener" or refresh="listener" parameter set on your 
+                            <a href="Form.html">Form</a> they will be invoked accordingly.
+                        </td>
+                    </tr>
                 </table>
 
                 <p>

Modified: tapestry/tapestry4/trunk/src/site/xdoc/components/LinkSubmit.xml
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/src/site/xdoc/components/LinkSubmit.xml?rev=429203&r1=429202&r2=429203&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/src/site/xdoc/components/LinkSubmit.xml (original)
+++ tapestry/tapestry4/trunk/src/site/xdoc/components/LinkSubmit.xml Sun Aug  6 15:36:00 2006
@@ -163,6 +163,20 @@
                             </p>
                         </td>
                     </tr>
+                    <tr>
+                        <td>submitType</td>
+                        <td>String - [submit,cancel,refresh]</td>
+                        <td></td>
+                        <td>yes</td>
+                        <td>submit</td>
+                        <td>
+                            Controls the type of submission that this component invokes. Using javascript
+                            this parameter will cause the invocation of the component to be recognized as 
+                            a cancel/refresh/normal form submission depending on the value given. If you 
+                            have a cancel="listener" or refresh="listener" parameter set on your 
+                            <a href="Form.html">Form</a> they will be invoked accordingly.
+                        </td>
+                    </tr>
                 </table>
 
                 <p>

Modified: tapestry/tapestry4/trunk/src/site/xdoc/components/Submit.xml
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/src/site/xdoc/components/Submit.xml?rev=429203&r1=429202&r2=429203&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/src/site/xdoc/components/Submit.xml (original)
+++ tapestry/tapestry4/trunk/src/site/xdoc/components/Submit.xml Sun Aug  6 15:36:00 2006
@@ -205,6 +205,20 @@
                             </p>
                         </td>
                     </tr>
+                    <tr>
+                        <td>submitType</td>
+                        <td>String - [submit,cancel,refresh]</td>
+                        <td></td>
+                        <td>yes</td>
+                        <td>submit</td>
+                        <td>
+                            Controls the type of submission that this component invokes. Using javascript
+                            this parameter will cause the invocation of the component to be recognized as 
+                            a cancel/refresh/normal form submission depending on the value given. If you 
+                            have a cancel="listener" or refresh="listener" parameter set on your 
+                            <a href="Form.html">Form</a> they will be invoked accordingly.
+                        </td>
+                    </tr>
                 </table>
 
                 <p>

Modified: tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/form/AbstractSubmit.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/form/AbstractSubmit.java?rev=429203&r1=429202&r2=429203&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/form/AbstractSubmit.java (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/form/AbstractSubmit.java Sun Aug  6 15:36:00 2006
@@ -15,11 +15,17 @@
 package org.apache.tapestry.form;
 
 import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
 
+import org.apache.hivemind.util.Defense;
 import org.apache.tapestry.IActionListener;
 import org.apache.tapestry.IForm;
 import org.apache.tapestry.IMarkupWriter;
 import org.apache.tapestry.IRequestCycle;
+import org.apache.tapestry.IScript;
+import org.apache.tapestry.PageRenderSupport;
+import org.apache.tapestry.TapestryUtils;
 import org.apache.tapestry.listener.ListenerInvoker;
 
 /**
@@ -30,7 +36,7 @@
  */
 
 abstract class AbstractSubmit extends AbstractFormComponent
-{
+{   
     /**
      * Determine if this submit component was clicked.
      * 
@@ -93,6 +99,33 @@
         }
     }
 
+    protected void renderSubmitType(IMarkupWriter writer, IRequestCycle cycle)
+    {
+        String type = getSubmitType();
+        
+        Defense.notNull(type, "submitType");
+        
+        if (type.equals(FormConstants.SUBMIT_NORMAL))
+            return;
+        
+        if (!isParameterBound("onClick")) {
+            
+            writer.attribute("onClick", 
+                    "tapestry.form." + type + "('" + getForm().getClientId() 
+                    + "', '" + getName() + "')");
+        } else {
+            
+            PageRenderSupport prs = TapestryUtils.getPageRenderSupport(cycle, this);
+            
+            Map parms = new HashMap();
+            
+            parms.put("submit", this);
+            parms.put("type", type);
+            
+            getSubmitTypeScript().execute(this, cycle, prs, parms);
+        }
+    }
+    
     /** parameter. */
     public abstract IActionListener getListener();
     
@@ -111,6 +144,12 @@
     /** parameter. */
     public abstract Object getParameters();
 
+    /** The type of submission, normal/cancel/refresh. */
+    public abstract String getSubmitType();
+    
     /** Injected. */
     public abstract ListenerInvoker getListenerInvoker();
+    
+    /** Injected. */
+    public abstract IScript getSubmitTypeScript();
 }

Modified: tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/form/ImageSubmit.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/form/ImageSubmit.java?rev=429203&r1=429202&r2=429203&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/form/ImageSubmit.java (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/form/ImageSubmit.java Sun Aug  6 15:36:00 2006
@@ -77,7 +77,9 @@
         renderIdAttribute(writer, cycle);
 
         renderInformalParameters(writer, cycle);
-
+        
+        renderSubmitType(writer, cycle);
+        
         writer.closeTag();
     }
 

Modified: tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/form/ImageSubmit.jwc
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/form/ImageSubmit.jwc?rev=429203&r1=429202&r2=429203&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/form/ImageSubmit.jwc (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/form/ImageSubmit.jwc Sun Aug  6 15:36:00 2006
@@ -76,6 +76,14 @@
       the parameters available to a deferred listener.
     </description>
   </parameter>
+  
+  <parameter name="submitType" default-value="literal:submit" >
+    <description>
+        The type of submission this component should cause. Valid values are 
+        submit, cancel, and refresh. 
+    </description>
+  </parameter>
+  
   <parameter name="id" property="idParameter"	default-value="id"/>
 
   		  
@@ -84,5 +92,6 @@
   <reserved-parameter name="border"/>
 
   <inject property="listenerInvoker" object="infrastructure:listenerInvoker"/>
-
+  <inject property="submitTypeScript" type="script" object="SubmitType.script"/>
+  
 </component-specification>

Modified: tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/form/LinkSubmit.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/form/LinkSubmit.java?rev=429203&r1=429202&r2=429203&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/form/LinkSubmit.java (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/form/LinkSubmit.java Sun Aug  6 15:36:00 2006
@@ -79,10 +79,12 @@
 
             writer.begin("a");
             writer.attribute("href", (String) symbols.get("href"));
-
+            
             renderIdAttribute(writer, cycle);
 
             renderInformalParameters(writer, cycle);
+            
+            renderSubmitType(writer, cycle);
         }
 
         renderBody(writer, cycle);

Modified: tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/form/LinkSubmit.jwc
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/form/LinkSubmit.jwc?rev=429203&r1=429202&r2=429203&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/form/LinkSubmit.jwc (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/form/LinkSubmit.jwc Sun Aug  6 15:36:00 2006
@@ -28,6 +28,7 @@
   <parameter name="disabled"/>
   <parameter name="selected"/>
   <parameter name="tag"/>
+  
   <parameter name="id" property="idParameter" default-value="id"/>
     
   <parameter name="listener">
@@ -52,10 +53,18 @@
     </description>
   </parameter>
 
+  <parameter name="submitType" default-value="literal:submit" >
+    <description>
+        The type of submission this component should cause. Valid values are 
+        submit, cancel, and refresh. 
+    </description>
+  </parameter>
+
   <reserved-parameter name="name"/>
   <reserved-parameter name="href"/>
   
   <inject property="listenerInvoker" object="infrastructure:listenerInvoker"/>
   <inject property="script" type="script" object="LinkSubmit.script"/>
+  <inject property="submitTypeScript" type="script" object="SubmitType.script"/>
   
 </component-specification>

Modified: tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/form/LinkSubmit.script
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/form/LinkSubmit.script?rev=429203&r1=429202&r2=429203&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/form/LinkSubmit.script (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/form/LinkSubmit.script Sun Aug  6 15:36:00 2006
@@ -24,7 +24,7 @@
 <input-symbol key="form" class="org.apache.tapestry.IForm" required="yes"/>
 
 <let key="href">
-  javascript:Tapestry.submit_form('${form.name}', '${name}');
+  tapestry.form.submit('${form.name}', '${name}');
 </let>
 
 </script>

Modified: tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/form/Submit.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/form/Submit.java?rev=429203&r1=429202&r2=429203&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/form/Submit.java (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/form/Submit.java Sun Aug  6 15:36:00 2006
@@ -63,7 +63,9 @@
         renderIdAttribute(writer, cycle);
 
         renderInformalParameters(writer, cycle);
-
+        
+        renderSubmitType(writer, cycle);
+        
         writer.closeTag();
     }
 

Modified: tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/form/Submit.jwc
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/form/Submit.jwc?rev=429203&r1=429202&r2=429203&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/form/Submit.jwc (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/form/Submit.jwc Sun Aug  6 15:36:00 2006
@@ -76,6 +76,13 @@
     </description>
   </parameter>
   
+  <parameter name="submitType" default-value="literal:submit" >
+    <description>
+        The type of submission this component should cause. Valid values are 
+        submit, cancel, and refresh. 
+    </description>
+  </parameter>
+  
   <parameter name="id" property="idParameter" default-value="id"/>
   		  
   <reserved-parameter name="name"/>
@@ -83,5 +90,6 @@
   <reserved-parameter name="defer"/>
 
   <inject property="listenerInvoker" object="infrastructure:listenerInvoker"/>
+  <inject property="submitTypeScript" type="script" object="SubmitType.script"/>
   
 </component-specification>

Added: tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/form/SubmitType.script
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/form/SubmitType.script?rev=429203&view=auto
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/form/SubmitType.script (added)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/form/SubmitType.script Sun Aug  6 15:36:00 2006
@@ -0,0 +1,20 @@
+<?xml version="1.0"?>
+<!DOCTYPE script PUBLIC
+  "-//Apache Software Foundation//Tapestry Script Specification 3.0//EN"
+  "http://jakarta.apache.org/tapestry/dtd/Script_3_0.dtd">
+<script>
+<input-symbol key="submit" required="yes" />
+<input-symbol key="type" required="yes" />
+    <body>
+        <unique>
+            dojo.require("dojo.event");
+            dojo.require("tapestry.*");
+            dojo.require("tapestry.form.*");
+        </unique>
+    </body>
+    <initialization>
+        dojo.event.connect(dojo.byId("${submit.clientId}"), "onclick", function(e){
+            tapestry.form.${type}("${submit.form.clientId}", "${submit.name}");
+        });
+    </initialization>
+</script>

Modified: tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/link/DirectLinkWorker.script
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/link/DirectLinkWorker.script?rev=429203&r1=429202&r2=429203&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/link/DirectLinkWorker.script (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/link/DirectLinkWorker.script Sun Aug  6 15:36:00 2006
@@ -29,4 +29,4 @@
             tapestry.bind(e.target.getAttribute("href"), content, ${json});
         });
     </initialization>
-</script>
\ No newline at end of file
+</script>

Modified: tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/services/impl/ApplicationSpecificationInitializer.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/services/impl/ApplicationSpecificationInitializer.java?rev=429203&r1=429202&r2=429203&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/services/impl/ApplicationSpecificationInitializer.java (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/services/impl/ApplicationSpecificationInitializer.java Sun Aug  6 15:36:00 2006
@@ -55,7 +55,7 @@
 
         if (specResource == null)
         {
-            _log.debug(ImplMessages.noApplicationSpecification(servlet));
+            _log.warn(ImplMessages.noApplicationSpecification(servlet));
 
             spec = constructStandinSpecification(servlet);
         }

Modified: tapestry/tapestry4/trunk/tapestry-framework/src/js/tapestry/form.js
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/js/tapestry/form.js?rev=429203&r1=429202&r2=429203&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/js/tapestry/form.js (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/js/tapestry/form.js Sun Aug  6 15:36:00 2006
@@ -228,7 +228,7 @@
 		form.submit();
 	},
 	
-	cancel:function(form){
+	cancel:function(form, submitName){
 		var form=dojo.byId(form);
 		if (!form){
 			dojo.raise("Form not found with id " + form);
@@ -237,10 +237,10 @@
 		
 		form.submitmode.value="cancel";
 		
-		this.submit(form);
+		this.submit(form, submitName);
 	},
 	
-	refresh:function(form){
+	refresh:function(form, submitName){
 		var form=dojo.byId(form);
 		if (!form){
 			dojo.raise("Form not found with id " + form);
@@ -249,7 +249,7 @@
 		
 		form.submitmode.value="refresh";
 		
-		this.submit(form);
+		this.submit(form, submitName);
 	},
 	
 	/**

Modified: tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/form/LinkSubmitTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/form/LinkSubmitTest.java?rev=429203&r1=429202&r2=429203&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/form/LinkSubmitTest.java (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/form/LinkSubmitTest.java Sun Aug  6 15:36:00 2006
@@ -85,13 +85,15 @@
         IForm form = newForm();
 
         LinkSubmit linkSubmit = newInstance(LinkSubmit.class, new Object[]
-        { "form", form, "name", "fred_1", "script", script, "idParameter", "fred_id" });
+        { "form", form, "name", "fred_1", "script", script, 
+            "idParameter", "fred_id", "submitType", "submit" });
+        
         linkSubmit.addBody(newBody());
 
         trainGetSupport(cycle, support);
 
         trainGetUniqueId(cycle, "fred_id", "fred_id_unique");
-
+        
         trainResponseBuilder(cycle, writer);
         
         replay();

Modified: tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/form/TestImageSubmit.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/form/TestImageSubmit.java?rev=429203&r1=429202&r2=429203&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/form/TestImageSubmit.java (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/form/TestImageSubmit.java Sun Aug  6 15:36:00 2006
@@ -80,7 +80,7 @@
         
         Creator creator = new Creator();
         ImageSubmit submit = (ImageSubmit) creator.newInstance(ImageSubmit.class, new Object[]
-        { "image", image });
+        { "image", image , "submitType", "submit"});
 
         trainGetForm(cycle, form);
 
@@ -127,7 +127,7 @@
 
         Creator creator = new Creator();
         ImageSubmit submit = (ImageSubmit) creator.newInstance(ImageSubmit.class, new Object[]
-        { "disabledImage", image, "disabled", Boolean.TRUE });
+        { "disabledImage", image, "disabled", Boolean.TRUE, "submitType", "submit" });
 
         trainGetForm(cycle, form);
 
@@ -171,7 +171,7 @@
 
         Creator creator = new Creator();
         ImageSubmit submit = (ImageSubmit) creator.newInstance(ImageSubmit.class, new Object[]
-        { "image", image, "disabled", Boolean.TRUE });
+        { "image", image, "disabled", Boolean.TRUE, "submitType", "submit" });
 
         trainGetForm(cycle, form);
 
@@ -215,7 +215,7 @@
 
         Creator creator = new Creator();
         ImageSubmit submit = (ImageSubmit) creator.newInstance(ImageSubmit.class, new Object[]
-        { "image", image, "nameOverride", "barney" });
+        { "image", image, "nameOverride", "barney", "submitType", "submit" });
 
         trainGetForm(cycle, form);
 

Modified: tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/form/TestSubmit.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/form/TestSubmit.java?rev=429203&r1=429202&r2=429203&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/form/TestSubmit.java (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/form/TestSubmit.java Sun Aug  6 15:36:00 2006
@@ -14,12 +14,12 @@
 
 package org.apache.tapestry.form;
 
-import static org.easymock.EasyMock.aryEq;
-import static org.easymock.EasyMock.expect;
+import static org.easymock.EasyMock.*;
 import static org.testng.AssertJUnit.assertEquals;
 
 import java.util.Collection;
 import java.util.LinkedList;
+import java.util.Map;
 
 import org.apache.hivemind.util.PropertyUtils;
 import org.apache.tapestry.IActionListener;
@@ -27,6 +27,8 @@
 import org.apache.tapestry.IForm;
 import org.apache.tapestry.IMarkupWriter;
 import org.apache.tapestry.IRequestCycle;
+import org.apache.tapestry.IScript;
+import org.apache.tapestry.PageRenderSupport;
 import org.apache.tapestry.listener.ListenerInvokerTerminator;
 import org.apache.tapestry.test.Creator;
 import org.apache.tapestry.valid.IValidationDelegate;
@@ -42,7 +44,7 @@
 @Test
 public class TestSubmit extends BaseFormComponentTestCase
 {
-    public void testPrerendered()
+    public void test_Prerendered()
     {
         Creator creator = new Creator();
         Submit submit = (Submit) creator.newInstance(Submit.class);
@@ -62,10 +64,10 @@
         verify();
     }
 
-    public void testRender()
+    public void test_Render()
     {
         Creator creator = new Creator();
-        Submit submit = (Submit) creator.newInstance(Submit.class);
+        Submit submit = (Submit) creator.newInstance(Submit.class, new Object[] {"submitType", "submit"});
 
         IValidationDelegate delegate = newDelegate();
         IForm form = newForm();
@@ -104,11 +106,11 @@
         verify();
     }
 
-    public void testRenderDisabled()
+    public void test_Render_Disabled()
     {
         Creator creator = new Creator();
         Submit submit = (Submit) creator.newInstance(Submit.class, new Object[]
-        { "disabled", Boolean.TRUE });
+        { "disabled", Boolean.TRUE, "submitType", "submit" });
 
         IValidationDelegate delegate = newDelegate();
         IForm form = newForm();
@@ -144,11 +146,11 @@
         verify();
     }
 
-    public void testRenderWithLabel()
+    public void test_Render_With_Label()
     {
         Creator creator = new Creator();
         Submit submit = (Submit) creator.newInstance(Submit.class, new Object[]
-        { "label", "flintstone" });
+        { "label", "flintstone", "submitType", "submit" });
 
         IValidationDelegate delegate = newDelegate();
         IForm form = newForm();
@@ -188,7 +190,82 @@
         verify();
     }
 
-    public void testRewindingDisabled()
+    public void test_SubmitType_OnClick()
+    {
+        IScript script = newMock(IScript.class);
+        Submit submit = newInstance(Submit.class, 
+                new Object[] {"submitType", "cancel", "submitTypeScript", script});
+        
+        IValidationDelegate delegate = newDelegate();
+        IForm form = newForm();
+        IRequestCycle cycle = newCycle();
+        IMarkupWriter writer = newWriter();
+
+        trainGetForm(cycle, form);
+
+        trainWasPrerendered(form, writer, submit, false);
+
+        trainGetDelegate(form, delegate);
+        
+        delegate.setFormComponent(submit);
+
+        trainGetElementId(form, submit, "fred");
+
+        trainIsRewinding(form, false);
+
+        trainIsRewinding(cycle, false);
+
+        form.setFormFieldUpdating(true);
+        
+        writer.beginEmpty("input");
+        writer.attribute("type", "submit");
+        writer.attribute("name", "fred");
+        
+        expect(form.getClientId()).andReturn("formtest");
+        
+        writer.attribute("onClick", "tapestry.form.cancel('formtest', 'fred')");
+        
+        writer.closeTag();
+
+        trainIsInError(delegate, false);
+
+        delegate.registerForFocus(submit, ValidationConstants.NORMAL_FIELD);
+
+        replay();
+
+        submit.renderComponent(writer, cycle);
+
+        verify();
+    }
+    
+    public void test_SubmitType_Script_OnClick()
+    {
+        IScript script = newMock(IScript.class);
+        IForm form = newForm();
+        IBinding binding = newMock(IBinding.class);
+        
+        Submit submit = newInstance(Submit.class, 
+                new Object[] {"submitType", "cancel", 
+            "submitTypeScript", script, "form", form});
+        
+        submit.setBinding("onClick", binding);
+        
+        IRequestCycle cycle = newCycle();
+        IMarkupWriter writer = newWriter();
+        
+        PageRenderSupport prs = newPageRenderSupport();
+        trainGetPageRenderSupport(cycle, prs);
+        
+        script.execute(eq(submit), eq(cycle), eq(prs), isA(Map.class));
+        
+        replay();
+        
+        submit.renderSubmitType(writer, cycle);
+
+        verify();
+    }
+    
+    public void test_Rewinding_Disabled()
     {
         Creator creator = new Creator();
         Submit submit = (Submit) creator.newInstance(Submit.class, new Object[]
@@ -218,7 +295,7 @@
         verify();
     }
 
-    public void testRewindNotForm()
+    public void test_Rewind_Not_Form()
     {
         Creator creator = new Creator();
         Submit submit = (Submit) creator.newInstance(Submit.class);
@@ -248,7 +325,7 @@
         verify();
     }
 
-    public void testRewindNotTrigger()
+    public void test_Rewind_Not_Trigger()
     {
         Creator creator = new Creator();
         Submit submit = (Submit) creator.newInstance(Submit.class);
@@ -279,7 +356,7 @@
         verify();
     }
 
-    public void testRewindTriggered()
+    public void test_Rewind_Triggered()
     {
         Creator creator = new Creator();
         Submit submit = (Submit) creator.newInstance(Submit.class, new Object[]
@@ -316,7 +393,7 @@
         verify();
     }
 
-    public void testTriggerWithListener()
+    public void test_Trigger_With_Listener()
     {
         IActionListener listener = newListener();
         IForm form = newForm();
@@ -335,7 +412,7 @@
         verify();
     }
 
-    public void testTriggerWithAction()
+    public void test_Trigger_With_Action()
     {
         IActionListener action = newListener();
         MockForm form = new MockForm();
@@ -361,7 +438,7 @@
         verify();
     }
 
-    public void testTriggerWithActionAndSingleParameter()
+    public void test_Trigger_With_Action_And_Single_Parameter()
     {
         IActionListener action = newListener();
         MockForm form = new MockForm();
@@ -390,7 +467,7 @@
         verify();
     }
 
-    public void testTriggerWithDActionAndMultipleParameters()
+    public void test_Trigger_With_Action_And_Multiple_Parameters()
     {
         IActionListener action = newListener();
         MockForm form = new MockForm();
@@ -422,7 +499,7 @@
         verify();
     }
     
-    public void testTriggerWithListenerAndAction()
+    public void test_Trigger_With_Listener_And_Action()
     {
         IActionListener listener = newListener();
         IActionListener action = newListener();
@@ -451,5 +528,5 @@
 
         verify();
     }
-    
+   
 }

Modified: tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/services/impl/TestApplicationSpecificationInitializer.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/services/impl/TestApplicationSpecificationInitializer.java?rev=429203&r1=429202&r2=429203&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/services/impl/TestApplicationSpecificationInitializer.java (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/services/impl/TestApplicationSpecificationInitializer.java Sun Aug  6 15:36:00 2006
@@ -50,7 +50,7 @@
 public class TestApplicationSpecificationInitializer extends BaseComponentTestCase
 {   
     
-    public void testOnClasspath() throws Exception
+    public void test_On_Classpath() throws Exception
     {
         DefaultClassResolver cr = new DefaultClassResolver();
 
@@ -100,7 +100,7 @@
         verify();
     }
 
-    public void testInAppContextFolder() throws Exception
+    public void test_In_App_Context_Folder() throws Exception
     {
         DefaultClassResolver cr = new DefaultClassResolver();
 
@@ -161,7 +161,7 @@
         verify();
     }
 
-    public void testInWebInfFolder() throws Exception
+    public void test_In_Web_Inf_Folder() throws Exception
     {
         DefaultClassResolver cr = new DefaultClassResolver();
 
@@ -224,7 +224,7 @@
         verify();
     }
 
-    public void testNoAppSpec() throws Exception
+    public void test_No_App_Spec() throws Exception
     {
         DefaultClassResolver cr = new DefaultClassResolver();
 
@@ -260,7 +260,7 @@
 
         expect(config.getServletName()).andReturn("wilma");
 
-        log.debug("Could not find an application specification for application servlet wilma.");
+        log.warn("Could not find an application specification for application servlet wilma.");
 
         expect(config.getServletName()).andReturn("wilma");
 
@@ -290,7 +290,7 @@
     /**
      * Test within the Registry, to ensure the module deployment descriptor is well configured.
      */
-    public void testIntegration() throws Exception
+    public void test_Integration() throws Exception
     {
         ServletContext context = newMock(ServletContext.class);
 
@@ -330,4 +330,4 @@
         
         registry.shutdown();
     }
-}
\ No newline at end of file
+}