You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by ar...@apache.org on 2012/05/16 18:29:35 UTC

svn commit: r1339253 - in /myfaces/trinidad/branches/1.2.12.7.0-branch: ./ trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/ trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/ trinidad-api/src/main/java/org/apac...

Author: arobinson74
Date: Wed May 16 16:29:35 2012
New Revision: 1339253

URL: http://svn.apache.org/viewvc?rev=1339253&view=rev
Log:
TRINIDAD-2101 - back port the changes onto this branch

Modified:
    myfaces/trinidad/branches/1.2.12.7.0-branch/   (props changed)
    myfaces/trinidad/branches/1.2.12.7.0-branch/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXShowDetailTemplate.java
    myfaces/trinidad/branches/1.2.12.7.0-branch/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXSwitcherTemplate.java
    myfaces/trinidad/branches/1.2.12.7.0-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/UIXComponent.java
    myfaces/trinidad/branches/1.2.12.7.0-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/UIXComponentBase.java
    myfaces/trinidad/branches/1.2.12.7.0-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/render/CoreRenderer.java
    myfaces/trinidad/branches/1.2.12.7.0-branch/trinidad-sandbox/sandbox-api/src/main/java-templates/org/apache/myfaces/trinidad/sandbox/component/   (props changed)
    myfaces/trinidad/branches/1.2.12.7.0-branch/trinidad-sandbox/sandbox-api/src/main/java/org/apache/myfaces/trinidad/sandbox/event/   (props changed)

Propchange: myfaces/trinidad/branches/1.2.12.7.0-branch/
------------------------------------------------------------------------------
  Merged /myfaces/trinidad/trunk:r1125570

Modified: myfaces/trinidad/branches/1.2.12.7.0-branch/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXShowDetailTemplate.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/1.2.12.7.0-branch/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXShowDetailTemplate.java?rev=1339253&r1=1339252&r2=1339253&view=diff
==============================================================================
--- myfaces/trinidad/branches/1.2.12.7.0-branch/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXShowDetailTemplate.java (original)
+++ myfaces/trinidad/branches/1.2.12.7.0-branch/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXShowDetailTemplate.java Wed May 16 16:29:35 2012
@@ -18,7 +18,12 @@
  */
 package org.apache.myfaces.trinidad.component;
 
+import java.util.Collections;
+import java.util.Iterator;
+
 import javax.el.MethodExpression;
+
+import javax.faces.component.UIComponent;
 import javax.faces.context.FacesContext;
 import javax.faces.el.MethodBinding;
 import javax.faces.event.AbortProcessingException;
@@ -26,9 +31,9 @@ import javax.faces.event.FacesEvent;
 import javax.faces.event.PhaseId;
 
 import org.apache.myfaces.trinidad.event.DisclosureEvent;
-
 import org.apache.myfaces.trinidad.logging.TrinidadLogger;
 
+
 /**
  * Base class for ShowDetail component.
  * @version $Name:  $ ($Revision$) $Date$
@@ -41,6 +46,7 @@ abstract public class UIXShowDetailTempl
 /**/  abstract public boolean isImmediate();
 /**/  abstract public MethodExpression getDisclosureListener();
 /**/  abstract public boolean isDisclosedTransient();
+/**/  abstract public void setDisclosureListener(MethodExpression expression);
 
   @Deprecated
   public void setDisclosureListener(MethodBinding binding)
@@ -49,33 +55,6 @@ abstract public class UIXShowDetailTempl
   }
 
   @Override
-  public void processDecodes(FacesContext context)
-  {
-    // If we're not disclosed, only process ourselves
-    if (!isDisclosed())
-    {
-      if (isRendered())
-        decode(context);
-    }
-    else
-      super.processDecodes(context);
-  }
-
-  @Override
-  public void processValidators(FacesContext context)
-  {
-    if (isDisclosed())
-      super.processValidators(context);
-  }
-
-  @Override
-  public void processUpdates(FacesContext context)
-  {
-    if (isDisclosed())
-      super.processUpdates(context);
-  }
-
-  @Override
   public void broadcast(FacesEvent event) throws AbortProcessingException
   {
     // Perform standard superclass processing
@@ -133,5 +112,17 @@ abstract public class UIXShowDetailTempl
     super.queueEvent(e);
   }
 
+  protected Iterator<UIComponent> getRenderedFacetsAndChildren(FacesContext facesContext)
+  {
+    if (isDisclosed())
+    {
+      return super.getRenderedFacetsAndChildren(facesContext);
+    }
+    else
+    {
+      return Collections.<UIComponent>emptyList().iterator();
+    }
+  }
+
   static private final TrinidadLogger _LOG = TrinidadLogger.createTrinidadLogger(UIXShowDetail.class);
 }

