Package com.smartgwt.client.data

# Class SimpleType.SimpleTypeValueExtractor

java.lang.Object
com.smartgwt.client.data.SimpleType.SimpleTypeValueExtractor

Enclosing class:
  SimpleType

public abstract static class SimpleType.SimpleTypeValueExtractor extends Object

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `SimpleTypeValueExtractor()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `abstract Object`
  `getAtomicValue(Object value)`
  Method to extract an atomic value (such as a string or number) from some arbitrary live data value.
  `Object`
  `getAtomicValue(Object value, String reason)`
  Method to extract an atomic value (such as a string or number) from some arbitrary live data value.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### SimpleTypeValueExtractor

    public SimpleTypeValueExtractor()

- ## Method Details

  - ### getAtomicValue

    public abstract Object getAtomicValue(Object value)
    Method to extract an atomic value (such as a string or number) from some arbitrary live data value. This method will be called for every field value of the specified type in order to convert from the raw data value to an atomic type to be used for standard DataBinding features such as sorting and editing.
    Parameters:
      `value` - Raw data value to convert. Typically this would be a field value for some record.
    Returns:
      Atomic value. This should match the underlying atomic type specified by the `#inheritsFrom` attribute.

  - ### getAtomicValue

    public Object getAtomicValue(Object value, String reason)
    Method to extract an atomic value (such as a string or number) from some arbitrary live data value. This method will be called for every field value of the specified type in order to convert from the raw data value to an atomic type to be used for standard DataBinding features such as sorting and editing. Note, you only need to override this method if you have a need for the additional context provided by the "reason" attribute. The default implementation just ignores the reason and calls the single-param version of getAtomicValue().

    Your method can use the "reason" parameter to affect the atomic value that is returned. - for example, if the reason is "sort" you could return the atomic value converted to upper-case, to impose case-insensitive sorting. Reason strings used by the system are:

    - "edit" Retrieving the edit value of the field in a +link{class:DynamicForm} or +link{class:ListGrid}/li>
    - "format" Retrieving the value to format it for display/li>
    - "filter" Retrieving the value for use in a filter comparison/li>
    - "sort" Retrieving the value for use in a sort comparison/li>
    - "group" Retrieving the value for use in a group comparison/li>
    - "formula" Retrieving the value for use in a formula calculation/li>
    - "vm_getValue" Retrieving the value from +link{valuesManager.getValue()}/li>
    - "validate" Retrieving the value for validation, or setting the value if validation caused it to change/li>
    - "compare" Retrieving the "old" or "new" value from +link{ListGrid.cellHasChanges()}/li>
    - "getRawValue" Retrieving the raw value of a +link{class:ListGrid} cell/li>
    - "criteria" Setting the value from +link{DynamicForm.setValuesAsCriteria()}/li>
    - "updateValue" Setting the value from internal methods of +link{class:DynamicForm} or +link{class:ValuesManager} /li>
    - "setRawValue" Setting the raw value of a +link{class:ListGrid} cell/li>
    - "saveLocally" Setting the value from +link{ListGrid.saveLocally()}
    Parameters:
      `value` - Raw data value to convert. Typically this would be a field value for some record.
      `reason` - A reason passed by the framework to indicate why it is asking for the atomic value.
    Returns:
      Atomic value. This should match the underlying atomic type specified by the `#inheritsFrom` attribute.