public void addListener ( ChangeListener listener , boolean weak ) { // only add the listener if they're not already there int idx = getListenerIndex ( listener ) ; if ( idx == - 1 ) { _listeners = ListUtil . add ( _listeners , weak ? new WeakReference < Object > ( listener ) : listener ) ; return ; } boolean oweak = _listeners [ idx ] instanceof WeakReference < ? > ; if ( weak == oweak ) { log . warning ( "Refusing repeat listener registration" , "dobj" , which ( ) , "list" , listener , new Exception ( ) ) ; } else { log . warning ( "Updating listener registered under different strength." , "dobj" , which ( ) , "list" , listener , "oweak" , oweak , "nweak" , weak , new Exception ( ) ) ; _listeners [ idx ] = weak ? new WeakReference < Object > ( listener ) : listener ; } }
Adds an event listener to this object . The listener will be notified when any events are dispatched on this object that match their particular listener interface .