yes, of course. the name could go away and be folded into PropertyModel.
but we need this in core because there is no way to use certain components
like ExternalLink with a compound model without it. maybe we can add
a check somehow?
Johan Compagner wrote:
>
> Then that name of that class is really wrong
> So it is a model for something that isn't uses as the real model of the
> component??
> Now it is just very fuzzy, and if used as normal model you get an
> exception.
> So thats not something i like to have in the core, that we can have a
> model
> that can't be used as a model... (normal model)
>
> johan
>
>
> On 4/5/07, Jonathan Locke <[EMAIL PROTECTED]> wrote:
>>
>>
>>
>>
>> Johan Compagner wrote:
>> >
>> > That one really doesn't work if i understand correctly what it should
>> do
>> >
>> > i guess it should do this:
>> >
>> > Form form = new Form(new CompoundModel(new Person))l
>> > form.add(new TextField(new ComponentPropertyModel("name")))
>> >
>>
>> no. it's for use with something like ExternalLink which takes IModels
>> that cannot work with compound models yet. the code above already
>> works with just: new TextField("name")
>>
>>
>>
>> >
>> > AssignmentWrapper(final Component component, final String propertyName)
>> >
>> > /**
>> > * @see wicket.model.INestedModelContainer#getNestedModel()
>> > */
>> > public IModel getNestedModel()
>> > {
>> > return component.getModel();
>> > }
>> >
>> > And this piece of code is really wrong. the getNestedModel should
>> return
>> > the
>> > parent model of the current model and that is not the
>> component.getModel
>> ()
>> > because that is the assigmentwrapper it self!
>> >
>> >
>>
>> the component has no model in the case where you use this class
>> so getModel will find the compound model via initModel().
>>
>> use case for this model is ONLY:
>>
>> final ExternalLink titleLink = new ExternalLink("title",
>> new ComponentPropertyModel("link"), new
>> ComponentPropertyModel(
>> "title"));
>>
>> where more than one model is being used by a component and that component
>> cannot directly support compound propertymodels. the idea is that this
>> functionality
>> will be folded into PropertyModel so the use case will just be:
>>
>> final ExternalLink titleLink = new ExternalLink("title",
>> new PropertyModel("link"), new PropertyModel(
>> "title"));
>>
>> again, the component has no model. it's referencing the compound
>> property
>> model
>> of the parent.
>>
>>
>> --
>> View this message in context:
>> http://www.nabble.com/The-new-ComponentPropertyModel-tf3531176.html#a9859800
>> Sent from the Wicket - Dev mailing list archive at Nabble.com.
>>
>>
>
>
--
View this message in context:
http://www.nabble.com/The-new-ComponentPropertyModel-tf3531176.html#a9861453
Sent from the Wicket - Dev mailing list archive at Nabble.com.