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/09/29 17:55:08 UTC
svn commit: r580600 - in /tapestry/tapestry5/trunk/tapestry-core/src:
main/java/org/apache/tapestry/corelib/components/ test/app1/
test/java/org/apache/tapestry/integration/
test/java/org/apache/tapestry/integration/app1/pages/
Author: hlship
Date: Sat Sep 29 08:55:08 2007
New Revision: 580600
URL: http://svn.apache.org/viewvc?rev=580600&view=rev
Log:
TAPESTRY-1709: Radio component throws an exception when used with RadioGroup and Label
Modified:
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/components/Radio.java
tapestry/tapestry5/trunk/tapestry-core/src/test/app1/RadioDemo.tml
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/IntegrationTests.java
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/app1/pages/RadioDemo.java
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/components/Radio.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/components/Radio.java?rev=580600&r1=580599&r2=580600&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/components/Radio.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/components/Radio.java Sat Sep 29 08:55:08 2007
@@ -81,6 +81,8 @@
private String _clientId;
+ private String _elementName;
+
/**
* If true, then the field will render out with a disabled attribute (to turn off client-side
* behavior). Further, a disabled field ignores any value in the request when the form is
@@ -99,12 +101,9 @@
return _defaultProvider.defaultBinding("value", _resources);
}
- /**
- * Returns the element name from the {@link RadioContainer#getElementName() container}.
- */
public String getElementName()
{
- return _container.getElementName();
+ return _elementName;
}
public String getLabel()
@@ -131,6 +130,7 @@
String value = _container.toClient(_value);
_clientId = _pageRenderSupport.allocateClientId(_resources.getId());
+ _elementName = _container.getElementName();
writer.element(
"input",
@@ -139,7 +139,7 @@
"id",
_clientId,
"name",
- getElementName(),
+ _elementName,
"value",
value);
Modified: tapestry/tapestry5/trunk/tapestry-core/src/test/app1/RadioDemo.tml
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/app1/RadioDemo.tml?rev=580600&r1=580599&r2=580600&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/app1/RadioDemo.tml (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/app1/RadioDemo.tml Sat Sep 29 08:55:08 2007
@@ -1,27 +1,47 @@
-<html t:type="Border" xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
+<html t:type="Border"
+ xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
<h1>Radio Demo</h1>
- <p>Choose a department: </p>
+ <p>Choose a department and position:</p>
<t:form>
<t:radiogroup t:id="department">
<t:loop source="departments" value="loopValue">
<p>
- <t:radio t:id="radio" value="loopValue" label="prop:label"/>
- <t:label for="radio"/>
+ <t:radio t:id="radio" value="loopValue" label="prop:label" />
+ <t:label for="radio" />
</p>
</t:loop>
</t:radiogroup>
+
+ <br />
+
+ <t:radiogroup t:id="position">
+ <p>
+ <t:radio t:id="radio1" value="literal:TEMP" label="Temp" />
+ <t:label for="radio1" />
+ </p>
+ <p>
+ <t:radio t:id="radio2" value="literal:LIFER" label="Lifer" />
+ <t:label for="radio2" />
+ </p>
+ </t:radiogroup>
+
<p>
- <input type="submit" value="Update"/>
+ <input type="submit" value="Update" />
</p>
</t:form>
<t:if test="department">
- <hr/>
+ <hr />
Selected department: ${department}
+ </t:if>
+
+ <t:if test="position">
+ <hr />
+ Selected position: ${position}
</t:if>
</html>
Modified: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/IntegrationTests.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/IntegrationTests.java?rev=580600&r1=580599&r2=580600&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/IntegrationTests.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/IntegrationTests.java Sat Sep 29 08:55:08 2007
@@ -1021,17 +1021,23 @@
String update = "//input[@type='submit']";
+ // in a loop ...
click("//label[.='Accounting']");
-
clickAndWait(update);
-
assertTextPresent("Selected department: ACCOUNTING");
click("//label[.='Sales And Marketing']");
+ clickAndWait(update);
+ assertTextPresent("Selected department: SALES_AND_MARKETING");
+ // not in a loop ...
+ click("//label[.='Temp']");
clickAndWait(update);
+ assertTextPresent("Selected position: TEMP");
- assertTextPresent("Selected department: SALES_AND_MARKETING");
+ click("//label[.='Lifer']");
+ clickAndWait(update);
+ assertTextPresent("Selected position: LIFER");
}
@Test
Modified: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/app1/pages/RadioDemo.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/app1/pages/RadioDemo.java?rev=580600&r1=580599&r2=580600&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/app1/pages/RadioDemo.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/app1/pages/RadioDemo.java Sat Sep 29 08:55:08 2007
@@ -25,6 +25,9 @@
@Persist
private Department _department;
+ @Persist
+ private String _position;
+
private Department _loopValue;
@Inject
@@ -40,6 +43,11 @@
return _department;
}
+ public String getPosition()
+ {
+ return _position;
+ }
+
public Department getLoopValue()
{
return _loopValue;
@@ -48,6 +56,11 @@
public void setDepartment(Department department)
{
_department = department;
+ }
+
+ public void setPosition(String position)
+ {
+ _position = position;
}
public void setLoopValue(Department loopValue)