Author: hlship
Date: Sat Oct 29 13:31:58 2005
New Revision: 329474
URL: http://svn.apache.org/viewcvs?rev=329474&view=rev
Log:
TAPESTRY-711: Do not give focus to disabled fields
Added:
jakarta/tapestry/trunk/framework/src/test/org/apache/tapestry/form/AbstractFormComponentTest.java
Modified:
jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/form/AbstractFormComponent.java
jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/form/LinkSubmit.java
jakarta/tapestry/trunk/status.xml
Modified:
jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/form/AbstractFormComponent.java
URL:
http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/form/AbstractFormComponent.java?rev=329474&r1=329473&r2=329474&view=diff
==============================================================================
---
jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/form/AbstractFormComponent.java
(original)
+++
jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/form/AbstractFormComponent.java
Sat Oct 29 13:31:58 2005
@@ -42,13 +42,13 @@
/**
* Returns true if the corresponding field, on the client side, can accept
user focus (i.e.,
- * implements the focus() method). Most components can take focus, but a
few ([EMAIL PROTECTED] Hidden})
- * override this method to return false.
+ * implements the focus() method). Most components can take focus (if not
disabled), but a few ([EMAIL PROTECTED] Hidden})
+ * override this method to always return false.
*/
protected boolean getCanTakeFocus()
{
- return true;
+ return !isDisabled();
}
/**
Modified:
jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/form/LinkSubmit.java
URL:
http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/form/LinkSubmit.java?rev=329474&r1=329473&r2=329474&view=diff
==============================================================================
---
jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/form/LinkSubmit.java
(original)
+++
jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/form/LinkSubmit.java
Sat Oct 29 13:31:58 2005
@@ -133,7 +133,7 @@
}
/**
- * Links can not take focus.
+ * Links can not take focus, ever.
*/
protected boolean getCanTakeFocus()
{
Added:
jakarta/tapestry/trunk/framework/src/test/org/apache/tapestry/form/AbstractFormComponentTest.java
URL:
http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/test/org/apache/tapestry/form/AbstractFormComponentTest.java?rev=329474&view=auto
==============================================================================
---
jakarta/tapestry/trunk/framework/src/test/org/apache/tapestry/form/AbstractFormComponentTest.java
(added)
+++
jakarta/tapestry/trunk/framework/src/test/org/apache/tapestry/form/AbstractFormComponentTest.java
Sat Oct 29 13:31:58 2005
@@ -0,0 +1,37 @@
+// Copyright 2005 The Apache Software Foundation
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package org.apache.tapestry.form;
+
+import org.apache.hivemind.util.PropertyUtils;
+
+/**
+ * Tests for [EMAIL PROTECTED] org.apache.tapestry.form.AbstractFormComponent}.
+ *
+ * @author Howard M. Lewis Ship
+ * @since 4.0
+ */
+public class AbstractFormComponentTest extends BaseFormComponentTestCase
+{
+ public void testCanTakeFocus()
+ {
+ AbstractFormComponent component = (AbstractFormComponent)
newInstance(AbstractFormComponent.class);
+
+ assertEquals(true, component.getCanTakeFocus());
+
+ PropertyUtils.write(component, "disabled", true);
+
+ assertEquals(false, component.getCanTakeFocus());
+ }
+}
Modified: jakarta/tapestry/trunk/status.xml
URL:
http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/status.xml?rev=329474&r1=329473&r2=329474&view=diff
==============================================================================
--- jakarta/tapestry/trunk/status.xml (original)
+++ jakarta/tapestry/trunk/status.xml Sat Oct 29 13:31:58 2005
@@ -57,6 +57,7 @@
<action type="update" dev="HLS">Change the examples distribution to be a
pre-configured JBoss distribution</action>
<action type="update" dev="HLS">Deprecate IMonitor and IMonitorFactory
(for removal in 4.1)</action>
<action type="fix" dev="HLS" fixes-bug="TAPESTRY-699"><div> tag
around form hidden fields should not be visible</action>
+ <action type="fix" dev="HLS" fixes-bug="TAPESTRY-711">Do not give focus
to disabled fields</action>
</release>
<release version="4.0-beta-11" date="Oct 16 2005">
<action type="fix" dev="HLS"
fixes-bug="TAPESTRY-650">ClassNotFoundException thrown when deserializing an
object from a client persistent property</action>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]