項目のコレクションを GroovyFX の TableView にバインドしたいのですが、呼び出された後にテーブルが更新されませんtableView()
。
JavaFX ではテーブルを更新できますが、GroovyFX では更新できません。バインディングが不足していると思います。
コードは
import static groovyx.javafx.GroovyFX.start
import groovyx.javafx.beans.FXBindable;
import javafx.scene.control.TableView
class Command {
@FXBindable String command
@FXBindable String target
@FXBindable String value
}
start{
TableView scriptTable
ObservableList<Command> script = []
stage(title: 'Example for Stackoverflow', visible: true) {
scene(fill: groovyblue, width: 600, height: 250) {
borderPane{
center(align: CENTER){
script.add( new Command(command: "a", value: "b", target: "c") )
scriptTable = tableView(items: script, editable: true){
tableColumn(text: "Command", property: "command"){}
tableColumn(text: "Target", property: "target"){}
tableColumn(text: "Value", property: "value"){}
}
script.add( new Command(command: "d", value: "e", target: "f") )
}
}
}
}
作成後にテーブルをデータ ("d, e, f") で更新する方法について、ヘルプをいただければ幸いです。
どうもありがとう。