Reputation: 17604
Given the following code example:
private final ObservableList<Person> data =
FXCollections.observableArrayList(
new Person("Jacob"),
new Person("Isabella")
);
public static class Person {
private final SimpleStringProperty firstName;
private Person(String fName, String lName, String email) {
this.firstName = new SimpleStringProperty(fName);
}
public String getFirstName() {
return firstName.get();
}
public void setFirstName(String fName) {
firstName.set(fName);
}
}
(A reduced example based on http://docs.oracle.com/javafx/2/ui_controls/table-view.htm#CJABHGAJ)
In that case, how does ObservableList know, that its underlying data changed? After all the SimpleStringProperty "firstName" in the Person class is private, so ObservableList shouldn't be able to attach any kind of listeners? Or is this done by some kind of reflection?
Upvotes: 0
Views: 426
Reputation: 310850
It doesn't. It only knows about changes to the list itself. Check the API.
Upvotes: 2