Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [ufk-dev] ObservableListModel multi element change problem

Hi Tom,

The check (size != 0) is just a guard condition to avoid the invalid
arguments for fireIntervalAdd/Remove.

The solution you posted earlier with
fireContentsChanged(ObservableListModel.this, 0,
Math.max(oldSize,newSize))
is perfectly fine.

The only problem I see is with the list selection.
The default selection model is index based.
The removal of a selected element and subsequent call of
fireContentsChanged() does not clear the selection - it just moves to
the next element.
In general removal of any element before the selected element will
effectively change the selection.

My solution will clear selection every time. Not very friendly...

So there is a thin compromise - preserve the selection position or the
selected element.

  Max


Back to the top