One solution could be to provide published API on DataSourceField (accessible through CustomValidator.dataSourceField) for retrieval of validator definitions bound to the field. This however would be cumbersome to use in custom validators because of the need to search for the correct definition and the problems in case that there are multiple validator definitions of the same type on the field.
Another solution could be to expose to Java code in CustomValidator one more field which points directly to the validator definition appropriate for the specific invocation of condition() and is available in the JavaScript call under the name "validator". This can be done e.g. through a Java field "protected DataClass dataSourceValidator". This field will be further managed in setup() and reset() in a fashion similar to the other already existing fields. Specifically initialization would be :
Code:
if(validator !=null) {
self.@com.smartgwt.client.widgets.form.validator.Custom Validator::dataSourceValidator = @com.smartgwt.client.core.DataClass::new(Lcom/google/gwt/core/client/JavaScriptObject;)(validator);
}
else {
self.@com.smartgwt.client.widgets.form.validator.Custom Validator:dataSourceValidator = @com.smartgwt.client.core.DataClass::new()();
}
It is probably clear from the above that I suggest adoption of the second solution and would be glad if Isomorphic adopts it.