在this demo Sampler of the Grid
widget ,源代码选项卡显示调用名为 ComponentRenderer
的类的代码。
Map<CountryData, Double> countryRatings = new HashMap<>();
Grid<CountryData> countryGrid = new Grid<CountryData>(
"Rate your favorite Countries");
countryGrid.setItems(countries);
countryGrid.addColumn(country -> new Label(country.getFullName()),
new ComponentRenderer()).setCaption("Name");
countryGrid.addColumn(country -> {
RatingStars ratingStars = new RatingStars();
ratingStars.setMaxValue(5);
ratingStars.setValue(countryRatings.containsKey(country)
? countryRatings.get(country) : 0.0d);
ratingStars.addValueChangeListener(
event -> countryRatings.put(country, event.getValue()));
return ratingStars;
}, new ComponentRenderer()).setCaption("Rating");
我找不到 Vaadin 8.0.3 API JavaDoc 中列出的此类.那么这个演示代码中使用的是什么类?
最佳答案
这是 Vaadin 8.1 中即将推出的一项功能。目前,如果您从 https://vaadin.com/releases 查看 alpha 版本,就可以使用它。
关于java - Vaadin Sampler 中的 `ComponentRenderer` 是什么类?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42946180/