I think I cannot use this solution.
The problem in that case is that the behavior is executed in another 
moment, not in instantiation time of the component.  And the children of 
the component depend of this listener.
For this reason, the only moment where I can execute the functionality 
is in the listener, when component is instantiated.

> I've had this same issue when trying to build a component 
> instantiation listener for inspecting hibernate annotations.  Since 
> the IComponentInstantiationListener interface doesn't have a hook for 
> "onModelBinding", i've tried to use Behaviors instead.  Can you try 
> something like this?
>
> public MyComponentInstantiationListener implements 
> IComponentInstantiationListener {
>     public void onInstantiation(Component component) {
>         component.add(new MyBehavior());
>     }
> }
>
> public MyBehavior extends AbstractBehavior {
>     public void bind(Component component) {
>         super.bind(component);
>
>         //inspect the model of the component and do your crazy work here
>    }
> }
>
>
> On 6/18/07, *Alberto Bueno* <[EMAIL PROTECTED] 
> <mailto:[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
>     <mailto: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