public class WikiEventUtils extends Object
Constructor and Description |
---|
WikiEventUtils() |
Modifier and Type | Method and Description |
---|---|
static void |
addWikiEventListener(Object client,
int type,
WikiEventListener listener)
This ungainly convenience method adds a WikiEventListener to the
appropriate component of the provided client Object, to listen
for events of the provided type (or related types, see the table
below).
|
public WikiEventUtils()
public static void addWikiEventListener(Object client, int type, WikiEventListener listener)
If the type value is valid but does not match any WikiEvent type known to this method, this will just attach the listener to the client Object. This may mean that the Object never fires events of the desired type; type-to-client matching is left to you to guarantee. Silence is golden, but not if you want those events.
Most event types expect a WikiEngine as the client, with the rest attaching the listener directly to the supplied source object, as described below:
WikiEvent Type(s) | Required Source Object | Actually Attached To |
---|---|---|
any WikiEngineEvent | WikiEngine | WikiEngine |
WikiPageEvent.PAGE_LOCK, WikiPageEvent.PAGE_UNLOCK | WikiEngine or PageManager | PageManager |
WikiPageEvent.PAGE_REQUESTED, WikiPageEvent.PAGE_DELIVERED | WikiServletFilter | WikiServletFilter |
WikiPageEvent (phase boundary event) | WikiEngine | FilterManager |
WikiPageEvent (in-phase event) | ||
WikiPageEvent (in-phase event) | any | source object |
WikiSecurityEvent | any | source object |
any other valid type | any | source object |
any invalid type | any | nothing |
phase boundary event types: WikiPageEvent.PRE_TRANSLATE_BEGIN, WikiPageEvent.PRE_TRANSLATE_END, WikiPageEvent.POST_TRANSLATE_BEGIN, WikiPageEvent.POST_TRANSLATE_END, WikiPageEvent.PRE_SAVE_BEGIN, WikiPageEvent.PRE_SAVE_END, WikiPageEvent.POST_SAVE_BEGIN, and WikiPageEvent.POST_SAVE_END.
in-phase event types: WikiPageEvent.PRE_TRANSLATE, WikiPageEvent.POST_TRANSLATE, WikiPageEvent.PRE_SAVE, and WikiPageEvent.POST_SAVE.
Note: The Actually Attached To column may also be considered as the class(es) that fire events of the type(s) shown in the WikiEvent Type column.
ClassCastException
- if there is a type mismatch between certain event types and the client ObjectWikiEvent
,
WikiEngineEvent
,
WikiPageEvent
,
WikiSecurityEvent
Copyright © 2001-2018 The Apache Software Foundation. All rights reserved.