Class GenericEventGenerator


  • public abstract class GenericEventGenerator
    extends EventGenerator
    Generic event generator.

    Generic communication to receive events.

    Since:
    2.0
    • Constructor Detail

      • GenericEventGenerator

        public GenericEventGenerator()
    • Method Detail

      • setProperty

        public 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.
        Parameters:
        name - the property name
        value - the property value
      • eventReceived

        protected void eventReceived​(int event,
                                     @Nullable
                                     EventHandler handler)
        Called by MicroUI pump when a custom event has been received from the native world. The event contains only one 32-bit value. Implementation has to decode the event. Then it can
        • perform any actions according the event (for instance update a model, etc.),
        • or save it, build a standard MicroUI event (see 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).

        Parameters:
        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.
      • eventReceived

        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. The event contains only one 32-bit value.
        Parameters:
        event - the 32-bit custom event value.
      • eventsReceived

        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. The event contains several 32-bit values.
        Parameters:
        events - the 32-bit custom event values.
        See Also:
        eventReceived(int)