Hi,

I have a Panel (myPanel) containing some child components. When I say:
myPanel.setEnabled(false);
I want to disable the panel, but also disable all children.

Preferably, I'd override setEnabled, but since it is final (sigh), this is impossible. A less elegant way to do it is to supply a public setChildrenEnabled method, or something. Usually, the applications I build try to be as implementation-agnostic as possible regarding the specific component subclasses, i.e. declare myPanel as Panel or even Component where possible. In that case, classes that use myPanel don't see setChildrenEnabled unless they cast it to MyPanel.

Another way would be to override onBeforeRender and use a Component.IVisitor to call setEnabled on all children. This works, but seems to me like the wrong moment to do this. Also, it would not allow you to disable myPanel but enable some specific child (since that would be overruled in onBeforeRender of MyPanel).

I think it comes down to the semantics of setEnabled. What does it mean when a component is disabled? What does it mean to a child when its parent is disabled? (this is starting to sound like a charity ad.)

Anyways. Any ideas?

--
Matthijs Wensveen
Func. Internet Integration
W http://www.func.nl
T +31 20 4230000
F +31 20 4223500

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to