You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Petros Petrou <pe...@cypoz.com> on 2008/04/02 03:12:53 UTC

Grid component and context values - TapestryException

I have the following code that works fine
AccountsList.tml
<table t:type="Grid" source="accountsList" row="account" mode="model">
   <t:parameter name="accountManagerCell">
      ${account?.accountManager?.username}
   </t:parameter>
</table>

AccountsList.java
...
private BeanModel<Account> model;
{
   model = beanModelSource.create(Account.class, true, componentResources);
   model.add("accountManager", null);
}

Now I replaced this line 
${account?.accountManager?.username}
with 
<aa t:type="PageLink" page="user/DetailsPage"
context="${account?.accountManager?.username}">${account?.accountManager?.username}</aa>

I am getting a TapestryException with the message
Context values (which are added to the request URL) may not be null or
blank. 

However, the context values are not blank because removing the "context"
everything works fine. 
Furthermore, moving this line 
<aa t:type="PageLink" page="user/DetailsPage"
context="${account?.accountManager?.username}">${account?.accountManager?.username}</aa>
outsite the grid component also works fine. 

Why it doesn't let me use context values for the PageLink inside a Grid
component ?
Petros
-- 
View this message in context: http://www.nabble.com/Grid-component-and-context-values---TapestryException-tp16433892p16433892.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


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


Re: T5: Is there a simple way to display property of embedded instance in Grid?

Posted by dhning <dh...@gaonline.com.cn>.
Got it. I will do in Java. 
I think @NonVisal is not so flexible, sometimes you want to hide this field here, but also you may want to show it there. If annotated with @NonVisal, it is always hidden by the BeanModel, and causes exception about 'not available property' if trying to access it.

Thanks!

DH


----- Original Message ----- 
From: "Jonathan Barker" <jo...@gmail.com>
To: "'Tapestry users'" <us...@tapestry.apache.org>
Sent: Monday, April 21, 2008 3:39 AM
Subject: RE: T5: Is there a simple way to display property of embedded instance in Grid?


> 
> DH,
> 
> For anything the least bit complicated, I do it in Java.
> 
> @Inject
> BeanModelSource _bms;
> 
> @Cached
> public BeanModel getBeanModel(){
> BeanModel model = _bms.create(User.class, false, _bms);
> model.include("username");
> model.add("location").sortable(true); 
> return model;
> }
> 
> 
> It has the side-benefit of keeping your templates cleaner - especially as
> the lists to include / exclude get longer.
> 
> Also, have you tried using @NonVisual to hide what you want to hide?  I
> haven't really used it, but it might suit your needs.
> 
> Jonathan
> 
> 
>> -----Original Message-----
>> From: ningdh [mailto:dhning@gaonline.com.cn]
>> Sent: Sunday, April 20, 2008 11:21 AM
>> To: Tapestry users
>> Subject: Re: T5: Is there a simple way to display property of embedded
>> instance in Grid?
>> 
>> Thank you, Tobias and Jonathan, especially for Tobias's detailed work.
>> 
>> I find include and add can't use together, because properties of 'add'
>> will be flushed and cleared by 'include' later, and this can be traced
>> from source code of BeanModelUtils. For example, I want to show 'username'
>> and 'city' of the user, so I write: include="username" add="location_city"
>> and add t:parameter to "location_city", but in the table I can only get
>> 'username' column. But if I remove include section, all the user
>> information and city will be shown.
>> 
>> Now I can use exclude and username to get what I need, but that would be
>> annoying to write so much longer exclude expression.
>> 
>> So is it a known issue?
>> 
>> Thanks.
>> DH
>> ----- Original Message -----
>> From: "Jonathan Barker" <jo...@gmail.com>
>> To: "'Tapestry users'" <us...@tapestry.apache.org>
>> Sent: Saturday, April 19, 2008 11:26 AM
>> Subject: RE: T5: Is there a simple way to display property of embedded
>> instance in Grid?
>> 
>> 
>> >
>> >
>> > I'll add to this and say that if you want sorting behavior, you can
>> > implement Comparable and Comparator (I don't remember which you need - I
>> > tend to implement both), and add "location" to your model.
>> >
>> > IIRC, you will need to build your model in code to say that the
>> "location"
>> > column is sortable.
>> >
>> >
>> > Jonathan
>> >
>> >
>> >> -----Original Message-----
>> >> From: Tobias Wehrum [mailto:Legato@dragonlab.de]
>> >> Sent: Friday, April 18, 2008 5:20 AM
>> >> To: Tapestry users
>> >> Subject: Re: T5: Is there a simple way to display property of embedded
>> >> instance in Grid?
>> >>
>> >> Hi DH,
>> >>
>> >> it would be:
>> >>
>> >> -----------------------------------------------------------------------
>> >> <table t:type="grid" t:source="userSource" row="currentUser"
>> >> add="location_city">
>> >>     <t:parameter name="location_citycell">
>> >> ${currentUser.location.city}
>> >>     </t:parameter>
>> >> </table>
>> >> -----------------------------------------------------------------------
>> >>
>> >> (Note the "add" instead of include - you want to add something not
>> already
>> >> existing, not include something.)
>> >>
>> >> On your page you have to define
>> >>
>> >> -----------------------------------------------------------------------
>> >> @Parameter
>> >> User userSource;
>> >> -----------------------------------------------------------------------
>> >>
>> >> to keep track of the current grid object.
>> >> So much for the first method.
>> >>
>> >>
>> >> If you want to have to have a Location always represented as a String
>> >> containing its city toString():
>> >>
>> >> -----------------------------------------------------------------------
>> >> class Location {
>> >> // [...]
>> >> public String toString() {
>> >> return city;
>> >> }
>> >> }
>> >> -----------------------------------------------------------------------
>> >>
>> >> Now you have to define a Translator for Tapestry (I use a template for
>> all
>> >> classes which implement toString()):
>> >>
>> >> -----------------------------------------------------------------------
>> >> public class ModelTranslator<ModelClass> implements
>> Translator<ModelClass>
>> >> {
>> >>
>> >>    public Class<ModelClass> getType() {
>> >>        return null;
>> >>    }
>> >>
>> >>    public ModelClass parseClient(String arg0, Messages arg1)
>> >>            throws ValidationException {
>> >>        throw new ValidationException("ModelTranslator cannot
>> >> implement parseClient()");
>> >>    }
>> >>
>> >>    public String toClient(ModelClass arg0) {
>> >>        return arg0.toString();
>> >>    }
>> >>
>> >> }
>> >> -----------------------------------------------------------------------
>> >>
>> >> Now you only have to announce your Translator in to your
>> AppModule.java:
>> >>
>> >> -----------------------------------------------------------------------
>> >>     @SuppressWarnings("unchecked")
>> >>     public static void
>> >> contributeDefaultDataTypeAnalyzer(MappedConfiguration<Class, String>
>> >> configuration) {
>> >>     configuration.add(User.class, "user");
>> >>     }
>> >>
>> >>     @SuppressWarnings("unchecked") {
>> >>     configuration.add("user", new ModelTranslator<User>());
>> >>     }
>> >> -----------------------------------------------------------------------
>> >>
>> >> ...and after doing this, you have to do exactly *nothing* to add it to
>> >> your grid - it will do so per default. :)
>> >>
>> >> Tobias
>> >>
>> >>
>> >> dhning schrieb:
>> >>
>> >> > Hi, Tobias
>> >> >
>> >> > Thanks for reply.
>> >> >
>> >> > I am newbie of customizing grid component.
>> >> > I guess what you mean like this?:
>> >> > <table t:type="grid" t:source="userSource" include="location_city">
>> >> >     <t:parameter name="location_cityheader">
>> >> >     </t:parameter>
>> >> >     <t:parameter name="location_citycell">
>> >> >     </t:parameter>
>> >> > </table>
>> >> >
>> >> > But exception message still exists: "Bean editor model for User does
>> not
>> >> contain a property named 'location_city'".
>> >> >
>> >> > Thanks!
>> >> >
>> >> > DH
>> >> >
>> >> >
>> >> > ----- Original Message -----
>> >> > From: "Tobias Wehrum" <Le...@dragonlab.de>
>> >> > To: "Tapestry users" <us...@tapestry.apache.org>
>> >> > Sent: Friday, April 18, 2008 4:20 PM
>> >> > Subject: Re: T5: Is there a simple way to display property of
>> embedded
>> >> instance in Grid?
>> >> >
>> >> >
>> >> >
>> >> >> Hi DH,
>> >> >>
>> >> >> you can teach Location a standard way to be outputted by overwriting
>> >> the
>> >> >> toString() function of Location.
>> >> >>
>> >> >> Now you can output the String returned by toString() simply by
>> >> including
>> >> >> "location".
>> >> >>
>> >> >> If you want to output different properties of Location and not in
>> one
>> >> >> cell, I think you will have to add location_city, location_street
>> etc
>> >> >> and implement <t:parameter> blocks for it.
>> >> >>
>> >> >> Hope that helps,
>> >> >> Tobias
>> >> >>
>> >> >> dhning schrieb:
>> >> >>
>> >> >>> Hi, All
>> >> >>>
>> >> >>> Case: A user own a location while the location is comprised of
>> city,
>> >> street...
>> >> >>> public class User {
>> >> >>>   private Location location;
>> >> >>>   // setter & getter
>> >> >>> }
>> >> >>> public class Location {
>> >> >>>   private String city;
>> >> >>>  // setter & getter
>> >> >>> }
>> >> >>>
>> >> >>> In the user list page, I want to display the city as one column in
>> >> Grid.
>> >> >>> But it doesn't work like this <table t:type="grid"
>> >> t:source="userSource" include="location.city"></table>.
>> >> >>> The exception message is "User does not contain a property named
>> >> 'location.city'".
>> >> >>>
>> >> >>> Is there a simple way to implement such function?
>> >> >>>
>> >> >>> Thanks in advance.
>> >> >>> DH
>> >> >>>
>> >> >> --------------------------------------------------------------------
>> -
>> >> >> 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
>> >
>> >
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 
>

