incubator-adffaces-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From noah <iamn...@gmail.com>
Subject Re: Components reinjected losing disabled state
Date Fri, 23 Mar 2007 19:48:24 GMT
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