public class ListIndexConverter extends Object implements Converter
The omnifaces.ListIndexConverter
is a variant of the ListConverter
which automatically converts
based on the position (index) of the selected item in the list instead of the Object.toString()
of the selected
item.
This converter is available by converter ID omnifaces.ListIndexConverter
and should be used in
combination with <o:converter>
in order to be able to pass the List
source to it, which it
can use for conversion. Here's a basic usage example with PrimeFaces <p:pickList>
, which is one of
the few select components which doesn't use SelectItem
s as the source, but work directly via a List
.
<p:pickList value="#{bean.dualListModel}" var="entity" itemValue="#{entity}" itemLabel="#{entity.someProperty}"> <o:converter converterId="omnifaces.ListIndexConverter" list="#{bean.dualListModel.source}" /> </p:pickList>
ListConverter
For detail, refer the javadoc of SelectItemsIndexConverter
and substitute
"SelectItemsIndexConverter
" by "ListIndexConverter
" and "SelectItemsConverter
"
by "ListConverter
".
DATETIMECONVERTER_DEFAULT_TIMEZONE_IS_SYSTEM_TIMEZONE_PARAM_NAME
Constructor and Description |
---|
ListIndexConverter() |
Modifier and Type | Method and Description |
---|---|
Object |
getAsObject(FacesContext context,
UIComponent component,
String value) |
String |
getAsString(FacesContext context,
UIComponent component,
Object value) |
void |
setList(List<?> list) |
public Object getAsObject(FacesContext context, UIComponent component, String value)
getAsObject
in interface Converter
public String getAsString(FacesContext context, UIComponent component, Object value)
getAsString
in interface Converter
public void setList(List<?> list)
Copyright © 2012–2015 OmniFaces. All rights reserved.