public class

ChoiceFormCell

extends FormCellMetadataLayout
implements FormCell<T> InlineValidation SupportsKey
java.lang.Object
   ↳ android.view.View
     ↳ android.view.ViewGroup
       ↳ android.widget.LinearLayout
         ↳ com.sap.cloud.mobile.fiori.formcell.FormCellMetadataLayout
           ↳ com.sap.cloud.mobile.fiori.formcell.ChoiceFormCell

Class Overview

A FormCell control which allows a user to view or select from a list of strings using Chips. Structure of the control :

  • TextView : showing the text to be displayed for label of the control See also : setKey(CharSequence)
  • Chips : showing a list of available strings. See also: setValueOptions(String[]) (CharSequence)}
  • The value property of the cell is equal to the selected tab index in the control. Currently two states of the control are available : normal, selected.

    Summary

    XML Attributes
    Attribute Name Related Method Description
    ChoiceFormCell_android_entries  
    ChoiceFormCell_cellChangeListener  
    ChoiceFormCell_isEditable  
    ChoiceFormCell_key  
    ChoiceFormCell_outlined  
    ChoiceFormCell_singleLine  
    ChoiceFormCell_value  
    [Expand]
    Inherited XML Attributes
    From class com.sap.cloud.mobile.fiori.formcell.FormCellMetadataLayout
    [Expand]
    Inherited Constants
    From class android.widget.LinearLayout
    From class android.view.ViewGroup
    From class android.view.View
    [Expand]
    Inherited Fields
    From class com.sap.cloud.mobile.fiori.formcell.FormCellMetadataLayout
    From class android.view.View
    Public Constructors
    ChoiceFormCell(Context context)
    Construct a new ChoiceFormCell with default styling, sets the CellType to WidgetType.CHOICE_CONTROL
    ChoiceFormCell(Context context, AttributeSet attrs)
    Construct a new ChoiceFormCell with default styling, overriding the attributes for the control as requested, sets the CellType to WidgetType.CHOICE_CONTROL
    Public Methods
    int getCellType()
    Return the enum value for ChoiceFormCell
    CellValueChangeListener<Integer> getCellValueChangeListener()
    Return the value change handler of the control
    CharSequence getError()
    Get the error
    TextView getErrorView()
    CharSequence getKey()
    Return the label of the property of control
    TextView getKeyLabel()
    Return the view holding the keyname string
    Integer getValue()
    Get the index of the selected value.
    String[] getValueOptions()
    Return the available string options for the tabLayout
    boolean isEditable()
    Returns if the control is enabled or not to modify values.
    boolean isOutlined()
    True when outlined chips are outlined.
    boolean isSingleLine()
    True when chips are displayed on a single line, that scrolls horizontally.
    void onRestoreInstanceState(Parcelable state)
    Parcelable onSaveInstanceState()
    void setAllowDeselect(boolean allowDeselect)
    allow or disallow user to deselect a selected choice
    void setCellValueChangeListener(CellValueChangeListener<Integer> listener)
    void setEditable(boolean isEditable)
    Set if the control is enabled or not to modify value of the control.
    void setError(CharSequence validationMessage)
    Set the error
    void setErrorEnabled(boolean errorEnabled)
    Enable or disable the error field on the view
    void setErrorTextAppearance(int textAppearance)
    Set the appearance of the error message
    void setHelperEnabled(boolean helperEnabled)
    Enable or disable the helper field on the view
    void setKey(CharSequence keyName)
    Set the label for property of the control
    void setKeyEnabled(boolean enabled)
    void setKeyTextAppearance(int resId)
    void setOutlined(boolean outlined)
    Indicate if chips should be outlined.
    void setSingleLine(boolean singleLine)
    When set to true, chips will be displayed on a single line that can scroll horizontally when the line is wider than the display.
    void setValue(Integer value)
    Set the index of the selected value.
    void setValueOptions(String[] valueOptions)
    Sets the string options for the tabLayout
    Protected Methods
    void adjustMargins()
    Calculate and set the margins for the cell's elements.
    void setLabelEnabled(boolean keyEnabled)
    Enable or disable the label field on the view
    boolean setupErrorHelperView()
    Setup the error/helper field on the view
    boolean setupLabelView()
    Setup the label view on the view
    [Expand]
    Inherited Methods
    From class com.sap.cloud.mobile.fiori.formcell.FormCellMetadataLayout
    From class android.widget.LinearLayout
    From class android.view.ViewGroup
    From class android.view.View
    From class java.lang.Object
    From interface android.graphics.drawable.Drawable.Callback
    From interface android.view.KeyEvent.Callback
    From interface android.view.ViewManager
    From interface android.view.ViewParent
    From interface android.view.accessibility.AccessibilityEventSource
    From interface com.sap.cloud.mobile.fiori.formcell.FormCell
    From interface com.sap.cloud.mobile.fiori.formcell.InlineValidation
    From interface com.sap.cloud.mobile.fiori.formcell.SupportsKey

    XML Attributes

    ChoiceFormCell_android_entries

    Related Methods

    ChoiceFormCell_cellChangeListener

    Related Methods

    ChoiceFormCell_isEditable

    Related Methods

    ChoiceFormCell_key

    Related Methods

    ChoiceFormCell_outlined

    Related Methods

    ChoiceFormCell_singleLine

    Related Methods

    ChoiceFormCell_value

    Related Methods

    Public Constructors

    public ChoiceFormCell (Context context)

    Construct a new ChoiceFormCell with default styling, sets the CellType to WidgetType.CHOICE_CONTROL

    Parameters
    context context

    public ChoiceFormCell (Context context, AttributeSet attrs)

    Construct a new ChoiceFormCell with default styling, overriding the attributes for the control as requested, sets the CellType to WidgetType.CHOICE_CONTROL

    Parameters
    context context
    attrs attribute set

    Public Methods

    public int getCellType ()

    Return the enum value for ChoiceFormCell

    Returns
    • WidgetType type of the control which has implemented FormCell

    public CellValueChangeListener<Integer> getCellValueChangeListener ()

    Return the value change handler of the control

    Returns
    • OnCellChangeListener - value change listener of the control

    public CharSequence getError ()

    Get the error

    Returns
    • Error message

    public TextView getErrorView ()

    public CharSequence getKey ()

    Return the label of the property of control

    Returns
    • CharSequence keyName

    public TextView getKeyLabel ()

    Return the view holding the keyname string

    Returns
    • TextView textview displaying keyname

    public Integer getValue ()

    Get the index of the selected value.

    Returns
    • the index of the selected value or -1 if no value selected.

    public String[] getValueOptions ()

    Return the available string options for the tabLayout

    Returns
    • String[] string values

    public boolean isEditable ()

    Returns if the control is enabled or not to modify values.

    Returns
    • Boolean user is allowed to modify the value of the control

    public boolean isOutlined ()

    True when outlined chips are outlined.

    Returns
    • true when outlined chips are outlined.

    public boolean isSingleLine ()

    True when chips are displayed on a single line, that scrolls horizontally. Otherwise, chips are displayed on multiple lines.

    Returns
    • true when chips are displayed on a single line, or false when chips are displayed on multiple lines.

    public void onRestoreInstanceState (Parcelable state)

    public Parcelable onSaveInstanceState ()

    public void setAllowDeselect (boolean allowDeselect)

    allow or disallow user to deselect a selected choice

    public void setCellValueChangeListener (CellValueChangeListener<Integer> listener)

    public void setEditable (boolean isEditable)

    Set if the control is enabled or not to modify value of the control. In readOnly mode, however, the text labels and text values will be selectable. By default, the control will be editable( user can modify value of the control)

    Parameters
    isEditable Boolean

    public void setError (CharSequence validationMessage)

    Set the error

    Parameters
    validationMessage error message

    public void setErrorEnabled (boolean errorEnabled)

    Enable or disable the error field on the view

    Parameters
    errorEnabled boolean

    public void setErrorTextAppearance (int textAppearance)

    Set the appearance of the error message

    Parameters
    textAppearance resource id

    public void setHelperEnabled (boolean helperEnabled)

    Enable or disable the helper field on the view

    Parameters
    helperEnabled boolean

    public void setKey (CharSequence keyName)

    Set the label for property of the control

    Parameters
    keyName label of the property

    public void setKeyEnabled (boolean enabled)

    public void setKeyTextAppearance (int resId)

    public void setOutlined (boolean outlined)

    Indicate if chips should be outlined.

    Parameters
    outlined true to outline chips, otherwise chips are not outlined.

    public void setSingleLine (boolean singleLine)

    When set to true, chips will be displayed on a single line that can scroll horizontally when the line is wider than the display. When set to false, chips will be displayed on multiple lines.

    Parameters
    singleLine true to display chips on a single line, false to display chips on multiple lines.

    public void setValue (Integer value)

    Set the index of the selected value.

    Resets the Cell if null or negative index is provided.

    Parameters
    value the index of the selected value.

    public void setValueOptions (String[] valueOptions)

    Sets the string options for the tabLayout

    Parameters
    valueOptions available string values

    Protected Methods

    protected void adjustMargins ()

    Calculate and set the margins for the cell's elements. Subclasses should override this method to suit their own needs.

    protected void setLabelEnabled (boolean keyEnabled)

    Enable or disable the label field on the view

    Parameters
    keyEnabled boolean

    protected boolean setupErrorHelperView ()

    Setup the error/helper field on the view

    Returns
    • boolean true: new view is created false:existing view is used

    protected boolean setupLabelView ()

    Setup the label view on the view

    Returns
    • boolean true: new view is created false:existing view is used