Interface EventTarget
- All Known Subinterfaces:
 BodyElement,ButtonElement,CanvasElement,ComponentElement,DelphiElement,Document,Element,HeadElement,InputElement,ItemElement,JavaObjectElement,OptionElement,ScriptElement,StyleElement
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.Get the attribute addition listener.Get the option addition listener.Get the append listener.Get the attribute change listener.Get the left-click listener@Nullable EventListenerGet the DOM closing listener.Get the input listener.Get the DOM loaded listener.Get the mouse enter listener.Get the mouse exit listener.Get the mouse move listener.Get the option change listener.Get the attribute remove listener.Get the remove child listener.Get the option removal listener.Get the right-click listenerGet the attribute set listener.Get the option set listener.@Nullable EventListenerGet the DOM spawned listener.voidSet the attribute addition listener.voidonAddOption(EventListener.Typed<AttributeMutateEvent> listener) Set the option addition listener.voidonAppendChild(EventListener.Typed<MutationEvent> listener) Set the append listener.voidSet the attribute change listener.voidonClick(EventListener.Typed<MouseEvent> listener) Set the click listener.voidonClosing(@Nullable EventListener listener) Set the DOM closing listener.voidonInput(EventListener.Typed<InputEvent> listener) Set the input listener.voidonLoaded(@Nullable EventListener listener) Set the DOM loaded listener.voidonMouseEnter(EventListener.Typed<MouseEvent> listener) Set the mouse enter listener.voidonMouseExit(EventListener.Typed<MouseEvent> listener) Set the mouse exit listener.voidonMouseMove(EventListener.Typed<MouseEvent> listener) Set the mouse move listener.voidSet the option change listener.voidSet the attribute removal listener.voidonRemoveChild(EventListener.Typed<MutationEvent> listener) Set the remove child listener.voidSet the option removal listener.voidonRightClick(EventListener.Typed<MouseEvent> listener) Set the right-click listener.voidSet the attribute set listener.voidonSetOption(EventListener.Typed<AttributeMutateEvent> listener) Set the option set listener.voidonSpawned(@Nullable EventListener listener) Set the DOM spawned listener.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
 - 
onClick
Set the click listener. The set listener will only be called when a player left-clicks the target.Can be removed by setting this to
nulland overridden by calling this method againListens to
EventTypes.CLICKevents.- Parameters:
 listener- Click listener
 - 
getOnClick
Get the left-click listener- Returns:
 - Click listener, or 
null, if not set 
 - 
onRightClick
Set the right-click listener.Can be removed by setting this to
nulland overridden by calling this method againListens to
EventTypes.CLICKevents.- Parameters:
 listener- Right click listener
 - 
getOnRightClick
Get the right-click listener- Returns:
 - Click listener, or 
null, if not set 
 - 
onMouseEnter
Set the mouse enter listener. The listener is called when a player's cursor enters the target.Can be removed by setting this to
nulland overridden by calling this method againListens to
EventTypes.MOUSE_ENTERevents.- Parameters:
 listener- Mouse enter listener
 - 
getOnMouseEnter
Get the mouse enter listener.- Returns:
 - Mouse enter listener, or 
null, if not set 
 - 
onMouseExit
Set the mouse exit listener. The listener is called when a player's cursor exits the target.Can be removed by setting this to
nulland overridden by calling this method againListens to
EventTypes.MOUSE_LEAVEevents.- Parameters:
 listener- Mouse exit listener
 - 
getOnMouseExit
Get the mouse exit listener.- Returns:
 - Mouse exit listener, or 
null, if not set 
 - 
onMouseMove
Set the mouse move listener. The listener is only called when a player's cursor moves inside the target. If a player's cursor exits or enters the target, the listener is not called.Can be removed by setting this to
nulland overridden by calling this method againListens to
EventTypes.MOUSE_MOVEevents.- Parameters:
 listener- Mouse move listener
 - 
getOnMouseMove
Get the mouse move listener.- Returns:
 - Mouse move listener, or 
null, if not set 
 - 
onAppendChild
Set the append listener. The listener is called when a childNodeis appended to the target.Can be removed by setting this to
nulland overridden by calling this method againListens to
EventTypes.APPEND_CHILDevents.- Parameters:
 listener- Child append listener
 - 
getOnAppendChild
Get the append listener.- Returns:
 - append listener, or 
null, if not set 
 - 
onRemoveChild
Set the remove child listener. The listener is called when a childNodeis removed from the target.Can be removed by setting this to
nulland overridden by calling this method againListens to
EventTypes.REMOVE_CHILDevents.- Parameters:
 listener- Child remove listener
 - 
