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 2008/02/05 16:03:00 UTC
svn commit: r618666 - in
/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/form:
Radio.java RadioGroup.java TextField.java
Author: jkuhnert
Date: Tue Feb 5 07:02:53 2008
New Revision: 618666
URL: http://svn.apache.org/viewvc?rev=618666&view=rev
Log:
Fixes TAPESTRY-2124. Radio components needed to have a valid name set during rewind for ValidationDelegate tracking.
Modified:
tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/form/Radio.java
tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/form/RadioGroup.java
tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/form/TextField.java
Modified: tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/form/Radio.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/form/Radio.java?rev=618666&r1=618665&r2=618666&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/form/Radio.java (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/form/Radio.java Tue Feb 5 07:02:53 2008
@@ -101,6 +101,9 @@
int option = group.getNextOptionId();
+ setClientId(group.getName()+option);
+ setName(group.getName());
+
// If not disabled and this is the selected button within the radio group,
// then update set the selection from the group to the value for this
// radio button. This will update the selected parameter of the RadioGroup.
Modified: tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/form/RadioGroup.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/form/RadioGroup.java?rev=618666&r1=618665&r2=618666&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/form/RadioGroup.java (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/form/RadioGroup.java Tue Feb 5 07:02:53 2008
@@ -27,7 +27,7 @@
* href="../../../../../ComponentReference/RadioGroup.html">Component Reference </a>]
* <p>
* As of 4.0, this component can be validated.
- *
+ *
* @author Howard Lewis Ship
* @author Paul Ferraro
*/
@@ -39,7 +39,7 @@
*/
static final String ATTRIBUTE_NAME = "org.apache.tapestry.active.RadioGroup";
-
+
// Cached copy of the value from the selectedBinding
Object _selection;
@@ -119,12 +119,14 @@
*/
protected void prepareForRender(IRequestCycle cycle)
{
+ super.prepareForRender(cycle);
+
if (cycle.getAttribute(ATTRIBUTE_NAME) != null)
throw new ApplicationRuntimeException(Tapestry.getMessage("RadioGroup.may-not-nest"),
- this, null, null);
-
+ this, null, null);
+
cycle.setAttribute(ATTRIBUTE_NAME, this);
-
+
_rendering = true;
_nextOptionId = 0;
}
@@ -134,6 +136,8 @@
*/
protected void cleanupAfterRender(IRequestCycle cycle)
{
+ super.cleanupAfterRender(cycle);
+
_rendering = false;
_selection = null;
@@ -147,28 +151,28 @@
protected void renderFormComponent(IMarkupWriter writer, IRequestCycle cycle)
{
_rewinding = false;
-
+
// For rendering, the Radio components need to know what the current
// selection is, so that the correct one can mark itself 'checked'.
_selection = getBinding("selected").getObject();
-
+
renderDelegatePrefix(writer, cycle);
-
+
writer.begin(getTemplateTagName());
-
+
renderInformalParameters(writer, cycle);
-
+
renderDelegateAttributes(writer, cycle);
-
+
renderBody(writer, cycle);
-
+
writer.end();
-
+
renderDelegateSuffix(writer, cycle);
-
+
getValidatableFieldSupport().renderContributions(this, writer, cycle);
}
-
+
/**
* @see org.apache.tapestry.form.AbstractFormComponent#rewindFormComponent(org.apache.tapestry.IMarkupWriter,
* org.apache.tapestry.IRequestCycle)
@@ -183,9 +187,9 @@
_selectedOption = Integer.parseInt(value);
_rewinding = true;
-
+
renderBody(writer, cycle);
-
+
try
{
getValidatableFieldSupport().validate(this, writer, cycle, _selection);
Modified: tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/form/TextField.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/form/TextField.java?rev=618666&r1=618665&r2=618666&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/form/TextField.java (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/form/TextField.java Tue Feb 5 07:02:53 2008
@@ -77,8 +77,8 @@
renderDelegateSuffix(writer, cycle);
- if (isParameterBound("mask") && !isDisabled()) {
-
+ if (isParameterBound("mask") && !isDisabled())
+ {
PageRenderSupport pageRenderSupport = TapestryUtils.getPageRenderSupport(cycle, this);
Map symbols = new HashMap();