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
public abstract class CustomValidator
- extends Validator
| Fields inherited from class com.smartgwt.client.core.JsObject |
jsObj |
| Methods inherited from class com.smartgwt.client.widgets.form.validator.Validator |
addValidatorDefinition, convertToValidatorArray, getClientOnly, getDependentFields, getOrCreateRef, getStopIfFalse, getStopOnError, getType, getTypeAsString, getValidateOnChange, setClientOnly, setDependentFields, setErrorMessage, setStopIfFalse, setStopOnError, setType, setType, setValidateOnChange |
| Methods inherited from class com.smartgwt.client.core.DataClass |
doAddHandler, fireEvent, getAttribute, getAttributeAsBoolean, getAttributeAsDate, getAttributeAsDouble, getAttributeAsDoubleArray, getAttributeAsFloat, getAttributeAsInt, getAttributeAsIntArray, getAttributeAsJavaScriptObject, getAttributeAsLong, getAttributeAsMap, getAttributeAsObject, getAttributeAsRecord, getAttributeAsString, getAttributeAsStringArray, getAttributes, getHandlerCount, getJsObj, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
formItem
protected FormItem formItem
dataSourceField
protected DataSourceField dataSourceField
record
protected Record record
validatorProperties
protected Map validatorProperties
resultingValue
protected Object resultingValue
CustomValidator
public CustomValidator()
condition
protected abstract boolean condition(Object value)
- Add custom validation logic by overriding this method. Access to the FormItem or DataSourceField on which the validator was
declared can be obtained by the
getFormItem() and getDataSourceField() methods respectively and the field values for
record being validated can be obtained by calling getRecord().
- 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 DataSourceField in which case
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.
getDataSourceField
public DataSourceField getDataSourceField()
- DataSourceField on which this validator was declared. May be null if the item is a FormItem in which case
getFormItem() should be called.
- Returns:
- DataSourceField on which this validator was declared.
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