【发布时间】:2015-07-02 09:29:49
【问题描述】:
我有一个由 3 个StringProperty 组成的非常简单的模型,我们称它们为property1、property2 和property3。我在我的模型中定义了常用的get/set/property 方法。我现在使用TableView 来显示其中一些属性。 Column模型定义如下
TableColumn<MyModel, String> tableColumn1 = new TableColumn<MyModel, String>("display 1");
TableColumn<MyModel, String> tableColumn2 = new TableColumn<MyModel, String>("display 2");
现在 TableColumn 遵循使用链接到我模型的属性之一的单元格值工厂的模式。
tableColumn1.setCellValueFactory((t)-> {
MyModel myModelValue = ((MyModel)t.getValue());
return myModelValue.getProperty3().equals("something") ? property1():property2();
});
tableColumn2.setCellValueFactory((t)-> property3());
现在的问题如下。如果property3 在执行过程中某处发生更改,它将正确触发我的表的column2 的更改和单元格的UI 更新。但它不会为 column1 做任何事情,因为 property1 和 property2 都没有改变。我怎样才能以某种方式强制 column1 更改或视情况听 property3 的更改
谢谢
【问题讨论】:
标签: java uitableview javafx tableview javafx-8