You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Human Dunnil <h....@gmail.com> on 2005/11/13 22:16:20 UTC

EnumPropertySelectionModel in Tapestry 4?

Hi folks,
I'm reading Tapestry in Action book, in chapter 4 there is class named
EnumPropertySelectionModel, but I can't find it in the latest release of
Tapestry (4 beta 11), Is this changed in T4? If so, what's replaced with it?
 Thanks in advance,
- Human

Re: EnumPropertySelectionModel in Tapestry 4?

Posted by Geoff Longman <gl...@gmail.com>.
class JDK15EnumPropertySelectionModel implements IPropertySelectionModel {
		private Object[] options;

		@SuppressWarnings("unchecked")
		public SelectionModel(Class<? extends Enum> enumType) {
			this(EnumSet.allOf(enumType));				
		}

		@SuppressWarnings("unchecked")
		public SelectionModel(EnumSet set) {
			ArrayList list = new ArrayList(set);
			Collections.sort(list);
			this.options = list.toArray();	
		}

		public int getOptionCount() {
			return options.length;
		}

		public Object getOption(int index) {
			return options[index];
		}

		public String getLabel(int index) {
			options[index].toString();
		}

		public String getValue(int index) {
			return Integer.toString(index);
		}

		public Object translateValue(String value) {
			int index;
			index = Integer.parseInt(value);
			return options[index];
		}
	}

On 11/14/05, Chris Chiappone <ch...@gmail.com> wrote:
> I beleive it was removed in tap4 because of jdk 5 and annotations.
>
> On 11/13/05, Human Dunnil <h....@gmail.com> wrote:
> > Hi folks,
> > I'm reading Tapestry in Action book, in chapter 4 there is class named
> > EnumPropertySelectionModel, but I can't find it in the latest release of
> > Tapestry (4 beta 11), Is this changed in T4? If so, what's replaced with it?
> >  Thanks in advance,
> > - Human
> >
> >
>
>
> --
> ~chris
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>


--
The Spindle guy.           http://spindle.sf.net
Get help with Spindle:   
http://lists.sourceforge.net/mailman/listinfo/spindle-user
Announcement Feed:    
http://www.jroller.com/rss/glongman?catname=/Announcements
Feature Updates:            http://spindle.sf.net/updates

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


Re: EnumPropertySelectionModel in Tapestry 4?

Posted by Chris Chiappone <ch...@gmail.com>.
I beleive it was removed in tap4 because of jdk 5 and annotations.

On 11/13/05, Human Dunnil <h....@gmail.com> wrote:
> Hi folks,
> I'm reading Tapestry in Action book, in chapter 4 there is class named
> EnumPropertySelectionModel, but I can't find it in the latest release of
> Tapestry (4 beta 11), Is this changed in T4? If so, what's replaced with it?
>  Thanks in advance,
> - Human
>
>


--
~chris

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