known direct subclasses: Binding,
Controller,
Delegate,
GraphicsCore,
HTMLViewSerializer,
HashChanger,
ItemNavigation,
ManagedObject,
MessageManager,
MessageProcessor,
NodeHierarchy,
ODataAnnotations,
ODataAnnotations,
ODataMetadata,
Route,
Router,
Scene,
SelectionModel,
Serializer,
Target,
Targets,
ViewSerializer,
Views,
WebSocket,
XMLViewSerializer
Provides eventing capabilities for objects like attaching or detaching event handlers for events which are notified when events are fired.
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
. 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. 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. 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 |
Returns a metadata object for class sap.ui.base.EventProvider.
Returns:
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:
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:
destroy()
Cleans up the internal structures and removes all event handlers.
The object must not be used anymore after destroy was called.
See:
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:
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. |
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:
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 |