struts-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mr...@apache.org
Subject svn commit: r649823 - in /struts/struts2/trunk/core/src: main/resources/template/simple/ test/java/org/apache/struts2/views/jsp/ui/ test/resources/org/apache/struts2/views/jsp/ui/
Date Sat, 19 Apr 2008 14:55:35 GMT
Author: mrdon
Date: Sat Apr 19 07:55:33 2008
New Revision: 649823

URL: http://svn.apache.org/viewvc?rev=649823&view=rev
Log:
Better handling of disabled checkboxes
WW-2499

Added:
    struts/struts2/trunk/core/src/test/resources/org/apache/struts2/views/jsp/ui/Checkbox-6.txt
Modified:
    struts/struts2/trunk/core/src/main/resources/template/simple/checkbox.ftl
    struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/ui/CheckboxTest.java
    struts/struts2/trunk/core/src/test/resources/org/apache/struts2/views/jsp/ui/Checkbox-1.txt
    struts/struts2/trunk/core/src/test/resources/org/apache/struts2/views/jsp/ui/Checkbox-2.txt
    struts/struts2/trunk/core/src/test/resources/org/apache/struts2/views/jsp/ui/Checkbox-3.txt
    struts/struts2/trunk/core/src/test/resources/org/apache/struts2/views/jsp/ui/Checkbox-33.txt
    struts/struts2/trunk/core/src/test/resources/org/apache/struts2/views/jsp/ui/Checkbox-4.txt
    struts/struts2/trunk/core/src/test/resources/org/apache/struts2/views/jsp/ui/Checkbox-5.txt

Modified: struts/struts2/trunk/core/src/main/resources/template/simple/checkbox.ftl
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/resources/template/simple/checkbox.ftl?rev=649823&r1=649822&r2=649823&view=diff
==============================================================================
--- struts/struts2/trunk/core/src/main/resources/template/simple/checkbox.ftl (original)
+++ struts/struts2/trunk/core/src/main/resources/template/simple/checkbox.ftl Sat Apr 19 07:55:33
2008
@@ -44,4 +44,8 @@
 <#include "/${parameters.templateDir}/simple/common-attributes.ftl" />
 <#include "/${parameters.templateDir}/simple/dynamic-attributes.ftl" />
 />
-<input type="hidden" name="__checkbox_${parameters.name?html}" value="${parameters.fieldValue?html}"
/>
\ No newline at end of file
+<input type="hidden" id="__checkbox_${parameters.id?html}" name="__checkbox_${parameters.name?html}"
value="${parameters.fieldValue?html}"<#rt/>
+<#if parameters.disabled?default(false)>
+ disabled="disabled"<#rt/>
+</#if>
+ /> 
\ No newline at end of file

Modified: struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/ui/CheckboxTest.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/ui/CheckboxTest.java?rev=649823&r1=649822&r2=649823&view=diff
==============================================================================
--- struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/ui/CheckboxTest.java
(original)
+++ struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/ui/CheckboxTest.java
Sat Apr 19 07:55:33 2008
@@ -178,4 +178,22 @@
 
         verify(CheckboxTag.class.getResource("Checkbox-2.txt"));
     }
+    
+    public void testDisabled() throws Exception {
+        TestAction testAction = (TestAction) action;
+        testAction.setFoo("true");
+
+        CheckboxTag tag = new CheckboxTag();
+        tag.setPageContext(pageContext);
+        tag.setLabel("mylabel");
+        tag.setName("foo");
+        tag.setFieldValue("baz");
+        tag.setTitle("mytitle");
+        tag.setDisabled("true");
+
+        tag.doStartTag();
+        tag.doEndTag();
+
+        verify(CheckboxTag.class.getResource("Checkbox-6.txt"));
+    }
 }

Modified: struts/struts2/trunk/core/src/test/resources/org/apache/struts2/views/jsp/ui/Checkbox-1.txt
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/test/resources/org/apache/struts2/views/jsp/ui/Checkbox-1.txt?rev=649823&r1=649822&r2=649823&view=diff
==============================================================================
--- struts/struts2/trunk/core/src/test/resources/org/apache/struts2/views/jsp/ui/Checkbox-1.txt
(original)
+++ struts/struts2/trunk/core/src/test/resources/org/apache/struts2/views/jsp/ui/Checkbox-1.txt
Sat Apr 19 07:55:33 2008
@@ -3,7 +3,7 @@
 	</td>
     <td valign="top" align="left">
 		<input type="checkbox" name="foo" value="baz" checked="checked" id="someId" title="mytitle"
onfocus="test();"/>
-		<input type="hidden" name="__checkbox_foo" value="baz"/>
+		<input type="hidden" id="__checkbox_someId" name="__checkbox_foo" value="baz"/>
         <label for="someId" class="checkboxLabel">mylabel</label>
     </td>
 </tr>

Modified: struts/struts2/trunk/core/src/test/resources/org/apache/struts2/views/jsp/ui/Checkbox-2.txt
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/test/resources/org/apache/struts2/views/jsp/ui/Checkbox-2.txt?rev=649823&r1=649822&r2=649823&view=diff
==============================================================================
--- struts/struts2/trunk/core/src/test/resources/org/apache/struts2/views/jsp/ui/Checkbox-2.txt
(original)
+++ struts/struts2/trunk/core/src/test/resources/org/apache/struts2/views/jsp/ui/Checkbox-2.txt
Sat Apr 19 07:55:33 2008
@@ -3,7 +3,7 @@
 	</td>
     <td valign="top" align="left">
         <input type="checkbox" name="foo" value="baz" id="foo" title="mytitle"/>
