Hi<br><br><div class="gmail_quote">2010/10/19 Ed Burns <span dir="ltr">&lt;<a href="mailto:edward.burns@oracle.com">edward.burns@oracle.com</a>&gt;</span><br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
&gt;&gt;&gt;&gt;&gt; On Mon, 18 Oct 2010 20:36:06 -0500, Leonardo Uribe &lt;<a href="mailto:lu4242@gmail.com">lu4242@gmail.com</a>&gt; said:<br>
<br>
[...]<br>
<br>
LU&gt; There are two possible alternatives here:<br>
<br>
LU&gt;  1. Implement the algorithm proposed for retargetMethodExpressions<br>
LU&gt; and ignore composite:attribute &quot;targets&quot; property says.<br>
<br>
LU&gt;  2. Implement the expected behavior of composite:attribute &quot;targets&quot;<br>
LU&gt; property and make some changes to retargetMethodExpressions<br>
LU&gt; algorithm.<br>
<br>
LU&gt; The intention is take option 2 and include it for JSF 2.0, because<br>
LU&gt; in theory should be handled as an implementation detail of the<br>
LU&gt; algorithm (anyway it could be good to update the documentation with<br>
LU&gt; the same advice used for retargetAttachedObjects).<br>
<br>
Certainly you have identified a valid issue.  The root problem is that<br>
the top level component needs to have a Java programming way to expose<br>
its composite-ness.<br>
<br>
LU&gt; For &quot;action&quot;, &quot;actionListener&quot;, &quot;validator&quot; and<br>
LU&gt; &quot;valueChangeListener&quot; it is clear that the action to take is<br>
LU&gt; something like this:<br>
<br>
LU&gt;  - If target is a composite component and that one &quot;retarget&quot; to<br>
LU&gt; other components and additionally does not implements<br>
LU&gt; [ActionSource2/EditableValueHolder], call:<br>
<br>
LU&gt;    targetComponent.getAttributes().put(attributeName,<br>
LU&gt; attributeNameValueExpression);<br>
<br>
LU&gt;    and call retargetMethodExpressions recursively. Take care of<br>
LU&gt; apply the method twice and if the property pointed by<br>
LU&gt; &quot;attributeName&quot; was already set, revert its effects.<br>
<br>
The solution you propose will work, but it feels a bit too<br>
implementation-ish.  Right now we declare that every compositeComponent<br>
must be a NamingContainer.  Perhaps it&#39;s time to define a new abstract<br>
sub-class of NamingContainer that is a union of all the behavioral<br>
interfaces?<br>
<br>
public abstract class javax.faces.component.CompositeComponent<br>
implements NamingContainer, ActionSource2, EditableValueHolder {<br>
  public abstract void acceptRetargetedMethodExpressions(BeanInfo<br>
    ccMetadata);<br>
}<br>
<br></blockquote><div><br>I like the way it works now. For example, tomahawk t:inputHtml component was<br>rewritten into a composite component, and it is a good example about when it could<br>be useful that the only requerimiento for a component to be composite is implement<br>
NamingContainer:<br><br>&lt;composite:interface componentType=&quot;org.apache.myfaces.InputHtml&quot;&gt;<br><br>public class InputHtml extends HtmlInputText implements NamingContainer, UniqueIdVendor {<br><br>In my understanding, if a composite component base class implements a behavioral interface,<br>
(ActionSource2, EditableValueHolder, ...), &quot;targets&quot; behavior must not be allowed, because<br>the code handling that will be on the base class. In the example shown InputHtml extends <br>from HtmlInputText, so it implements EditableValueHolder.<br>
<br>To decide when &quot;targets&quot; behavior applies I have something like this:<br><br>if (isCompositeComponentRetarget(context, innerComponent, attributeName) &amp;&amp; !(innerComponent instanceof ActionSource2))<br>
{<br>   //cc retarget<br>}<br>else<br>{<br>  //process on innerComponent<br>}<br><br>isCompositeComponentRetarget do two things:<br><br>- Check if the component is a composite one.<br>- Check if the attribute was defined looking on the BeanInfo.<br>
<br>Leonardo<br><br></div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
LU&gt; The tricky part is how to handle generic method expression<br>
LU&gt; properties. The javadoc says:<br>
<br>
We could specify whatever we needed in that<br>
acceptRetargetedMethodExpressions() method.<br>
<br>
Ed<br>
<font color="#888888"><br>
--<br>
| <a href="mailto:edward.burns@oracle.com">edward.burns@oracle.com</a> | office: +1 407 458 0017<br>
| homepage:               | <a href="http://ridingthecrest.com/" target="_blank">http://ridingthecrest.com/</a><br>
| 16 work days until German Oracle User&#39;s Group Conference<br>
</font></blockquote></div><br>