You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@wicket.apache.org by Bart Molenkamp <b....@bizzdesign.nl> on 2007/12/12 09:25:01 UTC

Component.initModel() doesn't handle IComponentAssignedModel correctly?

Hi,

I think the Component.initModel() isn't working correctly.
IComponentAssignedModel implementations don't get a wrapped
model. This e.g. breaks the ResourceModel.

I think that the line around 1490 should change from

  model = initModel();

to:

  model = wrap(initModel());

Is this correct?

Thanks,
Bart.

Re: Component.initModel() doesn't handle IComponentAssignedModel correctly?

Posted by Johan Compagner <jc...@gmail.com>.
No it was not forgotton because init model is build voor looking up
inherited models, i have never seen it used that there just a model is
created. The best thing is to do the wrap first yourself in init
model. Have to checkout what the result is if we also wrap that result
again.

On 12/12/07, Bart Molenkamp <b....@bizzdesign.nl> wrote:
> No, not an IComponentInheritedModel but in IComponentAssignedModel.
> ResourceModel implements this interface for example.
>
> If I have e.g. a subclass of Label and override the initModel(), I
> return a new ResourceModel(...) there. But then the resource
> model's wrapOnAssignment() is not called.
>
> But if I do a setModel(new ResourceModel(...)) (e.g. in the constructor)
> then the wrapOnAssignment() is called.
>
> So I think that it was simply forgotten to wrap the result of
> initModel() (see wrap() in Component class).
>
> Bart.
>
> > -----Oorspronkelijk bericht-----
> > Van: Johan Compagner [mailto:jcompagner@gmail.com]
> > Verzonden: woensdag 12 december 2007 11:20
> > Aan: dev@wicket.apache.org
> > Onderwerp: Re: Component.initModel() doesn't handle
> > IComponentAssignedModel correctly?
> >
> > Hmm so you have a IComponentInheritedModel that returns with the
> > getWrapModel call
> > a IWrapModel that is also a IComponentAssignedModel??
> >
> > johan
> >
> >
> >
> > On Dec 12, 2007 9:25 AM, Bart Molenkamp
> > <b....@bizzdesign.nl> wrote:
> >
> > > Hi,
> > >
> > > I think the Component.initModel() isn't working correctly.
> > > IComponentAssignedModel implementations don't get a wrapped
> > > model. This e.g. breaks the ResourceModel.
> > >
> > > I think that the line around 1490 should change from
> > >
> > >  model = initModel();
> > >
> > > to:
> > >
> > >  model = wrap(initModel());
> > >
> > > Is this correct?
> > >
> > > Thanks,
> > > Bart.
> > >
> >
>

RE: Component.initModel() doesn't handle IComponentAssignedModel correctly?

Posted by Bart Molenkamp <b....@bizzdesign.nl>.
No, not an IComponentInheritedModel but in IComponentAssignedModel.
ResourceModel implements this interface for example.

If I have e.g. a subclass of Label and override the initModel(), I
return a new ResourceModel(...) there. But then the resource
model's wrapOnAssignment() is not called.

But if I do a setModel(new ResourceModel(...)) (e.g. in the constructor)
then the wrapOnAssignment() is called.

So I think that it was simply forgotten to wrap the result of
initModel() (see wrap() in Component class).

Bart.

> -----Oorspronkelijk bericht-----
> Van: Johan Compagner [mailto:jcompagner@gmail.com]
> Verzonden: woensdag 12 december 2007 11:20
> Aan: dev@wicket.apache.org
> Onderwerp: Re: Component.initModel() doesn't handle
> IComponentAssignedModel correctly?
>
> Hmm so you have a IComponentInheritedModel that returns with the
> getWrapModel call
> a IWrapModel that is also a IComponentAssignedModel??
>
> johan
>
>
>
> On Dec 12, 2007 9:25 AM, Bart Molenkamp
> <b....@bizzdesign.nl> wrote:
>
> > Hi,
> >
> > I think the Component.initModel() isn't working correctly.
> > IComponentAssignedModel implementations don't get a wrapped
> > model. This e.g. breaks the ResourceModel.
> >
> > I think that the line around 1490 should change from
> >
> >  model = initModel();
> >
> > to:
> >
> >  model = wrap(initModel());
> >
> > Is this correct?
> >
> > Thanks,
> > Bart.
> >
>

Re: Component.initModel() doesn't handle IComponentAssignedModel correctly?

Posted by Johan Compagner <jc...@gmail.com>.
Hmm so you have a IComponentInheritedModel that returns with the
getWrapModel call
a IWrapModel that is also a IComponentAssignedModel??

johan



On Dec 12, 2007 9:25 AM, Bart Molenkamp <b....@bizzdesign.nl> wrote:

> Hi,
>
> I think the Component.initModel() isn't working correctly.
> IComponentAssignedModel implementations don't get a wrapped
> model. This e.g. breaks the ResourceModel.
>
> I think that the line around 1490 should change from
>
>  model = initModel();
>
> to:
>
>  model = wrap(initModel());
>
> Is this correct?
>
> Thanks,
> Bart.
>