Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/370.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 如何修复';com.vaadin.DefaultWidgetSet';不包含com.vaadin.addon.charts.Chart的实现_Java_Spring_Vaadin_Vaadin7 - Fatal编程技术网

Java 如何修复';com.vaadin.DefaultWidgetSet';不包含com.vaadin.addon.charts.Chart的实现

Java 如何修复';com.vaadin.DefaultWidgetSet';不包含com.vaadin.addon.charts.Chart的实现,java,spring,vaadin,vaadin7,Java,Spring,Vaadin,Vaadin7,通过在Eclipse/STS中使用“SpringStater项目”,我能够快速启动并运行一个Vaadin项目。我想通过Vaadin插件将图表添加到项目中。我在谷歌上搜索,试图找到如何在项目中正确添加和使用Vaadin图表插件。但我很困惑,因为有太多的“指南/教程”,但很多不是针对spring boot的,或者它们已经过时或不完整 因此,我正在为Vaadin SpringBoot VaadinChart插件寻找完整的指南/教程 这就是我到目前为止所做的: --Pom文件-- <?xml ve

通过在Eclipse/STS中使用“SpringStater项目”,我能够快速启动并运行一个Vaadin项目。我想通过Vaadin插件将图表添加到项目中。我在谷歌上搜索,试图找到如何在项目中正确添加和使用Vaadin图表插件。但我很困惑,因为有太多的“指南/教程”,但很多不是针对spring boot的,或者它们已经过时或不完整

因此,我正在为Vaadin SpringBoot VaadinChart插件寻找完整的指南/教程

这就是我到目前为止所做的:

--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>
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文件,或者这可以通过注释来完成

一些网站说我需要“重新编译你的widgetset”,这意味着我需要在pom文件中添加一些插件

其他网站说,我需要一个web.xml,但要使用SpringBootVaadinVaadin应用程序,只需运行

当我运行代码时,我得到:

Widgetset'com.vaadin.DefaultWidgetSet'不包含com.vaadin.addon.charts.Chart的实现。检查其组件连接器的@Connect映射、widgetsets GWT模块描述文件,然后重新编译widgetset。如果您下载了vaadin附加程序包,您可能需要参考附加程序说明


该过程与所有附加组件的过程相同。对于简单的应用程序,您只需要核心小部件,并且可以使用“DefaultWidgetSet”。您需要在项目中使用“ApplicationWidgetset”,它将核心的基本客户端组件实现与项目中使用的所有附加组件结合起来

以下是使用TouchKit附加组件示例的说明,但过程基本相同:

  • 使用cdn.virit.in的简单选项:
    • 将插件添加到
    • 将生成的servlet过滤器添加到配置中
  • 标准溶液:
    • 将@Widgetset注释添加到

好的。。。我将添加另一个条目与我所做的,迄今为止,还没有工作。。。有趣的是,像你这样的评论会让人沮丧。谢谢!!!只是需要一个开始的地方。cdn.virit.in是我也在寻找的。。。配置更少,代码更少。非常感谢你!