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/07/25 01:50:06 UTC
svn commit: r425230 - in /tapestry/tapestry4/trunk:
src/site/xdoc/components/ tapestry-framework/src/java/org/apache/tapestry/
tapestry-framework/src/java/org/apache/tapestry/form/
tapestry-framework/src/java/org/apache/tapestry/html/ tapestry-framewor...
Author: jkuhnert
Date: Mon Jul 24 16:50:05 2006
New Revision: 425230
URL: http://svn.apache.org/viewvc?rev=425230&view=rev
Log:
Reverted changes made to form submit components that replaced current listener parameter with the current action parameter
behaviour.(Among other things, this breaks For).
Also added a new disableCaching parameter to Shell component to allow control over the META caching tag, which is now set
to true for tapestry exception pages as per TAPESTRY-624
Modified:
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/Shell.xml
tapestry/tapestry4/trunk/src/site/xdoc/components/Submit.xml
tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/AbstractComponent.java
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.jwc
tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/form/LinkSubmit.jwc
tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/form/Submit.jwc
tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/html/Shell.java
tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/html/Shell.jwc
tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/pages/Exception.html
tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/pages/StaleLink.html
tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/pages/StaleSession.html
tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/form/TestSubmit.java
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=425230&r1=425229&r2=425230&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/src/site/xdoc/components/ImageSubmit.xml (original)
+++ tapestry/tapestry4/trunk/src/site/xdoc/components/ImageSubmit.xml Mon Jul 24 16:50:05 2006
@@ -162,13 +162,20 @@
<td>no</td>
<td></td>
<td>
- A listener that is notified if this component is triggered just before
- the form's listener, after all components enclosed by the Form have had
- a chance to update their properties.
+ An optional listener (typically specified as the name of a listener
+ method), notified when the Submit is triggered.
+
+ <p>
+ When invoking listeners invoked within a <a href="For.html">For</a> loop this
+ listener should be used.
+ </p>
<p>
- This parameter now behaves exactly like the current action= parameter, making
- action deprecated.
+ This parameter should <strong>not</strong> be used in the majority of cases as the
+ listener is notified before all form data has been captured on the server. Only use
+ this when you know you are going to redirect or do some other cancelling sort of action
+ that isn't likely to alter form state. Use <em>action</em> as your preferred listener
+ method parameter.
</p>
</td>
</tr>
@@ -189,7 +196,8 @@
a chance to update their properties.
<p>
- This parameter is now deprecated and marked for removal in Tapestry 4.2.
+ If you are going to notify a listener, this is probably the parameter you want
+ to bind to.
</p>
</td>
</tr>
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=425230&r1=425229&r2=425230&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/src/site/xdoc/components/LinkSubmit.xml (original)
+++ tapestry/tapestry4/trunk/src/site/xdoc/components/LinkSubmit.xml Mon Jul 24 16:50:05 2006
@@ -103,13 +103,20 @@
<td>no</td>
<td></td>
<td>
- A listener that is notified if this component is triggered just before
- the form's listener, after all components enclosed by the Form have had
- a chance to update their properties.
+ An optional listener (typically specified as the name of a listener
+ method), notified when the Submit is triggered.
+
+ <p>
+ When invoking listeners invoked within a <a href="For.html">For</a> loop this
+ listener should be used.
+ </p>
<p>
- This parameter now behaves exactly like the current action= parameter, making
- action deprecated.
+ This parameter should <strong>not</strong> be used in the majority of cases as the
+ listener is notified before all form data has been captured on the server. Only use
+ this when you know you are going to redirect or do some other cancelling sort of action
+ that isn't likely to alter form state. Use <em>action</em> as your preferred listener
+ method parameter.
</p>
</td>
</tr>
@@ -130,7 +137,8 @@
a chance to update their properties.
<p>
- This parameter is now deprecated and marked for removal in Tapestry 4.2.
+ If you are going to notify a listener, this is probably the parameter you want
+ to bind to.
</p>
</td>
</tr>
Modified: tapestry/tapestry4/trunk/src/site/xdoc/components/Shell.xml
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/src/site/xdoc/components/Shell.xml?rev=425230&r1=425229&r2=425230&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/src/site/xdoc/components/Shell.xml (original)
+++ tapestry/tapestry4/trunk/src/site/xdoc/components/Shell.xml Mon Jul 24 16:50:05 2006
@@ -150,7 +150,16 @@
refresh.
</td>
</tr>
-
+ <tr>
+ <td>disableCaching</td>
+ <td>boolean</td>
+ <td>no</td>
+ <td>false</td>
+ <td>
+ If provided, then a <meta> tag will be written setting the
+ content="nocache" value to try and prevent browser caching of page.
+ </td>
+ </tr>
<tr>
<td>delegate</td>
<td>
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=425230&r1=425229&r2=425230&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/src/site/xdoc/components/Submit.xml (original)
+++ tapestry/tapestry4/trunk/src/site/xdoc/components/Submit.xml Mon Jul 24 16:50:05 2006
@@ -144,13 +144,20 @@
<td>no</td>
<td></td>
<td>
- A listener that is notified if this component is triggered just before
- the form's listener, after all components enclosed by the Form have had
- a chance to update their properties.
+ An optional listener (typically specified as the name of a listener
+ method), notified when the Submit is triggered.
+
+ <p>
+ When invoking listeners invoked within a <a href="For.html">For</a> loop this
+ listener should be used.
+ </p>
<p>
- This parameter now behaves exactly like the current action= parameter, making
- action deprecated.
+ This parameter should <strong>not</strong> be used in the majority of cases as the
+ listener is notified before all form data has been captured on the server. Only use
+ this when you know you are going to redirect or do some other cancelling sort of action
+ that isn't likely to alter form state. Use <em>action</em> as your preferred listener
+ method parameter.
</p>
</td>
</tr>
@@ -171,7 +178,8 @@
a chance to update their properties.
<p>
- This parameter is now deprecated and marked for removal in Tapestry 4.2.
+ If you are going to notify a listener, this is probably the parameter you want
+ to bind to.
</p>
</td>
</tr>
Modified: tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/AbstractComponent.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/AbstractComponent.java?rev=425230&r1=425229&r2=425230&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/AbstractComponent.java (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/AbstractComponent.java Mon Jul 24 16:50:05 2006
@@ -689,8 +689,8 @@
/**
* Invoked by {@link #render(IMarkupWriter, IRequestCycle)}to prepare the component to render.
- * This implementation sets JavaBeans properties from matching bound parameters. This
- * implementation does nothing.
+ * This implementation sets JavaBeans properties from matching bound parameters. The default
+ * implementation of this method is empty.
*
* @since 2.0.3
*/
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=425230&r1=425229&r2=425230&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 Mon Jul 24 16:50:05 2006
@@ -75,19 +75,10 @@
{ parameters });
}
}
-
- // Defer 'listener' for later
- if (listener != null) {
- Runnable notify = new Runnable()
- {
- public void run()
- {
- listenerInvoker.invokeListener(listener, AbstractSubmit.this, cycle);
- }
- };
-
- form.addDeferredRunnable(notify);
- }
+
+ // Invoke 'listener' now, but defer 'action' for later
+ if (listener != null)
+ listenerInvoker.invokeListener(listener, AbstractSubmit.this, cycle);
if (action != null) {
Runnable notify = new Runnable()
@@ -104,13 +95,8 @@
/** parameter. */
public abstract IActionListener getListener();
-
- /**
- * Parameter for which listener to call when submitted.
- *
- * @deprecated To be completely removed in 4.2, use {@link #getListener()} instead.
- * @return
- */
+
+ /** parameter. */
public abstract IActionListener getAction();
/** parameter. */
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=425230&r1=425229&r2=425230&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 Mon Jul 24 16:50:05 2006
@@ -57,9 +57,7 @@
<parameter name="listener">
<description>
- A listener that is notified if this component is triggered
- just before the form's listener, after all components
- enclosed by the Form have had a chance to update their properties.
+ Notified when the button is clicked.
</description>
</parameter>
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=425230&r1=425229&r2=425230&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 Mon Jul 24 16:50:05 2006
@@ -32,9 +32,7 @@
<parameter name="listener">
<description>
- A listener that is notified if this component is triggered
- just before the form's listener, after all components
- enclosed by the Form have had a chance to update their properties.
+ A listener that is notified if this component is triggered.
</description>
</parameter>
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=425230&r1=425229&r2=425230&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 Mon Jul 24 16:50:05 2006
@@ -52,9 +52,7 @@
</parameter>
<parameter name="listener">
<description>
- A listener that is notified if this component is triggered
- just before the form's listener, after all components
- enclosed by the Form have had a chance to update their properties.
+ A listener that is notified if this component is triggered.
</description>
</parameter>
<parameter name="action" deprecated="yes">
Modified: tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/html/Shell.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/html/Shell.java?rev=425230&r1=425229&r2=425230&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/html/Shell.java (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/html/Shell.java Mon Jul 24 16:50:05 2006
@@ -72,6 +72,9 @@
writeMetaTag(writer, "name", "generator", GENERATOR_CONTENT);
+ if (isDisableCaching())
+ writeMetaTag(writer, "http-equiv", "content", "no-cache");
+
if (getRenderContentType())
writeMetaTag(writer, "http-equiv", "Content-Type", writer.getContentType());
@@ -181,6 +184,8 @@
writer.attribute("content", content);
writer.println();
}
+
+ public abstract boolean isDisableCaching();
public abstract boolean isAjaxEnabled();
Modified: tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/html/Shell.jwc
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/html/Shell.jwc?rev=425230&r1=425229&r2=425230&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/html/Shell.jwc (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/html/Shell.jwc Mon Jul 24 16:50:05 2006
@@ -99,6 +99,13 @@
</description>
</parameter>
+ <parameter name="disableCaching" default-value="false" >
+ <description>
+ If set, causes a META tag to be written with a value of no-cache to prevent browser caching of
+ whichever page is rendered.
+ </description>
+ </parameter>
+
<parameter name="ajaxDelegate"
default-value="bean:coreAjaxDelegate" >
<description>
Modified: tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/pages/Exception.html
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/pages/Exception.html?rev=425230&r1=425229&r2=425230&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/pages/Exception.html (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/pages/Exception.html Mon Jul 24 16:50:05 2006
@@ -14,7 +14,7 @@
limitations under the License.
-->
<span jwcid="$content$">
-<html jwcid="@Shell" title="Exception" stylesheet="ognl:assets.stylesheet" doctype="ognl:''" ajaxEnabled="true">
+<html jwcid="@Shell" title="Exception" stylesheet="ognl:assets.stylesheet" disableCaching="true" doctype="ognl:''">
<body>
<span class="exception-header">
Modified: tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/pages/StaleLink.html
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/pages/StaleLink.html?rev=425230&r1=425229&r2=425230&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/pages/StaleLink.html (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/pages/StaleLink.html Mon Jul 24 16:50:05 2006
@@ -1,5 +1,5 @@
-<span jwcid="@Shell" stylesheet="ognl:assets.stylesheet" doctype="ognl:''" title="Stale Link">
+<span jwcid="@Shell" stylesheet="ognl:assets.stylesheet" disableCaching="true" doctype="ognl:''" title="Stale Link">
<body>
Modified: tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/pages/StaleSession.html
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/pages/StaleSession.html?rev=425230&r1=425229&r2=425230&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/pages/StaleSession.html (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/pages/StaleSession.html Mon Jul 24 16:50:05 2006
@@ -1,5 +1,5 @@
-<span jwcid="@Shell" title="Stale Session" doctype="ognl:''" stylesheet="ognl:assets.stylesheet">
+<span jwcid="@Shell" title="Stale Session" disableCaching="true" doctype="ognl:''" stylesheet="ognl:assets.stylesheet">
<body>
Your session has timed out.
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=425230&r1=425229&r2=425230&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 Mon Jul 24 16:50:05 2006
@@ -319,24 +319,18 @@
public void testTriggerWithListener()
{
IActionListener listener = newListener();
- MockForm form = new MockForm();
+ IForm form = newForm();
IRequestCycle cycle = newCycle();
Creator creator = new Creator();
Submit submit = (Submit) creator.newInstance(Submit.class, new Object[]
{ "listener", listener, "listenerInvoker", new ListenerInvokerTerminator() });
-
- replay();
-
- submit.handleClick(cycle, form);
- verify();
-
listener.actionTriggered(submit, cycle);
replay();
- form.runDeferred();
+ submit.handleClick(cycle, form);
verify();
}
@@ -440,17 +434,17 @@
Submit submit = (Submit) creator.newInstance(Submit.class, new Object[]
{ "listener", listener, "action", action, "listenerInvoker",
new ListenerInvokerTerminator() });
+
+ listener.actionTriggered(submit, cycle);
replay();
submit.handleClick(cycle, form);
verify();
-
- listener.actionTriggered(submit, cycle);
-
+
action.actionTriggered(submit, cycle);
-
+
replay();
form.runDeferred();