Class sap.ui.comp.smartvariants.SmartVariantManagementModule: sap/ui/comp/smartvariants/SmartVariantManagement


The SmartVariantManagement control is a specialization of the VariantManagement control and communicates with the layer that offers SAPUI5 flexibility services to manage the variants.
For more information about SAPUI5 flexibility, refer to the Developer Guide.

Constructor Summary
new sap.ui.comp.smartvariants.SmartVariantManagement(sId?, mSettings?)Constructor for a new SmartVariantManagement.
Event Summary
afterSave(oControlEvent)This event is fired after a variant has been saved.
initialise(oControlEvent)This event is fired when the SmartVariantManagement control is initialized.
Events borrowed from class sap.ui.core.Control
Method Summary
sap.ui.comp.smartvariants.SmartVariantManagement.extend(sClassName, oClassInfo?, FNMetaImpl?)Creates a new subclass of class sap.ui.comp.smartvariants.SmartVariantManagement with name sClassName and enriches it with the information contained in oClassInfo.
sap.ui.comp.smartvariants.SmartVariantManagement.getMetadata()Returns a metadata object for class sap.ui.comp.smartvariants.SmartVariantManagement.
addPersonalizableControl(oCurrentControlInfo)Registers all controls interested and relying on variant handling.
attachAfterSave(oData?, fnFunction, oListener?)Attaches event handler fnFunction to the afterSave event of this sap.ui.comp.smartvariants.SmartVariantManagement.
destroyPersonalizableControls()Destroys all the personalizableControls in the aggregation personalizableControls.
detachAfterSave(fnFunction, oListener)Detaches event handler fnFunction from the afterSave event of this sap.ui.comp.smartvariants.SmartVariantManagement.
exit()Destroys the control.
fireAfterSave(mArguments?)Fires event afterSave to attached listeners.
fireManage(oVariantInfo)Eventhandler for the manage event of the VariantManagement control.
fireSave(oVariantInfo)Eventhandler for the save event of the VariantManagement control.
fireSelect(oVariantInfo)Eventhandler for the select event of the VariantManagement control.
getCurrentVariantId()Retrieves the current variant ID.
getPersistencyKey()Gets current value of property persistencyKey.
getPersonalizableControls()Gets content of aggregation personalizableControls.
getStandardVariant(oCurrentControl)Returns the standard variant.
getVariantContent(oControl, sKey)Retrieves the variant content.
indexOfPersonalizableControl(oPersonalizableControl)Checks for the provided sap.ui.comp.smartvariants.PersonalizableInfo in the aggregation personalizableControls.
init()control initialization
initialise(fCallback, oPersoControl)Initializes the SAPUI5 layer with the flexibility services by retrieving the list of variants.
insertPersonalizableControl(oPersonalizableControl, iIndex)Inserts a personalizableControl into the aggregation personalizableControls.
isPageVariant()Determines if the SmartVariantManagement instance is a page variant.
removeAllPersonalizableControls()Removes all the controls from the aggregation personalizableControls.
removePersonalizableControl(vPersonalizableControl)Removes a personalizableControl from the aggregation personalizableControls.
setCurrentVariantId(sVariantKey, bDoNotApplyVariant)Sets the current variant ID.
setPersistencyKey(sPersistencyKey)Sets a new value for property persistencyKey.
attachInitialise(oData?, fnFunction, oListener?)Attaches event handler fnFunction to the initialise event of this sap.ui.comp.smartvariants.SmartVariantManagement.
detachInitialise(fnFunction, oListener)Detaches event handler fnFunction from the initialise event of this sap.ui.comp.smartvariants.SmartVariantManagement.
fireInitialise(mArguments?)Fires event initialise to attached listeners.
Constructor Detail
new sap.ui.comp.smartvariants.SmartVariantManagement(sId?, mSettings?)
Constructor for a new SmartVariantManagement.
The call sequence is as follows:
A control for which personalization is used has to be registered first via the personalizableControls association. Then it has to call the initialise method with the arguments fCallback function which will be called once the personalization data has been retrieved and oPersoControl, the control itself.
Note: the function callback has to be defined in the personalizable control.
The old behavior, where the control has to register to the initialise event, before the initialise method call, should not be used any longer and is not supported at all for the page variant scenarios.

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

The supported settings are:

  • Properties
  • Aggregations
  • Events
    • initialise : fnListenerFunction or [fnListenerFunction, oListenerObject] or [oData, fnListenerFunction, oListenerObject]
    • afterSave : fnListenerFunction or [fnListenerFunction, oListenerObject] or [oData, fnListenerFunction, oListenerObject]

In addition, all settings applicable to the base type sap.ui.comp.variants.VariantManagement can be used as well.

