Event Firing
Overview
Events are usually fired (aka., triggered) by a component (when serving the user at the client). However, applications are allowed to send events too.
There are three ways to trigger an event: post, send and echo.
Post an Event
Posting is the most common way to trigger an event. By posting, the event is placed at the end of the event queue, while events stored in the event queue is processed one-by-one in first-in-first-out order. Each desktop has one event queue and all events are handled sequentially.
To trigger an event, you could invoke Events.postEvent(String, Component, Object). For example,
Events.postEvent("onClick", button, null); //simulate a click
In additions to post an event to the end of the event queue, you could specify a priority with Events.postEvent(int, String, Component, Object). By default, the priority is 0. The higher the priority the earlier an event is processed.
Notice that the invocation returns after placing the event to the event queue. In other words, the event won't be processed unless all other events posted earlier or with higher priority are processed.
Send an Event
Echo an Event