From Apache OpenOffice Wiki
Jump to: navigation, search

Events are notifications that you can register as listeners. This concept is actually expressed by registration or unregistration methods for the broadcaster, listener interfaces for the listener and event structures for the event.


If an object broadcasts a certain event, it offers a pair of methods like addEventNameListener() and removeEventNameListener(). This scheme conforms to the naming scheme of JavaBeans and does not mean that the implementation keeps track of a separate list for each event.

The event methods of the listener interface use the past tense form of the verb that specifies the event, usually in combination with the subject to which it applies, for example, mouseDragged(). For events which are notified before the event actually happens, the method begins with notify, for example, notifyTermination(). Event methods for prohibited events start with the prefix approve, for example, approveTermination().


Use events if other, previously unknown objects have to be notified about status changes in your object.

Normally, the methods add...Listener() and remove...Listener() have a single argument. The type of argument is an interface derived from

The event is a struct derived from, therefore this struct contains the source of the event.

Content on this page is licensed under the Public Documentation License (PDL).
Personal tools
In other languages