Don't know if this will help your but we had a similar issue (not using the 
beanmodel though), we used to override toString() in an EnumSelectModel but 
found this no longer works, the solution was to implement a properties file 
instead to do the mapping... I haven't tried it but you might be able to do 
something similar for your situation.

cheers,
Peter


----- Original Message -----
From: "Geoff Callender" <geoff.callender.jumpst...@gmail.com>
To: "Tapestry users" <users@tapestry.apache.org>
Sent: Thursday, 18 December, 2008 10:24:18 AM GMT +02:00 Athens, Beirut, 
Bucharest, Istanbul
Subject: Re: [T5] GenericSelectModel Problem

Unfortunately I don't have time to re-create your problem, but does  
the slightly different GenericSelectModel in JumpStart have the same  
problem?  http://localhost:8080/jumpstart/examples/select/easyobject

Cheers,

Geoff

On 18/12/2008, at 12:02 PM, CG wrote:

> anybody can help ? ...
>
> On Thu, Dec 18, 2008 at 12:00 AM, CG <learn....@gmail.com> wrote:
>> I have implemented the GenericSelectModel as written in wiki
>> (http://wiki.apache.org/tapestry/Tapestry5HowtoSelectWithObjects) and
>> it worked fine.
>> However, recently I add a new Bean class and create a
>> GenericSelectModel for it , and the nightmare come.
>>
>> For other bean class , no problem. Only for this particular bean
>> class.(UnitMeasurement)
>>
>> After debugging ..
>> I found out that , in the function toClient(T object) , we suppose to
>> receive parameter object as a bean class instance . however, for this
>> UnitMeasurement class
>> the object is String type, more precise , is a toString() value for
>> the bean instance
>>
>> I hv checked whether I pass in the model and encoder correctly or not
>> , yes, it is correct.  I really hv no idea to solve  .. please help.
>> Thanks.
>>
>>
>> T5 version : 5.0.18
>>
>> Rgds,
>> CG
>>
>>
>> Error
>> ====
>> [toClient] obj : MaterialType: [id=1, type=R, description=Raw
>> Material, isProduced=false, isPurchased=true, isForSales=false,
>> isJIT=true, record status=A, session id=, create login=admin, create
>> app=, create timestamp=2008-09-30 21:27:09.0, modify login=admin,
>> modify app=MaterialTypeMaintenance, modify time=2008-10-06  
>> 21:44:51.0,
>> version=0]
>> [toClient] obj : MaterialType: [id=1, type=R, description=Raw
>> Material, isProduced=false, isPurchased=true, isForSales=false,
>> isJIT=true, record status=A, session id=, create login=admin, create
>> app=, create timestamp=2008-09-30 21:27:09.0, modify login=admin,
>> modify app=MaterialTypeMaintenance, modify time=2008-10-06  
>> 21:44:51.0,
>> version=0]
>> [toClient] obj : MaterialType: [id=2, type=S,
>> description=Semi-Finished Material, isProduced=true,
>> isPurchased=false, isForSales=false, isJIT=true, record status=A,
>> session id=, create login=admin, create app=, create
>> timestamp=2008-09-30 21:27:09.0, modify login=admin, modify
>> app=MaterialTypeMaintenance, modify time=2008-10-25 00:48:43.0,
>> version=0]
>> [toClient] obj : MaterialType: [id=3, type=F, description=Finished
>> Goods, isProduced=true, isPurchased=false, isForSales=true,
>> isJIT=false, record status=A, session id=, create login=admin, create
>> app=, create timestamp=2008-09-30 21:27:09.0, modify login=admin,
>> modify app=, modify time=2008-09-30 21:27:09.0, version=0]
>> [toClient] obj : MaterialType: [id=4, type=P, description=Phantom
>> Material, isProduced=true, isPurchased=false, isForSales=false,
>> isJIT=true, record status=A, session id=, create login=admin, create
>> app=, create timestamp=2008-10-02 22:28:33.0, modify login=admin,
>> modify app=MaterialTypeMaintenance, modify time=2008-10-25  
>> 00:51:09.0,
>> version=0]
>> [toClient] obj : MaterialType: [id=5, type=T, description=Trading
>> Material, isProduced=false, isPurchased=true, isForSales=true,
>> isJIT=false, record status=A, session id=, create login=admin, create
>> app=, create timestamp=2008-10-04 00:36:53.0, modify login=admin,
>> modify app=MaterialTypeMaintenance, modify time=2008-10-25  
>> 00:51:19.0,
>> version=0]
>> [toClient] obj : MaterialType: [id=6, type=C, description=Consumable
>> Material, isProduced=false, isPurchased=true, isForSales=false,
>> isJIT=false, record status=A, session id=, create login=admin, create
>> app=MaterialTypeMaintenance, create timestamp=2008-10-06 21:49:31.0,
>> modify login=admin, modify app=MaterialTypeMaintenance, modify
>> time=2008-10-25 00:51:29.0, version=0]
>> [toClient] obj : UOM: [id=1, record status=A, session id=1, create
>> login=manual, create app=manual, create timestamp=2008-12-15
>> 00:00:00.0, modify login=manual, modify app=manual, modify
>> time=2008-12-15 00:00:00.0, version=1]
>> 23:43:23,759 ERROR [MaterialMaintenance] Render queue error in
>> BeforeRenderTemplate[MaterialMaintenance:uom]: Error reading property
>> 'id' of UOM: [id=1, record status=A, session id=1, create
>> login=manual, create app=manual, create timestamp=2008-12-15
>> 00:00:00.0, modify login=manual, modify app=manual, modify
>> time=2008-12-15 00:00:00.0, version=1]: object is not an instance of
>> declaring class
>> org.apache.tapestry5.ioc.internal.util.TapestryException: Error
>> reading property 'id' of UOM: [id=1, record status=A, session id=1,
>> create login=manual, create app=manual, create timestamp=2008-12-15
>> 00:00:00.0, modify login=manual, modify app=manual, modify
>> time=2008-12-15 00:00:00.0, version=1]: object is not an instance of
>> declaring class [at context:MaterialMaintenance.tml, line 60, column
>> 129]
>>       at  
>> org 
>> .apache 
>> .tapestry5 
>> .internal 
>> .structure 
>> .ComponentPageElementImpl.invoke(ComponentPageElementImpl.java:932)
>>       at  
>> org 
>> .apache.tapestry5.internal.structure.ComponentPageElementImpl.access 
>> $200(ComponentPageElementImpl.java:50)
>>       at  
>> org.apache.tapestry5.internal.structure.ComponentPageElementImpl 
>> $10.render(ComponentPageElementImpl.java:325)
>>       at org.apache.
>>
>> Page class Code
>> ==========
>>       uomsSelect = null;
>>       materialTypesSelect = null;
>>       uomsSelect = new
>> GenericSelectModel 
>> < 
>> UnitMeasurement 
>> >(uoms,UnitMeasurement.class,"shortForm","id",_access_uom);
>>       materialTypesSelect = new
>> GenericSelectModel 
>> < 
>> MaterialType 
>> >(materialTypes,MaterialType.class,"typeDescription","id",_access);
>>
>>
>>
>>
>>
>> Tml template
>> ========
>>                      <tr>
>>                          <th><t:label
>> t:for="MaterialType">MaterialType</t:label>:</th>
>>                          <td>   <select  t:type="select"
>> t:id="materialType" t:model="materialTypesSelect"
>> encoder="materialTypesSelect" t:value="materialType" /> </td>
>>                      </tr>
>>                      <tr>
>>                          <th><t:label t:for="UOM">Unit Of
>> Measurement</t:label>:</th>
>>                          <td>   <select  t:type="select" t:id="UOM"
>> t:model="uomsSelect" encoder="uomsSelect" t:value="UOM" /> </td>
>>                      </tr>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to