Package com.smartgwt.client.widgets.form.validator

# Class CustomValidator

java.lang.Object
com.smartgwt.client.core.JsObject
com.smartgwt.client.core.DataClass
com.smartgwt.client.widgets.form.validator.Validator
com.smartgwt.client.widgets.form.validator.CustomValidator

All Implemented Interfaces:
  `HasHandlers`

public abstract class CustomValidator extends Validator

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `protected Integer`
  `colNum`
  `protected DataSourceField`
  `dataSourceField`
  `protected DynamicForm`
  `dynamicForm`
  `protected FormItem`
  `formItem`
  `protected ListGrid`
  `listGrid`
  `protected ListGridField`
  `listGridField`
  `protected Record`
  `record`
  `protected Object`
  `resultingValue`
  `protected Integer`
  `rowNum`
  `protected Map`
  `validatorProperties`

  ### Fields inherited from class com.smartgwt.client.core.DataClass

  `factoryCreated, factoryProperties`

  ### Fields inherited from class com.smartgwt.client.core.JsObject

  `jsObj`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `CustomValidator()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `protected abstract boolean`
  `condition(Object value)`
  Add custom validation logic by overriding this method.
  `Integer`
  `getColNum()`
  The column number of the cell currently being validated, if the component being validated is a ListGrid.
  `DataSourceField`
  `getDataSourceField()`
  DataSourceField on which this validator was declared.
  `DynamicForm`
  `getDynamicForm()`
  DynamicForm currently being validated.
  `FormItem`
  `getFormItem()`
  FormItem on which this validator was declared.
  `ListGrid`
  `getListGrid()`
  ListGrid currently being validated.
  `ListGridField`
  `getListGridField()`
  ListGridField on which this validator was declared.
  `Record`
  `getRecord()`
  `Integer`
  `getRowNum()`
  The row number of the cell currently being validated, if the component being validated is a ListGrid.
  `Map`
  `getValidatorProperties()`
  Return the properties of validator that is defined on the DataSourceField.
  `protected void`
  `setResultingValue(Object resultingValue)`
  To transform the incoming value that is validated into a different value or format set this property from Validator.condition() to the desired value.

  ### Methods inherited from class com.smartgwt.client.widgets.form.validator.Validator

  `addValidatorDefinition, create, getApplyWhen, getCheckComponentData, getClientOnly, getCondition, getDependentFields, getOrCreateRef, getPrecision, getRoundToPrecision, getStopIfFalse, getStopOnError, getType, getTypeAsString, getValidateOnChange, setApplyWhen, setCheckComponentData, setClientOnly, setCondition, setDependentFields, setErrorMessage, setPrecision, setRoundToPrecision, setStopIfFalse, setStopOnError, setType, setType, setValidateOnChange`

  ### Methods inherited from class com.smartgwt.client.core.DataClass

  `applyFactoryProperties, doAddHandler, fireEvent, getAttribute, getAttributeAsBoolean, getAttributeAsBoolean, getAttributeAsDate, getAttributeAsDouble, getAttributeAsDoubleArray, getAttributeAsElement, getAttributeAsFloat, getAttributeAsInt, getAttributeAsIntArray, getAttributeAsJavaScriptObject, getAttributeAsLong, getAttributeAsMap, getAttributeAsObject, getAttributeAsRecord, getAttributeAsString, getAttributeAsStringArray, getAttributes, getHandlerCount, isFactoryCreated, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttributeAsJavaObject, setFactoryCreated`

  ### Methods inherited from class com.smartgwt.client.core.JsObject

  `equals, getJsObj, hashCode, isCreated, setJavaScriptObject, setJsObj`

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

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

- ## Field Details

  - ### formItem

    protected FormItem formItem

  - ### dataSourceField

    protected DataSourceField dataSourceField

  - ### listGridField

    protected ListGridField listGridField

  - ### record

    protected Record record

  - ### validatorProperties

    protected Map validatorProperties

  - ### resultingValue

    protected Object resultingValue

  - ### dynamicForm

    protected DynamicForm dynamicForm

  - ### listGrid

    protected ListGrid listGrid

  - ### rowNum

    protected Integer rowNum

  - ### colNum

    protected Integer colNum

- ## Constructor Details

  - ### CustomValidator

    public CustomValidator()

- ## Method Details

  - ### condition

    protected abstract boolean condition(Object value)
    Add custom validation logic by overriding this method. Access to the FormItem, ListGridField or DataSourceField on which the validator was declared can be obtained by the `getFormItem()`, `getListGridField()` and `getDataSourceField()` methods respectively. The field values for the record being validated can be obtained by calling `getRecord()`. The component being validated can be obtained by calling `getListGrid()` or `getDynamicForm()`. If the component being validated is a ListGrid, the row and column numbers identifying the cell being validated are accessible with the `getRowNum()` and `getColNum()` methods.
    Parameters:
      `value` - value to validate
    Returns:
      true if valid

  - ### getFormItem

    public FormItem getFormItem()
    FormItem on which this validator was declared. May be null if the item is a ListGridField or DataSourceField, in which case `getListGridField()` or `getDataSourceField()` should be called. NOTE: FormItem will not be available during a save performed without a form (eg programmatic save) or if the field.
    Returns:
      FormItem on which this validator was declared.

  - ### getListGridField

    public ListGridField getListGridField()
    ListGridField on which this validator was declared. May be null if the item is a FormItem or DataSourceField, in which case `getFormItem()` or `getDataSourceField()` should be called.
    Returns:
      ListGridField on which this validator was declared.

  - ### getDataSourceField

    public DataSourceField getDataSourceField()
    DataSourceField on which this validator was declared. May be null if the item is a FormItem or ListGridField, in which case `getFormItem()` or `getListGridField()` should be called.
    Returns:
      DataSourceField on which this validator was declared.

  - ### getListGrid

    public ListGrid getListGrid()
    ListGrid currently being validated. May be null if the component being validated is a DynamicForm, in which case `getDynamicForm()` should be called.
    Returns:
      ListGrid currently being validated

  - ### getDynamicForm

    public DynamicForm getDynamicForm()
    DynamicForm currently being validated. May be null if the component being validated is a ListGrid, in which case `getListGrid()` should be called.
    Returns:
      DynamicForm currently being validated

  - ### getRowNum

    public Integer getRowNum()
    The row number of the cell currently being validated, if the component being validated is a ListGrid. If the component being validated is a DynamicForm, this will be null
    Returns:
      the row number of the cell currently being validated, or null if the component is not a ListGrid

  - ### getColNum

    public Integer getColNum()
    The column number of the cell currently being validated, if the component being validated is a ListGrid. If the component being validated is a DynamicForm, this will be null
    Returns:
      the column number of the cell currently being validated, or null if the component is not a ListGrid

  - ### getValidatorProperties

    public Map getValidatorProperties()
    Return the properties of validator that is defined on the DataSourceField.
    Returns:
      the validator properties

  - ### setResultingValue

    protected void setResultingValue(Object resultingValue)
    To transform the incoming value that is validated into a different value or format set this property from Validator.condition() to the desired value.
    Parameters:
      `resultingValue` - the resulting value

  - ### getRecord

    public Record getRecord()
    Returns:
      field values for record being validated