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 2011/02/10 13:59:45 UTC
svn commit: r1069375 - in /tapestry/tapestry5/trunk:
tapestry-beanvalidator/src/test/java/org/example/testapp/pages/
tapestry-core/src/main/java/org/apache/tapestry5/
tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/
tapestry-core/sr...
Author: hlship
Date: Thu Feb 10 12:59:45 2011
New Revision: 1069375
URL: http://svn.apache.org/viewvc?rev=1069375&view=rev
Log:
TAP5-1440: Remove "validateForm" event triggered by Form component (replaced with "validate" event)
Modified:
tapestry/tapestry5/trunk/tapestry-beanvalidator/src/test/java/org/example/testapp/pages/InjectValidatorDemo.java
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/EventConstants.java
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Form.java
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/ValidateFormValidationExceptionDemo.java
Modified: tapestry/tapestry5/trunk/tapestry-beanvalidator/src/test/java/org/example/testapp/pages/InjectValidatorDemo.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-beanvalidator/src/test/java/org/example/testapp/pages/InjectValidatorDemo.java?rev=1069375&r1=1069374&r2=1069375&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-beanvalidator/src/test/java/org/example/testapp/pages/InjectValidatorDemo.java (original)
+++ tapestry/tapestry5/trunk/tapestry-beanvalidator/src/test/java/org/example/testapp/pages/InjectValidatorDemo.java Thu Feb 10 12:59:45 2011
@@ -1,4 +1,4 @@
-// Copyright 2009 The Apache Software Foundation
+// Copyright 2009, 2011 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.
@@ -41,7 +41,7 @@ public class InjectValidatorDemo
@InjectComponent
private Form form;
- void onValidateForm()
+ void onValidateFromForm()
{
Set<ConstraintViolation<InjectValidatorDemo>> violations = validator.validate(this, Bar.class);
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/EventConstants.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/EventConstants.java?rev=1069375&r1=1069374&r2=1069375&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/EventConstants.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/EventConstants.java Thu Feb 10 12:59:45 2011
@@ -78,17 +78,6 @@ public class EventConstants
public static final String SUBMIT = "submit";
/**
- * Event type for a notification to perform validation of submitted data. This allows a listener
- * to perform
- * cross-field validation. This occurs before the {@link #SUCCESS} or {@link #FAILURE} notification.
- *
- * @see org.apache.tapestry5.corelib.components.Form
- * @deprecated As of 5.2, this event should no longer be used; the Form component now fires a {@link #VALIDATE}
- * event. For compatibility, validateForm will be supported, but may be removed in a future release.
- */
- public static final String VALIDATE_FORM = "validateForm";
-
- /**
* Event type associated with clicking the cancel button inside a {@link BeanEditForm}.
*
* @since 5.2.0
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Form.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Form.java?rev=1069375&r1=1069374&r2=1069375&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Form.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Form.java Thu Feb 10 12:59:45 2011
@@ -18,7 +18,26 @@ import java.io.EOFException;
import java.io.IOException;
import java.io.ObjectInputStream;
-import org.apache.tapestry5.*;
+import org.apache.tapestry5.BindingConstants;
+import org.apache.tapestry5.CSSClassConstants;
+import org.apache.tapestry5.ClientElement;
+import org.apache.tapestry5.ComponentAction;
+import org.apache.tapestry5.ComponentResources;
+import org.apache.tapestry5.EventConstants;
+import org.apache.tapestry5.EventContext;
+import org.apache.tapestry5.Field;
+import org.apache.tapestry5.FormValidationControl;
+import org.apache.tapestry5.Link;
+import org.apache.tapestry5.MarkupConstants;
+import org.apache.tapestry5.MarkupWriter;
+import org.apache.tapestry5.PersistenceConstants;
+import org.apache.tapestry5.SymbolConstants;
+import org.apache.tapestry5.TrackableComponentEventCallback;
+import org.apache.tapestry5.ValidationDecorator;
+import org.apache.tapestry5.ValidationException;
+import org.apache.tapestry5.ValidationTracker;
+import org.apache.tapestry5.ValidationTrackerImpl;
+import org.apache.tapestry5.ValidationTrackerWrapper;
import org.apache.tapestry5.annotations.Environmental;
import org.apache.tapestry5.annotations.Events;
import org.apache.tapestry5.annotations.HeartbeatDeferred;
@@ -71,11 +90,10 @@ import org.slf4j.Logger;
* When the form is submitted, the component emits several notifications: first a
* {@link EventConstants#PREPARE_FOR_SUBMIT}, then a {@link EventConstants#PREPARE}: these allow the page to update its
* state as necessary to prepare for the form submission, then (after components enclosed by the form have operated), a
- * {@link EventConstants#VALIDATE} event is emitted (followed by a {@link EventConstants#VALIDATE_FORM} event, for
- * backwards compatibility), to allow for cross-form validation. After that, either a {@link EventConstants#SUCCESS} OR
- * {@link EventConstants#FAILURE} event (depending on whether the {@link ValidationTracker} has recorded any errors).
- * Lastly, a {@link EventConstants#SUBMIT} event, for any listeners that care only about form submission, regardless of
- * success or failure.
+ * {@link EventConstants#VALIDATE} event is emitted, to allow for cross-form validation. After that, either a
+ * {@link EventConstants#SUCCESS} OR {@link EventConstants#FAILURE} event (depending on whether the
+ * {@link ValidationTracker} has recorded any errors). Lastly, a {@link EventConstants#SUBMIT} event, for any listeners
+ * that care only about form submission, regardless of success or failure.
* <p/>
* For all of these notifications, the event context is derived from the <strong>context</strong> parameter. This
* context is encoded into the form's action URI (the parameter is not read when the form is submitted, instead the
@@ -83,46 +101,10 @@ import org.slf4j.Logger;
*/
@Events(
{ EventConstants.PREPARE_FOR_RENDER, EventConstants.PREPARE, EventConstants.PREPARE_FOR_SUBMIT,
- EventConstants.VALIDATE, EventConstants.VALIDATE_FORM, EventConstants.SUBMIT, EventConstants.FAILURE,
- EventConstants.SUCCESS })
+ EventConstants.VALIDATE, EventConstants.SUBMIT, EventConstants.FAILURE, EventConstants.SUCCESS })
public class Form implements ClientElement, FormValidationControl
{
/**
- * @deprecated Use constant from {@link EventConstants} instead.
- */
- public static final String PREPARE_FOR_RENDER = EventConstants.PREPARE_FOR_RENDER;
-
- /**
- * @deprecated Use constant from {@link EventConstants} instead.
- */
- public static final String PREPARE_FOR_SUBMIT = EventConstants.PREPARE_FOR_SUBMIT;
-
- /**
- * @deprecated Use constant from {@link EventConstants} instead.
- */
- public static final String PREPARE = EventConstants.PREPARE;
-
- /**
- * @deprecated Use constant from {@link EventConstants} instead.
- */
- public static final String SUBMIT = EventConstants.SUBMIT;
-
- /**
- * @deprecated Use constant from {@link EventConstants} instead.
- */
- public static final String VALIDATE_FORM = EventConstants.VALIDATE_FORM;
-
- /**
- * @deprecated Use constant from {@link EventConstants} instead.
- */
- public static final String SUCCESS = EventConstants.SUCCESS;
-
- /**
- * @deprecated Use constant from {@link EventConstants} instead.
- */
- public static final String FAILURE = EventConstants.FAILURE;
-
- /**
* Query parameter name storing form data (the serialized commands needed to
* process a form submission).
*/
@@ -405,8 +387,8 @@ public class Form implements ClientEleme
resources.triggerEvent(EventConstants.PREPARE_FOR_RENDER, context, null);
resources.triggerEvent(EventConstants.PREPARE, context, null);
-
- // Push BeanValidationContext only after the container had a chance to prepare
+
+ // Push BeanValidationContext only after the container had a chance to prepare
environment.push(BeanValidationContext.class, new BeanValidationContextImpl(validate));
// Save the form element for later, in case we want to write an encoding
@@ -536,7 +518,6 @@ public class Form implements ClientEleme
return true;
resources.triggerContextEvent(EventConstants.PREPARE, context, eventCallback);
-
environment.push(BeanValidationContext.class, new BeanValidationContextImpl(validate));
@@ -549,7 +530,7 @@ public class Form implements ClientEleme
formSupport.executeDeferred();
- fireValidateFormEvent(context, eventCallback);
+ fireValidateEvent(EventConstants.VALIDATE, context, eventCallback);
if (eventCallback.isAborted())
return true;
@@ -592,17 +573,6 @@ public class Form implements ClientEleme
}
}
- private void fireValidateFormEvent(EventContext context, TrackableComponentEventCallback callback)
- throws IOException
- {
- fireValidateEvent(EventConstants.VALIDATE, context, callback);
-
- if (callback.isAborted())
- return;
-
- fireValidateEvent(EventConstants.VALIDATE_FORM, context, callback);
- }
-
private void fireValidateEvent(String eventName, EventContext context, TrackableComponentEventCallback callback)
{
try
Modified: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/ValidateFormValidationExceptionDemo.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/ValidateFormValidationExceptionDemo.java?rev=1069375&r1=1069374&r2=1069375&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/ValidateFormValidationExceptionDemo.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/ValidateFormValidationExceptionDemo.java Thu Feb 10 12:59:45 2011
@@ -1,4 +1,4 @@
-// Copyright 2008 The Apache Software Foundation
+// Copyright 2008, 2011 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.
@@ -24,7 +24,7 @@ public class ValidateFormValidationExcep
@Persist
private String event;
- void onValidateFormFromForm() throws ValidationException
+ void onValidateFromForm() throws ValidationException
{
throw new ValidationException("From event handler method.");
}