public class MicroUIEventGenerator
extends java.lang.Object
EventGenerator
event generator implementation.
Several methods takes in argument a string generatorID
. This ID must refer to a MicroUI events generator
defined during the MicroEJ plaform build in microui/microui.xml
file (in platform configuration
project).
In designer mode (plugin mode), this ID is unknown so all methods throw an IllegalArgumentException
. The
caller should catch this exception and prints in the standard output stream a description of this event.
In MicroEJ application mode, this exception should not occur (the MicroUI events generator ID should exist). However, when exception occurs, the trace allows to the user to note there is an issue according the MicroUI events generator ID.
Modifier and Type | Method and Description |
---|---|
static void |
addEvent(int event)
Adds an event in the queue.
|
static void |
addEvent(int generatorId,
int data)
Constructs an event and adds it to the simulator input queue.
|
static void |
addEvent(java.lang.String generatorId,
int data)
Constructs an event and adds it to the simulator input queue.
|
static void |
addEvents(int[] events)
Adds several events in the queue.
|
static int |
buildEvent(int generatorId,
int data)
Constructs and returns an event.
|
static int |
buildEvent(java.lang.String generatorId,
int data)
Constructs and returns an event.
|
static int |
getData(int event)
Returns the data component of the event.
|
static int |
getType(int event)
Returns the type (i.e.
|
public static int getType(int event)
event
- the event to decode.public static int getData(int event)
event
- the event to decode.public static int buildEvent(java.lang.String generatorId, int data) throws java.lang.IllegalArgumentException
generatorId
- the required generator id (i.e. type) of the event.data
- the data component of the event.java.lang.IllegalArgumentException
- whether the generatorID refers to an unknown MicroUI generator (see class comment).public static int buildEvent(int generatorId, int data)
generatorId
- the required generator id (i.e. type) of the event.data
- the data component of the event.public static void addEvent(int event)
buildEvent(int, int)
or
buildEvent(String, int)
.event
- the event to add.public static void addEvents(int[] events)
buildEvent(int, int)
or buildEvent(String, int)
.events
- the events to add.public static void addEvent(java.lang.String generatorId, int data) throws java.lang.IllegalArgumentException
addEvent(buildEvent(generatorId, data))
.generatorId
- the required generator id (i.e. type) of the event.data
- the data component of the event.java.lang.IllegalArgumentException
- whether the generatorID refers to an unknown MicroUI generator (see class comment).public static void addEvent(int generatorId, int data)
addEvent(buildEvent(generatorId, data))
.generatorId
- the required generator id (i.e. type) of the event.data
- the data component of the event.