It seems that there are several separate issues around oldItems.equals (newItems)
The first part of RT-22463 : tableView will not be updated even when items.clear () is called
what is fixed. Clearing old items before installing a new list clears all old states, thereby updating the table. Any example where this does not work can be regression.
What else doesn't work is reinstalling items without first cleaning
This is a problem if the table displays properties that do not participate in the equal solution of the element (see the example in RT-22463 or Aubin ) and is covered - I hope - RT-39094
UPDATE : RT-39094 last fixed, for 8u40! Must bubble up in ea in a couple of weeks, thinking about u12 or such.
The technical reason seems to be checking for equality in the implementation of the cells: checking for element changes before the actual call to updateItem (T, boolean) was introduced to fix performance issues. Reasonable, just for hard code, "change" == old.equals (new) creates problems in some contexts.
A workaround great for me (without formal testing!) Is a custom TableRow that jumps if an identity check is required:
public class IdentityCheckingTableRow<T> extends TableRow<T> { @Override public void updateIndex(int i) { int oldIndex = getIndex(); T oldItem = getItem(); boolean wasEmpty = isEmpty(); super.updateIndex(i); updateItemIfNeeded(oldIndex, oldItem, wasEmpty); } protected void updateItemIfNeeded(int oldIndex, T oldItem, boolean wasEmpty) {
Note that TableCell has a similar hard-coded equality check, so if the user row is not enough, you might need to use a custom TableCell with a similar workaround (not running in an example where necessary, though)
kleopatra Oct 22 '14 at 15:13 2014-10-22 15:13
source share