You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by keithrbennett <ke...@gmail.com> on 2010/01/24 19:37:02 UTC

Re: Message Bundles - 1.3.2

Another related question...

I'm adding a ResourceModel to an AjaxLabelLink, and in the call to the
AjaxLabelLink's constructor, passing in:

new ResourceModel("myResourceKey")

does not work...I need to use wrapOnAssignment:

new ResourceModel("myResourceKey").wrapOnAssignment(this)

Is this the correct approach, or should I be doing it differently?

I looked briefly at the source code, and am wondering...why not just have a
ResourceModel constructor that takes a component as a parameter instead of
always using a wrapper approach?  Something to do with serialization?

Thanks,
Keith


-- 
View this message in context: http://old.nabble.com/Message-Bundles---1.3.2-tp16212900p27297793.html
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Message Bundles - 1.3.2

Posted by Pedro Santos <pe...@gmail.com>.
> I need to use wrapOnAssignment:
>
> new ResourceModel("myResourceKey").wrapOnAssignment(this)
>
> Is this the correct approach, or should I be doing it differently?

If the model of AjaxLabelLink is just an property you have created, yes this
is the correct aproach.

> I looked briefly at the source code, and am wondering...why not just have
a
> ResourceModel constructor that takes a component as a parameter instead of
> always using a wrapper approach?  Something to do with serialization?

Something to do with contracts. Wicket promises you that if you assign an
model that implements the IComponentAssignedModel to an component, an
algorithm similar to:
 void Component.setModel(IModel model)
 * {
 *     if (model instanceof IComponentAssignedModel)
 *     {
 *        this.model =
((IComponentAssignedModel)model).wrapOnAssignment(this);
 *     }
 *     else
 *     {
 *        this.model = model;
 *     }
 * }
will to be executed.


On Sun, Jan 24, 2010 at 4:37 PM, keithrbennett <ke...@gmail.com>wrote:

>
> Another related question...
>
> I'm adding a ResourceModel to an AjaxLabelLink, and in the call to the
> AjaxLabelLink's constructor, passing in:
>
> new ResourceModel("myResourceKey")
>
> does not work...I need to use wrapOnAssignment:
>
> new ResourceModel("myResourceKey").wrapOnAssignment(this)
>
> Is this the correct approach, or should I be doing it differently?
>
> I looked briefly at the source code, and am wondering...why not just have a
> ResourceModel constructor that takes a component as a parameter instead of
> always using a wrapper approach?  Something to do with serialization?
>
> Thanks,
> Keith
>
>
> --
> View this message in context:
> http://old.nabble.com/Message-Bundles---1.3.2-tp16212900p27297793.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>


-- 
Pedro Henrique Oliveira dos Santos