You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Andy Pahne <ap...@net22.de> on 2008/09/26 12:20:21 UTC

[T5] Select component: howto create a SelectModel out of List

I have a simple list of Strings that should be the source of a 
SelectModel. How do I create one?

I had a look at
    http://wiki.apache.org/tapestry/Tapestry5SelectObject
but it's outdated (before the T5 package name refactoring) and just 
looks to complicated for my simple purpose. Also I am not a great fan of 
"forking" core lib components and keeping them in touch with the current 
development.

There must be an easier way, I think.


Andy


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


Re: [T5] Select component: howto create a SelectModel out of List

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
Em Fri, 26 Sep 2008 08:35:11 -0300, Andy Pahne <ap...@net22.de> escreveu:

> That's the easier way I thought of, thanks. I was tricked by the  
> component reference, which states that the type of the parameter is  
> SelectModel.

The parameter type *is* SelectModel, but Tapestry has coercions:  
conversions from one type to another. There must be a String ->  
SelectModel coercer somewhere in Tapestry's code.

That's the same case with Grid's source parameter: its type is  
GridDataSource, but you can pass a List to it. ;)

Thiago

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


Re: [T5] Select component: howto create a SelectModel out of List

Posted by Andy Pahne <ap...@net22.de>.
Ulrich Stärk schrieb:
> If you want to use it with the select component then there is no need to
> write your own selectmodel. Just provide an array of strings to the model
> parameter, e.g. <t:select model="literal:foo,bar,baz"...> or <t:select
> model="strings"...> where strings is an array or list in your page class.
> 
> Uli
> 


That's the easier way I thought of, thanks. I was tricked by the 
component reference, which states that the type of the parameter is 
SelectModel.

Andy

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


Re: [T5] Select component: howto create a SelectModel out of List

Posted by Ulrich Stärk <ul...@spielviel.de>.
If you want to use it with the select component then there is no need to
write your own selectmodel. Just provide an array of strings to the model
parameter, e.g. <t:select model="literal:foo,bar,baz"...> or <t:select
model="strings"...> where strings is an array or list in your page class.

Uli

Am Fr, 26.09.2008, 12:32, schrieb Filip S. Adamsen:
> Hi,
>
> Just implement org.apache.tapestry5.SelectModel. You can extend
> org.apache.tapestry5.util.AbstractSelectModel when you do.
>
> -Filip
>
> On 2008-09-26 12:20, Andy Pahne wrote:
>>
>> I have a simple list of Strings that should be the source of a
>> SelectModel. How do I create one?
>>
>> I had a look at
>>    http://wiki.apache.org/tapestry/Tapestry5SelectObject
>> but it's outdated (before the T5 package name refactoring) and just
>> looks to complicated for my simple purpose. Also I am not a great fan of
>> "forking" core lib components and keeping them in touch with the current
>> development.
>>
>> There must be an easier way, I think.
>>
>>
>> Andy
>>
>>
>> ---------------------------------------------------------------------
>> 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] Select component: howto create a SelectModel out of List

Posted by "Filip S. Adamsen" <fs...@fsadev.com>.
Hi,

Just implement org.apache.tapestry5.SelectModel. You can extend 
org.apache.tapestry5.util.AbstractSelectModel when you do.

-Filip

On 2008-09-26 12:20, Andy Pahne wrote:
> 
> I have a simple list of Strings that should be the source of a 
> SelectModel. How do I create one?
> 
> I had a look at
>    http://wiki.apache.org/tapestry/Tapestry5SelectObject
> but it's outdated (before the T5 package name refactoring) and just 
> looks to complicated for my simple purpose. Also I am not a great fan of 
> "forking" core lib components and keeping them in touch with the current 
> development.
> 
> There must be an easier way, I think.
> 
> 
> Andy
> 
> 
> ---------------------------------------------------------------------
> 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