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
-
Field Summary
Modifier and TypeFieldDescriptionprotected Integer
protected DataSourceField
protected DynamicForm
protected FormItem
protected ListGrid
protected ListGridField
protected Record
protected Object
protected Integer
protected Map
Fields inherited from class com.smartgwt.client.core.DataClass
factoryCreated, factoryProperties
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected abstract boolean
Add custom validation logic by overriding this method.The column number of the cell currently being validated, if the component being validated is a ListGrid.DataSourceField on which this validator was declared.DynamicForm currently being validated.FormItem on which this validator was declared.ListGrid currently being validated.ListGridField on which this validator was declared.The row number of the cell currently being validated, if the component being validated is a ListGrid.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, getStopIfFalse, getStopOnError, getType, getTypeAsString, getValidateOnChange, setApplyWhen, setCheckComponentData, setClientOnly, setCondition, setDependentFields, setErrorMessage, 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
-
Field Details
-
formItem
-
dataSourceField
-
listGridField
-
record
-
validatorProperties
-
resultingValue
-
dynamicForm
-
listGrid
-
rowNum
-
colNum
-
-
Constructor Details
-
CustomValidator
public CustomValidator()
-
-
Method Details
-
condition
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 thegetFormItem()
,getListGridField()
andgetDataSourceField()
methods respectively. The field values for the record being validated can be obtained by callinggetRecord()
. The component being validated can be obtained by callinggetListGrid()
orgetDynamicForm()
. If the component being validated is a ListGrid, the row and column numbers identifying the cell being validated are accessible with thegetRowNum()
andgetColNum()
methods.- Parameters:
value
- value to validate- Returns:
- true if valid
-
getFormItem
FormItem on which this validator was declared. May be null if the item is a ListGridField or DataSourceField, in which casegetListGridField()
orgetDataSourceField()
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
ListGridField on which this validator was declared. May be null if the item is a FormItem or DataSourceField, in which casegetFormItem()
orgetDataSourceField()
should be called.- Returns:
- ListGridField on which this validator was declared.
-
getDataSourceField
DataSourceField on which this validator was declared. May be null if the item is a FormItem or ListGridField, in which casegetFormItem()
orgetListGridField()
should be called.- Returns:
- DataSourceField on which this validator was declared.
-
getListGrid
ListGrid currently being validated. May be null if the component being validated is a DynamicForm, in which casegetDynamicForm()
should be called.- Returns:
- ListGrid currently being validated
-
getDynamicForm
DynamicForm currently being validated. May be null if the component being validated is a ListGrid, in which casegetListGrid()
should be called.- Returns:
- DynamicForm currently being validated
-
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
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
Return the properties of validator that is defined on the DataSourceField.- Returns:
- the validator properties
-
setResultingValue
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
- Returns:
- field values for record being validated
-