【发布时间】:2015-01-27 00:59:25
【问题描述】:
我正在尝试将 vaadin 地址簿应用程序修改为稍微不同的应用程序,只是更改了字段名称。但我不知道如何用特定值而不是 vaadin 教程示例中的伪随机填充它。 这是我的代码。
private static IndexedContainer createDummyDatasource() {
IndexedContainer ic = new IndexedContainer();
for (String p : fieldNames) {
ic.addContainerProperty(p, String.class, "");
}
String[] cnumber = { "1", "2", "3" };
String[] ctitle = { "a", "b", "c" };
String[] faculty = { "xxx" };
for (int i = 0; i < 3; i++) {
Object id = ic.addItem();
ic.getContainerProperty(id, CNUMBER).setValue(cnumber[(int) (cnumber.length * Math.random())]);
ic.getContainerProperty(id, CTITLE).setValue(ctitle[(int) (ctitle.length * Math.random())]);
ic.getContainerProperty(id, FACULTY).setValue(faculty[(int) (faculty.length * Math.random())]);
}
return ic;
}
请帮忙..!!
【问题讨论】:
标签: eclipse vaadin addressbook