From: "Michael Heuer" <[EMAIL PROTECTED]>
> On Sat, 24 May 2003, Stephen Colebourne wrote:
>
> > CollectionChangeEvent:
> > Collection collection - the collection (current reference, ie. after
> > change)
> > int numberChanged - the number of elements changing
> > int changeIndex - for Lists, the index where the change starts
> > Object changed - the value/collection being added/removed/changed
> > boolean bulkOperation - true if addAll() etc. or clear()
> > int oldSize - size before change
> > int newSize - size after change
> > boolean sizeChanged - (derived from previous two)
>
> It looks to me that collecting this information may require
> synchronization in the decorator -- is that acceptable?
>
> ObservableCollection
> extends AbstractCollectionDecorator
>
> public boolean add(Object object)
> {
> // synchronized {
>
> int oldSize = size();
> boolean returnVal = super.add(object);
> int newSize = size();
>
> // }
>
> if (returnVal)
> support.fireElementAdded(oldSize, newSize, object);
>
> return returnVal;
> }
>
Synchronization is not the concern of the Observable classes. The user must
synchronize themselves if it is important.
Stephen
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]