Недавно я обновил версию Vaadin с 7 до 8.3.2. Одно из изменений, внесенных в более новую версию, заключается в том, что метод setContainerDataSource устарел. Поэтому я изменил свой код на:
List<Person> people = Arrays.asList(
new Person("Nicolaus Copernicus", 1543),
new Person("Galileo Galilei", 1564),
new Person("Johannes Kepler", 1571));
// Create a grid bound to the list
Grid<Person> grid = new Grid<>();
grid.setItems(people);
grid.addColumn(Person::getName).setCaption("Name");
grid.addColumn(Person::getBirthyear).setCaption("Year of birth");
Вот реализация класса Person:
public class Person implements Serializable {
public Person(String name, int birthyear) {
this.name = name;
this.birthyear = birthyear;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getBirthyear() {
return birthyear;
}
public void setBirthyear(int birthyear) {
this.birthyear = birthyear;
}
private String name;
private int birthyear;
}
Gird является частью HorizontalLayout, который находится в VerticalLayout. К сожалению, в браузере я вижу только границу таблицы - без значений в ней. Как же так? Я что-то упускаю?