API REVIEW: BaseObservableList
Martin Sladecek
martin.sladecek at oracle.com
Wed Nov 7 05:48:14 PST 2012
Hi Richard,
On 11/02/2012 06:49 PM, Richard Bair wrote:
>> Following methods were part of IterableChangeBuilder in the original discussion. Now they will be part of BaseObservableList and can be used for creating a Change and firing it, so you don't need to create subclasses of ListChangeListener.Change yourself.
>>
>> protected final void nextUpdate(int pos)
>> protected final void nextSet(int idx, E old)
>> protected final void nextReplace(int from, int to, ArrayList removed)
>> protected final void nextRemove(int idx, List removed)
>> protected final void nextRemove(int idx, E removed)
>> protected final void nextPermutation(int from, int to, int[] perm)
>> protected final void nextAdd(int from, int to)
>> protected final void endChange()
>> protected final void beginChange()
>>
>> All next* methods need to be enclosed in beginChange() / endChange() pair. The calls can be also nested and after the outermost endChange() call, callListeners() will be called with the newly created Change.
> It seems odd that these are on the base class itself. I don't remember the previous conversation so maybe I said something different before :-). Steve, I'm wondering what you think on this point?
I don't think we discussed this before. The other option is to have this
as part of ListChangeBuilder, which would be public (I planned to have
it package private) and call the methods on the builder instead.
So instead of
{
beginChange();
...
nextAdd();
...
endChange();
}
we'd get
getChangeBuilder().beginChange();
...
getChangeBuilder().nextAdd();
...
getChangeBuilder().endChange();
I have no strong opinion on this, the first one is more compact, but the
second option keeps the change related methods together in a different
class.
-Martin
More information about the openjfx-dev
mailing list