Modified: myfaces/trinidad/branches/1.2.12.7.0-branch/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXSwitcherTemplate.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/1.2.12.7.0-branch/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXSwitcherTemplate.java?rev=1339253&r1=1339252&r2=1339253&view=diff
==============================================================================
--- myfaces/trinidad/branches/1.2.12.7.0-branch/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXSwitcherTemplate.java (original)
+++ myfaces/trinidad/branches/1.2.12.7.0-branch/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXSwitcherTemplate.java Wed May 16 16:29:35 2012
@@ -20,6 +20,9 @@ package org.apache.myfaces.trinidad.comp
 
 import java.io.IOException;
 
+import java.util.Collections;
+import java.util.Iterator;
+
 import javax.faces.component.UIComponent;
 import javax.faces.context.FacesContext;
 
@@ -36,47 +39,14 @@ abstract public class UIXSwitcherTemplat
 /**/  abstract public String getDefaultFacet();
 
   /**
-   * Only decode the currently active facet.
-   */
-  @Override
-  public void processDecodes(FacesContext context)
-  {
-    UIComponent facet = _getFacet();
-    if (facet != null)
-      facet.processDecodes(context);
-  }
-
-  /**
-   * Only process validations on the currently active facet.
-   */
-  @Override
-  public void processValidators(FacesContext context)
-  {
-    UIComponent facet = _getFacet();
-    if (facet != null)
-      facet.processValidators(context);
-  }
-
-
-  /**
-   * Only process updates on the currently active facet.
-   */
-  @Override
-  public void processUpdates(FacesContext context)
-  {
-    UIComponent facet = _getFacet();
-    if (facet != null)
-      facet.processUpdates(context);
-  }
-
-  /**
    * Processes the selected switcher facet
    */
   public <S> boolean processFlattenedChildren(
     final FacesContext context,
     ComponentProcessingContext cpContext,
     final ComponentProcessor<S> childProcessor,
-    final S callbackContext) throws IOException
+    final S                     callbackContext
+    ) throws IOException
   {
     UIComponent facet = _getFacet();
     
@@ -124,6 +94,19 @@ abstract public class UIXSwitcherTemplat
     return true;
   }
 
