Hi Ludovic,
i've had similar problem with closeListener of primefaces dialog inside
composite components, my workaround was as follows:
<composite:interface componentType="yourpackage.ModalComposite">
<composite:attribute name="closeListener" method-signature="void
method(org.primefaces.event.CloseEvent)" shortDescription="action to call on
close - signature: void method(org.primefaces.event.CloseEvent)"/>
... other attributes...
<composite:implementation
<p:dialog header="#{cc.attrs.header}"
//some attrs
>
<p:ajax event="close"
listener="#{cc.closeListener}" //here is the important part
update="#{cc.attrs.onCloseUpdate}"
process="@this"/>
//other stuff
and finally the java class which handles the component
@FacesComponent(value="yourpackage.ModalComposite")
public class ModalComposite extends UINamingContainer {
@Override
public String getFamily() {
return "javax.faces.NamingContainer"; // Important! Required for
composite components.
}
public void closeListener(CloseEvent event) {
FacesContext context = FacesContext.getCurrentInstance();
MethodExpression ajaxEventListener = (MethodExpression)
getAttributes().get("closeListener");
if(ajaxEventListener != null){
ajaxEventListener.invoke(context.getELContext(), new Object[] {
event });
}
}
and here is how to use it:
<tag:modalComposite...
closeListener="#{myBean.clearSelection}"
public class MyBean {
public void clearSelection(CloseEvent event){
this.selectedPeople = null;
}
}
maybe it helps as workaround for you..
Att,
Rafael M. Pestano
Desenvolvedor Java Cia. de Processamento de Dados do Rio Grande do Sul
Graduando em Ciência da Computação UFRGS
http://conventionsframework.org
http://rpestano.wordpress.com/
@realpestano
________________________________
De: "[email protected]" <[email protected]>
Para: [email protected]
Enviadas: Segunda-feira, 23 de Julho de 2012 14:53
Assunto: Re: Passing method parameters to nested composite component
On 23/07/2012 19:39, Leonardo Uribe wrote:
> Hi
>
> Thinking more about it, check if both composite components define the
> attribute with method-signature. In theory, if there is a bug, it
> should be possible to reproduce it excluding primefaces and using
> actionListener or valueChangeListener instead. But first try the
> syntax using "targets" instead the cc EL expression.
I immediatly tried "targets" when you pointed it (on both declarations). It did
not help.
Both composite components declare the attribute with "method-signature".
The value is used by the inner control in an ajax declaration of a primefaces
p:datatable :
<p:ajax event="rowEdit" update="#{cc.attrs.onRowEdit}"
listener="#{cc.attrs.onRowEditListener}" />
I do not see how to use actionListener or valueChangeListener there.
I tried (dirty) using cc.parent.attrs.onRowEditListener instead, and it did not
help.
h:outputText of cc.parent.attrs.onRowEditListener seems correct :
org.apache.el.MethodExpressionImpl@358f0647
Thx,
Ludovic
|
| AVANT D'IMPRIMER, PENSEZ A L'ENVIRONNEMENT.
|