incubator-adffaces-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Daniel Hannum" <dhan...@quovadx.com>
Subject RE: Components reinjected losing disabled state
Date Fri, 23 Mar 2007 19:53:03 GMT
All sorts of options...

Simply using the null outcome is the easiest fix, but I agree that it
should be defining disabledness in the xhtml and using a method as you
describe that would contain that logic, or include the login in the
xhtml if it's simple.

Thanks!

-----Original Message-----
From: noah [mailto:iamnoah@gmail.com] 
Sent: Friday, March 23, 2007 3:48 PM
To: adffaces-user@incubator.apache.org
Subject: Re: Components reinjected losing disabled state

On 3/23/07, Daniel Hannum <dhannum@quovadx.com> wrote:
> It's not request scoped, so I could do
>
> public MyComponent getMyComponent() {
>         myComponent.setDisabled(radioButtonValue == 1);
>         return myComponent;
> }
>
> But that's ugly
>
> Best way to keep it from reseting is do it in the markup
>
> <yourComponent disabled="#{radioButtonValue == 1}"/>
>
> But that's putting a magic number in the UI. Not good.
>
> actionListeners were recommended because they don't reset the
component
> tree, but I don't like it because I really do need to do business
logic,
> it just happens to bring you back to the same page. Actions seem like
> the right thing, but they reset the tree, and there's no good place to
> put the components back the way they're supposed to be.
>
> Still seems to be no good solution. Is there something I'm not seeing?

What would be wrong with:

<yourComponent disabled="#{yourBean.isXDisabled}"/>

and yourBean having:

public boolean isXDisabled() {
   return radioButtonValue == 1;
}

That way the disabledness of the component isn't coupled directly to
the radioButton.

Mime
View raw message