Re: T5: Is there a simple way to display property of embedded instance in Grid?

Posted by Tobias Wehrum <Le...@dragonlab.de>.
I only wish Java had an one-line reorder function. (Or has it?)

I was (like you, ningdh) very irritated by said behavoir. My wish would 
be that we could use "add" both to add existing properties (but, for the 
one or other reason, like "has only a getter", non-showing) and 
not-property-blocks. Mh, maybe I should open an issue for that.

Tobias

Jonathan Barker schrieb:
> DH,
>
> For anything the least bit complicated, I do it in Java.
>
> @Inject
> BeanModelSource _bms;
>
> @Cached
> public BeanModel getBeanModel(){
> 	BeanModel model = _bms.create(User.class, false, _bms);
> 	model.include("username");
> 	model.add("location").sortable(true); 
> 	return model;
> }
>
>
> It has the side-benefit of keeping your templates cleaner - especially as
> the lists to include / exclude get longer.
>
> Also, have you tried using @NonVisual to hide what you want to hide?  I
> haven't really used it, but it might suit your needs.
>
> Jonathan
>
>
>   
>> -----Original Message-----
>> From: ningdh [mailto:dhning@gaonline.com.cn]
>> Sent: Sunday, April 20, 2008 11:21 AM
>> To: Tapestry users
>> Subject: Re: T5: Is there a simple way to display property of embedded
>> instance in Grid?
>>
>> Thank you, Tobias and Jonathan, especially for Tobias's detailed work.
>>
>> I find include and add can't use together, because properties of 'add'
>> will be flushed and cleared by 'include' later, and this can be traced
>> from source code of BeanModelUtils. For example, I want to show 'username'
>> and 'city' of the user, so I write: include="username" add="location_city"
>> and add t:parameter to "location_city", but in the table I can only get
>> 'username' column. But if I remove include section, all the user
>> information and city will be shown.
>>
>> Now I can use exclude and username to get what I need, but that would be
>> annoying to write so much longer exclude expression.
>>
>> So is it a known issue?
>>
>> Thanks.
>> DH
>> ----- Original Message -----
>> From: "Jonathan Barker" <jo...@gmail.com>
>> To: "'Tapestry users'" <us...@tapestry.apache.org>
>> Sent: Saturday, April 19, 2008 11:26 AM
>> Subject: RE: T5: Is there a simple way to display property of embedded
>> instance in Grid?
>>
>>
>>     
>>> I'll add to this and say that if you want sorting behavior, you can
>>> implement Comparable and Comparator (I don't remember which you need - I
>>> tend to implement both), and add "location" to your model.
>>>
>>> IIRC, you will need to build your model in code to say that the
>>>       
>> "location"
>>     
>>> column is sortable.
>>>
>>>
>>> Jonathan
>>>
>>>
>>>       
>>>> -----Original Message-----
>>>> From: Tobias Wehrum [mailto:Legato@dragonlab.de]
>>>> Sent: Friday, April 18, 2008 5:20 AM
>>>> To: Tapestry users
>>>> Subject: Re: T5: Is there a simple way to display property of embedded
>>>> instance in Grid?
>>>>
>>>> Hi DH,
>>>>
>>>> it would be:
>>>>
>>>> -----------------------------------------------------------------------
>>>> <table t:type="grid" t:source="userSource" row="currentUser"
>>>> add="location_city">
>>>>     <t:parameter name="location_citycell">
>>>> ${currentUser.location.city}
>>>>     </t:parameter>
>>>> </table>
>>>> -----------------------------------------------------------------------
>>>>
>>>> (Note the "add" instead of include - you want to add something not
>>>>         
>> already
>>     
>>>> existing, not include something.)
>>>>
>>>> On your page you have to define
>>>>
>>>> -----------------------------------------------------------------------
>>>> @Parameter
>>>> User userSource;
>>>> -----------------------------------------------------------------------
>>>>
>>>> to keep track of the current grid object.
>>>> So much for the first method.
>>>>
>>>>
>>>> If you want to have to have a Location always represented as a String
>>>> containing its city toString():
>>>>
>>>> -----------------------------------------------------------------------
>>>> class Location {
>>>> // [...]
>>>> public String toString() {
>>>> return city;
>>>> }
>>>> }
>>>> -----------------------------------------------------------------------
>>>>
>>>> Now you have to define a Translator for Tapestry (I use a template for
>>>>         
>> all
>>     
>>>> classes which implement toString()):
>>>>
>>>> -----------------------------------------------------------------------
>>>> public class ModelTranslator<ModelClass> implements
>>>>         
>> Translator<ModelClass>
>>     
>>>> {
>>>>
>>>>    public Class<ModelClass> getType() {
>>>>        return null;
>>>>    }
>>>>
>>>>    public ModelClass parseClient(String arg0, Messages arg1)
>>>>            throws ValidationException {
>>>>        throw new ValidationException("ModelTranslator cannot
>>>> implement parseClient()");
>>>>    }
>>>>
>>>>    public String toClient(ModelClass arg0) {
>>>>        return arg0.toString();
>>>>    }
>>>>
>>>> }
>>>> -----------------------------------------------------------------------
>>>>
>>>> Now you only have to announce your Translator in to your
>>>>         
>> AppModule.java:
>>     
>>>> -----------------------------------------------------------------------
>>>>     @SuppressWarnings("unchecked")
>>>>     public static void
>>>> contributeDefaultDataTypeAnalyzer(MappedConfiguration<Class, String>
>>>> configuration) {
>>>>     configuration.add(User.class, "user");
>>>>     }
>>>>
>>>>     @SuppressWarnings("unchecked") {
>>>>     configuration.add("user", new ModelTranslator<User>());
>>>>     }
>>>> -----------------------------------------------------------------------
>>>>
>>>> ...and after doing this, you have to do exactly *nothing* to add it to
>>>> your grid - it will do so per default. :)
>>>>
>>>> Tobias
>>>>
>>>>
>>>> dhning schrieb:
>>>>
>>>>         
>>>>> Hi, Tobias
>>>>>
>>>>> Thanks for reply.
>>>>>
>>>>> I am newbie of customizing grid component.
>>>>> I guess what you mean like this?:
>>>>> <table t:type="grid" t:source="userSource" include="location_city">
>>>>>     <t:parameter name="location_cityheader">
>>>>>     </t:parameter>
>>>>>     <t:parameter name="location_citycell">
>>>>>     </t:parameter>
>>>>> </table>
>>>>>
>>>>> But exception message still exists: "Bean editor model for User does
>>>>>           
>> not
>>     
>>>> contain a property named 'location_city'".
>>>>         
>>>>> Thanks!
>>>>>
>>>>> DH
>>>>>
>>>>>
>>>>> ----- Original Message -----
>>>>> From: "Tobias Wehrum" <Le...@dragonlab.de>
>>>>> To: "Tapestry users" <us...@tapestry.apache.org>
>>>>> Sent: Friday, April 18, 2008 4:20 PM
>>>>> Subject: Re: T5: Is there a simple way to display property of
>>>>>           
>> embedded
>>     
>>>> instance in Grid?
>>>>         
>>>>>
>>>>>           
>>>>>> Hi DH,
>>>>>>
>>>>>> you can teach Location a standard way to be outputted by overwriting
>>>>>>             
>>>> the
>>>>         
>>>>>> toString() function of Location.
>>>>>>
>>>>>> Now you can output the String returned by toString() simply by
>>>>>>             
>>>> including
>>>>         
>>>>>> "location".
>>>>>>
>>>>>> If you want to output different properties of Location and not in
>>>>>>             
>> one
>>     
>>>>>> cell, I think you will have to add location_city, location_street
>>>>>>             
>> etc
>>     
>>>>>> and implement <t:parameter> blocks for it.
>>>>>>
>>>>>> Hope that helps,
>>>>>> Tobias
>>>>>>
>>>>>> dhning schrieb:
>>>>>>
>>>>>>             
>>>>>>> Hi, All
>>>>>>>
>>>>>>> Case: A user own a location while the location is comprised of
>>>>>>>               
>> city,
>>     
>>>> street...
>>>>         
>>>>>>> public class User {
>>>>>>>   private Location location;
>>>>>>>   // setter & getter
>>>>>>> }
>>>>>>> public class Location {
>>>>>>>   private String city;
>>>>>>>  // setter & getter
>>>>>>> }
>>>>>>>
>>>>>>> In the user list page, I want to display the city as one column in
>>>>>>>               
>>>> Grid.
>>>>         
>>>>>>> But it doesn't work like this <table t:type="grid"
>>>>>>>               
>>>> t:source="userSource" include="location.city"></table>.
>>>>         
>>>>>>> The exception message is "User does not contain a property named
>>>>>>>               
>>>> 'location.city'".
>>>>         
>>>>>>> Is there a simple way to implement such function?
>>>>>>>
>>>>>>> Thanks in advance.
>>>>>>> DH
>>>>>>>
>>>>>>>               
>>>>>> --------------------------------------------------------------------
>>>>>>             
>> -
>>     
>>>>>> 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
>>>
>>>
>>>       
>
>
> ---------------------------------------------------------------------
> 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: T5: Is there a simple way to display property of embedded instance in Grid?

