You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lu...@apache.org on 2011/07/28 04:46:00 UTC
svn commit: r1151700 - in
/myfaces/core/branches/2.0.x/api/src/main/java/javax/faces/component:
UIComponentBase.java UIData.java UIInput.java
Author: lu4242
Date: Thu Jul 28 02:45:59 2011
New Revision: 1151700
URL: http://svn.apache.org/viewvc?rev=1151700&view=rev
Log:
MYFACES-3249 [2.1 Spec Review] Pre/PostValidateEvent publishing conditions
Modified:
myfaces/core/branches/2.0.x/api/src/main/java/javax/faces/component/UIComponentBase.java
myfaces/core/branches/2.0.x/api/src/main/java/javax/faces/component/UIData.java
myfaces/core/branches/2.0.x/api/src/main/java/javax/faces/component/UIInput.java
Modified: myfaces/core/branches/2.0.x/api/src/main/java/javax/faces/component/UIComponentBase.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.0.x/api/src/main/java/javax/faces/component/UIComponentBase.java?rev=1151700&r1=1151699&r2=1151700&view=diff
==============================================================================
--- myfaces/core/branches/2.0.x/api/src/main/java/javax/faces/component/UIComponentBase.java (original)
+++ myfaces/core/branches/2.0.x/api/src/main/java/javax/faces/component/UIComponentBase.java Thu Jul 28 02:45:59 2011
@@ -35,8 +35,10 @@ import javax.faces.event.BehaviorEvent;
import javax.faces.event.FacesEvent;
import javax.faces.event.FacesListener;
import javax.faces.event.PostAddToViewEvent;
+import javax.faces.event.PostValidateEvent;
import javax.faces.event.PreRemoveFromViewEvent;
import javax.faces.event.PreRenderComponentEvent;
+import javax.faces.event.PreValidateEvent;
import javax.faces.event.SystemEvent;
import javax.faces.event.SystemEventListener;
import javax.faces.render.RenderKit;
@@ -1233,21 +1235,31 @@ public abstract class UIComponentBase ex
pushComponentToEL(context, this);
if (_isPhaseExecutable(context))
{
- // Call the processValidators() method of all facets and children of this UIComponent, in the order
- // determined by a call to getFacetsAndChildren().
- int facetCount = getFacetCount();
- if (facetCount > 0)
+ //Pre validation event dispatch for component
+ context.getApplication().publishEvent(context, PreValidateEvent.class, getClass(), this);
+
+ try
{
- for (UIComponent facet : getFacets().values())
+ // Call the processValidators() method of all facets and children of this UIComponent, in the order
+ // determined by a call to getFacetsAndChildren().
+ int facetCount = getFacetCount();
+ if (facetCount > 0)
+ {
+ for (UIComponent facet : getFacets().values())
+ {
+ facet.processValidators(context);
+ }
+ }
+
+ for (int i = 0, childCount = getChildCount(); i < childCount; i++)
{
- facet.processValidators(context);
+ UIComponent child = getChildren().get(i);
+ child.processValidators(context);
}
}
-
- for (int i = 0, childCount = getChildCount(); i < childCount; i++)
+ finally
{
- UIComponent child = getChildren().get(i);
- child.processValidators(context);
+ context.getApplication().publishEvent(context, PostValidateEvent.class, getClass(), this);
}
}
}
Modified: myfaces/core/branches/2.0.x/api/src/main/java/javax/faces/component/UIData.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.0.x/api/src/main/java/javax/faces/component/UIData.java?rev=1151700&r1=1151699&r2=1151700&view=diff
==============================================================================
--- myfaces/core/branches/2.0.x/api/src/main/java/javax/faces/component/UIData.java (original)
+++ myfaces/core/branches/2.0.x/api/src/main/java/javax/faces/component/UIData.java Thu Jul 28 02:45:59 2011
@@ -40,6 +40,8 @@ import javax.faces.event.AbortProcessing
import javax.faces.event.FacesEvent;
import javax.faces.event.FacesListener;
import javax.faces.event.PhaseId;
+import javax.faces.event.PostValidateEvent;
+import javax.faces.event.PreValidateEvent;
import javax.faces.model.ArrayDataModel;
import javax.faces.model.DataModel;
import javax.faces.model.ListDataModel;
@@ -1178,12 +1180,23 @@ public class UIData extends UIComponentB
{
return;
}
- setRowIndex(-1);
- processFacets(context, PROCESS_VALIDATORS);
- processColumnFacets(context, PROCESS_VALIDATORS);
- processColumnChildren(context, PROCESS_VALIDATORS);
- setRowIndex(-1);
-
+
+ //Pre validation event dispatch for component
+ context.getApplication().publishEvent(context, PreValidateEvent.class, getClass(), this);
+
+ try
+ {
+ setRowIndex(-1);
+ processFacets(context, PROCESS_VALIDATORS);
+ processColumnFacets(context, PROCESS_VALIDATORS);
+ processColumnChildren(context, PROCESS_VALIDATORS);
+ setRowIndex(-1);
+ }
+ finally
+ {
+ context.getApplication().publishEvent(context, PostValidateEvent.class, getClass(), this);
+ }
+
// check if an validation error forces the render response for our data
if (context.getRenderResponse())
{
Modified: myfaces/core/branches/2.0.x/api/src/main/java/javax/faces/component/UIInput.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.0.x/api/src/main/java/javax/faces/component/UIInput.java?rev=1151700&r1=1151699&r2=1151700&view=diff
==============================================================================
--- myfaces/core/branches/2.0.x/api/src/main/java/javax/faces/component/UIInput.java (original)
+++ myfaces/core/branches/2.0.x/api/src/main/java/javax/faces/component/UIInput.java Thu Jul 28 02:45:59 2011
@@ -183,11 +183,10 @@ public class UIInput extends UIOutput im
pushComponentToEL(context, this);
if (isImmediate())
{
+ //Pre validation event dispatch for component
+ context.getApplication().publishEvent(context, PreValidateEvent.class, getClass(), this);
try
{
- //Pre validation event dispatch for component
- context.getApplication().publishEvent(context, PreValidateEvent.class, getClass(), this);
-
validate(context);
}
catch (RuntimeException e)
@@ -234,7 +233,24 @@ public class UIInput extends UIOutput im
popComponentFromEL(context);
}
- super.processValidators(context);
+ //super.processValidators(context);
+
+ // Call the processValidators() method of all facets and children of this UIComponent, in the order
+ // determined by a call to getFacetsAndChildren().
+ int facetCount = getFacetCount();
+ if (facetCount > 0)
+ {
+ for (UIComponent facet : getFacets().values())
+ {
+ facet.processValidators(context);
+ }
+ }
+
+ for (int i = 0, childCount = getChildCount(); i < childCount; i++)
+ {
+ UIComponent child = getChildren().get(i);
+ child.processValidators(context);
+ }
try
{
@@ -242,11 +258,10 @@ public class UIInput extends UIOutput im
pushComponentToEL(context, this);
if (!isImmediate())
{
+ //Pre validation event dispatch for component
+ context.getApplication().publishEvent(context, PreValidateEvent.class, getClass(), this);
try
{
- //Pre validation event dispatch for component
- context.getApplication().publishEvent(context, PreValidateEvent.class, getClass(), this);
-
validate(context);
}
catch (RuntimeException e)