By adding a ComponentStateListener to the component's 
"getComponentStateListeners" list and then adding/removing the decorator inside 
the "enabledChanged" method of your listener.

Something like this:
        comp.getComponentStateListeners().add(new ComponentStateListener() {
                @Override
                public void enabledChanged(Component component) {
                        if (component.isEnabled())
                                remove decorator
                        else
                                attach decorator
                }
        });

Something like that (you'd have to put in a "focusedChanged" method also in 
this example), but hopefully you get the idea.

Roger Whitcomb | Architect, Engineering | roger.whitc...@actian.com| Actian 
Corp. | 500 Arguello Street | Suite 200 | Redwood City | CA | 94063 | USA  | +1 
650-587-5596 | fax: +1 650-587-5550


-----Original Message-----
From: Bill van Melle [mailto:bill.van.me...@gmail.com] 
Sent: Tuesday, October 11, 2011 11:59 PM
To: dev@pivot.apache.org
Subject: Re: [jira] [Commented] (PIVOT-798) Component#isEnabled does not affect 
appearance recursively

On Tue, Oct 11, 2011 at 8:43 PM, Greg Brown <gk_br...@verizon.net> wrote:

> > It took me a while to figure out I could simply
> > override the skin's enabledChanged method to add or remove the decorator,
> > but now I'm good.
>
> Another option is to listen for changes to the enabled property of the
> container, if that makes sense for your app.
>

Isn't that what I'm doing by overriding enabledChanged?  Not sure what
you're getting at.

Reply via email to