【发布时间】:2018-08-17 05:32:38
【问题描述】:
如何从 Vaadin RadioButtonGroup country 绑定到 Country country DAO 对象?国家是枚举和 DateField(vaadin) 到 LocalDate(DAO)
public class Person {
@Id
String id;
LocalDate dateBorn;
Country country;
……
public class PersonFormUI extends GridLayout {
RadioButtonGroup<Country> country;
DateField dateBorn;
........
public enum Country {
EN, DE, IT }
使用此绑定,所有字段都已绑定并且运行良好,但是如何使用Converter 绑定枚举和日期?
binder.bindInstanceFields(this);
binder.setBean(personDAO);
【问题讨论】:
-
你需要使用什么样的转换器?还有你用的是什么 Vaadin 版本?
-
无论什么有助于从 vaadin 字段绑定到 java dao 对象,我都使用最新版本 8.3.0 。 Vaadin 没有我在文档中看到的日期转换器或枚举转换器,或者我必须将枚举和日期解析为字符串?
-
我相信 8.3.1 是最新的,我也不认为您需要任何转换器或解析字符串,Vaadin 会处理它。您可以在下面我的回答中找到示例。