Posted by Jonathan Barker <jo...@gmail.com>.
DH,

For anything the least bit complicated, I do it in Java.

@Inject
BeanModelSource _bms;

@Cached
public BeanModel getBeanModel(){
	BeanModel model = _bms.create(User.class, false, _bms);
	model.include("username");
	model.add("location").sortable(true); 
	return model;
}


It has the side-benefit of keeping your templates cleaner - especially as
the lists to include / exclude get longer.

Also, have you tried using @NonVisual to hide what you want to hide?  I
haven't really used it, but it might suit your needs.

Jonathan


> -----Original Message-----
> From: ningdh [mailto:dhning@gaonline.com.cn]
> Sent: Sunday, April 20, 2008 11:21 AM
> To: Tapestry users
> Subject: Re: T5: Is there a simple way to display property of embedded
> instance in Grid?
> 
> Thank you, Tobias and Jonathan, especially for Tobias's detailed work.
> 
> I find include and add can't use together, because properties of 'add'
> will be flushed and cleared by 'include' later, and this can be traced
> from source code of BeanModelUtils. For example, I want to show 'username'
> and 'city' of the user, so I write: include="username" add="location_city"
> and add t:parameter to "location_city", but in the table I can only get
> 'username' column. But if I remove include section, all the user
> information and city will be shown.
> 
> Now I can use exclude and username to get what I need, but that would be
> annoying to write so much longer exclude expression.
> 
> So is it a known issue?
> 
> Thanks.
> DH
> ----- Original Message -----
> From: "Jonathan Barker" <jo...@gmail.com>
> To: "'Tapestry users'" <us...@tapestry.apache.org>
> Sent: Saturday, April 19, 2008 11:26 AM
> Subject: RE: T5: Is there a simple way to display property of embedded
> instance in Grid?
> 
> 
> >
> >
> > I'll add to this and say that if you want sorting behavior, you can
> > implement Comparable and Comparator (I don't remember which you need - I
> > tend to implement both), and add "location" to your model.
> >
> > IIRC, you will need to build your model in code to say that the
> "location"
> > column is sortable.
> >
> >
> > Jonathan
> >
> >
> >> -----Original Message-----
> >> From: Tobias Wehrum [mailto:Legato@dragonlab.de]
> >> Sent: Friday, April 18, 2008 5:20 AM
> >> To: Tapestry users
> >> Subject: Re: T5: Is there a simple way to display property of embedded
> >> instance in Grid?
> >>
> >> Hi DH,
> >>
> >> it would be:
> >>
> >> -----------------------------------------------------------------------
> >> <table t:type="grid" t:source="userSource" row="currentUser"
> >> add="location_city">
> >>     <t:parameter name="location_citycell">
> >> ${currentUser.location.city}
> >>     </t:parameter>
> >> </table>
> >> -----------------------------------------------------------------------
> >>
> >> (Note the "add" instead of include - you want to add something not
> already
> >> existing, not include something.)
> >>
> >> On your page you have to define
> >>
> >> -----------------------------------------------------------------------
> >> @Parameter
> >> User userSource;
> >> -----------------------------------------------------------------------
> >>
> >> to keep track of the current grid object.
> >> So much for the first method.
> >>
> >>
> >> If you want to have to have a Location always represented as a String
> >> containing its city toString():
> >>
> >> -----------------------------------------------------------------------
> >> class Location {
> >> // [...]
> >> public String toString() {
> >> return city;
> >> }
> >> }
> >> -----------------------------------------------------------------------
> >>
> >> Now you have to define a Translator for Tapestry (I use a template for
> all
> >> classes which implement toString()):
> >>
> >> -----------------------------------------------------------------------
> >> public class ModelTranslator<ModelClass> implements
> Translator<ModelClass>
> >> {
> >>
> >>    public Class<ModelClass> getType() {
> >>        return null;
> >>    }
> >>
> >>    public ModelClass parseClient(String arg0, Messages arg1)
> >>            throws ValidationException {
> >>        throw new ValidationException("ModelTranslator cannot
> >> implement parseClient()");
> >>    }
> >>
> >>    public String toClient(ModelClass arg0) {
> >>        return arg0.toString();
> >>    }
> >>
> >> }
> >> -----------------------------------------------------------------------
> >>
> >> Now you only have to announce your Translator in to your
> AppModule.java:
> >>
> >> -----------------------------------------------------------------------
> >>     @SuppressWarnings("unchecked")
> >>     public static void
> >> contributeDefaultDataTypeAnalyzer(MappedConfiguration<Class, String>
> >> configuration) {
> >>     configuration.add(User.class, "user");
> >>     }
> >>
> >>     @SuppressWarnings("unchecked") {
> >>     configuration.add("user", new ModelTranslator<User>());
> >>     }
> >> -----------------------------------------------------------------------
> >>
> >> ...and after doing this, you have to do exactly *nothing* to add it to
> >> your grid - it will do so per default. :)
> >>
> >> Tobias
> >>
> >>
> >> dhning schrieb:
> >>
> >> > Hi, Tobias
> >> >
> >> > Thanks for reply.
> >> >
> >> > I am newbie of customizing grid component.
> >> > I guess what you mean like this?:
> >> > <table t:type="grid" t:source="userSource" include="location_city">
> >> >     <t:parameter name="location_cityheader">
> >> >     </t:parameter>
> >> >     <t:parameter name="location_citycell">
> >> >     </t:parameter>
> >> > </table>
> >> >
> >> > But exception message still exists: "Bean editor model for User does
> not
> >> contain a property named 'location_city'".
> >> >
> >> > Thanks!
> >> >
> >> > DH
> >> >
> >> >
> >> > ----- Original Message -----
> >> > From: "Tobias Wehrum" <Le...@dragonlab.de>
> >> > To: "Tapestry users" <us...@tapestry.apache.org>
> >> > Sent: Friday, April 18, 2008 4:20 PM
> >> > Subject: Re: T5: Is there a simple way to display property of
> embedded
> >> instance in Grid?
> >> >
> >> >
> >> >
> >> >> Hi DH,
> >> >>
> >> >> you can teach Location a standard way to be outputted by overwriting
> >> the
> >> >> toString() function of Location.
> >> >>
> >> >> Now you can output the String returned by toString() simply by
> >> including
> >> >> "location".
> >> >>
> >> >> If you want to output different properties of Location and not in
> one
> >> >> cell, I think you will have to add location_city, location_street
> etc
> >> >> and implement <t:parameter> blocks for it.
> >> >>
> >> >> Hope that helps,
> >> >> Tobias
> >> >>
> >> >> dhning schrieb:
> >> >>
> >> >>> Hi, All
> >> >>>
> >> >>> Case: A user own a location while the location is comprised of
> city,
> >> street...
> >> >>> public class User {
> >> >>>   private Location location;
> >> >>>   // setter & getter
> >> >>> }
> >> >>> public class Location {
> >> >>>   private String city;
> >> >>>  // setter & getter
> >> >>> }
> >> >>>
> >> >>> In the user list page, I want to display the city as one column in
> >> Grid.
> >> >>> But it doesn't work like this <table t:type="grid"
> >> t:source="userSource" include="location.city"></table>.
> >> >>> The exception message is "User does not contain a property named
> >> 'location.city'".
> >> >>>
> >> >>> Is there a simple way to implement such function?
> >> >>>
> >> >>> Thanks in advance.
> >> >>> DH
> >> >>>
> >> >> --------------------------------------------------------------------
> -
> >> >> 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
> >
> >


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


