FieldBinder is a single field binding buffer, a little sibling to Binder with similar API
FieldBinder Add-on for Vaadin 8 & 10+
FieldBinder is a little sibling of Binder for special case of single field bindings. FieldBinder enables to use same Converters, Validators and similar API to Binder with single field binding.
FieldBinder connects one Field component with value with one direction binding.
A binder is a binding, representing the mapping of a single field, through converters and validators, and acts as a buffer for bound value.
A binder instance can be bound to a single value and field instance at a time, but can be rebound as needed.
This add-on does not have client side implementation, widgetset compilation is not needed.
// Binder with integer FieldBinder<Integer> integerFieldBinder = new FieldBinder<>(); TextField integerField = new TextField("Input number"); // Text field with Integer value Converter and Validator // Demoing how to detect if value is valid and how to get it from FieldBinding FieldBinding<Integer> integerBinding = integerFieldBinder.forField(integerField) .withConverter(new StringToIntegerConverter("This is not a number")) .withValidator(new IntegerRangeValidator("Give a number between 5 and 10",5,10)) .bind(integerValue);
Was this helpful? Need more help?
Leave a comment or a question below. You can also join the chat on Discord or ask questions on StackOverflow.
- Migrated the add-on for Vaadin 14 (works probably also with 10-13)
- Apache License 2.0
- Vaadin 10+
- Vaadin 8.0+ in 0.2.0
- Browser Independent