I have class
public class Person implements Serializable {
private String name;
private Date birthDay;
private int years;
public gridRecord (String name, Date birthDay, int years){
this.name = name;
this.birthDay = birthDay;
this. years = years;
}
public int getYears() { return years; }
public void setYears(int years) { this.years = years; }
public Date getBirthDay () { return birthDay; }
public void setBirthDay(Date day) { this.birthDay = day; }
public String getName () { return name; }
public void setName(String name) { this.name = name; }
}
So, I try make grid with in row editors:
DateField dateField = new DateField();
TextField yearsField = new TextField();
TextField nameField = new TextField();
Grid<Person> grid = new Grid<>();
grid.setSelectionMode(SelectionMode.SINGLE);
grid.addColumn(Person::getBirthDay, new DateRenderer()).setCaption("Date")
.setEditorComponent(dateField, Person::setBirthDay); <---- here compile error
grid.addColumn(Person::getYears, new TextRenderer()).setCaption("Years")
.setEditorComponent(yearsField, Person::setYears); <---- here compile error
grid.addColumn(Person::getName, new TextRenderer())
.setEditorComponent(nameField, Person::setName); <---- here no error
The errors for field “Date” is "The method setEditorComponent(C, Setter<Person,Date>) in the type Grid.Column<Person,Date> is not applicable for the arguments (DateField, Setter<Person,Date>) , same error for field “Years”
The question is: How make in row editor for types other than string (ex. for date, integer)?