Class ServerEvent<T extends ServerEventListener>

java.lang.Object
com.oorian.messaging.events.Event<T>
com.oorian.messaging.events.server.ServerEvent<T>
Type Parameters:
T - the type of listener that handles this event

public abstract class ServerEvent<T extends ServerEventListener> extends Event<T>
Abstract base class for server-originated events that carry an event ID and source element.

Server events are created on the server side and dispatched to registered ServerEventListener implementations. They provide a mechanism for components to communicate internally without client involvement.

  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    Creates a new ServerEvent with bubbling enabled.
    protected
    ServerEvent(boolean bubbles)
    Creates a new ServerEvent with the specified bubbling behavior.
    protected
    ServerEvent(int id)
    Creates a new ServerEvent with the specified ID.
    protected
    ServerEvent(int id, boolean bubbles)
    Creates a new ServerEvent with the specified ID and bubbling behavior.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    dispatchTo(T listener)
    Dispatches this event to the specified listener.
    int
    Returns the event identifier.
    Returns the source element that originated this event.
    void
    setId(int id)
    Sets the event identifier.
    void
    Sets the source element that originated this event.

    Methods inherited from class com.oorian.messaging.events.Event

    bubbles

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ServerEvent

      protected ServerEvent()
      Creates a new ServerEvent with bubbling enabled.
    • ServerEvent

      protected ServerEvent(boolean bubbles)
      Creates a new ServerEvent with the specified bubbling behavior.
      Parameters:
      bubbles - true if this event should bubble, false otherwise
    • ServerEvent

      protected ServerEvent(int id)
      Creates a new ServerEvent with the specified ID.
      Parameters:
      id - the event identifier
    • ServerEvent

      protected ServerEvent(int id, boolean bubbles)
      Creates a new ServerEvent with the specified ID and bubbling behavior.
      Parameters:
      id - the event identifier
      bubbles - true if this event should bubble, false otherwise
  • Method Details

    • setId

      public void setId(int id)
      Sets the event identifier.
      Parameters:
      id - the event ID
    • setSource

      public void setSource(Element source)
      Sets the source element that originated this event.
      Parameters:
      source - the source element
    • getId

      public int getId()
      Returns the event identifier.
      Returns:
      the event ID
    • getSource

      public Element getSource()
      Returns the source element that originated this event.
      Returns:
      the source element
    • dispatchTo

      public void dispatchTo(T listener)
      Dispatches this event to the specified listener.

      Subclasses implement this method to call the appropriate handler method on the listener interface.

      Specified by:
      dispatchTo in class Event<T extends ServerEventListener>
      Parameters:
      listener - the listener to dispatch this event to