you could look at;

IComponentOnBeforeRenderListener


On 10/26/07, Mattijs Hoitink <[EMAIL PROTECTED]> wrote:
>
> hi there,
>
> I have written a behavior to change the appearance of a form component
> when it's invalid.
> I'm now looking for a way to automatically  add this behavior to all
> components in a form.
>
> I already played around with visitFormComponents like this:
> visitFormComponents(new FormComponent.AbstractVisitor() {
>     @Override
>     protected void onFormComponent(FormComponent formComponent) {
>         if(!(formComponent instanceof Button)) {
>             formComponent.add(new ValidationStyleBehavior());
>         }
>     }
> });
>
> The code above is working like it's supposed to. But if I use it in this
> way, I have to repeat this piece of code in the constructor of all the
> forms in my application.
>
> My question is: What would be the best way to have a Form execute this
> code? With another behavior on the form, that visits the form components
> and adds the second behavior? Or by implementing an interface? Or am I
> stuck with repeating the code for every form?
>
> --
> Mattijs Hoitink
> Func. Internet Integration
> W http://www.func.nl
> T +31 20 4230000 <LiveCall:+31204230000>
> F +31 20 4223500 <LiveCall:+31204223500>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

Reply via email to