Re: Enum or Drop Down

2011-02-21 Thread Taha Hafeez
To add to Thiago's golden words, you can have a simple ListValueEncoder for using index/toString() like this class ListValueEncoder(){ final private List values; public ListValueEncoder(List values){ this.values = values; } public String toClient(T value){ return values.i

Re: Enum or Drop Down

2011-02-21 Thread Thiago H. de Paula Figueiredo
On Mon, 21 Feb 2011 14:05:25 -0300, robnangle wrote: I am not using tapestry-hibernate, is there any examples out there because the few I have came across seem to be very complex? There are some examples out there that I consider the wrong approach, specifically implementing both ValueEnco

Re: Enum or Drop Down

2011-02-21 Thread robnangle
I am not using tapestry-hibernate, is there any examples out there because the few I have came across seem to be very complex? -- View this message in context: http://tapestry.1045711.n5.nabble.com/Enum-or-Drop-Down-tp3394312p3394431.html Sent from the Tapestry - User mailing list archive at Nab

Re: Enum or Drop Down

2011-02-21 Thread Thiago H. de Paula Figueiredo
On Mon, 21 Feb 2011 13:52:46 -0300, Richard Hill wrote: To be honest I never understood value encoder and don't use it. Recommendation: learn it and use it. In software development, ignorance is not bliss. :) When rendering a page all you need are a) the list of options and b) whic

Re: Enum or Drop Down

2011-02-21 Thread Richard Hill
know how to do that. Anyway, writing your own ValueEncoder is easy. > * What objects will be used as options? There's no way for Tapestry to do > that automatically in a reasonable way even when using tapestry-hibernate. > And SelectModelFactory already does the heavy lifting for you. > To b

Re: Enum or Drop Down

2011-02-21 Thread Thiago H. de Paula Figueiredo
On Mon, 21 Feb 2011 13:36:55 -0300, Richard Hill wrote: I always thought it would be nice if tap could generate a drop down given just a list - it could take the object id and toString() as values for example. There are two problems that you need to solve when writing a : * How do you map

Re: Enum or Drop Down

2011-02-21 Thread robnangle
Richard Hill-7 wrote: > > > I always thought it would be nice if tap could generate a drop down > given just a list - it could take the object id and toString() as values > for example. But sadly this does not exist so you have to build a model, > which as Stefan says is actually pretty simple.

Re: Enum or Drop Down

2011-02-21 Thread Richard Hill
I always thought it would be nice if tap could generate a drop down given just a list - it could take the object id and toString() as values for example. But sadly this does not exist so you have to build a model, which as Stefan says is actually pretty simple. And in fact being forced to supply y

Re: Enum or Drop Down

2011-02-21 Thread Stefan Schuetz
No, because tap needs to know how to remap the values on a form submit. So you need to provide a select model. But it's really easy stuff! Take a look: http://jumpstart.doublenegative.com.au/jumpstart/ - Stefan Am 21.02.2011 um 17:26 schrieb robnangle: > > So there is no way of doing it like

Re: Enum or Drop Down

2011-02-21 Thread robnangle
So there is no way of doing it like a grid: //players being a list populated from a database.. You have to create a model ect... -- View this message in context: http://tapestry.1045711.n5.nabble.com/Enum-or-Drop-Down-tp3394312p3394364.html Sent from the Tapestry - User mailing list archive

Re: Enum or Drop Down

2011-02-21 Thread Thiago H. de Paula Figueiredo
On Mon, 21 Feb 2011 12:55:59 -0300, Richard Hill wrote: You want to take a look at the t:select component. It takes a select model but tap can provide one automatically for an enum Plus see the SelectModelFactory interface to generate the select model easily. -- Thiago H. de Paula Figue

Re: Enum or Drop Down

2011-02-21 Thread Richard Hill
You want to take a look at the t:select component. It takes a select model but tap can provide one automatically for an enum On Mon, 2011-02-21 at 07:45 -0800, robnangle wrote: > Hi all, > Is it possible to populate an enum class with data from a database or what > component acts like a drop dow