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 2008/09/10 20:49:29 UTC

svn commit: r693926 - /tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Submit.java

Author: hlship
Date: Wed Sep 10 11:49:28 2008
New Revision: 693926

URL: http://svn.apache.org/viewvc?rev=693926&view=rev
Log:
TAPESTRY-2638: The name of the event triggered by a Submit component should be configurable, to allow for multiple components that trigger the same event handler method

Modified:
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Submit.java

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Submit.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Submit.java?rev=693926&r1=693925&r2=693926&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Submit.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Submit.java Wed Sep 10 11:49:28 2008
@@ -14,6 +14,7 @@
 
 package org.apache.tapestry5.corelib.components;
 
+import org.apache.tapestry5.BindingConstants;
 import org.apache.tapestry5.ComponentResources;
 import org.apache.tapestry5.MarkupWriter;
 import org.apache.tapestry5.annotations.Environmental;
@@ -42,6 +43,13 @@
     @Parameter
     private boolean defer = true;
 
+    /**
+     * The name of the event that will be triggered if this component is the cause of the form submission. The default
+     * is "selected".
+     */
+    @Parameter(allowNull = false, defaultPrefix = BindingConstants.LITERAL)
+    private String event = SELECTED_EVENT;
+
     @Environmental
     private FormSupport formSupport;
 
@@ -90,7 +98,7 @@
         {
             public void run()
             {
-                resources.triggerEvent(SELECTED_EVENT, null, null);
+                resources.triggerEvent(event, null, null);
             }
         };
 
@@ -100,7 +108,6 @@
 
         if (defer) formSupport.defer(sendNotification);
         else heartbeat.defer(sendNotification);
-
     }
 
     // For testing: