Hi
I am new to vaadin so I can’t understand how to fix this issue. I got this error (There are no instance fields found for automatic binding) in line: binder.bindInstanceFields(this)
class:InfoView
public class InfoView extends Div implements AfterNavigationObserver {
@Autowired
private RecordService recordService;
private Grid<Record> grid;
//private TextField id = new TextField();
private TextField txtFirstname = new TextField();
private TextField txtLastname = new TextField();
//private TextField email = new TextField();
//private PasswordField password = new PasswordField();
private Button cancel = new Button("άκυρο");
private Button save = new Button("αποθήκευση");
private Button delete = new Button("διαγραφή");
private Binder<Record> binder;
public InfoView() {
setId("master-detail-view");
// Configure Grid
grid = new Grid<>();
grid.addThemeVariants(GridVariant.LUMO_NO_BORDER);
grid.setHeightFull();
grid.addColumn(Record::getId).setHeader("id");
grid.addColumn(Record::getFirstName).setHeader("txtFirstname");
grid.addColumn(Record::getLastName).setHeader("txtLastname");
//when a row is selected or deselected, populate form
grid.asSingleSelect().addValueChangeListener(event -> populateForm(event.getValue()));
// Configure Form
binder = new Binder<>(Record.class);
// Bind fields. This where you'd define e.g. validation rules
binder.bindInstanceFields(this);
// note that password field isn't bound since that property doesn't exist in
// Employee
binder.setBean(new Record());
Record class:
package com.tool.jdbc;
public class Record {
Field[] listFields;
private Long id;
private String firstName, lastName;
public Record(Long id, String firstName, String lastName) {
this.id = id;
this.firstName = firstName;
this.lastName = lastName;
}
public Long getId() {
return id;
}
public String getFirstName() {
return firstName;
}
public String getLastName() {
return lastName;
}
public void setId(Long id) {
this.id = id;
}
public void setFirstName(String firstName) {
this.firstName=firstName;
}
public void setLastName(String lastName) {
this.lastName=lastName;
}
public Record()
{
}
}
Thank you in advance
Nick