Class ELSelectItemProvider
java.lang.Object
javax.faces.model.SelectItem
com.webmethods.caf.faces.data.object.ELSelectItemProvider
- All Implemented Interfaces:
ISelectItemProvider
,Serializable
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
- See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionDefault 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. -
Method Summary
Modifier and TypeMethodDescriptionReturns item's extended description, typically used in the UI as a tooltipReturns property name of the source object to use for select item descriptionReturns property name of the source object to use for select item disabled flaggetIcon()
Returns item's encoded icon URL.Returns property name of the source object to use for select item icongetLabel()
Returns item's display name, typically used in the UI to diplay this itemReturns property name of the source object to use for select item labelReturns currently set source objectgetStyle()
Returns item's inline CSS style.Returns property name of the source object to use for select item descriptiongetValue()
Returns item's value, used for data binding, typically a unique identifier.Returns property name of the source object to use for select item valueboolean
Returns true if item is disabled.void
setDescriptionFieldName
(String descriptionFieldName) Sets property name on the source object to use for select item descriptionvoid
setDisabledFieldName
(String disabledFieldName) Sets property name on the source object to use for select item disabled flagvoid
setIconFieldName
(String iconFieldName) Sets property name on the source object to use for select item iconvoid
setLabelFieldName
(String labelFieldName) Sets property name on the source object to use for select item descriptionvoid
Sets source object to usevoid
setStyleFieldName
(String styleFieldName) Sets property name on the source object to use for select item stylevoid
setValueFieldName
(String valueFieldName) Sets property name on the source object to use for select item valueMethods inherited from class javax.faces.model.SelectItem
isEscape, isNoSelectionOption, setDescription, setDisabled, setEscape, setLabel, setNoSelectionOption, setValue
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.webmethods.caf.faces.data.ISelectItemProvider
isEscape
-
Field Details
-
m_o
-
m_labelFieldName
-
m_valueFieldName
-
m_descriptionFieldName
-
m_disabledFieldName
-
m_styleFieldName
-
m_iconFieldName
-
-
Constructor Details
-
ELSelectItemProvider
public ELSelectItemProvider()Default constructor.setObject(Object)
must be called before use. -
ELSelectItemProvider
Initializes provider with the given object to use as a source and label and value properties.- Parameters:
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 item
-
ELSelectItemProvider
public ELSelectItemProvider(Object o, String labelFieldName, String valueFieldName, String descriptionFieldName, String disabledFieldName, String styleFieldName, String iconFieldName) Initializes provider with all required information.- Parameters:
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 benull
disabledFieldName
- name of the property to use to get the disabled flag for the select item, can benull
styleFieldName
- name of the property to use to get the style for the select item, can benull
iconFieldName
- name of the property to use to get the icon for the select item, can benull
-
-
Method Details
-
getDescription
Description copied from interface:ISelectItemProvider
Returns item's extended description, typically used in the UI as a tooltip- Specified by:
getDescription
in interfaceISelectItemProvider
- Overrides:
getDescription
in classSelectItem
- Returns:
- item's description
-
getIcon
Description copied from interface:ISelectItemProvider
Returns item's encoded icon URL.- Specified by:
getIcon
in interfaceISelectItemProvider
- Returns:
- icon url
-
getLabel
Description copied from interface:ISelectItemProvider
Returns item's display name, typically used in the UI to diplay this item- Specified by:
getLabel
in interfaceISelectItemProvider
- Overrides:
getLabel
in classSelectItem
- Returns:
- item's label
-
getStyle
Description copied from interface:ISelectItemProvider
Returns item's inline CSS style.- Specified by:
getStyle
in interfaceISelectItemProvider
- Returns:
- items's CSS style
-
getValue
Description copied from interface:ISelectItemProvider
Returns item's value, used for data binding, typically a unique identifier.- Specified by:
getValue
in interfaceISelectItemProvider
- Overrides:
getValue
in classSelectItem
- Returns:
- item's value
-
isDisabled
public boolean isDisabled()Description copied from interface:ISelectItemProvider
Returns true if item is disabled.- Specified by:
isDisabled
in interfaceISelectItemProvider
- Overrides:
isDisabled
in classSelectItem
- Returns:
- disabled status
-
setObject
Sets source object to use- Parameters:
o
- source object
-
getObject
Returns currently set source object- Returns:
- null if not set
-
getDescriptionFieldName
Returns property name of the source object to use for select item description- Returns:
- property name of null if not set
-
setDescriptionFieldName
Sets property name on the source object to use for select item description- Parameters:
descriptionFieldName
- property name, can be null
-
getDisabledFieldName
Returns property name of the source object to use for select item disabled flag- Returns:
- property name of null if not set
-
setDisabledFieldName
Sets property name on the source object to use for select item disabled flag- Parameters:
disabledFieldName
- property name, can be null
-
getIconFieldName
Returns property name of the source object to use for select item icon- Returns:
- property name of null if not set
-
setIconFieldName
Sets property name on the source object to use for select item icon- Parameters:
iconFieldName
- property name, can be null
-
getLabelFieldName
Returns property name of the source object to use for select item label- Returns:
- property name of null if not set
-
setLabelFieldName
Sets property name on the source object to use for select item description- Parameters:
labelFieldName
- property name, can be null
-
getStyleFieldName
Returns property name of the source object to use for select item description- Returns:
- property name of null if not set
-
setStyleFieldName
Sets property name on the source object to use for select item style- Parameters:
styleFieldName
- property name, can be null
-
getValueFieldName
Returns property name of the source object to use for select item value- Returns:
- property name of null if not set
-
setValueFieldName
Sets property name on the source object to use for select item value- Parameters:
valueFieldName
- property name, can be null
-