public abstract class GenericEventGenerator extends EventGenerator
Generic communication to receive events.
Constructor and Description |
---|
GenericEventGenerator() |
Modifier and Type | Method and Description |
---|---|
protected abstract void |
eventReceived(int event)
Called by the default implementation of
eventReceived(int, EventHandler) when a custom event has been
received from the native world. |
protected void |
eventReceived(int event,
EventHandler handler)
Called by MicroUI pump when a custom event has been received from the native world.
|
protected abstract void |
eventsReceived(int[] events)
Called by the default implementation of
eventReceived(int, EventHandler) when a custom event has been
received from the native world. |
protected void |
eventsReceived(int[] events,
EventHandler handler)
Called by MicroUI pump when a custom event has been received from the native world.
|
abstract void |
setProperty(String name,
String value)
Called at startup to configure the event generator with the specific properties set in the MicroUI XML file.
|
addToSystemPool, get, get, get, getEventHandler, getEventType, getId, removeFromSystemPool, sendEvent, setEventHandler
protected abstract void eventReceived(int event)
eventReceived(int, EventHandler)
when a custom event has been
received from the native world. The event contains only one 32-bit value.event
- the 32-bit custom event value.protected void eventReceived(int event, @Nullable EventHandler handler)
Event.buildEvent(int, EventGenerator, int)
and send
this event to the given event handler.The second solution is useful to deport the event management to a global events handler like other events (command, buttons, pointer and states).
When the handler is the display's event serializer (see Display.getEventHandler()
) the given handler is
the current displayable; it allows to handle the new MicroUI event immediately, without postponing it to the end
of the events queue. Otherwise the given handler is the handler returned by EventGenerator.getEventHandler()
.
The handler may be null
when there is no current displayable or when no handler is set on the event
generator.
The default implementation calls eventReceived(int)
.
event
- the 32-bit custom event value.handler
- the generator's events handler: the current displayable on display, the handler returned by
EventGenerator.getEventHandler()
or null
.protected abstract void eventsReceived(int[] events)
eventReceived(int, EventHandler)
when a custom event has been
received from the native world. The event contains several 32-bit values.events
- the 32-bit custom event values.eventReceived(int)
protected void eventsReceived(int[] events, @Nullable EventHandler handler)
See eventReceived(int, EventHandler)
comment.
The default implementation calls eventsReceived(int[])
.
events
- the 32-bit custom event values.handler
- the generator's events handler: the current displayable on display, the handler returned by
EventGenerator.getEventHandler()
or null
.