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版本,则可以使用它

07-27 17:46