You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tapestry.apache.org by dr...@apache.org on 2010/04/01 08:02:40 UTC
svn commit: r929854 - in /tapestry/tapestry5/trunk/tapestry-core/src:
main/java/org/apache/tapestry5/corelib/components/ test/app1/
test/java/org/apache/tapestry5/integration/app1/
test/java/org/apache/tapestry5/integration/app1/pages/
Author: drobiazko
Date: Thu Apr 1 06:02:40 2010
New Revision: 929854
URL: http://svn.apache.org/viewvc?rev=929854&view=rev
Log:
TAP5-1091: CLONE -Handler method of LinkSubmit component should accept a context
Modified:
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/LinkSubmit.java
tapestry/tapestry5/trunk/tapestry-core/src/test/app1/LinkSubmitDemo.tml
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/FormTests.java
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/LinkSubmitDemo.java
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/LinkSubmit.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/LinkSubmit.java?rev=929854&r1=929853&r2=929854&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/LinkSubmit.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/LinkSubmit.java Thu Apr 1 06:02:40 2010
@@ -63,6 +63,15 @@ public class LinkSubmit implements Clien
*/
@Parameter
private boolean defer = true;
+
+ /**
+ * The list of values that will be made available to event handler method of this component when the form is
+ * submitted.
+ *
+ * @since 5.2.0
+ */
+ @Parameter
+ private Object[] context;
@Inject
private ComponentResources resources;
@@ -110,7 +119,7 @@ public class LinkSubmit implements Clien
{
public void run()
{
- resources.triggerEvent(event, null, eventCallback);
+ resources.triggerEvent(event, context, eventCallback);
}
};
Modified: tapestry/tapestry5/trunk/tapestry-core/src/test/app1/LinkSubmitDemo.tml
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/app1/LinkSubmitDemo.tml?rev=929854&r1=929853&r2=929854&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/app1/LinkSubmitDemo.tml (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/app1/LinkSubmitDemo.tml Thu Apr 1 06:02:40 2010
@@ -1,12 +1,14 @@
<html t:type="border" xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
<h1>Link Submit Demo</h1>
+
+ <p>Result: ${result}.</p>
<t:form>
<t:errors/>
<t:textfield t:id="name"/>
<br/>
- <t:linksubmit t:id="fred">Fred</t:linksubmit>
+ <t:linksubmit t:id="fred" context="formContext">Fred</t:linksubmit>
<t:linksubmit t:id="barney" defer="true" event="neighbor">Barney</t:linksubmit>
</t:form>
Modified: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/FormTests.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/FormTests.java?rev=929854&r1=929853&r2=929854&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/FormTests.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/FormTests.java Thu Apr 1 06:02:40 2010
@@ -701,6 +701,7 @@ public class FormTests extends TapestryC
assertText("name-value", "Wilma");
assertText("last-clicked", "Fred");
+ assertTextPresent("Result: 10.14159");
type("name", "Betty");
clickAndWait("link=Barney");
Modified: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/LinkSubmitDemo.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/LinkSubmitDemo.java?rev=929854&r1=929853&r2=929854&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/LinkSubmitDemo.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/LinkSubmitDemo.java Thu Apr 1 06:02:40 2010
@@ -28,8 +28,22 @@ public class LinkSubmitDemo
@Property
@Persist
private String lastClicked;
+
+ @Persist
+ @Property
+ private Double result;
+
+ public Object[] getFormContext()
+ {
+ return new Object[]{new Integer(7), new Double(3.14159)};
+ }
- void onSelectedFromFred() { lastClicked = "Fred"; }
+ void onSelectedFromFred(Integer first, Double second)
+ {
+ lastClicked = "Fred";
+
+ result = first + second;
+ }
void onNeighbor() { lastClicked = "Barney"; }
}