Package net.arcadiusmc.dom.event
Interface EventTarget
- All Known Subinterfaces:
ButtonElement,Document,Element,ItemElement
public interface EventTarget
An object which can host event listeners and be the target of
Event dispatches-
Method Summary
Modifier and TypeMethodDescriptionvoidaddEventListener(String eventType, EventListener listener) Adds an event listener to the specified type.voiddispatchEvent(Event event) Dispatches an event.booleanremoveEventListener(String eventType, EventListener listener) Removes an event listener.
-
Method Details
-
addEventListener
Adds an event listener to the specified type.- Parameters:
eventType- Event typelistener- Event listener- Throws:
NullPointerException- if eithereventTypeorlistenerisnull
-
removeEventListener
Removes an event listener.If either the
eventTypeorlistenerisnull, this return false.- Parameters:
eventType- Event typelistener- Event listener- Returns:
true, if the listener was registered for the specifiedeventTypeand was removed,falseotherwise.- Throws:
NullPointerException- if eithereventTypeorlistenerisnull
-
dispatchEvent
Dispatches an event.Events are executed first by the target they are dispatched on. Then, if the event is set to bubble (with
Event.isBubbling()) then it will bubble up through the document tree.
Finally, the event will be dispatched toDocument.getGlobalTarget(), unless the event has been cancelled.- Parameters:
event- Event to dispatch- Throws:
NullPointerException- ifeventisnull
-