Spring Boot 如何使用 Vaadin 插件?
How to use Vaadin add-on with Spring Boot?
我正在使用带有 Spring Boot 的 Vaadin 7.6.3。我正在尝试使用 PopupButton 附加组件(但我不认为该问题是特定于附加组件的)。
我将附加组件添加为 gradle 的依赖项。这是创建 PopupButton 的代码:
PopupButton btn = new PopupButton("Test Button");
btn.setContent(new Label("Test"));
layout.addComponent(btn);
通过 Gradle 的 Vaadin 插件,我 运行 任务 vaadinCompile
在 src/main/webapp/VAADIN/gwt-unitCache
中创建了文件 src/main/resources/addon/client/ListaideWidgetset.gwt.xml
和多个文件,并且
src/main/webapp/VAADIN/widgetsets/addon.client.ListaideWidgetset
。我还在 UI 中添加了 @Widgetset("addon.client.ListaideWidgetset")
。我确认 widgetset 是通过客户端的 ?debug
模式使用的。
ListaideWidgetset.gwt.xml
的内容:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE module PUBLIC "-//Vaadin//DTD Vaadin 7//EN" "https://raw.github.com/vaadin/gwt/master/distro-source/core/src/gwt-module.dtd">
<!-- WS Compiler: manually edited -->
<module>
<inherits name="com.vaadin.DefaultWidgetSet" />
<set-configuration-property name="devModeRedirectEnabled" value="true" />
<set-property name="user.agent" value="ie8,ie9,gecko1_8,safari,ie10" />
<source path="client" />
<source path="shared" />
<collapse-all-properties />
<set-property name="compiler.useSymbolMaps" value="true" />
</module>
问题是按钮在客户端上显示为标准按钮(无 V 形)并且在单击时不会打开弹出窗口。
您的小部件集不包含插件。见 example:
<inherits name="org.vaadin.hene.popupbutton.widgetset.PopupbuttonWidgetset" />
添加后,重新编译小部件集,重新启动您的应用程序。
通常 gradle 插件可以为您处理此问题,但该功能可以被禁用或其他一些配置错误可能会阻止它。没有 build.gradle
...
很难说清楚
编辑
gradle vaadin 插件似乎无法正确处理此插件。作为解决方法,禁用小部件集的自动管理,这会阻止 gwt.xml
的重新生成。请参阅 https://github.com/johndevs/gradle-vaadin-plugin/wiki/Tasks-and-configuration-DSL 中的 manageWidgetset
)。例如。在您的 vaadin{}
块中添加 vaadinCompile.manageWidgetset = false
。
我正在使用带有 Spring Boot 的 Vaadin 7.6.3。我正在尝试使用 PopupButton 附加组件(但我不认为该问题是特定于附加组件的)。
我将附加组件添加为 gradle 的依赖项。这是创建 PopupButton 的代码:
PopupButton btn = new PopupButton("Test Button");
btn.setContent(new Label("Test"));
layout.addComponent(btn);
通过 Gradle 的 Vaadin 插件,我 运行 任务 vaadinCompile
在 src/main/webapp/VAADIN/gwt-unitCache
中创建了文件 src/main/resources/addon/client/ListaideWidgetset.gwt.xml
和多个文件,并且
src/main/webapp/VAADIN/widgetsets/addon.client.ListaideWidgetset
。我还在 UI 中添加了 @Widgetset("addon.client.ListaideWidgetset")
。我确认 widgetset 是通过客户端的 ?debug
模式使用的。
ListaideWidgetset.gwt.xml
的内容:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE module PUBLIC "-//Vaadin//DTD Vaadin 7//EN" "https://raw.github.com/vaadin/gwt/master/distro-source/core/src/gwt-module.dtd">
<!-- WS Compiler: manually edited -->
<module>
<inherits name="com.vaadin.DefaultWidgetSet" />
<set-configuration-property name="devModeRedirectEnabled" value="true" />
<set-property name="user.agent" value="ie8,ie9,gecko1_8,safari,ie10" />
<source path="client" />
<source path="shared" />
<collapse-all-properties />
<set-property name="compiler.useSymbolMaps" value="true" />
</module>
问题是按钮在客户端上显示为标准按钮(无 V 形)并且在单击时不会打开弹出窗口。
您的小部件集不包含插件。见 example:
<inherits name="org.vaadin.hene.popupbutton.widgetset.PopupbuttonWidgetset" />
添加后,重新编译小部件集,重新启动您的应用程序。
通常 gradle 插件可以为您处理此问题,但该功能可以被禁用或其他一些配置错误可能会阻止它。没有 build.gradle
...
编辑
gradle vaadin 插件似乎无法正确处理此插件。作为解决方法,禁用小部件集的自动管理,这会阻止 gwt.xml
的重新生成。请参阅 https://github.com/johndevs/gradle-vaadin-plugin/wiki/Tasks-and-configuration-DSL 中的 manageWidgetset
)。例如。在您的 vaadin{}
块中添加 vaadinCompile.manageWidgetset = false
。