id
int32 0
58k
| repo
stringlengths 5
67
| path
stringlengths 4
116
| func_name
stringlengths 0
58
| original_string
stringlengths 52
373k
| language
stringclasses 1
value | code
stringlengths 52
373k
| code_tokens
sequence | docstring
stringlengths 4
11.8k
| docstring_tokens
sequence | sha
stringlengths 40
40
| url
stringlengths 86
226
|
---|---|---|---|---|---|---|---|---|---|---|---|
3,900 | SAP/openui5 | src/sap.ui.core/src/sap/ui/core/Component.js | getManifestEntry | function getManifestEntry(oMetadata, oManifest, sKey, bMerged) {
var oData = oManifest.getEntry(sKey);
// merge / extend should only be done for objects or when entry wasn't found
if (oData !== undefined && !isPlainObject(oData)) {
return oData;
}
// merge the configuration of the parent manifest with local manifest
// the configuration of the static component metadata will be ignored
var oParent, oParentData;
if (bMerged && (oParent = oMetadata.getParent()) instanceof ComponentMetadata) {
oParentData = oParent.getManifestEntry(sKey, bMerged);
}
// only extend / clone if there is data
// otherwise "null" will be converted into an empty object
if (oParentData || oData) {
oData = jQuery.extend(true, {}, oParentData, oData);
}
return oData;
} | javascript | function getManifestEntry(oMetadata, oManifest, sKey, bMerged) {
var oData = oManifest.getEntry(sKey);
// merge / extend should only be done for objects or when entry wasn't found
if (oData !== undefined && !isPlainObject(oData)) {
return oData;
}
// merge the configuration of the parent manifest with local manifest
// the configuration of the static component metadata will be ignored
var oParent, oParentData;
if (bMerged && (oParent = oMetadata.getParent()) instanceof ComponentMetadata) {
oParentData = oParent.getManifestEntry(sKey, bMerged);
}
// only extend / clone if there is data
// otherwise "null" will be converted into an empty object
if (oParentData || oData) {
oData = jQuery.extend(true, {}, oParentData, oData);
}
return oData;
} | [
"function",
"getManifestEntry",
"(",
"oMetadata",
",",
"oManifest",
",",
"sKey",
",",
"bMerged",
")",
"{",
"var",
"oData",
"=",
"oManifest",
".",
"getEntry",
"(",
"sKey",
")",
";",
"// merge / extend should only be done for objects or when entry wasn't found",
"if",
"(",
"oData",
"!==",
"undefined",
"&&",
"!",
"isPlainObject",
"(",
"oData",
")",
")",
"{",
"return",
"oData",
";",
"}",
"// merge the configuration of the parent manifest with local manifest",
"// the configuration of the static component metadata will be ignored",
"var",
"oParent",
",",
"oParentData",
";",
"if",
"(",
"bMerged",
"&&",
"(",
"oParent",
"=",
"oMetadata",
".",
"getParent",
"(",
")",
")",
"instanceof",
"ComponentMetadata",
")",
"{",
"oParentData",
"=",
"oParent",
".",
"getManifestEntry",
"(",
"sKey",
",",
"bMerged",
")",
";",
"}",
"// only extend / clone if there is data",
"// otherwise \"null\" will be converted into an empty object",
"if",
"(",
"oParentData",
"||",
"oData",
")",
"{",
"oData",
"=",
"jQuery",
".",
"extend",
"(",
"true",
",",
"{",
"}",
",",
"oParentData",
",",
"oData",
")",
";",
"}",
"return",
"oData",
";",
"}"
] | Returns the configuration of a manifest section or the value for a
specific path. If no section or key is specified, the return value is null.
@param {sap.ui.core.ComponentMetadata} oMetadata the Component metadata
@param {sap.ui.core.Manifest} oManifest the manifest
@param {string} sKey Either the manifest section name (namespace) or a concrete path
@param {boolean} [bMerged] Indicates whether the manifest entry is merged with the manifest entries of the parent component.
@return {any|null} Value of the manifest section or the key (could be any kind of value)
@private
@see {@link sap.ui.core.Component#getManifestEntry} | [
"Returns",
"the",
"configuration",
"of",
"a",
"manifest",
"section",
"or",
"the",
"value",
"for",
"a",
"specific",
"path",
".",
"If",
"no",
"section",
"or",
"key",
"is",
"specified",
"the",
"return",
"value",
"is",
"null",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/Component.js#L102-L124 |
3,901 | SAP/openui5 | src/sap.ui.core/src/sap/ui/core/Component.js | createMetadataProxy | function createMetadataProxy(oMetadata, oManifest) {
// create a proxy for the metadata object and simulate to be an
// instance of the original metadata object of the Component
// => retrieving the prototype from the original metadata to
// support to proxy sub-classes of ComponentMetadata
var oMetadataProxy = Object.create(Object.getPrototypeOf(oMetadata));
// provide internal access to the static metadata object
oMetadataProxy._oMetadata = oMetadata;
oMetadataProxy._oManifest = oManifest;
// copy all functions from the metadata object except of the
// manifest related functions which will be instance specific now
for (var m in oMetadata) {
if (!/^(getManifest|getManifestObject|getManifestEntry|getMetadataVersion)$/.test(m) && typeof oMetadata[m] === "function") {
oMetadataProxy[m] = oMetadata[m].bind(oMetadata);
}
}
// return the content of the manifest instead of the static metadata
oMetadataProxy.getManifest = function() {
return oManifest && oManifest.getJson();
};
oMetadataProxy.getManifestObject = function() {
return oManifest;
};
oMetadataProxy.getManifestEntry = function(sKey, bMerged) {
return getManifestEntry(oMetadata, oManifest, sKey, bMerged);
};
oMetadataProxy.getMetadataVersion = function() {
return 2; // instance specific manifest => metadata version 2!
};
return oMetadataProxy;
} | javascript | function createMetadataProxy(oMetadata, oManifest) {
// create a proxy for the metadata object and simulate to be an
// instance of the original metadata object of the Component
// => retrieving the prototype from the original metadata to
// support to proxy sub-classes of ComponentMetadata
var oMetadataProxy = Object.create(Object.getPrototypeOf(oMetadata));
// provide internal access to the static metadata object
oMetadataProxy._oMetadata = oMetadata;
oMetadataProxy._oManifest = oManifest;
// copy all functions from the metadata object except of the
// manifest related functions which will be instance specific now
for (var m in oMetadata) {
if (!/^(getManifest|getManifestObject|getManifestEntry|getMetadataVersion)$/.test(m) && typeof oMetadata[m] === "function") {
oMetadataProxy[m] = oMetadata[m].bind(oMetadata);
}
}
// return the content of the manifest instead of the static metadata
oMetadataProxy.getManifest = function() {
return oManifest && oManifest.getJson();
};
oMetadataProxy.getManifestObject = function() {
return oManifest;
};
oMetadataProxy.getManifestEntry = function(sKey, bMerged) {
return getManifestEntry(oMetadata, oManifest, sKey, bMerged);
};
oMetadataProxy.getMetadataVersion = function() {
return 2; // instance specific manifest => metadata version 2!
};
return oMetadataProxy;
} | [
"function",
"createMetadataProxy",
"(",
"oMetadata",
",",
"oManifest",
")",
"{",
"// create a proxy for the metadata object and simulate to be an",
"// instance of the original metadata object of the Component",
"// => retrieving the prototype from the original metadata to",
"// support to proxy sub-classes of ComponentMetadata",
"var",
"oMetadataProxy",
"=",
"Object",
".",
"create",
"(",
"Object",
".",
"getPrototypeOf",
"(",
"oMetadata",
")",
")",
";",
"// provide internal access to the static metadata object",
"oMetadataProxy",
".",
"_oMetadata",
"=",
"oMetadata",
";",
"oMetadataProxy",
".",
"_oManifest",
"=",
"oManifest",
";",
"// copy all functions from the metadata object except of the",
"// manifest related functions which will be instance specific now",
"for",
"(",
"var",
"m",
"in",
"oMetadata",
")",
"{",
"if",
"(",
"!",
"/",
"^(getManifest|getManifestObject|getManifestEntry|getMetadataVersion)$",
"/",
".",
"test",
"(",
"m",
")",
"&&",
"typeof",
"oMetadata",
"[",
"m",
"]",
"===",
"\"function\"",
")",
"{",
"oMetadataProxy",
"[",
"m",
"]",
"=",
"oMetadata",
"[",
"m",
"]",
".",
"bind",
"(",
"oMetadata",
")",
";",
"}",
"}",
"// return the content of the manifest instead of the static metadata",
"oMetadataProxy",
".",
"getManifest",
"=",
"function",
"(",
")",
"{",
"return",
"oManifest",
"&&",
"oManifest",
".",
"getJson",
"(",
")",
";",
"}",
";",
"oMetadataProxy",
".",
"getManifestObject",
"=",
"function",
"(",
")",
"{",
"return",
"oManifest",
";",
"}",
";",
"oMetadataProxy",
".",
"getManifestEntry",
"=",
"function",
"(",
"sKey",
",",
"bMerged",
")",
"{",
"return",
"getManifestEntry",
"(",
"oMetadata",
",",
"oManifest",
",",
"sKey",
",",
"bMerged",
")",
";",
"}",
";",
"oMetadataProxy",
".",
"getMetadataVersion",
"=",
"function",
"(",
")",
"{",
"return",
"2",
";",
"// instance specific manifest => metadata version 2!",
"}",
";",
"return",
"oMetadataProxy",
";",
"}"
] | Utility function which creates a metadata proxy object for the given
metadata object
@param {sap.ui.core.ComponentMetadata} oMetadata the Component metadata
@param {sap.ui.core.Manifest} oManifest the manifest
@return {sap.ui.core.ComponentMetadata} a metadata proxy object | [
"Utility",
"function",
"which",
"creates",
"a",
"metadata",
"proxy",
"object",
"for",
"the",
"given",
"metadata",
"object"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/Component.js#L134-L170 |
3,902 | SAP/openui5 | src/sap.ui.core/src/sap/ui/core/Component.js | activateServices | function activateServices(oComponent) {
var oServices = oComponent.getManifestEntry("/sap.ui5/services");
for (var sService in oServices) {
if (oServices[sService].lazy === false) {
oComponent.getService(sService);
}
}
} | javascript | function activateServices(oComponent) {
var oServices = oComponent.getManifestEntry("/sap.ui5/services");
for (var sService in oServices) {
if (oServices[sService].lazy === false) {
oComponent.getService(sService);
}
}
} | [
"function",
"activateServices",
"(",
"oComponent",
")",
"{",
"var",
"oServices",
"=",
"oComponent",
".",
"getManifestEntry",
"(",
"\"/sap.ui5/services\"",
")",
";",
"for",
"(",
"var",
"sService",
"in",
"oServices",
")",
"{",
"if",
"(",
"oServices",
"[",
"sService",
"]",
".",
"lazy",
"===",
"false",
")",
"{",
"oComponent",
".",
"getService",
"(",
"sService",
")",
";",
"}",
"}",
"}"
] | Internal activation function for non lazy services which should be started immediately
@param {sap.ui.core.Component} oComponent The Component instance
@private | [
"Internal",
"activation",
"function",
"for",
"non",
"lazy",
"services",
"which",
"should",
"be",
"started",
"immediately"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/Component.js#L933-L940 |
3,903 | SAP/openui5 | src/sap.ui.core/src/sap/ui/core/Component.js | getPreloadModelConfigsFromManifest | function getPreloadModelConfigsFromManifest(oManifest, oComponentData, mCacheTokens) {
var mModelConfigs = {
afterManifest: {},
afterPreload: {}
};
// deep clone is needed as the mainfest only returns a read-only copy (freezed object)
var oManifestDataSources = jQuery.extend(true, {}, oManifest.getEntry("/sap.app/dataSources"));
var oManifestModels = jQuery.extend(true, {}, oManifest.getEntry("/sap.ui5/models"));
var mAllModelConfigurations = Component._createManifestModelConfigurations({
models: oManifestModels,
dataSources: oManifestDataSources,
manifest: oManifest,
componentData: oComponentData,
cacheTokens: mCacheTokens
});
// Read internal URI parameter to enable model preload for testing purposes
// Specify comma separated list of model names. Use an empty segment for the "default" model
// Examples:
// sap-ui-xx-preload-component-models-<componentName>=, => prelaod default model (empty string key)
// sap-ui-xx-preload-component-models-<componentName>=foo, => prelaod "foo" + default model (empty string key)
// sap-ui-xx-preload-component-models-<componentName>=foo,bar => prelaod "foo" + "bar" models
var sPreloadModels = new UriParameters(window.location.href).get("sap-ui-xx-preload-component-models-" + oManifest.getComponentName());
var aPreloadModels = sPreloadModels && sPreloadModels.split(",");
for (var sModelName in mAllModelConfigurations) {
var mModelConfig = mAllModelConfigurations[sModelName];
// activate "preload" flag in case URI parameter for testing is used (see code above)
if (!mModelConfig.preload && aPreloadModels && aPreloadModels.indexOf(sModelName) > -1 ) {
mModelConfig.preload = true;
Log.warning("FOR TESTING ONLY!!! Activating preload for model \"" + sModelName + "\" (" + mModelConfig.type + ")",
oManifest.getComponentName(), "sap.ui.core.Component");
}
// ResourceModels with async=false should be always loaded beforehand to get rid of sync requests under the hood (regardless of the "preload" flag)
if (mModelConfig.type === "sap.ui.model.resource.ResourceModel" &&
Array.isArray(mModelConfig.settings) &&
mModelConfig.settings.length > 0 &&
mModelConfig.settings[0].async !== true
) {
// Use separate config object for ResourceModels as the resourceBundle might be
// part of the Component-preload which isn't available when the regular "preloaded"-models are created
mModelConfigs.afterPreload[sModelName] = mModelConfig;
} else if (mModelConfig.preload) {
// Only create models:
// - which are flagged for preload (mModelConfig.preload) or activated via internal URI param (see above)
// - in case the model class is already loaded (otherwise log a warning)
if (sap.ui.loader._.getModuleState(mModelConfig.type.replace(/\./g, "/") + ".js")) {
mModelConfigs.afterManifest[sModelName] = mModelConfig;
} else {
Log.warning("Can not preload model \"" + sModelName + "\" as required class has not been loaded: \"" + mModelConfig.type + "\"",
oManifest.getComponentName(), "sap.ui.core.Component");
}
}
}
return mModelConfigs;
} | javascript | function getPreloadModelConfigsFromManifest(oManifest, oComponentData, mCacheTokens) {
var mModelConfigs = {
afterManifest: {},
afterPreload: {}
};
// deep clone is needed as the mainfest only returns a read-only copy (freezed object)
var oManifestDataSources = jQuery.extend(true, {}, oManifest.getEntry("/sap.app/dataSources"));
var oManifestModels = jQuery.extend(true, {}, oManifest.getEntry("/sap.ui5/models"));
var mAllModelConfigurations = Component._createManifestModelConfigurations({
models: oManifestModels,
dataSources: oManifestDataSources,
manifest: oManifest,
componentData: oComponentData,
cacheTokens: mCacheTokens
});
// Read internal URI parameter to enable model preload for testing purposes
// Specify comma separated list of model names. Use an empty segment for the "default" model
// Examples:
// sap-ui-xx-preload-component-models-<componentName>=, => prelaod default model (empty string key)
// sap-ui-xx-preload-component-models-<componentName>=foo, => prelaod "foo" + default model (empty string key)
// sap-ui-xx-preload-component-models-<componentName>=foo,bar => prelaod "foo" + "bar" models
var sPreloadModels = new UriParameters(window.location.href).get("sap-ui-xx-preload-component-models-" + oManifest.getComponentName());
var aPreloadModels = sPreloadModels && sPreloadModels.split(",");
for (var sModelName in mAllModelConfigurations) {
var mModelConfig = mAllModelConfigurations[sModelName];
// activate "preload" flag in case URI parameter for testing is used (see code above)
if (!mModelConfig.preload && aPreloadModels && aPreloadModels.indexOf(sModelName) > -1 ) {
mModelConfig.preload = true;
Log.warning("FOR TESTING ONLY!!! Activating preload for model \"" + sModelName + "\" (" + mModelConfig.type + ")",
oManifest.getComponentName(), "sap.ui.core.Component");
}
// ResourceModels with async=false should be always loaded beforehand to get rid of sync requests under the hood (regardless of the "preload" flag)
if (mModelConfig.type === "sap.ui.model.resource.ResourceModel" &&
Array.isArray(mModelConfig.settings) &&
mModelConfig.settings.length > 0 &&
mModelConfig.settings[0].async !== true
) {
// Use separate config object for ResourceModels as the resourceBundle might be
// part of the Component-preload which isn't available when the regular "preloaded"-models are created
mModelConfigs.afterPreload[sModelName] = mModelConfig;
} else if (mModelConfig.preload) {
// Only create models:
// - which are flagged for preload (mModelConfig.preload) or activated via internal URI param (see above)
// - in case the model class is already loaded (otherwise log a warning)
if (sap.ui.loader._.getModuleState(mModelConfig.type.replace(/\./g, "/") + ".js")) {
mModelConfigs.afterManifest[sModelName] = mModelConfig;
} else {
Log.warning("Can not preload model \"" + sModelName + "\" as required class has not been loaded: \"" + mModelConfig.type + "\"",
oManifest.getComponentName(), "sap.ui.core.Component");
}
}
}
return mModelConfigs;
} | [
"function",
"getPreloadModelConfigsFromManifest",
"(",
"oManifest",
",",
"oComponentData",
",",
"mCacheTokens",
")",
"{",
"var",
"mModelConfigs",
"=",
"{",
"afterManifest",
":",
"{",
"}",
",",
"afterPreload",
":",
"{",
"}",
"}",
";",
"// deep clone is needed as the mainfest only returns a read-only copy (freezed object)",
"var",
"oManifestDataSources",
"=",
"jQuery",
".",
"extend",
"(",
"true",
",",
"{",
"}",
",",
"oManifest",
".",
"getEntry",
"(",
"\"/sap.app/dataSources\"",
")",
")",
";",
"var",
"oManifestModels",
"=",
"jQuery",
".",
"extend",
"(",
"true",
",",
"{",
"}",
",",
"oManifest",
".",
"getEntry",
"(",
"\"/sap.ui5/models\"",
")",
")",
";",
"var",
"mAllModelConfigurations",
"=",
"Component",
".",
"_createManifestModelConfigurations",
"(",
"{",
"models",
":",
"oManifestModels",
",",
"dataSources",
":",
"oManifestDataSources",
",",
"manifest",
":",
"oManifest",
",",
"componentData",
":",
"oComponentData",
",",
"cacheTokens",
":",
"mCacheTokens",
"}",
")",
";",
"// Read internal URI parameter to enable model preload for testing purposes",
"// Specify comma separated list of model names. Use an empty segment for the \"default\" model",
"// Examples:",
"// sap-ui-xx-preload-component-models-<componentName>=, => prelaod default model (empty string key)",
"// sap-ui-xx-preload-component-models-<componentName>=foo, => prelaod \"foo\" + default model (empty string key)",
"// sap-ui-xx-preload-component-models-<componentName>=foo,bar => prelaod \"foo\" + \"bar\" models",
"var",
"sPreloadModels",
"=",
"new",
"UriParameters",
"(",
"window",
".",
"location",
".",
"href",
")",
".",
"get",
"(",
"\"sap-ui-xx-preload-component-models-\"",
"+",
"oManifest",
".",
"getComponentName",
"(",
")",
")",
";",
"var",
"aPreloadModels",
"=",
"sPreloadModels",
"&&",
"sPreloadModels",
".",
"split",
"(",
"\",\"",
")",
";",
"for",
"(",
"var",
"sModelName",
"in",
"mAllModelConfigurations",
")",
"{",
"var",
"mModelConfig",
"=",
"mAllModelConfigurations",
"[",
"sModelName",
"]",
";",
"// activate \"preload\" flag in case URI parameter for testing is used (see code above)",
"if",
"(",
"!",
"mModelConfig",
".",
"preload",
"&&",
"aPreloadModels",
"&&",
"aPreloadModels",
".",
"indexOf",
"(",
"sModelName",
")",
">",
"-",
"1",
")",
"{",
"mModelConfig",
".",
"preload",
"=",
"true",
";",
"Log",
".",
"warning",
"(",
"\"FOR TESTING ONLY!!! Activating preload for model \\\"\"",
"+",
"sModelName",
"+",
"\"\\\" (\"",
"+",
"mModelConfig",
".",
"type",
"+",
"\")\"",
",",
"oManifest",
".",
"getComponentName",
"(",
")",
",",
"\"sap.ui.core.Component\"",
")",
";",
"}",
"// ResourceModels with async=false should be always loaded beforehand to get rid of sync requests under the hood (regardless of the \"preload\" flag)",
"if",
"(",
"mModelConfig",
".",
"type",
"===",
"\"sap.ui.model.resource.ResourceModel\"",
"&&",
"Array",
".",
"isArray",
"(",
"mModelConfig",
".",
"settings",
")",
"&&",
"mModelConfig",
".",
"settings",
".",
"length",
">",
"0",
"&&",
"mModelConfig",
".",
"settings",
"[",
"0",
"]",
".",
"async",
"!==",
"true",
")",
"{",
"// Use separate config object for ResourceModels as the resourceBundle might be",
"// part of the Component-preload which isn't available when the regular \"preloaded\"-models are created",
"mModelConfigs",
".",
"afterPreload",
"[",
"sModelName",
"]",
"=",
"mModelConfig",
";",
"}",
"else",
"if",
"(",
"mModelConfig",
".",
"preload",
")",
"{",
"// Only create models:",
"// - which are flagged for preload (mModelConfig.preload) or activated via internal URI param (see above)",
"// - in case the model class is already loaded (otherwise log a warning)",
"if",
"(",
"sap",
".",
"ui",
".",
"loader",
".",
"_",
".",
"getModuleState",
"(",
"mModelConfig",
".",
"type",
".",
"replace",
"(",
"/",
"\\.",
"/",
"g",
",",
"\"/\"",
")",
"+",
"\".js\"",
")",
")",
"{",
"mModelConfigs",
".",
"afterManifest",
"[",
"sModelName",
"]",
"=",
"mModelConfig",
";",
"}",
"else",
"{",
"Log",
".",
"warning",
"(",
"\"Can not preload model \\\"\"",
"+",
"sModelName",
"+",
"\"\\\" as required class has not been loaded: \\\"\"",
"+",
"mModelConfig",
".",
"type",
"+",
"\"\\\"\"",
",",
"oManifest",
".",
"getComponentName",
"(",
")",
",",
"\"sap.ui.core.Component\"",
")",
";",
"}",
"}",
"}",
"return",
"mModelConfigs",
";",
"}"
] | Returns two maps of model configurations to be used for the model "preload" feature.
Used within loadComponent to create models during component load.
"afterManifest"
Models that are activated for preload via "preload=true" or URI parameter.
They will be created after the manifest is available.
"afterPreload"
Currently only for ResourceModels with async=false (default) to prevent sync requests
by loading the corresponding ResourceBundle in advance.
They will be created after the Component-preload has been loaded, as most apps package
their ResourceBundles within the Component-preload.
@param {sap.ui.core.Manifest} oManifest Manifest instance
@param {object} [oComponentData] optional component data object
@param {object} [mCacheTokens] optional cache tokens for OData models
@returns {object} object with two maps, see above | [
"Returns",
"two",
"maps",
"of",
"model",
"configurations",
"to",
"be",
"used",
"for",
"the",
"model",
"preload",
"feature",
".",
"Used",
"within",
"loadComponent",
"to",
"create",
"models",
"during",
"component",
"load",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/Component.js#L1728-L1789 |
3,904 | SAP/openui5 | src/sap.ui.core/src/sap/ui/core/Component.js | collectLoadManifestPromises | function collectLoadManifestPromises(oMetadata, oManifest) {
// ComponentMetadata classes with a static manifest or with legacy metadata
// do already have a manifest, so no action required
if (!oMetadata._oManifest) {
// TODO: If the "manifest" property is set, the code to load the manifest.json could be moved up to run in
// parallel with the ResourceModels that are created (after the Component-preload has finished) to trigger
// a potential request a bit earlier. Right now the whole component loading would be delayed by the async request.
var sName = oMetadata.getComponentName();
var sDefaultManifestUrl = getManifestUrl(sName);
var pLoadManifest;
if (oManifest) {
// Apply a copy of the already loaded manifest to be used by the static metadata class
pLoadManifest = Promise.resolve(JSON.parse(JSON.stringify(oManifest.getRawJson())));
} else {
// We need to load the manifest.json for the metadata class as
// it might differ from the one already loaded
// If the manifest.json is part of the Component-preload it will be taken from there
pLoadManifest = LoaderExtensions.loadResource({
url: sDefaultManifestUrl,
dataType: "json",
async: true
}).catch(function(oError) {
Log.error(
"Failed to load component manifest from \"" + sDefaultManifestUrl + "\" (component " + sName
+ ")! Reason: " + oError
);
// If the request fails, ignoring the error would end up in a sync call, which would fail, too.
return {};
});
}
aManifestsToLoad.push(pLoadManifest);
aMetadataObjects.push(oMetadata);
}
var oParentMetadata = oMetadata.getParent();
if (oParentMetadata && (oParentMetadata instanceof ComponentMetadata) && !oParentMetadata.isBaseClass()) {
collectLoadManifestPromises(oParentMetadata);
}
} | javascript | function collectLoadManifestPromises(oMetadata, oManifest) {
// ComponentMetadata classes with a static manifest or with legacy metadata
// do already have a manifest, so no action required
if (!oMetadata._oManifest) {
// TODO: If the "manifest" property is set, the code to load the manifest.json could be moved up to run in
// parallel with the ResourceModels that are created (after the Component-preload has finished) to trigger
// a potential request a bit earlier. Right now the whole component loading would be delayed by the async request.
var sName = oMetadata.getComponentName();
var sDefaultManifestUrl = getManifestUrl(sName);
var pLoadManifest;
if (oManifest) {
// Apply a copy of the already loaded manifest to be used by the static metadata class
pLoadManifest = Promise.resolve(JSON.parse(JSON.stringify(oManifest.getRawJson())));
} else {
// We need to load the manifest.json for the metadata class as
// it might differ from the one already loaded
// If the manifest.json is part of the Component-preload it will be taken from there
pLoadManifest = LoaderExtensions.loadResource({
url: sDefaultManifestUrl,
dataType: "json",
async: true
}).catch(function(oError) {
Log.error(
"Failed to load component manifest from \"" + sDefaultManifestUrl + "\" (component " + sName
+ ")! Reason: " + oError
);
// If the request fails, ignoring the error would end up in a sync call, which would fail, too.
return {};
});
}
aManifestsToLoad.push(pLoadManifest);
aMetadataObjects.push(oMetadata);
}
var oParentMetadata = oMetadata.getParent();
if (oParentMetadata && (oParentMetadata instanceof ComponentMetadata) && !oParentMetadata.isBaseClass()) {
collectLoadManifestPromises(oParentMetadata);
}
} | [
"function",
"collectLoadManifestPromises",
"(",
"oMetadata",
",",
"oManifest",
")",
"{",
"// ComponentMetadata classes with a static manifest or with legacy metadata",
"// do already have a manifest, so no action required",
"if",
"(",
"!",
"oMetadata",
".",
"_oManifest",
")",
"{",
"// TODO: If the \"manifest\" property is set, the code to load the manifest.json could be moved up to run in",
"// parallel with the ResourceModels that are created (after the Component-preload has finished) to trigger",
"// a potential request a bit earlier. Right now the whole component loading would be delayed by the async request.",
"var",
"sName",
"=",
"oMetadata",
".",
"getComponentName",
"(",
")",
";",
"var",
"sDefaultManifestUrl",
"=",
"getManifestUrl",
"(",
"sName",
")",
";",
"var",
"pLoadManifest",
";",
"if",
"(",
"oManifest",
")",
"{",
"// Apply a copy of the already loaded manifest to be used by the static metadata class",
"pLoadManifest",
"=",
"Promise",
".",
"resolve",
"(",
"JSON",
".",
"parse",
"(",
"JSON",
".",
"stringify",
"(",
"oManifest",
".",
"getRawJson",
"(",
")",
")",
")",
")",
";",
"}",
"else",
"{",
"// We need to load the manifest.json for the metadata class as",
"// it might differ from the one already loaded",
"// If the manifest.json is part of the Component-preload it will be taken from there",
"pLoadManifest",
"=",
"LoaderExtensions",
".",
"loadResource",
"(",
"{",
"url",
":",
"sDefaultManifestUrl",
",",
"dataType",
":",
"\"json\"",
",",
"async",
":",
"true",
"}",
")",
".",
"catch",
"(",
"function",
"(",
"oError",
")",
"{",
"Log",
".",
"error",
"(",
"\"Failed to load component manifest from \\\"\"",
"+",
"sDefaultManifestUrl",
"+",
"\"\\\" (component \"",
"+",
"sName",
"+",
"\")! Reason: \"",
"+",
"oError",
")",
";",
"// If the request fails, ignoring the error would end up in a sync call, which would fail, too.",
"return",
"{",
"}",
";",
"}",
")",
";",
"}",
"aManifestsToLoad",
".",
"push",
"(",
"pLoadManifest",
")",
";",
"aMetadataObjects",
".",
"push",
"(",
"oMetadata",
")",
";",
"}",
"var",
"oParentMetadata",
"=",
"oMetadata",
".",
"getParent",
"(",
")",
";",
"if",
"(",
"oParentMetadata",
"&&",
"(",
"oParentMetadata",
"instanceof",
"ComponentMetadata",
")",
"&&",
"!",
"oParentMetadata",
".",
"isBaseClass",
"(",
")",
")",
"{",
"collectLoadManifestPromises",
"(",
"oParentMetadata",
")",
";",
"}",
"}"
] | Collects the promises to load the manifest content and all of its parents manifest files.
Gathers promises within aManifestsToLoad.
Gathers associates meta data objects within aMetadataObjects.
@param {object} oMetadata The metadata object
@param {sap.ui.core.Manifest} [oManifest] root manifest, which is possibly already loaded | [
"Collects",
"the",
"promises",
"to",
"load",
"the",
"manifest",
"content",
"and",
"all",
"of",
"its",
"parents",
"manifest",
"files",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/Component.js#L1821-L1862 |
3,905 | SAP/openui5 | src/sap.ui.core/src/sap/ui/core/Component.js | function() {
// create a copy of arguments for local modification
// and later handover to Component constructor
var args = Array.prototype.slice.call(arguments);
// inject the manifest to the settings object
var mSettings;
if (args.length === 0 || typeof args[0] === "object") {
mSettings = args[0] = args[0] || {};
} else if (typeof args[0] === "string") {
mSettings = args[1] = args[1] || {};
}
mSettings._metadataProxy = oMetadataProxy;
// mixin created "models" into "mSettings"
if (mModels) {
mSettings._manifestModels = mModels;
}
// call the original constructor of the component class
var oInstance = Object.create(oClass.prototype);
oClass.apply(oInstance, args);
return oInstance;
} | javascript | function() {
// create a copy of arguments for local modification
// and later handover to Component constructor
var args = Array.prototype.slice.call(arguments);
// inject the manifest to the settings object
var mSettings;
if (args.length === 0 || typeof args[0] === "object") {
mSettings = args[0] = args[0] || {};
} else if (typeof args[0] === "string") {
mSettings = args[1] = args[1] || {};
}
mSettings._metadataProxy = oMetadataProxy;
// mixin created "models" into "mSettings"
if (mModels) {
mSettings._manifestModels = mModels;
}
// call the original constructor of the component class
var oInstance = Object.create(oClass.prototype);
oClass.apply(oInstance, args);
return oInstance;
} | [
"function",
"(",
")",
"{",
"// create a copy of arguments for local modification",
"// and later handover to Component constructor",
"var",
"args",
"=",
"Array",
".",
"prototype",
".",
"slice",
".",
"call",
"(",
"arguments",
")",
";",
"// inject the manifest to the settings object",
"var",
"mSettings",
";",
"if",
"(",
"args",
".",
"length",
"===",
"0",
"||",
"typeof",
"args",
"[",
"0",
"]",
"===",
"\"object\"",
")",
"{",
"mSettings",
"=",
"args",
"[",
"0",
"]",
"=",
"args",
"[",
"0",
"]",
"||",
"{",
"}",
";",
"}",
"else",
"if",
"(",
"typeof",
"args",
"[",
"0",
"]",
"===",
"\"string\"",
")",
"{",
"mSettings",
"=",
"args",
"[",
"1",
"]",
"=",
"args",
"[",
"1",
"]",
"||",
"{",
"}",
";",
"}",
"mSettings",
".",
"_metadataProxy",
"=",
"oMetadataProxy",
";",
"// mixin created \"models\" into \"mSettings\"",
"if",
"(",
"mModels",
")",
"{",
"mSettings",
".",
"_manifestModels",
"=",
"mModels",
";",
"}",
"// call the original constructor of the component class",
"var",
"oInstance",
"=",
"Object",
".",
"create",
"(",
"oClass",
".",
"prototype",
")",
";",
"oClass",
".",
"apply",
"(",
"oInstance",
",",
"args",
")",
";",
"return",
"oInstance",
";",
"}"
] | create the proxy class for passing the manifest | [
"create",
"the",
"proxy",
"class",
"for",
"passing",
"the",
"manifest"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/Component.js#L2496-L2521 |
|
3,906 | SAP/openui5 | src/sap.ui.core/src/sap/ui/core/Component.js | function(oPromise) {
// In order to make the error handling of the Promise.all() happen after all Promises finish, we catch all rejected Promises and make them resolve with an marked object.
oPromise = oPromise.then(
function(v) {
return {
result: v,
rejected: false
};
},
function(v) {
return {
result: v,
rejected: true
};
}
);
return oPromise;
} | javascript | function(oPromise) {
// In order to make the error handling of the Promise.all() happen after all Promises finish, we catch all rejected Promises and make them resolve with an marked object.
oPromise = oPromise.then(
function(v) {
return {
result: v,
rejected: false
};
},
function(v) {
return {
result: v,
rejected: true
};
}
);
return oPromise;
} | [
"function",
"(",
"oPromise",
")",
"{",
"// In order to make the error handling of the Promise.all() happen after all Promises finish, we catch all rejected Promises and make them resolve with an marked object.",
"oPromise",
"=",
"oPromise",
".",
"then",
"(",
"function",
"(",
"v",
")",
"{",
"return",
"{",
"result",
":",
"v",
",",
"rejected",
":",
"false",
"}",
";",
"}",
",",
"function",
"(",
"v",
")",
"{",
"return",
"{",
"result",
":",
"v",
",",
"rejected",
":",
"true",
"}",
";",
"}",
")",
";",
"return",
"oPromise",
";",
"}"
] | trigger loading of libraries and component preloads and collect the given promises | [
"trigger",
"loading",
"of",
"libraries",
"and",
"component",
"preloads",
"and",
"collect",
"the",
"given",
"promises"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/Component.js#L2670-L2687 |
|
3,907 | SAP/openui5 | src/sap.ui.core/src/sap/ui/core/Fragment.js | function(sTemplateName) {
var sUrl = sap.ui.require.toUrl(sTemplateName.replace(/\./g, "/")) + ".fragment.html";
var sHTML = _mHTMLTemplates[sUrl];
var sResourceName;
if (!sHTML) {
sResourceName = sTemplateName.replace(/\./g, "/") + ".fragment.html";
sHTML = LoaderExtensions.loadResource(sResourceName);
// TODO discuss
// a) why caching at all (more precise: why for HTML fragment although we refused to do it for other view/fragment types - risk of a memory leak!)
// b) why cached via URL instead of via name? Any special scenario in mind?
_mHTMLTemplates[sUrl] = sHTML;
}
return sHTML;
} | javascript | function(sTemplateName) {
var sUrl = sap.ui.require.toUrl(sTemplateName.replace(/\./g, "/")) + ".fragment.html";
var sHTML = _mHTMLTemplates[sUrl];
var sResourceName;
if (!sHTML) {
sResourceName = sTemplateName.replace(/\./g, "/") + ".fragment.html";
sHTML = LoaderExtensions.loadResource(sResourceName);
// TODO discuss
// a) why caching at all (more precise: why for HTML fragment although we refused to do it for other view/fragment types - risk of a memory leak!)
// b) why cached via URL instead of via name? Any special scenario in mind?
_mHTMLTemplates[sUrl] = sHTML;
}
return sHTML;
} | [
"function",
"(",
"sTemplateName",
")",
"{",
"var",
"sUrl",
"=",
"sap",
".",
"ui",
".",
"require",
".",
"toUrl",
"(",
"sTemplateName",
".",
"replace",
"(",
"/",
"\\.",
"/",
"g",
",",
"\"/\"",
")",
")",
"+",
"\".fragment.html\"",
";",
"var",
"sHTML",
"=",
"_mHTMLTemplates",
"[",
"sUrl",
"]",
";",
"var",
"sResourceName",
";",
"if",
"(",
"!",
"sHTML",
")",
"{",
"sResourceName",
"=",
"sTemplateName",
".",
"replace",
"(",
"/",
"\\.",
"/",
"g",
",",
"\"/\"",
")",
"+",
"\".fragment.html\"",
";",
"sHTML",
"=",
"LoaderExtensions",
".",
"loadResource",
"(",
"sResourceName",
")",
";",
"// TODO discuss",
"// a) why caching at all (more precise: why for HTML fragment although we refused to do it for other view/fragment types - risk of a memory leak!)",
"// b) why cached via URL instead of via name? Any special scenario in mind?",
"_mHTMLTemplates",
"[",
"sUrl",
"]",
"=",
"sHTML",
";",
"}",
"return",
"sHTML",
";",
"}"
] | Loads and returns a template for the given template name. Templates are only loaded once.
@param {string} sTemplateName The name of the template
@return {string} the template data
@private | [
"Loads",
"and",
"returns",
"a",
"template",
"for",
"the",
"given",
"template",
"name",
".",
"Templates",
"are",
"only",
"loaded",
"once",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/Fragment.js#L759-L773 |
|
3,908 | SAP/openui5 | src/sap.ui.core/src/sap/ui/core/Configuration.js | function() {
var sName;
// lazy load of LocaleData to avoid cyclic dependencies
if ( !LocaleData ) {
LocaleData = sap.ui.requireSync("sap/ui/core/LocaleData");
}
if (this.calendarType) {
for (sName in CalendarType) {
if (sName.toLowerCase() === this.calendarType.toLowerCase()) {
this.calendarType = sName;
return this.calendarType;
}
}
Log.warning("Parameter 'calendarType' is set to " + this.calendarType + " which isn't a valid value and therefore ignored. The calendar type is determined from format setting and current locale");
}
var sLegacyDateFormat = this.oFormatSettings.getLegacyDateFormat();
switch (sLegacyDateFormat) {
case "1":
case "2":
case "3":
case "4":
case "5":
case "6":
return CalendarType.Gregorian;
case "7":
case "8":
case "9":
return CalendarType.Japanese;
case "A":
case "B":
return CalendarType.Islamic;
case "C":
return CalendarType.Persian;
}
return LocaleData.getInstance(this.getLocale()).getPreferredCalendarType();
} | javascript | function() {
var sName;
// lazy load of LocaleData to avoid cyclic dependencies
if ( !LocaleData ) {
LocaleData = sap.ui.requireSync("sap/ui/core/LocaleData");
}
if (this.calendarType) {
for (sName in CalendarType) {
if (sName.toLowerCase() === this.calendarType.toLowerCase()) {
this.calendarType = sName;
return this.calendarType;
}
}
Log.warning("Parameter 'calendarType' is set to " + this.calendarType + " which isn't a valid value and therefore ignored. The calendar type is determined from format setting and current locale");
}
var sLegacyDateFormat = this.oFormatSettings.getLegacyDateFormat();
switch (sLegacyDateFormat) {
case "1":
case "2":
case "3":
case "4":
case "5":
case "6":
return CalendarType.Gregorian;
case "7":
case "8":
case "9":
return CalendarType.Japanese;
case "A":
case "B":
return CalendarType.Islamic;
case "C":
return CalendarType.Persian;
}
return LocaleData.getInstance(this.getLocale()).getPreferredCalendarType();
} | [
"function",
"(",
")",
"{",
"var",
"sName",
";",
"// lazy load of LocaleData to avoid cyclic dependencies",
"if",
"(",
"!",
"LocaleData",
")",
"{",
"LocaleData",
"=",
"sap",
".",
"ui",
".",
"requireSync",
"(",
"\"sap/ui/core/LocaleData\"",
")",
";",
"}",
"if",
"(",
"this",
".",
"calendarType",
")",
"{",
"for",
"(",
"sName",
"in",
"CalendarType",
")",
"{",
"if",
"(",
"sName",
".",
"toLowerCase",
"(",
")",
"===",
"this",
".",
"calendarType",
".",
"toLowerCase",
"(",
")",
")",
"{",
"this",
".",
"calendarType",
"=",
"sName",
";",
"return",
"this",
".",
"calendarType",
";",
"}",
"}",
"Log",
".",
"warning",
"(",
"\"Parameter 'calendarType' is set to \"",
"+",
"this",
".",
"calendarType",
"+",
"\" which isn't a valid value and therefore ignored. The calendar type is determined from format setting and current locale\"",
")",
";",
"}",
"var",
"sLegacyDateFormat",
"=",
"this",
".",
"oFormatSettings",
".",
"getLegacyDateFormat",
"(",
")",
";",
"switch",
"(",
"sLegacyDateFormat",
")",
"{",
"case",
"\"1\"",
":",
"case",
"\"2\"",
":",
"case",
"\"3\"",
":",
"case",
"\"4\"",
":",
"case",
"\"5\"",
":",
"case",
"\"6\"",
":",
"return",
"CalendarType",
".",
"Gregorian",
";",
"case",
"\"7\"",
":",
"case",
"\"8\"",
":",
"case",
"\"9\"",
":",
"return",
"CalendarType",
".",
"Japanese",
";",
"case",
"\"A\"",
":",
"case",
"\"B\"",
":",
"return",
"CalendarType",
".",
"Islamic",
";",
"case",
"\"C\"",
":",
"return",
"CalendarType",
".",
"Persian",
";",
"}",
"return",
"LocaleData",
".",
"getInstance",
"(",
"this",
".",
"getLocale",
"(",
")",
")",
".",
"getPreferredCalendarType",
"(",
")",
";",
"}"
] | Returns the calendar type which is being used in locale dependent functionality.
When it's explicitly set by calling <code>setCalendar</code>, the set calendar type is returned.
Otherwise, the calendar type is determined by checking the format settings and current locale.
@return {sap.ui.core.CalendarType} the current calendar type
@since 1.28.6 | [
"Returns",
"the",
"calendar",
"type",
"which",
"is",
"being",
"used",
"in",
"locale",
"dependent",
"functionality",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/Configuration.js#L820-L860 |
|
3,909 | SAP/openui5 | src/sap.ui.core/src/sap/ui/core/Configuration.js | function(sFormatLocale) {
var oFormatLocale = convertToLocaleOrNull(sFormatLocale),
mChanges;
check(sFormatLocale == null || typeof sFormatLocale === "string" && oFormatLocale, "sFormatLocale must be a BCP47 language tag or Java Locale id or null");
if ( toLanguageTag(oFormatLocale) !== toLanguageTag(this.formatLocale) ) {
this.formatLocale = oFormatLocale;
mChanges = this._collect();
mChanges.formatLocale = toLanguageTag(oFormatLocale);
this._endCollect();
}
return this;
} | javascript | function(sFormatLocale) {
var oFormatLocale = convertToLocaleOrNull(sFormatLocale),
mChanges;
check(sFormatLocale == null || typeof sFormatLocale === "string" && oFormatLocale, "sFormatLocale must be a BCP47 language tag or Java Locale id or null");
if ( toLanguageTag(oFormatLocale) !== toLanguageTag(this.formatLocale) ) {
this.formatLocale = oFormatLocale;
mChanges = this._collect();
mChanges.formatLocale = toLanguageTag(oFormatLocale);
this._endCollect();
}
return this;
} | [
"function",
"(",
"sFormatLocale",
")",
"{",
"var",
"oFormatLocale",
"=",
"convertToLocaleOrNull",
"(",
"sFormatLocale",
")",
",",
"mChanges",
";",
"check",
"(",
"sFormatLocale",
"==",
"null",
"||",
"typeof",
"sFormatLocale",
"===",
"\"string\"",
"&&",
"oFormatLocale",
",",
"\"sFormatLocale must be a BCP47 language tag or Java Locale id or null\"",
")",
";",
"if",
"(",
"toLanguageTag",
"(",
"oFormatLocale",
")",
"!==",
"toLanguageTag",
"(",
"this",
".",
"formatLocale",
")",
")",
"{",
"this",
".",
"formatLocale",
"=",
"oFormatLocale",
";",
"mChanges",
"=",
"this",
".",
"_collect",
"(",
")",
";",
"mChanges",
".",
"formatLocale",
"=",
"toLanguageTag",
"(",
"oFormatLocale",
")",
";",
"this",
".",
"_endCollect",
"(",
")",
";",
"}",
"return",
"this",
";",
"}"
] | Sets a new format locale to be used from now on for retrieving locale
specific formatters. Modifying this setting does not have an impact on
the retrieval of translated texts!
Can either be set to a concrete value (a BCP47 or Java locale compliant
language tag) or to <code>null</code>. When set to <code>null</code> (default
value) then locale specific formatters are retrieved for the current language.
After changing the format locale, the framework tries to update localization
specific parts of the UI. See the documentation of {@link #setLanguage} for
details and restrictions.
<b>Note</b>: When a format locale is set, it has higher priority than a number,
date or time format defined with a call to <code>setLegacyNumberFormat</code>,
<code>setLegacyDateFormat</code> or <code>setLegacyTimeFormat</code>.
<b>Note</b>: See documentation of {@link #setLanguage} for restrictions.
@param {string|null} sFormatLocale the new format locale as a BCP47 compliant language tag;
case doesn't matter and underscores can be used instead of dashes to separate
components (compatibility with Java Locale IDs)
@return {sap.ui.core.Configuration} <code>this</code> to allow method chaining
@public
@throws {Error} When <code>sFormatLocale</code> is given, but is not a valid BCP47 language
tag or Java locale identifier | [
"Sets",
"a",
"new",
"format",
"locale",
"to",
"be",
"used",
"from",
"now",
"on",
"for",
"retrieving",
"locale",
"specific",
"formatters",
".",
"Modifying",
"this",
"setting",
"does",
"not",
"have",
"an",
"impact",
"on",
"the",
"retrieval",
"of",
"translated",
"texts!"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/Configuration.js#L921-L934 |
|
3,910 | SAP/openui5 | src/sap.ui.core/src/sap/ui/core/Configuration.js | function(sAnimationMode) {
checkEnum(Configuration.AnimationMode, sAnimationMode, "animationMode");
// Set the animation to on or off depending on the animation mode to ensure backward compatibility.
this.animation = (sAnimationMode !== Configuration.AnimationMode.minimal && sAnimationMode !== Configuration.AnimationMode.none);
// Set the animation mode and update html attributes.
this.animationMode = sAnimationMode;
if (this._oCore && this._oCore._setupAnimation) {
this._oCore._setupAnimation();
}
} | javascript | function(sAnimationMode) {
checkEnum(Configuration.AnimationMode, sAnimationMode, "animationMode");
// Set the animation to on or off depending on the animation mode to ensure backward compatibility.
this.animation = (sAnimationMode !== Configuration.AnimationMode.minimal && sAnimationMode !== Configuration.AnimationMode.none);
// Set the animation mode and update html attributes.
this.animationMode = sAnimationMode;
if (this._oCore && this._oCore._setupAnimation) {
this._oCore._setupAnimation();
}
} | [
"function",
"(",
"sAnimationMode",
")",
"{",
"checkEnum",
"(",
"Configuration",
".",
"AnimationMode",
",",
"sAnimationMode",
",",
"\"animationMode\"",
")",
";",
"// Set the animation to on or off depending on the animation mode to ensure backward compatibility.",
"this",
".",
"animation",
"=",
"(",
"sAnimationMode",
"!==",
"Configuration",
".",
"AnimationMode",
".",
"minimal",
"&&",
"sAnimationMode",
"!==",
"Configuration",
".",
"AnimationMode",
".",
"none",
")",
";",
"// Set the animation mode and update html attributes.",
"this",
".",
"animationMode",
"=",
"sAnimationMode",
";",
"if",
"(",
"this",
".",
"_oCore",
"&&",
"this",
".",
"_oCore",
".",
"_setupAnimation",
")",
"{",
"this",
".",
"_oCore",
".",
"_setupAnimation",
"(",
")",
";",
"}",
"}"
] | Sets the current animation mode.
Expects an animation mode as string and validates it. If a wrong animation mode was set, an error is
thrown. If the mode is valid it is set, then the attributes <code>data-sap-ui-animation</code> and
<code>data-sap-ui-animation-mode</code> of the HTML document root element are also updated.
If the <code>animationMode</code> is <code>Configuration.AnimationMode.none</code> the old
<code>animation</code> property is set to <code>false</code>, otherwise it is set to <code>true</code>.
@param {sap.ui.core.Configuration.AnimationMode} sAnimationMode A valid animation mode
@throws {Error} If the provided <code>sAnimationMode</code> does not exist, an error is thrown
@since 1.50.0
@public | [
"Sets",
"the",
"current",
"animation",
"mode",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/Configuration.js#L1016-L1027 |
|
3,911 | SAP/openui5 | src/sap.ui.core/src/sap/ui/core/Configuration.js | function(bRTL) {
check(bRTL === null || typeof bRTL === "boolean", "bRTL must be null or a boolean");
var oldRTL = this.getRTL(),
mChanges;
this.rtl = bRTL;
if ( oldRTL != this.getRTL() ) { // also take the derived RTL flag into account for the before/after comparison!
mChanges = this._collect();
mChanges.rtl = this.getRTL();
this._endCollect();
}
return this;
} | javascript | function(bRTL) {
check(bRTL === null || typeof bRTL === "boolean", "bRTL must be null or a boolean");
var oldRTL = this.getRTL(),
mChanges;
this.rtl = bRTL;
if ( oldRTL != this.getRTL() ) { // also take the derived RTL flag into account for the before/after comparison!
mChanges = this._collect();
mChanges.rtl = this.getRTL();
this._endCollect();
}
return this;
} | [
"function",
"(",
"bRTL",
")",
"{",
"check",
"(",
"bRTL",
"===",
"null",
"||",
"typeof",
"bRTL",
"===",
"\"boolean\"",
",",
"\"bRTL must be null or a boolean\"",
")",
";",
"var",
"oldRTL",
"=",
"this",
".",
"getRTL",
"(",
")",
",",
"mChanges",
";",
"this",
".",
"rtl",
"=",
"bRTL",
";",
"if",
"(",
"oldRTL",
"!=",
"this",
".",
"getRTL",
"(",
")",
")",
"{",
"// also take the derived RTL flag into account for the before/after comparison!",
"mChanges",
"=",
"this",
".",
"_collect",
"(",
")",
";",
"mChanges",
".",
"rtl",
"=",
"this",
".",
"getRTL",
"(",
")",
";",
"this",
".",
"_endCollect",
"(",
")",
";",
"}",
"return",
"this",
";",
"}"
] | Sets the character orientation mode to be used from now on.
Can either be set to a concrete value (true meaning right-to-left,
false meaning left-to-right) or to <code>null</code> which means that
the character orientation mode should be derived from the current
language (incl. region) setting.
After changing the character orientation mode, the framework tries
to update localization specific parts of the UI. See the documentation of
{@link #setLanguage} for details and restrictions.
<b>Note</b>: See documentation of {@link #setLanguage} for restrictions.
@param {boolean|null} bRTL new character orientation mode or <code>null</code>
@return {sap.ui.core.Configuration} <code>this</code> to allow method chaining
@public | [
"Sets",
"the",
"character",
"orientation",
"mode",
"to",
"be",
"used",
"from",
"now",
"on",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/Configuration.js#L1071-L1083 |
|
3,912 | SAP/openui5 | src/sap.ui.core/src/sap/ui/core/Configuration.js | function(mSettings) {
function applyAll(ctx, m) {
var sName, sMethod;
for ( sName in m ) {
sMethod = "set" + sName.slice(0,1).toUpperCase() + sName.slice(1);
if ( sName === 'formatSettings' && ctx.oFormatSettings ) {
applyAll(ctx.oFormatSettings, m[sName]);
} else if ( typeof ctx[sMethod] === 'function' ) {
ctx[sMethod](m[sName]);
} else {
Log.warning("Configuration.applySettings: unknown setting '" + sName + "' ignored");
}
}
}
assert(typeof mSettings === 'object', "mSettings must be an object");
this._collect(); // block events
applyAll(this, mSettings);
this._endCollect(); // might fire localizationChanged
return this;
} | javascript | function(mSettings) {
function applyAll(ctx, m) {
var sName, sMethod;
for ( sName in m ) {
sMethod = "set" + sName.slice(0,1).toUpperCase() + sName.slice(1);
if ( sName === 'formatSettings' && ctx.oFormatSettings ) {
applyAll(ctx.oFormatSettings, m[sName]);
} else if ( typeof ctx[sMethod] === 'function' ) {
ctx[sMethod](m[sName]);
} else {
Log.warning("Configuration.applySettings: unknown setting '" + sName + "' ignored");
}
}
}
assert(typeof mSettings === 'object', "mSettings must be an object");
this._collect(); // block events
applyAll(this, mSettings);
this._endCollect(); // might fire localizationChanged
return this;
} | [
"function",
"(",
"mSettings",
")",
"{",
"function",
"applyAll",
"(",
"ctx",
",",
"m",
")",
"{",
"var",
"sName",
",",
"sMethod",
";",
"for",
"(",
"sName",
"in",
"m",
")",
"{",
"sMethod",
"=",
"\"set\"",
"+",
"sName",
".",
"slice",
"(",
"0",
",",
"1",
")",
".",
"toUpperCase",
"(",
")",
"+",
"sName",
".",
"slice",
"(",
"1",
")",
";",
"if",
"(",
"sName",
"===",
"'formatSettings'",
"&&",
"ctx",
".",
"oFormatSettings",
")",
"{",
"applyAll",
"(",
"ctx",
".",
"oFormatSettings",
",",
"m",
"[",
"sName",
"]",
")",
";",
"}",
"else",
"if",
"(",
"typeof",
"ctx",
"[",
"sMethod",
"]",
"===",
"'function'",
")",
"{",
"ctx",
"[",
"sMethod",
"]",
"(",
"m",
"[",
"sName",
"]",
")",
";",
"}",
"else",
"{",
"Log",
".",
"warning",
"(",
"\"Configuration.applySettings: unknown setting '\"",
"+",
"sName",
"+",
"\"' ignored\"",
")",
";",
"}",
"}",
"}",
"assert",
"(",
"typeof",
"mSettings",
"===",
"'object'",
",",
"\"mSettings must be an object\"",
")",
";",
"this",
".",
"_collect",
"(",
")",
";",
"// block events",
"applyAll",
"(",
"this",
",",
"mSettings",
")",
";",
"this",
".",
"_endCollect",
"(",
")",
";",
"// might fire localizationChanged",
"return",
"this",
";",
"}"
] | Applies multiple changes to the configuration at once.
If the changed settings contain localization related settings like <code>language</code>
or <ode>calendarType</code>, then only a single <code>localizationChanged</code> event will
be fired. As the framework has to inform all existing components, elements, models etc.
about localization changes, using <code>applySettings</code> can significantly reduce the
overhead for multiple changes, esp. when they occur after the UI has been created already.
The <code>mSettings</code> can contain any property <code><i>xyz</i></code> for which a
setter method <code>set<i>XYZ</i></code> exists in the API of this class.
Similarly, values for the {@link sap.ui.core.Configuration.FormatSettings format settings}
API can be provided in a nested object with name <code>formatSettings</code>.
@example <caption>Apply <code>language</code>, <code>calendarType</code> and several legacy
format settings in one call</caption>
sap.ui.getCore().getConfiguration().applySettings({
language: 'de',
calendarType: sap.ui.core.CalendarType.Gregorian,
formatSettings: {
legacyDateFormat: '1',
legacyTimeFormat: '1',
legacyNumberFormat: '1'
}
});
@param {object} mSettings Configuration options to apply
@returns {sap.ui.core.Configuration} Returns <code>this</code> to allow method chaining
@public
@since 1.38.6 | [
"Applies",
"multiple",
"changes",
"to",
"the",
"configuration",
"at",
"once",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/Configuration.js#L1475-L1498 |
|
3,913 | SAP/openui5 | src/sap.ui.core/src/sap/ui/core/Configuration.js | checkEnum | function checkEnum(oEnum, sValue, sPropertyName) {
var aValidValues = [];
for (var sKey in oEnum) {
if (oEnum.hasOwnProperty(sKey)) {
if (oEnum[sKey] === sValue) {
return;
}
aValidValues.push(oEnum[sKey]);
}
}
throw new Error("Unsupported Enumeration value for " + sPropertyName + ", valid values are: " + aValidValues.join(", "));
} | javascript | function checkEnum(oEnum, sValue, sPropertyName) {
var aValidValues = [];
for (var sKey in oEnum) {
if (oEnum.hasOwnProperty(sKey)) {
if (oEnum[sKey] === sValue) {
return;
}
aValidValues.push(oEnum[sKey]);
}
}
throw new Error("Unsupported Enumeration value for " + sPropertyName + ", valid values are: " + aValidValues.join(", "));
} | [
"function",
"checkEnum",
"(",
"oEnum",
",",
"sValue",
",",
"sPropertyName",
")",
"{",
"var",
"aValidValues",
"=",
"[",
"]",
";",
"for",
"(",
"var",
"sKey",
"in",
"oEnum",
")",
"{",
"if",
"(",
"oEnum",
".",
"hasOwnProperty",
"(",
"sKey",
")",
")",
"{",
"if",
"(",
"oEnum",
"[",
"sKey",
"]",
"===",
"sValue",
")",
"{",
"return",
";",
"}",
"aValidValues",
".",
"push",
"(",
"oEnum",
"[",
"sKey",
"]",
")",
";",
"}",
"}",
"throw",
"new",
"Error",
"(",
"\"Unsupported Enumeration value for \"",
"+",
"sPropertyName",
"+",
"\", valid values are: \"",
"+",
"aValidValues",
".",
"join",
"(",
"\", \"",
")",
")",
";",
"}"
] | Checks if a value exists within an enumerable list.
@param {object} oEnum Enumeration object with values for validation
@param {string} sValue Value to check against enumerable list
@param {string} sPropertyName Name of the property which is checked
@throws {Error} If the value could not be found, an error is thrown | [
"Checks",
"if",
"a",
"value",
"exists",
"within",
"an",
"enumerable",
"list",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/Configuration.js#L1613-L1624 |
3,914 | SAP/openui5 | src/sap.ui.core/src/sap/ui/core/Configuration.js | function() {
function fallback(that) {
var oLocale = that.oConfiguration.language;
// if any user settings have been defined, add the private use subtag "sapufmt"
if ( !jQuery.isEmptyObject(that.mSettings) ) {
// TODO move to Locale/LocaleData
var l = oLocale.toString();
if ( l.indexOf("-x-") < 0 ) {
l = l + "-x-sapufmt";
} else if ( l.indexOf("-sapufmt") <= l.indexOf("-x-") ) {
l = l + "-sapufmt";
}
oLocale = new Locale(l);
}
return oLocale;
}
return this.oConfiguration.formatLocale || fallback(this);
} | javascript | function() {
function fallback(that) {
var oLocale = that.oConfiguration.language;
// if any user settings have been defined, add the private use subtag "sapufmt"
if ( !jQuery.isEmptyObject(that.mSettings) ) {
// TODO move to Locale/LocaleData
var l = oLocale.toString();
if ( l.indexOf("-x-") < 0 ) {
l = l + "-x-sapufmt";
} else if ( l.indexOf("-sapufmt") <= l.indexOf("-x-") ) {
l = l + "-sapufmt";
}
oLocale = new Locale(l);
}
return oLocale;
}
return this.oConfiguration.formatLocale || fallback(this);
} | [
"function",
"(",
")",
"{",
"function",
"fallback",
"(",
"that",
")",
"{",
"var",
"oLocale",
"=",
"that",
".",
"oConfiguration",
".",
"language",
";",
"// if any user settings have been defined, add the private use subtag \"sapufmt\"",
"if",
"(",
"!",
"jQuery",
".",
"isEmptyObject",
"(",
"that",
".",
"mSettings",
")",
")",
"{",
"// TODO move to Locale/LocaleData",
"var",
"l",
"=",
"oLocale",
".",
"toString",
"(",
")",
";",
"if",
"(",
"l",
".",
"indexOf",
"(",
"\"-x-\"",
")",
"<",
"0",
")",
"{",
"l",
"=",
"l",
"+",
"\"-x-sapufmt\"",
";",
"}",
"else",
"if",
"(",
"l",
".",
"indexOf",
"(",
"\"-sapufmt\"",
")",
"<=",
"l",
".",
"indexOf",
"(",
"\"-x-\"",
")",
")",
"{",
"l",
"=",
"l",
"+",
"\"-sapufmt\"",
";",
"}",
"oLocale",
"=",
"new",
"Locale",
"(",
"l",
")",
";",
"}",
"return",
"oLocale",
";",
"}",
"return",
"this",
".",
"oConfiguration",
".",
"formatLocale",
"||",
"fallback",
"(",
"this",
")",
";",
"}"
] | Returns the locale to be used for formatting.
If no such locale has been defined, this method falls back to the language,
see {@link sap.ui.core.Configuration#getLanguage Configuration.getLanguage()}.
If any user preferences for date, time or number formatting have been set,
and if no format locale has been specified, then a special private use subtag
is added to the locale, indicating to the framework that these user preferences
should be applied.
@return {sap.ui.core.Locale} the format locale
@public | [
"Returns",
"the",
"locale",
"to",
"be",
"used",
"for",
"formatting",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/Configuration.js#L1661-L1678 |
|
3,915 | SAP/openui5 | src/sap.ui.core/src/sap/ui/core/Configuration.js | function(sStyle, sPattern) {
check(sStyle == "short" || sStyle == "medium" || sStyle == "long" || sStyle == "full", "sStyle must be short, medium, long or full");
this._set("dateFormats-" + sStyle, sPattern);
return this;
} | javascript | function(sStyle, sPattern) {
check(sStyle == "short" || sStyle == "medium" || sStyle == "long" || sStyle == "full", "sStyle must be short, medium, long or full");
this._set("dateFormats-" + sStyle, sPattern);
return this;
} | [
"function",
"(",
"sStyle",
",",
"sPattern",
")",
"{",
"check",
"(",
"sStyle",
"==",
"\"short\"",
"||",
"sStyle",
"==",
"\"medium\"",
"||",
"sStyle",
"==",
"\"long\"",
"||",
"sStyle",
"==",
"\"full\"",
",",
"\"sStyle must be short, medium, long or full\"",
")",
";",
"this",
".",
"_set",
"(",
"\"dateFormats-\"",
"+",
"sStyle",
",",
"sPattern",
")",
";",
"return",
"this",
";",
"}"
] | Defines the preferred format pattern for the given date format style.
Calling this method with a null or undefined pattern removes a previously set pattern.
If a pattern is defined, it will be preferred over patterns derived from the current locale.
See class {@link sap.ui.core.format.DateFormat} for details about the pattern syntax.
After changing the date pattern, the framework tries to update localization
specific parts of the UI. See the documentation of {@link sap.ui.core.Configuration#setLanguage}
for details and restrictions.
@param {string} sStyle must be one of short, medium, long or full.
@param {string} sPattern the format pattern to be used in LDML syntax.
@return {sap.ui.core.Configuration.FormatSettings} Returns <code>this</code> to allow method chaining
@public | [
"Defines",
"the",
"preferred",
"format",
"pattern",
"for",
"the",
"given",
"date",
"format",
"style",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/Configuration.js#L1846-L1850 |
|
3,916 | SAP/openui5 | src/sap.ui.core/src/sap/ui/core/Configuration.js | function(sType, sSymbol) {
check(sType == "decimal" || sType == "group" || sType == "plusSign" || sType == "minusSign", "sType must be decimal, group, plusSign or minusSign");
this._set("symbols-latn-" + sType, sSymbol);
return this;
} | javascript | function(sType, sSymbol) {
check(sType == "decimal" || sType == "group" || sType == "plusSign" || sType == "minusSign", "sType must be decimal, group, plusSign or minusSign");
this._set("symbols-latn-" + sType, sSymbol);
return this;
} | [
"function",
"(",
"sType",
",",
"sSymbol",
")",
"{",
"check",
"(",
"sType",
"==",
"\"decimal\"",
"||",
"sType",
"==",
"\"group\"",
"||",
"sType",
"==",
"\"plusSign\"",
"||",
"sType",
"==",
"\"minusSign\"",
",",
"\"sType must be decimal, group, plusSign or minusSign\"",
")",
";",
"this",
".",
"_set",
"(",
"\"symbols-latn-\"",
"+",
"sType",
",",
"sSymbol",
")",
";",
"return",
"this",
";",
"}"
] | Defines the string to be used for the given number symbol.
Calling this method with a null or undefined symbol removes a previously set symbol string.
Note that an empty string is explicitly allowed.
If a symbol is defined, it will be preferred over symbols derived from the current locale.
See class {@link sap.ui.core.format.NumberFormat} for details about the symbols.
After changing the number symbol, the framework tries to update localization
specific parts of the UI. See the documentation of {@link sap.ui.core.Configuration#setLanguage}
for details and restrictions.
@param {string} sStyle must be one of decimal, group, plusSign, minusSign.
@param {string} sSymbol will be used to represent the given symbol type
@return {sap.ui.core.Configuration.FormatSettings} Returns <code>this</code> to allow method chaining
@public | [
"Defines",
"the",
"string",
"to",
"be",
"used",
"for",
"the",
"given",
"number",
"symbol",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/Configuration.js#L1913-L1917 |
|
3,917 | SAP/openui5 | src/sap.ui.core/src/sap/ui/core/Configuration.js | function(mCurrencies) {
check(typeof mCurrencies === "object" || mCurrencies == null, "mCurrencyDigits must be an object");
Object.keys(mCurrencies || {}).forEach(function(sCurrencyDigit) {
check(typeof sCurrencyDigit === "string");
check(typeof mCurrencies[sCurrencyDigit] === "object");
});
this._set("currency", mCurrencies);
return this;
} | javascript | function(mCurrencies) {
check(typeof mCurrencies === "object" || mCurrencies == null, "mCurrencyDigits must be an object");
Object.keys(mCurrencies || {}).forEach(function(sCurrencyDigit) {
check(typeof sCurrencyDigit === "string");
check(typeof mCurrencies[sCurrencyDigit] === "object");
});
this._set("currency", mCurrencies);
return this;
} | [
"function",
"(",
"mCurrencies",
")",
"{",
"check",
"(",
"typeof",
"mCurrencies",
"===",
"\"object\"",
"||",
"mCurrencies",
"==",
"null",
",",
"\"mCurrencyDigits must be an object\"",
")",
";",
"Object",
".",
"keys",
"(",
"mCurrencies",
"||",
"{",
"}",
")",
".",
"forEach",
"(",
"function",
"(",
"sCurrencyDigit",
")",
"{",
"check",
"(",
"typeof",
"sCurrencyDigit",
"===",
"\"string\"",
")",
";",
"check",
"(",
"typeof",
"mCurrencies",
"[",
"sCurrencyDigit",
"]",
"===",
"\"object\"",
")",
";",
"}",
")",
";",
"this",
".",
"_set",
"(",
"\"currency\"",
",",
"mCurrencies",
")",
";",
"return",
"this",
";",
"}"
] | Sets custom currencies and replaces existing entries.
There is a special currency code named "DEFAULT" that is optional.
In case it is set it will be used for all currencies not contained
in the list, otherwise currency digits as defined by the CLDR will
be used as a fallback.
Example:
To use CLDR, but override single currencies
<code>
{
"KWD": {"digits": 3},
"TND" : {"digits": 3}
}
</code>
To replace the CLDR currency digits completely
<code>
{
"DEFAULT": {"digits": 2},
"ADP": {"digits": 0},
...
"XPF": {"digits": 0}
}
</code>
Note: To unset the custom currencies: call with <code>undefined</code>
@public
@param {object} mCurrencies currency map which is set
@returns {sap.ui.core.Configuration.FormatSettings} | [
"Sets",
"custom",
"currencies",
"and",
"replaces",
"existing",
"entries",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/Configuration.js#L1967-L1975 |
|
3,918 | SAP/openui5 | src/sap.ui.core/src/sap/ui/core/Configuration.js | function(sFormatId) {
sFormatId = sFormatId ? String(sFormatId).toUpperCase() : "";
check(!sFormatId || M_ABAP_DATE_FORMAT_PATTERN.hasOwnProperty(sFormatId), "sFormatId must be one of ['1','2','3','4','5','6','7','8','9','A','B','C'] or empty");
var mChanges = this.oConfiguration._collect();
this.sLegacyDateFormat = mChanges.legacyDateFormat = sFormatId;
this.setDatePattern("short", M_ABAP_DATE_FORMAT_PATTERN[sFormatId].pattern);
this.setDatePattern("medium", M_ABAP_DATE_FORMAT_PATTERN[sFormatId].pattern);
this.oConfiguration._endCollect();
return this;
} | javascript | function(sFormatId) {
sFormatId = sFormatId ? String(sFormatId).toUpperCase() : "";
check(!sFormatId || M_ABAP_DATE_FORMAT_PATTERN.hasOwnProperty(sFormatId), "sFormatId must be one of ['1','2','3','4','5','6','7','8','9','A','B','C'] or empty");
var mChanges = this.oConfiguration._collect();
this.sLegacyDateFormat = mChanges.legacyDateFormat = sFormatId;
this.setDatePattern("short", M_ABAP_DATE_FORMAT_PATTERN[sFormatId].pattern);
this.setDatePattern("medium", M_ABAP_DATE_FORMAT_PATTERN[sFormatId].pattern);
this.oConfiguration._endCollect();
return this;
} | [
"function",
"(",
"sFormatId",
")",
"{",
"sFormatId",
"=",
"sFormatId",
"?",
"String",
"(",
"sFormatId",
")",
".",
"toUpperCase",
"(",
")",
":",
"\"\"",
";",
"check",
"(",
"!",
"sFormatId",
"||",
"M_ABAP_DATE_FORMAT_PATTERN",
".",
"hasOwnProperty",
"(",
"sFormatId",
")",
",",
"\"sFormatId must be one of ['1','2','3','4','5','6','7','8','9','A','B','C'] or empty\"",
")",
";",
"var",
"mChanges",
"=",
"this",
".",
"oConfiguration",
".",
"_collect",
"(",
")",
";",
"this",
".",
"sLegacyDateFormat",
"=",
"mChanges",
".",
"legacyDateFormat",
"=",
"sFormatId",
";",
"this",
".",
"setDatePattern",
"(",
"\"short\"",
",",
"M_ABAP_DATE_FORMAT_PATTERN",
"[",
"sFormatId",
"]",
".",
"pattern",
")",
";",
"this",
".",
"setDatePattern",
"(",
"\"medium\"",
",",
"M_ABAP_DATE_FORMAT_PATTERN",
"[",
"sFormatId",
"]",
".",
"pattern",
")",
";",
"this",
".",
"oConfiguration",
".",
"_endCollect",
"(",
")",
";",
"return",
"this",
";",
"}"
] | Allows to specify one of the legacy ABAP date formats.
This method modifies the date patterns for 'short' and 'medium' style with the corresponding ABAP
format. When called with a null or undefined format id, any previously applied format will be removed.
After changing the legacy date format, the framework tries to update localization
specific parts of the UI. See the documentation of {@link sap.ui.core.Configuration#setLanguage}
for details and restrictions.
@param {string} sFormatId id of the ABAP data format (one of '1','2','3','4','5','6','7','8','9','A','B','C')
@return {sap.ui.core.Configuration.FormatSettings} Returns <code>this</code> to allow method chaining
@public | [
"Allows",
"to",
"specify",
"one",
"of",
"the",
"legacy",
"ABAP",
"date",
"formats",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/Configuration.js#L2057-L2066 |
|
3,919 | SAP/openui5 | src/sap.ui.core/src/sap/ui/core/Configuration.js | function(sFormatId) {
check(!sFormatId || M_ABAP_TIME_FORMAT_PATTERN.hasOwnProperty(sFormatId), "sFormatId must be one of ['0','1','2','3','4'] or empty");
var mChanges = this.oConfiguration._collect();
this.sLegacyTimeFormat = mChanges.legacyTimeFormat = sFormatId = sFormatId || "";
this.setTimePattern("short", M_ABAP_TIME_FORMAT_PATTERN[sFormatId]["short"]);
this.setTimePattern("medium", M_ABAP_TIME_FORMAT_PATTERN[sFormatId]["medium"]);
this._setDayPeriods("abbreviated", M_ABAP_TIME_FORMAT_PATTERN[sFormatId].dayPeriods);
this.oConfiguration._endCollect();
return this;
} | javascript | function(sFormatId) {
check(!sFormatId || M_ABAP_TIME_FORMAT_PATTERN.hasOwnProperty(sFormatId), "sFormatId must be one of ['0','1','2','3','4'] or empty");
var mChanges = this.oConfiguration._collect();
this.sLegacyTimeFormat = mChanges.legacyTimeFormat = sFormatId = sFormatId || "";
this.setTimePattern("short", M_ABAP_TIME_FORMAT_PATTERN[sFormatId]["short"]);
this.setTimePattern("medium", M_ABAP_TIME_FORMAT_PATTERN[sFormatId]["medium"]);
this._setDayPeriods("abbreviated", M_ABAP_TIME_FORMAT_PATTERN[sFormatId].dayPeriods);
this.oConfiguration._endCollect();
return this;
} | [
"function",
"(",
"sFormatId",
")",
"{",
"check",
"(",
"!",
"sFormatId",
"||",
"M_ABAP_TIME_FORMAT_PATTERN",
".",
"hasOwnProperty",
"(",
"sFormatId",
")",
",",
"\"sFormatId must be one of ['0','1','2','3','4'] or empty\"",
")",
";",
"var",
"mChanges",
"=",
"this",
".",
"oConfiguration",
".",
"_collect",
"(",
")",
";",
"this",
".",
"sLegacyTimeFormat",
"=",
"mChanges",
".",
"legacyTimeFormat",
"=",
"sFormatId",
"=",
"sFormatId",
"||",
"\"\"",
";",
"this",
".",
"setTimePattern",
"(",
"\"short\"",
",",
"M_ABAP_TIME_FORMAT_PATTERN",
"[",
"sFormatId",
"]",
"[",
"\"short\"",
"]",
")",
";",
"this",
".",
"setTimePattern",
"(",
"\"medium\"",
",",
"M_ABAP_TIME_FORMAT_PATTERN",
"[",
"sFormatId",
"]",
"[",
"\"medium\"",
"]",
")",
";",
"this",
".",
"_setDayPeriods",
"(",
"\"abbreviated\"",
",",
"M_ABAP_TIME_FORMAT_PATTERN",
"[",
"sFormatId",
"]",
".",
"dayPeriods",
")",
";",
"this",
".",
"oConfiguration",
".",
"_endCollect",
"(",
")",
";",
"return",
"this",
";",
"}"
] | Allows to specify one of the legacy ABAP time formats.
This method sets the time patterns for 'short' and 'medium' style to the corresponding ABAP
formats and sets the day period texts to "AM"/"PM" or "am"/"pm" respectively. When called
with a null or undefined format id, any previously applied format will be removed.
After changing the legacy time format, the framework tries to update localization
specific parts of the UI. See the documentation of {@link sap.ui.core.Configuration#setLanguage}
for details and restrictions.
@param {string} sFormatId id of the ABAP time format (one of '0','1','2','3','4')
@return {sap.ui.core.Configuration.FormatSettings} Returns <code>this</code> to allow method chaining
@public | [
"Allows",
"to",
"specify",
"one",
"of",
"the",
"legacy",
"ABAP",
"time",
"formats",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/Configuration.js#L2092-L2101 |
|
3,920 | SAP/openui5 | src/sap.ui.core/src/sap/ui/core/Configuration.js | function(sFormatId) {
sFormatId = sFormatId ? sFormatId.toUpperCase() : "";
check(!sFormatId || M_ABAP_NUMBER_FORMAT_SYMBOLS.hasOwnProperty(sFormatId), "sFormatId must be one of [' ','X','Y'] or empty");
var mChanges = this.oConfiguration._collect();
this.sLegacyNumberFormat = mChanges.legacyNumberFormat = sFormatId;
this.setNumberSymbol("group", M_ABAP_NUMBER_FORMAT_SYMBOLS[sFormatId].groupingSeparator);
this.setNumberSymbol("decimal", M_ABAP_NUMBER_FORMAT_SYMBOLS[sFormatId].decimalSeparator);
this.oConfiguration._endCollect();
return this;
} | javascript | function(sFormatId) {
sFormatId = sFormatId ? sFormatId.toUpperCase() : "";
check(!sFormatId || M_ABAP_NUMBER_FORMAT_SYMBOLS.hasOwnProperty(sFormatId), "sFormatId must be one of [' ','X','Y'] or empty");
var mChanges = this.oConfiguration._collect();
this.sLegacyNumberFormat = mChanges.legacyNumberFormat = sFormatId;
this.setNumberSymbol("group", M_ABAP_NUMBER_FORMAT_SYMBOLS[sFormatId].groupingSeparator);
this.setNumberSymbol("decimal", M_ABAP_NUMBER_FORMAT_SYMBOLS[sFormatId].decimalSeparator);
this.oConfiguration._endCollect();
return this;
} | [
"function",
"(",
"sFormatId",
")",
"{",
"sFormatId",
"=",
"sFormatId",
"?",
"sFormatId",
".",
"toUpperCase",
"(",
")",
":",
"\"\"",
";",
"check",
"(",
"!",
"sFormatId",
"||",
"M_ABAP_NUMBER_FORMAT_SYMBOLS",
".",
"hasOwnProperty",
"(",
"sFormatId",
")",
",",
"\"sFormatId must be one of [' ','X','Y'] or empty\"",
")",
";",
"var",
"mChanges",
"=",
"this",
".",
"oConfiguration",
".",
"_collect",
"(",
")",
";",
"this",
".",
"sLegacyNumberFormat",
"=",
"mChanges",
".",
"legacyNumberFormat",
"=",
"sFormatId",
";",
"this",
".",
"setNumberSymbol",
"(",
"\"group\"",
",",
"M_ABAP_NUMBER_FORMAT_SYMBOLS",
"[",
"sFormatId",
"]",
".",
"groupingSeparator",
")",
";",
"this",
".",
"setNumberSymbol",
"(",
"\"decimal\"",
",",
"M_ABAP_NUMBER_FORMAT_SYMBOLS",
"[",
"sFormatId",
"]",
".",
"decimalSeparator",
")",
";",
"this",
".",
"oConfiguration",
".",
"_endCollect",
"(",
")",
";",
"return",
"this",
";",
"}"
] | Allows to specify one of the legacy ABAP number format.
This method will modify the 'group' and 'decimal' symbols. When called with a null
or undefined format id, any previously applied format will be removed.
After changing the legacy number format, the framework tries to update localization
specific parts of the UI. See the documentation of {@link sap.ui.core.Configuration#setLanguage}
for details and restrictions.
@param {string} sFormatId id of the ABAP number format set (one of ' ','X','Y')
@return {sap.ui.core.Configuration.FormatSettings} Returns <code>this</code> to allow method chaining
@public | [
"Allows",
"to",
"specify",
"one",
"of",
"the",
"legacy",
"ABAP",
"number",
"format",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/Configuration.js#L2126-L2135 |
|
3,921 | SAP/openui5 | src/sap.ui.core/src/sap/ui/core/Configuration.js | function(aMappings) {
check(Array.isArray(aMappings), "aMappings must be an Array");
var mChanges = this.oConfiguration._collect();
this.aLegacyDateCalendarCustomizing = mChanges.legacyDateCalendarCustomizing = aMappings;
this.oConfiguration._endCollect();
return this;
} | javascript | function(aMappings) {
check(Array.isArray(aMappings), "aMappings must be an Array");
var mChanges = this.oConfiguration._collect();
this.aLegacyDateCalendarCustomizing = mChanges.legacyDateCalendarCustomizing = aMappings;
this.oConfiguration._endCollect();
return this;
} | [
"function",
"(",
"aMappings",
")",
"{",
"check",
"(",
"Array",
".",
"isArray",
"(",
"aMappings",
")",
",",
"\"aMappings must be an Array\"",
")",
";",
"var",
"mChanges",
"=",
"this",
".",
"oConfiguration",
".",
"_collect",
"(",
")",
";",
"this",
".",
"aLegacyDateCalendarCustomizing",
"=",
"mChanges",
".",
"legacyDateCalendarCustomizing",
"=",
"aMappings",
";",
"this",
".",
"oConfiguration",
".",
"_endCollect",
"(",
")",
";",
"return",
"this",
";",
"}"
] | Allows to specify the customizing data for Islamic calendar support
@param {object[]} aMappings contains the customizing data for the support of Islamic calendar.
@param {string} aMappings[].dateFormat The date format
@param {string} aMappings[].islamicMonthStart The Islamic date
@param {string} aMappings[].gregDate The corresponding Gregorian date
@return {sap.ui.core.Configuration.FormatSettings} Returns <code>this</code> to allow method chaining
@public | [
"Allows",
"to",
"specify",
"the",
"customizing",
"data",
"for",
"Islamic",
"calendar",
"support"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/Configuration.js#L2147-L2154 |
|
3,922 | SAP/openui5 | src/sap.ui.table/src/sap/ui/table/TableAccExtension.js | function(oEvent) {
var oTable = this.getTable();
if (!oTable || TableUtils.getCellInfo(oEvent.target).cell == null) {
return;
}
if (oTable._mTimeouts._cleanupACCExtension) {
clearTimeout(oTable._mTimeouts._cleanupACCExtension);
oTable._mTimeouts._cleanupACCExtension = null;
}
this.updateAccForCurrentCell("Focus");
} | javascript | function(oEvent) {
var oTable = this.getTable();
if (!oTable || TableUtils.getCellInfo(oEvent.target).cell == null) {
return;
}
if (oTable._mTimeouts._cleanupACCExtension) {
clearTimeout(oTable._mTimeouts._cleanupACCExtension);
oTable._mTimeouts._cleanupACCExtension = null;
}
this.updateAccForCurrentCell("Focus");
} | [
"function",
"(",
"oEvent",
")",
"{",
"var",
"oTable",
"=",
"this",
".",
"getTable",
"(",
")",
";",
"if",
"(",
"!",
"oTable",
"||",
"TableUtils",
".",
"getCellInfo",
"(",
"oEvent",
".",
"target",
")",
".",
"cell",
"==",
"null",
")",
"{",
"return",
";",
"}",
"if",
"(",
"oTable",
".",
"_mTimeouts",
".",
"_cleanupACCExtension",
")",
"{",
"clearTimeout",
"(",
"oTable",
".",
"_mTimeouts",
".",
"_cleanupACCExtension",
")",
";",
"oTable",
".",
"_mTimeouts",
".",
"_cleanupACCExtension",
"=",
"null",
";",
"}",
"this",
".",
"updateAccForCurrentCell",
"(",
"\"Focus\"",
")",
";",
"}"
] | Delegate for the focusin event.
@private
@param {jQuery.Event} oEvent The event object. | [
"Delegate",
"for",
"the",
"focusin",
"event",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/TableAccExtension.js#L958-L968 |
|
3,923 | SAP/openui5 | src/sap.ui.table/src/sap/ui/table/TableAccExtension.js | function(oEvent) {
var oTable = this.getTable();
if (!oTable) {
return;
}
oTable.$("sapUiTableGridCnt").attr("role", ExtensionHelper.getAriaAttributesFor(this, "CONTENT", {}).role);
oTable._mTimeouts._cleanupACCExtension = setTimeout(function() {
var oTable = this.getTable();
if (!oTable) {
return;
}
this._iLastRowNumber = null;
this._iLastColumnNumber = null;
ExtensionHelper.cleanupCellModifications(this);
oTable._mTimeouts._cleanupACCExtension = null;
}.bind(this), 100);
} | javascript | function(oEvent) {
var oTable = this.getTable();
if (!oTable) {
return;
}
oTable.$("sapUiTableGridCnt").attr("role", ExtensionHelper.getAriaAttributesFor(this, "CONTENT", {}).role);
oTable._mTimeouts._cleanupACCExtension = setTimeout(function() {
var oTable = this.getTable();
if (!oTable) {
return;
}
this._iLastRowNumber = null;
this._iLastColumnNumber = null;
ExtensionHelper.cleanupCellModifications(this);
oTable._mTimeouts._cleanupACCExtension = null;
}.bind(this), 100);
} | [
"function",
"(",
"oEvent",
")",
"{",
"var",
"oTable",
"=",
"this",
".",
"getTable",
"(",
")",
";",
"if",
"(",
"!",
"oTable",
")",
"{",
"return",
";",
"}",
"oTable",
".",
"$",
"(",
"\"sapUiTableGridCnt\"",
")",
".",
"attr",
"(",
"\"role\"",
",",
"ExtensionHelper",
".",
"getAriaAttributesFor",
"(",
"this",
",",
"\"CONTENT\"",
",",
"{",
"}",
")",
".",
"role",
")",
";",
"oTable",
".",
"_mTimeouts",
".",
"_cleanupACCExtension",
"=",
"setTimeout",
"(",
"function",
"(",
")",
"{",
"var",
"oTable",
"=",
"this",
".",
"getTable",
"(",
")",
";",
"if",
"(",
"!",
"oTable",
")",
"{",
"return",
";",
"}",
"this",
".",
"_iLastRowNumber",
"=",
"null",
";",
"this",
".",
"_iLastColumnNumber",
"=",
"null",
";",
"ExtensionHelper",
".",
"cleanupCellModifications",
"(",
"this",
")",
";",
"oTable",
".",
"_mTimeouts",
".",
"_cleanupACCExtension",
"=",
"null",
";",
"}",
".",
"bind",
"(",
"this",
")",
",",
"100",
")",
";",
"}"
] | Delegate for the focusout event.
@private
@param {jQuery.Event} oEvent The event object. | [
"Delegate",
"for",
"the",
"focusout",
"event",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/TableAccExtension.js#L976-L992 |
|
3,924 | SAP/openui5 | src/sap.ui.commons/src/sap/ui/commons/layout/AbsoluteLayout.js | function(aPositions) {
for (var index = 0; index < aPositions.length; index++) {
var oPosition = aPositions[index];
var oChildControl = oPosition.getControl();
if (oChildControl) {
AbsoluteLayout.cleanUpControl(oChildControl);
}
}
} | javascript | function(aPositions) {
for (var index = 0; index < aPositions.length; index++) {
var oPosition = aPositions[index];
var oChildControl = oPosition.getControl();
if (oChildControl) {
AbsoluteLayout.cleanUpControl(oChildControl);
}
}
} | [
"function",
"(",
"aPositions",
")",
"{",
"for",
"(",
"var",
"index",
"=",
"0",
";",
"index",
"<",
"aPositions",
".",
"length",
";",
"index",
"++",
")",
"{",
"var",
"oPosition",
"=",
"aPositions",
"[",
"index",
"]",
";",
"var",
"oChildControl",
"=",
"oPosition",
".",
"getControl",
"(",
")",
";",
"if",
"(",
"oChildControl",
")",
"{",
"AbsoluteLayout",
".",
"cleanUpControl",
"(",
"oChildControl",
")",
";",
"}",
"}",
"}"
] | Cleanup modifications of all child controls of the given positions.
@private | [
"Cleanup",
"modifications",
"of",
"all",
"child",
"controls",
"of",
"the",
"given",
"positions",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.commons/src/sap/ui/commons/layout/AbsoluteLayout.js#L520-L528 |
|
3,925 | SAP/openui5 | src/sap.ui.commons/src/sap/ui/commons/layout/AbsoluteLayout.js | function(oControl){
var bAdapted = false;
if (oControl.getParent() && oControl.getParent().getComputedPosition) {
var oPos = oControl.getParent().getComputedPosition();
if (oPos.top && oPos.bottom || oPos.height) {
jQuery(oControl.getDomRef()).css("height", "100%");
bAdapted = true;
}
if (oPos.left && oPos.right || oPos.width) {
jQuery(oControl.getDomRef()).css("width", "100%");
bAdapted = true;
}
if (bAdapted) {
AbsoluteLayoutRenderer.updatePositionStyles(oControl.getParent());
}
}
return bAdapted;
} | javascript | function(oControl){
var bAdapted = false;
if (oControl.getParent() && oControl.getParent().getComputedPosition) {
var oPos = oControl.getParent().getComputedPosition();
if (oPos.top && oPos.bottom || oPos.height) {
jQuery(oControl.getDomRef()).css("height", "100%");
bAdapted = true;
}
if (oPos.left && oPos.right || oPos.width) {
jQuery(oControl.getDomRef()).css("width", "100%");
bAdapted = true;
}
if (bAdapted) {
AbsoluteLayoutRenderer.updatePositionStyles(oControl.getParent());
}
}
return bAdapted;
} | [
"function",
"(",
"oControl",
")",
"{",
"var",
"bAdapted",
"=",
"false",
";",
"if",
"(",
"oControl",
".",
"getParent",
"(",
")",
"&&",
"oControl",
".",
"getParent",
"(",
")",
".",
"getComputedPosition",
")",
"{",
"var",
"oPos",
"=",
"oControl",
".",
"getParent",
"(",
")",
".",
"getComputedPosition",
"(",
")",
";",
"if",
"(",
"oPos",
".",
"top",
"&&",
"oPos",
".",
"bottom",
"||",
"oPos",
".",
"height",
")",
"{",
"jQuery",
"(",
"oControl",
".",
"getDomRef",
"(",
")",
")",
".",
"css",
"(",
"\"height\"",
",",
"\"100%\"",
")",
";",
"bAdapted",
"=",
"true",
";",
"}",
"if",
"(",
"oPos",
".",
"left",
"&&",
"oPos",
".",
"right",
"||",
"oPos",
".",
"width",
")",
"{",
"jQuery",
"(",
"oControl",
".",
"getDomRef",
"(",
")",
")",
".",
"css",
"(",
"\"width\"",
",",
"\"100%\"",
")",
";",
"bAdapted",
"=",
"true",
";",
"}",
"if",
"(",
"bAdapted",
")",
"{",
"AbsoluteLayoutRenderer",
".",
"updatePositionStyles",
"(",
"oControl",
".",
"getParent",
"(",
")",
")",
";",
"}",
"}",
"return",
"bAdapted",
";",
"}"
] | Adapt the sizes of controls if necessary.
@private | [
"Adapt",
"the",
"sizes",
"of",
"controls",
"if",
"necessary",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.commons/src/sap/ui/commons/layout/AbsoluteLayout.js#L564-L581 |
|
3,926 | SAP/openui5 | src/sap.ui.commons/src/sap/ui/commons/layout/AbsoluteLayout.js | function(oThis, sProp, oValue, sChangeType) {
var bHasDomRef = !!oThis.getDomRef();
oThis.setProperty(sProp, oValue, bHasDomRef);
if (bHasDomRef) {
oThis.contentChanged(null, sChangeType);
}
return oThis;
} | javascript | function(oThis, sProp, oValue, sChangeType) {
var bHasDomRef = !!oThis.getDomRef();
oThis.setProperty(sProp, oValue, bHasDomRef);
if (bHasDomRef) {
oThis.contentChanged(null, sChangeType);
}
return oThis;
} | [
"function",
"(",
"oThis",
",",
"sProp",
",",
"oValue",
",",
"sChangeType",
")",
"{",
"var",
"bHasDomRef",
"=",
"!",
"!",
"oThis",
".",
"getDomRef",
"(",
")",
";",
"oThis",
".",
"setProperty",
"(",
"sProp",
",",
"oValue",
",",
"bHasDomRef",
")",
";",
"if",
"(",
"bHasDomRef",
")",
"{",
"oThis",
".",
"contentChanged",
"(",
"null",
",",
"sChangeType",
")",
";",
"}",
"return",
"oThis",
";",
"}"
] | Sets the value of the given property and triggers Dom change if
possible.
@private | [
"Sets",
"the",
"value",
"of",
"the",
"given",
"property",
"and",
"triggers",
"Dom",
"change",
"if",
"possible",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.commons/src/sap/ui/commons/layout/AbsoluteLayout.js#L590-L597 |
|
3,927 | SAP/openui5 | src/sap.ui.core/src/sap/ui/model/odata/type/DateTime.js | adjustConstraints | function adjustConstraints(oType, oConstraints) {
var oAdjustedConstraints = {};
if (oConstraints) {
switch (oConstraints.displayFormat) {
case "Date":
oAdjustedConstraints.isDateOnly = true;
break;
case undefined:
break;
default:
Log.warning("Illegal displayFormat: " + oConstraints.displayFormat,
null, oType.getName());
}
oAdjustedConstraints.nullable = oConstraints.nullable;
}
return oAdjustedConstraints;
} | javascript | function adjustConstraints(oType, oConstraints) {
var oAdjustedConstraints = {};
if (oConstraints) {
switch (oConstraints.displayFormat) {
case "Date":
oAdjustedConstraints.isDateOnly = true;
break;
case undefined:
break;
default:
Log.warning("Illegal displayFormat: " + oConstraints.displayFormat,
null, oType.getName());
}
oAdjustedConstraints.nullable = oConstraints.nullable;
}
return oAdjustedConstraints;
} | [
"function",
"adjustConstraints",
"(",
"oType",
",",
"oConstraints",
")",
"{",
"var",
"oAdjustedConstraints",
"=",
"{",
"}",
";",
"if",
"(",
"oConstraints",
")",
"{",
"switch",
"(",
"oConstraints",
".",
"displayFormat",
")",
"{",
"case",
"\"Date\"",
":",
"oAdjustedConstraints",
".",
"isDateOnly",
"=",
"true",
";",
"break",
";",
"case",
"undefined",
":",
"break",
";",
"default",
":",
"Log",
".",
"warning",
"(",
"\"Illegal displayFormat: \"",
"+",
"oConstraints",
".",
"displayFormat",
",",
"null",
",",
"oType",
".",
"getName",
"(",
")",
")",
";",
"}",
"oAdjustedConstraints",
".",
"nullable",
"=",
"oConstraints",
".",
"nullable",
";",
"}",
"return",
"oAdjustedConstraints",
";",
"}"
] | Adjusts the constraints for DateTimeBase.
@param {sap.ui.model.odata.type.DateTime} oType
the type
@param {object} [oConstraints]
constraints, see {@link #constructor}
@returns {object}
the constraints adjusted for DateTimeBase | [
"Adjusts",
"the",
"constraints",
"for",
"DateTimeBase",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/type/DateTime.js#L21-L38 |
3,928 | SAP/openui5 | src/sap.ui.table/src/sap/ui/table/TableMenuUtils.js | function(oTable, iColumnIndex, bHoverFirstMenuItem, oCell) {
if (!oTable ||
iColumnIndex == null || iColumnIndex < 0) {
return;
}
if (bHoverFirstMenuItem == null) {
bHoverFirstMenuItem = false;
}
var oColumns = oTable.getColumns();
if (iColumnIndex >= oColumns.length) {
return;
}
var oColumn = oColumns[iColumnIndex];
if (!oColumn.getVisible()) {
return;
}
// Close all menus.
for (var i = 0; i < oColumns.length; i++) {
// If column menus of other columns are open, close them.
if (oColumns[i] !== oColumn) {
MenuUtils.closeColumnContextMenu(oTable, i);
}
}
MenuUtils.closeDataCellContextMenu(oTable);
var colspan = oCell && oCell.attr("colspan");
if (colspan && colspan !== "1") {
return; // headers with span do not have connection to a column, do not open the context menu
}
oColumn._openMenu(oCell && oCell[0] || oColumn.getDomRef(), bHoverFirstMenuItem);
} | javascript | function(oTable, iColumnIndex, bHoverFirstMenuItem, oCell) {
if (!oTable ||
iColumnIndex == null || iColumnIndex < 0) {
return;
}
if (bHoverFirstMenuItem == null) {
bHoverFirstMenuItem = false;
}
var oColumns = oTable.getColumns();
if (iColumnIndex >= oColumns.length) {
return;
}
var oColumn = oColumns[iColumnIndex];
if (!oColumn.getVisible()) {
return;
}
// Close all menus.
for (var i = 0; i < oColumns.length; i++) {
// If column menus of other columns are open, close them.
if (oColumns[i] !== oColumn) {
MenuUtils.closeColumnContextMenu(oTable, i);
}
}
MenuUtils.closeDataCellContextMenu(oTable);
var colspan = oCell && oCell.attr("colspan");
if (colspan && colspan !== "1") {
return; // headers with span do not have connection to a column, do not open the context menu
}
oColumn._openMenu(oCell && oCell[0] || oColumn.getDomRef(), bHoverFirstMenuItem);
} | [
"function",
"(",
"oTable",
",",
"iColumnIndex",
",",
"bHoverFirstMenuItem",
",",
"oCell",
")",
"{",
"if",
"(",
"!",
"oTable",
"||",
"iColumnIndex",
"==",
"null",
"||",
"iColumnIndex",
"<",
"0",
")",
"{",
"return",
";",
"}",
"if",
"(",
"bHoverFirstMenuItem",
"==",
"null",
")",
"{",
"bHoverFirstMenuItem",
"=",
"false",
";",
"}",
"var",
"oColumns",
"=",
"oTable",
".",
"getColumns",
"(",
")",
";",
"if",
"(",
"iColumnIndex",
">=",
"oColumns",
".",
"length",
")",
"{",
"return",
";",
"}",
"var",
"oColumn",
"=",
"oColumns",
"[",
"iColumnIndex",
"]",
";",
"if",
"(",
"!",
"oColumn",
".",
"getVisible",
"(",
")",
")",
"{",
"return",
";",
"}",
"// Close all menus.",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"oColumns",
".",
"length",
";",
"i",
"++",
")",
"{",
"// If column menus of other columns are open, close them.",
"if",
"(",
"oColumns",
"[",
"i",
"]",
"!==",
"oColumn",
")",
"{",
"MenuUtils",
".",
"closeColumnContextMenu",
"(",
"oTable",
",",
"i",
")",
";",
"}",
"}",
"MenuUtils",
".",
"closeDataCellContextMenu",
"(",
"oTable",
")",
";",
"var",
"colspan",
"=",
"oCell",
"&&",
"oCell",
".",
"attr",
"(",
"\"colspan\"",
")",
";",
"if",
"(",
"colspan",
"&&",
"colspan",
"!==",
"\"1\"",
")",
"{",
"return",
";",
"// headers with span do not have connection to a column, do not open the context menu",
"}",
"oColumn",
".",
"_openMenu",
"(",
"oCell",
"&&",
"oCell",
"[",
"0",
"]",
"||",
"oColumn",
".",
"getDomRef",
"(",
")",
",",
"bHoverFirstMenuItem",
")",
";",
"}"
] | Opens the context menu of a column.
If context menus of other columns are open, they will be closed.
@param {sap.ui.table.Table} oTable Instance of the table.
@param {int} iColumnIndex The index of the column to open the context menu on.
@param {boolean} [bHoverFirstMenuItem] If <code>true</code>, the first item in the opened menu will be hovered.
@param {jQuery} oCell The column header cell to which the menu should be attached.
@see openContextMenu
@see closeColumnContextMenu
@private | [
"Opens",
"the",
"context",
"menu",
"of",
"a",
"column",
".",
"If",
"context",
"menus",
"of",
"other",
"columns",
"are",
"open",
"they",
"will",
"be",
"closed",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/TableMenuUtils.js#L149-L183 |
|
3,929 | SAP/openui5 | src/sap.ui.table/src/sap/ui/table/TableMenuUtils.js | function(oTable, iColumnIndex) {
if (!oTable ||
iColumnIndex == null || iColumnIndex < 0) {
return;
}
var oColumns = oTable.getColumns();
if (iColumnIndex >= oColumns.length) {
return;
}
var oColumn = oColumns[iColumnIndex];
oColumn._closeMenu();
} | javascript | function(oTable, iColumnIndex) {
if (!oTable ||
iColumnIndex == null || iColumnIndex < 0) {
return;
}
var oColumns = oTable.getColumns();
if (iColumnIndex >= oColumns.length) {
return;
}
var oColumn = oColumns[iColumnIndex];
oColumn._closeMenu();
} | [
"function",
"(",
"oTable",
",",
"iColumnIndex",
")",
"{",
"if",
"(",
"!",
"oTable",
"||",
"iColumnIndex",
"==",
"null",
"||",
"iColumnIndex",
"<",
"0",
")",
"{",
"return",
";",
"}",
"var",
"oColumns",
"=",
"oTable",
".",
"getColumns",
"(",
")",
";",
"if",
"(",
"iColumnIndex",
">=",
"oColumns",
".",
"length",
")",
"{",
"return",
";",
"}",
"var",
"oColumn",
"=",
"oColumns",
"[",
"iColumnIndex",
"]",
";",
"oColumn",
".",
"_closeMenu",
"(",
")",
";",
"}"
] | Closes the context menu of a column.
@param {sap.ui.table.Table} oTable Instance of the table.
@param {int} iColumnIndex The index of the column to close the context menu on.
@see openContextMenu
@see openColumnContextMenu
@private | [
"Closes",
"the",
"context",
"menu",
"of",
"a",
"column",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/TableMenuUtils.js#L194-L207 |
|
3,930 | SAP/openui5 | src/sap.ui.table/src/sap/ui/table/TableMenuUtils.js | function(oTable) {
if (!oTable) {
return;
}
var oMenu = oTable._oCellContextMenu;
var bMenuOpen = oMenu != null && oMenu.bOpen;
if (bMenuOpen) {
oMenu.close();
}
} | javascript | function(oTable) {
if (!oTable) {
return;
}
var oMenu = oTable._oCellContextMenu;
var bMenuOpen = oMenu != null && oMenu.bOpen;
if (bMenuOpen) {
oMenu.close();
}
} | [
"function",
"(",
"oTable",
")",
"{",
"if",
"(",
"!",
"oTable",
")",
"{",
"return",
";",
"}",
"var",
"oMenu",
"=",
"oTable",
".",
"_oCellContextMenu",
";",
"var",
"bMenuOpen",
"=",
"oMenu",
"!=",
"null",
"&&",
"oMenu",
".",
"bOpen",
";",
"if",
"(",
"bMenuOpen",
")",
"{",
"oMenu",
".",
"close",
"(",
")",
";",
"}",
"}"
] | Closes the currently open data cell context menu.
Index information are not required as there is only one data cell context menu object and therefore only this one can be open.
@param {sap.ui.table.Table} oTable Instance of the table.
@see openContextMenu
@see openDataCellContextMenu
@private | [
"Closes",
"the",
"currently",
"open",
"data",
"cell",
"context",
"menu",
".",
"Index",
"information",
"are",
"not",
"required",
"as",
"there",
"is",
"only",
"one",
"data",
"cell",
"context",
"menu",
"object",
"and",
"therefore",
"only",
"this",
"one",
"can",
"be",
"open",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/TableMenuUtils.js#L313-L324 |
|
3,931 | SAP/openui5 | src/sap.ui.table/src/sap/ui/table/TableMenuUtils.js | function(oTable) {
if (!oTable || !oTable._oCellContextMenu) {
return;
}
oTable._oCellContextMenu.destroy();
oTable._oCellContextMenu = null;
} | javascript | function(oTable) {
if (!oTable || !oTable._oCellContextMenu) {
return;
}
oTable._oCellContextMenu.destroy();
oTable._oCellContextMenu = null;
} | [
"function",
"(",
"oTable",
")",
"{",
"if",
"(",
"!",
"oTable",
"||",
"!",
"oTable",
".",
"_oCellContextMenu",
")",
"{",
"return",
";",
"}",
"oTable",
".",
"_oCellContextMenu",
".",
"destroy",
"(",
")",
";",
"oTable",
".",
"_oCellContextMenu",
"=",
"null",
";",
"}"
] | Destroys the cell context menu.
@param {sap.ui.table.Table} oTable Instance of the table. | [
"Destroys",
"the",
"cell",
"context",
"menu",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/TableMenuUtils.js#L331-L338 |
|
3,932 | SAP/openui5 | src/sap.ui.core/src/sap/ui/qunit/utils/MemoryLeakCheck.js | function(assert, mActual, mExpected, sMessage) {
var aUnexpectedElements = [];
for (var sId in mActual) {
if (!mExpected[sId]) {
aUnexpectedElements.push(mActual[sId]);
}
}
// enrich with helpful info to more easily identify the leaked control
for (var i = 0; i < aUnexpectedElements.length; i++) {
if (typeof aUnexpectedElements[i].getText === "function") {
aUnexpectedElements[i] += " (text: '" + aUnexpectedElements[i].getText() + "')";
}
}
sMessage = sMessage + (aUnexpectedElements.length > 0 ? ". LEFTOVERS: " + aUnexpectedElements.join(", ") : "");
assert.equal(aUnexpectedElements.length, 0, sMessage);
} | javascript | function(assert, mActual, mExpected, sMessage) {
var aUnexpectedElements = [];
for (var sId in mActual) {
if (!mExpected[sId]) {
aUnexpectedElements.push(mActual[sId]);
}
}
// enrich with helpful info to more easily identify the leaked control
for (var i = 0; i < aUnexpectedElements.length; i++) {
if (typeof aUnexpectedElements[i].getText === "function") {
aUnexpectedElements[i] += " (text: '" + aUnexpectedElements[i].getText() + "')";
}
}
sMessage = sMessage + (aUnexpectedElements.length > 0 ? ". LEFTOVERS: " + aUnexpectedElements.join(", ") : "");
assert.equal(aUnexpectedElements.length, 0, sMessage);
} | [
"function",
"(",
"assert",
",",
"mActual",
",",
"mExpected",
",",
"sMessage",
")",
"{",
"var",
"aUnexpectedElements",
"=",
"[",
"]",
";",
"for",
"(",
"var",
"sId",
"in",
"mActual",
")",
"{",
"if",
"(",
"!",
"mExpected",
"[",
"sId",
"]",
")",
"{",
"aUnexpectedElements",
".",
"push",
"(",
"mActual",
"[",
"sId",
"]",
")",
";",
"}",
"}",
"// enrich with helpful info to more easily identify the leaked control",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"aUnexpectedElements",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"typeof",
"aUnexpectedElements",
"[",
"i",
"]",
".",
"getText",
"===",
"\"function\"",
")",
"{",
"aUnexpectedElements",
"[",
"i",
"]",
"+=",
"\" (text: '\"",
"+",
"aUnexpectedElements",
"[",
"i",
"]",
".",
"getText",
"(",
")",
"+",
"\"')\"",
";",
"}",
"}",
"sMessage",
"=",
"sMessage",
"+",
"(",
"aUnexpectedElements",
".",
"length",
">",
"0",
"?",
"\". LEFTOVERS: \"",
"+",
"aUnexpectedElements",
".",
"join",
"(",
"\", \"",
")",
":",
"\"\"",
")",
";",
"assert",
".",
"equal",
"(",
"aUnexpectedElements",
".",
"length",
",",
"0",
",",
"sMessage",
")",
";",
"}"
] | asserts that both given maps have the same entries | [
"asserts",
"that",
"both",
"given",
"maps",
"have",
"the",
"same",
"entries"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/qunit/utils/MemoryLeakCheck.js#L156-L174 |
|
3,933 | SAP/openui5 | src/sap.ui.core/src/sap/ui/model/odata/v2/ODataListBinding.js | getSortComparator | function getSortComparator(fnCompare) {
return function(vValue1, vValue2) {
if (vValue1 === vValue2) {
return 0;
}
if (vValue1 === null) {
return -1;
}
if (vValue2 === null) {
return 1;
}
return fnCompare(vValue1, vValue2);
};
} | javascript | function getSortComparator(fnCompare) {
return function(vValue1, vValue2) {
if (vValue1 === vValue2) {
return 0;
}
if (vValue1 === null) {
return -1;
}
if (vValue2 === null) {
return 1;
}
return fnCompare(vValue1, vValue2);
};
} | [
"function",
"getSortComparator",
"(",
"fnCompare",
")",
"{",
"return",
"function",
"(",
"vValue1",
",",
"vValue2",
")",
"{",
"if",
"(",
"vValue1",
"===",
"vValue2",
")",
"{",
"return",
"0",
";",
"}",
"if",
"(",
"vValue1",
"===",
"null",
")",
"{",
"return",
"-",
"1",
";",
"}",
"if",
"(",
"vValue2",
"===",
"null",
")",
"{",
"return",
"1",
";",
"}",
"return",
"fnCompare",
"(",
"vValue1",
",",
"vValue2",
")",
";",
"}",
";",
"}"
] | Creates a comparator usable for sorting.
The OData comparators return "NaN" for comparisons containing null values. While this is a valid result when used for filtering,
for sorting the null values need to be put in order, so the comparator must return either -1 or 1 instead, to have null sorted
at the top in ascending order and on the bottom in descending order.
@private | [
"Creates",
"a",
"comparator",
"usable",
"for",
"sorting",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/v2/ODataListBinding.js#L1269-L1282 |
3,934 | SAP/openui5 | src/sap.ui.core/src/sap/ui/core/RenderManager.js | reset | function reset() {
aBuffer = that.aBuffer = [];
aRenderedControls = that.aRenderedControls = [];
aStyleStack = that.aStyleStack = [{}];
} | javascript | function reset() {
aBuffer = that.aBuffer = [];
aRenderedControls = that.aRenderedControls = [];
aStyleStack = that.aStyleStack = [{}];
} | [
"function",
"reset",
"(",
")",
"{",
"aBuffer",
"=",
"that",
".",
"aBuffer",
"=",
"[",
"]",
";",
"aRenderedControls",
"=",
"that",
".",
"aRenderedControls",
"=",
"[",
"]",
";",
"aStyleStack",
"=",
"that",
".",
"aStyleStack",
"=",
"[",
"{",
"}",
"]",
";",
"}"
] | Reset all rendering related buffers. | [
"Reset",
"all",
"rendering",
"related",
"buffers",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/RenderManager.js#L114-L118 |
3,935 | SAP/openui5 | src/sap.ui.core/src/sap/ui/core/RenderManager.js | triggerBeforeRendering | function triggerBeforeRendering(oControl){
bLocked = true;
try {
var oEvent = jQuery.Event("BeforeRendering");
// store the element on the event (aligned with jQuery syntax)
oEvent.srcControl = oControl;
oControl._handleEvent(oEvent);
} finally {
bLocked = false;
}
} | javascript | function triggerBeforeRendering(oControl){
bLocked = true;
try {
var oEvent = jQuery.Event("BeforeRendering");
// store the element on the event (aligned with jQuery syntax)
oEvent.srcControl = oControl;
oControl._handleEvent(oEvent);
} finally {
bLocked = false;
}
} | [
"function",
"triggerBeforeRendering",
"(",
"oControl",
")",
"{",
"bLocked",
"=",
"true",
";",
"try",
"{",
"var",
"oEvent",
"=",
"jQuery",
".",
"Event",
"(",
"\"BeforeRendering\"",
")",
";",
"// store the element on the event (aligned with jQuery syntax)",
"oEvent",
".",
"srcControl",
"=",
"oControl",
";",
"oControl",
".",
"_handleEvent",
"(",
"oEvent",
")",
";",
"}",
"finally",
"{",
"bLocked",
"=",
"false",
";",
"}",
"}"
] | Triggers the BeforeRendering event on the given Control | [
"Triggers",
"the",
"BeforeRendering",
"event",
"on",
"the",
"given",
"Control"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/RenderManager.js#L577-L587 |
3,936 | SAP/openui5 | src/sap.ui.core/src/sap/ui/core/RenderManager.js | isDomPatchingEnabled | function isDomPatchingEnabled() {
if (bDomPatching === undefined) {
bDomPatching = sap.ui.getCore().getConfiguration().getDomPatching();
if (bDomPatching) {
Log.warning("DOM Patching is enabled: This feature should be used only for testing purposes!");
}
}
return bDomPatching;
} | javascript | function isDomPatchingEnabled() {
if (bDomPatching === undefined) {
bDomPatching = sap.ui.getCore().getConfiguration().getDomPatching();
if (bDomPatching) {
Log.warning("DOM Patching is enabled: This feature should be used only for testing purposes!");
}
}
return bDomPatching;
} | [
"function",
"isDomPatchingEnabled",
"(",
")",
"{",
"if",
"(",
"bDomPatching",
"===",
"undefined",
")",
"{",
"bDomPatching",
"=",
"sap",
".",
"ui",
".",
"getCore",
"(",
")",
".",
"getConfiguration",
"(",
")",
".",
"getDomPatching",
"(",
")",
";",
"if",
"(",
"bDomPatching",
")",
"{",
"Log",
".",
"warning",
"(",
"\"DOM Patching is enabled: This feature should be used only for testing purposes!\"",
")",
";",
"}",
"}",
"return",
"bDomPatching",
";",
"}"
] | Determines whether Dom Patching is enabled or not
@returns {boolean} whether or not dom patching is enabled
@private | [
"Determines",
"whether",
"Dom",
"Patching",
"is",
"enabled",
"or",
"not"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/RenderManager.js#L1831-L1840 |
3,937 | SAP/openui5 | src/sap.ui.ux3/src/sap/ui/ux3/NotificationBarRenderer.js | function(oRm, oControl) {
if (oControl.getResizeEnabled()) {
fnRenderToggler(oRm, oControl);
}
if (oControl.hasItems()) {
if (oControl.getVisibleStatus() == NotificationBarStatus.Max) {
fnWriteItemsMaximized(oRm, oControl);
} else {
fnWriteItemsDefault(oRm, oControl);
}
}
} | javascript | function(oRm, oControl) {
if (oControl.getResizeEnabled()) {
fnRenderToggler(oRm, oControl);
}
if (oControl.hasItems()) {
if (oControl.getVisibleStatus() == NotificationBarStatus.Max) {
fnWriteItemsMaximized(oRm, oControl);
} else {
fnWriteItemsDefault(oRm, oControl);
}
}
} | [
"function",
"(",
"oRm",
",",
"oControl",
")",
"{",
"if",
"(",
"oControl",
".",
"getResizeEnabled",
"(",
")",
")",
"{",
"fnRenderToggler",
"(",
"oRm",
",",
"oControl",
")",
";",
"}",
"if",
"(",
"oControl",
".",
"hasItems",
"(",
")",
")",
"{",
"if",
"(",
"oControl",
".",
"getVisibleStatus",
"(",
")",
"==",
"NotificationBarStatus",
".",
"Max",
")",
"{",
"fnWriteItemsMaximized",
"(",
"oRm",
",",
"oControl",
")",
";",
"}",
"else",
"{",
"fnWriteItemsDefault",
"(",
"oRm",
",",
"oControl",
")",
";",
"}",
"}",
"}"
] | Renders all notifiers | [
"Renders",
"all",
"notifiers"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.ux3/src/sap/ui/ux3/NotificationBarRenderer.js#L232-L244 |
|
3,938 | SAP/openui5 | src/sap.ui.ux3/src/sap/ui/ux3/NotificationBarRenderer.js | function(oRm, oNotifier, bMessageNotifier) {
var sId = oNotifier.getId();
oRm.write("<li");
oRm.writeElementData(oNotifier);
oRm.addClass("sapUiNotifier");
oRm.writeClasses();
// ItemNavigation can only handle focusable items
oRm.writeAttribute("tabindex", "-1");
oRm.writeAttribute("aria-describedby", sId + '-description>');
oRm.write(">"); // li element
fnWriteNotifierIcon(oRm, oNotifier.getIcon(), bMessageNotifier);
// adding an element to enable a
oRm.write('<div id="' + sId + '-description"');
oRm.addStyle("display", "none");
oRm.writeStyles();
oRm.write(">");
oRm.write("</div>");
var iCount = oNotifier.getMessages().length;
if (iCount > 0) {
// opening the div with corresponding classes
oRm.write('<div id="' + sId + '-counter" role="tooltip"');
oRm.addClass("sapUiNotifierMessageCount");
if (bMessageNotifier) {
oRm.addClass("sapUiMessage");
}
oRm.writeClasses();
oRm.write(">");
// write the div's content
if (iCount > 99) {
iCount = ">99";
}
oRm.write(iCount);
// closing the div
oRm.write("</div>");
}
oRm.write("</li>"); // li element
} | javascript | function(oRm, oNotifier, bMessageNotifier) {
var sId = oNotifier.getId();
oRm.write("<li");
oRm.writeElementData(oNotifier);
oRm.addClass("sapUiNotifier");
oRm.writeClasses();
// ItemNavigation can only handle focusable items
oRm.writeAttribute("tabindex", "-1");
oRm.writeAttribute("aria-describedby", sId + '-description>');
oRm.write(">"); // li element
fnWriteNotifierIcon(oRm, oNotifier.getIcon(), bMessageNotifier);
// adding an element to enable a
oRm.write('<div id="' + sId + '-description"');
oRm.addStyle("display", "none");
oRm.writeStyles();
oRm.write(">");
oRm.write("</div>");
var iCount = oNotifier.getMessages().length;
if (iCount > 0) {
// opening the div with corresponding classes
oRm.write('<div id="' + sId + '-counter" role="tooltip"');
oRm.addClass("sapUiNotifierMessageCount");
if (bMessageNotifier) {
oRm.addClass("sapUiMessage");
}
oRm.writeClasses();
oRm.write(">");
// write the div's content
if (iCount > 99) {
iCount = ">99";
}
oRm.write(iCount);
// closing the div
oRm.write("</div>");
}
oRm.write("</li>"); // li element
} | [
"function",
"(",
"oRm",
",",
"oNotifier",
",",
"bMessageNotifier",
")",
"{",
"var",
"sId",
"=",
"oNotifier",
".",
"getId",
"(",
")",
";",
"oRm",
".",
"write",
"(",
"\"<li\"",
")",
";",
"oRm",
".",
"writeElementData",
"(",
"oNotifier",
")",
";",
"oRm",
".",
"addClass",
"(",
"\"sapUiNotifier\"",
")",
";",
"oRm",
".",
"writeClasses",
"(",
")",
";",
"// ItemNavigation can only handle focusable items",
"oRm",
".",
"writeAttribute",
"(",
"\"tabindex\"",
",",
"\"-1\"",
")",
";",
"oRm",
".",
"writeAttribute",
"(",
"\"aria-describedby\"",
",",
"sId",
"+",
"'-description>'",
")",
";",
"oRm",
".",
"write",
"(",
"\">\"",
")",
";",
"// li element",
"fnWriteNotifierIcon",
"(",
"oRm",
",",
"oNotifier",
".",
"getIcon",
"(",
")",
",",
"bMessageNotifier",
")",
";",
"// adding an element to enable a",
"oRm",
".",
"write",
"(",
"'<div id=\"'",
"+",
"sId",
"+",
"'-description\"'",
")",
";",
"oRm",
".",
"addStyle",
"(",
"\"display\"",
",",
"\"none\"",
")",
";",
"oRm",
".",
"writeStyles",
"(",
")",
";",
"oRm",
".",
"write",
"(",
"\">\"",
")",
";",
"oRm",
".",
"write",
"(",
"\"</div>\"",
")",
";",
"var",
"iCount",
"=",
"oNotifier",
".",
"getMessages",
"(",
")",
".",
"length",
";",
"if",
"(",
"iCount",
">",
"0",
")",
"{",
"// opening the div with corresponding classes",
"oRm",
".",
"write",
"(",
"'<div id=\"'",
"+",
"sId",
"+",
"'-counter\" role=\"tooltip\"'",
")",
";",
"oRm",
".",
"addClass",
"(",
"\"sapUiNotifierMessageCount\"",
")",
";",
"if",
"(",
"bMessageNotifier",
")",
"{",
"oRm",
".",
"addClass",
"(",
"\"sapUiMessage\"",
")",
";",
"}",
"oRm",
".",
"writeClasses",
"(",
")",
";",
"oRm",
".",
"write",
"(",
"\">\"",
")",
";",
"// write the div's content",
"if",
"(",
"iCount",
">",
"99",
")",
"{",
"iCount",
"=",
"\">99\"",
";",
"}",
"oRm",
".",
"write",
"(",
"iCount",
")",
";",
"// closing the div",
"oRm",
".",
"write",
"(",
"\"</div>\"",
")",
";",
"}",
"oRm",
".",
"write",
"(",
"\"</li>\"",
")",
";",
"// li element",
"}"
] | Renders a single notifier | [
"Renders",
"a",
"single",
"notifier"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.ux3/src/sap/ui/ux3/NotificationBarRenderer.js#L344-L389 |
|
3,939 | SAP/openui5 | src/sap.ui.ux3/src/sap/ui/ux3/NotificationBarRenderer.js | function(oRm, aNotifiers) {
for ( var i = 0; i < aNotifiers.length; i++) {
fnRenderNotifier(oRm, aNotifiers[i], false);
}
} | javascript | function(oRm, aNotifiers) {
for ( var i = 0; i < aNotifiers.length; i++) {
fnRenderNotifier(oRm, aNotifiers[i], false);
}
} | [
"function",
"(",
"oRm",
",",
"aNotifiers",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"aNotifiers",
".",
"length",
";",
"i",
"++",
")",
"{",
"fnRenderNotifier",
"(",
"oRm",
",",
"aNotifiers",
"[",
"i",
"]",
",",
"false",
")",
";",
"}",
"}"
] | Renders given map of notifiers | [
"Renders",
"given",
"map",
"of",
"notifiers"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.ux3/src/sap/ui/ux3/NotificationBarRenderer.js#L420-L424 |
|
3,940 | SAP/openui5 | src/sap.ui.ux3/src/sap/ui/ux3/NotificationBarRenderer.js | function (oRm, sUri, bMessageNotifier) {
if (sUri == null || sUri == "") {
var icon = new Icon({
useIconTooltip: false
});
icon.addStyleClass("sapUiNotifierIcon");
if (bMessageNotifier) {
icon.setSrc("sap-icon://alert");
} else {
icon.setSrc("sap-icon://notification-2");
}
oRm.renderControl(icon);
return;
}
oRm.write("<img alt=\"\"");
oRm.addClass("sapUiNotifierIcon");
oRm.writeClasses();
oRm.writeAttributeEscaped("src", sUri);
oRm.write("/>");
} | javascript | function (oRm, sUri, bMessageNotifier) {
if (sUri == null || sUri == "") {
var icon = new Icon({
useIconTooltip: false
});
icon.addStyleClass("sapUiNotifierIcon");
if (bMessageNotifier) {
icon.setSrc("sap-icon://alert");
} else {
icon.setSrc("sap-icon://notification-2");
}
oRm.renderControl(icon);
return;
}
oRm.write("<img alt=\"\"");
oRm.addClass("sapUiNotifierIcon");
oRm.writeClasses();
oRm.writeAttributeEscaped("src", sUri);
oRm.write("/>");
} | [
"function",
"(",
"oRm",
",",
"sUri",
",",
"bMessageNotifier",
")",
"{",
"if",
"(",
"sUri",
"==",
"null",
"||",
"sUri",
"==",
"\"\"",
")",
"{",
"var",
"icon",
"=",
"new",
"Icon",
"(",
"{",
"useIconTooltip",
":",
"false",
"}",
")",
";",
"icon",
".",
"addStyleClass",
"(",
"\"sapUiNotifierIcon\"",
")",
";",
"if",
"(",
"bMessageNotifier",
")",
"{",
"icon",
".",
"setSrc",
"(",
"\"sap-icon://alert\"",
")",
";",
"}",
"else",
"{",
"icon",
".",
"setSrc",
"(",
"\"sap-icon://notification-2\"",
")",
";",
"}",
"oRm",
".",
"renderControl",
"(",
"icon",
")",
";",
"return",
";",
"}",
"oRm",
".",
"write",
"(",
"\"<img alt=\\\"\\\"\"",
")",
";",
"oRm",
".",
"addClass",
"(",
"\"sapUiNotifierIcon\"",
")",
";",
"oRm",
".",
"writeClasses",
"(",
")",
";",
"oRm",
".",
"writeAttributeEscaped",
"(",
"\"src\"",
",",
"sUri",
")",
";",
"oRm",
".",
"write",
"(",
"\"/>\"",
")",
";",
"}"
] | Renders the notifier's icon. If there is no icon set a default icon is
used | [
"Renders",
"the",
"notifier",
"s",
"icon",
".",
"If",
"there",
"is",
"no",
"icon",
"set",
"a",
"default",
"icon",
"is",
"used"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.ux3/src/sap/ui/ux3/NotificationBarRenderer.js#L430-L452 |
|
3,941 | SAP/openui5 | src/sap.ui.ux3/src/sap/ui/ux3/NotificationBarRenderer.js | function(oRm, oNotifier, oNotiBar) {
fnRenderNotifier(oRm, oNotifier, true);
fnRenderMessageNotifierMessageArea(oRm, oNotifier, oNotiBar);
} | javascript | function(oRm, oNotifier, oNotiBar) {
fnRenderNotifier(oRm, oNotifier, true);
fnRenderMessageNotifierMessageArea(oRm, oNotifier, oNotiBar);
} | [
"function",
"(",
"oRm",
",",
"oNotifier",
",",
"oNotiBar",
")",
"{",
"fnRenderNotifier",
"(",
"oRm",
",",
"oNotifier",
",",
"true",
")",
";",
"fnRenderMessageNotifierMessageArea",
"(",
"oRm",
",",
"oNotifier",
",",
"oNotiBar",
")",
";",
"}"
] | This renders a given message notifier and its message area next to the
notifier icon | [
"This",
"renders",
"a",
"given",
"message",
"notifier",
"and",
"its",
"message",
"area",
"next",
"to",
"the",
"notifier",
"icon"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.ux3/src/sap/ui/ux3/NotificationBarRenderer.js#L458-L461 |
|
3,942 | SAP/openui5 | src/sap.ui.ux3/src/sap/ui/ux3/NotificationBarRenderer.js | function(oRm, oMessageNotifier, oNotiBar) {
if (oMessageNotifier.hasItems()) {
var aMessages = oMessageNotifier.getMessages();
var lastItem = aMessages[aMessages.length - 1];
var oMA = oMessageNotifier._oMessageArea;
// this ensures that this message is selectable from the bar
oMA._message = lastItem;
var sId = oNotiBar.getId() + "-inplaceMessage-" + oMA._message.getId();
oRm.write("<li");
oRm.writeAttribute("id", sId);
oRm.addClass("sapUiInPlaceMessage");
oRm.writeClasses();
if (oNotiBar._gapMessageArea) {
var sMargin = oNotiBar._gapMessageArea + "px";
oRm.addStyle("margin-left", sMargin);
oRm.writeStyles();
}
oRm.write(">");
// oRm.renderControl(oMA);
if (lastItem.getText() != "") {
oRm.write("<div");
oRm.writeControlData(oMA);
// enable inplace message for item navigation
oRm.writeAttribute("tabindex", "-1");
oRm.addClass("sapUiNotifierMessageText");
oRm.addClass("sapUiInPlaceMessage");
// if the latest message is read-only don't provide a visual selectable link
if (oMessageNotifier._bEnableMessageSelect && !oMA._message.getReadOnly()) {
// if there is an event handler show the inplace message
// clickable
oRm.addClass("sapUiInPlaceMessageSelectable");
}
oRm.writeClasses();
oRm.write(">");
oRm.writeEscaped(lastItem.getText());
oRm.write("</div>"); // Text
}
if (lastItem.getTimestamp() != "") {
oRm.write("<div");
oRm.addClass("sapUiNotifierMessageTimestamp");
oRm.addClass("sapUiInPlaceMessage");
oRm.writeClasses();
oRm.write(">");
oRm.writeEscaped(lastItem.getTimestamp());
oRm.write("</div>"); // Timestamp
}
oRm.write("</li>");
}
} | javascript | function(oRm, oMessageNotifier, oNotiBar) {
if (oMessageNotifier.hasItems()) {
var aMessages = oMessageNotifier.getMessages();
var lastItem = aMessages[aMessages.length - 1];
var oMA = oMessageNotifier._oMessageArea;
// this ensures that this message is selectable from the bar
oMA._message = lastItem;
var sId = oNotiBar.getId() + "-inplaceMessage-" + oMA._message.getId();
oRm.write("<li");
oRm.writeAttribute("id", sId);
oRm.addClass("sapUiInPlaceMessage");
oRm.writeClasses();
if (oNotiBar._gapMessageArea) {
var sMargin = oNotiBar._gapMessageArea + "px";
oRm.addStyle("margin-left", sMargin);
oRm.writeStyles();
}
oRm.write(">");
// oRm.renderControl(oMA);
if (lastItem.getText() != "") {
oRm.write("<div");
oRm.writeControlData(oMA);
// enable inplace message for item navigation
oRm.writeAttribute("tabindex", "-1");
oRm.addClass("sapUiNotifierMessageText");
oRm.addClass("sapUiInPlaceMessage");
// if the latest message is read-only don't provide a visual selectable link
if (oMessageNotifier._bEnableMessageSelect && !oMA._message.getReadOnly()) {
// if there is an event handler show the inplace message
// clickable
oRm.addClass("sapUiInPlaceMessageSelectable");
}
oRm.writeClasses();
oRm.write(">");
oRm.writeEscaped(lastItem.getText());
oRm.write("</div>"); // Text
}
if (lastItem.getTimestamp() != "") {
oRm.write("<div");
oRm.addClass("sapUiNotifierMessageTimestamp");
oRm.addClass("sapUiInPlaceMessage");
oRm.writeClasses();
oRm.write(">");
oRm.writeEscaped(lastItem.getTimestamp());
oRm.write("</div>"); // Timestamp
}
oRm.write("</li>");
}
} | [
"function",
"(",
"oRm",
",",
"oMessageNotifier",
",",
"oNotiBar",
")",
"{",
"if",
"(",
"oMessageNotifier",
".",
"hasItems",
"(",
")",
")",
"{",
"var",
"aMessages",
"=",
"oMessageNotifier",
".",
"getMessages",
"(",
")",
";",
"var",
"lastItem",
"=",
"aMessages",
"[",
"aMessages",
".",
"length",
"-",
"1",
"]",
";",
"var",
"oMA",
"=",
"oMessageNotifier",
".",
"_oMessageArea",
";",
"// this ensures that this message is selectable from the bar",
"oMA",
".",
"_message",
"=",
"lastItem",
";",
"var",
"sId",
"=",
"oNotiBar",
".",
"getId",
"(",
")",
"+",
"\"-inplaceMessage-\"",
"+",
"oMA",
".",
"_message",
".",
"getId",
"(",
")",
";",
"oRm",
".",
"write",
"(",
"\"<li\"",
")",
";",
"oRm",
".",
"writeAttribute",
"(",
"\"id\"",
",",
"sId",
")",
";",
"oRm",
".",
"addClass",
"(",
"\"sapUiInPlaceMessage\"",
")",
";",
"oRm",
".",
"writeClasses",
"(",
")",
";",
"if",
"(",
"oNotiBar",
".",
"_gapMessageArea",
")",
"{",
"var",
"sMargin",
"=",
"oNotiBar",
".",
"_gapMessageArea",
"+",
"\"px\"",
";",
"oRm",
".",
"addStyle",
"(",
"\"margin-left\"",
",",
"sMargin",
")",
";",
"oRm",
".",
"writeStyles",
"(",
")",
";",
"}",
"oRm",
".",
"write",
"(",
"\">\"",
")",
";",
"// oRm.renderControl(oMA);",
"if",
"(",
"lastItem",
".",
"getText",
"(",
")",
"!=",
"\"\"",
")",
"{",
"oRm",
".",
"write",
"(",
"\"<div\"",
")",
";",
"oRm",
".",
"writeControlData",
"(",
"oMA",
")",
";",
"// enable inplace message for item navigation",
"oRm",
".",
"writeAttribute",
"(",
"\"tabindex\"",
",",
"\"-1\"",
")",
";",
"oRm",
".",
"addClass",
"(",
"\"sapUiNotifierMessageText\"",
")",
";",
"oRm",
".",
"addClass",
"(",
"\"sapUiInPlaceMessage\"",
")",
";",
"// if the latest message is read-only don't provide a visual selectable link",
"if",
"(",
"oMessageNotifier",
".",
"_bEnableMessageSelect",
"&&",
"!",
"oMA",
".",
"_message",
".",
"getReadOnly",
"(",
")",
")",
"{",
"// if there is an event handler show the inplace message",
"// clickable",
"oRm",
".",
"addClass",
"(",
"\"sapUiInPlaceMessageSelectable\"",
")",
";",
"}",
"oRm",
".",
"writeClasses",
"(",
")",
";",
"oRm",
".",
"write",
"(",
"\">\"",
")",
";",
"oRm",
".",
"writeEscaped",
"(",
"lastItem",
".",
"getText",
"(",
")",
")",
";",
"oRm",
".",
"write",
"(",
"\"</div>\"",
")",
";",
"// Text",
"}",
"if",
"(",
"lastItem",
".",
"getTimestamp",
"(",
")",
"!=",
"\"\"",
")",
"{",
"oRm",
".",
"write",
"(",
"\"<div\"",
")",
";",
"oRm",
".",
"addClass",
"(",
"\"sapUiNotifierMessageTimestamp\"",
")",
";",
"oRm",
".",
"addClass",
"(",
"\"sapUiInPlaceMessage\"",
")",
";",
"oRm",
".",
"writeClasses",
"(",
")",
";",
"oRm",
".",
"write",
"(",
"\">\"",
")",
";",
"oRm",
".",
"writeEscaped",
"(",
"lastItem",
".",
"getTimestamp",
"(",
")",
")",
";",
"oRm",
".",
"write",
"(",
"\"</div>\"",
")",
";",
"// Timestamp",
"}",
"oRm",
".",
"write",
"(",
"\"</li>\"",
")",
";",
"}",
"}"
] | Renders the message area next to a message notifier | [
"Renders",
"the",
"message",
"area",
"next",
"to",
"a",
"message",
"notifier"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.ux3/src/sap/ui/ux3/NotificationBarRenderer.js#L466-L520 |
|
3,943 | SAP/openui5 | src/sap.m/src/sap/m/ViewSettingsDialog.js | getViewSettingsItemByKey | function getViewSettingsItemByKey(aViewSettingsItems, sKey) {
var i, oItem;
// convenience, also allow strings
// find item with this key
for (i = 0; i < aViewSettingsItems.length; i++) {
if (aViewSettingsItems[i].getKey() === sKey) {
oItem = aViewSettingsItems[i];
break;
}
}
return oItem;
} | javascript | function getViewSettingsItemByKey(aViewSettingsItems, sKey) {
var i, oItem;
// convenience, also allow strings
// find item with this key
for (i = 0; i < aViewSettingsItems.length; i++) {
if (aViewSettingsItems[i].getKey() === sKey) {
oItem = aViewSettingsItems[i];
break;
}
}
return oItem;
} | [
"function",
"getViewSettingsItemByKey",
"(",
"aViewSettingsItems",
",",
"sKey",
")",
"{",
"var",
"i",
",",
"oItem",
";",
"// convenience, also allow strings",
"// find item with this key",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"aViewSettingsItems",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"aViewSettingsItems",
"[",
"i",
"]",
".",
"getKey",
"(",
")",
"===",
"sKey",
")",
"{",
"oItem",
"=",
"aViewSettingsItems",
"[",
"i",
"]",
";",
"break",
";",
"}",
"}",
"return",
"oItem",
";",
"}"
] | Gets an sap.m.ViewSettingsItem from a list of items by a given key.
@param {array} aViewSettingsItems The list of sap.m.ViewSettingsItem objects to be searched
@param {string} sKey The key of the searched item
@returns {*} The sap.m.ViewSettingsItem found in the list of items
@private | [
"Gets",
"an",
"sap",
".",
"m",
".",
"ViewSettingsItem",
"from",
"a",
"list",
"of",
"items",
"by",
"a",
"given",
"key",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.m/src/sap/m/ViewSettingsDialog.js#L2942-L2955 |
3,944 | SAP/openui5 | src/sap.m/src/sap/m/ViewSettingsDialog.js | findViewSettingsItemByKey | function findViewSettingsItemByKey(vItemOrKey, aViewSettingsItems, sErrorMessage) {
var oItem;
// convenience, also allow strings
if (typeof vItemOrKey === "string") {
// find item with this key
oItem = getViewSettingsItemByKey(aViewSettingsItems, vItemOrKey);
if (!oItem) {
Log.error(sErrorMessage);
}
} else {
oItem = vItemOrKey;
}
return oItem;
} | javascript | function findViewSettingsItemByKey(vItemOrKey, aViewSettingsItems, sErrorMessage) {
var oItem;
// convenience, also allow strings
if (typeof vItemOrKey === "string") {
// find item with this key
oItem = getViewSettingsItemByKey(aViewSettingsItems, vItemOrKey);
if (!oItem) {
Log.error(sErrorMessage);
}
} else {
oItem = vItemOrKey;
}
return oItem;
} | [
"function",
"findViewSettingsItemByKey",
"(",
"vItemOrKey",
",",
"aViewSettingsItems",
",",
"sErrorMessage",
")",
"{",
"var",
"oItem",
";",
"// convenience, also allow strings",
"if",
"(",
"typeof",
"vItemOrKey",
"===",
"\"string\"",
")",
"{",
"// find item with this key",
"oItem",
"=",
"getViewSettingsItemByKey",
"(",
"aViewSettingsItems",
",",
"vItemOrKey",
")",
";",
"if",
"(",
"!",
"oItem",
")",
"{",
"Log",
".",
"error",
"(",
"sErrorMessage",
")",
";",
"}",
"}",
"else",
"{",
"oItem",
"=",
"vItemOrKey",
";",
"}",
"return",
"oItem",
";",
"}"
] | Finds an sap.m.ViewSettingsItem from a list of items by a given key.
If it does not succeed logs an error.
@param {sap.m.ViewSettingsItem|string} vItemOrKey The searched item or its key
@param {array} aViewSettingsItems The list of sap.m.ViewSettingsItem objects to be searched
@param {string} sErrorMessage The error message that will be logged if the item is not found
@returns {*} The sap.m.ViewSettingsItem found in the list of items
@private | [
"Finds",
"an",
"sap",
".",
"m",
".",
"ViewSettingsItem",
"from",
"a",
"list",
"of",
"items",
"by",
"a",
"given",
"key",
".",
"If",
"it",
"does",
"not",
"succeed",
"logs",
"an",
"error",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.m/src/sap/m/ViewSettingsDialog.js#L2967-L2983 |
3,945 | SAP/openui5 | src/sap.m/src/sap/m/ViewSettingsDialog.js | restoreCustomTabContentAggregation | function restoreCustomTabContentAggregation(sAggregationName, oCustomTab) {
// Make sure page1 exists, as this method may be called on destroy(), after the page was destroyed
// Suppress creation of new page as the following logic is needed only when a page already exists
if (!this._getPage1(true)) {
return;
}
// only the 'customTabs' aggregation is manipulated with shenanigans
if (sAggregationName === 'customTabs' && oCustomTab) {
/* oCustomTab must be an instance of the "customTab" aggregation type and must be the last opened page */
if (oCustomTab.getMetadata().getName() === this.getMetadata().getManagedAggregation(sAggregationName).type &&
this._vContentPage === oCustomTab.getId()) {
/* the iContentPage property corresponds to the custom tab id - set the custom tab content aggregation
back to the custom tab instance */
var oPage1Content = this._getPage1().getContent();
oPage1Content.forEach(function (oContent) {
oCustomTab.addAggregation('content', oContent, true);
});
}
} else if (!sAggregationName && !oCustomTab) {
/* when these parameters are missing, cycle through all custom tabs and detect if any needs manipulation */
var oPage1Content = this._getPage1().getContent();
/* the vContentPage property corresponds to a custom tab id - set the custom tab content aggregation back
to the corresponding custom tab instance, so it can be reused later */
this.getCustomTabs().forEach(function (oCustomTab) {
if (this._vContentPage === oCustomTab.getId()) {
oPage1Content.forEach(function (oContent) {
oCustomTab.addAggregation('content', oContent, true);
});
}
}, this);
}
} | javascript | function restoreCustomTabContentAggregation(sAggregationName, oCustomTab) {
// Make sure page1 exists, as this method may be called on destroy(), after the page was destroyed
// Suppress creation of new page as the following logic is needed only when a page already exists
if (!this._getPage1(true)) {
return;
}
// only the 'customTabs' aggregation is manipulated with shenanigans
if (sAggregationName === 'customTabs' && oCustomTab) {
/* oCustomTab must be an instance of the "customTab" aggregation type and must be the last opened page */
if (oCustomTab.getMetadata().getName() === this.getMetadata().getManagedAggregation(sAggregationName).type &&
this._vContentPage === oCustomTab.getId()) {
/* the iContentPage property corresponds to the custom tab id - set the custom tab content aggregation
back to the custom tab instance */
var oPage1Content = this._getPage1().getContent();
oPage1Content.forEach(function (oContent) {
oCustomTab.addAggregation('content', oContent, true);
});
}
} else if (!sAggregationName && !oCustomTab) {
/* when these parameters are missing, cycle through all custom tabs and detect if any needs manipulation */
var oPage1Content = this._getPage1().getContent();
/* the vContentPage property corresponds to a custom tab id - set the custom tab content aggregation back
to the corresponding custom tab instance, so it can be reused later */
this.getCustomTabs().forEach(function (oCustomTab) {
if (this._vContentPage === oCustomTab.getId()) {
oPage1Content.forEach(function (oContent) {
oCustomTab.addAggregation('content', oContent, true);
});
}
}, this);
}
} | [
"function",
"restoreCustomTabContentAggregation",
"(",
"sAggregationName",
",",
"oCustomTab",
")",
"{",
"// Make sure page1 exists, as this method may be called on destroy(), after the page was destroyed",
"// Suppress creation of new page as the following logic is needed only when a page already exists",
"if",
"(",
"!",
"this",
".",
"_getPage1",
"(",
"true",
")",
")",
"{",
"return",
";",
"}",
"// only the 'customTabs' aggregation is manipulated with shenanigans",
"if",
"(",
"sAggregationName",
"===",
"'customTabs'",
"&&",
"oCustomTab",
")",
"{",
"/* oCustomTab must be an instance of the \"customTab\" aggregation type and must be the last opened page */",
"if",
"(",
"oCustomTab",
".",
"getMetadata",
"(",
")",
".",
"getName",
"(",
")",
"===",
"this",
".",
"getMetadata",
"(",
")",
".",
"getManagedAggregation",
"(",
"sAggregationName",
")",
".",
"type",
"&&",
"this",
".",
"_vContentPage",
"===",
"oCustomTab",
".",
"getId",
"(",
")",
")",
"{",
"/* the iContentPage property corresponds to the custom tab id - set the custom tab content aggregation\n\t\t\t\t back to the custom tab instance */",
"var",
"oPage1Content",
"=",
"this",
".",
"_getPage1",
"(",
")",
".",
"getContent",
"(",
")",
";",
"oPage1Content",
".",
"forEach",
"(",
"function",
"(",
"oContent",
")",
"{",
"oCustomTab",
".",
"addAggregation",
"(",
"'content'",
",",
"oContent",
",",
"true",
")",
";",
"}",
")",
";",
"}",
"}",
"else",
"if",
"(",
"!",
"sAggregationName",
"&&",
"!",
"oCustomTab",
")",
"{",
"/* when these parameters are missing, cycle through all custom tabs and detect if any needs manipulation */",
"var",
"oPage1Content",
"=",
"this",
".",
"_getPage1",
"(",
")",
".",
"getContent",
"(",
")",
";",
"/* the vContentPage property corresponds to a custom tab id - set the custom tab content aggregation back\n\t\t\t to the corresponding custom tab instance, so it can be reused later */",
"this",
".",
"getCustomTabs",
"(",
")",
".",
"forEach",
"(",
"function",
"(",
"oCustomTab",
")",
"{",
"if",
"(",
"this",
".",
"_vContentPage",
"===",
"oCustomTab",
".",
"getId",
"(",
")",
")",
"{",
"oPage1Content",
".",
"forEach",
"(",
"function",
"(",
"oContent",
")",
"{",
"oCustomTab",
".",
"addAggregation",
"(",
"'content'",
",",
"oContent",
",",
"true",
")",
";",
"}",
")",
";",
"}",
"}",
",",
"this",
")",
";",
"}",
"}"
] | Handle the "content" aggregation of a custom tab, as the items in it might be transferred to the dialog page
instance.
@param {string} sAggregationName The string identifying the aggregation that the given object should be removed from
@param {object} oCustomTab Custom tab instance
@private | [
"Handle",
"the",
"content",
"aggregation",
"of",
"a",
"custom",
"tab",
"as",
"the",
"items",
"in",
"it",
"might",
"be",
"transferred",
"to",
"the",
"dialog",
"page",
"instance",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.m/src/sap/m/ViewSettingsDialog.js#L3158-L3191 |
3,946 | SAP/openui5 | src/sap.m/src/sap/m/ViewSettingsDialog.js | function(sOperator) {
this.sOperator = sOperator || StringFilterOperator.StartsWith;
switch (this.sOperator) {
case StringFilterOperator.Equals:
this.fnOperator = fnEquals;
break;
case StringFilterOperator.Contains:
this.fnOperator = fnContains;
break;
case StringFilterOperator.StartsWith:
this.fnOperator = fnStartsWith;
break;
case StringFilterOperator.AnyWordStartsWith:
this.fnOperator = fnAnyWordStartsWith;
break;
default:
//warning when operator has been given but it doesn't match a value from sap.m.StringFilterOperator enum
Log.warning("Unknown string compare operator. Use values from sap.m.StringFilterOperator. Default operator should be used.");
this.fnOperator = fnContains;
break;
}
} | javascript | function(sOperator) {
this.sOperator = sOperator || StringFilterOperator.StartsWith;
switch (this.sOperator) {
case StringFilterOperator.Equals:
this.fnOperator = fnEquals;
break;
case StringFilterOperator.Contains:
this.fnOperator = fnContains;
break;
case StringFilterOperator.StartsWith:
this.fnOperator = fnStartsWith;
break;
case StringFilterOperator.AnyWordStartsWith:
this.fnOperator = fnAnyWordStartsWith;
break;
default:
//warning when operator has been given but it doesn't match a value from sap.m.StringFilterOperator enum
Log.warning("Unknown string compare operator. Use values from sap.m.StringFilterOperator. Default operator should be used.");
this.fnOperator = fnContains;
break;
}
} | [
"function",
"(",
"sOperator",
")",
"{",
"this",
".",
"sOperator",
"=",
"sOperator",
"||",
"StringFilterOperator",
".",
"StartsWith",
";",
"switch",
"(",
"this",
".",
"sOperator",
")",
"{",
"case",
"StringFilterOperator",
".",
"Equals",
":",
"this",
".",
"fnOperator",
"=",
"fnEquals",
";",
"break",
";",
"case",
"StringFilterOperator",
".",
"Contains",
":",
"this",
".",
"fnOperator",
"=",
"fnContains",
";",
"break",
";",
"case",
"StringFilterOperator",
".",
"StartsWith",
":",
"this",
".",
"fnOperator",
"=",
"fnStartsWith",
";",
"break",
";",
"case",
"StringFilterOperator",
".",
"AnyWordStartsWith",
":",
"this",
".",
"fnOperator",
"=",
"fnAnyWordStartsWith",
";",
"break",
";",
"default",
":",
"//warning when operator has been given but it doesn't match a value from sap.m.StringFilterOperator enum",
"Log",
".",
"warning",
"(",
"\"Unknown string compare operator. Use values from sap.m.StringFilterOperator. Default operator should be used.\"",
")",
";",
"this",
".",
"fnOperator",
"=",
"fnContains",
";",
"break",
";",
"}",
"}"
] | String filter helper class.
@param {string} sOperator sap.m.StringFilterOperator value. Default is sap.m.StringFilterOperator.StartsWith.
@constructor
@private | [
"String",
"filter",
"helper",
"class",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.m/src/sap/m/ViewSettingsDialog.js#L3228-L3250 |
|
3,947 | SAP/openui5 | src/sap.ui.core/src/sap/ui/model/odata/type/Decimal.js | getText | function getText(sKey, aParams) {
return sap.ui.getCore().getLibraryResourceBundle().getText(sKey, aParams);
} | javascript | function getText(sKey, aParams) {
return sap.ui.getCore().getLibraryResourceBundle().getText(sKey, aParams);
} | [
"function",
"getText",
"(",
"sKey",
",",
"aParams",
")",
"{",
"return",
"sap",
".",
"ui",
".",
"getCore",
"(",
")",
".",
"getLibraryResourceBundle",
"(",
")",
".",
"getText",
"(",
"sKey",
",",
"aParams",
")",
";",
"}"
] | Fetches a text from the message bundle and formats it using the parameters.
@param {string} sKey
the message key
@param {any[]} aParams
the message parameters
@returns {string}
the message | [
"Fetches",
"a",
"text",
"from",
"the",
"message",
"bundle",
"and",
"formats",
"it",
"using",
"the",
"parameters",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/type/Decimal.js#L68-L70 |
3,948 | SAP/openui5 | src/sap.ui.support/src/sap/ui/support/supportRules/IssueManager.js | function (oIssue) {
var element = sap.ui.getCore().byId(oIssue.context.id),
className = "";
if (oIssue.context.id === "WEBPAGE") {
className = "sap.ui.core";
} else if (element) {
className = element.getMetadata().getName();
}
return {
severity: oIssue.severity,
name: oIssue.rule.title,
description: oIssue.rule.description,
resolution: oIssue.rule.resolution,
resolutionUrls: oIssue.rule.resolutionurls,
audiences: oIssue.rule.audiences,
categories: oIssue.rule.categories,
details: oIssue.details,
ruleLibName: oIssue.rule.libName,
ruleId: oIssue.rule.id,
async: oIssue.rule.async === true, // Ensure async is either true or false
minVersion: oIssue.rule.minversion,
context: {
className: className,
id: oIssue.context.id
}
};
} | javascript | function (oIssue) {
var element = sap.ui.getCore().byId(oIssue.context.id),
className = "";
if (oIssue.context.id === "WEBPAGE") {
className = "sap.ui.core";
} else if (element) {
className = element.getMetadata().getName();
}
return {
severity: oIssue.severity,
name: oIssue.rule.title,
description: oIssue.rule.description,
resolution: oIssue.rule.resolution,
resolutionUrls: oIssue.rule.resolutionurls,
audiences: oIssue.rule.audiences,
categories: oIssue.rule.categories,
details: oIssue.details,
ruleLibName: oIssue.rule.libName,
ruleId: oIssue.rule.id,
async: oIssue.rule.async === true, // Ensure async is either true or false
minVersion: oIssue.rule.minversion,
context: {
className: className,
id: oIssue.context.id
}
};
} | [
"function",
"(",
"oIssue",
")",
"{",
"var",
"element",
"=",
"sap",
".",
"ui",
".",
"getCore",
"(",
")",
".",
"byId",
"(",
"oIssue",
".",
"context",
".",
"id",
")",
",",
"className",
"=",
"\"\"",
";",
"if",
"(",
"oIssue",
".",
"context",
".",
"id",
"===",
"\"WEBPAGE\"",
")",
"{",
"className",
"=",
"\"sap.ui.core\"",
";",
"}",
"else",
"if",
"(",
"element",
")",
"{",
"className",
"=",
"element",
".",
"getMetadata",
"(",
")",
".",
"getName",
"(",
")",
";",
"}",
"return",
"{",
"severity",
":",
"oIssue",
".",
"severity",
",",
"name",
":",
"oIssue",
".",
"rule",
".",
"title",
",",
"description",
":",
"oIssue",
".",
"rule",
".",
"description",
",",
"resolution",
":",
"oIssue",
".",
"rule",
".",
"resolution",
",",
"resolutionUrls",
":",
"oIssue",
".",
"rule",
".",
"resolutionurls",
",",
"audiences",
":",
"oIssue",
".",
"rule",
".",
"audiences",
",",
"categories",
":",
"oIssue",
".",
"rule",
".",
"categories",
",",
"details",
":",
"oIssue",
".",
"details",
",",
"ruleLibName",
":",
"oIssue",
".",
"rule",
".",
"libName",
",",
"ruleId",
":",
"oIssue",
".",
"rule",
".",
"id",
",",
"async",
":",
"oIssue",
".",
"rule",
".",
"async",
"===",
"true",
",",
"// Ensure async is either true or false",
"minVersion",
":",
"oIssue",
".",
"rule",
".",
"minversion",
",",
"context",
":",
"{",
"className",
":",
"className",
",",
"id",
":",
"oIssue",
".",
"context",
".",
"id",
"}",
"}",
";",
"}"
] | Converts Issue Object to a ViewModel that can be used by the IssueManager.
@param {object} oIssue Issue Object that is to be converted
@returns {object} Converted Issue Object | [
"Converts",
"Issue",
"Object",
"to",
"a",
"ViewModel",
"that",
"can",
"be",
"used",
"by",
"the",
"IssueManager",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.support/src/sap/ui/support/supportRules/IssueManager.js#L23-L51 |
|
3,949 | SAP/openui5 | src/sap.ui.support/src/sap/ui/support/supportRules/IssueManager.js | function (rules, selectedRulesIDs, issues) {
var rulesViewModel = {},
issueCount = 0,
group = {},
library = {},
rule = {},
rulesCopy = jQuery.extend(true, {}, rules),
issuesCopy = jQuery.extend(true, {}, issues);
for (group in rulesCopy) {
rulesViewModel[group] = jQuery.extend(true, {}, rulesCopy[group].ruleset._mRules);
library = rulesViewModel[group];
// Create non-enumerable properties
Object.defineProperty(library, 'selected', {
enumerable: false,
configurable: true,
writable: true,
value: false
});
Object.defineProperty(library, 'issueCount', {
enumerable: false,
configurable: true,
writable: true,
value: 0
});
for (rule in rulesCopy[group].ruleset._mRules) {
library[rule] = jQuery.extend(true, [], library[rule]);
// Create non-enumerable properties
Object.defineProperty(library[rule], 'selected', {
enumerable: false,
configurable: true,
writable: true,
value: false
});
Object.defineProperty(library[rule], 'issueCount', {
enumerable: false,
configurable: true,
writable: true,
value: 0
});
// Add selected flag to library and rule level.
if (selectedRulesIDs[rule]) {
library[rule].selected = true;
library.selected = true;
}
// Add issue count to library and rule level.
if (issuesCopy[group] && issuesCopy[group][rule]) {
// Not creating a new array to keep the properties.
library[rule].push.apply(library[rule], issuesCopy[group][rule]);
issueCount = issuesCopy[group][rule].length;
library[rule].issueCount = issueCount;
library.issueCount += issueCount;
}
}
}
return rulesViewModel;
} | javascript | function (rules, selectedRulesIDs, issues) {
var rulesViewModel = {},
issueCount = 0,
group = {},
library = {},
rule = {},
rulesCopy = jQuery.extend(true, {}, rules),
issuesCopy = jQuery.extend(true, {}, issues);
for (group in rulesCopy) {
rulesViewModel[group] = jQuery.extend(true, {}, rulesCopy[group].ruleset._mRules);
library = rulesViewModel[group];
// Create non-enumerable properties
Object.defineProperty(library, 'selected', {
enumerable: false,
configurable: true,
writable: true,
value: false
});
Object.defineProperty(library, 'issueCount', {
enumerable: false,
configurable: true,
writable: true,
value: 0
});
for (rule in rulesCopy[group].ruleset._mRules) {
library[rule] = jQuery.extend(true, [], library[rule]);
// Create non-enumerable properties
Object.defineProperty(library[rule], 'selected', {
enumerable: false,
configurable: true,
writable: true,
value: false
});
Object.defineProperty(library[rule], 'issueCount', {
enumerable: false,
configurable: true,
writable: true,
value: 0
});
// Add selected flag to library and rule level.
if (selectedRulesIDs[rule]) {
library[rule].selected = true;
library.selected = true;
}
// Add issue count to library and rule level.
if (issuesCopy[group] && issuesCopy[group][rule]) {
// Not creating a new array to keep the properties.
library[rule].push.apply(library[rule], issuesCopy[group][rule]);
issueCount = issuesCopy[group][rule].length;
library[rule].issueCount = issueCount;
library.issueCount += issueCount;
}
}
}
return rulesViewModel;
} | [
"function",
"(",
"rules",
",",
"selectedRulesIDs",
",",
"issues",
")",
"{",
"var",
"rulesViewModel",
"=",
"{",
"}",
",",
"issueCount",
"=",
"0",
",",
"group",
"=",
"{",
"}",
",",
"library",
"=",
"{",
"}",
",",
"rule",
"=",
"{",
"}",
",",
"rulesCopy",
"=",
"jQuery",
".",
"extend",
"(",
"true",
",",
"{",
"}",
",",
"rules",
")",
",",
"issuesCopy",
"=",
"jQuery",
".",
"extend",
"(",
"true",
",",
"{",
"}",
",",
"issues",
")",
";",
"for",
"(",
"group",
"in",
"rulesCopy",
")",
"{",
"rulesViewModel",
"[",
"group",
"]",
"=",
"jQuery",
".",
"extend",
"(",
"true",
",",
"{",
"}",
",",
"rulesCopy",
"[",
"group",
"]",
".",
"ruleset",
".",
"_mRules",
")",
";",
"library",
"=",
"rulesViewModel",
"[",
"group",
"]",
";",
"// Create non-enumerable properties",
"Object",
".",
"defineProperty",
"(",
"library",
",",
"'selected'",
",",
"{",
"enumerable",
":",
"false",
",",
"configurable",
":",
"true",
",",
"writable",
":",
"true",
",",
"value",
":",
"false",
"}",
")",
";",
"Object",
".",
"defineProperty",
"(",
"library",
",",
"'issueCount'",
",",
"{",
"enumerable",
":",
"false",
",",
"configurable",
":",
"true",
",",
"writable",
":",
"true",
",",
"value",
":",
"0",
"}",
")",
";",
"for",
"(",
"rule",
"in",
"rulesCopy",
"[",
"group",
"]",
".",
"ruleset",
".",
"_mRules",
")",
"{",
"library",
"[",
"rule",
"]",
"=",
"jQuery",
".",
"extend",
"(",
"true",
",",
"[",
"]",
",",
"library",
"[",
"rule",
"]",
")",
";",
"// Create non-enumerable properties",
"Object",
".",
"defineProperty",
"(",
"library",
"[",
"rule",
"]",
",",
"'selected'",
",",
"{",
"enumerable",
":",
"false",
",",
"configurable",
":",
"true",
",",
"writable",
":",
"true",
",",
"value",
":",
"false",
"}",
")",
";",
"Object",
".",
"defineProperty",
"(",
"library",
"[",
"rule",
"]",
",",
"'issueCount'",
",",
"{",
"enumerable",
":",
"false",
",",
"configurable",
":",
"true",
",",
"writable",
":",
"true",
",",
"value",
":",
"0",
"}",
")",
";",
"// Add selected flag to library and rule level.",
"if",
"(",
"selectedRulesIDs",
"[",
"rule",
"]",
")",
"{",
"library",
"[",
"rule",
"]",
".",
"selected",
"=",
"true",
";",
"library",
".",
"selected",
"=",
"true",
";",
"}",
"// Add issue count to library and rule level.",
"if",
"(",
"issuesCopy",
"[",
"group",
"]",
"&&",
"issuesCopy",
"[",
"group",
"]",
"[",
"rule",
"]",
")",
"{",
"// Not creating a new array to keep the properties.",
"library",
"[",
"rule",
"]",
".",
"push",
".",
"apply",
"(",
"library",
"[",
"rule",
"]",
",",
"issuesCopy",
"[",
"group",
"]",
"[",
"rule",
"]",
")",
";",
"issueCount",
"=",
"issuesCopy",
"[",
"group",
"]",
"[",
"rule",
"]",
".",
"length",
";",
"library",
"[",
"rule",
"]",
".",
"issueCount",
"=",
"issueCount",
";",
"library",
".",
"issueCount",
"+=",
"issueCount",
";",
"}",
"}",
"}",
"return",
"rulesViewModel",
";",
"}"
] | Gets rules and issues, and converts each rule to a ruleViewModel - parameters should be converted as specified beforehand.
@public
@method
@name sap.ui.support.IssueManager.getRulesViewModel
@param {object} rules All the rules from _mRulesets
@param {array} selectedRulesIDs The rule ID's of the selected rules.
@param {array} issues The issues to map to the rulesViewModel
The issues passes should be grouped and in ViewModel format.
@returns {object} rulesViewModel All the rules with issues, selected flag and issueCount properties
The issues are in ViewModel format. | [
"Gets",
"rules",
"and",
"issues",
"and",
"converts",
"each",
"rule",
"to",
"a",
"ruleViewModel",
"-",
"parameters",
"should",
"be",
"converted",
"as",
"specified",
"beforehand",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.support/src/sap/ui/support/supportRules/IssueManager.js#L133-L195 |
|
3,950 | SAP/openui5 | src/sap.ui.support/src/sap/ui/support/supportRules/IssueManager.js | function(oRules) {
var index = 0,
innerIndex = 0,
treeTableModel = {},
rulesViewModel,
rule,
rules = [];
rulesViewModel = this.getRulesViewModel(oRules, [], []);
for (var libraryName in rulesViewModel) {
treeTableModel[index] = {
name: libraryName,
id: libraryName + " " + index,
selected: true,
type: "lib",
nodes: rules
};
for (var ruleName in rulesViewModel[libraryName]) {
rule = rulesViewModel[libraryName][ruleName];
rules.push({
name: rule.title,
description: rule.description,
id: rule.id,
audiences: rule.audiences.toString(),
categories: rule.categories.toString(),
minversion: rule.minversion,
resolution: rule.resolution,
title: rule.title,
libName: libraryName,
selected: true
});
innerIndex++;
}
rules = [];
index++;
}
return treeTableModel;
} | javascript | function(oRules) {
var index = 0,
innerIndex = 0,
treeTableModel = {},
rulesViewModel,
rule,
rules = [];
rulesViewModel = this.getRulesViewModel(oRules, [], []);
for (var libraryName in rulesViewModel) {
treeTableModel[index] = {
name: libraryName,
id: libraryName + " " + index,
selected: true,
type: "lib",
nodes: rules
};
for (var ruleName in rulesViewModel[libraryName]) {
rule = rulesViewModel[libraryName][ruleName];
rules.push({
name: rule.title,
description: rule.description,
id: rule.id,
audiences: rule.audiences.toString(),
categories: rule.categories.toString(),
minversion: rule.minversion,
resolution: rule.resolution,
title: rule.title,
libName: libraryName,
selected: true
});
innerIndex++;
}
rules = [];
index++;
}
return treeTableModel;
} | [
"function",
"(",
"oRules",
")",
"{",
"var",
"index",
"=",
"0",
",",
"innerIndex",
"=",
"0",
",",
"treeTableModel",
"=",
"{",
"}",
",",
"rulesViewModel",
",",
"rule",
",",
"rules",
"=",
"[",
"]",
";",
"rulesViewModel",
"=",
"this",
".",
"getRulesViewModel",
"(",
"oRules",
",",
"[",
"]",
",",
"[",
"]",
")",
";",
"for",
"(",
"var",
"libraryName",
"in",
"rulesViewModel",
")",
"{",
"treeTableModel",
"[",
"index",
"]",
"=",
"{",
"name",
":",
"libraryName",
",",
"id",
":",
"libraryName",
"+",
"\" \"",
"+",
"index",
",",
"selected",
":",
"true",
",",
"type",
":",
"\"lib\"",
",",
"nodes",
":",
"rules",
"}",
";",
"for",
"(",
"var",
"ruleName",
"in",
"rulesViewModel",
"[",
"libraryName",
"]",
")",
"{",
"rule",
"=",
"rulesViewModel",
"[",
"libraryName",
"]",
"[",
"ruleName",
"]",
";",
"rules",
".",
"push",
"(",
"{",
"name",
":",
"rule",
".",
"title",
",",
"description",
":",
"rule",
".",
"description",
",",
"id",
":",
"rule",
".",
"id",
",",
"audiences",
":",
"rule",
".",
"audiences",
".",
"toString",
"(",
")",
",",
"categories",
":",
"rule",
".",
"categories",
".",
"toString",
"(",
")",
",",
"minversion",
":",
"rule",
".",
"minversion",
",",
"resolution",
":",
"rule",
".",
"resolution",
",",
"title",
":",
"rule",
".",
"title",
",",
"libName",
":",
"libraryName",
",",
"selected",
":",
"true",
"}",
")",
";",
"innerIndex",
"++",
";",
"}",
"rules",
"=",
"[",
"]",
";",
"index",
"++",
";",
"}",
"return",
"treeTableModel",
";",
"}"
] | Gets rules and converts them into treeTable format.
@public
@method
@name sap.ui.support.IssueManager.getTreeTableViewModel
@param {object} oRules Deserialized rules found within the current state
@returns {object} TreeTableModel Rules in treeTable usable format
The rules are in a TreeTable format. | [
"Gets",
"rules",
"and",
"converts",
"them",
"into",
"treeTable",
"format",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.support/src/sap/ui/support/supportRules/IssueManager.js#L206-L244 |
|
3,951 | SAP/openui5 | src/sap.ui.support/src/sap/ui/support/supportRules/IssueManager.js | function(issuesModel) {
var treeTableModel = {},
index = 0,
innerIndex = 0,
issueCount = 0,
oSortedSeverityCount,
iHighSeverityCount = 0,
iMediumSeverityCount = 0,
iLowSeverityCount = 0;
for (var libName in issuesModel) {
treeTableModel[index] = {
name: libName,
showAudiences: false,
showCategories: false,
type: "lib"
};
for (var rule in issuesModel[libName]) {
oSortedSeverityCount = this._sortSeverityIssuesByPriority(issuesModel[libName][rule]);
treeTableModel[index][innerIndex] = {
formattedName: this._getFormattedName({
name: issuesModel[libName][rule][0].name,
highCount: oSortedSeverityCount.high,
mediumCount: oSortedSeverityCount.medium,
lowCount: oSortedSeverityCount.low,
highName: 'H',
mediumName: 'M',
lowName: 'L'}),
name: issuesModel[libName][rule][0].name,
showAudiences: true,
showCategories: true,
categories: issuesModel[libName][rule][0].categories.join(", "),
audiences: issuesModel[libName][rule][0].audiences.join(", "),
issueCount: issuesModel[libName][rule].length,
description: issuesModel[libName][rule][0].description,
resolution: issuesModel[libName][rule][0].resolution,
type: "rule",
ruleLibName: issuesModel[libName][rule][0].ruleLibName,
ruleId: issuesModel[libName][rule][0].ruleId,
selected: issuesModel[libName][rule][0].selected,
details: issuesModel[libName][rule][0].details,
severity: issuesModel[libName][rule][0].severity
};
issueCount += issuesModel[libName][rule].length;
innerIndex++;
iHighSeverityCount += oSortedSeverityCount.high;
iMediumSeverityCount += oSortedSeverityCount.medium;
iLowSeverityCount += oSortedSeverityCount.low;
}
treeTableModel[index].formattedName = this._getFormattedName({
name: treeTableModel[index].name,
highCount: iHighSeverityCount,
mediumCount: iMediumSeverityCount,
lowCount: iLowSeverityCount,
highName: 'High',
mediumName: 'Medium',
lowName: 'Low'
});
treeTableModel[index].name += " (" + issueCount + " issues)";
treeTableModel[index].issueCount = issueCount;
issueCount = 0;
innerIndex = 0;
index++;
iHighSeverityCount = 0;
iMediumSeverityCount = 0;
iLowSeverityCount = 0;
}
return treeTableModel;
} | javascript | function(issuesModel) {
var treeTableModel = {},
index = 0,
innerIndex = 0,
issueCount = 0,
oSortedSeverityCount,
iHighSeverityCount = 0,
iMediumSeverityCount = 0,
iLowSeverityCount = 0;
for (var libName in issuesModel) {
treeTableModel[index] = {
name: libName,
showAudiences: false,
showCategories: false,
type: "lib"
};
for (var rule in issuesModel[libName]) {
oSortedSeverityCount = this._sortSeverityIssuesByPriority(issuesModel[libName][rule]);
treeTableModel[index][innerIndex] = {
formattedName: this._getFormattedName({
name: issuesModel[libName][rule][0].name,
highCount: oSortedSeverityCount.high,
mediumCount: oSortedSeverityCount.medium,
lowCount: oSortedSeverityCount.low,
highName: 'H',
mediumName: 'M',
lowName: 'L'}),
name: issuesModel[libName][rule][0].name,
showAudiences: true,
showCategories: true,
categories: issuesModel[libName][rule][0].categories.join(", "),
audiences: issuesModel[libName][rule][0].audiences.join(", "),
issueCount: issuesModel[libName][rule].length,
description: issuesModel[libName][rule][0].description,
resolution: issuesModel[libName][rule][0].resolution,
type: "rule",
ruleLibName: issuesModel[libName][rule][0].ruleLibName,
ruleId: issuesModel[libName][rule][0].ruleId,
selected: issuesModel[libName][rule][0].selected,
details: issuesModel[libName][rule][0].details,
severity: issuesModel[libName][rule][0].severity
};
issueCount += issuesModel[libName][rule].length;
innerIndex++;
iHighSeverityCount += oSortedSeverityCount.high;
iMediumSeverityCount += oSortedSeverityCount.medium;
iLowSeverityCount += oSortedSeverityCount.low;
}
treeTableModel[index].formattedName = this._getFormattedName({
name: treeTableModel[index].name,
highCount: iHighSeverityCount,
mediumCount: iMediumSeverityCount,
lowCount: iLowSeverityCount,
highName: 'High',
mediumName: 'Medium',
lowName: 'Low'
});
treeTableModel[index].name += " (" + issueCount + " issues)";
treeTableModel[index].issueCount = issueCount;
issueCount = 0;
innerIndex = 0;
index++;
iHighSeverityCount = 0;
iMediumSeverityCount = 0;
iLowSeverityCount = 0;
}
return treeTableModel;
} | [
"function",
"(",
"issuesModel",
")",
"{",
"var",
"treeTableModel",
"=",
"{",
"}",
",",
"index",
"=",
"0",
",",
"innerIndex",
"=",
"0",
",",
"issueCount",
"=",
"0",
",",
"oSortedSeverityCount",
",",
"iHighSeverityCount",
"=",
"0",
",",
"iMediumSeverityCount",
"=",
"0",
",",
"iLowSeverityCount",
"=",
"0",
";",
"for",
"(",
"var",
"libName",
"in",
"issuesModel",
")",
"{",
"treeTableModel",
"[",
"index",
"]",
"=",
"{",
"name",
":",
"libName",
",",
"showAudiences",
":",
"false",
",",
"showCategories",
":",
"false",
",",
"type",
":",
"\"lib\"",
"}",
";",
"for",
"(",
"var",
"rule",
"in",
"issuesModel",
"[",
"libName",
"]",
")",
"{",
"oSortedSeverityCount",
"=",
"this",
".",
"_sortSeverityIssuesByPriority",
"(",
"issuesModel",
"[",
"libName",
"]",
"[",
"rule",
"]",
")",
";",
"treeTableModel",
"[",
"index",
"]",
"[",
"innerIndex",
"]",
"=",
"{",
"formattedName",
":",
"this",
".",
"_getFormattedName",
"(",
"{",
"name",
":",
"issuesModel",
"[",
"libName",
"]",
"[",
"rule",
"]",
"[",
"0",
"]",
".",
"name",
",",
"highCount",
":",
"oSortedSeverityCount",
".",
"high",
",",
"mediumCount",
":",
"oSortedSeverityCount",
".",
"medium",
",",
"lowCount",
":",
"oSortedSeverityCount",
".",
"low",
",",
"highName",
":",
"'H'",
",",
"mediumName",
":",
"'M'",
",",
"lowName",
":",
"'L'",
"}",
")",
",",
"name",
":",
"issuesModel",
"[",
"libName",
"]",
"[",
"rule",
"]",
"[",
"0",
"]",
".",
"name",
",",
"showAudiences",
":",
"true",
",",
"showCategories",
":",
"true",
",",
"categories",
":",
"issuesModel",
"[",
"libName",
"]",
"[",
"rule",
"]",
"[",
"0",
"]",
".",
"categories",
".",
"join",
"(",
"\", \"",
")",
",",
"audiences",
":",
"issuesModel",
"[",
"libName",
"]",
"[",
"rule",
"]",
"[",
"0",
"]",
".",
"audiences",
".",
"join",
"(",
"\", \"",
")",
",",
"issueCount",
":",
"issuesModel",
"[",
"libName",
"]",
"[",
"rule",
"]",
".",
"length",
",",
"description",
":",
"issuesModel",
"[",
"libName",
"]",
"[",
"rule",
"]",
"[",
"0",
"]",
".",
"description",
",",
"resolution",
":",
"issuesModel",
"[",
"libName",
"]",
"[",
"rule",
"]",
"[",
"0",
"]",
".",
"resolution",
",",
"type",
":",
"\"rule\"",
",",
"ruleLibName",
":",
"issuesModel",
"[",
"libName",
"]",
"[",
"rule",
"]",
"[",
"0",
"]",
".",
"ruleLibName",
",",
"ruleId",
":",
"issuesModel",
"[",
"libName",
"]",
"[",
"rule",
"]",
"[",
"0",
"]",
".",
"ruleId",
",",
"selected",
":",
"issuesModel",
"[",
"libName",
"]",
"[",
"rule",
"]",
"[",
"0",
"]",
".",
"selected",
",",
"details",
":",
"issuesModel",
"[",
"libName",
"]",
"[",
"rule",
"]",
"[",
"0",
"]",
".",
"details",
",",
"severity",
":",
"issuesModel",
"[",
"libName",
"]",
"[",
"rule",
"]",
"[",
"0",
"]",
".",
"severity",
"}",
";",
"issueCount",
"+=",
"issuesModel",
"[",
"libName",
"]",
"[",
"rule",
"]",
".",
"length",
";",
"innerIndex",
"++",
";",
"iHighSeverityCount",
"+=",
"oSortedSeverityCount",
".",
"high",
";",
"iMediumSeverityCount",
"+=",
"oSortedSeverityCount",
".",
"medium",
";",
"iLowSeverityCount",
"+=",
"oSortedSeverityCount",
".",
"low",
";",
"}",
"treeTableModel",
"[",
"index",
"]",
".",
"formattedName",
"=",
"this",
".",
"_getFormattedName",
"(",
"{",
"name",
":",
"treeTableModel",
"[",
"index",
"]",
".",
"name",
",",
"highCount",
":",
"iHighSeverityCount",
",",
"mediumCount",
":",
"iMediumSeverityCount",
",",
"lowCount",
":",
"iLowSeverityCount",
",",
"highName",
":",
"'High'",
",",
"mediumName",
":",
"'Medium'",
",",
"lowName",
":",
"'Low'",
"}",
")",
";",
"treeTableModel",
"[",
"index",
"]",
".",
"name",
"+=",
"\" (\"",
"+",
"issueCount",
"+",
"\" issues)\"",
";",
"treeTableModel",
"[",
"index",
"]",
".",
"issueCount",
"=",
"issueCount",
";",
"issueCount",
"=",
"0",
";",
"innerIndex",
"=",
"0",
";",
"index",
"++",
";",
"iHighSeverityCount",
"=",
"0",
";",
"iMediumSeverityCount",
"=",
"0",
";",
"iLowSeverityCount",
"=",
"0",
";",
"}",
"return",
"treeTableModel",
";",
"}"
] | Gets issues in TreeTable format.
@public
@method
@name sap.ui.support.IssueManager.getIssuesViewModel
@param {object} issuesModel All the issues after they have been grouped with <code>groupIssues</code>
@returns {object} All the issues in TreeTable usable model | [
"Gets",
"issues",
"in",
"TreeTable",
"format",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.support/src/sap/ui/support/supportRules/IssueManager.js#L254-L330 |
|
3,952 | SAP/openui5 | src/sap.ui.support/src/sap/ui/support/supportRules/IssueManager.js | function (oIssues) {
var viewModel = [];
for (var i = 0; i < oIssues.length; i++) {
viewModel.push(_convertIssueToViewModel(oIssues[i]));
}
return viewModel;
} | javascript | function (oIssues) {
var viewModel = [];
for (var i = 0; i < oIssues.length; i++) {
viewModel.push(_convertIssueToViewModel(oIssues[i]));
}
return viewModel;
} | [
"function",
"(",
"oIssues",
")",
"{",
"var",
"viewModel",
"=",
"[",
"]",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"oIssues",
".",
"length",
";",
"i",
"++",
")",
"{",
"viewModel",
".",
"push",
"(",
"_convertIssueToViewModel",
"(",
"oIssues",
"[",
"i",
"]",
")",
")",
";",
"}",
"return",
"viewModel",
";",
"}"
] | Converts issues to view model format.
@public
@method
@name sap.ui.support.IssueManager.convertToViewModel
@param {array} oIssues The issues to convert
@returns {array} viewModel Issues in ViewModel format | [
"Converts",
"issues",
"to",
"view",
"model",
"format",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.support/src/sap/ui/support/supportRules/IssueManager.js#L398-L404 |
|
3,953 | SAP/openui5 | src/sap.ui.support/src/sap/ui/support/supportRules/IssueManager.js | function (oIssues) {
var groupedIssues = {},
issue = {};
for (var i = 0; i < oIssues.length; i++) {
issue = oIssues[i];
if (!groupedIssues[issue.ruleLibName]) {
groupedIssues[issue.ruleLibName] = {};
}
if (!groupedIssues[issue.ruleLibName][issue.ruleId]) {
groupedIssues[issue.ruleLibName][issue.ruleId] = [];
}
groupedIssues[issue.ruleLibName][issue.ruleId].push(issue);
}
return groupedIssues;
} | javascript | function (oIssues) {
var groupedIssues = {},
issue = {};
for (var i = 0; i < oIssues.length; i++) {
issue = oIssues[i];
if (!groupedIssues[issue.ruleLibName]) {
groupedIssues[issue.ruleLibName] = {};
}
if (!groupedIssues[issue.ruleLibName][issue.ruleId]) {
groupedIssues[issue.ruleLibName][issue.ruleId] = [];
}
groupedIssues[issue.ruleLibName][issue.ruleId].push(issue);
}
return groupedIssues;
} | [
"function",
"(",
"oIssues",
")",
"{",
"var",
"groupedIssues",
"=",
"{",
"}",
",",
"issue",
"=",
"{",
"}",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"oIssues",
".",
"length",
";",
"i",
"++",
")",
"{",
"issue",
"=",
"oIssues",
"[",
"i",
"]",
";",
"if",
"(",
"!",
"groupedIssues",
"[",
"issue",
".",
"ruleLibName",
"]",
")",
"{",
"groupedIssues",
"[",
"issue",
".",
"ruleLibName",
"]",
"=",
"{",
"}",
";",
"}",
"if",
"(",
"!",
"groupedIssues",
"[",
"issue",
".",
"ruleLibName",
"]",
"[",
"issue",
".",
"ruleId",
"]",
")",
"{",
"groupedIssues",
"[",
"issue",
".",
"ruleLibName",
"]",
"[",
"issue",
".",
"ruleId",
"]",
"=",
"[",
"]",
";",
"}",
"groupedIssues",
"[",
"issue",
".",
"ruleLibName",
"]",
"[",
"issue",
".",
"ruleId",
"]",
".",
"push",
"(",
"issue",
")",
";",
"}",
"return",
"groupedIssues",
";",
"}"
] | Groups all issues by library and rule ID.
@public
@method
@name sap.ui.support.IssueManager.groupIssues
@param {array} oIssues The issues to group. Must be in a ViewModel format
@returns {array} groupedIssues Grouped issues by library and rule id | [
"Groups",
"all",
"issues",
"by",
"library",
"and",
"rule",
"ID",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.support/src/sap/ui/support/supportRules/IssueManager.js#L414-L433 |
|
3,954 | SAP/openui5 | src/sap.ui.table/src/sap/ui/table/TableRendererUtils.js | function(rm, sClassName, bShouldAdd) {
if (sClassName && (!!bShouldAdd || arguments.length == 2)) {
rm.addClass(sClassName);
if (TAGCONTEXT) {
TAGCONTEXT.writeClasses = true;
}
}
return TableRendererUtils;
} | javascript | function(rm, sClassName, bShouldAdd) {
if (sClassName && (!!bShouldAdd || arguments.length == 2)) {
rm.addClass(sClassName);
if (TAGCONTEXT) {
TAGCONTEXT.writeClasses = true;
}
}
return TableRendererUtils;
} | [
"function",
"(",
"rm",
",",
"sClassName",
",",
"bShouldAdd",
")",
"{",
"if",
"(",
"sClassName",
"&&",
"(",
"!",
"!",
"bShouldAdd",
"||",
"arguments",
".",
"length",
"==",
"2",
")",
")",
"{",
"rm",
".",
"addClass",
"(",
"sClassName",
")",
";",
"if",
"(",
"TAGCONTEXT",
")",
"{",
"TAGCONTEXT",
".",
"writeClasses",
"=",
"true",
";",
"}",
"}",
"return",
"TableRendererUtils",
";",
"}"
] | Adds the given CSS class if no condition is given or the condition is truthy.
@param {sap.ui.core.RenderManager} rm Instance of the rendermanager
@param {string} sClassName The CSS class which should be written
@param {boolean} [bShouldAdd] optional condition
@returns TableRendererUtils to allow method chaining
@private | [
"Adds",
"the",
"given",
"CSS",
"class",
"if",
"no",
"condition",
"is",
"given",
"or",
"the",
"condition",
"is",
"truthy",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/TableRendererUtils.js#L33-L41 |
|
3,955 | SAP/openui5 | src/sap.ui.table/src/sap/ui/table/TableRendererUtils.js | function(rm, sName, oValue, bShouldAdd) {
if (sName && oValue && (!!bShouldAdd || arguments.length == 3)) {
rm.addStyle(sName, oValue);
if (TAGCONTEXT) {
TAGCONTEXT.writeStyles = true;
}
}
return TableRendererUtils;
} | javascript | function(rm, sName, oValue, bShouldAdd) {
if (sName && oValue && (!!bShouldAdd || arguments.length == 3)) {
rm.addStyle(sName, oValue);
if (TAGCONTEXT) {
TAGCONTEXT.writeStyles = true;
}
}
return TableRendererUtils;
} | [
"function",
"(",
"rm",
",",
"sName",
",",
"oValue",
",",
"bShouldAdd",
")",
"{",
"if",
"(",
"sName",
"&&",
"oValue",
"&&",
"(",
"!",
"!",
"bShouldAdd",
"||",
"arguments",
".",
"length",
"==",
"3",
")",
")",
"{",
"rm",
".",
"addStyle",
"(",
"sName",
",",
"oValue",
")",
";",
"if",
"(",
"TAGCONTEXT",
")",
"{",
"TAGCONTEXT",
".",
"writeStyles",
"=",
"true",
";",
"}",
"}",
"return",
"TableRendererUtils",
";",
"}"
] | Adds the given style if no condition is given or the condition is truthy.
@param {sap.ui.core.RenderManager} rm Instance of the rendermanager
@param {string} sName The style name which should be written
@param {string} oValue The style value which should be written
@param {boolean} [bShouldAdd] optional condition
@returns TableRendererUtils to allow method chaining
@private | [
"Adds",
"the",
"given",
"style",
"if",
"no",
"condition",
"is",
"given",
"or",
"the",
"condition",
"is",
"truthy",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/TableRendererUtils.js#L54-L62 |
|
3,956 | SAP/openui5 | src/sap.ui.table/src/sap/ui/table/TableRendererUtils.js | function(rm, oTable, oConfig) {
oConfig = oConfig || {};
rm.write("<", oConfig.tag || "div");
TAGCONTEXT = oConfig;
if (oConfig.furtherSettings) {
oConfig.furtherSettings(rm, oTable);
}
if (Array.isArray(oConfig.classname) && oConfig.classname.length) {
for (var i = 0; i < oConfig.classname.length; i++) {
TableRendererUtils.addClass(rm, oConfig.classname[i]);
}
} else if (oConfig.classname) {
TableRendererUtils.addClass(rm, oConfig.classname);
}
if (oConfig.id) {
rm.writeAttribute("id", (oConfig.element || oTable).getId() + "-" + oConfig.id);
} else if (oConfig.element) {
if (oConfig.element instanceof Control) {
rm.writeControlData(oConfig.element);
} else {
rm.writeElementData(oConfig.element);
}
}
if (oConfig.attributes) {
for (var name in oConfig.attributes) {
if (oConfig.attributes.hasOwnProperty(name)) {
rm.writeAttribute(name, oConfig.attributes[name]);
}
}
}
if (typeof oConfig.tabindex === "number") {
rm.writeAttribute("tabindex", "" + oConfig.tabindex);
}
if (oConfig.aria) {
oTable._getAccRenderExtension().writeAriaAttributesFor(rm, oTable, oConfig.aria, oConfig.ariaconfig);
}
if (TAGCONTEXT.writeClasses) {
rm.writeClasses();
}
if (TAGCONTEXT.writeStyles) {
rm.writeStyles();
}
TAGCONTEXT = null;
rm.write(">");
return TableRendererUtils;
} | javascript | function(rm, oTable, oConfig) {
oConfig = oConfig || {};
rm.write("<", oConfig.tag || "div");
TAGCONTEXT = oConfig;
if (oConfig.furtherSettings) {
oConfig.furtherSettings(rm, oTable);
}
if (Array.isArray(oConfig.classname) && oConfig.classname.length) {
for (var i = 0; i < oConfig.classname.length; i++) {
TableRendererUtils.addClass(rm, oConfig.classname[i]);
}
} else if (oConfig.classname) {
TableRendererUtils.addClass(rm, oConfig.classname);
}
if (oConfig.id) {
rm.writeAttribute("id", (oConfig.element || oTable).getId() + "-" + oConfig.id);
} else if (oConfig.element) {
if (oConfig.element instanceof Control) {
rm.writeControlData(oConfig.element);
} else {
rm.writeElementData(oConfig.element);
}
}
if (oConfig.attributes) {
for (var name in oConfig.attributes) {
if (oConfig.attributes.hasOwnProperty(name)) {
rm.writeAttribute(name, oConfig.attributes[name]);
}
}
}
if (typeof oConfig.tabindex === "number") {
rm.writeAttribute("tabindex", "" + oConfig.tabindex);
}
if (oConfig.aria) {
oTable._getAccRenderExtension().writeAriaAttributesFor(rm, oTable, oConfig.aria, oConfig.ariaconfig);
}
if (TAGCONTEXT.writeClasses) {
rm.writeClasses();
}
if (TAGCONTEXT.writeStyles) {
rm.writeStyles();
}
TAGCONTEXT = null;
rm.write(">");
return TableRendererUtils;
} | [
"function",
"(",
"rm",
",",
"oTable",
",",
"oConfig",
")",
"{",
"oConfig",
"=",
"oConfig",
"||",
"{",
"}",
";",
"rm",
".",
"write",
"(",
"\"<\"",
",",
"oConfig",
".",
"tag",
"||",
"\"div\"",
")",
";",
"TAGCONTEXT",
"=",
"oConfig",
";",
"if",
"(",
"oConfig",
".",
"furtherSettings",
")",
"{",
"oConfig",
".",
"furtherSettings",
"(",
"rm",
",",
"oTable",
")",
";",
"}",
"if",
"(",
"Array",
".",
"isArray",
"(",
"oConfig",
".",
"classname",
")",
"&&",
"oConfig",
".",
"classname",
".",
"length",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"oConfig",
".",
"classname",
".",
"length",
";",
"i",
"++",
")",
"{",
"TableRendererUtils",
".",
"addClass",
"(",
"rm",
",",
"oConfig",
".",
"classname",
"[",
"i",
"]",
")",
";",
"}",
"}",
"else",
"if",
"(",
"oConfig",
".",
"classname",
")",
"{",
"TableRendererUtils",
".",
"addClass",
"(",
"rm",
",",
"oConfig",
".",
"classname",
")",
";",
"}",
"if",
"(",
"oConfig",
".",
"id",
")",
"{",
"rm",
".",
"writeAttribute",
"(",
"\"id\"",
",",
"(",
"oConfig",
".",
"element",
"||",
"oTable",
")",
".",
"getId",
"(",
")",
"+",
"\"-\"",
"+",
"oConfig",
".",
"id",
")",
";",
"}",
"else",
"if",
"(",
"oConfig",
".",
"element",
")",
"{",
"if",
"(",
"oConfig",
".",
"element",
"instanceof",
"Control",
")",
"{",
"rm",
".",
"writeControlData",
"(",
"oConfig",
".",
"element",
")",
";",
"}",
"else",
"{",
"rm",
".",
"writeElementData",
"(",
"oConfig",
".",
"element",
")",
";",
"}",
"}",
"if",
"(",
"oConfig",
".",
"attributes",
")",
"{",
"for",
"(",
"var",
"name",
"in",
"oConfig",
".",
"attributes",
")",
"{",
"if",
"(",
"oConfig",
".",
"attributes",
".",
"hasOwnProperty",
"(",
"name",
")",
")",
"{",
"rm",
".",
"writeAttribute",
"(",
"name",
",",
"oConfig",
".",
"attributes",
"[",
"name",
"]",
")",
";",
"}",
"}",
"}",
"if",
"(",
"typeof",
"oConfig",
".",
"tabindex",
"===",
"\"number\"",
")",
"{",
"rm",
".",
"writeAttribute",
"(",
"\"tabindex\"",
",",
"\"\"",
"+",
"oConfig",
".",
"tabindex",
")",
";",
"}",
"if",
"(",
"oConfig",
".",
"aria",
")",
"{",
"oTable",
".",
"_getAccRenderExtension",
"(",
")",
".",
"writeAriaAttributesFor",
"(",
"rm",
",",
"oTable",
",",
"oConfig",
".",
"aria",
",",
"oConfig",
".",
"ariaconfig",
")",
";",
"}",
"if",
"(",
"TAGCONTEXT",
".",
"writeClasses",
")",
"{",
"rm",
".",
"writeClasses",
"(",
")",
";",
"}",
"if",
"(",
"TAGCONTEXT",
".",
"writeStyles",
")",
"{",
"rm",
".",
"writeStyles",
"(",
")",
";",
"}",
"TAGCONTEXT",
"=",
"null",
";",
"rm",
".",
"write",
"(",
"\">\"",
")",
";",
"return",
"TableRendererUtils",
";",
"}"
] | Writes the starting tag of an element with the given settings.
@param {sap.ui.core.RenderManager} rm Instance of the rendermanager
@param {sap.ui.table.Table} oTable Instance of the table
@param {object} oConfig the configuration of the start tag
@param {string} [oConfig.tag] The tag type which should be used. If nothing is given <code>div</code> is used.
@param {string|string[]} [oConfig.classname] CSS class(es) which should be added to the element.
@param {string} [oConfig.id] The id which should be used. The id is automatically prefixed with the id of the <code>oTable</code>
of with the id of <code>oConfig.element</code> (if given).
@param {sap.ui.core.Element} [oConfig.element] If an id is given, the id is prefixed with the id of <code>oConfig.element</code>. If no id is given
the control/element data of this element is written.
@param {number} [oConfig.tabindex] The value of the tabindex attribute, if needed.
@param {object} [oConfig.attributes] Map of name value pairs of further attributes which should be written (NOTE: No escaping is done!)
@param {string} [oConfig.aria] The key as defined in the AccRenderExtension to render the aria attributes (see writeAriaAttributesFor)
@param {object} [oConfig.ariaconfig] Map of further aria configurations (see <code>writeAriaAttributesFor</code>)
@param {function} [oConfig.furtherSettings] Callback function which can be used for additional settings (which are not covered by the features of this function)
on the start element
@param {boolean} [oConfig.writeClasses] Whether the <code>writeClasses</code> function of the render manager should be called. This flag is automatically set
when the <code>classname</code> attribute is given or when the <code>TableRendererUtils.addClass</code> function is
used within the <code>furtherSettings</code> callback.
@param {boolean} [oConfig.writeStyles] Whether the <code>writeStyles</code> function of the render manager should be called. This flag is automatically set
when the <code>TableRendererUtils.addStyle</code> function is used within the <code>furtherSettings</code> callback.
@returns TableRendererUtils to allow method chaining
@private | [
"Writes",
"the",
"starting",
"tag",
"of",
"an",
"element",
"with",
"the",
"given",
"settings",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/TableRendererUtils.js#L92-L146 |
|
3,957 | SAP/openui5 | src/sap.ui.table/src/sap/ui/table/TableRendererUtils.js | function(rm, oTable, oConfig) {
TableRendererUtils.startElement(rm, oTable, oConfig);
TableRendererUtils.endElement(rm, oConfig ? oConfig.tag : null);
return TableRendererUtils;
} | javascript | function(rm, oTable, oConfig) {
TableRendererUtils.startElement(rm, oTable, oConfig);
TableRendererUtils.endElement(rm, oConfig ? oConfig.tag : null);
return TableRendererUtils;
} | [
"function",
"(",
"rm",
",",
"oTable",
",",
"oConfig",
")",
"{",
"TableRendererUtils",
".",
"startElement",
"(",
"rm",
",",
"oTable",
",",
"oConfig",
")",
";",
"TableRendererUtils",
".",
"endElement",
"(",
"rm",
",",
"oConfig",
"?",
"oConfig",
".",
"tag",
":",
"null",
")",
";",
"return",
"TableRendererUtils",
";",
"}"
] | Writes the starting and end tag of an element with the given settings.
@param {sap.ui.core.RenderManager} rm Instance of the rendermanager
@param {sap.ui.table.Table} oTable Instance of the table
@param {object} oConfig the configuration of the start tag
@returns TableRendererUtils to allow method chaining
@see TableRendererUtils#startElement
@see TableRendererUtils#endElement
@private | [
"Writes",
"the",
"starting",
"and",
"end",
"tag",
"of",
"an",
"element",
"with",
"the",
"given",
"settings",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/TableRendererUtils.js#L173-L177 |
|
3,958 | SAP/openui5 | src/sap.ui.core/src/sap/ui/thirdparty/signals.js | function (listener, listenerContext, priority) {
validateListener(listener, 'add');
return this._registerListener(listener, false, listenerContext, priority);
} | javascript | function (listener, listenerContext, priority) {
validateListener(listener, 'add');
return this._registerListener(listener, false, listenerContext, priority);
} | [
"function",
"(",
"listener",
",",
"listenerContext",
",",
"priority",
")",
"{",
"validateListener",
"(",
"listener",
",",
"'add'",
")",
";",
"return",
"this",
".",
"_registerListener",
"(",
"listener",
",",
"false",
",",
"listenerContext",
",",
"priority",
")",
";",
"}"
] | Add a listener to the signal.
@param {Function} listener Signal handler function.
@param {Object} [listenerContext] Context on which listener will be executed (object that should represent the `this` variable inside listener function).
@param {Number} [priority] The priority level of the event listener. Listeners with higher priority will be executed before listeners with lower priority. Listeners with same priority level will be executed at the same order as they were added. (default = 0)
@return {SignalBinding} An Object representing the binding between the Signal and listener. | [
"Add",
"a",
"listener",
"to",
"the",
"signal",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/thirdparty/signals.js#L296-L299 |
|
3,959 | SAP/openui5 | src/sap.ui.core/src/sap/ui/thirdparty/signals.js | function (listener, context) {
validateListener(listener, 'remove');
var i = this._indexOfListener(listener, context);
if (i !== -1) {
this._bindings[i]._destroy(); //no reason to a SignalBinding exist if it isn't attached to a signal
this._bindings.splice(i, 1);
}
return listener;
} | javascript | function (listener, context) {
validateListener(listener, 'remove');
var i = this._indexOfListener(listener, context);
if (i !== -1) {
this._bindings[i]._destroy(); //no reason to a SignalBinding exist if it isn't attached to a signal
this._bindings.splice(i, 1);
}
return listener;
} | [
"function",
"(",
"listener",
",",
"context",
")",
"{",
"validateListener",
"(",
"listener",
",",
"'remove'",
")",
";",
"var",
"i",
"=",
"this",
".",
"_indexOfListener",
"(",
"listener",
",",
"context",
")",
";",
"if",
"(",
"i",
"!==",
"-",
"1",
")",
"{",
"this",
".",
"_bindings",
"[",
"i",
"]",
".",
"_destroy",
"(",
")",
";",
"//no reason to a SignalBinding exist if it isn't attached to a signal",
"this",
".",
"_bindings",
".",
"splice",
"(",
"i",
",",
"1",
")",
";",
"}",
"return",
"listener",
";",
"}"
] | Remove a single listener from the dispatch queue.
@param {Function} listener Handler function that should be removed.
@param {Object} [context] Execution context (since you can add the same handler multiple times if executing in a different context).
@return {Function} Listener handler function. | [
"Remove",
"a",
"single",
"listener",
"from",
"the",
"dispatch",
"queue",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/thirdparty/signals.js#L319-L328 |
|
3,960 | SAP/openui5 | src/sap.ui.demokit/src/sap/ui/demokit/explored/util/MyRouter.js | function (sRoute, oData) {
var oHistory = History.getInstance();
var oPrevHash = oHistory.getPreviousHash();
if (oPrevHash !== undefined) {
window.history.go(-1);
} else {
var bReplace = true; // otherwise we go backwards with a forward history
this.navTo(sRoute, oData, bReplace);
}
} | javascript | function (sRoute, oData) {
var oHistory = History.getInstance();
var oPrevHash = oHistory.getPreviousHash();
if (oPrevHash !== undefined) {
window.history.go(-1);
} else {
var bReplace = true; // otherwise we go backwards with a forward history
this.navTo(sRoute, oData, bReplace);
}
} | [
"function",
"(",
"sRoute",
",",
"oData",
")",
"{",
"var",
"oHistory",
"=",
"History",
".",
"getInstance",
"(",
")",
";",
"var",
"oPrevHash",
"=",
"oHistory",
".",
"getPreviousHash",
"(",
")",
";",
"if",
"(",
"oPrevHash",
"!==",
"undefined",
")",
"{",
"window",
".",
"history",
".",
"go",
"(",
"-",
"1",
")",
";",
"}",
"else",
"{",
"var",
"bReplace",
"=",
"true",
";",
"// otherwise we go backwards with a forward history",
"this",
".",
"navTo",
"(",
"sRoute",
",",
"oData",
",",
"bReplace",
")",
";",
"}",
"}"
] | mobile nav back handling | [
"mobile",
"nav",
"back",
"handling"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.demokit/src/sap/ui/demokit/explored/util/MyRouter.js#L17-L26 |
|
3,961 | SAP/openui5 | src/sap.ui.core/src/sap/ui/model/odata/_ODataMetaModelUtils.js | function (o, oExtension, sTypeClass, sNonDefaultValue, bDeepCopy) {
if (sTypeClass === "EntitySet" && oExtension.value === sNonDefaultValue) {
// potentially nested structure so do deep copy
if (bDeepCopy) {
jQuery.extend(true, o, mV2ToV4[oExtension.name]);
} else {
// Warning: Passing false for the first argument is not supported!
jQuery.extend(o, mV2ToV4[oExtension.name]);
}
}
} | javascript | function (o, oExtension, sTypeClass, sNonDefaultValue, bDeepCopy) {
if (sTypeClass === "EntitySet" && oExtension.value === sNonDefaultValue) {
// potentially nested structure so do deep copy
if (bDeepCopy) {
jQuery.extend(true, o, mV2ToV4[oExtension.name]);
} else {
// Warning: Passing false for the first argument is not supported!
jQuery.extend(o, mV2ToV4[oExtension.name]);
}
}
} | [
"function",
"(",
"o",
",",
"oExtension",
",",
"sTypeClass",
",",
"sNonDefaultValue",
",",
"bDeepCopy",
")",
"{",
"if",
"(",
"sTypeClass",
"===",
"\"EntitySet\"",
"&&",
"oExtension",
".",
"value",
"===",
"sNonDefaultValue",
")",
"{",
"// potentially nested structure so do deep copy",
"if",
"(",
"bDeepCopy",
")",
"{",
"jQuery",
".",
"extend",
"(",
"true",
",",
"o",
",",
"mV2ToV4",
"[",
"oExtension",
".",
"name",
"]",
")",
";",
"}",
"else",
"{",
"// Warning: Passing false for the first argument is not supported!",
"jQuery",
".",
"extend",
"(",
"o",
",",
"mV2ToV4",
"[",
"oExtension",
".",
"name",
"]",
")",
";",
"}",
"}",
"}"
] | Adds EntitySet V4 annotation for current extension if extension value is equal to
the given non-default value. Depending on bDeepCopy the annotation will be merged
with deep copy.
@param {object} o
any object
@param {object} oExtension
the SAP Annotation (OData Version 2.0) for which a V4 annotation needs to be added
@param {string} sTypeClass
the type class of the given object; supported type classes are "Property" and
"EntitySet"
@param {string} sNonDefaultValue
if current extension value is equal to this sNonDefaultValue the annotation is
added
@param {boolean} bDeepCopy
if true the annotation is mixed in as deep copy of the entry in mV2ToV4 map | [
"Adds",
"EntitySet",
"V4",
"annotation",
"for",
"current",
"extension",
"if",
"extension",
"value",
"is",
"equal",
"to",
"the",
"given",
"non",
"-",
"default",
"value",
".",
"Depending",
"on",
"bDeepCopy",
"the",
"annotation",
"will",
"be",
"merged",
"with",
"deep",
"copy",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/_ODataMetaModelUtils.js#L181-L191 |
|
3,962 | SAP/openui5 | src/sap.ui.core/src/sap/ui/model/odata/_ODataMetaModelUtils.js | function (sV2AnnotationName, oEntitySet, oProperty) {
var aNames = mV2ToV4PropertyCollection[sV2AnnotationName],
sTerm = aNames[0],
sCollection = aNames[1],
oAnnotation = oEntitySet[sTerm] || {},
aCollection = oAnnotation[sCollection] || [];
aCollection.push({ "PropertyPath" : oProperty.name });
oAnnotation[sCollection] = aCollection;
oEntitySet[sTerm] = oAnnotation;
} | javascript | function (sV2AnnotationName, oEntitySet, oProperty) {
var aNames = mV2ToV4PropertyCollection[sV2AnnotationName],
sTerm = aNames[0],
sCollection = aNames[1],
oAnnotation = oEntitySet[sTerm] || {},
aCollection = oAnnotation[sCollection] || [];
aCollection.push({ "PropertyPath" : oProperty.name });
oAnnotation[sCollection] = aCollection;
oEntitySet[sTerm] = oAnnotation;
} | [
"function",
"(",
"sV2AnnotationName",
",",
"oEntitySet",
",",
"oProperty",
")",
"{",
"var",
"aNames",
"=",
"mV2ToV4PropertyCollection",
"[",
"sV2AnnotationName",
"]",
",",
"sTerm",
"=",
"aNames",
"[",
"0",
"]",
",",
"sCollection",
"=",
"aNames",
"[",
"1",
"]",
",",
"oAnnotation",
"=",
"oEntitySet",
"[",
"sTerm",
"]",
"||",
"{",
"}",
",",
"aCollection",
"=",
"oAnnotation",
"[",
"sCollection",
"]",
"||",
"[",
"]",
";",
"aCollection",
".",
"push",
"(",
"{",
"\"PropertyPath\"",
":",
"oProperty",
".",
"name",
"}",
")",
";",
"oAnnotation",
"[",
"sCollection",
"]",
"=",
"aCollection",
";",
"oEntitySet",
"[",
"sTerm",
"]",
"=",
"oAnnotation",
";",
"}"
] | Adds current property to the property collection for given V2 annotation.
@param {string} sV2AnnotationName
V2 annotation name (key in map mV2ToV4PropertyCollection)
@param {object} oEntitySet
the entity set
@param {object} oProperty
the property of the entity | [
"Adds",
"current",
"property",
"to",
"the",
"property",
"collection",
"for",
"given",
"V2",
"annotation",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/_ODataMetaModelUtils.js#L270-L280 |
|
3,963 | SAP/openui5 | src/sap.ui.core/src/sap/ui/model/odata/_ODataMetaModelUtils.js | function (o, oExtension, sTypeClass) {
switch (oExtension.name) {
case "aggregation-role":
if (oExtension.value === "dimension") {
o["com.sap.vocabularies.Analytics.v1.Dimension"] = oBoolTrue;
} else if (oExtension.value === "measure") {
o["com.sap.vocabularies.Analytics.v1.Measure"] = oBoolTrue;
}
break;
case "display-format":
if (oExtension.value === "NonNegative") {
o["com.sap.vocabularies.Common.v1.IsDigitSequence"] = oBoolTrue;
} else if (oExtension.value === "UpperCase") {
o["com.sap.vocabularies.Common.v1.IsUpperCase"] = oBoolTrue;
}
break;
case "pageable":
case "topable":
Utils.addEntitySetAnnotation(o, oExtension, sTypeClass, "false", false);
break;
case "creatable":
Utils.addEntitySetAnnotation(o, oExtension, sTypeClass, "false", true);
break;
case "deletable":
case "deletable-path":
Utils.handleXableAndXablePath(o, oExtension, sTypeClass,
"Org.OData.Capabilities.V1.DeleteRestrictions", "Deletable");
break;
case "updatable":
case "updatable-path":
Utils.handleXableAndXablePath(o, oExtension, sTypeClass,
"Org.OData.Capabilities.V1.UpdateRestrictions", "Updatable");
break;
case "requires-filter":
Utils.addEntitySetAnnotation(o, oExtension, sTypeClass, "true", true);
break;
case "field-control":
o["com.sap.vocabularies.Common.v1.FieldControl"]
= { "Path" : oExtension.value };
break;
case "heading":
o["com.sap.vocabularies.Common.v1.Heading"] = { "String" : oExtension.value };
break;
case "label":
o["com.sap.vocabularies.Common.v1.Label"] = { "String" : oExtension.value };
break;
case "precision":
o["Org.OData.Measures.V1.Scale"] = { "Path" : oExtension.value };
break;
case "quickinfo":
o["com.sap.vocabularies.Common.v1.QuickInfo"] =
{ "String" : oExtension.value };
break;
case "text":
o["com.sap.vocabularies.Common.v1.Text"] = { "Path" : oExtension.value };
break;
case "visible":
if (oExtension.value === "false") {
o["com.sap.vocabularies.Common.v1.FieldControl"] = {
"EnumMember" : "com.sap.vocabularies.Common.v1.FieldControlType/Hidden"
};
o["com.sap.vocabularies.UI.v1.Hidden"] = oBoolTrue;
}
break;
default:
// no transformation for V2 annotation supported or necessary
}
} | javascript | function (o, oExtension, sTypeClass) {
switch (oExtension.name) {
case "aggregation-role":
if (oExtension.value === "dimension") {
o["com.sap.vocabularies.Analytics.v1.Dimension"] = oBoolTrue;
} else if (oExtension.value === "measure") {
o["com.sap.vocabularies.Analytics.v1.Measure"] = oBoolTrue;
}
break;
case "display-format":
if (oExtension.value === "NonNegative") {
o["com.sap.vocabularies.Common.v1.IsDigitSequence"] = oBoolTrue;
} else if (oExtension.value === "UpperCase") {
o["com.sap.vocabularies.Common.v1.IsUpperCase"] = oBoolTrue;
}
break;
case "pageable":
case "topable":
Utils.addEntitySetAnnotation(o, oExtension, sTypeClass, "false", false);
break;
case "creatable":
Utils.addEntitySetAnnotation(o, oExtension, sTypeClass, "false", true);
break;
case "deletable":
case "deletable-path":
Utils.handleXableAndXablePath(o, oExtension, sTypeClass,
"Org.OData.Capabilities.V1.DeleteRestrictions", "Deletable");
break;
case "updatable":
case "updatable-path":
Utils.handleXableAndXablePath(o, oExtension, sTypeClass,
"Org.OData.Capabilities.V1.UpdateRestrictions", "Updatable");
break;
case "requires-filter":
Utils.addEntitySetAnnotation(o, oExtension, sTypeClass, "true", true);
break;
case "field-control":
o["com.sap.vocabularies.Common.v1.FieldControl"]
= { "Path" : oExtension.value };
break;
case "heading":
o["com.sap.vocabularies.Common.v1.Heading"] = { "String" : oExtension.value };
break;
case "label":
o["com.sap.vocabularies.Common.v1.Label"] = { "String" : oExtension.value };
break;
case "precision":
o["Org.OData.Measures.V1.Scale"] = { "Path" : oExtension.value };
break;
case "quickinfo":
o["com.sap.vocabularies.Common.v1.QuickInfo"] =
{ "String" : oExtension.value };
break;
case "text":
o["com.sap.vocabularies.Common.v1.Text"] = { "Path" : oExtension.value };
break;
case "visible":
if (oExtension.value === "false") {
o["com.sap.vocabularies.Common.v1.FieldControl"] = {
"EnumMember" : "com.sap.vocabularies.Common.v1.FieldControlType/Hidden"
};
o["com.sap.vocabularies.UI.v1.Hidden"] = oBoolTrue;
}
break;
default:
// no transformation for V2 annotation supported or necessary
}
} | [
"function",
"(",
"o",
",",
"oExtension",
",",
"sTypeClass",
")",
"{",
"switch",
"(",
"oExtension",
".",
"name",
")",
"{",
"case",
"\"aggregation-role\"",
":",
"if",
"(",
"oExtension",
".",
"value",
"===",
"\"dimension\"",
")",
"{",
"o",
"[",
"\"com.sap.vocabularies.Analytics.v1.Dimension\"",
"]",
"=",
"oBoolTrue",
";",
"}",
"else",
"if",
"(",
"oExtension",
".",
"value",
"===",
"\"measure\"",
")",
"{",
"o",
"[",
"\"com.sap.vocabularies.Analytics.v1.Measure\"",
"]",
"=",
"oBoolTrue",
";",
"}",
"break",
";",
"case",
"\"display-format\"",
":",
"if",
"(",
"oExtension",
".",
"value",
"===",
"\"NonNegative\"",
")",
"{",
"o",
"[",
"\"com.sap.vocabularies.Common.v1.IsDigitSequence\"",
"]",
"=",
"oBoolTrue",
";",
"}",
"else",
"if",
"(",
"oExtension",
".",
"value",
"===",
"\"UpperCase\"",
")",
"{",
"o",
"[",
"\"com.sap.vocabularies.Common.v1.IsUpperCase\"",
"]",
"=",
"oBoolTrue",
";",
"}",
"break",
";",
"case",
"\"pageable\"",
":",
"case",
"\"topable\"",
":",
"Utils",
".",
"addEntitySetAnnotation",
"(",
"o",
",",
"oExtension",
",",
"sTypeClass",
",",
"\"false\"",
",",
"false",
")",
";",
"break",
";",
"case",
"\"creatable\"",
":",
"Utils",
".",
"addEntitySetAnnotation",
"(",
"o",
",",
"oExtension",
",",
"sTypeClass",
",",
"\"false\"",
",",
"true",
")",
";",
"break",
";",
"case",
"\"deletable\"",
":",
"case",
"\"deletable-path\"",
":",
"Utils",
".",
"handleXableAndXablePath",
"(",
"o",
",",
"oExtension",
",",
"sTypeClass",
",",
"\"Org.OData.Capabilities.V1.DeleteRestrictions\"",
",",
"\"Deletable\"",
")",
";",
"break",
";",
"case",
"\"updatable\"",
":",
"case",
"\"updatable-path\"",
":",
"Utils",
".",
"handleXableAndXablePath",
"(",
"o",
",",
"oExtension",
",",
"sTypeClass",
",",
"\"Org.OData.Capabilities.V1.UpdateRestrictions\"",
",",
"\"Updatable\"",
")",
";",
"break",
";",
"case",
"\"requires-filter\"",
":",
"Utils",
".",
"addEntitySetAnnotation",
"(",
"o",
",",
"oExtension",
",",
"sTypeClass",
",",
"\"true\"",
",",
"true",
")",
";",
"break",
";",
"case",
"\"field-control\"",
":",
"o",
"[",
"\"com.sap.vocabularies.Common.v1.FieldControl\"",
"]",
"=",
"{",
"\"Path\"",
":",
"oExtension",
".",
"value",
"}",
";",
"break",
";",
"case",
"\"heading\"",
":",
"o",
"[",
"\"com.sap.vocabularies.Common.v1.Heading\"",
"]",
"=",
"{",
"\"String\"",
":",
"oExtension",
".",
"value",
"}",
";",
"break",
";",
"case",
"\"label\"",
":",
"o",
"[",
"\"com.sap.vocabularies.Common.v1.Label\"",
"]",
"=",
"{",
"\"String\"",
":",
"oExtension",
".",
"value",
"}",
";",
"break",
";",
"case",
"\"precision\"",
":",
"o",
"[",
"\"Org.OData.Measures.V1.Scale\"",
"]",
"=",
"{",
"\"Path\"",
":",
"oExtension",
".",
"value",
"}",
";",
"break",
";",
"case",
"\"quickinfo\"",
":",
"o",
"[",
"\"com.sap.vocabularies.Common.v1.QuickInfo\"",
"]",
"=",
"{",
"\"String\"",
":",
"oExtension",
".",
"value",
"}",
";",
"break",
";",
"case",
"\"text\"",
":",
"o",
"[",
"\"com.sap.vocabularies.Common.v1.Text\"",
"]",
"=",
"{",
"\"Path\"",
":",
"oExtension",
".",
"value",
"}",
";",
"break",
";",
"case",
"\"visible\"",
":",
"if",
"(",
"oExtension",
".",
"value",
"===",
"\"false\"",
")",
"{",
"o",
"[",
"\"com.sap.vocabularies.Common.v1.FieldControl\"",
"]",
"=",
"{",
"\"EnumMember\"",
":",
"\"com.sap.vocabularies.Common.v1.FieldControlType/Hidden\"",
"}",
";",
"o",
"[",
"\"com.sap.vocabularies.UI.v1.Hidden\"",
"]",
"=",
"oBoolTrue",
";",
"}",
"break",
";",
"default",
":",
"// no transformation for V2 annotation supported or necessary",
"}",
"}"
] | Adds the corresponding V4 annotation to the given object based on the given SAP
extension.
@param {object} o
any object
@param {object} oExtension
the SAP Annotation (OData Version 2.0) for which a V4 annotation needs to be added
@param {string} sTypeClass
the type class of the given object; supported type classes are "Property" and
"EntitySet" | [
"Adds",
"the",
"corresponding",
"V4",
"annotation",
"to",
"the",
"given",
"object",
"based",
"on",
"the",
"given",
"SAP",
"extension",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/_ODataMetaModelUtils.js#L461-L528 |
|
3,964 | SAP/openui5 | src/sap.ui.core/src/sap/ui/model/odata/_ODataMetaModelUtils.js | function (aArray, vExpectedPropertyValue, sPropertyName) {
var i, n;
sPropertyName = sPropertyName || "name";
if (aArray) {
for (i = 0, n = aArray.length; i < n; i += 1) {
if (aArray[i][sPropertyName] === vExpectedPropertyValue) {
return i;
}
}
}
return -1;
} | javascript | function (aArray, vExpectedPropertyValue, sPropertyName) {
var i, n;
sPropertyName = sPropertyName || "name";
if (aArray) {
for (i = 0, n = aArray.length; i < n; i += 1) {
if (aArray[i][sPropertyName] === vExpectedPropertyValue) {
return i;
}
}
}
return -1;
} | [
"function",
"(",
"aArray",
",",
"vExpectedPropertyValue",
",",
"sPropertyName",
")",
"{",
"var",
"i",
",",
"n",
";",
"sPropertyName",
"=",
"sPropertyName",
"||",
"\"name\"",
";",
"if",
"(",
"aArray",
")",
"{",
"for",
"(",
"i",
"=",
"0",
",",
"n",
"=",
"aArray",
".",
"length",
";",
"i",
"<",
"n",
";",
"i",
"+=",
"1",
")",
"{",
"if",
"(",
"aArray",
"[",
"i",
"]",
"[",
"sPropertyName",
"]",
"===",
"vExpectedPropertyValue",
")",
"{",
"return",
"i",
";",
"}",
"}",
"}",
"return",
"-",
"1",
";",
"}"
] | Returns the index of the first object inside the given array, where the property with the
given name has the given expected value.
@param {object[]} [aArray]
some array
@param {any} vExpectedPropertyValue
expected value of the property with given name
@param {string} [sPropertyName="name"]
some property name
@returns {number}
the index of the first object found or <code>-1</code> if no such object is found | [
"Returns",
"the",
"index",
"of",
"the",
"first",
"object",
"inside",
"the",
"given",
"array",
"where",
"the",
"property",
"with",
"the",
"given",
"name",
"has",
"the",
"given",
"expected",
"value",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/_ODataMetaModelUtils.js#L586-L598 |
|
3,965 | SAP/openui5 | src/sap.ui.core/src/sap/ui/model/odata/_ODataMetaModelUtils.js | function (aArray, vExpectedPropertyValue, sPropertyName) {
var iIndex = Utils.findIndex(aArray, vExpectedPropertyValue, sPropertyName);
return iIndex < 0 ? null : aArray[iIndex];
} | javascript | function (aArray, vExpectedPropertyValue, sPropertyName) {
var iIndex = Utils.findIndex(aArray, vExpectedPropertyValue, sPropertyName);
return iIndex < 0 ? null : aArray[iIndex];
} | [
"function",
"(",
"aArray",
",",
"vExpectedPropertyValue",
",",
"sPropertyName",
")",
"{",
"var",
"iIndex",
"=",
"Utils",
".",
"findIndex",
"(",
"aArray",
",",
"vExpectedPropertyValue",
",",
"sPropertyName",
")",
";",
"return",
"iIndex",
"<",
"0",
"?",
"null",
":",
"aArray",
"[",
"iIndex",
"]",
";",
"}"
] | Returns the object inside the given array, where the property with the given name has
the given expected value.
@param {object[]} aArray
some array
@param {any} vExpectedPropertyValue
expected value of the property with given name
@param {string} [sPropertyName="name"]
some property name
@returns {object}
the object found or <code>null</code> if no such object is found | [
"Returns",
"the",
"object",
"inside",
"the",
"given",
"array",
"where",
"the",
"property",
"with",
"the",
"given",
"name",
"has",
"the",
"given",
"expected",
"value",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/_ODataMetaModelUtils.js#L613-L617 |
|
3,966 | SAP/openui5 | src/sap.ui.core/src/sap/ui/model/odata/_ODataMetaModelUtils.js | function (oAnnotations, sQualifiedName, bInContainer) {
var o = bInContainer
? oAnnotations.EntityContainer
: oAnnotations.propertyAnnotations;
return o && o[sQualifiedName] || {};
} | javascript | function (oAnnotations, sQualifiedName, bInContainer) {
var o = bInContainer
? oAnnotations.EntityContainer
: oAnnotations.propertyAnnotations;
return o && o[sQualifiedName] || {};
} | [
"function",
"(",
"oAnnotations",
",",
"sQualifiedName",
",",
"bInContainer",
")",
"{",
"var",
"o",
"=",
"bInContainer",
"?",
"oAnnotations",
".",
"EntityContainer",
":",
"oAnnotations",
".",
"propertyAnnotations",
";",
"return",
"o",
"&&",
"o",
"[",
"sQualifiedName",
"]",
"||",
"{",
"}",
";",
"}"
] | Gets the map from child name to annotations for a parent with the given qualified
name which lives inside the entity container as indicated.
@param {sap.ui.model.odata.ODataAnnotations} oAnnotations
the OData annotations
@param {string} sQualifiedName
the parent's qualified name
@param {boolean} bInContainer
whether the parent lives inside the entity container (or beside it)
@returns {object}
the map from child name to annotations | [
"Gets",
"the",
"map",
"from",
"child",
"name",
"to",
"annotations",
"for",
"a",
"parent",
"with",
"the",
"given",
"qualified",
"name",
"which",
"lives",
"inside",
"the",
"entity",
"container",
"as",
"indicated",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/_ODataMetaModelUtils.js#L632-L637 |
|
3,967 | SAP/openui5 | src/sap.ui.core/src/sap/ui/model/odata/_ODataMetaModelUtils.js | function (oEntityContainer, sArrayName, sName, bAsPath) {
var k,
vResult = bAsPath ? undefined : null;
if (oEntityContainer) {
k = Utils.findIndex(oEntityContainer[sArrayName], sName);
if (k >= 0) {
vResult = bAsPath
? oEntityContainer.$path + "/" + sArrayName + "/" + k
: oEntityContainer[sArrayName][k];
}
}
return vResult;
} | javascript | function (oEntityContainer, sArrayName, sName, bAsPath) {
var k,
vResult = bAsPath ? undefined : null;
if (oEntityContainer) {
k = Utils.findIndex(oEntityContainer[sArrayName], sName);
if (k >= 0) {
vResult = bAsPath
? oEntityContainer.$path + "/" + sArrayName + "/" + k
: oEntityContainer[sArrayName][k];
}
}
return vResult;
} | [
"function",
"(",
"oEntityContainer",
",",
"sArrayName",
",",
"sName",
",",
"bAsPath",
")",
"{",
"var",
"k",
",",
"vResult",
"=",
"bAsPath",
"?",
"undefined",
":",
"null",
";",
"if",
"(",
"oEntityContainer",
")",
"{",
"k",
"=",
"Utils",
".",
"findIndex",
"(",
"oEntityContainer",
"[",
"sArrayName",
"]",
",",
"sName",
")",
";",
"if",
"(",
"k",
">=",
"0",
")",
"{",
"vResult",
"=",
"bAsPath",
"?",
"oEntityContainer",
".",
"$path",
"+",
"\"/\"",
"+",
"sArrayName",
"+",
"\"/\"",
"+",
"k",
":",
"oEntityContainer",
"[",
"sArrayName",
"]",
"[",
"k",
"]",
";",
"}",
"}",
"return",
"vResult",
";",
"}"
] | Returns the thing with the given simple name from the given entity container.
@param {object} oEntityContainer
the entity container
@param {string} sArrayName
name of array within entity container which will be searched
@param {string} sName
a simple name, e.g. "Foo"
@param {boolean} [bAsPath=false]
determines whether the thing itself is returned or just its path
@returns {object|string}
(the path to) the thing with the given qualified name; <code>undefined</code> (for a
path) or <code>null</code> (for an object) if no such thing is found | [
"Returns",
"the",
"thing",
"with",
"the",
"given",
"simple",
"name",
"from",
"the",
"given",
"entity",
"container",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/_ODataMetaModelUtils.js#L654-L668 |
|
3,968 | SAP/openui5 | src/sap.ui.core/src/sap/ui/model/odata/_ODataMetaModelUtils.js | function (vModel, sNamespace) {
var oSchema = null,
aSchemas = Array.isArray(vModel)
? vModel
: vModel.getObject("/dataServices/schema");
if (aSchemas) {
aSchemas.forEach(function (o) {
if (o.namespace === sNamespace) {
oSchema = o;
return false; // break
}
});
}
return oSchema;
} | javascript | function (vModel, sNamespace) {
var oSchema = null,
aSchemas = Array.isArray(vModel)
? vModel
: vModel.getObject("/dataServices/schema");
if (aSchemas) {
aSchemas.forEach(function (o) {
if (o.namespace === sNamespace) {
oSchema = o;
return false; // break
}
});
}
return oSchema;
} | [
"function",
"(",
"vModel",
",",
"sNamespace",
")",
"{",
"var",
"oSchema",
"=",
"null",
",",
"aSchemas",
"=",
"Array",
".",
"isArray",
"(",
"vModel",
")",
"?",
"vModel",
":",
"vModel",
".",
"getObject",
"(",
"\"/dataServices/schema\"",
")",
";",
"if",
"(",
"aSchemas",
")",
"{",
"aSchemas",
".",
"forEach",
"(",
"function",
"(",
"o",
")",
"{",
"if",
"(",
"o",
".",
"namespace",
"===",
"sNamespace",
")",
"{",
"oSchema",
"=",
"o",
";",
"return",
"false",
";",
"// break",
"}",
"}",
")",
";",
"}",
"return",
"oSchema",
";",
"}"
] | Returns the schema with the given namespace.
@param {sap.ui.model.Model|object[]} vModel
either a model or an array of schemas
@param {string} sNamespace
a namespace, e.g. "ACME"
@returns {object}
the schema with the given namespace; <code>null</code> if no such schema is found | [
"Returns",
"the",
"schema",
"with",
"the",
"given",
"namespace",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/_ODataMetaModelUtils.js#L724-L740 |
|
3,969 | SAP/openui5 | src/sap.ui.core/src/sap/ui/model/odata/_ODataMetaModelUtils.js | function (oAnnotations, oData, oMetaModel) {
var aSchemas = oData.dataServices.schema;
if (!aSchemas) {
return;
}
aSchemas.forEach(function (oSchema, i) {
var sSchemaVersion;
// remove datajs artefact for inline annotations in $metadata
delete oSchema.annotations;
Utils.liftSAPData(oSchema);
oSchema.$path = "/dataServices/schema/" + i;
sSchemaVersion = oSchema["sap:schema-version"];
if (sSchemaVersion) {
oSchema["Org.Odata.Core.V1.SchemaVersion"] = {
String : sSchemaVersion
};
}
jQuery.extend(oSchema, oAnnotations[oSchema.namespace]);
Utils.visitParents(oSchema, oAnnotations, "association",
function (oAssociation, mChildAnnotations) {
Utils.visitChildren(oAssociation.end, mChildAnnotations);
});
Utils.visitParents(oSchema, oAnnotations, "complexType",
function (oComplexType, mChildAnnotations) {
Utils.visitChildren(oComplexType.property, mChildAnnotations, "Property");
Utils.addSapSemantics(oComplexType);
});
// visit all entity types before visiting the entity sets to ensure that V2
// annotations are already lifted up and can be used for calculating entity
// set annotations which are based on V2 annotations on entity properties
Utils.visitParents(oSchema, oAnnotations, "entityType", Utils.visitEntityType);
Utils.visitParents(oSchema, oAnnotations, "entityContainer",
function (oEntityContainer, mChildAnnotations) {
Utils.visitChildren(oEntityContainer.associationSet, mChildAnnotations);
Utils.visitChildren(oEntityContainer.entitySet, mChildAnnotations,
"EntitySet", aSchemas);
Utils.visitChildren(oEntityContainer.functionImport, mChildAnnotations,
"", null, Utils.visitParameters.bind(this,
oAnnotations, oSchema, oEntityContainer));
});
});
Utils.addUnitAnnotations(aSchemas, oMetaModel);
} | javascript | function (oAnnotations, oData, oMetaModel) {
var aSchemas = oData.dataServices.schema;
if (!aSchemas) {
return;
}
aSchemas.forEach(function (oSchema, i) {
var sSchemaVersion;
// remove datajs artefact for inline annotations in $metadata
delete oSchema.annotations;
Utils.liftSAPData(oSchema);
oSchema.$path = "/dataServices/schema/" + i;
sSchemaVersion = oSchema["sap:schema-version"];
if (sSchemaVersion) {
oSchema["Org.Odata.Core.V1.SchemaVersion"] = {
String : sSchemaVersion
};
}
jQuery.extend(oSchema, oAnnotations[oSchema.namespace]);
Utils.visitParents(oSchema, oAnnotations, "association",
function (oAssociation, mChildAnnotations) {
Utils.visitChildren(oAssociation.end, mChildAnnotations);
});
Utils.visitParents(oSchema, oAnnotations, "complexType",
function (oComplexType, mChildAnnotations) {
Utils.visitChildren(oComplexType.property, mChildAnnotations, "Property");
Utils.addSapSemantics(oComplexType);
});
// visit all entity types before visiting the entity sets to ensure that V2
// annotations are already lifted up and can be used for calculating entity
// set annotations which are based on V2 annotations on entity properties
Utils.visitParents(oSchema, oAnnotations, "entityType", Utils.visitEntityType);
Utils.visitParents(oSchema, oAnnotations, "entityContainer",
function (oEntityContainer, mChildAnnotations) {
Utils.visitChildren(oEntityContainer.associationSet, mChildAnnotations);
Utils.visitChildren(oEntityContainer.entitySet, mChildAnnotations,
"EntitySet", aSchemas);
Utils.visitChildren(oEntityContainer.functionImport, mChildAnnotations,
"", null, Utils.visitParameters.bind(this,
oAnnotations, oSchema, oEntityContainer));
});
});
Utils.addUnitAnnotations(aSchemas, oMetaModel);
} | [
"function",
"(",
"oAnnotations",
",",
"oData",
",",
"oMetaModel",
")",
"{",
"var",
"aSchemas",
"=",
"oData",
".",
"dataServices",
".",
"schema",
";",
"if",
"(",
"!",
"aSchemas",
")",
"{",
"return",
";",
"}",
"aSchemas",
".",
"forEach",
"(",
"function",
"(",
"oSchema",
",",
"i",
")",
"{",
"var",
"sSchemaVersion",
";",
"// remove datajs artefact for inline annotations in $metadata",
"delete",
"oSchema",
".",
"annotations",
";",
"Utils",
".",
"liftSAPData",
"(",
"oSchema",
")",
";",
"oSchema",
".",
"$path",
"=",
"\"/dataServices/schema/\"",
"+",
"i",
";",
"sSchemaVersion",
"=",
"oSchema",
"[",
"\"sap:schema-version\"",
"]",
";",
"if",
"(",
"sSchemaVersion",
")",
"{",
"oSchema",
"[",
"\"Org.Odata.Core.V1.SchemaVersion\"",
"]",
"=",
"{",
"String",
":",
"sSchemaVersion",
"}",
";",
"}",
"jQuery",
".",
"extend",
"(",
"oSchema",
",",
"oAnnotations",
"[",
"oSchema",
".",
"namespace",
"]",
")",
";",
"Utils",
".",
"visitParents",
"(",
"oSchema",
",",
"oAnnotations",
",",
"\"association\"",
",",
"function",
"(",
"oAssociation",
",",
"mChildAnnotations",
")",
"{",
"Utils",
".",
"visitChildren",
"(",
"oAssociation",
".",
"end",
",",
"mChildAnnotations",
")",
";",
"}",
")",
";",
"Utils",
".",
"visitParents",
"(",
"oSchema",
",",
"oAnnotations",
",",
"\"complexType\"",
",",
"function",
"(",
"oComplexType",
",",
"mChildAnnotations",
")",
"{",
"Utils",
".",
"visitChildren",
"(",
"oComplexType",
".",
"property",
",",
"mChildAnnotations",
",",
"\"Property\"",
")",
";",
"Utils",
".",
"addSapSemantics",
"(",
"oComplexType",
")",
";",
"}",
")",
";",
"// visit all entity types before visiting the entity sets to ensure that V2",
"// annotations are already lifted up and can be used for calculating entity",
"// set annotations which are based on V2 annotations on entity properties",
"Utils",
".",
"visitParents",
"(",
"oSchema",
",",
"oAnnotations",
",",
"\"entityType\"",
",",
"Utils",
".",
"visitEntityType",
")",
";",
"Utils",
".",
"visitParents",
"(",
"oSchema",
",",
"oAnnotations",
",",
"\"entityContainer\"",
",",
"function",
"(",
"oEntityContainer",
",",
"mChildAnnotations",
")",
"{",
"Utils",
".",
"visitChildren",
"(",
"oEntityContainer",
".",
"associationSet",
",",
"mChildAnnotations",
")",
";",
"Utils",
".",
"visitChildren",
"(",
"oEntityContainer",
".",
"entitySet",
",",
"mChildAnnotations",
",",
"\"EntitySet\"",
",",
"aSchemas",
")",
";",
"Utils",
".",
"visitChildren",
"(",
"oEntityContainer",
".",
"functionImport",
",",
"mChildAnnotations",
",",
"\"\"",
",",
"null",
",",
"Utils",
".",
"visitParameters",
".",
"bind",
"(",
"this",
",",
"oAnnotations",
",",
"oSchema",
",",
"oEntityContainer",
")",
")",
";",
"}",
")",
";",
"}",
")",
";",
"Utils",
".",
"addUnitAnnotations",
"(",
"aSchemas",
",",
"oMetaModel",
")",
";",
"}"
] | Merges the given annotation data into the given metadata and lifts SAPData extensions.
@param {object} oAnnotations
annotations "JSON"
@param {object} oData
metadata "JSON"
@param {sap.ui.model.odata.ODataMetaModel} oMetaModel
the metamodel | [
"Merges",
"the",
"given",
"annotation",
"data",
"into",
"the",
"given",
"metadata",
"and",
"lifts",
"SAPData",
"extensions",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/_ODataMetaModelUtils.js#L954-L1003 |
|
3,970 | SAP/openui5 | src/sap.ui.core/src/sap/ui/model/odata/_ODataMetaModelUtils.js | function (aChildren, mChildAnnotations, sTypeClass, aSchemas, fnCallback,
iStartIndex) {
if (!aChildren) {
return;
}
if (iStartIndex) {
aChildren = aChildren.slice(iStartIndex);
}
aChildren.forEach(function (oChild) {
// lift SAP data for easy access to SAP Annotations for OData V 2.0
Utils.liftSAPData(oChild, sTypeClass);
});
aChildren.forEach(function (oChild) {
var oEntityType;
if (sTypeClass === "EntitySet") {
// calculated entity set annotations need to be added before V4
// annotations are merged
oEntityType = Utils.getObject(aSchemas, "entityType", oChild.entityType);
Utils.calculateEntitySetAnnotations(oChild, oEntityType);
}
if (fnCallback) {
fnCallback(oChild);
}
// merge V4 annotations after child annotations are processed
jQuery.extend(oChild, mChildAnnotations[oChild.name || oChild.role]);
});
} | javascript | function (aChildren, mChildAnnotations, sTypeClass, aSchemas, fnCallback,
iStartIndex) {
if (!aChildren) {
return;
}
if (iStartIndex) {
aChildren = aChildren.slice(iStartIndex);
}
aChildren.forEach(function (oChild) {
// lift SAP data for easy access to SAP Annotations for OData V 2.0
Utils.liftSAPData(oChild, sTypeClass);
});
aChildren.forEach(function (oChild) {
var oEntityType;
if (sTypeClass === "EntitySet") {
// calculated entity set annotations need to be added before V4
// annotations are merged
oEntityType = Utils.getObject(aSchemas, "entityType", oChild.entityType);
Utils.calculateEntitySetAnnotations(oChild, oEntityType);
}
if (fnCallback) {
fnCallback(oChild);
}
// merge V4 annotations after child annotations are processed
jQuery.extend(oChild, mChildAnnotations[oChild.name || oChild.role]);
});
} | [
"function",
"(",
"aChildren",
",",
"mChildAnnotations",
",",
"sTypeClass",
",",
"aSchemas",
",",
"fnCallback",
",",
"iStartIndex",
")",
"{",
"if",
"(",
"!",
"aChildren",
")",
"{",
"return",
";",
"}",
"if",
"(",
"iStartIndex",
")",
"{",
"aChildren",
"=",
"aChildren",
".",
"slice",
"(",
"iStartIndex",
")",
";",
"}",
"aChildren",
".",
"forEach",
"(",
"function",
"(",
"oChild",
")",
"{",
"// lift SAP data for easy access to SAP Annotations for OData V 2.0",
"Utils",
".",
"liftSAPData",
"(",
"oChild",
",",
"sTypeClass",
")",
";",
"}",
")",
";",
"aChildren",
".",
"forEach",
"(",
"function",
"(",
"oChild",
")",
"{",
"var",
"oEntityType",
";",
"if",
"(",
"sTypeClass",
"===",
"\"EntitySet\"",
")",
"{",
"// calculated entity set annotations need to be added before V4",
"// annotations are merged",
"oEntityType",
"=",
"Utils",
".",
"getObject",
"(",
"aSchemas",
",",
"\"entityType\"",
",",
"oChild",
".",
"entityType",
")",
";",
"Utils",
".",
"calculateEntitySetAnnotations",
"(",
"oChild",
",",
"oEntityType",
")",
";",
"}",
"if",
"(",
"fnCallback",
")",
"{",
"fnCallback",
"(",
"oChild",
")",
";",
"}",
"// merge V4 annotations after child annotations are processed",
"jQuery",
".",
"extend",
"(",
"oChild",
",",
"mChildAnnotations",
"[",
"oChild",
".",
"name",
"||",
"oChild",
".",
"role",
"]",
")",
";",
"}",
")",
";",
"}"
] | Visits all children inside the given array, lifts "SAPData" extensions and
inlines OData V4 annotations for each child.
@param {object[]} aChildren
any array of children
@param {object} mChildAnnotations
map from child name (or role) to annotations
@param {string} [sTypeClass]
the type class of the given children; supported type classes are "Property"
and "EntitySet"
@param {object[]} [aSchemas]
Array of OData data service schemas (needed only for type class "EntitySet")
@param {function} [fnCallback]
optional callback for each child
@param {number} [iStartIndex=0]
optional start index in the given array | [
"Visits",
"all",
"children",
"inside",
"the",
"given",
"array",
"lifts",
"SAPData",
"extensions",
"and",
"inlines",
"OData",
"V4",
"annotations",
"for",
"each",
"child",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/_ODataMetaModelUtils.js#L1023-L1051 |
|
3,971 | SAP/openui5 | src/sap.ui.core/src/sap/ui/model/odata/_ODataMetaModelUtils.js | function (oAnnotations, oSchema, oEntityContainer, oFunctionImport) {
var mAnnotations;
if (!oFunctionImport.parameter) {
return;
}
mAnnotations = Utils.getChildAnnotations(oAnnotations,
oSchema.namespace + "." + oEntityContainer.name, true);
oFunctionImport.parameter.forEach(
function (oParam) {
Utils.liftSAPData(oParam);
jQuery.extend(oParam,
mAnnotations[oFunctionImport.name + "/" + oParam.name]);
}
);
} | javascript | function (oAnnotations, oSchema, oEntityContainer, oFunctionImport) {
var mAnnotations;
if (!oFunctionImport.parameter) {
return;
}
mAnnotations = Utils.getChildAnnotations(oAnnotations,
oSchema.namespace + "." + oEntityContainer.name, true);
oFunctionImport.parameter.forEach(
function (oParam) {
Utils.liftSAPData(oParam);
jQuery.extend(oParam,
mAnnotations[oFunctionImport.name + "/" + oParam.name]);
}
);
} | [
"function",
"(",
"oAnnotations",
",",
"oSchema",
",",
"oEntityContainer",
",",
"oFunctionImport",
")",
"{",
"var",
"mAnnotations",
";",
"if",
"(",
"!",
"oFunctionImport",
".",
"parameter",
")",
"{",
"return",
";",
"}",
"mAnnotations",
"=",
"Utils",
".",
"getChildAnnotations",
"(",
"oAnnotations",
",",
"oSchema",
".",
"namespace",
"+",
"\".\"",
"+",
"oEntityContainer",
".",
"name",
",",
"true",
")",
";",
"oFunctionImport",
".",
"parameter",
".",
"forEach",
"(",
"function",
"(",
"oParam",
")",
"{",
"Utils",
".",
"liftSAPData",
"(",
"oParam",
")",
";",
"jQuery",
".",
"extend",
"(",
"oParam",
",",
"mAnnotations",
"[",
"oFunctionImport",
".",
"name",
"+",
"\"/\"",
"+",
"oParam",
".",
"name",
"]",
")",
";",
"}",
")",
";",
"}"
] | Visits all parameters of the given function import.
@param {object} oAnnotations
annotations "JSON"
@param {object} oSchema
OData data service schema
@param {object} oEntityContainer
the entity container
@param {object} oFunctionImport
a function import's V2 metadata object | [
"Visits",
"all",
"parameters",
"of",
"the",
"given",
"function",
"import",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/_ODataMetaModelUtils.js#L1079-L1094 |
|
3,972 | SAP/openui5 | src/sap.m/src/sap/m/TimePickerSlider.js | findIndexInArray | function findIndexInArray(aArray, fnPredicate) {
if (aArray == null) {
throw new TypeError('findIndex called with null or undefined array');
}
if (typeof fnPredicate !== 'function') {
throw new TypeError('predicate must be a function');
}
var iLength = aArray.length;
var fnThisArg = arguments[1];
var vValue;
for (var iIndex = 0; iIndex < iLength; iIndex++) {
vValue = aArray[iIndex];
if (fnPredicate.call(fnThisArg, vValue, iIndex, aArray)) {
return iIndex;
}
}
return -1;
} | javascript | function findIndexInArray(aArray, fnPredicate) {
if (aArray == null) {
throw new TypeError('findIndex called with null or undefined array');
}
if (typeof fnPredicate !== 'function') {
throw new TypeError('predicate must be a function');
}
var iLength = aArray.length;
var fnThisArg = arguments[1];
var vValue;
for (var iIndex = 0; iIndex < iLength; iIndex++) {
vValue = aArray[iIndex];
if (fnPredicate.call(fnThisArg, vValue, iIndex, aArray)) {
return iIndex;
}
}
return -1;
} | [
"function",
"findIndexInArray",
"(",
"aArray",
",",
"fnPredicate",
")",
"{",
"if",
"(",
"aArray",
"==",
"null",
")",
"{",
"throw",
"new",
"TypeError",
"(",
"'findIndex called with null or undefined array'",
")",
";",
"}",
"if",
"(",
"typeof",
"fnPredicate",
"!==",
"'function'",
")",
"{",
"throw",
"new",
"TypeError",
"(",
"'predicate must be a function'",
")",
";",
"}",
"var",
"iLength",
"=",
"aArray",
".",
"length",
";",
"var",
"fnThisArg",
"=",
"arguments",
"[",
"1",
"]",
";",
"var",
"vValue",
";",
"for",
"(",
"var",
"iIndex",
"=",
"0",
";",
"iIndex",
"<",
"iLength",
";",
"iIndex",
"++",
")",
"{",
"vValue",
"=",
"aArray",
"[",
"iIndex",
"]",
";",
"if",
"(",
"fnPredicate",
".",
"call",
"(",
"fnThisArg",
",",
"vValue",
",",
"iIndex",
",",
"aArray",
")",
")",
"{",
"return",
"iIndex",
";",
"}",
"}",
"return",
"-",
"1",
";",
"}"
] | Finds the index of an element, satisfying provided predicate.
@param {array} aArray The array to be predicted
@param {function} fnPredicate Testing function
@returns {number} The index in the array, if an element in the array satisfies the provided testing function
@private | [
"Finds",
"the",
"index",
"of",
"an",
"element",
"satisfying",
"provided",
"predicate",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.m/src/sap/m/TimePickerSlider.js#L1210-L1229 |
3,973 | SAP/openui5 | src/sap.m/src/sap/m/TimePickerSlider.js | function (oEvent) {
var iPageY = oEvent.touches && oEvent.touches.length ? oEvent.touches[0].pageY : oEvent.pageY;
this._bIsDrag = false;
if (!this.getIsExpanded()) {
return;
}
this._stopAnimation();
this._startDrag(iPageY);
oEvent.preventDefault();
this._mousedown = true;
} | javascript | function (oEvent) {
var iPageY = oEvent.touches && oEvent.touches.length ? oEvent.touches[0].pageY : oEvent.pageY;
this._bIsDrag = false;
if (!this.getIsExpanded()) {
return;
}
this._stopAnimation();
this._startDrag(iPageY);
oEvent.preventDefault();
this._mousedown = true;
} | [
"function",
"(",
"oEvent",
")",
"{",
"var",
"iPageY",
"=",
"oEvent",
".",
"touches",
"&&",
"oEvent",
".",
"touches",
".",
"length",
"?",
"oEvent",
".",
"touches",
"[",
"0",
"]",
".",
"pageY",
":",
"oEvent",
".",
"pageY",
";",
"this",
".",
"_bIsDrag",
"=",
"false",
";",
"if",
"(",
"!",
"this",
".",
"getIsExpanded",
"(",
")",
")",
"{",
"return",
";",
"}",
"this",
".",
"_stopAnimation",
"(",
")",
";",
"this",
".",
"_startDrag",
"(",
"iPageY",
")",
";",
"oEvent",
".",
"preventDefault",
"(",
")",
";",
"this",
".",
"_mousedown",
"=",
"true",
";",
"}"
] | Default onTouchStart handler.
@param {jQuery.Event} oEvent Event object | [
"Default",
"onTouchStart",
"handler",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.m/src/sap/m/TimePickerSlider.js#L1235-L1248 |
|
3,974 | SAP/openui5 | src/sap.m/src/sap/m/TimePickerSlider.js | function (oEvent) {
var iPageY = oEvent.touches && oEvent.touches.length ? oEvent.touches[0].pageY : oEvent.pageY;
if (!this._mousedown || !this.getIsExpanded()) {
return;
}
//galaxy s5 android 5.0 fires touchmove every time - so see if it's far enough to call it a drag
if (!this._bIsDrag && this._dragSession && this._dragSession.positions.length) {
//there is a touch at least 5px away vertically from the initial touch
var bFarEnough = this._dragSession.positions.some(function(pos) {
return Math.abs(pos.pageY - iPageY) > 5;
});
if (bFarEnough) {
this._bIsDrag = true;
}
}
this._doDrag(iPageY, oEvent.timeStamp);
this._mousedown = true;
} | javascript | function (oEvent) {
var iPageY = oEvent.touches && oEvent.touches.length ? oEvent.touches[0].pageY : oEvent.pageY;
if (!this._mousedown || !this.getIsExpanded()) {
return;
}
//galaxy s5 android 5.0 fires touchmove every time - so see if it's far enough to call it a drag
if (!this._bIsDrag && this._dragSession && this._dragSession.positions.length) {
//there is a touch at least 5px away vertically from the initial touch
var bFarEnough = this._dragSession.positions.some(function(pos) {
return Math.abs(pos.pageY - iPageY) > 5;
});
if (bFarEnough) {
this._bIsDrag = true;
}
}
this._doDrag(iPageY, oEvent.timeStamp);
this._mousedown = true;
} | [
"function",
"(",
"oEvent",
")",
"{",
"var",
"iPageY",
"=",
"oEvent",
".",
"touches",
"&&",
"oEvent",
".",
"touches",
".",
"length",
"?",
"oEvent",
".",
"touches",
"[",
"0",
"]",
".",
"pageY",
":",
"oEvent",
".",
"pageY",
";",
"if",
"(",
"!",
"this",
".",
"_mousedown",
"||",
"!",
"this",
".",
"getIsExpanded",
"(",
")",
")",
"{",
"return",
";",
"}",
"//galaxy s5 android 5.0 fires touchmove every time - so see if it's far enough to call it a drag",
"if",
"(",
"!",
"this",
".",
"_bIsDrag",
"&&",
"this",
".",
"_dragSession",
"&&",
"this",
".",
"_dragSession",
".",
"positions",
".",
"length",
")",
"{",
"//there is a touch at least 5px away vertically from the initial touch",
"var",
"bFarEnough",
"=",
"this",
".",
"_dragSession",
".",
"positions",
".",
"some",
"(",
"function",
"(",
"pos",
")",
"{",
"return",
"Math",
".",
"abs",
"(",
"pos",
".",
"pageY",
"-",
"iPageY",
")",
">",
"5",
";",
"}",
")",
";",
"if",
"(",
"bFarEnough",
")",
"{",
"this",
".",
"_bIsDrag",
"=",
"true",
";",
"}",
"}",
"this",
".",
"_doDrag",
"(",
"iPageY",
",",
"oEvent",
".",
"timeStamp",
")",
";",
"this",
".",
"_mousedown",
"=",
"true",
";",
"}"
] | Default onTouchMove handler.
@param {jQuery.Event} oEvent Event object | [
"Default",
"onTouchMove",
"handler",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.m/src/sap/m/TimePickerSlider.js#L1254-L1276 |
|
3,975 | SAP/openui5 | src/sap.m/src/sap/m/TimePickerSlider.js | function (oEvent) {
var iPageY = oEvent.changedTouches && oEvent.changedTouches.length ? oEvent.changedTouches[0].pageY : oEvent.pageY;
if (this._bIsDrag === false) {
this.fireTap(oEvent);
this._dragSession = null;
}
this._bIsDrag = true;
if (!this.getIsExpanded()) {
this._dragSession = null;
return;
}
this._endDrag(iPageY, oEvent.timeStamp);
this._mousedown = false;
} | javascript | function (oEvent) {
var iPageY = oEvent.changedTouches && oEvent.changedTouches.length ? oEvent.changedTouches[0].pageY : oEvent.pageY;
if (this._bIsDrag === false) {
this.fireTap(oEvent);
this._dragSession = null;
}
this._bIsDrag = true;
if (!this.getIsExpanded()) {
this._dragSession = null;
return;
}
this._endDrag(iPageY, oEvent.timeStamp);
this._mousedown = false;
} | [
"function",
"(",
"oEvent",
")",
"{",
"var",
"iPageY",
"=",
"oEvent",
".",
"changedTouches",
"&&",
"oEvent",
".",
"changedTouches",
".",
"length",
"?",
"oEvent",
".",
"changedTouches",
"[",
"0",
"]",
".",
"pageY",
":",
"oEvent",
".",
"pageY",
";",
"if",
"(",
"this",
".",
"_bIsDrag",
"===",
"false",
")",
"{",
"this",
".",
"fireTap",
"(",
"oEvent",
")",
";",
"this",
".",
"_dragSession",
"=",
"null",
";",
"}",
"this",
".",
"_bIsDrag",
"=",
"true",
";",
"if",
"(",
"!",
"this",
".",
"getIsExpanded",
"(",
")",
")",
"{",
"this",
".",
"_dragSession",
"=",
"null",
";",
"return",
";",
"}",
"this",
".",
"_endDrag",
"(",
"iPageY",
",",
"oEvent",
".",
"timeStamp",
")",
";",
"this",
".",
"_mousedown",
"=",
"false",
";",
"}"
] | Default onTouchEnd handler.
@param {jQuery.Event} oEvent Event object | [
"Default",
"onTouchEnd",
"handler",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.m/src/sap/m/TimePickerSlider.js#L1282-L1300 |
|
3,976 | SAP/openui5 | src/sap.ui.core/src/sap/ui/events/PseudoEvents.js | checkModifierKeys | function checkModifierKeys(oEvent, bCtrlKey, bAltKey, bShiftKey) {
return oEvent.shiftKey == bShiftKey && oEvent.altKey == bAltKey && getCtrlKey(oEvent) == bCtrlKey;
} | javascript | function checkModifierKeys(oEvent, bCtrlKey, bAltKey, bShiftKey) {
return oEvent.shiftKey == bShiftKey && oEvent.altKey == bAltKey && getCtrlKey(oEvent) == bCtrlKey;
} | [
"function",
"checkModifierKeys",
"(",
"oEvent",
",",
"bCtrlKey",
",",
"bAltKey",
",",
"bShiftKey",
")",
"{",
"return",
"oEvent",
".",
"shiftKey",
"==",
"bShiftKey",
"&&",
"oEvent",
".",
"altKey",
"==",
"bAltKey",
"&&",
"getCtrlKey",
"(",
"oEvent",
")",
"==",
"bCtrlKey",
";",
"}"
] | Convenience method to check an event for a certain combination of modifier keys
@private | [
"Convenience",
"method",
"to",
"check",
"an",
"event",
"for",
"a",
"certain",
"combination",
"of",
"modifier",
"keys"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/events/PseudoEvents.js#L20-L22 |
3,977 | SAP/openui5 | src/sap.ui.demokit/src/sap/ui/demokit/explored/view/entity.controller.js | function (sType) {
if (!sType) {
return null;
} else {
// remove core prefix
sType = sType.replace("sap.ui.core.", "");
// only take text after last dot
var index = sType.lastIndexOf(".");
return (index !== -1) ? sType.substr(index + 1) : sType;
}
} | javascript | function (sType) {
if (!sType) {
return null;
} else {
// remove core prefix
sType = sType.replace("sap.ui.core.", "");
// only take text after last dot
var index = sType.lastIndexOf(".");
return (index !== -1) ? sType.substr(index + 1) : sType;
}
} | [
"function",
"(",
"sType",
")",
"{",
"if",
"(",
"!",
"sType",
")",
"{",
"return",
"null",
";",
"}",
"else",
"{",
"// remove core prefix",
"sType",
"=",
"sType",
".",
"replace",
"(",
"\"sap.ui.core.\"",
",",
"\"\"",
")",
";",
"// only take text after last dot",
"var",
"index",
"=",
"sType",
".",
"lastIndexOf",
"(",
"\".\"",
")",
";",
"return",
"(",
"index",
"!==",
"-",
"1",
")",
"?",
"sType",
".",
"substr",
"(",
"index",
"+",
"1",
")",
":",
"sType",
";",
"}",
"}"
] | Converts the type to a friendly readable text | [
"Converts",
"the",
"type",
"to",
"a",
"friendly",
"readable",
"text"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.demokit/src/sap/ui/demokit/explored/view/entity.controller.js#L476-L486 |
|
3,978 | SAP/openui5 | src/sap.ui.demokit/src/sap/ui/demokit/explored/view/entity.controller.js | function (controlName) {
var oLibComponentModel = data.libComponentInfos;
jQuery.sap.require("sap.ui.core.util.LibraryInfo");
var LibraryInfo = sap.ui.require("sap/ui/core/util/LibraryInfo");
var oLibInfo = new LibraryInfo();
var sActualControlComponent = oLibInfo._getActualComponent(oLibComponentModel, controlName);
return sActualControlComponent;
} | javascript | function (controlName) {
var oLibComponentModel = data.libComponentInfos;
jQuery.sap.require("sap.ui.core.util.LibraryInfo");
var LibraryInfo = sap.ui.require("sap/ui/core/util/LibraryInfo");
var oLibInfo = new LibraryInfo();
var sActualControlComponent = oLibInfo._getActualComponent(oLibComponentModel, controlName);
return sActualControlComponent;
} | [
"function",
"(",
"controlName",
")",
"{",
"var",
"oLibComponentModel",
"=",
"data",
".",
"libComponentInfos",
";",
"jQuery",
".",
"sap",
".",
"require",
"(",
"\"sap.ui.core.util.LibraryInfo\"",
")",
";",
"var",
"LibraryInfo",
"=",
"sap",
".",
"ui",
".",
"require",
"(",
"\"sap/ui/core/util/LibraryInfo\"",
")",
";",
"var",
"oLibInfo",
"=",
"new",
"LibraryInfo",
"(",
")",
";",
"var",
"sActualControlComponent",
"=",
"oLibInfo",
".",
"_getActualComponent",
"(",
"oLibComponentModel",
",",
"controlName",
")",
";",
"return",
"sActualControlComponent",
";",
"}"
] | the actual component for the control
@param {string} controlName
@return {string} sActualControlComponent | [
"the",
"actual",
"component",
"for",
"the",
"control"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.demokit/src/sap/ui/demokit/explored/view/entity.controller.js#L542-L549 |
|
3,979 | SAP/openui5 | src/sap.ui.core/src/sap/ui/base/ManagedObjectMetadata.js | loadOwnDesignTime | function loadOwnDesignTime(oMetadata) {
if (isPlainObject(oMetadata._oDesignTime) || !oMetadata._oDesignTime) {
return Promise.resolve(oMetadata._oDesignTime || {});
}
return new Promise(function(fnResolve) {
var sModule;
if (typeof oMetadata._oDesignTime === "string") {
//oMetadata._oDesignTime points to resource path to another file, for example: "sap/ui/core/designtime/<control>.designtime"
sModule = oMetadata._oDesignTime;
} else {
sModule = oMetadata.getName().replace(/\./g, "/") + ".designtime";
}
preloadDesigntimeLibrary(oMetadata).then(function(oLib) {
sap.ui.require([sModule], function(mDesignTime) {
mDesignTime.designtimeModule = sModule;
oMetadata._oDesignTime = mDesignTime;
mDesignTime._oLib = oLib;
fnResolve(mDesignTime);
});
});
});
} | javascript | function loadOwnDesignTime(oMetadata) {
if (isPlainObject(oMetadata._oDesignTime) || !oMetadata._oDesignTime) {
return Promise.resolve(oMetadata._oDesignTime || {});
}
return new Promise(function(fnResolve) {
var sModule;
if (typeof oMetadata._oDesignTime === "string") {
//oMetadata._oDesignTime points to resource path to another file, for example: "sap/ui/core/designtime/<control>.designtime"
sModule = oMetadata._oDesignTime;
} else {
sModule = oMetadata.getName().replace(/\./g, "/") + ".designtime";
}
preloadDesigntimeLibrary(oMetadata).then(function(oLib) {
sap.ui.require([sModule], function(mDesignTime) {
mDesignTime.designtimeModule = sModule;
oMetadata._oDesignTime = mDesignTime;
mDesignTime._oLib = oLib;
fnResolve(mDesignTime);
});
});
});
} | [
"function",
"loadOwnDesignTime",
"(",
"oMetadata",
")",
"{",
"if",
"(",
"isPlainObject",
"(",
"oMetadata",
".",
"_oDesignTime",
")",
"||",
"!",
"oMetadata",
".",
"_oDesignTime",
")",
"{",
"return",
"Promise",
".",
"resolve",
"(",
"oMetadata",
".",
"_oDesignTime",
"||",
"{",
"}",
")",
";",
"}",
"return",
"new",
"Promise",
"(",
"function",
"(",
"fnResolve",
")",
"{",
"var",
"sModule",
";",
"if",
"(",
"typeof",
"oMetadata",
".",
"_oDesignTime",
"===",
"\"string\"",
")",
"{",
"//oMetadata._oDesignTime points to resource path to another file, for example: \"sap/ui/core/designtime/<control>.designtime\"",
"sModule",
"=",
"oMetadata",
".",
"_oDesignTime",
";",
"}",
"else",
"{",
"sModule",
"=",
"oMetadata",
".",
"getName",
"(",
")",
".",
"replace",
"(",
"/",
"\\.",
"/",
"g",
",",
"\"/\"",
")",
"+",
"\".designtime\"",
";",
"}",
"preloadDesigntimeLibrary",
"(",
"oMetadata",
")",
".",
"then",
"(",
"function",
"(",
"oLib",
")",
"{",
"sap",
".",
"ui",
".",
"require",
"(",
"[",
"sModule",
"]",
",",
"function",
"(",
"mDesignTime",
")",
"{",
"mDesignTime",
".",
"designtimeModule",
"=",
"sModule",
";",
"oMetadata",
".",
"_oDesignTime",
"=",
"mDesignTime",
";",
"mDesignTime",
".",
"_oLib",
"=",
"oLib",
";",
"fnResolve",
"(",
"mDesignTime",
")",
";",
"}",
")",
";",
"}",
")",
";",
"}",
")",
";",
"}"
] | Returns a promise that resolves with the own, unmerged designtime data.
If the class is marked as having no designtime data, the promise will resolve with null.
@private | [
"Returns",
"a",
"promise",
"that",
"resolves",
"with",
"the",
"own",
"unmerged",
"designtime",
"data",
".",
"If",
"the",
"class",
"is",
"marked",
"as",
"having",
"no",
"designtime",
"data",
"the",
"promise",
"will",
"resolve",
"with",
"null",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/base/ManagedObjectMetadata.js#L1804-L1826 |
3,980 | SAP/openui5 | src/sap.ui.core/src/sap/ui/base/ManagedObjectMetadata.js | getScopeBasedDesignTime | function getScopeBasedDesignTime(mMetadata, sScopeKey) {
var mResult = mMetadata;
if ("default" in mMetadata) {
mResult = merge(
{},
mMetadata.default,
sScopeKey !== "default" && mMetadata[sScopeKey] || null
);
}
return mResult;
} | javascript | function getScopeBasedDesignTime(mMetadata, sScopeKey) {
var mResult = mMetadata;
if ("default" in mMetadata) {
mResult = merge(
{},
mMetadata.default,
sScopeKey !== "default" && mMetadata[sScopeKey] || null
);
}
return mResult;
} | [
"function",
"getScopeBasedDesignTime",
"(",
"mMetadata",
",",
"sScopeKey",
")",
"{",
"var",
"mResult",
"=",
"mMetadata",
";",
"if",
"(",
"\"default\"",
"in",
"mMetadata",
")",
"{",
"mResult",
"=",
"merge",
"(",
"{",
"}",
",",
"mMetadata",
".",
"default",
",",
"sScopeKey",
"!==",
"\"default\"",
"&&",
"mMetadata",
"[",
"sScopeKey",
"]",
"||",
"null",
")",
";",
"}",
"return",
"mResult",
";",
"}"
] | Extracts metadata from metadata map by scope key
@param {object} mMetadata metadata map received from loader
@param {string} sScopeKey scope name to be extracted
@private | [
"Extracts",
"metadata",
"from",
"metadata",
"map",
"by",
"scope",
"key"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/base/ManagedObjectMetadata.js#L1873-L1885 |
3,981 | SAP/openui5 | src/sap.m/src/sap/m/FormattedText.js | openExternalLink | function openExternalLink (oEvent) {
var newWindow = window.open();
newWindow.opener = null;
newWindow.location = oEvent.currentTarget.href;
oEvent.preventDefault();
} | javascript | function openExternalLink (oEvent) {
var newWindow = window.open();
newWindow.opener = null;
newWindow.location = oEvent.currentTarget.href;
oEvent.preventDefault();
} | [
"function",
"openExternalLink",
"(",
"oEvent",
")",
"{",
"var",
"newWindow",
"=",
"window",
".",
"open",
"(",
")",
";",
"newWindow",
".",
"opener",
"=",
"null",
";",
"newWindow",
".",
"location",
"=",
"oEvent",
".",
"currentTarget",
".",
"href",
";",
"oEvent",
".",
"preventDefault",
"(",
")",
";",
"}"
] | prohibit a new window from accessing window.opener.location | [
"prohibit",
"a",
"new",
"window",
"from",
"accessing",
"window",
".",
"opener",
".",
"location"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.m/src/sap/m/FormattedText.js#L282-L287 |
3,982 | SAP/openui5 | src/sap.ui.table/src/sap/ui/table/Table.js | setMinColWidths | function setMinColWidths(oTable) {
var oTableRef = oTable.getDomRef();
var iAbsoluteMinWidth = TableUtils.Column.getMinColumnWidth();
var aNotFixedVariableColumns = [];
var bColumnHeaderVisible = oTable.getColumnHeaderVisible();
function calcNewWidth(iDomWidth, iMinWidth) {
if (iDomWidth <= iMinWidth) {
// tolerance of -5px to make the resizing smooother
return Math.max(iDomWidth, iMinWidth - 5, iAbsoluteMinWidth) + "px";
}
return -1;
}
function isFixNeeded(col) {
var minWidth = Math.max(col._minWidth || 0, iAbsoluteMinWidth, col.getMinWidth());
var colWidth = col.getWidth();
var aColHeaders;
var colHeader;
var domWidth;
// if a column has variable width, check if its current width of the
// first corresponding <th> element in less than minimum and store it;
// do not change freezed columns
if (TableUtils.isVariableWidth(colWidth) && !TableUtils.isFixedColumn(oTable, col.getIndex())) {
aColHeaders = oTableRef.querySelectorAll('th[data-sap-ui-colid="' + col.getId() + '"]');
colHeader = aColHeaders[bColumnHeaderVisible ? 0 : 1]; // if column headers have display:none, use data table
domWidth = colHeader ? colHeader.offsetWidth : null;
if (domWidth !== null) {
if (domWidth <= minWidth) {
return {headers : aColHeaders, newWidth: calcNewWidth(domWidth, minWidth)};
} else if (colHeader && colHeader.style.width != colWidth) {
aNotFixedVariableColumns.push({col: col, header: colHeader, minWidth: minWidth, headers: aColHeaders});
// reset the minimum style width that was set previously
return {headers : aColHeaders, newWidth: colWidth};
}
aNotFixedVariableColumns.push({col: col, header: colHeader, minWidth: minWidth, headers: aColHeaders});
}
}
return null;
}
function adaptColWidth(oColInfo) {
if (oColInfo) {
Array.prototype.forEach.call(oColInfo.headers, function(header) {
header.style.width = oColInfo.newWidth;
});
}
}
// adjust widths of all found column headers
oTable._getVisibleColumns().map(isFixNeeded).forEach(adaptColWidth);
//Check the rest of the flexible non-adapted columns
//Due to adaptations they could be smaller now.
if (aNotFixedVariableColumns.length) {
var iDomWidth;
for (var i = 0; i < aNotFixedVariableColumns.length; i++) {
iDomWidth = aNotFixedVariableColumns[i].header && aNotFixedVariableColumns[i].header.offsetWidth;
aNotFixedVariableColumns[i].newWidth = calcNewWidth(iDomWidth, aNotFixedVariableColumns[i].minWidth);
if (parseInt(aNotFixedVariableColumns[i].newWidth) >= 0) {
adaptColWidth(aNotFixedVariableColumns[i]);
}
}
}
} | javascript | function setMinColWidths(oTable) {
var oTableRef = oTable.getDomRef();
var iAbsoluteMinWidth = TableUtils.Column.getMinColumnWidth();
var aNotFixedVariableColumns = [];
var bColumnHeaderVisible = oTable.getColumnHeaderVisible();
function calcNewWidth(iDomWidth, iMinWidth) {
if (iDomWidth <= iMinWidth) {
// tolerance of -5px to make the resizing smooother
return Math.max(iDomWidth, iMinWidth - 5, iAbsoluteMinWidth) + "px";
}
return -1;
}
function isFixNeeded(col) {
var minWidth = Math.max(col._minWidth || 0, iAbsoluteMinWidth, col.getMinWidth());
var colWidth = col.getWidth();
var aColHeaders;
var colHeader;
var domWidth;
// if a column has variable width, check if its current width of the
// first corresponding <th> element in less than minimum and store it;
// do not change freezed columns
if (TableUtils.isVariableWidth(colWidth) && !TableUtils.isFixedColumn(oTable, col.getIndex())) {
aColHeaders = oTableRef.querySelectorAll('th[data-sap-ui-colid="' + col.getId() + '"]');
colHeader = aColHeaders[bColumnHeaderVisible ? 0 : 1]; // if column headers have display:none, use data table
domWidth = colHeader ? colHeader.offsetWidth : null;
if (domWidth !== null) {
if (domWidth <= minWidth) {
return {headers : aColHeaders, newWidth: calcNewWidth(domWidth, minWidth)};
} else if (colHeader && colHeader.style.width != colWidth) {
aNotFixedVariableColumns.push({col: col, header: colHeader, minWidth: minWidth, headers: aColHeaders});
// reset the minimum style width that was set previously
return {headers : aColHeaders, newWidth: colWidth};
}
aNotFixedVariableColumns.push({col: col, header: colHeader, minWidth: minWidth, headers: aColHeaders});
}
}
return null;
}
function adaptColWidth(oColInfo) {
if (oColInfo) {
Array.prototype.forEach.call(oColInfo.headers, function(header) {
header.style.width = oColInfo.newWidth;
});
}
}
// adjust widths of all found column headers
oTable._getVisibleColumns().map(isFixNeeded).forEach(adaptColWidth);
//Check the rest of the flexible non-adapted columns
//Due to adaptations they could be smaller now.
if (aNotFixedVariableColumns.length) {
var iDomWidth;
for (var i = 0; i < aNotFixedVariableColumns.length; i++) {
iDomWidth = aNotFixedVariableColumns[i].header && aNotFixedVariableColumns[i].header.offsetWidth;
aNotFixedVariableColumns[i].newWidth = calcNewWidth(iDomWidth, aNotFixedVariableColumns[i].minWidth);
if (parseInt(aNotFixedVariableColumns[i].newWidth) >= 0) {
adaptColWidth(aNotFixedVariableColumns[i]);
}
}
}
} | [
"function",
"setMinColWidths",
"(",
"oTable",
")",
"{",
"var",
"oTableRef",
"=",
"oTable",
".",
"getDomRef",
"(",
")",
";",
"var",
"iAbsoluteMinWidth",
"=",
"TableUtils",
".",
"Column",
".",
"getMinColumnWidth",
"(",
")",
";",
"var",
"aNotFixedVariableColumns",
"=",
"[",
"]",
";",
"var",
"bColumnHeaderVisible",
"=",
"oTable",
".",
"getColumnHeaderVisible",
"(",
")",
";",
"function",
"calcNewWidth",
"(",
"iDomWidth",
",",
"iMinWidth",
")",
"{",
"if",
"(",
"iDomWidth",
"<=",
"iMinWidth",
")",
"{",
"// tolerance of -5px to make the resizing smooother",
"return",
"Math",
".",
"max",
"(",
"iDomWidth",
",",
"iMinWidth",
"-",
"5",
",",
"iAbsoluteMinWidth",
")",
"+",
"\"px\"",
";",
"}",
"return",
"-",
"1",
";",
"}",
"function",
"isFixNeeded",
"(",
"col",
")",
"{",
"var",
"minWidth",
"=",
"Math",
".",
"max",
"(",
"col",
".",
"_minWidth",
"||",
"0",
",",
"iAbsoluteMinWidth",
",",
"col",
".",
"getMinWidth",
"(",
")",
")",
";",
"var",
"colWidth",
"=",
"col",
".",
"getWidth",
"(",
")",
";",
"var",
"aColHeaders",
";",
"var",
"colHeader",
";",
"var",
"domWidth",
";",
"// if a column has variable width, check if its current width of the",
"// first corresponding <th> element in less than minimum and store it;",
"// do not change freezed columns",
"if",
"(",
"TableUtils",
".",
"isVariableWidth",
"(",
"colWidth",
")",
"&&",
"!",
"TableUtils",
".",
"isFixedColumn",
"(",
"oTable",
",",
"col",
".",
"getIndex",
"(",
")",
")",
")",
"{",
"aColHeaders",
"=",
"oTableRef",
".",
"querySelectorAll",
"(",
"'th[data-sap-ui-colid=\"'",
"+",
"col",
".",
"getId",
"(",
")",
"+",
"'\"]'",
")",
";",
"colHeader",
"=",
"aColHeaders",
"[",
"bColumnHeaderVisible",
"?",
"0",
":",
"1",
"]",
";",
"// if column headers have display:none, use data table",
"domWidth",
"=",
"colHeader",
"?",
"colHeader",
".",
"offsetWidth",
":",
"null",
";",
"if",
"(",
"domWidth",
"!==",
"null",
")",
"{",
"if",
"(",
"domWidth",
"<=",
"minWidth",
")",
"{",
"return",
"{",
"headers",
":",
"aColHeaders",
",",
"newWidth",
":",
"calcNewWidth",
"(",
"domWidth",
",",
"minWidth",
")",
"}",
";",
"}",
"else",
"if",
"(",
"colHeader",
"&&",
"colHeader",
".",
"style",
".",
"width",
"!=",
"colWidth",
")",
"{",
"aNotFixedVariableColumns",
".",
"push",
"(",
"{",
"col",
":",
"col",
",",
"header",
":",
"colHeader",
",",
"minWidth",
":",
"minWidth",
",",
"headers",
":",
"aColHeaders",
"}",
")",
";",
"// reset the minimum style width that was set previously",
"return",
"{",
"headers",
":",
"aColHeaders",
",",
"newWidth",
":",
"colWidth",
"}",
";",
"}",
"aNotFixedVariableColumns",
".",
"push",
"(",
"{",
"col",
":",
"col",
",",
"header",
":",
"colHeader",
",",
"minWidth",
":",
"minWidth",
",",
"headers",
":",
"aColHeaders",
"}",
")",
";",
"}",
"}",
"return",
"null",
";",
"}",
"function",
"adaptColWidth",
"(",
"oColInfo",
")",
"{",
"if",
"(",
"oColInfo",
")",
"{",
"Array",
".",
"prototype",
".",
"forEach",
".",
"call",
"(",
"oColInfo",
".",
"headers",
",",
"function",
"(",
"header",
")",
"{",
"header",
".",
"style",
".",
"width",
"=",
"oColInfo",
".",
"newWidth",
";",
"}",
")",
";",
"}",
"}",
"// adjust widths of all found column headers",
"oTable",
".",
"_getVisibleColumns",
"(",
")",
".",
"map",
"(",
"isFixNeeded",
")",
".",
"forEach",
"(",
"adaptColWidth",
")",
";",
"//Check the rest of the flexible non-adapted columns",
"//Due to adaptations they could be smaller now.",
"if",
"(",
"aNotFixedVariableColumns",
".",
"length",
")",
"{",
"var",
"iDomWidth",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"aNotFixedVariableColumns",
".",
"length",
";",
"i",
"++",
")",
"{",
"iDomWidth",
"=",
"aNotFixedVariableColumns",
"[",
"i",
"]",
".",
"header",
"&&",
"aNotFixedVariableColumns",
"[",
"i",
"]",
".",
"header",
".",
"offsetWidth",
";",
"aNotFixedVariableColumns",
"[",
"i",
"]",
".",
"newWidth",
"=",
"calcNewWidth",
"(",
"iDomWidth",
",",
"aNotFixedVariableColumns",
"[",
"i",
"]",
".",
"minWidth",
")",
";",
"if",
"(",
"parseInt",
"(",
"aNotFixedVariableColumns",
"[",
"i",
"]",
".",
"newWidth",
")",
">=",
"0",
")",
"{",
"adaptColWidth",
"(",
"aNotFixedVariableColumns",
"[",
"i",
"]",
")",
";",
"}",
"}",
"}",
"}"
] | the only place to fix the minimum column width | [
"the",
"only",
"place",
"to",
"fix",
"the",
"minimum",
"column",
"width"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/Table.js#L1564-L1628 |
3,983 | SAP/openui5 | src/sap.ui.core/src/sap/ui/core/routing/Target.js | function(mArguments) {
var sTitle = this._oTitleProvider && this._oTitleProvider.getTitle();
if (sTitle) {
this.fireTitleChanged({
name: this._oOptions._name,
title: sTitle
});
}
this._bIsDisplayed = true;
return this.fireEvent(this.M_EVENTS.DISPLAY, mArguments);
} | javascript | function(mArguments) {
var sTitle = this._oTitleProvider && this._oTitleProvider.getTitle();
if (sTitle) {
this.fireTitleChanged({
name: this._oOptions._name,
title: sTitle
});
}
this._bIsDisplayed = true;
return this.fireEvent(this.M_EVENTS.DISPLAY, mArguments);
} | [
"function",
"(",
"mArguments",
")",
"{",
"var",
"sTitle",
"=",
"this",
".",
"_oTitleProvider",
"&&",
"this",
".",
"_oTitleProvider",
".",
"getTitle",
"(",
")",
";",
"if",
"(",
"sTitle",
")",
"{",
"this",
".",
"fireTitleChanged",
"(",
"{",
"name",
":",
"this",
".",
"_oOptions",
".",
"_name",
",",
"title",
":",
"sTitle",
"}",
")",
";",
"}",
"this",
".",
"_bIsDisplayed",
"=",
"true",
";",
"return",
"this",
".",
"fireEvent",
"(",
"this",
".",
"M_EVENTS",
".",
"DISPLAY",
",",
"mArguments",
")",
";",
"}"
] | Fire event created to attached listeners.
@param {object} [mArguments] the arguments to pass along with the event.
@return {sap.ui.core.routing.Target} <code>this</code> to allow method chaining
@protected | [
"Fire",
"event",
"created",
"to",
"attached",
"listeners",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/routing/Target.js#L167-L179 |
|
3,984 | SAP/openui5 | src/sap.ui.core/src/sap/ui/core/routing/Target.js | function(oData, fnFunction, oListener) {
var bHasListener = this.hasListeners("titleChanged"),
sTitle = this._oTitleProvider && this._oTitleProvider.getTitle();
this.attachEvent(this.M_EVENTS.TITLE_CHANGED, oData, fnFunction, oListener);
// in case the title is changed before the first event listener is attached, we need to notify, too
if (!bHasListener && sTitle && this._bIsDisplayed) {
this.fireTitleChanged({
name: this._oOptions._name,
title: sTitle
});
}
return this;
} | javascript | function(oData, fnFunction, oListener) {
var bHasListener = this.hasListeners("titleChanged"),
sTitle = this._oTitleProvider && this._oTitleProvider.getTitle();
this.attachEvent(this.M_EVENTS.TITLE_CHANGED, oData, fnFunction, oListener);
// in case the title is changed before the first event listener is attached, we need to notify, too
if (!bHasListener && sTitle && this._bIsDisplayed) {
this.fireTitleChanged({
name: this._oOptions._name,
title: sTitle
});
}
return this;
} | [
"function",
"(",
"oData",
",",
"fnFunction",
",",
"oListener",
")",
"{",
"var",
"bHasListener",
"=",
"this",
".",
"hasListeners",
"(",
"\"titleChanged\"",
")",
",",
"sTitle",
"=",
"this",
".",
"_oTitleProvider",
"&&",
"this",
".",
"_oTitleProvider",
".",
"getTitle",
"(",
")",
";",
"this",
".",
"attachEvent",
"(",
"this",
".",
"M_EVENTS",
".",
"TITLE_CHANGED",
",",
"oData",
",",
"fnFunction",
",",
"oListener",
")",
";",
"// in case the title is changed before the first event listener is attached, we need to notify, too",
"if",
"(",
"!",
"bHasListener",
"&&",
"sTitle",
"&&",
"this",
".",
"_bIsDisplayed",
")",
"{",
"this",
".",
"fireTitleChanged",
"(",
"{",
"name",
":",
"this",
".",
"_oOptions",
".",
"_name",
",",
"title",
":",
"sTitle",
"}",
")",
";",
"}",
"return",
"this",
";",
"}"
] | Will be fired when the title of this Target has been changed.
@name sap.ui.core.routing.Target#titleChanged
@event
@param {object} oEvent
@param {sap.ui.base.EventProvider} oEvent.getSource
@param {object} oEvent.getParameters
@param {string} oEvent.getParameters.title The name of this target
@param {string} oEvent.getParameters.title The current displayed title
@private
Attach event-handler <code>fnFunction</code> to the 'titleChanged' event of this <code>sap.ui.core.routing.Target</code>.<br/>
When the first event handler is registered later than the last title change, it's still called with the last changed title because
when title is set with static text, the event is fired synchronously with the instantiation of this Target and the event handler can't
be registered before the event is fired.
@param {object} [oData] The object, that should be passed along with the event-object when firing the event.
@param {function} fnFunction The function to call, when the event occurs. This function will be called on the
oListener-instance (if present) or in a 'static way'.
@param {object} [oListener] Object on which to call the given function.
@return {sap.ui.core.routing.Target} <code>this</code> to allow method chaining
@private | [
"Will",
"be",
"fired",
"when",
"the",
"title",
"of",
"this",
"Target",
"has",
"been",
"changed",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/routing/Target.js#L209-L222 |
|
3,985 | SAP/openui5 | src/sap.ui.integration/src/sap/ui/integration/util/CustomElements.js | callback | function callback(mutationsList, observer) {
mutationsList.forEach(function (mutation) {
if (mutation.type == 'childList') {
var addedNodes = mutation.addedNodes,
removedNodes = mutation.removedNodes,
node,
xnode,
count,
aTags,
i;
for (count = 0; count < addedNodes.length; count++) {
node = addedNodes[count];
if (!document.createCustomElement._querySelector) {
return;
}
if (node.tagName && document.createCustomElement.hasOwnProperty(node.tagName.toLowerCase())) {
if (!node._control) {
document.createCustomElement[node.tagName.toLowerCase()].connectToNode(node);
}
node._control._connectedCallback();
}
if (node.tagName) {
aTags = node.querySelectorAll(document.createCustomElement._querySelector);
for (i = 0; i < aTags.length; i++) {
xnode = aTags[i];
if (xnode.tagName && document.createCustomElement.hasOwnProperty(xnode.tagName.toLowerCase())) {
if (!xnode._control) {
document.createCustomElement[xnode.tagName.toLowerCase()].connectToNode(xnode);
}
xnode._control._connectedCallback();
}
}
}
}
for (count = 0; count < removedNodes.length; count++) {
node = removedNodes[count];
if (!document.createCustomElement._querySelector) {
return;
}
if (node._control) {
node._control._disconnectedCallback();
}
if (node.tagName) {
aTags = node.querySelectorAll(document.createCustomElement._querySelector);
for (i = 0; i < aTags.length; i++) {
xnode = aTags[i];
if (xnode._control) {
xnode._control._disconnectedCallback();
}
}
}
}
} else if (mutation.type === "attributes" && mutation.target && mutation.target._control) {
mutation.target._control._changeProperty.call(mutation.target._control, mutation.attributeName, mutation.target.getAttribute(mutation.attributeName));
}
});
} | javascript | function callback(mutationsList, observer) {
mutationsList.forEach(function (mutation) {
if (mutation.type == 'childList') {
var addedNodes = mutation.addedNodes,
removedNodes = mutation.removedNodes,
node,
xnode,
count,
aTags,
i;
for (count = 0; count < addedNodes.length; count++) {
node = addedNodes[count];
if (!document.createCustomElement._querySelector) {
return;
}
if (node.tagName && document.createCustomElement.hasOwnProperty(node.tagName.toLowerCase())) {
if (!node._control) {
document.createCustomElement[node.tagName.toLowerCase()].connectToNode(node);
}
node._control._connectedCallback();
}
if (node.tagName) {
aTags = node.querySelectorAll(document.createCustomElement._querySelector);
for (i = 0; i < aTags.length; i++) {
xnode = aTags[i];
if (xnode.tagName && document.createCustomElement.hasOwnProperty(xnode.tagName.toLowerCase())) {
if (!xnode._control) {
document.createCustomElement[xnode.tagName.toLowerCase()].connectToNode(xnode);
}
xnode._control._connectedCallback();
}
}
}
}
for (count = 0; count < removedNodes.length; count++) {
node = removedNodes[count];
if (!document.createCustomElement._querySelector) {
return;
}
if (node._control) {
node._control._disconnectedCallback();
}
if (node.tagName) {
aTags = node.querySelectorAll(document.createCustomElement._querySelector);
for (i = 0; i < aTags.length; i++) {
xnode = aTags[i];
if (xnode._control) {
xnode._control._disconnectedCallback();
}
}
}
}
} else if (mutation.type === "attributes" && mutation.target && mutation.target._control) {
mutation.target._control._changeProperty.call(mutation.target._control, mutation.attributeName, mutation.target.getAttribute(mutation.attributeName));
}
});
} | [
"function",
"callback",
"(",
"mutationsList",
",",
"observer",
")",
"{",
"mutationsList",
".",
"forEach",
"(",
"function",
"(",
"mutation",
")",
"{",
"if",
"(",
"mutation",
".",
"type",
"==",
"'childList'",
")",
"{",
"var",
"addedNodes",
"=",
"mutation",
".",
"addedNodes",
",",
"removedNodes",
"=",
"mutation",
".",
"removedNodes",
",",
"node",
",",
"xnode",
",",
"count",
",",
"aTags",
",",
"i",
";",
"for",
"(",
"count",
"=",
"0",
";",
"count",
"<",
"addedNodes",
".",
"length",
";",
"count",
"++",
")",
"{",
"node",
"=",
"addedNodes",
"[",
"count",
"]",
";",
"if",
"(",
"!",
"document",
".",
"createCustomElement",
".",
"_querySelector",
")",
"{",
"return",
";",
"}",
"if",
"(",
"node",
".",
"tagName",
"&&",
"document",
".",
"createCustomElement",
".",
"hasOwnProperty",
"(",
"node",
".",
"tagName",
".",
"toLowerCase",
"(",
")",
")",
")",
"{",
"if",
"(",
"!",
"node",
".",
"_control",
")",
"{",
"document",
".",
"createCustomElement",
"[",
"node",
".",
"tagName",
".",
"toLowerCase",
"(",
")",
"]",
".",
"connectToNode",
"(",
"node",
")",
";",
"}",
"node",
".",
"_control",
".",
"_connectedCallback",
"(",
")",
";",
"}",
"if",
"(",
"node",
".",
"tagName",
")",
"{",
"aTags",
"=",
"node",
".",
"querySelectorAll",
"(",
"document",
".",
"createCustomElement",
".",
"_querySelector",
")",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"aTags",
".",
"length",
";",
"i",
"++",
")",
"{",
"xnode",
"=",
"aTags",
"[",
"i",
"]",
";",
"if",
"(",
"xnode",
".",
"tagName",
"&&",
"document",
".",
"createCustomElement",
".",
"hasOwnProperty",
"(",
"xnode",
".",
"tagName",
".",
"toLowerCase",
"(",
")",
")",
")",
"{",
"if",
"(",
"!",
"xnode",
".",
"_control",
")",
"{",
"document",
".",
"createCustomElement",
"[",
"xnode",
".",
"tagName",
".",
"toLowerCase",
"(",
")",
"]",
".",
"connectToNode",
"(",
"xnode",
")",
";",
"}",
"xnode",
".",
"_control",
".",
"_connectedCallback",
"(",
")",
";",
"}",
"}",
"}",
"}",
"for",
"(",
"count",
"=",
"0",
";",
"count",
"<",
"removedNodes",
".",
"length",
";",
"count",
"++",
")",
"{",
"node",
"=",
"removedNodes",
"[",
"count",
"]",
";",
"if",
"(",
"!",
"document",
".",
"createCustomElement",
".",
"_querySelector",
")",
"{",
"return",
";",
"}",
"if",
"(",
"node",
".",
"_control",
")",
"{",
"node",
".",
"_control",
".",
"_disconnectedCallback",
"(",
")",
";",
"}",
"if",
"(",
"node",
".",
"tagName",
")",
"{",
"aTags",
"=",
"node",
".",
"querySelectorAll",
"(",
"document",
".",
"createCustomElement",
".",
"_querySelector",
")",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"aTags",
".",
"length",
";",
"i",
"++",
")",
"{",
"xnode",
"=",
"aTags",
"[",
"i",
"]",
";",
"if",
"(",
"xnode",
".",
"_control",
")",
"{",
"xnode",
".",
"_control",
".",
"_disconnectedCallback",
"(",
")",
";",
"}",
"}",
"}",
"}",
"}",
"else",
"if",
"(",
"mutation",
".",
"type",
"===",
"\"attributes\"",
"&&",
"mutation",
".",
"target",
"&&",
"mutation",
".",
"target",
".",
"_control",
")",
"{",
"mutation",
".",
"target",
".",
"_control",
".",
"_changeProperty",
".",
"call",
"(",
"mutation",
".",
"target",
".",
"_control",
",",
"mutation",
".",
"attributeName",
",",
"mutation",
".",
"target",
".",
"getAttribute",
"(",
"mutation",
".",
"attributeName",
")",
")",
";",
"}",
"}",
")",
";",
"}"
] | Callback function to execute when mutations are observed | [
"Callback",
"function",
"to",
"execute",
"when",
"mutations",
"are",
"observed"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.integration/src/sap/ui/integration/util/CustomElements.js#L73-L129 |
3,986 | SAP/openui5 | src/sap.ui.core/src/sap/ui/core/util/XMLPreprocessor.js | createContextInterface | function createContextInterface(oWithControl, mSettings, i, vBindingOrContext) {
/*
* Returns the single binding or model context related to the current formatter call.
*
* @param {number} [iPart]
* index of part in case of the root formatter of a composite binding
* @returns {sap.ui.model.Binding|sap.ui.model.Context}
* single binding or model context
*/
function getBindingOrContext(iPart) {
if (!vBindingOrContext) {
// lazy initialization
// BEWARE: this is not yet defined when createContextInterface() is called!
vBindingOrContext = oWithControl.getBinding("any");
if (vBindingOrContext instanceof CompositeBinding) {
vBindingOrContext = vBindingOrContext.getBindings();
if (i !== undefined) { // not a root formatter
vBindingOrContext = vBindingOrContext[i];
}
}
}
return Array.isArray(vBindingOrContext)
? vBindingOrContext[iPart]
: vBindingOrContext;
}
/**
* Returns the resolved path for the given single binding or model context.
*
* @param {sap.ui.model.Binding|sap.ui.model.Context} oBindingOrContext
* single binding or model context
* @returns {string}
* the resolved path
*/
function getPath(oBindingOrContext) {
return oBindingOrContext instanceof Context
? oBindingOrContext.getPath()
: oBindingOrContext.getModel().resolve(
oBindingOrContext.getPath(), oBindingOrContext.getContext());
}
/**
* Context interface provided by XML template processing as an additional first argument to
* any formatter function which opts in to this mechanism. Candidates for such formatter
* functions are all those used in binding expressions which are evaluated during XML
* template processing, including those used inside template instructions like
* <code><template:if></code>. The formatter function needs to be marked with a property
* <code>requiresIContext = true</code> to express that it requires this extended signature
* (compared to ordinary formatter functions). The usual arguments are provided after the
* first one (currently: the raw value from the model).
*
* This interface provides callback functions to access the model and path which are needed
* to process OData V4 annotations. It initially offers a subset of methods from
* {@link sap.ui.model.Context} so that formatters might also be called with a context
* object for convenience, e.g. outside of XML template processing (see below for an
* exception to this rule).
*
* <b>Example:</b> Suppose you have a formatter function called "foo" like below and it is
* used within an XML template like
* <code><template:if test="{path: '...', formatter: 'foo'}"></code>.
* In this case <code>foo</code> is called with arguments <code>oInterface, vRawValue</code>
* such that
* <code>oInterface.getModel().getObject(oInterface.getPath()) === vRawValue</code> holds.
* <pre>
* window.foo = function (oInterface, vRawValue) {
* //TODO ...
* };
* window.foo.requiresIContext = true;
* </pre>
*
* <b>Composite Binding Examples:</b> Suppose you have the same formatter function and it is
* used in a composite binding like <code><Text text="{path: 'Label', formatter: 'foo'}:
* {path: 'Value', formatter: 'foo'}"/></code>.
* In this case <code>oInterface.getPath()</code> refers to ".../Label" in the 1st call and
* ".../Value" in the 2nd call. This means each formatter call knows which part of the
* composite binding it belongs to and behaves just as if it was an ordinary binding.
*
* Suppose your formatter is not used within a part of the composite binding, but at the
* root of the composite binding in order to aggregate all parts like <code>
* <Text text="{parts: [{path: 'Label'}, {path: 'Value'}], formatter: 'foo'}"/></code>.
* In this case <code>oInterface.getPath(0)</code> refers to ".../Label" and
* <code>oInterface.getPath(1)</code> refers to ".../Value". This means, the root formatter
* can access the ith part of the composite binding at will (since 1.31.0); see also
* {@link #.getInterface getInterface}.
* The function <code>foo</code> is called with arguments such that <code>
* oInterface.getModel(i).getObject(oInterface.getPath(i)) === arguments[i + 1]</code>
* holds.
* This use is not supported within an expression binding, that is, <code><Text
* text="{= ${parts: [{path: 'Label'}, {path: 'Value'}], formatter: 'foo'} }"/></code>
* does not work as expected because the property <code>requiresIContext = true</code> is
* ignored.
*
* To distinguish those two use cases, just check whether <code>oInterface.getModel() ===
* undefined</code>, in which case the formatter is called on root level of a composite
* binding. To find out the number of parts, probe for the smallest non-negative integer
* where <code>oInterface.getModel(i) === undefined</code>.
* This additional functionality is, of course, not available from
* {@link sap.ui.model.Context}, i.e. such formatters MUST be called with an instance of
* this context interface.
*
* @interface
* @name sap.ui.core.util.XMLPreprocessor.IContext
* @public
* @since 1.27.1
*/
return /** @lends sap.ui.core.util.XMLPreprocessor.IContext */ {
/**
* Returns a context interface for the indicated part in case of the root formatter of a
* composite binding. The new interface provides access to the original settings, but
* only to the model and path of the indicated part:
* <pre>
* this.getInterface(i).getSetting(sName) === this.getSetting(sName);
* this.getInterface(i).getModel() === this.getModel(i);
* this.getInterface(i).getPath() === this.getPath(i);
* </pre>
*
* If a path is given, the new interface points to the resolved path as follows:
* <pre>
* this.getInterface(i, "foo/bar").getPath() === this.getPath(i) + "/foo/bar";
* this.getInterface(i, "/absolute/path").getPath() === "/absolute/path";
* </pre>
* A formatter which is not at the root level of a composite binding can also provide a
* path, but must not provide an index:
* <pre>
* this.getInterface("foo/bar").getPath() === this.getPath() + "/foo/bar";
* this.getInterface("/absolute/path").getPath() === "/absolute/path";
* </pre>
* Note that at least one argument must be present.
*
* @param {number} [iPart]
* index of part in case of the root formatter of a composite binding
* @param {string} [sPath]
* a path, interpreted relative to <code>this.getPath(iPart)</code>
* @returns {sap.ui.core.util.XMLPreprocessor.IContext}
* the context interface related to the indicated part
* @throws {Error}
* In case an index is given but the current interface does not belong to the root
* formatter of a composite binding, or in case the given index is invalid (e.g.
* missing or out of range), or in case a path is missing because no index is given,
* or in case a path is given but the model cannot not create a binding context
* synchronously
* @public
* @since 1.31.0
*/
getInterface : function (iPart, sPath) {
var oBaseContext, oBindingOrContext, oModel;
if (typeof iPart === "string") {
sPath = iPart;
iPart = undefined;
}
getBindingOrContext(); // initialize vBindingOrContext
if (Array.isArray(vBindingOrContext)) {
if (iPart >= 0 && iPart < vBindingOrContext.length) {
oBindingOrContext = vBindingOrContext[iPart];
} else {
throw new Error("Invalid index of part: " + iPart);
}
} else if (iPart !== undefined) {
throw new Error("Not the root formatter of a composite binding");
} else if (sPath) {
oBindingOrContext = vBindingOrContext;
} else {
throw new Error("Missing path");
}
if (sPath) {
oModel = oBindingOrContext.getModel();
if (sPath.charAt(0) !== '/') { // relative path needs a base context
oBaseContext = oBindingOrContext instanceof Context
? oBindingOrContext
: oModel.createBindingContext(oBindingOrContext.getPath(),
oBindingOrContext.getContext());
}
oBindingOrContext = oModel.createBindingContext(sPath, oBaseContext);
if (!oBindingOrContext) {
throw new Error(
"Model could not create binding context synchronously: " + oModel);
}
}
return createContextInterface(null, mSettings, undefined, oBindingOrContext);
},
/**
* Returns the model related to the current formatter call.
*
* @param {number} [iPart]
* index of part in case of the root formatter of a composite binding
* (since 1.31.0)
* @returns {sap.ui.model.Model}
* the model related to the current formatter call, or (since 1.31.0)
* <code>undefined</code> in case of a root formatter if no <code>iPart</code> is
* given or if <code>iPart</code> is out of range
* @public
*/
getModel : function (iPart) {
var oBindingOrContext = getBindingOrContext(iPart);
return oBindingOrContext && oBindingOrContext.getModel();
},
/**
* Returns the absolute path related to the current formatter call.
*
* @param {number} [iPart]
* index of part in case of the root formatter of a composite binding (since 1.31.0)
* @returns {string}
* the absolute path related to the current formatter call, or (since 1.31.0)
* <code>undefined</code> in case of a root formatter if no <code>iPart</code> is
* given or if <code>iPart</code> is out of range
* @public
*/
getPath : function (iPart) {
var oBindingOrContext = getBindingOrContext(iPart);
return oBindingOrContext && getPath(oBindingOrContext);
},
/**
* Returns the value of the setting with the given name which was provided to the XML
* template processing.
*
* @param {string} sName
* the name of the setting
* @returns {any}
* the value of the setting
* @throws {Error}
* if the name is one of the reserved names: "bindingContexts", "models"
* @public
*/
getSetting : function (sName) {
if (sName === "bindingContexts" || sName === "models") {
throw new Error("Illegal argument: " + sName);
}
return mSettings[sName];
}
};
} | javascript | function createContextInterface(oWithControl, mSettings, i, vBindingOrContext) {
/*
* Returns the single binding or model context related to the current formatter call.
*
* @param {number} [iPart]
* index of part in case of the root formatter of a composite binding
* @returns {sap.ui.model.Binding|sap.ui.model.Context}
* single binding or model context
*/
function getBindingOrContext(iPart) {
if (!vBindingOrContext) {
// lazy initialization
// BEWARE: this is not yet defined when createContextInterface() is called!
vBindingOrContext = oWithControl.getBinding("any");
if (vBindingOrContext instanceof CompositeBinding) {
vBindingOrContext = vBindingOrContext.getBindings();
if (i !== undefined) { // not a root formatter
vBindingOrContext = vBindingOrContext[i];
}
}
}
return Array.isArray(vBindingOrContext)
? vBindingOrContext[iPart]
: vBindingOrContext;
}
/**
* Returns the resolved path for the given single binding or model context.
*
* @param {sap.ui.model.Binding|sap.ui.model.Context} oBindingOrContext
* single binding or model context
* @returns {string}
* the resolved path
*/
function getPath(oBindingOrContext) {
return oBindingOrContext instanceof Context
? oBindingOrContext.getPath()
: oBindingOrContext.getModel().resolve(
oBindingOrContext.getPath(), oBindingOrContext.getContext());
}
/**
* Context interface provided by XML template processing as an additional first argument to
* any formatter function which opts in to this mechanism. Candidates for such formatter
* functions are all those used in binding expressions which are evaluated during XML
* template processing, including those used inside template instructions like
* <code><template:if></code>. The formatter function needs to be marked with a property
* <code>requiresIContext = true</code> to express that it requires this extended signature
* (compared to ordinary formatter functions). The usual arguments are provided after the
* first one (currently: the raw value from the model).
*
* This interface provides callback functions to access the model and path which are needed
* to process OData V4 annotations. It initially offers a subset of methods from
* {@link sap.ui.model.Context} so that formatters might also be called with a context
* object for convenience, e.g. outside of XML template processing (see below for an
* exception to this rule).
*
* <b>Example:</b> Suppose you have a formatter function called "foo" like below and it is
* used within an XML template like
* <code><template:if test="{path: '...', formatter: 'foo'}"></code>.
* In this case <code>foo</code> is called with arguments <code>oInterface, vRawValue</code>
* such that
* <code>oInterface.getModel().getObject(oInterface.getPath()) === vRawValue</code> holds.
* <pre>
* window.foo = function (oInterface, vRawValue) {
* //TODO ...
* };
* window.foo.requiresIContext = true;
* </pre>
*
* <b>Composite Binding Examples:</b> Suppose you have the same formatter function and it is
* used in a composite binding like <code><Text text="{path: 'Label', formatter: 'foo'}:
* {path: 'Value', formatter: 'foo'}"/></code>.
* In this case <code>oInterface.getPath()</code> refers to ".../Label" in the 1st call and
* ".../Value" in the 2nd call. This means each formatter call knows which part of the
* composite binding it belongs to and behaves just as if it was an ordinary binding.
*
* Suppose your formatter is not used within a part of the composite binding, but at the
* root of the composite binding in order to aggregate all parts like <code>
* <Text text="{parts: [{path: 'Label'}, {path: 'Value'}], formatter: 'foo'}"/></code>.
* In this case <code>oInterface.getPath(0)</code> refers to ".../Label" and
* <code>oInterface.getPath(1)</code> refers to ".../Value". This means, the root formatter
* can access the ith part of the composite binding at will (since 1.31.0); see also
* {@link #.getInterface getInterface}.
* The function <code>foo</code> is called with arguments such that <code>
* oInterface.getModel(i).getObject(oInterface.getPath(i)) === arguments[i + 1]</code>
* holds.
* This use is not supported within an expression binding, that is, <code><Text
* text="{= ${parts: [{path: 'Label'}, {path: 'Value'}], formatter: 'foo'} }"/></code>
* does not work as expected because the property <code>requiresIContext = true</code> is
* ignored.
*
* To distinguish those two use cases, just check whether <code>oInterface.getModel() ===
* undefined</code>, in which case the formatter is called on root level of a composite
* binding. To find out the number of parts, probe for the smallest non-negative integer
* where <code>oInterface.getModel(i) === undefined</code>.
* This additional functionality is, of course, not available from
* {@link sap.ui.model.Context}, i.e. such formatters MUST be called with an instance of
* this context interface.
*
* @interface
* @name sap.ui.core.util.XMLPreprocessor.IContext
* @public
* @since 1.27.1
*/
return /** @lends sap.ui.core.util.XMLPreprocessor.IContext */ {
/**
* Returns a context interface for the indicated part in case of the root formatter of a
* composite binding. The new interface provides access to the original settings, but
* only to the model and path of the indicated part:
* <pre>
* this.getInterface(i).getSetting(sName) === this.getSetting(sName);
* this.getInterface(i).getModel() === this.getModel(i);
* this.getInterface(i).getPath() === this.getPath(i);
* </pre>
*
* If a path is given, the new interface points to the resolved path as follows:
* <pre>
* this.getInterface(i, "foo/bar").getPath() === this.getPath(i) + "/foo/bar";
* this.getInterface(i, "/absolute/path").getPath() === "/absolute/path";
* </pre>
* A formatter which is not at the root level of a composite binding can also provide a
* path, but must not provide an index:
* <pre>
* this.getInterface("foo/bar").getPath() === this.getPath() + "/foo/bar";
* this.getInterface("/absolute/path").getPath() === "/absolute/path";
* </pre>
* Note that at least one argument must be present.
*
* @param {number} [iPart]
* index of part in case of the root formatter of a composite binding
* @param {string} [sPath]
* a path, interpreted relative to <code>this.getPath(iPart)</code>
* @returns {sap.ui.core.util.XMLPreprocessor.IContext}
* the context interface related to the indicated part
* @throws {Error}
* In case an index is given but the current interface does not belong to the root
* formatter of a composite binding, or in case the given index is invalid (e.g.
* missing or out of range), or in case a path is missing because no index is given,
* or in case a path is given but the model cannot not create a binding context
* synchronously
* @public
* @since 1.31.0
*/
getInterface : function (iPart, sPath) {
var oBaseContext, oBindingOrContext, oModel;
if (typeof iPart === "string") {
sPath = iPart;
iPart = undefined;
}
getBindingOrContext(); // initialize vBindingOrContext
if (Array.isArray(vBindingOrContext)) {
if (iPart >= 0 && iPart < vBindingOrContext.length) {
oBindingOrContext = vBindingOrContext[iPart];
} else {
throw new Error("Invalid index of part: " + iPart);
}
} else if (iPart !== undefined) {
throw new Error("Not the root formatter of a composite binding");
} else if (sPath) {
oBindingOrContext = vBindingOrContext;
} else {
throw new Error("Missing path");
}
if (sPath) {
oModel = oBindingOrContext.getModel();
if (sPath.charAt(0) !== '/') { // relative path needs a base context
oBaseContext = oBindingOrContext instanceof Context
? oBindingOrContext
: oModel.createBindingContext(oBindingOrContext.getPath(),
oBindingOrContext.getContext());
}
oBindingOrContext = oModel.createBindingContext(sPath, oBaseContext);
if (!oBindingOrContext) {
throw new Error(
"Model could not create binding context synchronously: " + oModel);
}
}
return createContextInterface(null, mSettings, undefined, oBindingOrContext);
},
/**
* Returns the model related to the current formatter call.
*
* @param {number} [iPart]
* index of part in case of the root formatter of a composite binding
* (since 1.31.0)
* @returns {sap.ui.model.Model}
* the model related to the current formatter call, or (since 1.31.0)
* <code>undefined</code> in case of a root formatter if no <code>iPart</code> is
* given or if <code>iPart</code> is out of range
* @public
*/
getModel : function (iPart) {
var oBindingOrContext = getBindingOrContext(iPart);
return oBindingOrContext && oBindingOrContext.getModel();
},
/**
* Returns the absolute path related to the current formatter call.
*
* @param {number} [iPart]
* index of part in case of the root formatter of a composite binding (since 1.31.0)
* @returns {string}
* the absolute path related to the current formatter call, or (since 1.31.0)
* <code>undefined</code> in case of a root formatter if no <code>iPart</code> is
* given or if <code>iPart</code> is out of range
* @public
*/
getPath : function (iPart) {
var oBindingOrContext = getBindingOrContext(iPart);
return oBindingOrContext && getPath(oBindingOrContext);
},
/**
* Returns the value of the setting with the given name which was provided to the XML
* template processing.
*
* @param {string} sName
* the name of the setting
* @returns {any}
* the value of the setting
* @throws {Error}
* if the name is one of the reserved names: "bindingContexts", "models"
* @public
*/
getSetting : function (sName) {
if (sName === "bindingContexts" || sName === "models") {
throw new Error("Illegal argument: " + sName);
}
return mSettings[sName];
}
};
} | [
"function",
"createContextInterface",
"(",
"oWithControl",
",",
"mSettings",
",",
"i",
",",
"vBindingOrContext",
")",
"{",
"/*\n\t\t * Returns the single binding or model context related to the current formatter call.\n\t\t *\n\t\t * @param {number} [iPart]\n\t\t * index of part in case of the root formatter of a composite binding\n\t\t * @returns {sap.ui.model.Binding|sap.ui.model.Context}\n\t\t * single binding or model context\n\t\t */",
"function",
"getBindingOrContext",
"(",
"iPart",
")",
"{",
"if",
"(",
"!",
"vBindingOrContext",
")",
"{",
"// lazy initialization",
"// BEWARE: this is not yet defined when createContextInterface() is called!",
"vBindingOrContext",
"=",
"oWithControl",
".",
"getBinding",
"(",
"\"any\"",
")",
";",
"if",
"(",
"vBindingOrContext",
"instanceof",
"CompositeBinding",
")",
"{",
"vBindingOrContext",
"=",
"vBindingOrContext",
".",
"getBindings",
"(",
")",
";",
"if",
"(",
"i",
"!==",
"undefined",
")",
"{",
"// not a root formatter",
"vBindingOrContext",
"=",
"vBindingOrContext",
"[",
"i",
"]",
";",
"}",
"}",
"}",
"return",
"Array",
".",
"isArray",
"(",
"vBindingOrContext",
")",
"?",
"vBindingOrContext",
"[",
"iPart",
"]",
":",
"vBindingOrContext",
";",
"}",
"/**\n\t\t * Returns the resolved path for the given single binding or model context.\n\t\t *\n\t\t * @param {sap.ui.model.Binding|sap.ui.model.Context} oBindingOrContext\n\t\t * single binding or model context\n\t\t * @returns {string}\n\t\t * the resolved path\n\t\t */",
"function",
"getPath",
"(",
"oBindingOrContext",
")",
"{",
"return",
"oBindingOrContext",
"instanceof",
"Context",
"?",
"oBindingOrContext",
".",
"getPath",
"(",
")",
":",
"oBindingOrContext",
".",
"getModel",
"(",
")",
".",
"resolve",
"(",
"oBindingOrContext",
".",
"getPath",
"(",
")",
",",
"oBindingOrContext",
".",
"getContext",
"(",
")",
")",
";",
"}",
"/**\n\t\t * Context interface provided by XML template processing as an additional first argument to\n\t\t * any formatter function which opts in to this mechanism. Candidates for such formatter\n\t\t * functions are all those used in binding expressions which are evaluated during XML\n\t\t * template processing, including those used inside template instructions like\n\t\t * <code><template:if></code>. The formatter function needs to be marked with a property\n\t\t * <code>requiresIContext = true</code> to express that it requires this extended signature\n\t\t * (compared to ordinary formatter functions). The usual arguments are provided after the\n\t\t * first one (currently: the raw value from the model).\n\t\t *\n\t\t * This interface provides callback functions to access the model and path which are needed\n\t\t * to process OData V4 annotations. It initially offers a subset of methods from\n\t\t * {@link sap.ui.model.Context} so that formatters might also be called with a context\n\t\t * object for convenience, e.g. outside of XML template processing (see below for an\n\t\t * exception to this rule).\n\t\t *\n\t\t * <b>Example:</b> Suppose you have a formatter function called \"foo\" like below and it is\n\t\t * used within an XML template like\n\t\t * <code><template:if test=\"{path: '...', formatter: 'foo'}\"></code>.\n\t\t * In this case <code>foo</code> is called with arguments <code>oInterface, vRawValue</code>\n\t\t * such that\n\t\t * <code>oInterface.getModel().getObject(oInterface.getPath()) === vRawValue</code> holds.\n\t\t * <pre>\n\t\t * window.foo = function (oInterface, vRawValue) {\n\t\t * //TODO ...\n\t\t * };\n\t\t * window.foo.requiresIContext = true;\n\t\t * </pre>\n\t\t *\n\t\t * <b>Composite Binding Examples:</b> Suppose you have the same formatter function and it is\n\t\t * used in a composite binding like <code><Text text=\"{path: 'Label', formatter: 'foo'}:\n\t\t * {path: 'Value', formatter: 'foo'}\"/></code>.\n\t\t * In this case <code>oInterface.getPath()</code> refers to \".../Label\" in the 1st call and\n\t\t * \".../Value\" in the 2nd call. This means each formatter call knows which part of the\n\t\t * composite binding it belongs to and behaves just as if it was an ordinary binding.\n\t\t *\n\t\t * Suppose your formatter is not used within a part of the composite binding, but at the\n\t\t * root of the composite binding in order to aggregate all parts like <code>\n\t\t * <Text text=\"{parts: [{path: 'Label'}, {path: 'Value'}], formatter: 'foo'}\"/></code>.\n\t\t * In this case <code>oInterface.getPath(0)</code> refers to \".../Label\" and\n\t\t * <code>oInterface.getPath(1)</code> refers to \".../Value\". This means, the root formatter\n\t\t * can access the ith part of the composite binding at will (since 1.31.0); see also\n\t\t * {@link #.getInterface getInterface}.\n\t\t * The function <code>foo</code> is called with arguments such that <code>\n\t\t * oInterface.getModel(i).getObject(oInterface.getPath(i)) === arguments[i + 1]</code>\n\t\t * holds.\n\t\t * This use is not supported within an expression binding, that is, <code><Text\n\t\t * text=\"{= ${parts: [{path: 'Label'}, {path: 'Value'}], formatter: 'foo'} }\"/></code>\n\t\t * does not work as expected because the property <code>requiresIContext = true</code> is\n\t\t * ignored.\n\t\t *\n\t\t * To distinguish those two use cases, just check whether <code>oInterface.getModel() ===\n\t\t * undefined</code>, in which case the formatter is called on root level of a composite\n\t\t * binding. To find out the number of parts, probe for the smallest non-negative integer\n\t\t * where <code>oInterface.getModel(i) === undefined</code>.\n\t\t * This additional functionality is, of course, not available from\n\t\t * {@link sap.ui.model.Context}, i.e. such formatters MUST be called with an instance of\n\t\t * this context interface.\n\t\t *\n\t\t * @interface\n\t\t * @name sap.ui.core.util.XMLPreprocessor.IContext\n\t\t * @public\n\t\t * @since 1.27.1\n\t\t */",
"return",
"/** @lends sap.ui.core.util.XMLPreprocessor.IContext */",
"{",
"/**\n\t\t\t * Returns a context interface for the indicated part in case of the root formatter of a\n\t\t\t * composite binding. The new interface provides access to the original settings, but\n\t\t\t * only to the model and path of the indicated part:\n\t\t\t * <pre>\n\t\t\t * this.getInterface(i).getSetting(sName) === this.getSetting(sName);\n\t\t\t * this.getInterface(i).getModel() === this.getModel(i);\n\t\t\t * this.getInterface(i).getPath() === this.getPath(i);\n\t\t\t * </pre>\n\t\t\t *\n\t\t\t * If a path is given, the new interface points to the resolved path as follows:\n\t\t\t * <pre>\n\t\t\t * this.getInterface(i, \"foo/bar\").getPath() === this.getPath(i) + \"/foo/bar\";\n\t\t\t * this.getInterface(i, \"/absolute/path\").getPath() === \"/absolute/path\";\n\t\t\t * </pre>\n\t\t\t * A formatter which is not at the root level of a composite binding can also provide a\n\t\t\t * path, but must not provide an index:\n\t\t\t * <pre>\n\t\t\t * this.getInterface(\"foo/bar\").getPath() === this.getPath() + \"/foo/bar\";\n\t\t\t * this.getInterface(\"/absolute/path\").getPath() === \"/absolute/path\";\n\t\t\t * </pre>\n\t\t\t * Note that at least one argument must be present.\n\t\t\t *\n\t\t\t * @param {number} [iPart]\n\t\t\t * index of part in case of the root formatter of a composite binding\n\t\t\t * @param {string} [sPath]\n\t\t\t * a path, interpreted relative to <code>this.getPath(iPart)</code>\n\t\t\t * @returns {sap.ui.core.util.XMLPreprocessor.IContext}\n\t\t\t * the context interface related to the indicated part\n\t\t\t * @throws {Error}\n\t\t\t * In case an index is given but the current interface does not belong to the root\n\t\t\t * formatter of a composite binding, or in case the given index is invalid (e.g.\n\t\t\t * missing or out of range), or in case a path is missing because no index is given,\n\t\t\t * or in case a path is given but the model cannot not create a binding context\n\t\t\t * synchronously\n\t\t\t * @public\n\t\t\t * @since 1.31.0\n\t\t\t */",
"getInterface",
":",
"function",
"(",
"iPart",
",",
"sPath",
")",
"{",
"var",
"oBaseContext",
",",
"oBindingOrContext",
",",
"oModel",
";",
"if",
"(",
"typeof",
"iPart",
"===",
"\"string\"",
")",
"{",
"sPath",
"=",
"iPart",
";",
"iPart",
"=",
"undefined",
";",
"}",
"getBindingOrContext",
"(",
")",
";",
"// initialize vBindingOrContext",
"if",
"(",
"Array",
".",
"isArray",
"(",
"vBindingOrContext",
")",
")",
"{",
"if",
"(",
"iPart",
">=",
"0",
"&&",
"iPart",
"<",
"vBindingOrContext",
".",
"length",
")",
"{",
"oBindingOrContext",
"=",
"vBindingOrContext",
"[",
"iPart",
"]",
";",
"}",
"else",
"{",
"throw",
"new",
"Error",
"(",
"\"Invalid index of part: \"",
"+",
"iPart",
")",
";",
"}",
"}",
"else",
"if",
"(",
"iPart",
"!==",
"undefined",
")",
"{",
"throw",
"new",
"Error",
"(",
"\"Not the root formatter of a composite binding\"",
")",
";",
"}",
"else",
"if",
"(",
"sPath",
")",
"{",
"oBindingOrContext",
"=",
"vBindingOrContext",
";",
"}",
"else",
"{",
"throw",
"new",
"Error",
"(",
"\"Missing path\"",
")",
";",
"}",
"if",
"(",
"sPath",
")",
"{",
"oModel",
"=",
"oBindingOrContext",
".",
"getModel",
"(",
")",
";",
"if",
"(",
"sPath",
".",
"charAt",
"(",
"0",
")",
"!==",
"'/'",
")",
"{",
"// relative path needs a base context",
"oBaseContext",
"=",
"oBindingOrContext",
"instanceof",
"Context",
"?",
"oBindingOrContext",
":",
"oModel",
".",
"createBindingContext",
"(",
"oBindingOrContext",
".",
"getPath",
"(",
")",
",",
"oBindingOrContext",
".",
"getContext",
"(",
")",
")",
";",
"}",
"oBindingOrContext",
"=",
"oModel",
".",
"createBindingContext",
"(",
"sPath",
",",
"oBaseContext",
")",
";",
"if",
"(",
"!",
"oBindingOrContext",
")",
"{",
"throw",
"new",
"Error",
"(",
"\"Model could not create binding context synchronously: \"",
"+",
"oModel",
")",
";",
"}",
"}",
"return",
"createContextInterface",
"(",
"null",
",",
"mSettings",
",",
"undefined",
",",
"oBindingOrContext",
")",
";",
"}",
",",
"/**\n\t\t\t * Returns the model related to the current formatter call.\n\t\t\t *\n\t\t\t * @param {number} [iPart]\n\t\t\t * index of part in case of the root formatter of a composite binding\n\t\t\t * (since 1.31.0)\n\t\t\t * @returns {sap.ui.model.Model}\n\t\t\t * the model related to the current formatter call, or (since 1.31.0)\n\t\t\t * <code>undefined</code> in case of a root formatter if no <code>iPart</code> is\n\t\t\t * given or if <code>iPart</code> is out of range\n\t\t\t * @public\n\t\t\t */",
"getModel",
":",
"function",
"(",
"iPart",
")",
"{",
"var",
"oBindingOrContext",
"=",
"getBindingOrContext",
"(",
"iPart",
")",
";",
"return",
"oBindingOrContext",
"&&",
"oBindingOrContext",
".",
"getModel",
"(",
")",
";",
"}",
",",
"/**\n\t\t\t * Returns the absolute path related to the current formatter call.\n\t\t\t *\n\t\t\t * @param {number} [iPart]\n\t\t\t * index of part in case of the root formatter of a composite binding (since 1.31.0)\n\t\t\t * @returns {string}\n\t\t\t * the absolute path related to the current formatter call, or (since 1.31.0)\n\t\t\t * <code>undefined</code> in case of a root formatter if no <code>iPart</code> is\n\t\t\t * given or if <code>iPart</code> is out of range\n\t\t\t * @public\n\t\t\t */",
"getPath",
":",
"function",
"(",
"iPart",
")",
"{",
"var",
"oBindingOrContext",
"=",
"getBindingOrContext",
"(",
"iPart",
")",
";",
"return",
"oBindingOrContext",
"&&",
"getPath",
"(",
"oBindingOrContext",
")",
";",
"}",
",",
"/**\n\t\t\t * Returns the value of the setting with the given name which was provided to the XML\n\t\t\t * template processing.\n\t\t\t *\n\t\t\t * @param {string} sName\n\t\t\t * the name of the setting\n\t\t\t * @returns {any}\n\t\t\t * the value of the setting\n\t\t\t * @throws {Error}\n\t\t\t * if the name is one of the reserved names: \"bindingContexts\", \"models\"\n\t\t\t * @public\n\t\t\t */",
"getSetting",
":",
"function",
"(",
"sName",
")",
"{",
"if",
"(",
"sName",
"===",
"\"bindingContexts\"",
"||",
"sName",
"===",
"\"models\"",
")",
"{",
"throw",
"new",
"Error",
"(",
"\"Illegal argument: \"",
"+",
"sName",
")",
";",
"}",
"return",
"mSettings",
"[",
"sName",
"]",
";",
"}",
"}",
";",
"}"
] | Creates the context interface for a call to the given control's formatter of the binding part
with given index.
@param {sap.ui.core.util._with} oWithControl
the "with" control
@param {object} mSettings
map/JSON-object with initial property values, etc.
@param {number} [i]
index of part inside a composite binding
@param {sap.ui.model.Binding|sap.ui.model.Binding[]|sap.ui.model.Context}
[vBindingOrContext]
single binding or model context or array of parts; if this parameter is given,
"oWithControl" and "i" are ignored, else it is lazily computed from those two
@returns {sap.ui.core.util.XMLPreprocessor.IContext}
the callback interface | [
"Creates",
"the",
"context",
"interface",
"for",
"a",
"call",
"to",
"the",
"given",
"control",
"s",
"formatter",
"of",
"the",
"binding",
"part",
"with",
"given",
"index",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/util/XMLPreprocessor.js#L86-L326 |
3,987 | SAP/openui5 | src/sap.ui.core/src/sap/ui/core/util/XMLPreprocessor.js | getPath | function getPath(oBindingOrContext) {
return oBindingOrContext instanceof Context
? oBindingOrContext.getPath()
: oBindingOrContext.getModel().resolve(
oBindingOrContext.getPath(), oBindingOrContext.getContext());
} | javascript | function getPath(oBindingOrContext) {
return oBindingOrContext instanceof Context
? oBindingOrContext.getPath()
: oBindingOrContext.getModel().resolve(
oBindingOrContext.getPath(), oBindingOrContext.getContext());
} | [
"function",
"getPath",
"(",
"oBindingOrContext",
")",
"{",
"return",
"oBindingOrContext",
"instanceof",
"Context",
"?",
"oBindingOrContext",
".",
"getPath",
"(",
")",
":",
"oBindingOrContext",
".",
"getModel",
"(",
")",
".",
"resolve",
"(",
"oBindingOrContext",
".",
"getPath",
"(",
")",
",",
"oBindingOrContext",
".",
"getContext",
"(",
")",
")",
";",
"}"
] | Returns the resolved path for the given single binding or model context.
@param {sap.ui.model.Binding|sap.ui.model.Context} oBindingOrContext
single binding or model context
@returns {string}
the resolved path | [
"Returns",
"the",
"resolved",
"path",
"for",
"the",
"given",
"single",
"binding",
"or",
"model",
"context",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/util/XMLPreprocessor.js#L123-L128 |
3,988 | SAP/openui5 | src/sap.ui.core/src/sap/ui/core/util/XMLPreprocessor.js | getAny | function getAny(oWithControl, oBindingInfo, mSettings, oScope, bAsync) {
var bValueAsPromise = false;
/*
* Prepares the given binding info or part of it; makes it "one time" and binds its
* formatter function (if opted in) to an interface object.
*
* @param {object} oInfo
* a binding info or a part of it
* @param {number} i
* index of binding info's part (if applicable)
*/
function prepare(oInfo, i) {
var fnFormatter = oInfo.formatter,
oModel,
sModelName = oInfo.model;
if (oInfo.path && oInfo.path.indexOf(">") > 0) {
sModelName = oInfo.path.slice(0, oInfo.path.indexOf(">"));
}
oModel = oWithControl.getModel(sModelName);
if (fnFormatter && fnFormatter.requiresIContext === true) {
fnFormatter = oInfo.formatter
= fnFormatter.bind(null, createContextInterface(oWithControl, mSettings, i));
}
// wrap formatter only if there is a formatter and async is allowed and either
// - we use $$valueAsPromise ourselves, or
// - we are top-level and at least one child has used $$valueAsPromise
if (fnFormatter && bAsync
&& (oModel && oModel.$$valueAsPromise || i === undefined && bValueAsPromise)) {
oInfo.formatter = function () {
var that = this;
return SyncPromise.all(arguments).then(function (aArguments) {
return fnFormatter.apply(that, aArguments);
});
};
oInfo.formatter.textFragments = fnFormatter.textFragments;
}
oInfo.mode = BindingMode.OneTime;
oInfo.parameters = oInfo.parameters || {};
oInfo.parameters.scope = oScope;
if (bAsync && oModel && oModel.$$valueAsPromise) { // opt-in to async behavior
bValueAsPromise = oInfo.parameters.$$valueAsPromise = true;
}
}
try {
if (oBindingInfo.parts) {
oBindingInfo.parts.forEach(prepare);
}
prepare(oBindingInfo);
oWithControl.bindProperty("any", oBindingInfo);
return oWithControl.getBinding("any")
? SyncPromise.resolve(oWithControl.getAny())
: null;
} catch (e) {
return SyncPromise.reject(e);
} finally {
oWithControl.unbindProperty("any", true);
}
} | javascript | function getAny(oWithControl, oBindingInfo, mSettings, oScope, bAsync) {
var bValueAsPromise = false;
/*
* Prepares the given binding info or part of it; makes it "one time" and binds its
* formatter function (if opted in) to an interface object.
*
* @param {object} oInfo
* a binding info or a part of it
* @param {number} i
* index of binding info's part (if applicable)
*/
function prepare(oInfo, i) {
var fnFormatter = oInfo.formatter,
oModel,
sModelName = oInfo.model;
if (oInfo.path && oInfo.path.indexOf(">") > 0) {
sModelName = oInfo.path.slice(0, oInfo.path.indexOf(">"));
}
oModel = oWithControl.getModel(sModelName);
if (fnFormatter && fnFormatter.requiresIContext === true) {
fnFormatter = oInfo.formatter
= fnFormatter.bind(null, createContextInterface(oWithControl, mSettings, i));
}
// wrap formatter only if there is a formatter and async is allowed and either
// - we use $$valueAsPromise ourselves, or
// - we are top-level and at least one child has used $$valueAsPromise
if (fnFormatter && bAsync
&& (oModel && oModel.$$valueAsPromise || i === undefined && bValueAsPromise)) {
oInfo.formatter = function () {
var that = this;
return SyncPromise.all(arguments).then(function (aArguments) {
return fnFormatter.apply(that, aArguments);
});
};
oInfo.formatter.textFragments = fnFormatter.textFragments;
}
oInfo.mode = BindingMode.OneTime;
oInfo.parameters = oInfo.parameters || {};
oInfo.parameters.scope = oScope;
if (bAsync && oModel && oModel.$$valueAsPromise) { // opt-in to async behavior
bValueAsPromise = oInfo.parameters.$$valueAsPromise = true;
}
}
try {
if (oBindingInfo.parts) {
oBindingInfo.parts.forEach(prepare);
}
prepare(oBindingInfo);
oWithControl.bindProperty("any", oBindingInfo);
return oWithControl.getBinding("any")
? SyncPromise.resolve(oWithControl.getAny())
: null;
} catch (e) {
return SyncPromise.reject(e);
} finally {
oWithControl.unbindProperty("any", true);
}
} | [
"function",
"getAny",
"(",
"oWithControl",
",",
"oBindingInfo",
",",
"mSettings",
",",
"oScope",
",",
"bAsync",
")",
"{",
"var",
"bValueAsPromise",
"=",
"false",
";",
"/*\n\t\t * Prepares the given binding info or part of it; makes it \"one time\" and binds its\n\t\t * formatter function (if opted in) to an interface object.\n\t\t *\n\t\t * @param {object} oInfo\n\t\t * a binding info or a part of it\n\t\t * @param {number} i\n\t\t * index of binding info's part (if applicable)\n\t\t */",
"function",
"prepare",
"(",
"oInfo",
",",
"i",
")",
"{",
"var",
"fnFormatter",
"=",
"oInfo",
".",
"formatter",
",",
"oModel",
",",
"sModelName",
"=",
"oInfo",
".",
"model",
";",
"if",
"(",
"oInfo",
".",
"path",
"&&",
"oInfo",
".",
"path",
".",
"indexOf",
"(",
"\">\"",
")",
">",
"0",
")",
"{",
"sModelName",
"=",
"oInfo",
".",
"path",
".",
"slice",
"(",
"0",
",",
"oInfo",
".",
"path",
".",
"indexOf",
"(",
"\">\"",
")",
")",
";",
"}",
"oModel",
"=",
"oWithControl",
".",
"getModel",
"(",
"sModelName",
")",
";",
"if",
"(",
"fnFormatter",
"&&",
"fnFormatter",
".",
"requiresIContext",
"===",
"true",
")",
"{",
"fnFormatter",
"=",
"oInfo",
".",
"formatter",
"=",
"fnFormatter",
".",
"bind",
"(",
"null",
",",
"createContextInterface",
"(",
"oWithControl",
",",
"mSettings",
",",
"i",
")",
")",
";",
"}",
"// wrap formatter only if there is a formatter and async is allowed and either",
"// - we use $$valueAsPromise ourselves, or",
"// - we are top-level and at least one child has used $$valueAsPromise",
"if",
"(",
"fnFormatter",
"&&",
"bAsync",
"&&",
"(",
"oModel",
"&&",
"oModel",
".",
"$$valueAsPromise",
"||",
"i",
"===",
"undefined",
"&&",
"bValueAsPromise",
")",
")",
"{",
"oInfo",
".",
"formatter",
"=",
"function",
"(",
")",
"{",
"var",
"that",
"=",
"this",
";",
"return",
"SyncPromise",
".",
"all",
"(",
"arguments",
")",
".",
"then",
"(",
"function",
"(",
"aArguments",
")",
"{",
"return",
"fnFormatter",
".",
"apply",
"(",
"that",
",",
"aArguments",
")",
";",
"}",
")",
";",
"}",
";",
"oInfo",
".",
"formatter",
".",
"textFragments",
"=",
"fnFormatter",
".",
"textFragments",
";",
"}",
"oInfo",
".",
"mode",
"=",
"BindingMode",
".",
"OneTime",
";",
"oInfo",
".",
"parameters",
"=",
"oInfo",
".",
"parameters",
"||",
"{",
"}",
";",
"oInfo",
".",
"parameters",
".",
"scope",
"=",
"oScope",
";",
"if",
"(",
"bAsync",
"&&",
"oModel",
"&&",
"oModel",
".",
"$$valueAsPromise",
")",
"{",
"// opt-in to async behavior",
"bValueAsPromise",
"=",
"oInfo",
".",
"parameters",
".",
"$$valueAsPromise",
"=",
"true",
";",
"}",
"}",
"try",
"{",
"if",
"(",
"oBindingInfo",
".",
"parts",
")",
"{",
"oBindingInfo",
".",
"parts",
".",
"forEach",
"(",
"prepare",
")",
";",
"}",
"prepare",
"(",
"oBindingInfo",
")",
";",
"oWithControl",
".",
"bindProperty",
"(",
"\"any\"",
",",
"oBindingInfo",
")",
";",
"return",
"oWithControl",
".",
"getBinding",
"(",
"\"any\"",
")",
"?",
"SyncPromise",
".",
"resolve",
"(",
"oWithControl",
".",
"getAny",
"(",
")",
")",
":",
"null",
";",
"}",
"catch",
"(",
"e",
")",
"{",
"return",
"SyncPromise",
".",
"reject",
"(",
"e",
")",
";",
"}",
"finally",
"{",
"oWithControl",
".",
"unbindProperty",
"(",
"\"any\"",
",",
"true",
")",
";",
"}",
"}"
] | Gets the value of the control's "any" property via the given binding info.
@param {sap.ui.core.util._with} oWithControl
the "with" control
@param {object} oBindingInfo
the binding info
@param {object} mSettings
map/JSON-object with initial property values, etc.
@param {object} oScope
map of currently known aliases
@param {boolean} bAsync
whether async processing is allowed
@returns {sap.ui.base.SyncPromise|null}
a sync promise which resolves with the property value or is rejected with a corresponding
error (for example, an error thrown by a formatter), or <code>null</code> in case the
binding is not ready (because it refers to a model which is not available) | [
"Gets",
"the",
"value",
"of",
"the",
"control",
"s",
"any",
"property",
"via",
"the",
"given",
"binding",
"info",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/util/XMLPreprocessor.js#L346-L408 |
3,989 | SAP/openui5 | src/sap.ui.core/src/sap/ui/core/util/XMLPreprocessor.js | stopAndGo | function stopAndGo(aElements, fnCallback) {
var i = -1;
/*
* Visits the next element, taking the result of the previous callback into account.
*
* @param {boolean} bFound
* Whether an element was approved by the corresponding callback
* @returns {sap.ui.base.SyncPromise|any}
* First call returns a <code>sap.ui.base.SyncPromise</code> which resolves with a later
* call's result.
*/
function next(bFound) {
if (bFound) {
return aElements[i];
}
i += 1;
if (i < aElements.length) {
return fnCallback(aElements[i], i, aElements).then(next);
}
}
return aElements.length
? next()
: oSyncPromiseResolved;
} | javascript | function stopAndGo(aElements, fnCallback) {
var i = -1;
/*
* Visits the next element, taking the result of the previous callback into account.
*
* @param {boolean} bFound
* Whether an element was approved by the corresponding callback
* @returns {sap.ui.base.SyncPromise|any}
* First call returns a <code>sap.ui.base.SyncPromise</code> which resolves with a later
* call's result.
*/
function next(bFound) {
if (bFound) {
return aElements[i];
}
i += 1;
if (i < aElements.length) {
return fnCallback(aElements[i], i, aElements).then(next);
}
}
return aElements.length
? next()
: oSyncPromiseResolved;
} | [
"function",
"stopAndGo",
"(",
"aElements",
",",
"fnCallback",
")",
"{",
"var",
"i",
"=",
"-",
"1",
";",
"/*\n\t\t * Visits the next element, taking the result of the previous callback into account.\n\t\t *\n\t\t * @param {boolean} bFound\n\t\t * Whether an element was approved by the corresponding callback\n\t\t * @returns {sap.ui.base.SyncPromise|any}\n\t\t * First call returns a <code>sap.ui.base.SyncPromise</code> which resolves with a later\n\t\t * call's result.\n\t\t */",
"function",
"next",
"(",
"bFound",
")",
"{",
"if",
"(",
"bFound",
")",
"{",
"return",
"aElements",
"[",
"i",
"]",
";",
"}",
"i",
"+=",
"1",
";",
"if",
"(",
"i",
"<",
"aElements",
".",
"length",
")",
"{",
"return",
"fnCallback",
"(",
"aElements",
"[",
"i",
"]",
",",
"i",
",",
"aElements",
")",
".",
"then",
"(",
"next",
")",
";",
"}",
"}",
"return",
"aElements",
".",
"length",
"?",
"next",
"(",
")",
":",
"oSyncPromiseResolved",
";",
"}"
] | Visits the given elements one-by-one, calls the given callback for each of them and stops
and waits for each sync promise returned by the callback before going on to the next element.
If a sync promise resolves with a truthy value, iteration stops and the corresponding element
becomes the result of the returned sync promise.
@param {any[]} aElements
Whatever elements we want to visit
@param {function} fnCallback
A function to be called with a single element and its index and the array (like
{@link Array#find} does it), returning a {@link sap.ui.base.SyncPromise}.
@returns {sap.ui.base.SyncPromise}
A sync promise which resolves with the first element where the callback's sync promise
resolved with a truthy value, or resolves with <code>undefined</code> as soon as the last
callback's sync promise has resolved, or is rejected with a corresponding error if any
callback returns a rejected sync promise or throws an error
@throws {Error}
If the first callback throws | [
"Visits",
"the",
"given",
"elements",
"one",
"-",
"by",
"-",
"one",
"calls",
"the",
"given",
"callback",
"for",
"each",
"of",
"them",
"and",
"stops",
"and",
"waits",
"for",
"each",
"sync",
"promise",
"returned",
"by",
"the",
"callback",
"before",
"going",
"on",
"to",
"the",
"next",
"element",
".",
"If",
"a",
"sync",
"promise",
"resolves",
"with",
"a",
"truthy",
"value",
"iteration",
"stops",
"and",
"the",
"corresponding",
"element",
"becomes",
"the",
"result",
"of",
"the",
"returned",
"sync",
"promise",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/util/XMLPreprocessor.js#L429-L454 |
3,990 | SAP/openui5 | src/sap.ui.core/src/sap/ui/core/util/XMLPreprocessor.js | function (fnVisitor, sNamespace, sLocalName) {
var fnOldVisitor = mVisitors[sNamespace];
if (fnVisitor !== null && typeof fnVisitor !== "function"
|| fnVisitor === visitNodeWrapper) {
throw new Error("Invalid visitor: " + fnVisitor);
}
if (!sNamespace || sNamespace === sNAMESPACE || sNamespace === "sap.ui.core"
|| sNamespace.indexOf(" ") >= 0) {
throw new Error("Invalid namespace: " + sNamespace);
}
Log.debug("Plug-in visitor for namespace '" + sNamespace + "', local name '"
+ sLocalName + "'", fnVisitor, sXMLPreprocessor);
if (sLocalName) {
sNamespace = sNamespace + " " + sLocalName;
fnOldVisitor = mVisitors[sNamespace] || fnOldVisitor;
}
mVisitors[sNamespace] = fnVisitor;
return fnOldVisitor || visitNodeWrapper;
} | javascript | function (fnVisitor, sNamespace, sLocalName) {
var fnOldVisitor = mVisitors[sNamespace];
if (fnVisitor !== null && typeof fnVisitor !== "function"
|| fnVisitor === visitNodeWrapper) {
throw new Error("Invalid visitor: " + fnVisitor);
}
if (!sNamespace || sNamespace === sNAMESPACE || sNamespace === "sap.ui.core"
|| sNamespace.indexOf(" ") >= 0) {
throw new Error("Invalid namespace: " + sNamespace);
}
Log.debug("Plug-in visitor for namespace '" + sNamespace + "', local name '"
+ sLocalName + "'", fnVisitor, sXMLPreprocessor);
if (sLocalName) {
sNamespace = sNamespace + " " + sLocalName;
fnOldVisitor = mVisitors[sNamespace] || fnOldVisitor;
}
mVisitors[sNamespace] = fnVisitor;
return fnOldVisitor || visitNodeWrapper;
} | [
"function",
"(",
"fnVisitor",
",",
"sNamespace",
",",
"sLocalName",
")",
"{",
"var",
"fnOldVisitor",
"=",
"mVisitors",
"[",
"sNamespace",
"]",
";",
"if",
"(",
"fnVisitor",
"!==",
"null",
"&&",
"typeof",
"fnVisitor",
"!==",
"\"function\"",
"||",
"fnVisitor",
"===",
"visitNodeWrapper",
")",
"{",
"throw",
"new",
"Error",
"(",
"\"Invalid visitor: \"",
"+",
"fnVisitor",
")",
";",
"}",
"if",
"(",
"!",
"sNamespace",
"||",
"sNamespace",
"===",
"sNAMESPACE",
"||",
"sNamespace",
"===",
"\"sap.ui.core\"",
"||",
"sNamespace",
".",
"indexOf",
"(",
"\" \"",
")",
">=",
"0",
")",
"{",
"throw",
"new",
"Error",
"(",
"\"Invalid namespace: \"",
"+",
"sNamespace",
")",
";",
"}",
"Log",
".",
"debug",
"(",
"\"Plug-in visitor for namespace '\"",
"+",
"sNamespace",
"+",
"\"', local name '\"",
"+",
"sLocalName",
"+",
"\"'\"",
",",
"fnVisitor",
",",
"sXMLPreprocessor",
")",
";",
"if",
"(",
"sLocalName",
")",
"{",
"sNamespace",
"=",
"sNamespace",
"+",
"\" \"",
"+",
"sLocalName",
";",
"fnOldVisitor",
"=",
"mVisitors",
"[",
"sNamespace",
"]",
"||",
"fnOldVisitor",
";",
"}",
"mVisitors",
"[",
"sNamespace",
"]",
"=",
"fnVisitor",
";",
"return",
"fnOldVisitor",
"||",
"visitNodeWrapper",
";",
"}"
] | Plug-in the given visitor which is called for each matching XML element.
@param {function} [fnVisitor]
Visitor function, will be called with the matching XML DOM element and a
{@link sap.ui.core.util.XMLPreprocessor.ICallback callback interface} which uses a map
of currently known variables; must return <code>undefined</code>.
Must be either a function or <code>null</code>, nothing else.
@param {string} sNamespace
The expected namespace URI; must not contain spaces;
"http://schemas.sap.com/sapui5/extension/sap.ui.core.template/1" and "sap.ui.core" are
reserved
@param {string} [sLocalName]
The expected local name; if it is missing, the local name is ignored for a match.
@returns {function}
The visitor function which previously matched elements with the given namespace and
local name, or a function which calls "visitNode" but never <code>null</code> so that
you can safely delegate to it.
In general, you cannot restore the previous state by calling <code>plugIn</code> again
with this function.
@throws {Error}
If visitor or namespace is invalid
@private | [
"Plug",
"-",
"in",
"the",
"given",
"visitor",
"which",
"is",
"called",
"for",
"each",
"matching",
"XML",
"element",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/util/XMLPreprocessor.js#L531-L550 |
|
3,991 | SAP/openui5 | src/sap.ui.core/src/sap/ui/core/util/XMLPreprocessor.js | function (aElements, fnCallback) {
try {
return SyncPromise.resolve(stopAndGo(aElements, fnCallback));
} catch (e) {
return SyncPromise.reject(e);
}
} | javascript | function (aElements, fnCallback) {
try {
return SyncPromise.resolve(stopAndGo(aElements, fnCallback));
} catch (e) {
return SyncPromise.reject(e);
}
} | [
"function",
"(",
"aElements",
",",
"fnCallback",
")",
"{",
"try",
"{",
"return",
"SyncPromise",
".",
"resolve",
"(",
"stopAndGo",
"(",
"aElements",
",",
"fnCallback",
")",
")",
";",
"}",
"catch",
"(",
"e",
")",
"{",
"return",
"SyncPromise",
".",
"reject",
"(",
"e",
")",
";",
"}",
"}"
] | Visits the given elements one-by-one, calls the given callback for each of
them and stops and waits for each thenable returned by the callback before
going on to the next element. If a thenable resolves with a truthy value,
iteration stops and the corresponding element becomes the result of the
returned thenable.
<b>Note:</b> If the visitor function is used for synchronous XML Templating,
the callback must return a sync promise; in other cases, any thenable is OK.
@param {any[]} aElements
Whatever elements we want to visit
@param {function} fnCallback
A function to be called with a single element and its index and the array
(like {@link Array#find} does it), returning a thenable, preferrably a
{@link sap.ui.base.SyncPromise}
@returns {sap.ui.base.SyncPromise}
A sync promise which resolves with the first element where the callback's
thenable resolved with a truthy value, or resolves with
<code>undefined</code> as soon as the last callback's thenable has
resolved, or is rejected with a corresponding error if any callback returns
a rejected thenable or throws an error | [
"Visits",
"the",
"given",
"elements",
"one",
"-",
"by",
"-",
"one",
"calls",
"the",
"given",
"callback",
"for",
"each",
"of",
"them",
"and",
"stops",
"and",
"waits",
"for",
"each",
"thenable",
"returned",
"by",
"the",
"callback",
"before",
"going",
"on",
"to",
"the",
"next",
"element",
".",
"If",
"a",
"thenable",
"resolves",
"with",
"a",
"truthy",
"value",
"iteration",
"stops",
"and",
"the",
"corresponding",
"element",
"becomes",
"the",
"result",
"of",
"the",
"returned",
"thenable",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/util/XMLPreprocessor.js#L644-L650 |
|
3,992 | SAP/openui5 | src/sap.ui.core/src/sap/ui/core/util/XMLPreprocessor.js | function (sPath) {
var oBindingInfo,
oModel,
sResolvedPath;
sPath = sPath || "";
if (sPath[0] === "{") {
throw new Error("Must be a simple path, not a binding: " + sPath);
}
oBindingInfo = BindingParser.simpleParser("{" + sPath + "}");
oModel = oWithControl.getModel(oBindingInfo.model);
if (!oModel) {
throw new Error("Unknown model '" + oBindingInfo.model + "': " + sPath);
}
sResolvedPath = oModel.resolve(oBindingInfo.path,
oWithControl.getBindingContext(oBindingInfo.model));
if (!sResolvedPath) {
throw new Error("Cannot resolve path: " + sPath);
}
return oModel.createBindingContext(sResolvedPath);
} | javascript | function (sPath) {
var oBindingInfo,
oModel,
sResolvedPath;
sPath = sPath || "";
if (sPath[0] === "{") {
throw new Error("Must be a simple path, not a binding: " + sPath);
}
oBindingInfo = BindingParser.simpleParser("{" + sPath + "}");
oModel = oWithControl.getModel(oBindingInfo.model);
if (!oModel) {
throw new Error("Unknown model '" + oBindingInfo.model + "': " + sPath);
}
sResolvedPath = oModel.resolve(oBindingInfo.path,
oWithControl.getBindingContext(oBindingInfo.model));
if (!sResolvedPath) {
throw new Error("Cannot resolve path: " + sPath);
}
return oModel.createBindingContext(sResolvedPath);
} | [
"function",
"(",
"sPath",
")",
"{",
"var",
"oBindingInfo",
",",
"oModel",
",",
"sResolvedPath",
";",
"sPath",
"=",
"sPath",
"||",
"\"\"",
";",
"if",
"(",
"sPath",
"[",
"0",
"]",
"===",
"\"{\"",
")",
"{",
"throw",
"new",
"Error",
"(",
"\"Must be a simple path, not a binding: \"",
"+",
"sPath",
")",
";",
"}",
"oBindingInfo",
"=",
"BindingParser",
".",
"simpleParser",
"(",
"\"{\"",
"+",
"sPath",
"+",
"\"}\"",
")",
";",
"oModel",
"=",
"oWithControl",
".",
"getModel",
"(",
"oBindingInfo",
".",
"model",
")",
";",
"if",
"(",
"!",
"oModel",
")",
"{",
"throw",
"new",
"Error",
"(",
"\"Unknown model '\"",
"+",
"oBindingInfo",
".",
"model",
"+",
"\"': \"",
"+",
"sPath",
")",
";",
"}",
"sResolvedPath",
"=",
"oModel",
".",
"resolve",
"(",
"oBindingInfo",
".",
"path",
",",
"oWithControl",
".",
"getBindingContext",
"(",
"oBindingInfo",
".",
"model",
")",
")",
";",
"if",
"(",
"!",
"sResolvedPath",
")",
"{",
"throw",
"new",
"Error",
"(",
"\"Cannot resolve path: \"",
"+",
"sPath",
")",
";",
"}",
"return",
"oModel",
".",
"createBindingContext",
"(",
"sResolvedPath",
")",
";",
"}"
] | Returns the model's context which corresponds to the given simple binding
path. Uses the map of currently known variables.
@param {string} [sPath=""]
A simple binding path which may include a model name ("a variable"), for
example "var>some/relative/path", but not a binding ("{...}")
@returns {sap.ui.model.Context}
The corresponding context which holds the model and the resolved, absolute
path
@throws {Error}
If a binding is given, if the path refers to an unknown model, or if the
path cannot be resolved (typically because a relative path was given for a
model without a binding context) | [
"Returns",
"the",
"model",
"s",
"context",
"which",
"corresponds",
"to",
"the",
"given",
"simple",
"binding",
"path",
".",
"Uses",
"the",
"map",
"of",
"currently",
"known",
"variables",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/util/XMLPreprocessor.js#L667-L687 |
|
3,993 | SAP/openui5 | src/sap.ui.core/src/sap/ui/core/util/XMLPreprocessor.js | getResolvedBinding | function getResolvedBinding(sValue, oElement, oWithControl, bMandatory,
fnCallIfConstant) {
var vBindingInfo,
oPromise;
Measurement.average(sPerformanceGetResolvedBinding, "", aPerformanceCategories);
try {
vBindingInfo
= BindingParser.complexParser(sValue, oScope, bMandatory, true, true, true)
|| sValue; // in case there is no binding and nothing to unescape
} catch (e) {
return SyncPromise.reject(e);
}
if (vBindingInfo.functionsNotFound) {
if (bMandatory) {
warn(oElement, 'Function name(s)',
vBindingInfo.functionsNotFound.join(", "), 'not found');
}
Measurement.end(sPerformanceGetResolvedBinding);
return null; // treat incomplete bindings as unrelated
}
if (typeof vBindingInfo === "object") {
oPromise = getAny(oWithControl, vBindingInfo, mSettings, oScope,
!oViewInfo.sync);
if (bMandatory && !oPromise) {
warn(oElement, 'Binding not ready');
} else if (oViewInfo.sync && oPromise && oPromise.isPending()) {
error("Async formatter in sync view in " + sValue + " of ", oElement);
}
} else {
oPromise = SyncPromise.resolve(vBindingInfo);
if (fnCallIfConstant) { // string
fnCallIfConstant();
}
}
Measurement.end(sPerformanceGetResolvedBinding);
return oPromise;
} | javascript | function getResolvedBinding(sValue, oElement, oWithControl, bMandatory,
fnCallIfConstant) {
var vBindingInfo,
oPromise;
Measurement.average(sPerformanceGetResolvedBinding, "", aPerformanceCategories);
try {
vBindingInfo
= BindingParser.complexParser(sValue, oScope, bMandatory, true, true, true)
|| sValue; // in case there is no binding and nothing to unescape
} catch (e) {
return SyncPromise.reject(e);
}
if (vBindingInfo.functionsNotFound) {
if (bMandatory) {
warn(oElement, 'Function name(s)',
vBindingInfo.functionsNotFound.join(", "), 'not found');
}
Measurement.end(sPerformanceGetResolvedBinding);
return null; // treat incomplete bindings as unrelated
}
if (typeof vBindingInfo === "object") {
oPromise = getAny(oWithControl, vBindingInfo, mSettings, oScope,
!oViewInfo.sync);
if (bMandatory && !oPromise) {
warn(oElement, 'Binding not ready');
} else if (oViewInfo.sync && oPromise && oPromise.isPending()) {
error("Async formatter in sync view in " + sValue + " of ", oElement);
}
} else {
oPromise = SyncPromise.resolve(vBindingInfo);
if (fnCallIfConstant) { // string
fnCallIfConstant();
}
}
Measurement.end(sPerformanceGetResolvedBinding);
return oPromise;
} | [
"function",
"getResolvedBinding",
"(",
"sValue",
",",
"oElement",
",",
"oWithControl",
",",
"bMandatory",
",",
"fnCallIfConstant",
")",
"{",
"var",
"vBindingInfo",
",",
"oPromise",
";",
"Measurement",
".",
"average",
"(",
"sPerformanceGetResolvedBinding",
",",
"\"\"",
",",
"aPerformanceCategories",
")",
";",
"try",
"{",
"vBindingInfo",
"=",
"BindingParser",
".",
"complexParser",
"(",
"sValue",
",",
"oScope",
",",
"bMandatory",
",",
"true",
",",
"true",
",",
"true",
")",
"||",
"sValue",
";",
"// in case there is no binding and nothing to unescape",
"}",
"catch",
"(",
"e",
")",
"{",
"return",
"SyncPromise",
".",
"reject",
"(",
"e",
")",
";",
"}",
"if",
"(",
"vBindingInfo",
".",
"functionsNotFound",
")",
"{",
"if",
"(",
"bMandatory",
")",
"{",
"warn",
"(",
"oElement",
",",
"'Function name(s)'",
",",
"vBindingInfo",
".",
"functionsNotFound",
".",
"join",
"(",
"\", \"",
")",
",",
"'not found'",
")",
";",
"}",
"Measurement",
".",
"end",
"(",
"sPerformanceGetResolvedBinding",
")",
";",
"return",
"null",
";",
"// treat incomplete bindings as unrelated",
"}",
"if",
"(",
"typeof",
"vBindingInfo",
"===",
"\"object\"",
")",
"{",
"oPromise",
"=",
"getAny",
"(",
"oWithControl",
",",
"vBindingInfo",
",",
"mSettings",
",",
"oScope",
",",
"!",
"oViewInfo",
".",
"sync",
")",
";",
"if",
"(",
"bMandatory",
"&&",
"!",
"oPromise",
")",
"{",
"warn",
"(",
"oElement",
",",
"'Binding not ready'",
")",
";",
"}",
"else",
"if",
"(",
"oViewInfo",
".",
"sync",
"&&",
"oPromise",
"&&",
"oPromise",
".",
"isPending",
"(",
")",
")",
"{",
"error",
"(",
"\"Async formatter in sync view in \"",
"+",
"sValue",
"+",
"\" of \"",
",",
"oElement",
")",
";",
"}",
"}",
"else",
"{",
"oPromise",
"=",
"SyncPromise",
".",
"resolve",
"(",
"vBindingInfo",
")",
";",
"if",
"(",
"fnCallIfConstant",
")",
"{",
"// string",
"fnCallIfConstant",
"(",
")",
";",
"}",
"}",
"Measurement",
".",
"end",
"(",
"sPerformanceGetResolvedBinding",
")",
";",
"return",
"oPromise",
";",
"}"
] | Interprets the given value as a binding and returns the resulting value; takes care
of unescaping and thus also of constant expressions.
@param {string} sValue
an XML DOM attribute value
@param {Element} oElement
the XML DOM element
@param {sap.ui.core.util._with} oWithControl
the "with" control
@param {boolean} bMandatory
whether a binding is actually required (e.g. by a <code>template:if</code>) and not
optional (e.g. for {@link resolveAttributeBinding}); if so, the binding parser
unescapes the given value (which is a prerequisite for constant expressions) and
warnings are logged for functions not found
@param {function} [fnCallIfConstant]
optional function to be called in case the return value is obviously a constant,
not influenced by any binding
@returns {sap.ui.base.SyncPromise|null}
a sync promise which resolves with the property value or is rejected with a
corresponding error (for example, an error thrown by a formatter), or
<code>null</code> in case the binding is not ready (because it refers to a model
which is not available)
@throws {Error}
if a formatter returns a promise in sync mode | [
"Interprets",
"the",
"given",
"value",
"as",
"a",
"binding",
"and",
"returns",
"the",
"resulting",
"value",
";",
"takes",
"care",
"of",
"unescaping",
"and",
"thus",
"also",
"of",
"constant",
"expressions",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/util/XMLPreprocessor.js#L1086-L1125 |
3,994 | SAP/openui5 | src/sap.ui.core/src/sap/ui/core/util/XMLPreprocessor.js | liftChildNodes | function liftChildNodes(oParent, oWithControl, oTarget) {
return visitChildNodes(oParent, oWithControl).then(function () {
var oChild;
oTarget = oTarget || oParent;
while ((oChild = oParent.firstChild)) {
oTarget.parentNode.insertBefore(oChild, oTarget);
}
});
} | javascript | function liftChildNodes(oParent, oWithControl, oTarget) {
return visitChildNodes(oParent, oWithControl).then(function () {
var oChild;
oTarget = oTarget || oParent;
while ((oChild = oParent.firstChild)) {
oTarget.parentNode.insertBefore(oChild, oTarget);
}
});
} | [
"function",
"liftChildNodes",
"(",
"oParent",
",",
"oWithControl",
",",
"oTarget",
")",
"{",
"return",
"visitChildNodes",
"(",
"oParent",
",",
"oWithControl",
")",
".",
"then",
"(",
"function",
"(",
")",
"{",
"var",
"oChild",
";",
"oTarget",
"=",
"oTarget",
"||",
"oParent",
";",
"while",
"(",
"(",
"oChild",
"=",
"oParent",
".",
"firstChild",
")",
")",
"{",
"oTarget",
".",
"parentNode",
".",
"insertBefore",
"(",
"oChild",
",",
"oTarget",
")",
";",
"}",
"}",
")",
";",
"}"
] | Visits the child nodes of the given parent element. Lifts them up by inserting them
before the target element.
@param {Element} oParent the XML DOM DOM element
@param {sap.ui.core.util._with} oWithControl the "with" control
@param {Element} [oTarget=oParent] the target DOM element
@returns {sap.ui.base.SyncPromise}
A sync promise which resolves with <code>undefined</code> as soon as visiting and
lifting is done, or is rejected with a corresponding error if visiting fails. | [
"Visits",
"the",
"child",
"nodes",
"of",
"the",
"given",
"parent",
"element",
".",
"Lifts",
"them",
"up",
"by",
"inserting",
"them",
"before",
"the",
"target",
"element",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/util/XMLPreprocessor.js#L1207-L1216 |
3,995 | SAP/openui5 | src/sap.ui.core/src/sap/ui/core/util/XMLPreprocessor.js | visitAttribute | function visitAttribute(oElement, oAttribute, oWithControl) {
if (fnSupportInfo) {
fnSupportInfo({context:undefined /*context from node clone*/, env:{caller:"visitAttribute", before: {name: oAttribute.name, value: oAttribute.value}}});
}
return resolveAttributeBinding(oElement, oAttribute, oWithControl)
.then(function () {
if (fnSupportInfo) {
fnSupportInfo({context:undefined /*context from node clone*/, env:{caller:"visitAttribute", after: {name: oAttribute.name, value: oAttribute.value}}});
}
});
} | javascript | function visitAttribute(oElement, oAttribute, oWithControl) {
if (fnSupportInfo) {
fnSupportInfo({context:undefined /*context from node clone*/, env:{caller:"visitAttribute", before: {name: oAttribute.name, value: oAttribute.value}}});
}
return resolveAttributeBinding(oElement, oAttribute, oWithControl)
.then(function () {
if (fnSupportInfo) {
fnSupportInfo({context:undefined /*context from node clone*/, env:{caller:"visitAttribute", after: {name: oAttribute.name, value: oAttribute.value}}});
}
});
} | [
"function",
"visitAttribute",
"(",
"oElement",
",",
"oAttribute",
",",
"oWithControl",
")",
"{",
"if",
"(",
"fnSupportInfo",
")",
"{",
"fnSupportInfo",
"(",
"{",
"context",
":",
"undefined",
"/*context from node clone*/",
",",
"env",
":",
"{",
"caller",
":",
"\"visitAttribute\"",
",",
"before",
":",
"{",
"name",
":",
"oAttribute",
".",
"name",
",",
"value",
":",
"oAttribute",
".",
"value",
"}",
"}",
"}",
")",
";",
"}",
"return",
"resolveAttributeBinding",
"(",
"oElement",
",",
"oAttribute",
",",
"oWithControl",
")",
".",
"then",
"(",
"function",
"(",
")",
"{",
"if",
"(",
"fnSupportInfo",
")",
"{",
"fnSupportInfo",
"(",
"{",
"context",
":",
"undefined",
"/*context from node clone*/",
",",
"env",
":",
"{",
"caller",
":",
"\"visitAttribute\"",
",",
"after",
":",
"{",
"name",
":",
"oAttribute",
".",
"name",
",",
"value",
":",
"oAttribute",
".",
"value",
"}",
"}",
"}",
")",
";",
"}",
"}",
")",
";",
"}"
] | Visits the given attribute of the given element. If the attribute value represents a
binding expression that can be resolved, it is replaced with the resulting value.
@param {Element} oElement the XML DOM element
@param {Attr} oAttribute one of the element's attribute nodes
@param {sap.ui.core.template._with} oWithControl the "with" control
@returns {sap.ui.base.SyncPromise}
A sync promise which resolves with <code>undefined</code> as soon as the
attribute's value has been replaced, or is rejected with a corresponding error if
getting the binding's value fails. | [
"Visits",
"the",
"given",
"attribute",
"of",
"the",
"given",
"element",
".",
"If",
"the",
"attribute",
"value",
"represents",
"a",
"binding",
"expression",
"that",
"can",
"be",
"resolved",
"it",
"is",
"replaced",
"with",
"the",
"resulting",
"value",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/util/XMLPreprocessor.js#L1726-L1736 |
3,996 | SAP/openui5 | src/sap.ui.core/src/sap/ui/core/util/XMLPreprocessor.js | visitAttributes | function visitAttributes(oElement, oWithControl) {
/*
* Comparator for DOM attributes by name.
*
* @param {Attr} oAttributeA
* @param {Attr} oAttributeB
* @returns {number} <0, 0, >0
*/
function comparator(oAttributeA, oAttributeB) {
return oAttributeA.name.localeCompare(oAttributeB.name);
}
return stopAndGo(
// Note: iterate over a shallow copy to account for removal of attributes!
// Note: sort attributes by name to achieve a stable log order across browsers
Array.prototype.slice.apply(oElement.attributes).sort(comparator),
function (oAttribute) {
return visitAttribute(oElement, oAttribute, oWithControl);
});
} | javascript | function visitAttributes(oElement, oWithControl) {
/*
* Comparator for DOM attributes by name.
*
* @param {Attr} oAttributeA
* @param {Attr} oAttributeB
* @returns {number} <0, 0, >0
*/
function comparator(oAttributeA, oAttributeB) {
return oAttributeA.name.localeCompare(oAttributeB.name);
}
return stopAndGo(
// Note: iterate over a shallow copy to account for removal of attributes!
// Note: sort attributes by name to achieve a stable log order across browsers
Array.prototype.slice.apply(oElement.attributes).sort(comparator),
function (oAttribute) {
return visitAttribute(oElement, oAttribute, oWithControl);
});
} | [
"function",
"visitAttributes",
"(",
"oElement",
",",
"oWithControl",
")",
"{",
"/*\n\t\t\t\t * Comparator for DOM attributes by name.\n\t\t\t\t *\n\t\t\t\t * @param {Attr} oAttributeA\n\t\t\t\t * @param {Attr} oAttributeB\n\t\t\t\t * @returns {number} <0, 0, >0\n\t\t\t\t */",
"function",
"comparator",
"(",
"oAttributeA",
",",
"oAttributeB",
")",
"{",
"return",
"oAttributeA",
".",
"name",
".",
"localeCompare",
"(",
"oAttributeB",
".",
"name",
")",
";",
"}",
"return",
"stopAndGo",
"(",
"// Note: iterate over a shallow copy to account for removal of attributes!",
"// Note: sort attributes by name to achieve a stable log order across browsers",
"Array",
".",
"prototype",
".",
"slice",
".",
"apply",
"(",
"oElement",
".",
"attributes",
")",
".",
"sort",
"(",
"comparator",
")",
",",
"function",
"(",
"oAttribute",
")",
"{",
"return",
"visitAttribute",
"(",
"oElement",
",",
"oAttribute",
",",
"oWithControl",
")",
";",
"}",
")",
";",
"}"
] | Visits all attributes of the given element. If an attribute value represents a
binding expression that can be resolved, it is replaced with the resulting value.
@param {Element} oElement the XML DOM element
@param {sap.ui.core.template._with} oWithControl the "with" control
@returns {sap.ui.base.SyncPromise}
A sync promise which resolves with <code>undefined</code> as soon as all
attributes' values have been replaced, or is rejected with a corresponding error if
getting some binding's value fails. | [
"Visits",
"all",
"attributes",
"of",
"the",
"given",
"element",
".",
"If",
"an",
"attribute",
"value",
"represents",
"a",
"binding",
"expression",
"that",
"can",
"be",
"resolved",
"it",
"is",
"replaced",
"with",
"the",
"resulting",
"value",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/util/XMLPreprocessor.js#L1749-L1768 |
3,997 | SAP/openui5 | src/sap.ui.core/src/sap/ui/core/util/XMLPreprocessor.js | visitChildNodes | function visitChildNodes(oNode, oWithControl) {
return stopAndGo(
// cache live collection so that removing a template node does not hurt
Array.prototype.slice.apply(oNode.childNodes),
function (oChild) {
return visitNode(oChild, oWithControl);
});
} | javascript | function visitChildNodes(oNode, oWithControl) {
return stopAndGo(
// cache live collection so that removing a template node does not hurt
Array.prototype.slice.apply(oNode.childNodes),
function (oChild) {
return visitNode(oChild, oWithControl);
});
} | [
"function",
"visitChildNodes",
"(",
"oNode",
",",
"oWithControl",
")",
"{",
"return",
"stopAndGo",
"(",
"// cache live collection so that removing a template node does not hurt",
"Array",
".",
"prototype",
".",
"slice",
".",
"apply",
"(",
"oNode",
".",
"childNodes",
")",
",",
"function",
"(",
"oChild",
")",
"{",
"return",
"visitNode",
"(",
"oChild",
",",
"oWithControl",
")",
";",
"}",
")",
";",
"}"
] | Visits all child nodes of the given node.
@param {Node} oNode the XML DOM node
@param {sap.ui.core.util._with} oWithControl the "with" control
@returns {sap.ui.base.SyncPromise}
A sync promise which resolves with <code>undefined</code> as soon as visiting is
done, or is rejected with a corresponding error if visiting fails. | [
"Visits",
"all",
"child",
"nodes",
"of",
"the",
"given",
"node",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/util/XMLPreprocessor.js#L1779-L1786 |
3,998 | SAP/openui5 | src/sap.ui.core/src/sap/ui/core/util/XMLPreprocessor.js | visitNode | function visitNode(oNode, oWithControl) {
var fnVisitor;
function visitAttributesAndChildren() {
return visitAttributes(oNode, oWithControl).then(function () {
return visitChildNodes(oNode, oWithControl);
}).then(function () {
if (fnSupportInfo) {
fnSupportInfo({context:oNode, env:{caller:"visitNode", after: {name: oNode.tagName}}});
}
});
}
// process only ELEMENT_NODEs
if (oNode.nodeType !== 1 /* Node.ELEMENT_NODE */) {
return oSyncPromiseResolved;
}
if (fnSupportInfo) {
fnSupportInfo({context:oNode, env:{caller:"visitNode", before: {name: oNode.tagName}}});
}
if (oNode.namespaceURI === sNAMESPACE) {
switch (oNode.localName) {
case "alias":
return templateAlias(oNode, oWithControl);
case "if":
return templateIf(oNode, oWithControl);
case "repeat":
return templateRepeat(oNode, oWithControl);
case "with":
return templateWith(oNode, oWithControl);
default:
error("Unexpected tag ", oNode);
}
} else if (oNode.namespaceURI === "sap.ui.core") {
switch (oNode.localName) {
case "ExtensionPoint":
return templateExtensionPoint(oNode, oWithControl).then(function (bResult) {
if (bResult) {
return visitAttributesAndChildren();
}
});
case "Fragment":
if (oNode.getAttribute("type") === "XML") {
return templateFragment(oNode, oWithControl);
}
break;
// no default
}
} else {
fnVisitor = mVisitors[oNode.namespaceURI + " " + oNode.localName]
|| mVisitors[oNode.namespaceURI];
if (fnVisitor) {
iNestingLevel++;
debug(oNode, "Calling visitor");
return fnVisitor(oNode, createCallbackInterface(oWithControl))
.then(function (vVisitorResult) {
if (vVisitorResult !== undefined) {
// prepare for later enhancements using return value
error("Unexpected return value from visitor for ", oNode);
}
debugFinished(oNode);
iNestingLevel -= 1;
});
}
}
return visitAttributesAndChildren();
} | javascript | function visitNode(oNode, oWithControl) {
var fnVisitor;
function visitAttributesAndChildren() {
return visitAttributes(oNode, oWithControl).then(function () {
return visitChildNodes(oNode, oWithControl);
}).then(function () {
if (fnSupportInfo) {
fnSupportInfo({context:oNode, env:{caller:"visitNode", after: {name: oNode.tagName}}});
}
});
}
// process only ELEMENT_NODEs
if (oNode.nodeType !== 1 /* Node.ELEMENT_NODE */) {
return oSyncPromiseResolved;
}
if (fnSupportInfo) {
fnSupportInfo({context:oNode, env:{caller:"visitNode", before: {name: oNode.tagName}}});
}
if (oNode.namespaceURI === sNAMESPACE) {
switch (oNode.localName) {
case "alias":
return templateAlias(oNode, oWithControl);
case "if":
return templateIf(oNode, oWithControl);
case "repeat":
return templateRepeat(oNode, oWithControl);
case "with":
return templateWith(oNode, oWithControl);
default:
error("Unexpected tag ", oNode);
}
} else if (oNode.namespaceURI === "sap.ui.core") {
switch (oNode.localName) {
case "ExtensionPoint":
return templateExtensionPoint(oNode, oWithControl).then(function (bResult) {
if (bResult) {
return visitAttributesAndChildren();
}
});
case "Fragment":
if (oNode.getAttribute("type") === "XML") {
return templateFragment(oNode, oWithControl);
}
break;
// no default
}
} else {
fnVisitor = mVisitors[oNode.namespaceURI + " " + oNode.localName]
|| mVisitors[oNode.namespaceURI];
if (fnVisitor) {
iNestingLevel++;
debug(oNode, "Calling visitor");
return fnVisitor(oNode, createCallbackInterface(oWithControl))
.then(function (vVisitorResult) {
if (vVisitorResult !== undefined) {
// prepare for later enhancements using return value
error("Unexpected return value from visitor for ", oNode);
}
debugFinished(oNode);
iNestingLevel -= 1;
});
}
}
return visitAttributesAndChildren();
} | [
"function",
"visitNode",
"(",
"oNode",
",",
"oWithControl",
")",
"{",
"var",
"fnVisitor",
";",
"function",
"visitAttributesAndChildren",
"(",
")",
"{",
"return",
"visitAttributes",
"(",
"oNode",
",",
"oWithControl",
")",
".",
"then",
"(",
"function",
"(",
")",
"{",
"return",
"visitChildNodes",
"(",
"oNode",
",",
"oWithControl",
")",
";",
"}",
")",
".",
"then",
"(",
"function",
"(",
")",
"{",
"if",
"(",
"fnSupportInfo",
")",
"{",
"fnSupportInfo",
"(",
"{",
"context",
":",
"oNode",
",",
"env",
":",
"{",
"caller",
":",
"\"visitNode\"",
",",
"after",
":",
"{",
"name",
":",
"oNode",
".",
"tagName",
"}",
"}",
"}",
")",
";",
"}",
"}",
")",
";",
"}",
"// process only ELEMENT_NODEs",
"if",
"(",
"oNode",
".",
"nodeType",
"!==",
"1",
"/* Node.ELEMENT_NODE */",
")",
"{",
"return",
"oSyncPromiseResolved",
";",
"}",
"if",
"(",
"fnSupportInfo",
")",
"{",
"fnSupportInfo",
"(",
"{",
"context",
":",
"oNode",
",",
"env",
":",
"{",
"caller",
":",
"\"visitNode\"",
",",
"before",
":",
"{",
"name",
":",
"oNode",
".",
"tagName",
"}",
"}",
"}",
")",
";",
"}",
"if",
"(",
"oNode",
".",
"namespaceURI",
"===",
"sNAMESPACE",
")",
"{",
"switch",
"(",
"oNode",
".",
"localName",
")",
"{",
"case",
"\"alias\"",
":",
"return",
"templateAlias",
"(",
"oNode",
",",
"oWithControl",
")",
";",
"case",
"\"if\"",
":",
"return",
"templateIf",
"(",
"oNode",
",",
"oWithControl",
")",
";",
"case",
"\"repeat\"",
":",
"return",
"templateRepeat",
"(",
"oNode",
",",
"oWithControl",
")",
";",
"case",
"\"with\"",
":",
"return",
"templateWith",
"(",
"oNode",
",",
"oWithControl",
")",
";",
"default",
":",
"error",
"(",
"\"Unexpected tag \"",
",",
"oNode",
")",
";",
"}",
"}",
"else",
"if",
"(",
"oNode",
".",
"namespaceURI",
"===",
"\"sap.ui.core\"",
")",
"{",
"switch",
"(",
"oNode",
".",
"localName",
")",
"{",
"case",
"\"ExtensionPoint\"",
":",
"return",
"templateExtensionPoint",
"(",
"oNode",
",",
"oWithControl",
")",
".",
"then",
"(",
"function",
"(",
"bResult",
")",
"{",
"if",
"(",
"bResult",
")",
"{",
"return",
"visitAttributesAndChildren",
"(",
")",
";",
"}",
"}",
")",
";",
"case",
"\"Fragment\"",
":",
"if",
"(",
"oNode",
".",
"getAttribute",
"(",
"\"type\"",
")",
"===",
"\"XML\"",
")",
"{",
"return",
"templateFragment",
"(",
"oNode",
",",
"oWithControl",
")",
";",
"}",
"break",
";",
"// no default",
"}",
"}",
"else",
"{",
"fnVisitor",
"=",
"mVisitors",
"[",
"oNode",
".",
"namespaceURI",
"+",
"\" \"",
"+",
"oNode",
".",
"localName",
"]",
"||",
"mVisitors",
"[",
"oNode",
".",
"namespaceURI",
"]",
";",
"if",
"(",
"fnVisitor",
")",
"{",
"iNestingLevel",
"++",
";",
"debug",
"(",
"oNode",
",",
"\"Calling visitor\"",
")",
";",
"return",
"fnVisitor",
"(",
"oNode",
",",
"createCallbackInterface",
"(",
"oWithControl",
")",
")",
".",
"then",
"(",
"function",
"(",
"vVisitorResult",
")",
"{",
"if",
"(",
"vVisitorResult",
"!==",
"undefined",
")",
"{",
"// prepare for later enhancements using return value",
"error",
"(",
"\"Unexpected return value from visitor for \"",
",",
"oNode",
")",
";",
"}",
"debugFinished",
"(",
"oNode",
")",
";",
"iNestingLevel",
"-=",
"1",
";",
"}",
")",
";",
"}",
"}",
"return",
"visitAttributesAndChildren",
"(",
")",
";",
"}"
] | Visits the given node.
@param {Node} oNode the XML DOM node
@param {sap.ui.core.template._with} oWithControl the "with" control
@returns {sap.ui.base.SyncPromise}
A sync promise which resolves with <code>undefined</code> as soon as visiting is
done, or is rejected with a corresponding error if visiting fails.
@throws {Error}
If an unexpected tag in the template namespace is encountered | [
"Visits",
"the",
"given",
"node",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/util/XMLPreprocessor.js#L1799-L1873 |
3,999 | SAP/openui5 | src/sap.ui.commons/src/sap/ui/commons/Tree.js | restoreSelectedChildren | function restoreSelectedChildren(oNode, aExpandingParents, oFirstCollapsedParent) {
var bIsExpanded = oNode.getExpanded(),
bNodeReferredInParents = false,
bIncludeInExpandingParents = bIsExpanded && !!oNode.getSelectedForNodes().length,
oFirstCollapsedParentNode = (oFirstCollapsedParent || bIsExpanded) ? oFirstCollapsedParent : oNode,
i;
//check if any of the expanded parents, that have references, refers the current node
//if so - remove the reference
for (i = 0; i < aExpandingParents.length; i++) {
if (aExpandingParents[i].getSelectedForNodes().indexOf(oNode.getId()) !== -1) {
bNodeReferredInParents = true;
aExpandingParents[i].removeAssociation("selectedForNodes", oNode, true);
}
}
//if the node is referred somewhere in its parents and it has a collapsed parent
//add a reference to the node in the first collapsed parent (if it is not already there)
if (oFirstCollapsedParentNode && bNodeReferredInParents && oFirstCollapsedParentNode !== oNode) {
if (oFirstCollapsedParentNode.getSelectedForNodes().indexOf(oNode.getId()) === -1) {
oFirstCollapsedParentNode.addAssociation("selectedForNodes", oNode, true);
}
oFirstCollapsedParentNode.$().addClass('sapUiTreeNodeSelectedParent');
}
//include the node in the expanding parents only if it has references to selected child nodes
if (bIncludeInExpandingParents) {
aExpandingParents.push(oNode);
}
var aNodes = oNode._getNodes();
for (i = 0; i < aNodes.length; i++) {
restoreSelectedChildren(aNodes[i], aExpandingParents, oFirstCollapsedParentNode);
}
//exclude the node from the expanding parents
if (bIncludeInExpandingParents) {
aExpandingParents.pop(oNode);
}
} | javascript | function restoreSelectedChildren(oNode, aExpandingParents, oFirstCollapsedParent) {
var bIsExpanded = oNode.getExpanded(),
bNodeReferredInParents = false,
bIncludeInExpandingParents = bIsExpanded && !!oNode.getSelectedForNodes().length,
oFirstCollapsedParentNode = (oFirstCollapsedParent || bIsExpanded) ? oFirstCollapsedParent : oNode,
i;
//check if any of the expanded parents, that have references, refers the current node
//if so - remove the reference
for (i = 0; i < aExpandingParents.length; i++) {
if (aExpandingParents[i].getSelectedForNodes().indexOf(oNode.getId()) !== -1) {
bNodeReferredInParents = true;
aExpandingParents[i].removeAssociation("selectedForNodes", oNode, true);
}
}
//if the node is referred somewhere in its parents and it has a collapsed parent
//add a reference to the node in the first collapsed parent (if it is not already there)
if (oFirstCollapsedParentNode && bNodeReferredInParents && oFirstCollapsedParentNode !== oNode) {
if (oFirstCollapsedParentNode.getSelectedForNodes().indexOf(oNode.getId()) === -1) {
oFirstCollapsedParentNode.addAssociation("selectedForNodes", oNode, true);
}
oFirstCollapsedParentNode.$().addClass('sapUiTreeNodeSelectedParent');
}
//include the node in the expanding parents only if it has references to selected child nodes
if (bIncludeInExpandingParents) {
aExpandingParents.push(oNode);
}
var aNodes = oNode._getNodes();
for (i = 0; i < aNodes.length; i++) {
restoreSelectedChildren(aNodes[i], aExpandingParents, oFirstCollapsedParentNode);
}
//exclude the node from the expanding parents
if (bIncludeInExpandingParents) {
aExpandingParents.pop(oNode);
}
} | [
"function",
"restoreSelectedChildren",
"(",
"oNode",
",",
"aExpandingParents",
",",
"oFirstCollapsedParent",
")",
"{",
"var",
"bIsExpanded",
"=",
"oNode",
".",
"getExpanded",
"(",
")",
",",
"bNodeReferredInParents",
"=",
"false",
",",
"bIncludeInExpandingParents",
"=",
"bIsExpanded",
"&&",
"!",
"!",
"oNode",
".",
"getSelectedForNodes",
"(",
")",
".",
"length",
",",
"oFirstCollapsedParentNode",
"=",
"(",
"oFirstCollapsedParent",
"||",
"bIsExpanded",
")",
"?",
"oFirstCollapsedParent",
":",
"oNode",
",",
"i",
";",
"//check if any of the expanded parents, that have references, refers the current node",
"//if so - remove the reference",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"aExpandingParents",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"aExpandingParents",
"[",
"i",
"]",
".",
"getSelectedForNodes",
"(",
")",
".",
"indexOf",
"(",
"oNode",
".",
"getId",
"(",
")",
")",
"!==",
"-",
"1",
")",
"{",
"bNodeReferredInParents",
"=",
"true",
";",
"aExpandingParents",
"[",
"i",
"]",
".",
"removeAssociation",
"(",
"\"selectedForNodes\"",
",",
"oNode",
",",
"true",
")",
";",
"}",
"}",
"//if the node is referred somewhere in its parents and it has a collapsed parent",
"//add a reference to the node in the first collapsed parent (if it is not already there)",
"if",
"(",
"oFirstCollapsedParentNode",
"&&",
"bNodeReferredInParents",
"&&",
"oFirstCollapsedParentNode",
"!==",
"oNode",
")",
"{",
"if",
"(",
"oFirstCollapsedParentNode",
".",
"getSelectedForNodes",
"(",
")",
".",
"indexOf",
"(",
"oNode",
".",
"getId",
"(",
")",
")",
"===",
"-",
"1",
")",
"{",
"oFirstCollapsedParentNode",
".",
"addAssociation",
"(",
"\"selectedForNodes\"",
",",
"oNode",
",",
"true",
")",
";",
"}",
"oFirstCollapsedParentNode",
".",
"$",
"(",
")",
".",
"addClass",
"(",
"'sapUiTreeNodeSelectedParent'",
")",
";",
"}",
"//include the node in the expanding parents only if it has references to selected child nodes",
"if",
"(",
"bIncludeInExpandingParents",
")",
"{",
"aExpandingParents",
".",
"push",
"(",
"oNode",
")",
";",
"}",
"var",
"aNodes",
"=",
"oNode",
".",
"_getNodes",
"(",
")",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"aNodes",
".",
"length",
";",
"i",
"++",
")",
"{",
"restoreSelectedChildren",
"(",
"aNodes",
"[",
"i",
"]",
",",
"aExpandingParents",
",",
"oFirstCollapsedParentNode",
")",
";",
"}",
"//exclude the node from the expanding parents",
"if",
"(",
"bIncludeInExpandingParents",
")",
"{",
"aExpandingParents",
".",
"pop",
"(",
"oNode",
")",
";",
"}",
"}"
] | Removes the references inside the expanded node of its selected children, because
they are no longer needed.
@param {sap.ui.commons.TreeNode} oNode The current node to look at
@param {object} aExpandingParents Array of parents of the current node that have selectedForNodes references
@param {sap.ui.commons.TreeNode} oFirstCollapsedParent The topmost collapsed parent node of the current node | [
"Removes",
"the",
"references",
"inside",
"the",
"expanded",
"node",
"of",
"its",
"selected",
"children",
"because",
"they",
"are",
"no",
"longer",
"needed",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.commons/src/sap/ui/commons/Tree.js#L518-L557 |
Subsets and Splits