org.chorem.pollen.ui.data
Class GenericSelectModel<T>

java.lang.Object
  extended by org.apache.tapestry5.util.AbstractSelectModel
      extended by org.chorem.pollen.ui.data.GenericSelectModel<T>
All Implemented Interfaces:
org.apache.tapestry5.SelectModel, org.apache.tapestry5.ValueEncoder<T>

public class GenericSelectModel<T>
extends org.apache.tapestry5.util.AbstractSelectModel
implements org.apache.tapestry5.ValueEncoder<T>

Generic selection model for a list of Objects. Adadpted from http://wiki.apache.org/tapestry/Tapestry5HowtoSelectWithObjects use:

 @Inject
 private PropertyAccess _access;
 
in your page to ge the PropertyAccess service.
!Notice: you must set the created instance both as model and encoder parameter for the Select component.


Constructor Summary
GenericSelectModel(List<T> list, Class<T> clazz, String labelField, String idField, org.apache.tapestry5.ioc.services.PropertyAccess access)
           
 
Method Summary
 List<T> getList()
           
 List<org.apache.tapestry5.OptionGroupModel> getOptionGroups()
           
 List<org.apache.tapestry5.OptionModel> getOptions()
           
 String toClient(T obj)
           
 T toValue(String string)
           
 
Methods inherited from class org.apache.tapestry5.util.AbstractSelectModel
visit
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GenericSelectModel

public GenericSelectModel(List<T> list,
                          Class<T> clazz,
                          String labelField,
                          String idField,
                          org.apache.tapestry5.ioc.services.PropertyAccess access)
Method Detail

getOptionGroups

public List<org.apache.tapestry5.OptionGroupModel> getOptionGroups()
Specified by:
getOptionGroups in interface org.apache.tapestry5.SelectModel

getOptions

public List<org.apache.tapestry5.OptionModel> getOptions()
Specified by:
getOptions in interface org.apache.tapestry5.SelectModel

getList

public List<T> getList()

toClient

public String toClient(T obj)
Specified by:
toClient in interface org.apache.tapestry5.ValueEncoder<T>

toValue

public T toValue(String string)
Specified by:
toValue in interface org.apache.tapestry5.ValueEncoder<T>


Copyright © 2009-2010 CodeLutin. All Rights Reserved.