GridFX Changelistener ignoring events
dennisfischer opened this issue · 6 comments
Hey,
jfxtras.labs.internal.scene.control.skin.GridViewSkin seems to have a bug with it's itemsListener.
The implemented listener checks for 1 change Event only, if 2 change events are existing within the variable "change", the second one is ignored.
I've added my own listener and compared this to the one given in the GridViewSkin source file. The change event contained "added" = true + "removed" = true, there's not a single cell being deleted from my gridview. The only thing that happens is that elements are added to the list.
This failure could be due to an javafx internal bug of throwing invalid change events. Following code is being executed:
itemList.set(itemList.indexOf(model), model);
Events thrown by this single change event:
Added: true
Removed: true
Replaced: true
Updated: false
Events processed by your change listener:
Added
if (change.wasAdded()) {
addCell(i);
} else if (change.wasPermutated()) {
// TODO: what to do know??
updateAllCells();
} else if (change.wasRemoved()) {
removeCell(i);
} else if (change.wasReplaced()) {
replaceCell(i);
} else if (change.wasUpdated()) {
updateCell(i);
}
Possible untested fix:
if (change.wasReplaced()) {
replaceCell(i);
}else if (change.wasAdded()) {
addCell(i);
} else if (change.wasPermutated()) {
// TODO: what to do know??
updateAllCells();
} else if (change.wasRemoved()) {
removeCell(i);
} else if (change.wasUpdated()) {
updateCell(i);
}
Thanks for the feedback and the very good description. I will try your fix the next days.
Is there any progress on this issue?
Hi,
I commited a fix and a demo that uses ADD, REMOVE & CHANGE events. Can you please check if everything is now working for you.
Hi,
I'll check it with the next snapshot jar which should be online tomorrow!?
Hi again,
this issue seems to be solved. At least everything works now for me.
Cool! Thx for testing.