WikiEventListener
Class designation: Interface org.apache.wiki.event.WikiEventListener extends java.util.EventListener

WikiEventListener extends Java's EventListener, defining an interface for an object that listens for WikiEvent. Unlike most Java event handling, there's no need for class-level maintenance of listener lists (e.g., add and remove listener methods), since this is all handled by methods within the WikiEventManager.

WikiEventListener is part of the JSPWiki WikiEvent package.

A Typical Example#

One can simultaneously create an anonymous class implementing the WikiEventListener interface and using the WikiEventManager add it as a listener for events from a given object (often this, the source object):

    WikiEventManager.addWikiEventListener(this,
            new WikiEventListener() {
                public void actionPerformed( WikiEvent e ) {
                    if ( e.getSource() instanceof SomeObject
                            && e.getType() == SOME_TYPE ) {
                        // do something intelligent here
                    }
                }
            }); 
How you react to events, i.e., what you do within actionPerformed() is up to you, but typically there'll first be a test for the type of source object and the event type.
See: WikiEvent, WikiEventManager

Category.Documentation