Package ej.microui.event

## Class Event

- java.lang.Object
- - ej.microui.event.Event

-     public class Event
      extends Object

  MicroUI features int-based events, allowing for a rich event mechanism compatible with scare resources. This class provides `EventGenerator` classes with event constants and helper methods to build and analyse events.

  An event has a type, a 8-bit figure that forms the most significant byte of the int-event, followed by 8-bits which is the generator identifier quantity, and followed by 16-bit of data.

  event : type (8-bit) + generatorId (8-bit) + data (16-bit)

  The very first 16 types [0x00..0x0f], some of which are defined by constants in `EventGenerator` subclasses, are MicroUI reserved. An application may create as many as 240 different kind of events.

  See Also:
    `EventGenerator`

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `Event()` |

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `static int` | `buildEvent​(int type, EventGenerator gen, int data)` | Builds an event from a given type, an eventGenerator and data.
    `static int` | `getData​(int event)` | Returns the event's data issued by a generator.
    `static EventGenerator` | `getGenerator​(int event)` | Gets a converter out of an event assuming the event has been generated by an `EventGenerator` that has been previously added to the system pool.
    `static int` | `getGeneratorId​(int event)` | Returns the event's generator identifier.
    `static int` | `getType​(int event)` | Returns the type of an event.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### Event

          public Event()

  - ### Method Detail

    - #### buildEvent

          public static int buildEvent​(int type,
                                       EventGenerator gen,
                                       int data)

      Builds an event from a given type, an eventGenerator and data.

      `type` and `data` must respect the format (respectively 0x0 to 0xff and 0x0 to 0xffff). No check is performed at runtime, only a crop is performed.

      Parameters:
        `type` - the type of the event to build
        `gen` - the generator associated with the event
        `data` - the data of the event to build
      Returns:
        the event as an `int`

    - #### getType

          public static int getType​(int event)

      Returns the type of an event.
      Parameters:
        `event` - an event
      Returns:
        event's type as an `int`

    - #### getData

          public static int getData​(int event)

      Returns the event's data issued by a generator.
      Parameters:
        `event` - an event
      Returns:
        event's data as an `int`

    - #### getGeneratorId

          public static int getGeneratorId​(int event)

      Returns the event's generator identifier.
      Parameters:
        `event` - an event
      Returns:
        event's generator as an `int`

    - #### getGenerator

          public static EventGenerator getGenerator​(int event)

      Gets a converter out of an event assuming the event has been generated by an `EventGenerator` that has been previously added to the system pool.
      Parameters:
        `event` - an event
      Returns:
        the event generator or null.
      Throws:
        `IllegalArgumentException` - if there is no generator associated to this event.
        `MicroUIException` - if MicroUI is not started
      See Also:
        `EventGenerator.addToSystemPool()`