class sap.ui.vtm.Extension

Control sample: sap.ui.vtm.Extension
Visiblity: public
UX Guidelines:
Implements:
Available since: N/A
Module: sap/ui/vtm/Extension
Application Component:

A base class for extensions.

Extensions provide an extensibility mechanism through which behaviors can be added, allowing for a default set of behaviors that can be overridden by application developers. Extensions react to events raised by VTM elements/controls or other extensions.

Derived classes should provide their own #initialize implementation. Extensions are expected to be as independent from one another as possible.

Extensions implement interfaces to indicate the functional role(s) that they fulfill. Extensions can be found by interface calling getExtensionByInterface. Specific extensions can be found using getExtensionByName. Typically extensions are retrieved using these methods in order to get or set their enabled property.


Constructor

This class is an abstract class that is not intended to be instantiated directly.

Accepts an object literal mSettings that defines initial property values, aggregated and associated objects as well as event handlers. See sap.ui.base.ManagedObject#constructor for a general description of the syntax of the settings object.

new sap.ui.vtm.Extension(sId, mSettings)
Param Type Default Value Description
sId string

id for the new sap.m.Extension instance.

mSettings object

Object with initial property values, aggregated objects etc. for the new sap.m.Extension instance.


Properties

Name Type Default Value Description
enabled boolean true

Controls whether the extension is enabled.

Visibility: public

Events Overview

Event Description
enabledChanged

Fired when the enabled property is changed.

initialized

Fired when initialization has completed.

enabledChanged

Fired when the enabled property is changed.

Param Type Description
oControlEvent sap.ui.base.Event
getSource sap.ui.base.EventProvider
getParameters object

initialized

Fired when initialization has completed.

Param Type Description
oControlEvent sap.ui.base.Event
getSource sap.ui.base.EventProvider
getParameters object

Methods Overview

Method Description
applyPanelHandler

Calls a function once for each panel that is attached (currently or in the future) to the sap.ui.vtm.Vtm instance that owns this extension.

This function should only be used after the Promise returned by #getVtmPromise has resolved.

attachEnabledChanged

Attaches event handler fnFunction to the enabledChanged event of this sap.ui.vtm.Extension.

When called, the context of the event handler (its this) will be bound to oListener if specified, otherwise it will be bound to this sap.ui.vtm.Extension itself.

Fired when the enabled property is changed.

attachInitialized

Attaches event handler fnFunction to the initialized event of this sap.ui.vtm.Extension.

When called, the context of the event handler (its this) will be bound to oListener if specified, otherwise it will be bound to this sap.ui.vtm.Extension itself.

Fired when initialization has completed.

bindEnabled

Binds property enabled to model data.

See ManagedObject.bindProperty for a detailed description of the possible properties of oBindingInfo

detachEnabledChanged

Detaches event handler fnFunction from the enabledChanged event of this sap.ui.vtm.Extension.

The passed function and listener object must match the ones used for event registration.

detachInitialized

Detaches event handler fnFunction from the initialized event of this sap.ui.vtm.Extension.

The passed function and listener object must match the ones used for event registration.

sap.ui.vtm.Extension.extend

Creates a new subclass of class sap.ui.vtm.Extension 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.core.Element.extend.

fireEnabledChanged

Fires event enabledChanged to attached listeners.

fireInitialized

Fires event initialized to attached listeners.

getEnabled

Gets current value of property enabled.

Controls whether the extension is enabled.

Default value is true.

getInitializedPromise

Gets a Promise that resolves after the initialize method has been called for the extension.

The initialize method is called after the Promise returned by getVtmPromise resolves.

sap.ui.vtm.Extension.getMetadata

Returns a metadata object for class sap.ui.vtm.Extension.

getVtmPromise

Gets a Promise that resolves when the extension is added to the extensions aggregation of an sap.ui.vtm.Vtm instance.

The relevant sap.ui.vtm.Vtm instance is passed to the resolve handler.

initialize

Contains initialization code for the extension. Derived classes must redefine this method.

setEnabled

Sets a new value for property enabled.

Controls whether the extension is enabled.

When called with a value of null or undefined, the default value of the property will be restored.

Default value is true.

unbindEnabled

