public class EventUtil extends Object
| Modifier and Type | Method and Description |
|---|---|
static Class<? extends Event> |
getEventClass(String eventType)
Returns the implementation class for the specified event type.
|
static String |
getEventType(Class<? extends Event> eventClass)
Returns the event type given the implementation class.
|
static String |
getEventType(ClientRequest request)
Extracts the event type from the client request.
|
static Method |
getHandler(String handlerName,
Object instance,
Event event)
Returns a suitable handler method for an event.
|
static boolean |
hasEvent(ClientRequest request)
Returns true if the client request contains an event.
|
static boolean |
hasEvent(ClientRequest request,
String eventType)
Returns true if the client request contains an event of the specified type.
|
static boolean |
invokeHandler(String handlerName,
Object instance,
Event event)
Invokes an event handler.
|
static void |
post(Event event)
Queues an event for later processing.
|
static void |
post(Page page,
Event event)
Queues an event for later processing.
|
static Event |
post(Page page,
String eventName,
BaseComponent target,
Object data)
Creates and posts an event for later delivery.
|
static Event |
post(String eventName,
BaseComponent target,
Object data)
Creates and posts an event for later delivery.
|
static void |
send(Event event)
Sends an event to its designated target.
|
static void |
send(Event event,
BaseComponent target)
Sends an event to the specified target.
|
static Event |
send(String eventName,
BaseComponent target,
Object data)
Creates and sends an event to the specified target.
|
static String |
stripOn(String eventType)
Strips the "on" prefix from an event type, if one is present.
|
static Event |
toEvent(ClientRequest request)
Extracts an event from the client request.
|
static Event |
toEvent(String eventType)
Creates an event from the specified event type.
|
public static void send(Event event)
event - The event to send. If the event's designated target is null, the event is sent
to the page in the current execution context.public static void send(Event event, BaseComponent target)
event - The event to send.target - The target for the event. If the target is null, the event is sent to the page
in the current execution context.public static Event send(String eventName, BaseComponent target, Object data)
eventName - The event name.target - The event target.data - Optional event data.public static void post(Event event)
event - The event to queue.public static void post(Page page, Event event)
page - Page owning the target queue.event - The event to queue.public static Event post(String eventName, BaseComponent target, Object data)
eventName - The event name.target - The event target.data - Optional event data.public static Event post(Page page, String eventName, BaseComponent target, Object data)
page - Page owning the target queue.eventName - The event name.target - The event target.data - Optional event data.public static Class<? extends Event> getEventClass(String eventType)
eventType - The event type (with or without the "on" prefix).public static String getEventType(Class<? extends Event> eventClass)
eventClass - The event class.public static String stripOn(String eventType)
eventType - The event type.public static boolean invokeHandler(String handlerName, Object instance, Event event)
handlerName - The name of the handler method.instance - The instance implementing the handler method.event - The event.public static Method getHandler(String handlerName, Object instance, Event event)
handlerName - The name of the handler method (defaults to a method with the same name as
the event type).instance - The instance implementing the handler method.event - The event.public static boolean hasEvent(ClientRequest request)
request - The client request.public static boolean hasEvent(ClientRequest request, String eventType)
request - The client request.eventType - The event type.public static Event toEvent(ClientRequest request)
request - The client request.IllegalArgumentException - If the request does not contain an event.public static String getEventType(ClientRequest request)
request - The client request.public static Event toEvent(String eventType)
eventType - The event type.Copyright © 2017 Regenstrief Center for Biomedical Informatics. All rights reserved.