FieldBinder
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.
Sample code
// 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);
Links
Compatibility
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.
Version
Version 2.0.0
- Migrated the add-on for Vaadin 14 (works probably also with 10-13)
- Released
- 2019-12-30
- Maturity
- BETA
- License
- Apache License 2.0
Compatibility
- Framework
- Vaadin 10+
- Vaadin 8.0+ in 0.2.0
- Browser
- Browser Independent