Hi<br><br><div class="gmail_quote">2010/10/19 Ed Burns <span dir="ltr"><<a href="mailto:edward.burns@oracle.com">edward.burns@oracle.com</a>></span><br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
>>>>> On Mon, 18 Oct 2010 20:36:06 -0500, Leonardo Uribe <<a href="mailto:lu4242@gmail.com">lu4242@gmail.com</a>> said:<br>
<br>
[...]<br>
<br>
LU> There are two possible alternatives here:<br>
<br>
LU> 1. Implement the algorithm proposed for retargetMethodExpressions<br>
LU> and ignore composite:attribute "targets" property says.<br>
<br>
LU> 2. Implement the expected behavior of composite:attribute "targets"<br>
LU> property and make some changes to retargetMethodExpressions<br>
LU> algorithm.<br>
<br>
LU> The intention is take option 2 and include it for JSF 2.0, because<br>
LU> in theory should be handled as an implementation detail of the<br>
LU> algorithm (anyway it could be good to update the documentation with<br>
LU> 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> For "action", "actionListener", "validator" and<br>
LU> "valueChangeListener" it is clear that the action to take is<br>
LU> something like this:<br>
<br>
LU> - If target is a composite component and that one "retarget" to<br>
LU> other components and additionally does not implements<br>
LU> [ActionSource2/EditableValueHolder], call:<br>
<br>
LU> targetComponent.getAttributes().put(attributeName,<br>
LU> attributeNameValueExpression);<br>
<br>
LU> and call retargetMethodExpressions recursively. Take care of<br>
LU> apply the method twice and if the property pointed by<br>
LU> "attributeName" 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'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><composite:interface componentType="org.apache.myfaces.InputHtml"><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, ...), "targets" 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 "targets" behavior applies I have something like this:<br><br>if (isCompositeComponentRetarget(context, innerComponent, attributeName) && !(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> The tricky part is how to handle generic method expression<br>
LU> 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's Group Conference<br>
</font></blockquote></div><br>