Example usage for com.vaadin.data Binder bind

List of usage examples for com.vaadin.data Binder bind

Introduction

In this page you can find the example usage for com.vaadin.data Binder bind.

Prototype

public <FIELDVALUE> Binding<BEAN, FIELDVALUE> bind(HasValue<FIELDVALUE> field,
        ValueProvider<BEAN, FIELDVALUE> getter, Setter<BEAN, FIELDVALUE> setter) 

Source Link

Document

Binds a field to a bean property represented by the given getter and setter pair.

Usage

From source file:uk.q3c.krail.testapp.view.AccountsView.java

License:Apache License

public void fake() {
    Binder<Person> binder = new Binder<>();

    TextField titleField = new TextField();

    // Start by defining the Field instance to use
    binder.forField(titleField)/*from   w  ww. j  av  a2  s  . c  o m*/
            // Finalize by doing the actual binding to the Person class
            .bind(
                    // Callback that loads the title from a person instance
                    Person::getTitle,
                    // Callback that saves the title in a person instance
                    Person::setTitle);

    TextField nameField = new TextField();

    // Shorthand for cases without extra configuration
    binder.bind(nameField, Person::getName, Person::setName);
}