You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by ma...@apache.org on 2009/11/23 10:45:09 UTC

svn commit: r883293 - /myfaces/trinidad/branches/trinidad-2.0.x/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/UIXComponentBase.java

Author: matzew
Date: Mon Nov 23 09:45:09 2009
New Revision: 883293

URL: http://svn.apache.org/viewvc?rev=883293&view=rev
Log:
TRINIDAD-1612 - Add support for the new Lifecycle Management Methods (see spec section 3.1.14)
TRINIDAD-1614 - add new system events implementation for the lifecycle methods, like processXyz

Modified:
    myfaces/trinidad/branches/trinidad-2.0.x/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/UIXComponentBase.java

Modified: myfaces/trinidad/branches/trinidad-2.0.x/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/UIXComponentBase.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/trinidad-2.0.x/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/UIXComponentBase.java?rev=883293&r1=883292&r2=883293&view=diff
==============================================================================
--- myfaces/trinidad/branches/trinidad-2.0.x/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/UIXComponentBase.java (original)
+++ myfaces/trinidad/branches/trinidad-2.0.x/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/UIXComponentBase.java Mon Nov 23 09:45:09 2009
@@ -729,14 +729,17 @@
     if (context == null)
       throw new NullPointerException();
 
+    // Call UIComponent.pushComponentToEL(javax.faces.context.FacesContext, javax.faces.component.UIComponent)
+    pushComponentToEL(context, this);
+
     if (!isRendered())
       return;
 
+    context.getApplication().publishEvent(context,  PreRenderComponentEvent.class, UIComponent.class, this);
+
     _cacheRenderer(context);
     Renderer renderer = getRenderer(context);
 
-    context.getApplication().publishEvent(context,  PreRenderComponentEvent.class, UIComponent.class, this);
-
     // if there is a Renderer for this component
     if (renderer != null)
     {
@@ -767,15 +770,22 @@
     if (context == null)
       throw new NullPointerException();
 
-    if (isRendered())
+    try
     {
-      Renderer renderer = getRenderer(context);
-      // if there is a Renderer for this component
-      if (renderer != null)
+      if (isRendered())
       {
-        renderer.encodeEnd(context, this);
+        Renderer renderer = getRenderer(context);
+        // if there is a Renderer for this component
+        if (renderer != null)
+        {
+          renderer.encodeEnd(context, this);
+        }
       }
     }
+    finally
+    {
+      popComponentFromEL(context);
+    }
   }
 
   /**
@@ -820,12 +830,23 @@
     if (!isRendered())
       return;
 
-    // Process all facets and children of this component
-    decodeChildren(context);
+    pushComponentToEL(context, this);
 
-    // Process this component itself
-    decode(context);
+    try
+    {
+      // Process all facets and children of this component
+      decodeChildren(context);
+
+      // Process this component itself
+      decode(context);
+    }
+    finally
+    {
+      // Call UIComponent.popComponentFromEL(javax.faces.context.FacesContext) from inside of a finally
+      // block, just before returning.
 
+      popComponentFromEL(context);
+    }
   }
 
   @Override
@@ -837,8 +858,17 @@
     if (!isRendered())
       return;
 
-    // Process all facets and children of this component
-    validateChildren(context);
+    pushComponentToEL(context, this);
+
+    try
+    {
+      // Process all facets and children of this component
+      validateChildren(context);
+    }
+    finally
+    {
+      popComponentFromEL(context);
+    }
   }
 
   @Override
@@ -850,8 +880,17 @@
     if (!isRendered())
       return;
 
-    // Process all facets and children of this component
-    updateChildren(context);
+    pushComponentToEL(context, this);
+
+    try
+    {
+      // Process all facets and children of this component
+      updateChildren(context);
+    }
+    finally
+    {
+      popComponentFromEL(context);
+    }
   }
 
   @Override
@@ -863,6 +902,8 @@
     if (_LOG.isFiner())
       _LOG.finer("processSaveState() on " + this);
 
+    pushComponentToEL(context, this);
+
     Object state = null;
 
     try
@@ -889,6 +930,11 @@
       throw e;
     }
 
+    finally
+    {
+      popComponentFromEL(context);
+    }
+
     // if component state serialization checking is on, attempt to Serialize the
     // component state immediately in order to determine which component's state
     // failed state saving.  Note that since our parent will attempt this same
@@ -923,16 +969,25 @@
     if (_LOG.isFiner())
       _LOG.finer("processRestoreState() on " + this);
 
-    // If we saved a "TreeState", use it to restore everything
-    if (state instanceof TreeState)
+    pushComponentToEL(context, this);
+
+    try
     {
-      ((TreeState) state).restoreState(context, this);
+      // If we saved a "TreeState", use it to restore everything
+      if (state instanceof TreeState)
+      {
+        ((TreeState) state).restoreState(context, this);
+      }
+      // Otherwise, we had no children or facets, and just use
+      // the "state" object
+      else
+      {
+        restoreState(context, state);
+      }
     }
-    // Otherwise, we had no children or facets, and just use
-    // the "state" object
-    else
+    finally
     {
-      restoreState(context, state);
+      popComponentFromEL(context);
     }
   }