class sap.ui.fl.variants.VariantModel

Visiblity: restricted
UX Guidelines:
Implements:
Available since: N/A
Module: sap/ui/fl/variants/VariantModel
Application Component: CA-UI5-FL

Variant model implementation for JSON format.


Constructor

Constructor for a new sap.ui.fl.variants.VariantModel model.

new sap.ui.fl.variants.VariantModel(oData, mPropertyBag)
Param Type Default Value Description
oData object

Either the URL where to load the JSON from or a JS object

mPropertyBag object

Map of properties required for the constructor

flexController sap.ui.fl.FlexController

FlexController instance for the component which uses the variant model

appComponent sap.ui.core.Component

Application component instance that is currently loading


Methods Overview

Method Description
checkDirtyStateForControlModels

Checks if dirty changes exist for the current variant inside the passed variant management reference. If no dirty changes exist, it marks the associated 'modified' model property to false.

sap.ui.fl.variants.VariantModel.extend

Creates a new subclass of class sap.ui.fl.variants.VariantModel 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.model.json.JSONModel.extend.

getCurrentVariantReference

Returns the current variant for a given variant management control.

sap.ui.fl.variants.VariantModel.getMetadata

Returns a metadata object for class sap.ui.fl.variants.VariantModel.

manageVariants

Opens the Manage Views dialog. Returns a promise which resolves to changes made from the manage dialog, based on the parameters passed.

setVariantProperties

Sets the passed properties on a variant for the passed variant management reference and returns the content for change creation

checkDirtyStateForControlModels

Checks if dirty changes exist for the current variant inside the passed variant management reference. If no dirty changes exist, it marks the associated 'modified' model property to false.

Param Type DefaultValue Description
aVariantManagementReferences string[]

Array of variant management references

sap.ui.fl.variants.VariantModel.extend

Creates a new subclass of class sap.ui.fl.variants.VariantModel 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.model.json.JSONModel.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

getCurrentVariantReference

Returns the current variant for a given variant management control.

Param Type DefaultValue Description
sVariantManagementReference string

Variant management reference

sap.ui.fl.variants.VariantModel.getMetadata

Returns a metadata object for class sap.ui.fl.variants.VariantModel.

manageVariants

Opens the Manage Views dialog. Returns a promise which resolves to changes made from the manage dialog, based on the parameters passed.

Param Type DefaultValue Description
oVariantManagementControl sap.ui.fl.variants.VariantManagement

Variant management control

sVariantManagementReference String

Variant management reference

sLayer String

Current layer

sClass String

Style class assigned to the management dialog

oContextSharingComponentPromise Promise<sap.ui.core.ComponentContainer>

Promise resolving with the ComponentContainer

setVariantProperties

Sets the passed properties on a variant for the passed variant management reference and returns the content for change creation

Param Type DefaultValue Description
sVariantManagementReference sap.ui.fl.variants.VariantManagement

Variant management reference

mPropertyBag Object

Map of properties

variantReference String

Variant reference for which properties should be set

changeType String

Change type due to which properties are being set

layer String

Current layer

appComponent String

App component instance

title String

New app title value for setTitle change type

visible boolean

New visible value for setVisible change type

contexts object

New contexts object (e.g. roles) for setContexts change type

favorite boolean

New favorite value for setFavorite change type

executeOnSelect boolean

New executeOnSelect value for setExecuteOnSelect change type

defaultVariant String

New default variant for setDefault change type

bUpdateCurrentVariant boolean

Update current variant