Re: T5: Is there a simple way to display property of embedded instance in Grid?

Posted by ningdh <dh...@gaonline.com.cn>.
Thank you, Tobias and Jonathan, especially for Tobias's detailed work.

I find include and add can't use together, because properties of 'add' will be flushed and cleared by 'include' later, and this can be traced from source code of BeanModelUtils. For example, I want to show 'username' and 'city' of the user, so I write: include="username" add="location_city" and add t:parameter to "location_city", but in the table I can only get 'username' column. But if I remove include section, all the user information and city will be shown.

Now I can use exclude and username to get what I need, but that would be annoying to write so much longer exclude expression.

So is it a known issue? 

Thanks.
DH
----- Original Message ----- 
From: "Jonathan Barker" <jo...@gmail.com>
To: "'Tapestry users'" <us...@tapestry.apache.org>
Sent: Saturday, April 19, 2008 11:26 AM
Subject: RE: T5: Is there a simple way to display property of embedded instance in Grid?


> 
> 
> I'll add to this and say that if you want sorting behavior, you can
> implement Comparable and Comparator (I don't remember which you need - I
> tend to implement both), and add "location" to your model.
> 
> IIRC, you will need to build your model in code to say that the "location"
> column is sortable.
> 
> 
> Jonathan
> 
> 
>> -----Original Message-----
>> From: Tobias Wehrum [mailto:Legato@dragonlab.de]
>> Sent: Friday, April 18, 2008 5:20 AM
>> To: Tapestry users
>> Subject: Re: T5: Is there a simple way to display property of embedded
>> instance in Grid?
>> 
>> Hi DH,
>> 
>> it would be:
>> 
>> -----------------------------------------------------------------------
>> <table t:type="grid" t:source="userSource" row="currentUser"
>> add="location_city">
>>     <t:parameter name="location_citycell">
>> ${currentUser.location.city}
>>     </t:parameter>
>> </table>
>> -----------------------------------------------------------------------
>> 
>> (Note the "add" instead of include - you want to add something not already
>> existing, not include something.)
>> 
>> On your page you have to define
>> 
>> -----------------------------------------------------------------------
>> @Parameter
>> User userSource;
>> -----------------------------------------------------------------------
>> 
>> to keep track of the current grid object.
>> So much for the first method.
>> 
>> 
>> If you want to have to have a Location always represented as a String
>> containing its city toString():
>> 
>> -----------------------------------------------------------------------
>> class Location {
>> // [...]
>> public String toString() {
>> return city;
>> }
>> }
>> -----------------------------------------------------------------------
>> 
>> Now you have to define a Translator for Tapestry (I use a template for all
>> classes which implement toString()):
>> 
>> -----------------------------------------------------------------------
>> public class ModelTranslator<ModelClass> implements Translator<ModelClass>
>> {
>> 
>>    public Class<ModelClass> getType() {
>>        return null;
>>    }
>> 
>>    public ModelClass parseClient(String arg0, Messages arg1)
>>            throws ValidationException {
>>        throw new ValidationException("ModelTranslator cannot
>> implement parseClient()");
>>    }
>> 
>>    public String toClient(ModelClass arg0) {
>>        return arg0.toString();
>>    }
>> 
>> }
>> -----------------------------------------------------------------------
>> 
>> Now you only have to announce your Translator in to your AppModule.java:
>> 
>> -----------------------------------------------------------------------
>>     @SuppressWarnings("unchecked")
>>     public static void
>> contributeDefaultDataTypeAnalyzer(MappedConfiguration<Class, String>
>> configuration) {
>>     configuration.add(User.class, "user");
>>     }
>> 
>>     @SuppressWarnings("unchecked") {
>>     configuration.add("user", new ModelTranslator<User>());
>>     }
>> -----------------------------------------------------------------------
>> 
>> ...and after doing this, you have to do exactly *nothing* to add it to
>> your grid - it will do so per default. :)
>> 
>> Tobias
>> 
>> 
>> dhning schrieb:
>> 
>> > Hi, Tobias
>> >
>> > Thanks for reply.
>> >
>> > I am newbie of customizing grid component.
>> > I guess what you mean like this?:
>> > <table t:type="grid" t:source="userSource" include="location_city">
>> >     <t:parameter name="location_cityheader">
>> >     </t:parameter>
>> >     <t:parameter name="location_citycell">
>> >     </t:parameter>
>> > </table>
>> >
>> > But exception message still exists: "Bean editor model for User does not
>> contain a property named 'location_city'".
>> >
>> > Thanks!
>> >
>> > DH
>> >
>> >
>> > ----- Original Message -----
>> > From: "Tobias Wehrum" <Le...@dragonlab.de>
>> > To: "Tapestry users" <us...@tapestry.apache.org>
>> > Sent: Friday, April 18, 2008 4:20 PM
>> > Subject: Re: T5: Is there a simple way to display property of embedded
>> instance in Grid?
>> >
>> >
>> >
>> >> Hi DH,
>> >>
>> >> you can teach Location a standard way to be outputted by overwriting
>> the
>> >> toString() function of Location.
>> >>
>> >> Now you can output the String returned by toString() simply by
>> including
>> >> "location".
>> >>
>> >> If you want to output different properties of Location and not in one
>> >> cell, I think you will have to add location_city, location_street etc
>> >> and implement <t:parameter> blocks for it.
>> >>
>> >> Hope that helps,
>> >> Tobias
>> >>
>> >> dhning schrieb:
>> >>
>> >>> Hi, All
>> >>>
>> >>> Case: A user own a location while the location is comprised of city,
>> street...
>> >>> public class User {
>> >>>   private Location location;
>> >>>   // setter & getter
>> >>> }
>> >>> public class Location {
>> >>>   private String city;
>> >>>  // setter & getter
>> >>> }
>> >>>
>> >>> In the user list page, I want to display the city as one column in
>> Grid.
>> >>> But it doesn't work like this <table t:type="grid"
>> t:source="userSource" include="location.city"></table>.
>> >>> The exception message is "User does not contain a property named
>> 'location.city'".
>> >>>
>> >>> Is there a simple way to implement such function?
>> >>>
>> >>> Thanks in advance.
>> >>> DH
>> >>>
>> >> ---------------------------------------------------------------------
>> >> 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: T5: Is there a simple way to display property of embedded instance in Grid?

