Class ELSelectItemProvider

java.lang.Object
javax.faces.model.SelectItem
com.webmethods.caf.faces.data.object.ELSelectItemProvider
All Implemented Interfaces:
ISelectItemProvider, Serializable

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
 
See Also:
  • Field Details

    • m_o

      protected Object m_o
    • m_labelFieldName

      protected String m_labelFieldName
    • m_valueFieldName

      protected String m_valueFieldName
    • m_descriptionFieldName

      protected String m_descriptionFieldName
    • m_disabledFieldName

      protected String m_disabledFieldName
    • m_styleFieldName

      protected String m_styleFieldName
    • m_iconFieldName

      protected String m_iconFieldName
  • Constructor Details

    • ELSelectItemProvider

      public ELSelectItemProvider()
      Default constructor. setObject(Object) must be called before use.
    • ELSelectItemProvider

      public ELSelectItemProvider(Object o, String labelFieldName, String valueFieldName)
      Initializes provider with the given object to use as a source and label and value properties.
      Parameters:
      o - source object
      labelFieldName - name of the property to use to get the label for the select item
      valueFieldName - 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 object
      labelFieldName - name of the property to use to get the label for the select item
      valueFieldName - name of the property to use to get the value for the select item
      descriptionFieldName - 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
  • Method Details

    • getDescription

      public String getDescription()
      Description copied from interface: ISelectItemProvider
      Returns item's extended description, typically used in the UI as a tooltip
      Specified by:
      getDescription in interface ISelectItemProvider
      Overrides:
      getDescription in class SelectItem
      Returns:
      item's description
    • getIcon

      public String getIcon()
      Description copied from interface: ISelectItemProvider
      Returns item's encoded icon URL.
      Specified by:
      getIcon in interface ISelectItemProvider
      Returns:
      icon url
    • getLabel

      public String getLabel()
      Description copied from interface: ISelectItemProvider
      Returns item's display name, typically used in the UI to diplay this item
      Specified by:
      getLabel in interface ISelectItemProvider
      Overrides:
      getLabel in class SelectItem
      Returns:
      item's label
    • getStyle

      public String getStyle()
      Description copied from interface: ISelectItemProvider
      Returns item's inline CSS style.
      Specified by:
      getStyle in interface ISelectItemProvider
      Returns:
      items's CSS style
    • getValue

      public Object getValue()
      Description copied from interface: ISelectItemProvider
      Returns item's value, used for data binding, typically a unique identifier.
      Specified by:
      getValue in interface ISelectItemProvider
      Overrides:
      getValue in class SelectItem
      Returns:
      item's value
    • isDisabled

      public boolean isDisabled()
      Description copied from interface: ISelectItemProvider
      Returns true if item is disabled.
      Specified by:
      isDisabled in interface ISelectItemProvider
      Overrides:
      isDisabled in class SelectItem
      Returns:
      disabled status
    • setObject

      public void setObject(Object o)
      Sets source object to use
      Parameters:
      o - source object
    • getObject

      public Object getObject()
      Returns currently set source object
      Returns:
      null if not set
    • getDescriptionFieldName

      public String getDescriptionFieldName()
      Returns property name of the source object to use for select item description
      Returns:
      property name of null if not set
    • setDescriptionFieldName

      public void setDescriptionFieldName(String descriptionFieldName)
      Sets property name on the source object to use for select item description
      Parameters:
      descriptionFieldName - property name, can be null
    • getDisabledFieldName

      public String getDisabledFieldName()
      Returns property name of the source object to use for select item disabled flag
      Returns:
      property name of null if not set
    • setDisabledFieldName

      public void setDisabledFieldName(String disabledFieldName)
      Sets property name on the source object to use for select item disabled flag
      Parameters:
      disabledFieldName - property name, can be null
    • getIconFieldName

      public String getIconFieldName()
      Returns property name of the source object to use for select item icon
      Returns:
      property name of null if not set
    • setIconFieldName

      public void setIconFieldName(String iconFieldName)
      Sets property name on the source object to use for select item icon
      Parameters:
      iconFieldName - property name, can be null
    • getLabelFieldName

      public String getLabelFieldName()
      Returns property name of the source object to use for select item label
      Returns:
      property name of null if not set
    • setLabelFieldName

      public void setLabelFieldName(String labelFieldName)
      Sets property name on the source object to use for select item description
      Parameters:
      labelFieldName - property name, can be null
    • getStyleFieldName

      public String getStyleFieldName()
      Returns property name of the source object to use for select item description
      Returns:
      property name of null if not set
    • setStyleFieldName

      public void setStyleFieldName(String styleFieldName)
      Sets property name on the source object to use for select item style
      Parameters:
      styleFieldName - property name, can be null
    • getValueFieldName

      public String getValueFieldName()
      Returns property name of the source object to use for select item value
      Returns:
      property name of null if not set
    • setValueFieldName

      public void setValueFieldName(String valueFieldName)
      Sets property name on the source object to use for select item value
      Parameters:
      valueFieldName - property name, can be null