public class ELSelectItemProvider extends SelectItem implements Serializable, ISelectItemProvider
Adapts an object to an ISelectItemProvider
using faces' expression language to access its properties.
Clients must specify what properties to use for select item's label, value, description, etc.
class Item { public int getId(); public String getName(); }; Item item = new Items("1", "First Item"); ISelectItemProvider provider = new ELSelectItemProvider(item, "id", "name"); String label = provider.getLabel(); // returns "First Item" Object value = provider.getValue(); // returns 1
Modifier and Type | Field and Description |
---|---|
protected String |
m_descriptionFieldName |
protected String |
m_disabledFieldName |
protected String |
m_iconFieldName |
protected String |
m_labelFieldName |
protected Object |
m_o |
protected String |
m_styleFieldName |
protected String |
m_valueFieldName |
Constructor and Description |
---|
ELSelectItemProvider()
Default constructor.
|
ELSelectItemProvider(Object o,
String labelFieldName,
String valueFieldName)
Initializes provider with the given object to use as a source and label and value properties.
|
ELSelectItemProvider(Object o,
String labelFieldName,
String valueFieldName,
String descriptionFieldName,
String disabledFieldName,
String styleFieldName,
String iconFieldName)
Initializes provider with all required information.
|
Modifier and Type | Method and Description |
---|---|
String |
getDescription()
Returns item's extended description, typically used in the UI as a tooltip
|
String |
getDescriptionFieldName()
Returns property name of the source object to use for select item description
|
String |
getDisabledFieldName()
Returns property name of the source object to use for select item disabled flag
|
String |
getIcon()
Returns item's encoded icon URL.
|
String |
getIconFieldName()
Returns property name of the source object to use for select item icon
|
String |
getLabel()
Returns item's display name, typically used in the UI to diplay this item
|
String |
getLabelFieldName()
Returns property name of the source object to use for select item label
|
Object |
getObject()
Returns currently set source object
|
String |
getStyle()
Returns item's inline CSS style.
|
String |
getStyleFieldName()
Returns property name of the source object to use for select item description
|
Object |
getValue()
Returns item's value, used for data binding, typically a unique identifier.
|
String |
getValueFieldName()
Returns property name of the source object to use for select item value
|
boolean |
isDisabled()
Returns true if item is disabled.
|
void |
setDescriptionFieldName(String descriptionFieldName)
Sets property name on the source object to use for select item description
|
void |
setDisabledFieldName(String disabledFieldName)
Sets property name on the source object to use for select item disabled flag
|
void |
setIconFieldName(String iconFieldName)
Sets property name on the source object to use for select item icon
|
void |
setLabelFieldName(String labelFieldName)
Sets property name on the source object to use for select item description
|
void |
setObject(Object o)
Sets source object to use
|
void |
setStyleFieldName(String styleFieldName)
Sets property name on the source object to use for select item style
|
void |
setValueFieldName(String valueFieldName)
Sets property name on the source object to use for select item value
|
isEscape, isNoSelectionOption, setDescription, setDisabled, setEscape, setLabel, setNoSelectionOption, setValue
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
isEscape
protected Object m_o
protected String m_labelFieldName
protected String m_valueFieldName
protected String m_descriptionFieldName
protected String m_disabledFieldName
protected String m_styleFieldName
protected String m_iconFieldName
public ELSelectItemProvider()
setObject(Object)
must be called before use.public ELSelectItemProvider(Object o, String labelFieldName, String valueFieldName)
o
- source objectlabelFieldName
- name of the property to use to get the label for the select itemvalueFieldName
- name of the property to use to get the value for the select itempublic ELSelectItemProvider(Object o, String labelFieldName, String valueFieldName, String descriptionFieldName, String disabledFieldName, String styleFieldName, String iconFieldName)
o
- source objectlabelFieldName
- name of the property to use to get the label for the select itemvalueFieldName
- name of the property to use to get the value for the select itemdescriptionFieldName
- name of the property to use to get the description for the select item, can be null
disabledFieldName
- name of the property to use to get the disabled flag for the select item, can be null
styleFieldName
- name of the property to use to get the style for the select item, can be null
iconFieldName
- name of the property to use to get the icon for the select item, can be null
public String getDescription()
ISelectItemProvider
getDescription
in interface ISelectItemProvider
getDescription
in class SelectItem
public String getIcon()
ISelectItemProvider
getIcon
in interface ISelectItemProvider
public String getLabel()
ISelectItemProvider
getLabel
in interface ISelectItemProvider
getLabel
in class SelectItem
public String getStyle()
ISelectItemProvider
getStyle
in interface ISelectItemProvider
public Object getValue()
ISelectItemProvider
getValue
in interface ISelectItemProvider
getValue
in class SelectItem
public boolean isDisabled()
ISelectItemProvider
isDisabled
in interface ISelectItemProvider
isDisabled
in class SelectItem
public void setObject(Object o)
o
- source objectpublic Object getObject()
public String getDescriptionFieldName()
public void setDescriptionFieldName(String descriptionFieldName)
descriptionFieldName
- property name, can be nullpublic String getDisabledFieldName()
public void setDisabledFieldName(String disabledFieldName)
disabledFieldName
- property name, can be nullpublic String getIconFieldName()
public void setIconFieldName(String iconFieldName)
iconFieldName
- property name, can be nullpublic String getLabelFieldName()
public void setLabelFieldName(String labelFieldName)
labelFieldName
- property name, can be nullpublic String getStyleFieldName()
public void setStyleFieldName(String styleFieldName)
styleFieldName
- property name, can be nullpublic String getValueFieldName()
public void setValueFieldName(String valueFieldName)
valueFieldName
- property name, can be null