我正在使用包含 BillingTableRow 类型项目的 JavaFX TreeTableView。我希望根据 BillingTableRow 中的 getType() 方法给出的值对列进行样式设置,但我似乎无法从我试图设置的回调内部访问它。这是我的代码:
Callback<TreeTableColumn<BillingTableRow, Double>, TreeTableCell<BillingTableRow, Double>> eveningCallback = new Callback<TreeTableColumn<BillingTableRow, Double>, TreeTableCell<BillingTableRow, Double>>() {
@Override
public TreeTableCell<BillingTableRow, Double> call(TreeTableColumn<BillingTableRow, Double> p) {
return new EditableTreeTableDoubleCell() {
@Override
public void updateItem(Double item, boolean empty) {
super.updateItem(item, empty);
BillingTableRow row = (...)// Get attached BillingTableRow for current tree table row.
if (row.getType() == 0) {
setText(null);
}
}
};
}
};
eveningColumn.setCellFactory(eveningCallback);
我应该用什么替换 (...) 才能让它工作?