You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tapestry.apache.org by hl...@apache.org on 2007/02/06 22:39:03 UTC

svn commit: r504306 - in /tapestry/tapestry5/tapestry-core/trunk/src: main/java/org/apache/tapestry/corelib/components/ main/resources/org/apache/tapestry/corelib/components/ test/app1/WEB-INF/ test/java/org/apache/tapestry/integration/

Author: hlship
Date: Tue Feb  6 13:39:02 2007
New Revision: 504306

URL: http://svn.apache.org/viewvc?view=rev&rev=504306
Log:
Add a parameter to allow the label of the BeanEditForm's submit button to be customized.

Modified:
    tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/corelib/components/BeanEditForm.java
    tapestry/tapestry5/tapestry-core/trunk/src/main/resources/org/apache/tapestry/corelib/components/BeanEditForm.html
    tapestry/tapestry5/tapestry-core/trunk/src/main/resources/org/apache/tapestry/corelib/components/BeanEditForm.properties
    tapestry/tapestry5/tapestry-core/trunk/src/test/app1/WEB-INF/BeanEditorDemo.html
    tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/integration/IntegrationTests.java

Modified: tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/corelib/components/BeanEditForm.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/corelib/components/BeanEditForm.java?view=diff&rev=504306&r1=504305&r2=504306
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/corelib/components/BeanEditForm.java (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/corelib/components/BeanEditForm.java Tue Feb  6 13:39:02 2007
@@ -60,6 +60,9 @@
 @SupportsInformalParameters
 public class BeanEditForm
 {
+    @Parameter(value = "message:submit-label", defaultPrefix = "literal")
+    private String _submitLabel;
+
     /** The object to be editted by the BeanEditor. */
     @Parameter(required = true)
     private Object _object;
@@ -249,5 +252,10 @@
     public Form getForm()
     {
         return _form;
+    }
+
+    public String getSubmitLabel()
+    {
+        return _submitLabel;
     }
 }

Modified: tapestry/tapestry5/tapestry-core/trunk/src/main/resources/org/apache/tapestry/corelib/components/BeanEditForm.html
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/main/resources/org/apache/tapestry/corelib/components/BeanEditForm.html?view=diff&rev=504306&r1=504305&r2=504306
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/main/resources/org/apache/tapestry/corelib/components/BeanEditForm.html (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/main/resources/org/apache/tapestry/corelib/components/BeanEditForm.html Tue Feb  6 13:39:02 2007
@@ -7,7 +7,7 @@
             <t:comp type="Delegate" to="blockForProperty"/>
         </div>
         <div class="t-beaneditor-row">
-            <input type="submit" value="Create/Update"/>
+            <input t:type="Submit" type="submit" value="prop:submitLabel"/>
         </div>
     </div>
     

Modified: tapestry/tapestry5/tapestry-core/trunk/src/main/resources/org/apache/tapestry/corelib/components/BeanEditForm.properties
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/main/resources/org/apache/tapestry/corelib/components/BeanEditForm.properties?view=diff&rev=504306&r1=504305&r2=504306
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/main/resources/org/apache/tapestry/corelib/components/BeanEditForm.properties (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/main/resources/org/apache/tapestry/corelib/components/BeanEditForm.properties Tue Feb  6 13:39:02 2007
@@ -13,3 +13,4 @@
 # limitations under the License.
 
 no-editor=The BeanEditor component does not include an editor of type '%s' (for property '%s').
+submit-label=Create/Update

Modified: tapestry/tapestry5/tapestry-core/trunk/src/test/app1/WEB-INF/BeanEditorDemo.html
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/test/app1/WEB-INF/BeanEditorDemo.html?view=diff&rev=504306&r1=504305&r2=504306
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/test/app1/WEB-INF/BeanEditorDemo.html (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/test/app1/WEB-INF/BeanEditorDemo.html Tue Feb  6 13:39:02 2007
@@ -1,16 +1,16 @@
-<t:comp type="Border" xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
-    <h1>BeanEditor Component Demo</h1>
-    
-    <t:comp id="edit" object="registrationData">
-    
-    <t:parameter name="firstName">
-    	<label t:type="Label" for="firstName"/>
-		<input t:type="TextField" t:id="firstName" value="registrationData.firstName" size="40"/> (First Name is Required)
-	</t:parameter>
-	    	
-    </t:comp>
-              
-    <p>
-        [<a t:type="ActionLink" t:id="clear">Clear Data</a>]
-    </p>        
-</t:comp>
\ No newline at end of file
+<t:comp type="Border"
+	xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
+	<h1>BeanEditor Component Demo</h1>
+
+	<t:comp id="edit" object="registrationData" submitlabel="Register">
+
+		<t:parameter name="firstName">
+			<label t:type="Label" for="firstName" /> <input t:type="TextField"
+				t:id="firstName" value="registrationData.firstName" size="40" />
+			(First Name is Required) 
+		</t:parameter>
+
+	</t:comp>
+
+	<p>[<a t:type="ActionLink" t:id="clear">Clear Data</a>]</p>
+</t:comp>

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=504306&r1=504305&r2=504306
==============================================================================
--- 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 Tue Feb  6 13:39:02 2007
@@ -708,7 +708,7 @@
     @Test
     public void bean_editor()
     {
-        String submitButton = "//input[@value='Create/Update']";
+        String submitButton = "//input[@id='submit']";
 
         _selenium.open(BASE_URL);
         clickAndWait("link=BeanEditor Demo");
@@ -720,8 +720,14 @@
                 "Everyone has to have a last name!",
                 "Year of Birth requires a value of at least 1900.");
 
+        // Part of the override for the firstName property
+
         assertText("//input[@id='firstName']/@size", "40");
-        
+
+        // Check override of the submit label
+
+        assertText("//input[@id='submit']/@value", "Register");
+
         _selenium.type("firstName", "a");
         _selenium.type("lastName", "b");
         _selenium.type("birthYear", "");