myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <mario.buonop...@accenture.com>
Subject RE: Change visibility dinamically
Date Tue, 27 Feb 2007 20:36:41 GMT
Yes I know, using rendered, valueBinding and managed bean I can do it,
but to use these options I have to project the application to managed
this cases. Suppose I have developed an application and in a page I have
a textbox that, at develop design, noone supposed this component could
be hide in some situation...so the text box is always rendered. In this
case I don't have no programmatic "if" and no EL expression. How can I
hide this texbox without modify the code? I  was thinking to implement a
my UIViewRoot, override the component in faces-config to force to use my
UIViewRoot and put inside my UIViewRoot all the logic.....is it
possible? Is it correct?

-----Original Message-----
From: Mike Kienenberger [mailto:mkienenb@gmail.com] 
Sent: 27 febbraio 2007 21.23
To: MyFaces Discussion
Subject: Re: Change visibility dinamically

Oops.  You're right, Simon.   It could be set programmically.   I
still think it's a bad design, but that's just my opinion.

On 2/27/07, Simon Kitching <simon.kitching@rhe.co.nz> wrote:
> Not sure what you mean, Mike.
>
> Every UIComponent has a setRendered(boolean) method that can be called
> to specify whether that component is rendered or not. This method
could
> certainly be called from a PhaseListener.
>
> Note that there is a slight flaw in the design of this method in my
> opinion; the rendered property can be specified as either an EL
> expression (ie stored as a ValueBinding) or can be a literal value set
> via setRendered(). If a value-binding is used then setRendered() can
> later be used to override that; however once rendered has been set
using
>   setRendered, there is no way to go back to using an EL expression.
In
> other words, once you've decided to manually control the rendered
state
> you cannot go back to using the original EL rendered expression.
>
> One way around this would be to use
>    // create a ValueBinding for the expression #{true}
>    setValueBinding("rendered", vb);
> rather than
>    setRendered(true);
>
> Cheers,
>
> Simon
>
> Mike Kienenberger wrote:
> > You can only set the rendered property of a component from the
values
> > of a managed bean (unless you're using facelet functions or
customized
> > el resolvers).   Your managed bean can call whatever java code you
> > want it to.
> >
> > If you give more specific details of what you're trying to
accomplish,
> > maybe we can help you more.
> >
> >
> > On 2/27/07, mario.buonopane@accenture.com
> > <mario.buonopane@accenture.com> wrote:
> >>
> >>
> >>
> >>
> >> I wanna change the behavior of my application changing the
visibility of
> >> some component basing of specific rules but I don't wan put this
logic
> >> in my
> >> Managed Bean but externally. May be implementing a Phase Listener
can
> >> help
> >> me to do this? In wich Phase should I set the visible property of
my
> >> components?
> >>
>


This message is for the designated recipient only and may contain privileged, proprietary,
or otherwise private information.  If you have received it in error, please notify the sender
immediately and delete the original.  Any other use of the email by you is prohibited.

Mime
View raw message