From the eclipse help:
setCellValueFactory
The cell value factory needs to be set to specify how to populate all cells within a single TableColumn. A cell value factory is a Callback that provides a CellDataFeatures instance, and expects an ObservableValue to be returned. The returned ObservableValue instance will be observed internally to allow for immediate updates to the value to be reflected on screen.
CellDataFeatures
A support class used in TableColumn as a wrapper class to provide all necessary information for a particular Cell.
PropertyValueFactory
Creates a default PropertyValueFactory to extract the value from a given TableView row item reflectively, using the given property name.
Explained in my words:
myTableViewColumn.setCellValueFactory(new PropertyValueFactory<MyModelClass, String>("name"));
setCellValueFactory specifies how to populate all cells in the column myTableViewColumn. The data-type used here is a property. By using PropertyValueFactory we get the specified property by looking for the property named "name" (declared in MyModelClass private final SimpleStringProperty name = new SimpleStringProperty("");
).
Did I understood the usage of setCellValueFactory
and PropertyValueFactory
?