Parameters:
{string}sId? ID for the new control, generated automatically if no ID is given
{object}mSettings? initial settings for the new control
Event Detail
afterSave(oControlEvent)
This event is fired after a variant has been saved. This event can be used to retrieve the ID of the saved variant.
Parameters:
{sap.ui.base.Event}oControlEvent
{sap.ui.base.EventProvider}oControlEvent.getSource
{object}oControlEvent.getParameters
initialise(oControlEvent)
This event is fired when the SmartVariantManagement control is initialized.
Parameters:
{sap.ui.base.Event}oControlEvent
{sap.ui.base.EventProvider}oControlEvent.getSource
{object}oControlEvent.getParameters
Deprecated:
Since version 1.38.0. Replaced by providing the personalizable control and the callback via the initialise-method.
Method Detail
sap.ui.comp.smartvariants.SmartVariantManagement.extend(sClassName, oClassInfo?, FNMetaImpl?): function
Creates a new subclass of class sap.ui.comp.smartvariants.SmartVariantManagement 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.comp.variants.VariantManagement.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.comp.smartvariants.SmartVariantManagement.getMetadata(): sap.ui.base.Metadata
Returns a metadata object for class sap.ui.comp.smartvariants.SmartVariantManagement.
Returns:
{sap.ui.base.Metadata} Metadata object describing this class
addPersonalizableControl(oCurrentControlInfo)
Registers all controls interested and relying on variant handling.
Parameters:
{sap.ui.comp.smartvariants.PersonalizableInfo}oCurrentControlInfo Provides information about the personalizable control.
attachAfterSave(oData?, fnFunction, oListener?): sap.ui.comp.smartvariants.SmartVariantManagement
Attaches event handler fnFunction to the afterSave event of this sap.ui.comp.smartvariants.SmartVariantManagement.

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.comp.smartvariants.SmartVariantManagement itself.

This event is fired after a variant has been saved. This event can be used to retrieve the ID of the saved variant.

Parameters:
{object}oData? An application-specific payload object that will be passed to the event handler along with the event object when firing the event
{function}fnFunction The function to be called when the event occurs
{object}oListener? Context object to call the event handler with. Defaults to this sap.ui.comp.smartvariants.SmartVariantManagement itself
Returns:
{sap.ui.comp.smartvariants.SmartVariantManagement} Reference to this in order to allow method chaining
destroyPersonalizableControls(): sap.ui.comp.smartvariants.SmartVariantManagement
Destroys all the personalizableControls in the aggregation personalizableControls.
Returns:
{sap.ui.comp.smartvariants.SmartVariantManagement} Reference to this in order to allow method chaining
detachAfterSave(fnFunction, oListener): sap.ui.comp.smartvariants.SmartVariantManagement
Detaches event handler fnFunction from the afterSave event of this sap.ui.comp.smartvariants.SmartVariantManagement.

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

Parameters:
{function}fnFunction The function to be called, when the event occurs
{object}oListener Context object on which the given function had to be called
Returns:
{sap.ui.comp.smartvariants.SmartVariantManagement} Reference to this in order to allow method chaining
exit()
Destroys the control.
Fires event afterSave to attached listeners.
Parameters:
{Map}mArguments? The arguments to pass along with the event
Returns:
{sap.ui.comp.smartvariants.SmartVariantManagement} Reference to this in order to allow method chaining
fireManage(oVariantInfo)
Eventhandler for the manage event of the VariantManagement control. Raises the base class event for spacial handlings like save tile.
Parameters:
{object}oVariantInfo Describes the variants that will be deleted/renamed
fireSave(oVariantInfo)
Eventhandler for the save event of the VariantManagement control.
Parameters:
{object}oVariantInfo Describes the variant to be saved
fireSelect(oVariantInfo)
Eventhandler for the select event of the VariantManagement control.
Parameters:
{object}oVariantInfo Describes the selected variant
getCurrentVariantId(): string
Retrieves the current variant ID. For a standard variant, an empty string is returned.
Since:
1.28.1
Returns:
{string} Current variant ID
getPersistencyKey(): string
Gets current value of property persistencyKey.

Key used to access personalization data.

Returns:
{string} Value of property persistencyKey
getPersonalizableControls(): sap.ui.comp.smartvariants.PersonalizableInfo[]
Gets content of aggregation personalizableControls.

All controls that rely on variant handling have to be added to this aggregation.

