Class ClientEvent<T extends ClientEventListener>
- 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
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 Summary
ConstructorsModifierConstructorDescriptionprotectedConstructs a new ClientEvent with default settings. -
Method Summary
Modifier and TypeMethodDescriptionReturns the source element of this event.Returns the target element of this event.voidSets the source element for this event.voidSets the target element for this event.Methods inherited from class com.oorian.messaging.events.Event
bubbles, dispatchTo
-
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
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
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
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
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
-