Class ClientEvent<T extends ClientEventListener>

java.lang.Object
com.oorian.messaging.events.Event<T>
com.oorian.messaging.events.client.ClientEvent<T>
Type Parameters:
T - the type of listener that handles this event, must extend ClientEventListener
Direct Known Subclasses:
AnimationEvent, ClientFileEvent, ClipboardErrorEvent, ClipboardEvent, ClipboardReadEvent, CompositionEvent, DragEndEvent, DragEnterEvent, DragExitEvent, DragLeaveEvent, DragOverEvent, DragStartEvent, DropEvent, FocusEvent, FormEvent, FullscreenChangeEvent, FullscreenErrorEvent, GeolocationErrorEvent, GeolocationEvent, InputEvent, KeyEvent, MediaDevicesErrorEvent, MediaDevicesEvent, MouseClickedEvent, MouseEvent, NetworkStatusEvent, NotificationClickEvent, NotificationCloseEvent, NotificationErrorEvent, PermissionStatusEvent, PointerEvent, ScrollbarEvent, ShareErrorEvent, ShareSuccessEvent, SpeechErrorEvent, SpeechResultEvent, StorageEvent, ToggleEvent, TouchEvent, TransitionEvent, UserEvent, VisibilityChangeEvent, WakeLockErrorEvent, WakeLockEvent

public abstract class ClientEvent<T extends ClientEventListener> extends Event<T>
Abstract base class for all client-side events in the Oorian framework.

This class serves as the foundation for all events that originate from client-side interactions such as keyboard input, focus changes, form submissions, and custom user actions. It extends the framework's Event class and provides essential context information including the source and target HTML elements.

Features:

  • Maintains references to the source and target HTML elements
  • Type-safe listener association through generic parameterization

Usage: Subclasses should extend this class to create specific event types for different client interactions. The generic parameter T specifies the listener type that will handle this event.


 public class MyCustomEvent extends ClientEvent<MyCustomListener> {
     @Override
     public void dispatchTo(MyCustomListener listener) {
         listener.onEvent(this);
     }
 }
 
Since:
2016
Version:
1.0
Author:
Marvin P. Warble Jr.
See Also:
  • Constructor Details

    • ClientEvent

      protected ClientEvent()
      Constructs a new ClientEvent with default settings.

      Creates a non-bubbling event by passing false to the parent Event constructor. This constructor is protected to ensure that only subclasses can instantiate client events.

  • Method Details

    • setSource

      public void setSource(Element source)
      Sets the source element for this event.

      The source element represents the HTML element that originated this event, typically the element on which the user interaction occurred.

      Parameters:
      source - the HTML element that is the source of this event
    • setTarget

      public void setTarget(Element target)
      Sets the target element for this event.

      The target element represents the HTML element that is the intended recipient or target of this event. In some cases, this may differ from the source element due to event delegation or bubbling.

      Parameters:
      target - the HTML element that is the target of this event
    • getSource

      public Element getSource()
      Returns the source element of this event.

      The source element is the HTML element that originated this event.

      Returns:
      the HTML element that is the source of this event, or null if not set
    • getTarget

      public Element getTarget()
      Returns the target element of this event.

      The target element is the HTML element that is the intended recipient of this event.

      Returns:
      the HTML element that is the target of this event, or null if not set