Author: jcompagner
Date: Tue Dec 12 02:28:48 2006
New Revision: 486086

URL: http://svn.apache.org/viewvc?view=rev&rev=486086
Log:
streamlined onEvent -> onError/onUpdate

Modified:
    
incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/ajax/form/AjaxFormComponentUpdatingBehavior.java

Modified: 
incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/ajax/form/AjaxFormComponentUpdatingBehavior.java
URL: 
http://svn.apache.org/viewvc/incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/ajax/form/AjaxFormComponentUpdatingBehavior.java?view=diff&rev=486086&r1=486085&r2=486086
==============================================================================
--- 
incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/ajax/form/AjaxFormComponentUpdatingBehavior.java
 (original)
+++ 
incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/ajax/form/AjaxFormComponentUpdatingBehavior.java
 Tue Dec 12 02:28:48 2006
@@ -44,7 +44,7 @@
  */
 public abstract class AjaxFormComponentUpdatingBehavior extends 
AjaxEventBehavior
 {
-       /**
+       /**  
         * Construct.
         * 
         * @param event
@@ -109,7 +109,6 @@
        protected final void onEvent(final AjaxRequestTarget target)
        {
                final FormComponent formComponent = getFormComponent();
-               boolean callOnUpdate = true;
 
                try
                {
@@ -125,20 +124,14 @@
                        {
                                formComponent.valid();
                                formComponent.updateModel();
+                               onUpdate(target);
                        }
                }
                catch (RuntimeException e)
                {
-                       callOnUpdate = false;
                        onError(target, e);
 
                }
-
-               if (callOnUpdate)
-               {
-                       onUpdate(target);
-               }
-
        }
 
        /**
@@ -153,14 +146,14 @@
         * Called to handle any error resulting from updating form component. 
Errors
         * thrown from [EMAIL PROTECTED] #onUpdate(AjaxRequestTarget)} will not 
be caught here.
         * 
-        * The exception param can be null then it is an validate failure, if 
the 
-        * Exception is not null then an exception did happen.
+        * The RuntimeException will be null if it was just a validation or 
conversion 
+        * error of the FormComponent
         * 
         * @param target
         * @param e
         */
        protected void onError(AjaxRequestTarget target, RuntimeException e)
        {
-               throw e;
+               if(e != null) throw e;
        }
 }


Reply via email to