You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by Sylvain Vieujot <sv...@apache.org> on 2004/11/23 05:39:22 UTC

New "permanent" attribute to x:aliasBean

The aliasBean didn't work with commandButtons.

The problem is that when events are broadcasted, the tag has no way
(that I'm aware of) to intercept the calls to it's children broadcast.
So, it can't make/remove the alias before/after the call to a child
h:commandButton action.

The only way I've found to solve this is to add a new attribute named
permanent to the x:aliasBean.
So if permanent="true" is added to the tag, the alias isn't removed when
the tag is closed.

I know, this is quite ugly, but I didn't find a better way to handle
this case.

Suggestions to improve this and find a way to remove this attribute
would be very welcome.

Sylvain.

Re: New "permanent" attribute to x:aliasBean

Posted by Sylvain Vieujot <sv...@apache.org>.
You're right, it works great.

Thanks for the trick.

Sylvain.

On Tue, 2004-11-23 at 09:15 +0100, Manfred Geiler wrote:

> Sylvain,
> Do you have a custom "aliasBean" component associated with the tag?
> If yes, you could do the same trick as the UIData does. UIData wraps 
> each Event in a private FacesEventWrapper class so that it has total 
> control of the situation (i.e. the current row) for broadcasting the 
> real Event to the actual component.
> Look at the queueEvent and broadcast methods in 
> javax.faces.component.UIData to see what I mean.
> 
> HTH,
> Manfred
> 
> 
> Sylvain Vieujot wrote:
> > The aliasBean didn't work with commandButton/s/.
> > 
> > The problem is that when events are broadcasted, the tag has no way 
> > (that I'm aware of) to intercept the calls to it's children broadcast.
> > So, it can't make/remove the alias before/after the call to a child 
> > h:commandButton action.
> > 
> > The only way I've found to solve this is to add a new attribute named 
> > *permanent* to the x:aliasBean.
> > So if permanent="true" is added to the tag, the alias isn't removed when 
> > the tag is closed.
> > 
> > I know, this is quite ugly, but I didn't find a better way to handle 
> > this case.
> > 
> > Suggestions to improve this and find a way to remove this attribute 
> > would be very welcome.
> > 
> > Sylvain.

Re: New "permanent" attribute to x:aliasBean

Posted by Manfred Geiler <ma...@apache.org>.
Sylvain,
Do you have a custom "aliasBean" component associated with the tag?
If yes, you could do the same trick as the UIData does. UIData wraps 
each Event in a private FacesEventWrapper class so that it has total 
control of the situation (i.e. the current row) for broadcasting the 
real Event to the actual component.
Look at the queueEvent and broadcast methods in 
javax.faces.component.UIData to see what I mean.

HTH,
Manfred


Sylvain Vieujot wrote:
> The aliasBean didn't work with commandButton/s/.
> 
> The problem is that when events are broadcasted, the tag has no way 
> (that I'm aware of) to intercept the calls to it's children broadcast.
> So, it can't make/remove the alias before/after the call to a child 
> h:commandButton action.
> 
> The only way I've found to solve this is to add a new attribute named 
> *permanent* to the x:aliasBean.
> So if permanent="true" is added to the tag, the alias isn't removed when 
> the tag is closed.
> 
> I know, this is quite ugly, but I didn't find a better way to handle 
> this case.
> 
> Suggestions to improve this and find a way to remove this attribute 
> would be very welcome.
> 
> Sylvain.