getOnRemoveChild
Get the remove child listener.- Returns:
 - remove child listener, or 
null, if not set 
 - 
onAttributeChange
Set the attribute change listener. The listener is called whenever any change is made to an attribute's value.Can be removed by setting this to
nulland overridden by calling this method againListens to
EventTypes.MODIFY_ATTRevents.- Parameters:
 listener- Attribute listener
 - 
getOnAttributeChange
Get the attribute change listener.- Returns:
 - attribute change listener, or 
null, if not set 
 - 
onSetAttribute
Set the attribute set listener. The listener is called whenever an existing attribute's value is set.Can be removed by setting this to
nulland overridden by calling this method againListens to
EventTypes.MODIFY_ATTRevents.- Parameters:
 listener- Attribute set listener
 - 
getOnSetAttribute
Get the attribute set listener.- Returns:
 - attribute set listener, or 
null, if not set 
 - 
onRemoveAttribute
Set the attribute removal listener. The listener is called whenever an existing attribute's value is removed.Can be removed by setting this to
nulland overridden by calling this method againListens to
EventTypes.MODIFY_ATTRevents.- Parameters:
 listener-
 - 
getOnRemoveAttribute
Get the attribute remove listener.- Returns:
 - attribute remove listener, or 
null, if not set 
 - 
onAddAttribute
Set the attribute addition listener. The listener is called whenever a new attribute is set.Can be removed by setting this to
nulland overridden by calling this method againListens to
EventTypes.MODIFY_ATTRevents.- Parameters:
 listener- Attribute addition listener
 - 
getOnAddAttribute
Get the attribute addition listener.- Returns:
 - attribute addition listener, or 
null, if not set 
 - 
onOptionChange
Set the option change listener. The listener is called whenever any change is made to an document option's value.Can be removed by setting this to
nulland overridden by calling this method againListens to
EventTypes.MODIFY_OPTIONevents.- Parameters:
 listener- Option listener
 - 
getOnOptionChange
Get the option change listener.- Returns:
 - option change listener, or 
null, if not set 
 - 
onSetOption
Set the option set listener. The listener is called whenever an existing document option's value is set.Can be removed by setting this to
nulland overridden by calling this method againListens to
EventTypes.MODIFY_OPTIONevents.- Parameters:
 listener- Option set listener
 - 
getOnSetOption
Get the option set listener.- Returns:
 - option set listener, or 
null, if not set 
 - 
onRemoveOption
Set the option removal listener. The listener is called whenever an existing document option's value is removed.Can be removed by setting this to
nulland overridden by calling this method againListens to
EventTypes.MODIFY_OPTIONevents.- Parameters:
 listener- Option remove listener
 - 
getOnRemoveOption
Get the option removal listener.- Returns:
 - option removal listener, or 
null, if not set 
 - 
onAddOption
Set the option addition listener. The listener is called whenever a new document option is set.Can be removed by setting this to
nulland overridden by calling this method againListens to
EventTypes.MODIFY_OPTIONevents.- Parameters:
 listener- Option addition listener
 - 
getOnAddOption
Get the option addition listener.- Returns:
 - option addition listener, or 
null, if not set 
 - 
onInput
Set the input listener. The listener is called whenever the input of anInputElementis changed, either by player or by calling theInputElement.setValue(String)method.Can be removed by setting this to
nulland overridden by calling this method againListens to
EventTypes.INPUTevents.- Parameters:
 listener- Input listener
 - 
getOnInput
Get the input listener.- Returns:
 - input listener, or 
null, if not set 
 - 
onLoaded
Set the DOM loaded listener. The listener is called when the DOM tree is finished loading.Can be removed by setting this to
nulland overridden by calling this method againListens to
EventTypes.DOM_LOADEDevents.- Parameters:
 listener- DOM loaded listener
 - 
getOnLoaded
Get the DOM loaded listener.- Returns:
 - DOM loaded listener, or 
null, if not set 
 - 
onSpawned
Set the DOM spawned listener. The listener is called when the document view is spawned and becomes visible to players.Can be removed by setting this to
nulland overridden by calling this method againListens to
EventTypes.DOM_SPAWNEDevents.- Parameters:
 listener- Spawn listener
 - 
getOnSpawned
Get the DOM spawned listener.- Returns:
 - DOM spawned listener, or 
null, if not set 
 - 
onClosing
Set the DOM closing listener. The listener is called when the document view starts closing.Can be removed by setting this to
nulland overridden by calling this method againListens to
EventTypes.DOM_CLOSINGevents.- Parameters:
 listener- Closing listener
 - 
getOnClosing
Get the DOM closing listener.- Returns:
 - DOM closing listener, or 
null, if not set 
 
 -