Posted by Jonathan Barker <jo...@gmail.com>.

I'll add to this and say that if you want sorting behavior, you can
implement Comparable and Comparator (I don't remember which you need - I
tend to implement both), and add "location" to your model.

IIRC, you will need to build your model in code to say that the "location"
column is sortable.


Jonathan


> -----Original Message-----
> From: Tobias Wehrum [mailto:Legato@dragonlab.de]
> Sent: Friday, April 18, 2008 5:20 AM
> To: Tapestry users
> Subject: Re: T5: Is there a simple way to display property of embedded
> instance in Grid?
> 
> Hi DH,
> 
> it would be:
> 
> -----------------------------------------------------------------------
> <table t:type="grid" t:source="userSource" row="currentUser"
> add="location_city">
>     <t:parameter name="location_citycell">
> 	${currentUser.location.city}
>     </t:parameter>
> </table>
> -----------------------------------------------------------------------
> 
> (Note the "add" instead of include - you want to add something not already
> existing, not include something.)
> 
> On your page you have to define
> 
> -----------------------------------------------------------------------
> @Parameter
> User userSource;
> -----------------------------------------------------------------------
> 
> to keep track of the current grid object.
> So much for the first method.
> 
> 
> If you want to have to have a Location always represented as a String
> containing its city toString():
> 
> -----------------------------------------------------------------------
> class Location {
> 	// [...]
> 	public String toString() {
> 		return city;
> 	}
> }
> -----------------------------------------------------------------------
> 
> Now you have to define a Translator for Tapestry (I use a template for all
> classes which implement toString()):
> 
> -----------------------------------------------------------------------
> public class ModelTranslator<ModelClass> implements Translator<ModelClass>
> {
> 
> 	   public Class<ModelClass> getType() {
> 	       return null;
> 	   }
> 
> 	   public ModelClass parseClient(String arg0, Messages arg1)
> 	           throws ValidationException {
> 	       throw new ValidationException("ModelTranslator cannot
> implement parseClient()");
> 	   }
> 
> 	   public String toClient(ModelClass arg0) {
> 	       return arg0.toString();
> 	   }
> 
> }
> -----------------------------------------------------------------------
> 
> Now you only have to announce your Translator in to your AppModule.java:
> 
> -----------------------------------------------------------------------
>     @SuppressWarnings("unchecked")
>     public static void
> contributeDefaultDataTypeAnalyzer(MappedConfiguration<Class, String>
> configuration) {
>     	configuration.add(User.class, "user");
>     }
> 
>     @SuppressWarnings("unchecked") {
>     	configuration.add("user", new ModelTranslator<User>());
>     }
> -----------------------------------------------------------------------
> 
> ...and after doing this, you have to do exactly *nothing* to add it to
> your grid - it will do so per default. :)
> 
> Tobias
> 
> 
> dhning schrieb:
> 
> > Hi, Tobias
> >
> > Thanks for reply.
> >
> > I am newbie of customizing grid component.
> > I guess what you mean like this?:
> > <table t:type="grid" t:source="userSource" include="location_city">
> >     <t:parameter name="location_cityheader">
> >     </t:parameter>
> >     <t:parameter name="location_citycell">
> >     </t:parameter>
> > </table>
> >
> > But exception message still exists: "Bean editor model for User does not
> contain a property named 'location_city'".
> >
> > Thanks!
> >
> > DH
> >
> >
> > ----- Original Message -----
> > From: "Tobias Wehrum" <Le...@dragonlab.de>
> > To: "Tapestry users" <us...@tapestry.apache.org>
> > Sent: Friday, April 18, 2008 4:20 PM
> > Subject: Re: T5: Is there a simple way to display property of embedded
> instance in Grid?
> >
> >
> >
> >> Hi DH,
> >>
> >> you can teach Location a standard way to be outputted by overwriting
> the
> >> toString() function of Location.
> >>
> >> Now you can output the String returned by toString() simply by
> including
> >> "location".
> >>
> >> If you want to output different properties of Location and not in one
> >> cell, I think you will have to add location_city, location_street etc
> >> and implement <t:parameter> blocks for it.
> >>
> >> Hope that helps,
> >> Tobias
> >>
> >> dhning schrieb:
> >>
> >>> Hi, All
> >>>
> >>> Case: A user own a location while the location is comprised of city,
> street...
> >>> public class User {
> >>>   private Location location;
> >>>   // setter & getter
> >>> }
> >>> public class Location {
> >>>   private String city;
> >>>  // setter & getter
> >>> }
> >>>
> >>> In the user list page, I want to display the city as one column in
> Grid.
> >>> But it doesn't work like this <table t:type="grid"
> t:source="userSource" include="location.city"></table>.
> >>> The exception message is "User does not contain a property named
> 'location.city'".
> >>>
> >>> Is there a simple way to implement such function?
> >>>
> >>> Thanks in advance.
> >>> DH
> >>>
> >> ---------------------------------------------------------------------
> >> 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: T5: Is there a simple way to display property of embedded instance in Grid?

