-
Bug
-
Resolution: Fixed
-
P4
-
None
-
fx2.0
-
Windows 7, JDK7, JavaFX b40
The documentation for ListChangeListener.Change suggest the following code:
{code}
ObservableList<Item> theList = ...;
{
theList.addListener(new ListChangeListener<Item>() {
public void onChanged(Change<Item> c) {
while (c.next()) {
for (Item remitem : c.getRemoved()) {
remitem.remove(Outer.this);
}
for (Item additem : c.getAddedSubList()) {
additem.add(Outer.this);
}
}
}
});
}
{code}
But this will not work because c.next() returns false if there was only one change.
See attached example.
{code}
ObservableList<Item> theList = ...;
{
theList.addListener(new ListChangeListener<Item>() {
public void onChanged(Change<Item> c) {
while (c.next()) {
for (Item remitem : c.getRemoved()) {
remitem.remove(Outer.this);
}
for (Item additem : c.getAddedSubList()) {
additem.add(Outer.this);
}
}
}
});
}
{code}
But this will not work because c.next() returns false if there was only one change.
See attached example.