我正在尝试使用 Vaadin 构建一个应用程序。我注意到 vaadin 8 中未包含日历组件。 是否可以在 Vaadin 8 中使用 Vaadin 7 中的日历?
最佳答案
长版
根据 v8 release notes (目前8.0.5)有几个legacy components (包括日历)尚未移植到 v8,但包含在单独的包中。 migration section简要描述兼容性依赖项包含的内容:
Migrating to Vaadin Framework 8.0
Vaadin Framework 7 applications need some changes when migrating to Vaadin Framework 8. In addition to updating dependencies, all references to Framework 7 style data binding and components using it need to be updated either to use new Framework 8 style data binding or to use the compatibility versions in separate packages.
Vaadin Framework 7 compatible versions of the old data binding API and components (with the exception of Form) are available in the package com.vaadin.v7 in modules vaadin-compatibility-server, vaadin-compatibility-shared etc. that can be used instead of vaadin-server, vaadin-shared etc. The package vaadin-compatibility-client-compiled contains the widgetset com.vaadin.v7.Vaadin7WidgetSet which can be used instead of DefaultWidgetSet. Note that the widgetset compilation for Vaadin7WidgetSet compilation requires at least 1G of memory. To ensure this, add -Xmx1G to the vaadin-maven-plugin configuration in your pom.xml file.
All applications using either Reindeer, Runo, Chameleon or Base theme must include the vaadin-compability-themes package.
Some Vaadin Framework 7 add-ons do not work in version 8 - please check the add-ons in Vaadin Directory for Framework version 8 support
此外,来自migration Vaadin 文档中有关软件包的部分:
Updating Maven Dependencies
For maven based projects including compatibility packages is simply a matter of changing the artifactId of the desired non-compatibility dependency to the compatibility variant. For example in the case of changing the vaadin-server dependency from Framework version 7.7.6 to 8.0.0 would require changing
<dependency> <groupId>com.vaadin</groupId> <artifactId>vaadin-server</artifactId> <version>7.7.6</version> </dependency>
to either
<dependency> <groupId>com.vaadin</groupId> <artifactId>vaadin-compatibility-server</artifactId> <version>8.0.0</version> </dependency>
for including both compatibility features as well as non-compatibility ones, or alternatively
<dependency> <groupId>com.vaadin</groupId> <artifactId>vaadin-server</artifactId> <version>8.0.0</version> </dependency>
to only include Framework 8 features. The full list of compatibility packages available for Framework 8 are the following:
- vaadin-compatibility-server
- vaadin-compatibility-client
- vaadin-compatibility-client-compiled
- vaadin-compatibility-shared
- vaadin-compatibility-themes
...以及widgetset :
<小时/>Widgetset Changes
When using compatibility packages in your project you need to changes references from the default vaadin client side widgetset com.vaadin.DefaultWidgetSet to the one containing the compatibility packages com.vaadin.v7.Vaadin7WidgetSet, which is available in the vaadin-compatibility-client-compiled maven dependency. Typically, widgetset recompilation will handle this automatically for you, except for the following two cases which should be handled manually:
Your project defines a custom widgetset, in which case you need to make sure Vaadin7WidgetSet is inherited
An UI in your project defines its widgetset with the annotation
@Widgetset("com.vaadin.DefaultWidgetSet")
, which should be changed to@Widgetset("com.vaadin.v7.Vaadin7WidgetSet")
The widgetset compilation for Vaadin7WidgetSet requires at least 1G of memory. To ensure this, add -Xmx1G to the vaadin-maven-plugin configuration in your pom.xml file.
TL;DR 版本
您可能需要将以下 2 个依赖项添加到您的项目中才能访问兼容性组件和小部件集:
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-compatibility-server</artifactId>
<version>8.0.5</version>
</dependency>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-compatibility-client-compiled</artifactId>
<version>8.0.5</version>
</dependency>
...从 com.vaadin.DefaultWidgetSet
更改为 com.vaadin.v7.Vaadin7WidgetSet
并重新编译您的 widgetset。
关于java - Vaadin 8 中的日历,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43762330/