Why would you not use <composite:renderFacet name="..." /> in this case? Why does <composite:insertFacet /> exist except for convenience?

  <h:panelGrid>
        <f:facet name="caption">
     <composite:renderFacet name="caption"/>
        </f:facet>
  </h:panelGrid>
vs.
  <h:panelGrid>
     <composite:insertFacet name="caption"/>
  </h:panelGrid>

Since renderFacet already transfers its children into the parent component, <f:facet> could be used to propagate those children upward... that seems like a simple enough solution to me unless I am missing a use case. If I'm right, this is potentially duplicate functionality, potentially confusing since there are two very similar tags with similar functionality, and potentially complex to implement (not a super big consideration, but simplicity should always be the goal.)

My suggestion in this case is to remove <cc:insertFacet /> from the spec altogether, leave the repositioning to be done manually -- with not much extra code (how deep are people really going to nest facets most of the time? It's not that much extra work and provides just as much control.)

--Lincoln

PS. Going a step further, "renderFacet" is really inserting the facet children, and could be renamed to "insertFacet" should we decide to do away with the current "insertFacet" - I find that the word "render" is slightly misleading, since it's not truly causing a render to occur, simply inserting children into a different parent.


Tag insertFacet


The presence of this tag in a <composite:implementation> section must cause the named facet to be taken from the facet map of the top level component and inserted as a facet child of the component in which this element is nested.

Tag renderFacet

This element is used in the <composite:implementation> section. The facet with the name equal to the value of the name attribute, given by the page author in the using page, will be rendered at this point in the composite component PDL page.

The implementation of this tag handler must insert a component with component-type javax.faces.Output and renderer-type javax.faces.CompositeFacet as a child at this point in the component tree.

The implementation of this tag handler must store an attribute into the created component's attribute map under the key given by the value of the symbolic constant UIComponent.FACETS_KEY. The value for this key must be the evaluated value of the "name" attribute.





On Tue, 2009-09-15 at 19:29 -0400, Andy Schwartz wrote:

<composite:interface>
  <composite:facet name="caption"/>
  <composite:facet name="backupCaption"/>
</composite:interface>

<composite:implementation>
  <h:panelGrid>
     <composite:insertFacet name="caption"/>
  </h:panelGrid>

  <h:panelGrid>
    <!-- Uh oh. -->
    <composite:insertFacet name="backupCaption"/>
  </h:panelGrid>
</composite:implementation>
--
Lincoln Baxter, III
Co-Founder of OcpSoft
Author of PrettyFaces URL Rewriting for JSF