Posted by Tobias Wehrum <Le...@dragonlab.de>.
Hi DH,

it would be:

-----------------------------------------------------------------------
<table t:type="grid" t:source="userSource" row="currentUser" add="location_city">
    <t:parameter name="location_citycell">
	${currentUser.location.city}
    </t:parameter>
</table>
-----------------------------------------------------------------------

(Note the "add" instead of include - you want to add something not already existing, not include something.)

On your page you have to define

-----------------------------------------------------------------------
@Parameter
User userSource;
-----------------------------------------------------------------------

to keep track of the current grid object.
So much for the first method.


If you want to have to have a Location always represented as a String containing its city toString():

-----------------------------------------------------------------------
class Location {
	// [...]
	public String toString() {
		return city;
	}
}
-----------------------------------------------------------------------

Now you have to define a Translator for Tapestry (I use a template for all classes which implement toString()):

-----------------------------------------------------------------------
public class ModelTranslator<ModelClass> implements Translator<ModelClass> {

	   public Class<ModelClass> getType() {
	       return null;
	   }

	   public ModelClass parseClient(String arg0, Messages arg1)
	           throws ValidationException {
	       throw new ValidationException("ModelTranslator cannot implement parseClient()");
	   }

	   public String toClient(ModelClass arg0) {
	       return arg0.toString();
	   }

}
-----------------------------------------------------------------------

