why would the models component have to be null?
couldn't it be the one with the compound?
Or be the one with another main model?

But this model (that is still not really a model) is just so that this
constructor:

public ExternalLink(final String id, final IModel href, final IModel label)

can be called with 1 or 2 models that take the value out of a compount
model??

Just use a property model for that... and do it yourself.

new ExternalLink("id", new PropertyModel("href", XXXX), new
PropertyModel("label", XXXX))

and XXX can be a compound or another model.

the only thing you avoid here is the XXXX part because you still have to do
new XxxxModel("label")
so what is the gain here?
What we do gain is suddenly models implementations that aren't really model
implementations.


johan


On 4/5/07, Jonathan Locke <[EMAIL PROTECTED]> wrote:



maybe when a wrap occurs on one of these we can check to make sure
the model of the component is null (compound property model is being
inherited).  we would need to expose Component's check of model == null
in getModel() through something like isModelNull().  but that would make
it fairly safe.


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#a9861817
Sent from the Wicket - Dev mailing list archive at Nabble.com.


Reply via email to