Как исправить «com.vaadin.DefaultWidgetSet» не содержит реализацию для com.vaadin.addon.charts.Chart
Используя «Spring Stater Project» в Eclipse / STS, я смог быстро запустить и запустить проект Vaadin. Я хочу добавить графики через Vaadin-Addon в проект. У меня есть Google, пытающийся найти, как правильно добавить и использовать Vaadin Chart addon для проекта. Но я запутался, потому что там так много «Руководств / Учебников», но многие из них не для весенней загрузки, или они устарели или частично.
Поэтому я ищу полное руководство / учебное пособие для Vaadin-SpringBoot-VaadinChart-AddOn.
Это то, что я до сих пор:
---- POM файл ----
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.aci</groupId>
<artifactId>oversight2</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>oversight2</name>
<description>Oversite</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.2.5.RELEASE</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>1.8</java.version>
</properties>
<dependencies>
<!-- <dependency> -->
<!-- <groupId>com.vaadin</groupId> -->
<!-- <artifactId>vaadin-spring-boot</artifactId> -->
<!-- <version>1.0.0</version> -->
<!-- </dependency> -->
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-spring-boot-starter</artifactId>
<version>1.0.0.beta3</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.vaadin.addon</groupId>
<version>2.0.0</version>
<artifactId>vaadin-charts</artifactId>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-bom</artifactId>
<version>7.4.5</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>vaadin-addons</id>
<url>http://maven.vaadin.com/vaadin-addons</url>
</repository>
</repositories>
</project>
---- код Java ----
public class BasicBarChart extends AbstractVaadinChartExample {
@Override
public String getDescription() {
return "Basic bar";
}
@Override
protected Component getChart() {
Chart chart = new Chart(ChartType.BAR);
Configuration conf = chart.getConfiguration();
conf.setTitle("Historic World Population by Region");
conf.setSubTitle("Source: Wikipedia.org");
XAxis x = new XAxis();
x.setCategories("Africa", "America", "Asia", "Europe", "Oceania");
x.setTitle((String) null);
conf.addxAxis(x);
YAxis y = new YAxis();
y.setMin(0);
Title title = new Title("Population (millions)");
title.setVerticalAlign(VerticalAlign.HIGH);
y.setTitle(title);
conf.addyAxis(y);
Tooltip tooltip = new Tooltip();
tooltip.setFormatter("this.series.name +': '+ this.y +' millions'");
conf.setTooltip(tooltip);
PlotOptionsBar plot = new PlotOptionsBar();
plot.setDataLabels(new Labels(true));
conf.setPlotOptions(plot);
Legend legend = new Legend();
legend.setLayout(LayoutDirection.VERTICAL);
legend.setHorizontalAlign(HorizontalAlign.RIGHT);
legend.setVerticalAlign(VerticalAlign.TOP);
legend.setX(-100);
legend.setY(100);
legend.setFloating(true);
legend.setBorderWidth(1);
legend.setBackgroundColor("#FFFFFF");
legend.setShadow(true);
conf.setLegend(legend);
conf.disableCredits();
List series = new ArrayList();
series.add(new ListSeries("Year 1800", 107, 31, 635, 203, 2));
series.add(new ListSeries("Year 1900", 133, 156, 947, 408, 6));
series.add(new ListSeries("Year 2008", 973, 914, 4054, 732, 34));
conf.setSeries(series);
chart.drawChart(conf);
return chart;
}
}
@SpringUI
@VaadinServletConfiguration(productionMode = false, ui = MyVaadinUI.class)
public class MyVaadinUI extends UI {
@Override
protected void init(VaadinRequest vaadinRequest) {
setContent(new BasicBarChart());
}
}
Я создал 30-дневный лицензионный ключ AGPL
Есть сайты, которые говорят, что мне нужен файл gwt.xml, или это можно сделать с помощью аннотаций
Некоторые сайты говорят, что мне нужно «перекомпилировать ваш набор виджетов», что означает, что мне нужно добавить плагин в мой файл pom.
Другие сайты говорят, что мне нужен web.xml, но с приложением spring-boot-vaadin Vaadin просто запускается.
Когда я запускаю код, я получаю:
Widgetset 'com.vaadin.DefaultWidgetSet' не содержит реализацию для com.vaadin.addon.charts.Chart. Проверьте отображение @Connect его коннектора компонента, файл описания модуля GWT наборов виджетов и пересоберите ваш набор виджетов. Если вы скачали пакет дополнений vaadin, вы можете обратиться к инструкциям по дополнению.