0
我在尝试更新组合框的内容(使用Griffon 1.2.0和JavaFX插件)。正在更新Griffon JavaFX组合框
我的模型:
class MyModel {
List monthList = FXCollections.observableList([new DateMidnight()])
def convertDate = [
fromString: { String s ->
return new DateMidnight(DateTimeFormat.forPattern("yyyy-MM").parseDateTime(s))
},
toString: { DateMidnight d ->
return "2011-10"
}
] as StringConverter
}
我的观点包括:
comboBox(items: (model.monthList), converter: model.convertDate)
现在我有一个被调用的控制器操作,当他们按一个按钮:
def load = {
execInsideUIAsync {
def months = myService.buildMonthList()
model.monthList.addAll(months)
}
}
的问题是组合框内容永不改变。任何人都可以帮助我了解我错过了什么吗?
有组合框上没有文档尚未http://groovyfx.org/docs/guide/single.html#choiceBoxComboBox
而且,我已经正确实施了转换?
不幸的是,这并不适用于我。我定义我的组合框: 组合框(ID:“月”,转换器:model.convertDate) ,然后用noparent块: noparent { months.items = model.monthList ,然后在我的控制器我更新模型 model.monthList.clear() model.monthList.addAll(months) 但该视图永不改变。 我一直能够操纵组合框的唯一方法是直接访问view.months.items并直接清除/填充它。不理想。 – prule 2013-02-23 22:06:42
嗯,它可能是一个线程问题?我用Griffon 1.2.0和groovyfx/javafx 0.8运行代码。有关详细信息,请参阅https://gist.github.com/aalmiray/5023272。该指南详细介绍了@线程http://griffon.codehaus.org/guide/latest/guide/threading.html#annotationBasedThreading – aalmiray 2013-02-24 09:56:40
嘿,我创建了一个新的应用程序来尝试你的例子,它工作正常。但我仍然无法在我现有的应用程序中使用它。当我有时间时,我会尽量让它正常工作。谢谢你的帮助。 – prule 2013-02-25 01:12:46