Now you only have to announce your Translator in to your AppModule.java:

-----------------------------------------------------------------------
    @SuppressWarnings("unchecked")
    public static void contributeDefaultDataTypeAnalyzer(MappedConfiguration<Class, String> configuration) {
    	configuration.add(User.class, "user");
    }

    @SuppressWarnings("unchecked") {
    	configuration.add("user", new ModelTranslator<User>());
    } 
-----------------------------------------------------------------------

...and after doing this, you have to do exactly *nothing* to add it to your grid - it will do so per default. :)

Tobias


dhning schrieb:

> Hi, Tobias
>
> Thanks for reply.
>
> I am newbie of customizing grid component.
> I guess what you mean like this?:
> <table t:type="grid" t:source="userSource" include="location_city">
>     <t:parameter name="location_cityheader">
>     </t:parameter>
>     <t:parameter name="location_citycell">
>     </t:parameter>
> </table>
>
> But exception message still exists: "Bean editor model for User does not contain a property named 'location_city'".
>
> Thanks!
>
> DH
>
>
> ----- Original Message ----- 
> From: "Tobias Wehrum" <Le...@dragonlab.de>
> To: "Tapestry users" <us...@tapestry.apache.org>
> Sent: Friday, April 18, 2008 4:20 PM
> Subject: Re: T5: Is there a simple way to display property of embedded instance in Grid?
>
>
>   
>> Hi DH,
>>
>> you can teach Location a standard way to be outputted by overwriting the 
>> toString() function of Location.
>>
>> Now you can output the String returned by toString() simply by including 
>> "location".
>>
>> If you want to output different properties of Location and not in one 
>> cell, I think you will have to add location_city, location_street etc 
>> and implement <t:parameter> blocks for it.
>>
>> Hope that helps,
>> Tobias
>>
>> dhning schrieb:
>>     
>>> Hi, All
>>>
>>> Case: A user own a location while the location is comprised of city, street...
>>> public class User {
>>>   private Location location;
>>>   // setter & getter
>>> }
>>> public class Location {
>>>   private String city;
>>>  // setter & getter
>>> }
>>>
>>> In the user list page, I want to display the city as one column in Grid.
>>> But it doesn't work like this <table t:type="grid" t:source="userSource" include="location.city"></table>.
>>> The exception message is "User does not contain a property named 'location.city'".
>>>
>>> Is there a simple way to implement such function?
>>>
>>> Thanks in advance.
>>> DH
>>>       
>> ---------------------------------------------------------------------
>> 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: T5: Is there a simple way to display property of embedded instance in Grid?

Posted by dhning <dh...@gaonline.com.cn>.
Hi, Tobias

Thanks for reply.

I am newbie of customizing grid component.
I guess what you mean like this?:
<table t:type="grid" t:source="userSource" include="location_city">
    <t:parameter name="location_cityheader">
    </t:parameter>
    <t:parameter name="location_citycell">
    </t:parameter>
</table>

But exception message still exists: "Bean editor model for User does not contain a property named 'location_city'".

Thanks!

DH


----- Original Message ----- 
From: "Tobias Wehrum" <Le...@dragonlab.de>
To: "Tapestry users" <us...@tapestry.apache.org>
Sent: Friday, April 18, 2008 4:20 PM
Subject: Re: T5: Is there a simple way to display property of embedded instance in Grid?


> Hi DH,
> 
> you can teach Location a standard way to be outputted by overwriting the 
> toString() function of Location.
> 
> Now you can output the String returned by toString() simply by including 
> "location".
> 
> If you want to output different properties of Location and not in one 
> cell, I think you will have to add location_city, location_street etc 
> and implement <t:parameter> blocks for it.
> 
> Hope that helps,
> Tobias
> 
> dhning schrieb:
>> Hi, All
>>
>> Case: A user own a location while the location is comprised of city, street...
>> public class User {
>>   private Location location;
>>   // setter & getter
>> }
>> public class Location {
>>   private String city;
>>  // setter & getter
>> }
>>
>> In the user list page, I want to display the city as one column in Grid.
>> But it doesn't work like this <table t:type="grid" t:source="userSource" include="location.city"></table>.
>> The exception message is "User does not contain a property named 'location.city'".
>>
>> Is there a simple way to implement such function?
>>
>> Thanks in advance.
>> DH
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 
>

