Package org.apache.wiki.filters
Class PageEventFilter
- java.lang.Object
- 
- org.apache.wiki.api.filters.BasePageFilter
- 
- org.apache.wiki.filters.PageEventFilter
 
 
- 
- All Implemented Interfaces:
- PageFilter
 
 public class PageEventFilter extends BasePageFilter Fires WikiPageEvents for page events.Adding a PageEventFilter to the FilterManager will automatically attach an event delegate with the WikiEventManager to provide for firing and listener management. All that remains is then adding the listener to the filter via the WikiEventManager. This is quite simple: PageEventFilter filter = new PageEventFilter(); engine.getFilterManager().addPageFilter(filter,5000); // attach listener to filter WikiEventManager.addWikiEventListener(filter,listener);This class provides convenience methods for adding and removing WikiEventListeners. - See Also:
- WikiEventManager
 
- 
- 
Field Summary- 
Fields inherited from class org.apache.wiki.api.filters.BasePageFilterm_engine
 
- 
 - 
Constructor SummaryConstructors Constructor Description PageEventFilter()
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddWikiEventListener(WikiEventListener listener)Registers a WikiEventListener with this instance.protected voidfireEvent(int type, Context context)Fires a WikiPageEvent of the provided type and page name to all registered listeners.voidinitialize(Engine engine, java.util.Properties properties)Called whenever a new PageFilter is instantiated and reset.voidpostSave(Context wikiContext, java.lang.String content)This method is called after the page has been successfully saved.java.lang.StringpostTranslate(Context wikiContext, java.lang.String htmlContent)This method is called after a page has been fed through the TranslatorReader, so anything you are seeing here is translated content.java.lang.StringpreSave(Context wikiContext, java.lang.String content)This method is called before the page has been saved to the PageProvider.java.lang.StringpreTranslate(Context wikiContext, java.lang.String content)This method is called whenever a page has been loaded from the provider, but not yet been sent through the TranslatorReader.voidremoveWikiEventListener(WikiEventListener listener)Un-registers a WikiEventListener with this instance.- 
Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 - 
Methods inherited from interface org.apache.wiki.api.filters.PageFilterdestroy
 
- 
 
- 
- 
- 
Constructor Detail- 
PageEventFilterpublic PageEventFilter() 
 
- 
 - 
Method Detail- 
initializepublic void initialize(Engine engine, java.util.Properties properties) throws FilterException Called whenever a new PageFilter is instantiated and reset.- Specified by:
- initializein interface- PageFilter
- Overrides:
- initializein class- BasePageFilter
- Parameters:
- engine- The Engine which owns this PageFilter
- properties- The properties ripped from filters.xml.
- Throws:
- FilterException- If the filter could not be initialized. If this is thrown, the filter is not added to the internal queues.
 
 - 
preTranslatepublic java.lang.String preTranslate(Context wikiContext, java.lang.String content) This method is called whenever a page has been loaded from the provider, but not yet been sent through the TranslatorReader. Note that you cannot do HTML translation here, because TranslatorReader is likely to escape it.- Parameters:
- wikiContext- The current wikicontext.
- content- WikiMarkup.
- Returns:
- The modified wikimarkup content. Default implementation returns the markup as received.
 
 - 
postTranslatepublic java.lang.String postTranslate(Context wikiContext, java.lang.String htmlContent) This method is called after a page has been fed through the TranslatorReader, so anything you are seeing here is translated content. If you want to do any of your own WikiMarkup2HTML translation, do it here.- Parameters:
- wikiContext- The WikiContext.
- htmlContent- The translated HTML.
- Returns:
- The modified HTML. Default implementation returns the translated html as received.
 
 - 
preSavepublic java.lang.String preSave(Context wikiContext, java.lang.String content) This method is called before the page has been saved to the PageProvider.- Parameters:
- wikiContext- The WikiContext
- content- The wikimarkup that the user just wanted to save.
- Returns:
- The modified wikimarkup. Default implementation returns the markup as received.
 
 - 
postSavepublic void postSave(Context wikiContext, java.lang.String content) This method is called after the page has been successfully saved. If the saving fails for any reason, then this method will not be called.Since the result is discarded from this method, this is only useful for things like counters, etc. - Parameters:
- wikiContext- The WikiContext
- content- The content which was just stored.
 
 - 
addWikiEventListenerpublic final void addWikiEventListener(WikiEventListener listener) Registers a WikiEventListener with this instance. This is a convenience method.- Parameters:
- listener- the event listener
 
 - 
removeWikiEventListenerpublic final void removeWikiEventListener(WikiEventListener listener) Un-registers a WikiEventListener with this instance. This is a convenience method.- Parameters:
- listener- the event listener
 
 - 
fireEventprotected final void fireEvent(int type, Context context) Fires a WikiPageEvent of the provided type and page name to all registered listeners. Only PAGE_LOCK and PAGE_UNLOCK event types will fire an event; other event types are ignored.- Parameters:
- type- the WikiPageEvent type to be fired.
- context- the WikiContext of the event.
- See Also:
- WikiPageEvent
 
 
- 
 
-