Grid with editor: how to cancel saving bean in addSaveListener

Hi,
we use Vaadin 8.3.3, in Grid we have left editing enabled.


final Editor editor = grid.getEditor().setEnabled(true);
final Binder editorBinder = editor.getBinder();
editor.addSaveListener(listener -> {
	T current = listener.getBean();
	
	if (current.getValue() == null)
		//TODO NOT SAVE
	else
		editor.save();
}

I would if the bean is not valid, don’t save bean. But it is possible? if yes, how?
Thanks

Sara

The first choice is to set Validators with Binder for the fields. See chapter “validation” here:

https://vaadin.com/docs/v8/framework/datamodel/datamodel-forms.html

Thanks for help.
Yes, i have create a validator for any field of T.


editorBinder.forField(textField1).withValidator((s, ctx)->{
if (StringUtils.isNotBlank(s))
	return ValidationResult.ok();
return ValidationResult.error("error");
}).bind("field1");
editorBinder.forField(textField2).withValidator((s, ctx)->{
if (StringUtils.isNotBlank(s))
	return ValidationResult.ok();
return ValidationResult.error("error");
}).bind("field2");

But any validator check the value of field of T, but it’s impossible validate T.