Re: T5: Is there a simple way to display property of embedded instance in Grid?

Posted by Tobias Wehrum <Le...@dragonlab.de>.
Hi DH,

you can teach Location a standard way to be outputted by overwriting the 
toString() function of Location.

Now you can output the String returned by toString() simply by including 
"location".

If you want to output different properties of Location and not in one 
cell, I think you will have to add location_city, location_street etc 
and implement <t:parameter> blocks for it.

Hope that helps,
Tobias

dhning schrieb:
> Hi, All
>
> Case: A user own a location while the location is comprised of city, street...
> public class User {
>   private Location location;
>   // setter & getter
> }
> public class Location {
>   private String city;
>  // setter & getter
> }
>
> In the user list page, I want to display the city as one column in Grid.
> But it doesn't work like this <table t:type="grid" t:source="userSource" include="location.city"></table>.
> The exception message is "User does not contain a property named 'location.city'".
>
> Is there a simple way to implement such function?
>
> Thanks in advance.
> DH


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


T5: Is there a simple way to display property of embedded instance in Grid?

Posted by dhning <dh...@gaonline.com.cn>.
Hi, All

Case: A user own a location while the location is comprised of city, street...
public class User {
  private Location location;
  // setter & getter
}
public class Location {
  private String city;
 // setter & getter
}

In the user list page, I want to display the city as one column in Grid.
But it doesn't work like this <table t:type="grid" t:source="userSource" include="location.city"></table>.
The exception message is "User does not contain a property named 'location.city'".

Is there a simple way to implement such function?

Thanks in advance.
DH

Re: Grid component and context values - TapestryException

Posted by Petros Petrou <pe...@cypoz.com>.
Hi guys, 

Has anyone seen the problem below

Petros


Petros Petrou wrote:
> 
> I have the following code that works fine
> AccountsList.tml
> <table t:type="Grid" source="accountsList" row="account" mode="model">
>    <t:parameter name="accountManagerCell">
>       ${account?.accountManager?.username}
>    </t:parameter>
> </table>
> 
> AccountsList.java
> ...
> private BeanModel<Account> model;
> {
>    model = beanModelSource.create(Account.class, true,
> componentResources);
>    model.add("accountManager", null);
> }
> 
> Now I replaced this line 
> ${account?.accountManager?.username}
> with 
> <aa t:type="PageLink" page="user/DetailsPage"
> context="${account?.accountManager?.username}">${account?.accountManager?.username}</aa>
> 
> I am getting a TapestryException with the message
> Context values (which are added to the request URL) may not be null or
> blank. 
> 
> However, the context values are not blank because removing the "context"
> everything works fine. 
> Furthermore, moving this line 
> <aa t:type="PageLink" page="user/DetailsPage"
> context="${account?.accountManager?.username}">${account?.accountManager?.username}</aa>
> outsite the grid component also works fine. 
> 
> Why it doesn't let me use context values for the PageLink inside a Grid
> component ?
> Petros
> 

-- 
View this message in context: http://www.nabble.com/Grid-component-and-context-values---TapestryException-tp16433892p16759812.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


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


Re: Re: Grid component and context values - TapestryException

Posted by Petros Petrou <pe...@cypoz.com>.
Hi Greetz,

You suggestion fixed the problem thank you :)

Petros



nille hammer wrote:
> 
> Hi Petros,
> the problem is caused by the expression
> context="{account?.accountManager?.username}". With "?." you tell
> Tapestry: "The value might be null, please check before calling the
> Method." As null values aren´t allowed in context, you must not tell
> Tapestry that your values might be null. Change the expression to
> context="{account.accountManager.username}" and ensure in another way in
> your code that account and accountManager aren´t null when being called by
> the t:parameter.
> Greetz nillehammer
> 
> ----- original Nachricht --------
> 
> Betreff: Re: Grid component and context values - TapestryException
> Gesendet: Fr, 18. Apr 2008
> Von: Petros Petrou<pe...@cypoz.com>
> 
>> 
>> Hi guys, 
>> 
>> Has anyone seen the problem below
>> 
>> Petros
>> 
>> 
>> Petros Petrou wrote:
>> > 
>> > I have the following code that works fine
>> > AccountsList.tml
>> > <table t:type="Grid" source="accountsList" row="account" mode="model">
>> >    <t:parameter name="accountManagerCell">
>> >       ${account?.accountManager?.username}
>> >    </t:parameter>
>> > </table>
>> > 
>> > AccountsList.java
>> > ...
>> > private BeanModel<Account> model;
>> > {
>> >    model = beanModelSource.create(Account.class, true,
>> > componentResources);
>> >    model.add("accountManager", null);
>> > }
>> > 
>> > Now I replaced this line 
>> > ${account?.accountManager?.username}
>> > with 
>> > <aa t:type="PageLink" page="user/DetailsPage"
>> >
>> context="${account?.accountManager?.username}">${account?.accountManager?.us
>> ername}</aa>
>> > 
>> > I am getting a TapestryException with the message
>> > Context values (which are added to the request URL) may not be null or
>> > blank. 
>> > 
>> > However, the context values are not blank because removing the
>> "context"
>> > everything works fine. 
>> > Furthermore, moving this line 
>> > <aa t:type="PageLink" page="user/DetailsPage"
>> >
>> context="${account?.accountManager?.username}">${account?.accountManager?.us
>> ername}</aa>
>> > outsite the grid component also works fine. 
>> > 
>> > Why it doesn't let me use context values for the PageLink inside a Grid
>> > component ?
>> > Petros
>> > 
>> 
>> -- 
>> View this message in context:
>> http://www.nabble.com/Grid-component-and-context-values---TapestryException-
>> tp16433892p16759812.html
>> Sent from the Tapestry - User mailing list archive at Nabble.com.
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>> 
>> 
> 
> --- original Nachricht Ende ----
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Grid-component-and-context-values---TapestryException-tp16433892p16773952.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


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