You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by hl...@apache.org on 2005/08/14 15:38:21 UTC
cvs commit: jakarta-tapestry/framework/src/java/org/apache/tapestry/valid IValidationDelegate.java ValidationDelegate.java
hlship 2005/08/14 06:38:21
Modified: . status.xml
framework/src/test/org/apache/tapestry/valid
TestValidationDelegate.java
framework/src/java/org/apache/tapestry/valid
IValidationDelegate.java ValidationDelegate.java
Log:
TAPESTRY-549: Method clearErrors() of IValidationDelegate is missing in 4.0
Revision Changes Path
1.210 +1 -0 jakarta-tapestry/status.xml
Index: status.xml
===================================================================
RCS file: /home/cvs/jakarta-tapestry/status.xml,v
retrieving revision 1.209
retrieving revision 1.210
diff -u -r1.209 -r1.210
--- status.xml 14 Aug 2005 13:26:18 -0000 1.209
+++ status.xml 14 Aug 2005 13:38:20 -0000 1.210
@@ -56,6 +56,7 @@
<action type="fix" dev="HLS" fixes-bug="TAPESTRY-528">Add IComponentSpecification.getReservedParameterNames()</action>
<action type="fix" dev="HLS" fixes-bug="TAPESTRY-557">Remove unused org.apache.tapestry.IResourceLocation (replaced by org.apache.hivemind.Resource)</action>
<action type="fix" dev="HLS" fixes-bug="TAPESTRY-553">Rename property-name attribute of configure element to "property" (matching the code in SpecificationParser, as well as other similar elements in the DTD)</action>
+ <action type="fix" dev="HLS" fixes-bug="TAPESTRY-549">Method clearErrors() of IValidationDelegate is missing in 4.0</action>
</release>
<release version="4.0-beta-4" date="Aug 10 2005">
<action type="fix" dev="HLS">Add getComponent() method to IComponent.</action>
1.3 +26 -1 jakarta-tapestry/framework/src/test/org/apache/tapestry/valid/TestValidationDelegate.java
Index: TestValidationDelegate.java
===================================================================
RCS file: /home/cvs/jakarta-tapestry/framework/src/test/org/apache/tapestry/valid/TestValidationDelegate.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- TestValidationDelegate.java 20 May 2005 12:46:08 -0000 1.2
+++ TestValidationDelegate.java 14 Aug 2005 13:38:20 -0000 1.3
@@ -289,7 +289,7 @@
}
/** @since 4.0 */
-
+
public void testGetErrorRenderers()
{
List l = d.getErrorRenderers();
@@ -316,4 +316,29 @@
verifyControls();
}
+
+ public void testClearErrors()
+ {
+ IFormComponent f = newField("input", 4);
+
+ replayControls();
+
+ d.setFormComponent(f);
+ d.recordFieldInputValue("hello");
+ d.record("An error in the input field.", null);
+
+ assertEquals(true, d.getHasErrors());
+
+ assertNotNull(d.getFirstError());
+
+ d.clearErrors();
+
+ assertEquals(false, d.getHasErrors());
+
+ d.setFormComponent(f);
+
+ assertEquals("hello", d.getFieldInputValue());
+
+ verifyControls();
+ }
}
\ No newline at end of file
1.10 +15 -0 jakarta-tapestry/framework/src/java/org/apache/tapestry/valid/IValidationDelegate.java
Index: IValidationDelegate.java
===================================================================
RCS file: /home/cvs/jakarta-tapestry/framework/src/java/org/apache/tapestry/valid/IValidationDelegate.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- IValidationDelegate.java 21 Jul 2005 13:17:58 -0000 1.9
+++ IValidationDelegate.java 14 Aug 2005 13:38:20 -0000 1.10
@@ -135,6 +135,20 @@
public void clear();
/**
+ * Clears all errors, but maintains user input. This is useful when a form has been submitted
+ * for a semantic other than "process this data". A common example of this is a dependent drop
+ * down list; selecting an option in one drop down list forces a refresh submit of the form, to
+ * repopulate the options in a second, dependent drop down list.
+ * <p>
+ * In these cases, the user input provided in the request is maintained, but any errors should
+ * be cleared out (to prevent unwanted error messages and decorations).
+ *
+ * @since 3.0.1
+ */
+
+ public void clearErrors();
+
+ /**
* Records the user's input for the current form component. Input should be recorded even if
* there isn't an explicit error, since later form-wide validations may discover an error in the
* field.
@@ -295,4 +309,5 @@
* @since 4.0
*/
public String getFocusField();
+
}
\ No newline at end of file
1.9 +13 -0 jakarta-tapestry/framework/src/java/org/apache/tapestry/valid/ValidationDelegate.java
Index: ValidationDelegate.java
===================================================================
RCS file: /home/cvs/jakarta-tapestry/framework/src/java/org/apache/tapestry/valid/ValidationDelegate.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- ValidationDelegate.java 21 Jul 2005 13:17:58 -0000 1.8
+++ ValidationDelegate.java 14 Aug 2005 13:38:20 -0000 1.9
@@ -64,6 +64,19 @@
_trackingMap.clear();
}
+ public void clearErrors()
+ {
+ if (_trackings == null)
+ return;
+
+ Iterator i = _trackings.iterator();
+ while (i.hasNext())
+ {
+ FieldTracking ft = (FieldTracking) i.next();
+ ft.setErrorRenderer(null);
+ }
+ }
+
/**
* If the form component is in error, places a <font color="red"< around it. Note: this
* will only work on the render phase after a rewind, and will be confused if components are
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-dev-help@jakarta.apache.org