From the JavaDoc:
ObservableList theList = ...;
theList.addListener(new ListChangeListener<Item>() {
public void onChanged(Change<tem> c) {
while (c.next()) {
if (c.wasPermutated()) {
for (int i = c.getFrom(); i < c.getTo(); ++i) {
//permutate
}
} else if (c.wasUpdated()) {
//update item
} else {
for (Item remitem : c.getRemoved()) {
remitem.remove(Outer.this);
}
for (Item additem : c.getAddedSubList()) {
additem.add(Outer.this);
}
}
}
}
});
}
Adding and removing items is straight forward, but what about //update item
and // permutate
?
How do I know which items have been permutated by which other items?
What does update mean exactly? Is it just adding the same item to the list again?
And what about
for (Item remitem : c.getRemoved()) {
remitem.remove(Outer.this);
}
or (Item additem : c.getAddedSubList()) {
additem.add(Outer.this);
}
What does Outer.this
mean?
Outer.this.remove(remitem)
andOuter.this.add(additem)
intead? – Lepus