> 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 <[email protected]>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: [email protected]
> For additional commands, e-mail: [email protected]
>
>
--
Pedro Henrique Oliveira dos Santos