+  protected Iterator<UIComponent> getRenderedFacetsAndChildren(FacesContext facesContext)
+  {
+    UIComponent facet = _getFacet();
+    if (facet == null)
+    {
+      return Collections.<UIComponent>emptyList().iterator();
+    }
+    else
+    {
+      return Collections.singleton(facet).iterator();
+    }
+  }
+
   private UIComponent _getFacet()
   {
     if (!isRendered())

Modified: myfaces/trinidad/branches/1.2.12.7.0-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/UIXComponent.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/1.2.12.7.0-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/UIXComponent.java?rev=1339253&r1=1339252&r2=1339253&view=diff
==============================================================================
--- myfaces/trinidad/branches/1.2.12.7.0-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/UIXComponent.java (original)
+++ myfaces/trinidad/branches/1.2.12.7.0-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/UIXComponent.java Wed May 16 16:29:35 2012
@@ -327,6 +327,29 @@ abstract public class UIXComponent exten
   }
 
   /**
+   * Specifies what facets and children components should be processed as rendered for life-cycle
+   * methods. Any components not returned will not be processed during methods such as decoding,
+   * validating, updating the model, rendered-only tree visiting, etc.
+   *
+   * @param facesContext the facesContext
+   * @return An iterator of components to process. Must not return null (return an empty iterator
+   * if no children components should be processed).
+   */
+  protected Iterator<UIComponent> getRenderedFacetsAndChildren(
+    FacesContext facesContext)
+  {
+    Renderer renderer = getRenderer(facesContext);
+    if (renderer instanceof CoreRenderer)
+    {
+      return ((CoreRenderer)renderer).getRenderedFacetsAndChildren(facesContext, this);
+    }
+    else
+    {
+      return getFacetsAndChildren();
+    }
+  }
+
+  /**
   * <p>Perform a tree visit starting at the specified node in the tree.</p>
   *
   * <p>UIXComponent.visitTree() implementations do not invoke the
@@ -426,7 +449,10 @@ abstract public class UIXComponent exten
       // visit the children of the component
       try
       {
-        Iterator<UIComponent> kids = component.getFacetsAndChildren();
+        Iterator<UIComponent> kids =
+          uixComponent != null && visitContext.getHints().contains(VisitHint.SKIP_UNRENDERED) ?
+          uixComponent.getRenderedFacetsAndChildren(context) :
+          component.getFacetsAndChildren();
 
         while(kids.hasNext())
         {

Modified: myfaces/trinidad/branches/1.2.12.7.0-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/UIXComponentBase.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/1.2.12.7.0-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/UIXComponentBase.java?rev=1339253&r1=1339252&r2=1339253&view=diff
==============================================================================
--- myfaces/trinidad/branches/1.2.12.7.0-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/UIXComponentBase.java (original)
+++ myfaces/trinidad/branches/1.2.12.7.0-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/UIXComponentBase.java Wed May 16 16:29:35 2012
@@ -57,11 +57,13 @@ import org.apache.myfaces.trinidad.bean.
 import org.apache.myfaces.trinidad.bean.util.ValueMap;
 import org.apache.myfaces.trinidad.change.AttributeComponentChange;
 import org.apache.myfaces.trinidad.change.RowKeySetAttributeChange;
+import org.apache.myfaces.trinidad.component.UIXComponent;
 import org.apache.myfaces.trinidad.context.RequestContext;
 import org.apache.myfaces.trinidad.event.AttributeChangeEvent;
 import org.apache.myfaces.trinidad.event.AttributeChangeListener;
 import org.apache.myfaces.trinidad.logging.TrinidadLogger;
 import org.apache.myfaces.trinidad.model.RowKeySet;
+import org.apache.myfaces.trinidad.render.CoreRenderer;
 import org.apache.myfaces.trinidad.render.ExtendedRenderer;
 import org.apache.myfaces.trinidad.render.LifecycleRenderer;
 import org.apache.myfaces.trinidad.util.ThreadLocalUtils;
@@ -305,6 +307,14 @@ abstract public class UIXComponentBase e
     return _attributes;
   }
 
+  @Override
+  protected Iterator<UIComponent> getRenderedFacetsAndChildren(
+    FacesContext facesContext)
+  {
+    _cacheRenderer(facesContext);
+    return super.getRenderedFacetsAndChildren(facesContext);
+  }
+
   // ------------------------------------------------------------- Properties
 
 
@@ -979,7 +989,7 @@ abstract public class UIXComponentBase e
    */
   protected void decodeChildrenImpl(FacesContext context)
   {
-    Iterator<UIComponent> kids = getFacetsAndChildren();
+    Iterator<UIComponent> kids = getRenderedFacetsAndChildren(context);
     while (kids.hasNext())
     {
       UIComponent kid = kids.next();
@@ -1015,7 +1025,7 @@ abstract public class UIXComponentBase e
   protected void validateChildrenImpl(FacesContext context)
   {
     // Process all the facets and children of this component
-    Iterator<UIComponent> kids = getFacetsAndChildren();
+    Iterator<UIComponent> kids = getRenderedFacetsAndChildren(context);
     while (kids.hasNext())
     {
       UIComponent kid = kids.next();
@@ -1046,7 +1056,7 @@ abstract public class UIXComponentBase e
   protected void updateChildrenImpl(FacesContext context)
   {
     // Process all the facets and children of this component
-    Iterator<UIComponent> kids = getFacetsAndChildren();
+    Iterator<UIComponent> kids = getRenderedFacetsAndChildren(context);
     while (kids.hasNext())
     {
       UIComponent kid = kids.next();

Modified: myfaces/trinidad/branches/1.2.12.7.0-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/render/CoreRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/1.2.12.7.0-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/render/CoreRenderer.java?rev=1339253&r1=1339252&r2=1339253&view=diff
==============================================================================
--- myfaces/trinidad/branches/1.2.12.7.0-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/render/CoreRenderer.java (original)
+++ myfaces/trinidad/branches/1.2.12.7.0-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/render/CoreRenderer.java Wed May 16 16:29:35 2012
@@ -55,6 +55,23 @@ public class CoreRenderer extends Render
   }
 
   /**
+   * Allows the rendered to specify what components should be involved with rendered children
+   * life-cycle operations and methods.
+   *
+   * @param facesContext the faces context
+   * @param component the component from which to get the rendered facets and children
+   * @see UIXComponentBase#getRenderedFacetsAndChildren(FacesContext)
+   * @return A list of components to process as rendered components. Defaults to all facets and
+   * children of a component
+   */
+  public Iterator<UIComponent> getRenderedFacetsAndChildren(
+    FacesContext facesContext,
+    UIComponent  component)
+  {
+    return component.getFacetsAndChildren();
+  }
+
+  /**
    * <p>
    * Called when visiting the CoreRenderer's component during optimized partial page encoding so
    * that the CoreRenderer can modify what is actually encoded.  For example tab controls often

Propchange: myfaces/trinidad/branches/1.2.12.7.0-branch/trinidad-sandbox/sandbox-api/src/main/java-templates/org/apache/myfaces/trinidad/sandbox/component/
------------------------------------------------------------------------------
  Merged /myfaces/trinidad/trunk/trinidad-sandbox/sandbox-api/src/main/java-templates/org/apache/myfaces/trinidad/sandbox/component:r1125570

Propchange: myfaces/trinidad/branches/1.2.12.7.0-branch/trinidad-sandbox/sandbox-api/src/main/java/org/apache/myfaces/trinidad/sandbox/event/
------------------------------------------------------------------------------
  Merged /myfaces/trinidad/trunk/trinidad-sandbox/sandbox-api/src/main/java/org/apache/myfaces/trinidad/sandbox/event:r1125570