-        <input type="hidden" name="__checkbox_foo" value="baz"/>
+        <input type="hidden" id="__checkbox_foo" name="__checkbox_foo" value="baz"/>
         <label for="foo" class="checkboxLabel">mylabel</label>
     </td>
 </tr>

Modified: struts/struts2/trunk/core/src/test/resources/org/apache/struts2/views/jsp/ui/Checkbox-3.txt
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/test/resources/org/apache/struts2/views/jsp/ui/Checkbox-3.txt?rev=649823&r1=649822&r2=649823&view=diff
==============================================================================
--- struts/struts2/trunk/core/src/test/resources/org/apache/struts2/views/jsp/ui/Checkbox-3.txt
(original)
+++ struts/struts2/trunk/core/src/test/resources/org/apache/struts2/views/jsp/ui/Checkbox-3.txt
Sat Apr 19 07:55:33 2008
@@ -10,7 +10,7 @@
 	</td>
     <td valign="top" align="left">
           <input type="checkbox" name="foo" value="baz" checked="checked" id="foo" class="myErrorClass"
title="mytitle" onclick="test();" ondblclick="test();"/>
-          <input type="hidden" name="__checkbox_foo" value="baz"/>
+          <input type="hidden" id="__checkbox_foo" name="__checkbox_foo" value="baz"/>
           <label for="foo" class="checkboxErrorLabel">mylabel</label>
     </td>
 </tr>

Modified: struts/struts2/trunk/core/src/test/resources/org/apache/struts2/views/jsp/ui/Checkbox-33.txt
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/test/resources/org/apache/struts2/views/jsp/ui/Checkbox-33.txt?rev=649823&r1=649822&r2=649823&view=diff
==============================================================================
--- struts/struts2/trunk/core/src/test/resources/org/apache/struts2/views/jsp/ui/Checkbox-33.txt
(original)
+++ struts/struts2/trunk/core/src/test/resources/org/apache/struts2/views/jsp/ui/Checkbox-33.txt
Sat Apr 19 07:55:33 2008
@@ -10,7 +10,7 @@
 	</td>
     <td valign="top" align="left">
           <input type="checkbox" name="foo" value="baz" checked="checked" id="foo" style="color:red"
title="mytitle" onclick="test();" ondblclick="test();"/>
-          <input type="hidden" name="__checkbox_foo" value="baz"/>
+          <input type="hidden" id="__checkbox_foo" name="__checkbox_foo" value="baz"/>
           <label for="foo" class="checkboxErrorLabel">mylabel</label>
     </td>
 </tr>

Modified: struts/struts2/trunk/core/src/test/resources/org/apache/struts2/views/jsp/ui/Checkbox-4.txt
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/test/resources/org/apache/struts2/views/jsp/ui/Checkbox-4.txt?rev=649823&r1=649822&r2=649823&view=diff
==============================================================================
--- struts/struts2/trunk/core/src/test/resources/org/apache/struts2/views/jsp/ui/Checkbox-4.txt
(original)
+++ struts/struts2/trunk/core/src/test/resources/org/apache/struts2/views/jsp/ui/Checkbox-4.txt
Sat Apr 19 07:55:33 2008
@@ -6,6 +6,6 @@
 <tr>
     <td colspan="2">
 		<input type="checkbox" name="foo" value="baz" checked="checked" id="someId" title="mytitle"
onfocus="test();"/>
-		<input type="hidden" name="__checkbox_foo" value="baz"/>
+		<input type="hidden" id="__checkbox_someId" name="__checkbox_foo" value="baz"/>
     </td>
 </tr>

Modified: struts/struts2/trunk/core/src/test/resources/org/apache/struts2/views/jsp/ui/Checkbox-5.txt
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/test/resources/org/apache/struts2/views/jsp/ui/Checkbox-5.txt?rev=649823&r1=649822&r2=649823&view=diff
==============================================================================
--- struts/struts2/trunk/core/src/test/resources/org/apache/struts2/views/jsp/ui/Checkbox-5.txt
(original)
+++ struts/struts2/trunk/core/src/test/resources/org/apache/struts2/views/jsp/ui/Checkbox-5.txt
Sat Apr 19 07:55:33 2008
@@ -4,6 +4,6 @@
 	</td>
     <td valign="top" align="left">
 		<input type="checkbox" name="foo" value="baz" checked="checked" id="someId" title="mytitle"
onfocus="test();"/>
-		<input type="hidden" name="__checkbox_foo" value="baz"/>
+		<input type="hidden" id="__checkbox_someId" name="__checkbox_foo" value="baz"/>
     </td>
 </tr>

Added: struts/struts2/trunk/core/src/test/resources/org/apache/struts2/views/jsp/ui/Checkbox-6.txt
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/test/resources/org/apache/struts2/views/jsp/ui/Checkbox-6.txt?rev=649823&view=auto
==============================================================================
--- struts/struts2/trunk/core/src/test/resources/org/apache/struts2/views/jsp/ui/Checkbox-6.txt
(added)
+++ struts/struts2/trunk/core/src/test/resources/org/apache/struts2/views/jsp/ui/Checkbox-6.txt
Sat Apr 19 07:55:33 2008
@@ -0,0 +1,9 @@
+<tr>
+	<td valign="top" align="right">
+	</td>
+    <td valign="top" align="left">
+		<input type="checkbox" name="foo" value="baz" checked="checked" disabled="disabled"
id="foo" title="mytitle" />
+		<input type="hidden" id="__checkbox_foo" name="__checkbox_foo" value="baz" disabled="disabled"/>
+		<label for="foo" class="checkboxLabel">mylabel</label>
+    </td>
+</tr>



Mime
View raw message