I am using Vaadin 8.1 with SpringBoot 1.4.2
class Person
{
private Date startDate;
private String name;
public Date getStartDate() {return startDate;}
public void setStartDate(Date dt){startDate=dt;}
public String getName(){return name;}
public void setName(String s){name = s;}
}
public class TestUI extends UI
{
@Override
protected void init(VaadinRequest request) {
VerticalLayout vl = new VerticalLayout();
DateField txtStartDate = new DateField(label);
txtStartDate.setPlaceholder(“mm/dd/yyyy”);
txtStartDate.setDateFormat(“mm/dd/yyyy”);
vl.addComponent(txtStartDate);
TextField nameField = new TextField(“Name:”);
vl.addComponent(nameField);
setContent(vl);
Binder<Person> personBinder = new Binder<>();
personBinder .bind(nameField ,Person::getName,Person::setName);
personBinder .forField(txtStartDate)
.withNullRepresentation(null)
.withConverter(new LocalDateToDateConverter())
.bind(Person::getStartDate,Person::setStartDate);
personBinder.addStatusChangeListener(event -> {
if(event.getBinder().isValid()
&& event.getBinder().hasChanges())
Notification.show("Data was changed!");
});
}
}
After I change the start date, the change event was not fired.
Did I do something wrong? or using wrong event listener?
Thank you in advance!