You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@wicket.apache.org by Tobias Soloschenko <to...@googlemail.com> on 2015/12/06 09:31:51 UTC
CompoundPropertyModel works different in wicket-7.x and master
Hi guys,
Martin mentioned to me that my last integration breaks the build of Wicket-7.x.
As I saw master compiled fine. After a short research we found out that the CompoundPropertyModel works slightly different.
Output in wicket-7.x:
<img wicket:id="compoundImage" src="Model:classname=[org.apache.wicket.model.PropertyModel]:nestedModel=[Model:classname=[org.apache.wicket.model.CompoundPropertyModel]:nestedModel=[org.apache.wicket.markup.html.image.ExternalImageTestPage$ImageSrc@7cdbc5d3]]:expression=[url]"/>
Output in master:
<img wicket:id="compoundImage" src="http://www.google.de/test.jpg"/>
Invokation:
ImageSrc imageSrc = new ImageSrc();
imageSrc.setUrl("http://www.google.de/test.jpg");
CompoundPropertyModel<ImageSrc> compoundPropertyModel = new CompoundPropertyModel<ImageSrc>(imageSrc);
add(new ExternalImage("compoundImage",compoundPropertyModel.bind("url")));
Code to receive the model object. String.valueOf(model.getObject());
I don't know what changed, but maybe you know.
kind regards
Tobias
Re: CompoundPropertyModel works different in wicket-7.x and master
Posted by Sven Meier <sv...@meiers.net>.
BTW to really make sure this works with CompoundPropertyModel, it would
be nicer if the test would be more like
org.apache.wicket.model.InheritedModelTest
Regards
Sven
On 06.12.2015 10:04, Sven Meier wrote:
> Hi Tobios,
>
> > new ExternalImage("compoundImage",compoundPropertyModel.bind("url")));
>
> this invokes the constructor with the Serializable argument, effectively
> wrapping the propertyModel inside a normal model.
>
> Have fun
> Sven
>
>
> On 06.12.2015 09:31, Tobias Soloschenko wrote:
>> Hi guys,
>>
>> Martin mentioned to me that my last integration breaks the build of
>> Wicket-7.x.
>>
>> As I saw master compiled fine. After a short research we found out
>> that the CompoundPropertyModel works slightly different.
>>
>> Output in wicket-7.x:
>>
>> <img wicket:id="compoundImage"
>> src="Model:classname=[org.apache.wicket.model.PropertyModel]:nestedModel=[Model:classname=[org.apache.wicket.model.CompoundPropertyModel]:nestedModel=[org.apache.wicket.markup.html.image.ExternalImageTestPage$ImageSrc@7cdbc5d3]]:expression=[url]"/>
>>
>>
>> Output in master:
>>
>> <img wicket:id="compoundImage" src="http://www.google.de/test.jpg"/>
>>
>> Invokation:
>>
>> ImageSrc imageSrc = new ImageSrc();
>> imageSrc.setUrl("http://www.google.de/test.jpg");
>> CompoundPropertyModel<ImageSrc> compoundPropertyModel = new
>> CompoundPropertyModel<ImageSrc>(imageSrc);
>> add(new
>> ExternalImage("compoundImage",compoundPropertyModel.bind("url")));
>>
>> Code to receive the model object. String.valueOf(model.getObject());
>>
>> I don't know what changed, but maybe you know.
>>
>> kind regards
>>
>> Tobias
>>
Re: CompoundPropertyModel works different in wicket-7.x and master
Posted by Tobias Soloschenko <to...@googlemail.com>.
Great! Thanks a lot for the fix!
kind regards
Tobias
> Am 06.12.2015 um 14:21 schrieb Sven Meier <sv...@meiers.net>:
>
> Hi all,
>
> the Java 8 compiler is just better inferrinf the right method signature. That's nothing Wicket can do about - besides avoiding constructor overloading.
>
> I've changed the test as Sebastien has proposed.
>
> Have fun+
> Sven
>
>> On 06.12.2015 14:14, Sebastien wrote:
>> Hi Tobias,
>>
>> I agree with Sven about the way of testing the CPM.
>> If you change the test like this, it works fine:
>>
>> test-page:
>> ImageSrc imageSrc = new ImageSrc();
>> imageSrc.setUrl("http://www.google.de/test.jpg");
>>
>> Form<?> form = new Form<ImageSrc>("form", new
>> CompoundPropertyModel<ImageSrc>(imageSrc));
>> add(form);
>>
>> form.add(new ExternalImage("url"));
>>
>>
>> <form wicket:id="form">
>> <img wicket:id="url" />
>> </form>
>>
>>
>> test:
>> Assert.assertTrue(lastResponseAsString.contains("<img
>> wicket:id=\"url\" src=\"http://www.google.de/test.jpg\"/>"));
>>
>>
>> I does not explain why there is a diff a behavior between 7.x and master,
>> but I guess it could be treated in a different ticket...
>>
>> Best regards,
>> Sebastien.
>>
Re: CompoundPropertyModel works different in wicket-7.x and master
Posted by Tobias Soloschenko <to...@googlemail.com>.
Hi all,
I am going to add some Information about the new components the next days. :-)
kind regards
Tobias
> Am 06.12.2015 um 14:21 schrieb Sven Meier <sv...@meiers.net>:
>
> Hi all,
>
> the Java 8 compiler is just better inferrinf the right method signature. That's nothing Wicket can do about - besides avoiding constructor overloading.
>
> I've changed the test as Sebastien has proposed.
>
> Have fun+
> Sven
>
>> On 06.12.2015 14:14, Sebastien wrote:
>> Hi Tobias,
>>
>> I agree with Sven about the way of testing the CPM.
>> If you change the test like this, it works fine:
>>
>> test-page:
>> ImageSrc imageSrc = new ImageSrc();
>> imageSrc.setUrl("http://www.google.de/test.jpg");
>>
>> Form<?> form = new Form<ImageSrc>("form", new
>> CompoundPropertyModel<ImageSrc>(imageSrc));
>> add(form);
>>
>> form.add(new ExternalImage("url"));
>>
>>
>> <form wicket:id="form">
>> <img wicket:id="url" />
>> </form>
>>
>>
>> test:
>> Assert.assertTrue(lastResponseAsString.contains("<img
>> wicket:id=\"url\" src=\"http://www.google.de/test.jpg\"/>"));
>>
>>
>> I does not explain why there is a diff a behavior between 7.x and master,
>> but I guess it could be treated in a different ticket...
>>
>> Best regards,
>> Sebastien.
>>
Re: CompoundPropertyModel works different in wicket-7.x and master
Posted by Sven Meier <sv...@meiers.net>.
Hi all,
the Java 8 compiler is just better inferrinf the right method signature.
That's nothing Wicket can do about - besides avoiding constructor
overloading.
I've changed the test as Sebastien has proposed.
Have fun+
Sven
On 06.12.2015 14:14, Sebastien wrote:
> Hi Tobias,
>
> I agree with Sven about the way of testing the CPM.
> If you change the test like this, it works fine:
>
> test-page:
> ImageSrc imageSrc = new ImageSrc();
> imageSrc.setUrl("http://www.google.de/test.jpg");
>
> Form<?> form = new Form<ImageSrc>("form", new
> CompoundPropertyModel<ImageSrc>(imageSrc));
> add(form);
>
> form.add(new ExternalImage("url"));
>
>
> <form wicket:id="form">
> <img wicket:id="url" />
> </form>
>
>
> test:
> Assert.assertTrue(lastResponseAsString.contains("<img
> wicket:id=\"url\" src=\"http://www.google.de/test.jpg\"/>"));
>
>
> I does not explain why there is a diff a behavior between 7.x and master,
> but I guess it could be treated in a different ticket...
>
> Best regards,
> Sebastien.
>
Re: CompoundPropertyModel works different in wicket-7.x and master
Posted by Sebastien <se...@gmail.com>.
Hi Tobias,
I agree with Sven about the way of testing the CPM.
If you change the test like this, it works fine:
test-page:
ImageSrc imageSrc = new ImageSrc();
imageSrc.setUrl("http://www.google.de/test.jpg");
Form<?> form = new Form<ImageSrc>("form", new
CompoundPropertyModel<ImageSrc>(imageSrc));
add(form);
form.add(new ExternalImage("url"));
<form wicket:id="form">
<img wicket:id="url" />
</form>
test:
Assert.assertTrue(lastResponseAsString.contains("<img
wicket:id=\"url\" src=\"http://www.google.de/test.jpg\"/>"));
I does not explain why there is a diff a behavior between 7.x and master,
but I guess it could be treated in a different ticket...
Best regards,
Sebastien.
Re: CompoundPropertyModel works different in wicket-7.x and master
Posted by Tobias Soloschenko <to...@googlemail.com>.
But this is not good and I think a Bug of this Model. It should behave the same.
kind regards
Tobias
> Am 06.12.2015 um 11:46 schrieb Sven Meier <sv...@meiers.net>:
>
> Hi Tobias,
>
> I'm not sure: CompoundPropertyModel#bind() has a generic type parameter, perhaps this is treated differently in Java 7 vs. 8.
>
> Sven
>
>> On 06.12.2015 10:57, Tobias Soloschenko wrote:
>> Hi Sven,
>>
>> so the behavior of wicket-7.x is right then? Because getObect receives the actual nested model and not src as model object?
>>
>> Then we have an error in master.
>>
>> kind regards
>>
>> Tobias
>>
>>> Am 06.12.2015 um 10:04 schrieb Sven Meier <sv...@meiers.net>:
>>>
>>> Hi Tobios,
>>>
>>>> new ExternalImage("compoundImage",compoundPropertyModel.bind("url")));
>>>
>>> this invokes the constructor with the Serializable argument, effectively wrapping the propertyModel inside a normal model.
>>>
>>> Have fun
>>> Sven
>>>
>>>
>>>> On 06.12.2015 09:31, Tobias Soloschenko wrote:
>>>> Hi guys,
>>>>
>>>> Martin mentioned to me that my last integration breaks the build of Wicket-7.x.
>>>>
>>>> As I saw master compiled fine. After a short research we found out that the CompoundPropertyModel works slightly different.
>>>>
>>>> Output in wicket-7.x:
>>>>
>>>> <img wicket:id="compoundImage" src="Model:classname=[org.apache.wicket.model.PropertyModel]:nestedModel=[Model:classname=[org.apache.wicket.model.CompoundPropertyModel]:nestedModel=[org.apache.wicket.markup.html.image.ExternalImageTestPage$ImageSrc@7cdbc5d3]]:expression=[url]"/>
>>>>
>>>> Output in master:
>>>>
>>>> <img wicket:id="compoundImage" src="http://www.google.de/test.jpg"/>
>>>>
>>>> Invokation:
>>>>
>>>> ImageSrc imageSrc = new ImageSrc();
>>>> imageSrc.setUrl("http://www.google.de/test.jpg");
>>>> CompoundPropertyModel<ImageSrc> compoundPropertyModel = new CompoundPropertyModel<ImageSrc>(imageSrc);
>>>> add(new ExternalImage("compoundImage",compoundPropertyModel.bind("url")));
>>>>
>>>> Code to receive the model object. String.valueOf(model.getObject());
>>>>
>>>> I don't know what changed, but maybe you know.
>>>>
>>>> kind regards
>>>>
>>>> Tobias
>>>>
Re: CompoundPropertyModel works different in wicket-7.x and master
Posted by Sven Meier <sv...@meiers.net>.
Hi Tobias,
I'm not sure: CompoundPropertyModel#bind() has a generic type parameter,
perhaps this is treated differently in Java 7 vs. 8.
Sven
On 06.12.2015 10:57, Tobias Soloschenko wrote:
> Hi Sven,
>
> so the behavior of wicket-7.x is right then? Because getObect receives the actual nested model and not src as model object?
>
> Then we have an error in master.
>
> kind regards
>
> Tobias
>
>> Am 06.12.2015 um 10:04 schrieb Sven Meier <sv...@meiers.net>:
>>
>> Hi Tobios,
>>
>>> new ExternalImage("compoundImage",compoundPropertyModel.bind("url")));
>>
>> this invokes the constructor with the Serializable argument, effectively wrapping the propertyModel inside a normal model.
>>
>> Have fun
>> Sven
>>
>>
>>> On 06.12.2015 09:31, Tobias Soloschenko wrote:
>>> Hi guys,
>>>
>>> Martin mentioned to me that my last integration breaks the build of Wicket-7.x.
>>>
>>> As I saw master compiled fine. After a short research we found out that the CompoundPropertyModel works slightly different.
>>>
>>> Output in wicket-7.x:
>>>
>>> <img wicket:id="compoundImage" src="Model:classname=[org.apache.wicket.model.PropertyModel]:nestedModel=[Model:classname=[org.apache.wicket.model.CompoundPropertyModel]:nestedModel=[org.apache.wicket.markup.html.image.ExternalImageTestPage$ImageSrc@7cdbc5d3]]:expression=[url]"/>
>>>
>>> Output in master:
>>>
>>> <img wicket:id="compoundImage" src="http://www.google.de/test.jpg"/>
>>>
>>> Invokation:
>>>
>>> ImageSrc imageSrc = new ImageSrc();
>>> imageSrc.setUrl("http://www.google.de/test.jpg");
>>> CompoundPropertyModel<ImageSrc> compoundPropertyModel = new CompoundPropertyModel<ImageSrc>(imageSrc);
>>> add(new ExternalImage("compoundImage",compoundPropertyModel.bind("url")));
>>>
>>> Code to receive the model object. String.valueOf(model.getObject());
>>>
>>> I don't know what changed, but maybe you know.
>>>
>>> kind regards
>>>
>>> Tobias
>>>
Re: CompoundPropertyModel works different in wicket-7.x and master
Posted by Tobias Soloschenko <to...@googlemail.com>.
Hi Sven,
so the behavior of wicket-7.x is right then? Because getObect receives the actual nested model and not src as model object?
Then we have an error in master.
kind regards
Tobias
> Am 06.12.2015 um 10:04 schrieb Sven Meier <sv...@meiers.net>:
>
> Hi Tobios,
>
> > new ExternalImage("compoundImage",compoundPropertyModel.bind("url")));
>
> this invokes the constructor with the Serializable argument, effectively wrapping the propertyModel inside a normal model.
>
> Have fun
> Sven
>
>
>> On 06.12.2015 09:31, Tobias Soloschenko wrote:
>> Hi guys,
>>
>> Martin mentioned to me that my last integration breaks the build of Wicket-7.x.
>>
>> As I saw master compiled fine. After a short research we found out that the CompoundPropertyModel works slightly different.
>>
>> Output in wicket-7.x:
>>
>> <img wicket:id="compoundImage" src="Model:classname=[org.apache.wicket.model.PropertyModel]:nestedModel=[Model:classname=[org.apache.wicket.model.CompoundPropertyModel]:nestedModel=[org.apache.wicket.markup.html.image.ExternalImageTestPage$ImageSrc@7cdbc5d3]]:expression=[url]"/>
>>
>> Output in master:
>>
>> <img wicket:id="compoundImage" src="http://www.google.de/test.jpg"/>
>>
>> Invokation:
>>
>> ImageSrc imageSrc = new ImageSrc();
>> imageSrc.setUrl("http://www.google.de/test.jpg");
>> CompoundPropertyModel<ImageSrc> compoundPropertyModel = new CompoundPropertyModel<ImageSrc>(imageSrc);
>> add(new ExternalImage("compoundImage",compoundPropertyModel.bind("url")));
>>
>> Code to receive the model object. String.valueOf(model.getObject());
>>
>> I don't know what changed, but maybe you know.
>>
>> kind regards
>>
>> Tobias
>>
Re: CompoundPropertyModel works different in wicket-7.x and master
Posted by Sven Meier <sv...@meiers.net>.
Hi Tobios,
> new ExternalImage("compoundImage",compoundPropertyModel.bind("url")));
this invokes the constructor with the Serializable argument, effectively
wrapping the propertyModel inside a normal model.
Have fun
Sven
On 06.12.2015 09:31, Tobias Soloschenko wrote:
> Hi guys,
>
> Martin mentioned to me that my last integration breaks the build of Wicket-7.x.
>
> As I saw master compiled fine. After a short research we found out that the CompoundPropertyModel works slightly different.
>
> Output in wicket-7.x:
>
> <img wicket:id="compoundImage" src="Model:classname=[org.apache.wicket.model.PropertyModel]:nestedModel=[Model:classname=[org.apache.wicket.model.CompoundPropertyModel]:nestedModel=[org.apache.wicket.markup.html.image.ExternalImageTestPage$ImageSrc@7cdbc5d3]]:expression=[url]"/>
>
> Output in master:
>
> <img wicket:id="compoundImage" src="http://www.google.de/test.jpg"/>
>
> Invokation:
>
> ImageSrc imageSrc = new ImageSrc();
> imageSrc.setUrl("http://www.google.de/test.jpg");
> CompoundPropertyModel<ImageSrc> compoundPropertyModel = new CompoundPropertyModel<ImageSrc>(imageSrc);
> add(new ExternalImage("compoundImage",compoundPropertyModel.bind("url")));
>
> Code to receive the model object. String.valueOf(model.getObject());
>
> I don't know what changed, but maybe you know.
>
> kind regards
>
> Tobias
>