Abstract Class sap.ui.base.EventProviderModule: sap/ui/base/EventProvider

extends Object

Provides eventing capabilities for objects like attaching or detaching event handlers for events which are notified when events are fired.

Constructor Summary
new sap.ui.base.EventProvider()Creates an instance of EventProvider.
Method Summary
sap.ui.base.EventProvider.extend(sClassName, oClassInfo?, FNMetaImpl?)Creates a new subclass of class sap.ui.base.EventProvider with name sClassName and enriches it with the information contained in oClassInfo.
sap.ui.base.EventProvider.getMetadata()Returns a metadata object for class sap.ui.base.EventProvider.
attachEvent(sEventId, oData?, fnFunction, oListener?)Attaches an event handler to the event with the given identifier.
attachEventOnce(sEventId, oData?, fnFunction, oListener?)Attaches an event handler, called one time only, to the event with the given identifier.
destroy()Cleans up the internal structures and removes all event handlers.
detachEvent(sEventId, fnFunction, oListener?)Removes a previously attached event handler from the event with the given identifier.
fireEvent(sEventId, mParameters?, bAllowPreventDefault?, bEnableEventBubbling?)Fires an event with the given settings and notifies all attached event handlers.
getEventingParent()Returns the parent in the eventing hierarchy of this object.
hasListeners(sEventId)Returns whether there are any registered event handlers for the event with the given identifier.
toString()Returns a string representation of this object.
Methods borrowed from class sap.ui.base.Object
Constructor Detail
new sap.ui.base.EventProvider()
Creates an instance of EventProvider.
Method Detail
sap.ui.base.EventProvider.extend(sClassName, oClassInfo?, FNMetaImpl?): function
Creates a new subclass of class sap.ui.base.EventProvider with name sClassName and enriches it with the information contained in oClassInfo.

oClassInfo might contain the same kind of information as described in sap.ui.base.Object.extend.

Parameters:
{string}sClassName Name of the class being created
{object}oClassInfo? Object literal with information about the class
{function}FNMetaImpl? Constructor function for the metadata object; if not given, it defaults to sap.ui.core.ElementMetadata
Returns:
{function} Created class / constructor function
sap.ui.base.EventProvider.getMetadata(): sap.ui.base.Metadata
Returns a metadata object for class sap.ui.base.EventProvider.
Returns:
{sap.ui.base.Metadata} Metadata object describing this class
attachEvent(sEventId, oData?, fnFunction, oListener?): sap.ui.base.EventProvider
Attaches an event handler to the event with the given identifier.
Parameters:
{string}sEventId The identifier of the event to listen for
{object}oData? An object that will be passed to the handler along with the event object when the event is fired
{function}fnFunction The handler function to call when the event occurs. This function will be called in the context of the oListener instance (if present) or on the event provider instance. The event object (sap.ui.base.Event) is provided as first argument of the handler. Handlers must not change the content of the event. The second argument is the specified oData instance (if present).
{object}oListener? The object that wants to be notified when the event occurs (this context within the handler function). If it is not specified, the handler function is called in the context of the event provider.
Returns:
{sap.ui.base.EventProvider} Returns this to allow method chaining
attachEventOnce(sEventId, oData?, fnFunction, oListener?): sap.ui.base.EventProvider
Attaches an event handler, called one time only, to the event with the given identifier.

When the event occurs, the handler function is called and the handler registration is automatically removed afterwards.

Parameters:
{string}sEventId The identifier of the event to listen for
{object}oData? An object that will be passed to the handler along with the event object when the event is fired
{function}fnFunction The handler function to call when the event occurs. This function will be called in the context of the oListener instance (if present) or on the event provider instance. The event object (sap.ui.base.Event) is provided as first argument of the handler. Handlers must not change the content of the event. The second argument is the specified oData instance (if present).
{object}oListener? The object that wants to be notified when the event occurs (this context within the handler function). If it is not specified, the handler function is called in the context of the event provider.
Returns:
{sap.ui.base.EventProvider} Returns this to allow method chaining
destroy()
Cleans up the internal structures and removes all event handlers.

The object must not be used anymore after destroy was called.

See:
sap.ui.base.Object#destroy
detachEvent(sEventId, fnFunction, oListener?): sap.ui.base.EventProvider
Removes a previously attached event handler from the event with the given identifier.

The passed parameters must match those used for registration with attachEvent beforehand.

Parameters:
{string}sEventId The identifier of the event to detach from
{function}fnFunction The handler function to detach from the event
{object}oListener? The object that wanted to be notified when the event occurred
Returns:
{sap.ui.base.EventProvider} Returns this to allow method chaining
fireEvent(sEventId, mParameters?, bAllowPreventDefault?, bEnableEventBubbling?): sap.ui.base.EventProvider|boolean
Fires an event with the given settings and notifies all attached event handlers.
Parameters:
{string}sEventId The identifier of the event to fire
{object}mParameters? The parameters which should be carried by the event
{boolean}bAllowPreventDefault? Defines whether function preventDefault is supported on the fired event
{boolean}bEnableEventBubbling? Defines whether event bubbling is enabled on the fired event. Set to true the event is also forwarded to the parent(s) of the event provider (getEventingParent) until the bubbling of the event is stopped or no parent is available anymore.
Returns:
{sap.ui.base.EventProvider|boolean} Returns this to allow method chaining. When preventDefault is supported on the fired event the function returns true if the default action should be executed, false otherwise.
getEventingParent(): sap.ui.base.EventProvider
Returns the parent in the eventing hierarchy of this object.

Per default this returns null, but if eventing is used in objects, which are hierarchically structured, this can be overwritten to make the object hierarchy visible to the eventing and enables the use of event bubbling within this object hierarchy.

Returns:
{sap.ui.base.EventProvider} The parent event provider
hasListeners(sEventId): boolean
Returns whether there are any registered event handlers for the event with the given identifier.
Parameters:
{string}sEventId The identifier of the event
Returns:
{boolean} Whether there are any registered event handlers
toString(): string
Returns a string representation of this object.

In case there is no class or id information, a simple static string is returned. Subclasses should override this method.

Returns:
{string} A string description of this event provider