This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 28315 - Missing getListeners (getPropertyChangeListeners, getNodeListeners) methods
Summary: Missing getListeners (getPropertyChangeListeners, getNodeListeners) methods
Status: RESOLVED WONTFIX
Alias: None
Product: platform
Classification: Unclassified
Component: Nodes (show other bugs)
Version: 3.x
Hardware: PC All
: P2 blocker (vote)
Assignee: Petr Nejedly
URL:
Keywords: API
Depends on:
Blocks:
 
Reported: 2002-10-29 09:18 UTC by Peter Zavadsky
Modified: 2008-12-22 18:40 UTC (History)
0 users

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Peter Zavadsky 2002-10-29 09:18:00 UTC
Those methods (like it is e.g. on JComponent)
would be useful to check whether some listener is
already registered at node (object in general),
and in behave afterwards according the result,
i.e. not to register itself many times.

I guess such methods would be useful also on other
types of objects.


Currently the abovementioned case is by-passed by
weak listener technnique, (the new one is
registered and the old one is deregistered while
the hard ref to the old one is replaced by the one
to the new listener).
But that's not nice nither from performance
(always new listener is created) nor from
consistency point of view (until the garbage comes
into play, there is more than one listener in the
game).
Comment 1 Petr Nejedly 2004-01-09 09:45:12 UTC
Taking over the node bugs from phrebejk.
Comment 2 Petr Nejedly 2004-04-08 12:56:36 UTC
It would be big mistake to put such methost in API.
First of all, you're responsible yourself for registering only once
and you need no support from the event source. You don't even need the
WeakListener most of the time and WeakListener won't help you in any
way with multiple registrations.
Second, it would allow you to gain access to other, unrelated,
listeners and do strange things with them (fake event, unregistration
of foreign listeners, ...)