fr.ifremer.suiviobsmer.ui.base
Class GenericSelectModel<T>
java.lang.Object
org.apache.tapestry5.util.AbstractSelectModel
fr.ifremer.suiviobsmer.ui.base.GenericSelectModel<T>
- Type Parameters:
T -
- All Implemented Interfaces:
- org.apache.tapestry5.SelectModel
public class GenericSelectModel<T>
- extends org.apache.tapestry5.util.AbstractSelectModel
GenericSelectModel.java
Based on IdSelectModel from
A generic selection model whose value is the id of the chosen object, not the object itself.
- Version:
- $Revision: 3 $
Last update: $Date: 2009-07-31 16:54:15 +0200 (ven. 31 juil. 2009) $
by : $Author: fdesbois $
- Author:
- fdesbois
| 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 |
GenericSelectModel
public GenericSelectModel(List<T> list,
Class<T> clazz,
String labelField,
String idField,
org.apache.tapestry5.ioc.services.PropertyAccess access)
- Parameters:
list - the list of objects you want modeled in a Select component. These objects MUST implement
equals(Object obj) and hashCode(). If the objects are JPA entities, ensure their implementations of
equals(Object obj) and hashCode() return the same thing for different instances of the same detached
entity.clazz - the class of objects in the list.labelField - the name of the field you want displayed as the label in the selection list, eg. "name".idField - the name of the field which is the unique identifier of each object in the list, eg. "id". This is
used in the value property of the Select component.access - Declare a PropertyAccess injected into your page (eg. Inject private PropertyAccess _access) then pass it in here.
GenericSelectModel
public GenericSelectModel(Map<String,List<T>> map,
Class<T> clazz,
String labelField,
String idField,
org.apache.tapestry5.ioc.services.PropertyAccess access)
getOptionGroups
public List<org.apache.tapestry5.OptionGroupModel> getOptionGroups()
getOptions
public List<org.apache.tapestry5.OptionModel> getOptions()
getList
public List<T> getList()
findObject
public T findObject(String id)
Copyright © 2009-2010 Ifremer. All Rights Reserved.