Re: ValueChangeListener + composite components
FYI: https://issues.apache.org/jira/browse/MYFACES-3112 -Matthias On Wed, Mar 16, 2011 at 6:07 PM, Jakob Korherr jakob.korh...@gmail.com wrote: Matthias, please always answer to the mailing list too, not just to my private email address. Otherwise no one can follow our discussion! I am afraid you hit a problem of JSF 2.0. It's currently not possible to retarget a special method expression (like valueChangeListener) from one composite component to another (and, of course, also not to its children). See JSF spec issue: http://java.net/jira/browse/JAVASERVERFACES_SPEC_PUBLIC-755 Regards, Jakob 2011/3/16 ZEILERBAUER Matthias matthias.zeilerba...@tirol.gv.at: Here it is: checkbox.xhtml composite:interface name=checkbox composite:attribute name=valueChangeListener method-signature=void (javax.faces.event.ValueChangeEvent) targets=${cc.attrs.id} / /composite:interface composite:implementation h:panelGroup template:labelinput2 id=${cc.attrs.id} f:facet name=inputFacet h:selectBooleanCheckbox id=inputComponent value=#{cc.attrs.value} composite:insertChildren / /h:selectBooleanCheckbox /f:facet /template:labelinput2 /h:panelGroup /composite:implementation labelinput2.xhtml composite:interface name=labelinput componentType=javax.faces.Input !-- Events -- composite:attribute name=valueChangeListener method-signature=void f(javax.faces.event.ValueChangeEvent) targets=inputComponent / !-- Facets -- composite:facet name=inputFacet / composite:facet name=textFacet / !-- Component Ids -- composite:editableValueHolder name=inputComponent / /composite:interface composite:implementation h:panelGroup div h:panelGroup div h:outputLabel for=inputComponent#{cc.attrs.label}/h:outputLabel /div /h:panelGroup div composite:renderFacet name=inputFacet required=true / composite:renderFacet name=textFacet / composite:insertChildren / /div div h:message for=inputComponent / /div /div /h:panelGroup /composite:implementation LG Matthias -Ursprüngliche Nachricht- Von: sethfromaust...@gmail.com [mailto:sethfromaust...@gmail.com] Im Auftrag von Jakob Korherr Gesendet: Mittwoch, 16. März 2011 16:54 An: MyFaces Development Cc: ZEILERBAUER Matthias Betreff: Re: ValueChangeListener + composite components Hi, the standard component is a UINamingContainer. Could you please send me the whole markup of the composite component? Regards, Jakob 2011/3/16 ZEILERBAUER Matthias matthias.zeilerba...@tirol.gv.at: Thanks for the code. But I still don't get it working. I didn't specify a componentType for my implementation, so it should be a standard implementation which does inherit the right finComponent() api. Also my nested composition is a standard implementation. But I do know now that the problem is with my nested compositions, that the ValueChangeListener is not passed to this nested composition. How do I do that? -Ursprüngliche Nachricht- Von: sethfromaust...@gmail.com [mailto:sethfromaust...@gmail.com] Im Auftrag von Jakob Korherr Gesendet: Mittwoch, 16. März 2011 16:21 An: MyFaces Development Cc: ZEILERBAUER Matthias Betreff: Re: ValueChangeListener + composite components Here is the code from FaceletViewDeclarationLanguage.retargetMethodExpressions: UIComponent innerComponent = topLevelComponent.findComponent(target); if (innerComponent == null) { if (log.isLoggable(Level.SEVERE)) log.severe(Inner component + target + not found when retargetMethodExpressions); continue; } ...with topLevelComponent beeing the composite component. Thus, in your example, your composite component needs to be able to find the target component via findComponent(). Please refer to the javadoc of findComponent() and check if it is implement correctly on all the components inside your composite component. My guess is that the parent component of the f:facet does not check his facets in findComponent(). Regards, Jakob 2011/3/16 ZEILERBAUER Matthias matthias.zeilerba...@tirol.gv.at: Doesn't work. I already proved it. LG Matthias -Ursprüngliche Nachricht- Von: sethfromaust...@gmail.com [mailto:sethfromaust...@gmail.com] Im Auftrag von Jakob Korherr Gesendet: Mittwoch, 16. März 2011 16:03 An: MyFaces Development Cc: ZEILERBAUER Matthias Betreff: Re: ValueChangeListener + composite components Hi Matthias, Try using the relative clientid
ValueChangeListener + composite components
Hello guys, I have a problem with the valueChangeListener on my composite component. I = have following structure: composite:interface name=3Dcheckbox ... composite:attribute name=3DvalueChangeListener targets=3DinputComponent= / ... /composite:interface composite:implementation template:c1 ... f:facet name=3DinputFacet h:inputText id=3DinputComponent / /f:facet ... /template:c1 My error message is: FaceletViewDe E Inner component valueChangeListener not found when retarge= tMethodExpressions When I tried to give the composite:attribute name=3DvalueChangeListener targets=3DinputComponent= / on my c1-Interface the Error-Message didn't appear, but the ValueChang= eListener still wasn't called. Second thing I tried was to give the h:inputText id=3DinputComponent / not in the facet-Definition, but only= in my implementation and then the ValueChangeListener worked. What is my mistake, or does composition not work properly with facets? LG
Re: ValueChangeListener + composite components
Hi Matthias, Try using the relative clientid of the h:inputText from within your composite component, thus something like container1:container2:inputComponent. Also, please ask questions like this one only at us...@myfaces.apache.org, thanks. Regards, Jakob 2011/3/16 ZEILERBAUER Matthias matthias.zeilerba...@tirol.gv.at: Hello guys, I have a problem with the valueChangeListener on my composite component. I = have following structure: composite:interface name=3Dcheckbox ... composite:attribute name=3DvalueChangeListener targets=3DinputComponent= / ... /composite:interface composite:implementation template:c1 ... f:facet name=3DinputFacet h:inputText id=3DinputComponent / /f:facet ... /template:c1 My error message is: FaceletViewDe E Inner component valueChangeListener not found when retarge= tMethodExpressions When I tried to give the composite:attribute name=3DvalueChangeListener targets=3DinputComponent= / on my c1-Interface the Error-Message didn't appear, but the ValueChang= eListener still wasn't called. Second thing I tried was to give the h:inputText id=3DinputComponent / not in the facet-Definition, but only= in my implementation and then the ValueChangeListener worked. What is my mistake, or does composition not work properly with facets? LG -- Jakob Korherr blog: http://www.jakobk.com twitter: http://twitter.com/jakobkorherr work: http://www.irian.at
Re: ValueChangeListener + composite components
Here is the code from FaceletViewDeclarationLanguage.retargetMethodExpressions: UIComponent innerComponent = topLevelComponent.findComponent(target); if (innerComponent == null) { if (log.isLoggable(Level.SEVERE)) log.severe(Inner component + target + not found when retargetMethodExpressions); continue; } ...with topLevelComponent beeing the composite component. Thus, in your example, your composite component needs to be able to find the target component via findComponent(). Please refer to the javadoc of findComponent() and check if it is implement correctly on all the components inside your composite component. My guess is that the parent component of the f:facet does not check his facets in findComponent(). Regards, Jakob 2011/3/16 ZEILERBAUER Matthias matthias.zeilerba...@tirol.gv.at: Doesn't work. I already proved it. LG Matthias -Ursprüngliche Nachricht- Von: sethfromaust...@gmail.com [mailto:sethfromaust...@gmail.com] Im Auftrag von Jakob Korherr Gesendet: Mittwoch, 16. März 2011 16:03 An: MyFaces Development Cc: ZEILERBAUER Matthias Betreff: Re: ValueChangeListener + composite components Hi Matthias, Try using the relative clientid of the h:inputText from within your composite component, thus something like container1:container2:inputComponent. Also, please ask questions like this one only at us...@myfaces.apache.org, thanks. Regards, Jakob 2011/3/16 ZEILERBAUER Matthias matthias.zeilerba...@tirol.gv.at: Hello guys, I have a problem with the valueChangeListener on my composite component. I = have following structure: composite:interface name=3Dcheckbox ... composite:attribute name=3DvalueChangeListener targets=3DinputComponent= / ... /composite:interface composite:implementation template:c1 ... f:facet name=3DinputFacet h:inputText id=3DinputComponent / /f:facet ... /template:c1 My error message is: FaceletViewDe E Inner component valueChangeListener not found when retarge= tMethodExpressions When I tried to give the composite:attribute name=3DvalueChangeListener targets=3DinputComponent= / on my c1-Interface the Error-Message didn't appear, but the ValueChang= eListener still wasn't called. Second thing I tried was to give the h:inputText id=3DinputComponent / not in the facet-Definition, but only= in my implementation and then the ValueChangeListener worked. What is my mistake, or does composition not work properly with facets? LG -- Jakob Korherr blog: http://www.jakobk.com twitter: http://twitter.com/jakobkorherr work: http://www.irian.at -- Jakob Korherr blog: http://www.jakobk.com twitter: http://twitter.com/jakobkorherr work: http://www.irian.at
Re: ValueChangeListener + composite components
Hi, the standard component is a UINamingContainer. Could you please send me the whole markup of the composite component? Regards, Jakob 2011/3/16 ZEILERBAUER Matthias matthias.zeilerba...@tirol.gv.at: Thanks for the code. But I still don't get it working. I didn't specify a componentType for my implementation, so it should be a standard implementation which does inherit the right finComponent() api. Also my nested composition is a standard implementation. But I do know now that the problem is with my nested compositions, that the ValueChangeListener is not passed to this nested composition. How do I do that? -Ursprüngliche Nachricht- Von: sethfromaust...@gmail.com [mailto:sethfromaust...@gmail.com] Im Auftrag von Jakob Korherr Gesendet: Mittwoch, 16. März 2011 16:21 An: MyFaces Development Cc: ZEILERBAUER Matthias Betreff: Re: ValueChangeListener + composite components Here is the code from FaceletViewDeclarationLanguage.retargetMethodExpressions: UIComponent innerComponent = topLevelComponent.findComponent(target); if (innerComponent == null) { if (log.isLoggable(Level.SEVERE)) log.severe(Inner component + target + not found when retargetMethodExpressions); continue; } ...with topLevelComponent beeing the composite component. Thus, in your example, your composite component needs to be able to find the target component via findComponent(). Please refer to the javadoc of findComponent() and check if it is implement correctly on all the components inside your composite component. My guess is that the parent component of the f:facet does not check his facets in findComponent(). Regards, Jakob 2011/3/16 ZEILERBAUER Matthias matthias.zeilerba...@tirol.gv.at: Doesn't work. I already proved it. LG Matthias -Ursprüngliche Nachricht- Von: sethfromaust...@gmail.com [mailto:sethfromaust...@gmail.com] Im Auftrag von Jakob Korherr Gesendet: Mittwoch, 16. März 2011 16:03 An: MyFaces Development Cc: ZEILERBAUER Matthias Betreff: Re: ValueChangeListener + composite components Hi Matthias, Try using the relative clientid of the h:inputText from within your composite component, thus something like container1:container2:inputComponent. Also, please ask questions like this one only at us...@myfaces.apache.org, thanks. Regards, Jakob 2011/3/16 ZEILERBAUER Matthias matthias.zeilerba...@tirol.gv.at: Hello guys, I have a problem with the valueChangeListener on my composite component. I = have following structure: composite:interface name=3Dcheckbox ... composite:attribute name=3DvalueChangeListener targets=3DinputComponent= / ... /composite:interface composite:implementation template:c1 ... f:facet name=3DinputFacet h:inputText id=3DinputComponent / /f:facet ... /template:c1 My error message is: FaceletViewDe E Inner component valueChangeListener not found when retarge= tMethodExpressions When I tried to give the composite:attribute name=3DvalueChangeListener targets=3DinputComponent= / on my c1-Interface the Error-Message didn't appear, but the ValueChang= eListener still wasn't called. Second thing I tried was to give the h:inputText id=3DinputComponent / not in the facet-Definition, but only= in my implementation and then the ValueChangeListener worked. What is my mistake, or does composition not work properly with facets? LG -- Jakob Korherr blog: http://www.jakobk.com twitter: http://twitter.com/jakobkorherr work: http://www.irian.at -- Jakob Korherr blog: http://www.jakobk.com twitter: http://twitter.com/jakobkorherr work: http://www.irian.at -- Jakob Korherr blog: http://www.jakobk.com twitter: http://twitter.com/jakobkorherr work: http://www.irian.at
Re: ValueChangeListener + composite components
Matthias, please always answer to the mailing list too, not just to my private email address. Otherwise no one can follow our discussion! I am afraid you hit a problem of JSF 2.0. It's currently not possible to retarget a special method expression (like valueChangeListener) from one composite component to another (and, of course, also not to its children). See JSF spec issue: http://java.net/jira/browse/JAVASERVERFACES_SPEC_PUBLIC-755 Regards, Jakob 2011/3/16 ZEILERBAUER Matthias matthias.zeilerba...@tirol.gv.at: Here it is: checkbox.xhtml composite:interface name=checkbox composite:attribute name=valueChangeListener method-signature=void (javax.faces.event.ValueChangeEvent) targets=${cc.attrs.id} / /composite:interface composite:implementation h:panelGroup template:labelinput2 id=${cc.attrs.id} f:facet name=inputFacet h:selectBooleanCheckbox id=inputComponent value=#{cc.attrs.value} composite:insertChildren / /h:selectBooleanCheckbox /f:facet /template:labelinput2 /h:panelGroup /composite:implementation labelinput2.xhtml composite:interface name=labelinput componentType=javax.faces.Input !-- Events -- composite:attribute name=valueChangeListener method-signature=void f(javax.faces.event.ValueChangeEvent) targets=inputComponent / !-- Facets -- composite:facet name=inputFacet / composite:facet name=textFacet / !-- Component Ids -- composite:editableValueHolder name=inputComponent / /composite:interface composite:implementation h:panelGroup div h:panelGroup div h:outputLabel for=inputComponent#{cc.attrs.label}/h:outputLabel /div /h:panelGroup div composite:renderFacet name=inputFacet required=true / composite:renderFacet name=textFacet / composite:insertChildren / /div div h:message for=inputComponent / /div /div /h:panelGroup /composite:implementation LG Matthias -Ursprüngliche Nachricht- Von: sethfromaust...@gmail.com [mailto:sethfromaust...@gmail.com] Im Auftrag von Jakob Korherr Gesendet: Mittwoch, 16. März 2011 16:54 An: MyFaces Development Cc: ZEILERBAUER Matthias Betreff: Re: ValueChangeListener + composite components Hi, the standard component is a UINamingContainer. Could you please send me the whole markup of the composite component? Regards, Jakob 2011/3/16 ZEILERBAUER Matthias matthias.zeilerba...@tirol.gv.at: Thanks for the code. But I still don't get it working. I didn't specify a componentType for my implementation, so it should be a standard implementation which does inherit the right finComponent() api. Also my nested composition is a standard implementation. But I do know now that the problem is with my nested compositions, that the ValueChangeListener is not passed to this nested composition. How do I do that? -Ursprüngliche Nachricht- Von: sethfromaust...@gmail.com [mailto:sethfromaust...@gmail.com] Im Auftrag von Jakob Korherr Gesendet: Mittwoch, 16. März 2011 16:21 An: MyFaces Development Cc: ZEILERBAUER Matthias Betreff: Re: ValueChangeListener + composite components Here is the code from FaceletViewDeclarationLanguage.retargetMethodExpressions: UIComponent innerComponent = topLevelComponent.findComponent(target); if (innerComponent == null) { if (log.isLoggable(Level.SEVERE)) log.severe(Inner component + target + not found when retargetMethodExpressions); continue; } ...with topLevelComponent beeing the composite component. Thus, in your example, your composite component needs to be able to find the target component via findComponent(). Please refer to the javadoc of findComponent() and check if it is implement correctly on all the components inside your composite component. My guess is that the parent component of the f:facet does not check his facets in findComponent(). Regards, Jakob 2011/3/16 ZEILERBAUER Matthias matthias.zeilerba...@tirol.gv.at: Doesn't work. I already proved it. LG Matthias -Ursprüngliche Nachricht- Von: sethfromaust...@gmail.com [mailto:sethfromaust...@gmail.com] Im Auftrag von Jakob Korherr Gesendet: Mittwoch, 16. März 2011 16:03 An: MyFaces Development Cc: ZEILERBAUER Matthias Betreff: Re: ValueChangeListener + composite components Hi Matthias, Try using the relative clientid of the h:inputText from within your composite component, thus something like container1:container2:inputComponent. Also, please ask questions like this one only at us