Interface EventInterceptor
To register an event interceptor to a desktop, invoke
Desktop.addListener(java.lang.Object).
To register an event intercepter to a configuration, invoke
Configuration.addListener(java.lang.Class<?>).
- Since:
- 3.0.0
- Author:
- tomyeh
-
Method Summary
Modifier and TypeMethodDescriptiondefault voidafterProcessEvent(Event event) Called after processing an event.default EventbeforePostEvent(Event event) Called before posting an event (withEvents.postEvent(org.zkoss.zk.ui.event.Event)).default EventbeforeProcessEvent(Event event) Called before processing an event.default EventbeforeSendEvent(Event event) Called before sending an event (withEvents.sendEvent(org.zkoss.zk.ui.Component, org.zkoss.zk.ui.event.Event)).
-
Method Details
-
beforeSendEvent
Called before sending an event (withEvents.sendEvent(org.zkoss.zk.ui.Component, org.zkoss.zk.ui.event.Event)).If this method throws an exception, it will abort the execution and shows an error message to the end user (unless it is cleaned up by
EventThreadCleanup).- Parameters:
event- the event being sent- Returns:
- the event to be sent (so it is usually the same event passed by the event argument). If null, the event is dropped. Note: multiple interceptors might be registered, and the returned value of an interceptor will be used for the following interceptor.
-
beforePostEvent
Called before posting an event (withEvents.postEvent(org.zkoss.zk.ui.event.Event)).If this method throws an exception, it will abort the execution and shows an error message to the end user (unless it is cleaned up by
EventThreadCleanup).- Parameters:
event- the event being posted- Returns:
- the event to be posted (so it is usually the same event passed by the event argument). If null, the event is dropped. Note: multiple interceptors might be registered, and the returned value of an interceptor will be used for the following interceptor.
-
beforeProcessEvent
Called before processing an event. By processing, we mean handing over the event to the event listeners and handlers.Note: it executes in the event processing thread, so you can update the desktop whatever you need. For example, you might create a highlighted window and return null to prevent the user from accessing, if the system is too busy.
If this method throws an exception, it will abort the execution and shows an error message to the end user (unless it is cleaned up by
EventThreadCleanup).- Parameters:
event- the event being processed- Returns:
- the event to be processed (so it is usually the same event passed by the event argument). If null, the event is dropped. Note: multiple interceptors might be registered, and the returned value of an interceptor will be used for the following interceptor.
-
afterProcessEvent
Called after processing an event. By processing, we mean handing over the event to the event listeners and handlers.If this method throws an exception, it will abort the execution and shows an error message to the end user (unless it is cleaned up by
EventThreadCleanup).- Parameters:
event- the event being processed
-