站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > NetBeans API Javadoc 5.0.0

MDRChangeSource (NetBeans MDR API) - NetBeans API Javadoc 5.0.0

 

org.netbeans.api.mdr.events
Interface MDRChangeSource

All Known Subinterfaces:
MDRepository, MDRObject

public interface MDRChangeSource

Event source interface implemented by all the repository objects and MDRepository. Enables other objects to register for listening to any repository events. The objects that have to be registered for event notifications need to implement MDRChangeListener or MDRPreChangeListener interface.

The repository distributes all the events recursively in the following way:

Figure below shows where the events are initially fired and how they propagate. Event sources and propagation

All the events are propagated recursively till they reach the repository object (e.g. each instance event is as a result of propagation always fired on the instance itself, on its class proxy, on its immediate package proxy, on all other package proxies containing the immediate package proxy to the outermost package proxy and at the end on the repository containing instance).

In addition, any event is fired only once for each listener (so no matter how many objects on the event's propagation path is a listener registered on - e.g. on both class proxy and its instances - it receives each notification only once per event).

Listeners may be added specifically for certain events only by calling addListener(MDRChangeListener, int). If instead addListener(MDRChangeListener) is used for listener addition and, hence, no event mask is speficied, the listener receives all events which are propagated to the source it is registered for.


Method Summary
 void addListener(MDRChangeListener listener)
          Registers a listener for receiving all event notifications.
 void addListener(MDRChangeListener listener, int mask)
          Registers a listener for receiving notifications about events the type of which matches mask.
 void removeListener(MDRChangeListener listener)
          Removes listener from the list of objects registered for events notifications.
 void removeListener(MDRChangeListener listener, int mask)
          Removes listener only for events of types matching mask.
 

Method Detail

addListener

public void addListener(MDRChangeListener listener)
Registers a listener for receiving all event notifications.

Parameters:
listener - Object that implements MDRChangeListener interface.

addListener

public void addListener(MDRChangeListener listener,
                        int mask)
Registers a listener for receiving notifications about events the type of which matches mask.

Parameters:
listener - Object that implements MDRChangeListener interface.
mask - bitmask to be used in a call to MDRChangeEvent.isOfType(int) to filter events based on the mask. The masks are defined in MDRChangeEvent and the interfaces that extend it.
See Also:
Constant Field Values

removeListener

public void removeListener(MDRChangeListener listener)
Removes listener from the list of objects registered for events notifications.

Parameters:
listener - Object that implements MDRChangeListener interface.

removeListener

public void removeListener(MDRChangeListener listener,
                           int mask)
Removes listener only for events of types matching mask. If a listener is additionally registered for events of other types, it proceeds listening on the remaining event types.

Parameters:
listener - Object that implements MDRChangeListener interface.
mask - determines the types of events the listener shall stop to listen on. The masks are defined in MDRChangeEvent and the interfaces that extend it.
See Also:
Constant Field Values

 

Built on May 3 2007.  |  Portions Copyright 1997-2005 Sun Microsystems, Inc. All rights reserved.