Unbinds property enabled from model data.

applyPanelHandler

Calls a function once for each panel that is attached (currently or in the future) to the sap.ui.vtm.Vtm instance that owns this extension.

This function should only be used after the Promise returned by #getVtmPromise has resolved.

Param Type DefaultValue Description
panelHandler function

A function that takes one sap.ui.vtm.Panel argument.

attachEnabledChanged

Attaches event handler fnFunction to the enabledChanged event of this sap.ui.vtm.Extension.

When called, the context of the event handler (its this) will be bound to oListener if specified, otherwise it will be bound to this sap.ui.vtm.Extension itself.

Fired when the enabled property is changed.

Param Type DefaultValue Description
oData object

An application-specific payload object that will be passed to the event handler along with the event object when firing the event

fnFunction function(sap.ui.base.Event) : void

The function to be called when the event occurs

oListener object

Context object to call the event handler with. Defaults to this sap.ui.vtm.Extension itself

attachInitialized

Attaches event handler fnFunction to the initialized event of this sap.ui.vtm.Extension.

When called, the context of the event handler (its this) will be bound to oListener if specified, otherwise it will be bound to this sap.ui.vtm.Extension itself.

Fired when initialization has completed.

Param Type DefaultValue Description
oData object

An application-specific payload object that will be passed to the event handler along with the event object when firing the event

fnFunction function(sap.ui.base.Event) : void

The function to be called when the event occurs

oListener object

Context object to call the event handler with. Defaults to this sap.ui.vtm.Extension itself

bindEnabled

Binds property enabled to model data.

See ManagedObject.bindProperty for a detailed description of the possible properties of oBindingInfo

Param Type DefaultValue Description
oBindingInfo sap.ui.base.ManagedObject.PropertyBindingInfo

The binding information

detachEnabledChanged

Detaches event handler fnFunction from the enabledChanged event of this sap.ui.vtm.Extension.

The passed function and listener object must match the ones used for event registration.

Param Type DefaultValue Description
fnFunction function(sap.ui.base.Event) : void

The function to be called, when the event occurs

oListener object

Context object on which the given function had to be called

detachInitialized

Detaches event handler fnFunction from the initialized event of this sap.ui.vtm.Extension.

The passed function and listener object must match the ones used for event registration.

Param Type DefaultValue Description
fnFunction function(sap.ui.base.Event) : void

The function to be called, when the event occurs

oListener object

Context object on which the given function had to be called

sap.ui.vtm.Extension.extend

Creates a new subclass of class sap.ui.vtm.Extension 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.core.Element.extend.

Param Type DefaultValue Description
sClassName string

Name of the class being created

oClassInfo object

Object literal with information about the class

FNMetaImpl function

Constructor function for the metadata object; if not given, it defaults to the metadata implementation used by this class

fireEnabledChanged

Fires event enabledChanged to attached listeners.

Param Type DefaultValue Description
mParameters object

Parameters to pass along with the event

fireInitialized

Fires event initialized to attached listeners.

Param Type DefaultValue Description
mParameters object

Parameters to pass along with the event

getEnabled

Gets current value of property enabled.

Controls whether the extension is enabled.

Default value is true.

getInitializedPromise

Gets a Promise that resolves after the initialize method has been called for the extension.

The initialize method is called after the Promise returned by getVtmPromise resolves.

sap.ui.vtm.Extension.getMetadata

Returns a metadata object for class sap.ui.vtm.Extension.

getVtmPromise

Gets a Promise that resolves when the extension is added to the extensions aggregation of an sap.ui.vtm.Vtm instance.

The relevant sap.ui.vtm.Vtm instance is passed to the resolve handler.

initialize

Contains initialization code for the extension. Derived classes must redefine this method.

Param Type DefaultValue Description
vtm sap.ui.vtm.Vtm

The sap.ui.vtm.Vtm instance that this extension belongs to.

setEnabled

Sets a new value for property enabled.

Controls whether the extension is enabled.

When called with a value of null or undefined, the default value of the property will be restored.

Default value is true.

Param Type DefaultValue Description
bEnabled boolean true

New value for property enabled

unbindEnabled

Unbinds property enabled from model data.