You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Peter Courcoux <pe...@courcoux.biz> on 2008/06/30 22:45:47 UTC
Loop Component
Hi all,
When the loop component sets the value from the iterator, it seems to
miss properties inherited from a base class.
So if I'm iterating over a set of objects of class B which extends A,
I'm only seeing the properties of B set. All the properties which are
inherited from A are null.
Am I missing something?
Any pointers much appreciated.
Thanks,
Peter
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: Loop Component
Posted by Peter Courcoux <pe...@courcoux.biz>.
Hi Bill,
Thanks for your help. Yes all the public getters and setters are there.
I just didn't show them to save space.
I've been assuming that beans that are simply being iterated over do
not themselves need any annotations, that the annotations are confined
to the component/page classes. Am I wrong here?
A simple cut and paste of all the properties and getters and setters
from A to B means it all works again. I'm guessing that there is some
reflection or cglib magic going on in the depths, but I'm fairly new to
Tapestry and thought it best to ask... It looks like a bug, but might
well be a feature. It would be nice to know.
Thanks again.
Would it be appropriate to cross post to the dev list, do you think?
Regards,
Peter
Bill Holloway wrote:
> Peter, make sure that the properties in your superclass are either
> annotated with @Property or have public getter and setter methods.
>
> Bill
>
> On Tue, Jul 1, 2008 at 11:43 AM, Peter Courcoux <pe...@courcoux.biz> wrote:
>
>> Many thanks for your reply Sven.
>>
>> However, I think that I didn't explain the problem properly.
>>
>> If my, much simplified, java class is like this :-
>> <pre>
>>
>> public class comp {
>>
>> //note getters/setters/annotations not shown
>>
>> private B valueItem;
>>
>> private List<B> items = new ArrayList<B>();
>>
>> public List<B> getSourceList(){
>> B item1 = new B();
>> item1.setEmail("peter@courcoux.biz");
>> item1.setName("Peter");
>> List<B> sourceList = new ArrayList<B>();
>> sourceList.add(item1);
>> return sourceList;
>> }
>> }
>>
>> and a comp.tml including :-
>>
>> <tr t:type="loop" source="sourceList" value="valueItem">
>> <td>
>> <t:checkbox t:id="..." value="selected"/>
>> </td>
>> </tr>
>>
>> and use a setSelected(...) method (not shown) to copy a ticked
>> valueItem to the items list,
>> then
>>
>> in the case of (1)
>>
>> public class B {
>> private String name;
>> private String email;
>> ...
>> }
>>
>> All is fine.
>>
>>
>> However, if we have the case of (2)
>>
>>
>> public class A {
>> private String name;
>> ...
>> }
>>
>> public class B extends A {
>> private String email;
>> ...
>> }
>> </pre>
>>
>> then the objects in the items list have email correctly set and name ==
>> null, where both should have been set.
>>
>> I am using t5.0.13 and java6.
>>
>> Any pointers/thoughts much appreciated.
>>
>> Regards,
>>
>> Peter
>>
>>
>>
>> Sven Homburg wrote:
>>
>>> the OGNL binding should help you
>>> http://code.google.com/p/tapestry5-components/
>>> http://87.193.218.134:8080/t5components/t5c-commons/howto_ognlbinding.html
>>>
>>> 2008/6/30 Peter Courcoux <pe...@courcoux.biz>:
>>>
>>>
>>>
>>>> Hi all,
>>>>
>>>> When the loop component sets the value from the iterator, it seems to
>>>> miss
>>>> properties inherited from a base class.
>>>>
>>>> So if I'm iterating over a set of objects of class B which extends A, I'm
>>>> only seeing the properties of B set. All the properties which are
>>>> inherited
>>>> from A are null.
>>>>
>>>> Am I missing something?
>>>>
>>>> Any pointers much appreciated.
>>>>
>>>> Thanks,
>>>>
>>>> Peter
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>>
>>>>
>>>>
>>>>
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>>
>
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: Loop Component
Posted by Bill Holloway <bi...@peoplepad.com>.
Peter, make sure that the properties in your superclass are either
annotated with @Property or have public getter and setter methods.
Bill
On Tue, Jul 1, 2008 at 11:43 AM, Peter Courcoux <pe...@courcoux.biz> wrote:
> Many thanks for your reply Sven.
>
> However, I think that I didn't explain the problem properly.
>
> If my, much simplified, java class is like this :-
> <pre>
>
> public class comp {
>
> //note getters/setters/annotations not shown
>
> private B valueItem;
>
> private List<B> items = new ArrayList<B>();
>
> public List<B> getSourceList(){
> B item1 = new B();
> item1.setEmail("peter@courcoux.biz");
> item1.setName("Peter");
> List<B> sourceList = new ArrayList<B>();
> sourceList.add(item1);
> return sourceList;
> }
> }
>
> and a comp.tml including :-
>
> <tr t:type="loop" source="sourceList" value="valueItem">
> <td>
> <t:checkbox t:id="..." value="selected"/>
> </td>
> </tr>
>
> and use a setSelected(...) method (not shown) to copy a ticked
> valueItem to the items list,
> then
>
> in the case of (1)
>
> public class B {
> private String name;
> private String email;
> ...
> }
>
> All is fine.
>
>
> However, if we have the case of (2)
>
>
> public class A {
> private String name;
> ...
> }
>
> public class B extends A {
> private String email;
> ...
> }
> </pre>
>
> then the objects in the items list have email correctly set and name ==
> null, where both should have been set.
>
> I am using t5.0.13 and java6.
>
> Any pointers/thoughts much appreciated.
>
> Regards,
>
> Peter
>
>
>
> Sven Homburg wrote:
>>
>> the OGNL binding should help you
>> http://code.google.com/p/tapestry5-components/
>> http://87.193.218.134:8080/t5components/t5c-commons/howto_ognlbinding.html
>>
>> 2008/6/30 Peter Courcoux <pe...@courcoux.biz>:
>>
>>
>>>
>>> Hi all,
>>>
>>> When the loop component sets the value from the iterator, it seems to
>>> miss
>>> properties inherited from a base class.
>>>
>>> So if I'm iterating over a set of objects of class B which extends A, I'm
>>> only seeing the properties of B set. All the properties which are
>>> inherited
>>> from A are null.
>>>
>>> Am I missing something?
>>>
>>> Any pointers much appreciated.
>>>
>>> Thanks,
>>>
>>> Peter
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>
>>>
>>>
>>
>>
>>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
--
Bill @ PeoplePad
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: Loop Component
Posted by Peter Courcoux <pe...@courcoux.biz>.
Many thanks for your reply Sven.
However, I think that I didn't explain the problem properly.
If my, much simplified, java class is like this :-
<pre>
public class comp {
//note getters/setters/annotations not shown
private B valueItem;
private List<B> items = new ArrayList<B>();
public List<B> getSourceList(){
B item1 = new B();
item1.setEmail("peter@courcoux.biz");
item1.setName("Peter");
List<B> sourceList = new ArrayList<B>();
sourceList.add(item1);
return sourceList;
}
}
and a comp.tml including :-
<tr t:type="loop" source="sourceList" value="valueItem">
<td>
<t:checkbox t:id="..." value="selected"/>
</td>
</tr>
and use a setSelected(...) method (not shown) to copy a ticked
valueItem to the items list,
then
in the case of (1)
public class B {
private String name;
private String email;
...
}
All is fine.
However, if we have the case of (2)
public class A {
private String name;
...
}
public class B extends A {
private String email;
...
}
</pre>
then the objects in the items list have email correctly set and name ==
null, where both should have been set.
I am using t5.0.13 and java6.
Any pointers/thoughts much appreciated.
Regards,
Peter
Sven Homburg wrote:
> the OGNL binding should help you
> http://code.google.com/p/tapestry5-components/
> http://87.193.218.134:8080/t5components/t5c-commons/howto_ognlbinding.html
>
> 2008/6/30 Peter Courcoux <pe...@courcoux.biz>:
>
>
>> Hi all,
>>
>> When the loop component sets the value from the iterator, it seems to miss
>> properties inherited from a base class.
>>
>> So if I'm iterating over a set of objects of class B which extends A, I'm
>> only seeing the properties of B set. All the properties which are inherited
>> from A are null.
>>
>> Am I missing something?
>>
>> Any pointers much appreciated.
>>
>> Thanks,
>>
>> Peter
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>>
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: Loop Component
Posted by Sven Homburg <ho...@googlemail.com>.
the OGNL binding should help you
http://code.google.com/p/tapestry5-components/
http://87.193.218.134:8080/t5components/t5c-commons/howto_ognlbinding.html
2008/6/30 Peter Courcoux <pe...@courcoux.biz>:
> Hi all,
>
> When the loop component sets the value from the iterator, it seems to miss
> properties inherited from a base class.
>
> So if I'm iterating over a set of objects of class B which extends A, I'm
> only seeing the properties of B set. All the properties which are inherited
> from A are null.
>
> Am I missing something?
>
> Any pointers much appreciated.
>
> Thanks,
>
> Peter
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
--
with regards
Sven Homburg
http://tapestry5-components.googlecode.com
http://chenillekit.googlecode.com