T - public class GenericSelectModel<T>
extends org.apache.tapestry5.util.AbstractSelectModel
| Constructor and Description |
|---|
GenericSelectModel(List<T> list,
Class<T> clazz,
String labelField,
String idField,
org.apache.tapestry5.ioc.services.PropertyAccess access) |
GenericSelectModel(Map<String,List<T>> map,
Class<T> clazz,
String labelField,
String idField,
org.apache.tapestry5.ioc.services.PropertyAccess access) |
| Modifier and Type | Method and Description |
|---|---|
T |
findObject(String id) |
List<T> |
getList() |
List<org.apache.tapestry5.OptionGroupModel> |
getOptionGroups() |
List<org.apache.tapestry5.OptionModel> |
getOptions() |
public GenericSelectModel(List<T> list, Class<T> clazz, String labelField, String idField, org.apache.tapestry5.ioc.services.PropertyAccess access)
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.Copyright © 2009-2012 Ifremer. All Rights Reserved.