I know IComponentOnBeforeRenderListener, but I cannot use this
interface, because I need to condition
the instantiation of the children of my component, depending of the
functionality of the Listener.
And if I use IComponentOnBeforeRenderListener, the instantiation has
been finished when the interface
is called.
The best moment to use this functionality is in the
IComponentInstantiationListener... because any children
have been still instantiated.

> There is now - since a few weeks - also
> org.apache.wicket.application.IComponentOnBeforeRenderListener, which
> may suit your needs better.
>
> We (Teachscape) use it like:
>
> public final class ValidationListener implements
> IComponentOnBeforeRenderListener {
>
>   public void onBeforeRender(Component component) {
>     if (component instanceof FormComponent && !component.hasBeenRendered()) {
>       // add validators
>       processComponent((FormComponent) component);
>     }
> }
>
> and in our application's init method:
>
> addComponentOnBeforeRenderListener(new ValidationListener());
>
>
> Eelco
>
> On 6/18/07, Alberto Bueno <[EMAIL PROTECTED]> wrote:
>   
>> Hi,
>>
>> I'm using IComponentInstantiationListener to add additional
>> functionality to my components. But in this listener I need to know the
>> model of the component to condition this functionality.
>> If we inspect the code, we can see that the listeners are called before
>> assigning the model to the component:
>>
>>     public Component(final String id, final IModel model)
>>     {
>>         setId(id);
>>         getApplication().notifyComponentInstantiationListeners(this);
>>         this.model = wrap(model);
>>
>>         final IDebugSettings debugSettings =
>> Application.get().getDebugSettings();
>>         if (debugSettings.getComponentUseCheck())
>>         {
>>             setMetaData(CONSTRUCTED_AT_KEY, Strings.toString(this, new
>> MarkupException(
>>                     "constructed")));
>>         }
>>     }
>>
>> Are there any reason to do the notification in that moment?
>>
>> Thanks
>>
>>
>>
>> -------------------------------------------------------------------------
>> This SF.net email is sponsored by DB2 Express
>> Download DB2 Express C - the FREE version of DB2 express and take
>> control of your XML. No limits. Just data. Click to get it now.
>> http://sourceforge.net/powerbar/db2/
>> _______________________________________________
>> Wicket-user mailing list
>> Wicket-user@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/wicket-user
>>
>>     
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by DB2 Express
> Download DB2 Express C - the FREE version of DB2 express and take
> control of your XML. No limits. Just data. Click to get it now.
> http://sourceforge.net/powerbar/db2/
> _______________________________________________
> Wicket-user mailing list
> Wicket-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/wicket-user
>   



-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to