Returns:
{sap.ui.comp.smartvariants.PersonalizableInfo[]}
getStandardVariant(oCurrentControl): Object
Returns the standard variant.
Parameters:
{sap.ui.core.Control}oCurrentControl Current personalizable control
Returns:
{Object} The standard variant.
getVariantContent(oControl, sKey): object
Retrieves the variant content.
Parameters:
{sap.ui.core.Control}oControl Current personalizable control
{string}sKey The variant key
Returns:
{object} JSON Representing the content of the variant
indexOfPersonalizableControl(oPersonalizableControl): int
Checks for the provided sap.ui.comp.smartvariants.PersonalizableInfo in the aggregation personalizableControls. and returns its index if found or -1 otherwise.
Parameters:
{sap.ui.comp.smartvariants.PersonalizableInfo}oPersonalizableControl The personalizableControl whose index is looked for
Returns:
{int} The index of the provided control in the aggregation if found, or -1 otherwise
init()
control initialization
Since:
1.26.1
initialise(fCallback, oPersoControl)
Initializes the SAPUI5 layer with the flexibility services by retrieving the list of variants. Once the initialization has been completed, the control for personalization is informed via the initialise event.
Parameters:
{function}fCallback Function will be called whenever the data for the personalizable control is received
{sap.ui.core.Control}oPersoControl Current control that can be personalized
insertPersonalizableControl(oPersonalizableControl, iIndex): sap.ui.comp.smartvariants.SmartVariantManagement
Inserts a personalizableControl into the aggregation personalizableControls.
Parameters:
{sap.ui.comp.smartvariants.PersonalizableInfo}oPersonalizableControl the personalizableControl to insert; if empty, nothing is inserted
{int}iIndex the 0-based index the personalizableControl should be inserted at; for a negative value of iIndex, the personalizableControl is inserted at position 0; for a value greater than the current size of the aggregation, the personalizableControl is inserted at the last position
Returns:
{sap.ui.comp.smartvariants.SmartVariantManagement} Reference to this in order to allow method chaining
isPageVariant(): boolean
Determines if the SmartVariantManagement instance is a page variant.
Returns:
{boolean}true if it is a page variant, otherwise false
removeAllPersonalizableControls(): sap.ui.comp.smartvariants.PersonalizableInfo[]
Removes all the controls from the aggregation personalizableControls.

Additionally, it unregisters them from the hosting UIArea.

Returns:
{sap.ui.comp.smartvariants.PersonalizableInfo[]} An array of the removed elements (might be empty)
removePersonalizableControl(vPersonalizableControl): sap.ui.comp.smartvariants.PersonalizableInfo
Removes a personalizableControl from the aggregation personalizableControls.
Parameters:
{int|string|sap.ui.comp.smartvariants.PersonalizableInfo}vPersonalizableControl The personalizableControlto remove or its index or id
Returns:
{sap.ui.comp.smartvariants.PersonalizableInfo} The removed personalizableControl or null
setCurrentVariantId(sVariantKey, bDoNotApplyVariant): void
Sets the current variant ID.
Parameters:
{string}sVariantKey The variant key
{boolean}bDoNotApplyVariant If set to true, the applyVariant method is not executed yet. Relevant during navigation, when called before the initialise event has been executed.
Since:
1.28.1
setPersistencyKey(sPersistencyKey): sap.ui.comp.smartvariants.SmartVariantManagement
Sets a new value for property persistencyKey.

Key used to access personalization data.

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

Parameters:
{string}sPersistencyKey New value for property persistencyKey
Returns:
{sap.ui.comp.smartvariants.SmartVariantManagement} Reference to this in order to allow method chaining
attachInitialise(oData?, fnFunction, oListener?): sap.ui.comp.smartvariants.SmartVariantManagement
Attaches event handler fnFunction to the initialise event of this sap.ui.comp.smartvariants.SmartVariantManagement.

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.comp.smartvariants.SmartVariantManagement itself.

This event is fired when the SmartVariantManagement control is initialized.

Parameters:
{object}oData? An application-specific payload object that will be passed to the event handler along with the event object when firing the event
{function}fnFunction The function to be called when the event occurs
{object}oListener? Context object to call the event handler with. Defaults to this sap.ui.comp.smartvariants.SmartVariantManagement itself
Deprecated:
Since version 1.38.0. Replaced by providing the personalizable control and the callback via the initialise-method.
Returns:
{sap.ui.comp.smartvariants.SmartVariantManagement} Reference to this in order to allow method chaining
detachInitialise(fnFunction, oListener): sap.ui.comp.smartvariants.SmartVariantManagement
Detaches event handler fnFunction from the initialise event of this sap.ui.comp.smartvariants.SmartVariantManagement.

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

Parameters:
{function}fnFunction The function to be called, when the event occurs
{object}oListener Context object on which the given function had to be called
Deprecated:
Since version 1.38.0. Replaced by providing the personalizable control and the callback via the initialise-method.
Returns:
{sap.ui.comp.smartvariants.SmartVariantManagement} Reference to this in order to allow method chaining
Fires event initialise to attached listeners.
Parameters:
{Map}mArguments? The arguments to pass along with the event
Deprecated:
Since version 1.38.0. Replaced by providing the personalizable control and the callback via the initialise-method.
Returns:
{sap.ui.comp.smartvariants.SmartVariantManagement} Reference to this in order to allow method chaining