[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
AW: [riena-dev] ListenerList vs ArrayList
|
FYI, here's a couple of points we discussed in the call today:
- Eclipse doesn't treat adding Listeners consistently (some APIs allow several, some don't).
- For developer ease-of-use we want to provide a consistent behavior when adding Listeners. We will try to use ListenerList where possible, meaning that duplicates are not supported. I will change the Tree/Table/List-Ridget to use ListenerList and update the tests and javadoc.
- Christian/Stefan will discuss if it makes sense to throw an exception when adding a listener that's already there.
Kind regards,
Elias.
-----Ursprüngliche Nachricht-----
Von: riena-dev-bounces@xxxxxxxxxxx [mailto:riena-dev-bounces@xxxxxxxxxxx] Im Auftrag von Stefan Liebig
Gesendet: Wednesday, August 27, 2008 00:31
An: Riena Developers list
Betreff: Re: [riena-dev] ListenerList vs ArrayList
Several points:
- I think we are free to change (better extend) the behavior of our
ListenerList to suit our needs
- the original ListenerList already was policy driven, so why not widen
the policy if we need it?
- and again: what is the use case for adding a listener multiple times,
and is this an indicator for some design flaw, unclear responsibilities,
bla, bla, .. (don´t get me wrong, I am just asking)
Stefan
Christian Campo wrote:
> I think we should agree on something (either duplicates or not). Now
> you, Elias, removed the ListenerList to allow duplicates while
> Thorsten just on monday replaced an ArrayList with the ListenerList.
>
> There should be a unique policy throughout Riena. I am sure what the
> policy is in Eclipse. I thought the ListenerList that we use is just
> a copy of the class of Riena with an API that supports Generics. So
> the "offiicial" class in Eclipse that should be used for Listeners
> does not
> allow duplicates (or better it ignores them).
>
> If you ignore what could happen is that if you add the same listener
> twice and then remove one, no listener is registered (since there is
> no counter). So
> can a programmer know that a listener he wants to register (this
> particular instance) is already registered ? If he can, then he is
> doing something wrong
> registering it the second time. Its a little that we dont throw an
> exception for duplicates then, but that is the way the Eclipse class
> behaves.
>
> IMHO I think since the ListenerList exists we should use it for each
> and every case where a Listener is required. Since the original
> implementation from
> Eclipse ignores duplicates (and hence does not allow them), we could
> think about throwing some kind of runtime exception and document that
> duplicate
> listeners are not allowed.
>
> What do you guys think ?
>
> christian
>
>
> Am 27.08.2008 um 07:31 schrieb Stefan Liebig:
>
>> We could also extend ListenerList to allow duplicates. There is
>> already an enum Mode that could be
>> extended for that.
>> However, does it make sense for a listener to be notified multiple
>> times for the same event?
>>
>> Stefan
>>
>> Volanakis, Elias wrote:
>>> Just FYI, in the Tree/Table/List-Ridget I changed the container for the
>>> double click listeners to ArrayList (recently changed to ListenerList).
>>> The reason for using an ArrayList is that adding duplicate listeners is
>>> explicitly permitted there.
>>>
>>> This fixes the recent test failures in #testAddDoubleClickListener.
>>> Feel free to discuss if you disagree. The alternative is to adjust the
>>> tests / javadoc to disallow duplicate listeners.
>>>
>>> Thanks,
>>> Elias.
>>>
>>> _______________________________________________
>>> riena-dev mailing list
>>> riena-dev@xxxxxxxxxxx
>>> https://dev.eclipse.org/mailman/listinfo/riena-dev
>>>
>>
>> _______________________________________________
>> riena-dev mailing list
>> riena-dev@xxxxxxxxxxx
>> https://dev.eclipse.org/mailman/listinfo/riena-dev
>
> _______________________________________________
> riena-dev mailing list
> riena-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/riena-dev
_______________________________________________
riena-dev mailing list
riena-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/riena-dev