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
4,300
SAP/openui5
lib/jsdoc/ui5/plugin.js
function (e) { currentProgram = undefined; currentModule = { name: null, resource: getResourceName(e.filename), module: getModuleName(getResourceName(e.filename)), localNames: Object.create(null) }; }
javascript
function (e) { currentProgram = undefined; currentModule = { name: null, resource: getResourceName(e.filename), module: getModuleName(getResourceName(e.filename)), localNames: Object.create(null) }; }
[ "function", "(", "e", ")", "{", "currentProgram", "=", "undefined", ";", "currentModule", "=", "{", "name", ":", "null", ",", "resource", ":", "getResourceName", "(", "e", ".", "filename", ")", ",", "module", ":", "getModuleName", "(", "getResourceName", "(", "e", ".", "filename", ")", ")", ",", "localNames", ":", "Object", ".", "create", "(", "null", ")", "}", ";", "}" ]
Log each file before it is parsed @param {object} e Event info object
[ "Log", "each", "file", "before", "it", "is", "parsed" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/lib/jsdoc/ui5/plugin.js#L2106-L2114
4,301
SAP/openui5
src/sap.ui.core/src/sap/ui/core/ComponentMetadata.js
function(a, fnCallback) { var o = {}; if (a) { for (var i = 0, l = a.length; i < l; i++) { var oValue = a[i]; if (typeof oValue === "string") { o[oValue] = typeof fnCallback === "function" && fnCallback(oValue) || {}; } } } return o; }
javascript
function(a, fnCallback) { var o = {}; if (a) { for (var i = 0, l = a.length; i < l; i++) { var oValue = a[i]; if (typeof oValue === "string") { o[oValue] = typeof fnCallback === "function" && fnCallback(oValue) || {}; } } } return o; }
[ "function", "(", "a", ",", "fnCallback", ")", "{", "var", "o", "=", "{", "}", ";", "if", "(", "a", ")", "{", "for", "(", "var", "i", "=", "0", ",", "l", "=", "a", ".", "length", ";", "i", "<", "l", ";", "i", "++", ")", "{", "var", "oValue", "=", "a", "[", "i", "]", ";", "if", "(", "typeof", "oValue", "===", "\"string\"", ")", "{", "o", "[", "oValue", "]", "=", "typeof", "fnCallback", "===", "\"function\"", "&&", "fnCallback", "(", "oValue", ")", "||", "{", "}", ";", "}", "}", "}", "return", "o", ";", "}" ]
this function can be outsourced in future when the ComponentMetadata is not used anymore and the new Application manifest is used - but for now we keep it as it will be one of the common use cases to have the classical ComponentMetadata and this should be transformed into the new manifest structure for compatibility converter for array with string values to object
[ "this", "function", "can", "be", "outsourced", "in", "future", "when", "the", "ComponentMetadata", "is", "not", "used", "anymore", "and", "the", "new", "Application", "manifest", "is", "used", "-", "but", "for", "now", "we", "keep", "it", "as", "it", "will", "be", "one", "of", "the", "common", "use", "cases", "to", "have", "the", "classical", "ComponentMetadata", "and", "this", "should", "be", "transformed", "into", "the", "new", "manifest", "structure", "for", "compatibility", "converter", "for", "array", "with", "string", "values", "to", "object" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/ComponentMetadata.js#L786-L797
4,302
SAP/openui5
src/sap.ui.core/src/sap/ui/core/mvc/EventHandlerResolver.js
parse
function parse(sValue) { sValue = sValue.trim(); var oTokenizer = new JSTokenizer(); var aResult = []; var sBuffer = ""; var iParenthesesCounter = 0; oTokenizer.init(sValue, 0); for (;;) { var sSymbol = oTokenizer.next(); if ( sSymbol === '"' || sSymbol === "'" ) { var pos = oTokenizer.getIndex(); oTokenizer.string(); sBuffer += sValue.slice(pos, oTokenizer.getIndex()); sSymbol = oTokenizer.getCh(); } if ( !sSymbol ) { break; } switch (sSymbol) { case "(": iParenthesesCounter++; break; case ")": iParenthesesCounter--; break; } if (sSymbol === ";" && iParenthesesCounter === 0) { aResult.push(sBuffer.trim()); sBuffer = ""; } else { sBuffer += sSymbol; } } if (sBuffer) { aResult.push(sBuffer.trim()); } return aResult; }
javascript
function parse(sValue) { sValue = sValue.trim(); var oTokenizer = new JSTokenizer(); var aResult = []; var sBuffer = ""; var iParenthesesCounter = 0; oTokenizer.init(sValue, 0); for (;;) { var sSymbol = oTokenizer.next(); if ( sSymbol === '"' || sSymbol === "'" ) { var pos = oTokenizer.getIndex(); oTokenizer.string(); sBuffer += sValue.slice(pos, oTokenizer.getIndex()); sSymbol = oTokenizer.getCh(); } if ( !sSymbol ) { break; } switch (sSymbol) { case "(": iParenthesesCounter++; break; case ")": iParenthesesCounter--; break; } if (sSymbol === ";" && iParenthesesCounter === 0) { aResult.push(sBuffer.trim()); sBuffer = ""; } else { sBuffer += sSymbol; } } if (sBuffer) { aResult.push(sBuffer.trim()); } return aResult; }
[ "function", "parse", "(", "sValue", ")", "{", "sValue", "=", "sValue", ".", "trim", "(", ")", ";", "var", "oTokenizer", "=", "new", "JSTokenizer", "(", ")", ";", "var", "aResult", "=", "[", "]", ";", "var", "sBuffer", "=", "\"\"", ";", "var", "iParenthesesCounter", "=", "0", ";", "oTokenizer", ".", "init", "(", "sValue", ",", "0", ")", ";", "for", "(", ";", ";", ")", "{", "var", "sSymbol", "=", "oTokenizer", ".", "next", "(", ")", ";", "if", "(", "sSymbol", "===", "'\"'", "||", "sSymbol", "===", "\"'\"", ")", "{", "var", "pos", "=", "oTokenizer", ".", "getIndex", "(", ")", ";", "oTokenizer", ".", "string", "(", ")", ";", "sBuffer", "+=", "sValue", ".", "slice", "(", "pos", ",", "oTokenizer", ".", "getIndex", "(", ")", ")", ";", "sSymbol", "=", "oTokenizer", ".", "getCh", "(", ")", ";", "}", "if", "(", "!", "sSymbol", ")", "{", "break", ";", "}", "switch", "(", "sSymbol", ")", "{", "case", "\"(\"", ":", "iParenthesesCounter", "++", ";", "break", ";", "case", "\")\"", ":", "iParenthesesCounter", "--", ";", "break", ";", "}", "if", "(", "sSymbol", "===", "\";\"", "&&", "iParenthesesCounter", "===", "0", ")", "{", "aResult", ".", "push", "(", "sBuffer", ".", "trim", "(", ")", ")", ";", "sBuffer", "=", "\"\"", ";", "}", "else", "{", "sBuffer", "+=", "sSymbol", ";", "}", "}", "if", "(", "sBuffer", ")", "{", "aResult", ".", "push", "(", "sBuffer", ".", "trim", "(", ")", ")", ";", "}", "return", "aResult", ";", "}" ]
Parses and splits the incoming string into meaningful event handler definitions Examples: parse(".fnControllerMethod") => [".fnControllerMethod"] parse(".doSomething('Hello World'); .doSomething2('string'); globalFunction") => [".doSomething('Hello World')", ".doSomething2('string')", "globalFunction"] parse(".fnControllerMethod; .fnControllerMethod(${ path:'/someModelProperty', formatter: '.myFormatter', type: 'sap.ui.model.type.String'} ); globalFunction") => [".fnControllerMethod", ".fnControllerMethod(${ path:'/someModelProperty', formatter: '.myFormatter', type: 'sap.ui.model.type.String'} )", "globalFunction"] @param [string] sValue - Incoming string @return {string[]} - Array of event handler definitions
[ "Parses", "and", "splits", "the", "incoming", "string", "into", "meaningful", "event", "handler", "definitions" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/mvc/EventHandlerResolver.js#L205-L246
4,303
SAP/openui5
src/sap.ui.core/src/sap/ui/core/mvc/View.js
initPreprocessor
function initPreprocessor(oPreprocessor, bAsync) { var oPreprocessorImpl; if (typeof oPreprocessor.preprocessor === "string") { var sPreprocessorName = oPreprocessor.preprocessor.replace(/\./g, "/"); // module string given, resolve and retrieve object if (bAsync) { return new Promise(function(resolve, reject) { sap.ui.require([sPreprocessorName], function(oPreprocessorImpl) { resolve(oPreprocessorImpl); }); }); } else { return sap.ui.requireSync(sPreprocessorName); } } else if (typeof oPreprocessor.preprocessor === "function" && !oPreprocessor.preprocessor.process) { oPreprocessorImpl = { process: oPreprocessor.preprocessor }; } else { oPreprocessorImpl = oPreprocessor.preprocessor; } if (bAsync) { return Promise.resolve(oPreprocessorImpl); } else { return oPreprocessorImpl; } }
javascript
function initPreprocessor(oPreprocessor, bAsync) { var oPreprocessorImpl; if (typeof oPreprocessor.preprocessor === "string") { var sPreprocessorName = oPreprocessor.preprocessor.replace(/\./g, "/"); // module string given, resolve and retrieve object if (bAsync) { return new Promise(function(resolve, reject) { sap.ui.require([sPreprocessorName], function(oPreprocessorImpl) { resolve(oPreprocessorImpl); }); }); } else { return sap.ui.requireSync(sPreprocessorName); } } else if (typeof oPreprocessor.preprocessor === "function" && !oPreprocessor.preprocessor.process) { oPreprocessorImpl = { process: oPreprocessor.preprocessor }; } else { oPreprocessorImpl = oPreprocessor.preprocessor; } if (bAsync) { return Promise.resolve(oPreprocessorImpl); } else { return oPreprocessorImpl; } }
[ "function", "initPreprocessor", "(", "oPreprocessor", ",", "bAsync", ")", "{", "var", "oPreprocessorImpl", ";", "if", "(", "typeof", "oPreprocessor", ".", "preprocessor", "===", "\"string\"", ")", "{", "var", "sPreprocessorName", "=", "oPreprocessor", ".", "preprocessor", ".", "replace", "(", "/", "\\.", "/", "g", ",", "\"/\"", ")", ";", "// module string given, resolve and retrieve object", "if", "(", "bAsync", ")", "{", "return", "new", "Promise", "(", "function", "(", "resolve", ",", "reject", ")", "{", "sap", ".", "ui", ".", "require", "(", "[", "sPreprocessorName", "]", ",", "function", "(", "oPreprocessorImpl", ")", "{", "resolve", "(", "oPreprocessorImpl", ")", ";", "}", ")", ";", "}", ")", ";", "}", "else", "{", "return", "sap", ".", "ui", ".", "requireSync", "(", "sPreprocessorName", ")", ";", "}", "}", "else", "if", "(", "typeof", "oPreprocessor", ".", "preprocessor", "===", "\"function\"", "&&", "!", "oPreprocessor", ".", "preprocessor", ".", "process", ")", "{", "oPreprocessorImpl", "=", "{", "process", ":", "oPreprocessor", ".", "preprocessor", "}", ";", "}", "else", "{", "oPreprocessorImpl", "=", "oPreprocessor", ".", "preprocessor", ";", "}", "if", "(", "bAsync", ")", "{", "return", "Promise", ".", "resolve", "(", "oPreprocessorImpl", ")", ";", "}", "else", "{", "return", "oPreprocessorImpl", ";", "}", "}" ]
resolves either the module dependency or the function which was passed to settings to the internal preprocessor config object @param {object} oPreprocessor Preprocessor config object @param {boolean} bAsync Whether processing is async or not @return {object} oPreprocessorImpl @private
[ "resolves", "either", "the", "module", "dependency", "or", "the", "function", "which", "was", "passed", "to", "settings", "to", "the", "internal", "preprocessor", "config", "object" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/mvc/View.js#L231-L259
4,304
SAP/openui5
src/sap.ui.core/src/sap/ui/core/mvc/View.js
initPreprocessorQueues
function initPreprocessorQueues(oView, mSettings) { var oViewClass = oView.getMetadata().getClass(); function resolvePreprocessors(oPreprocessor) { oPreprocessor.preprocessor = initPreprocessor(oPreprocessor, mSettings.async); } // shallow copy to avoid issues when manipulating the internal object structure oView.mPreprocessors = jQuery.extend({}, mSettings.preprocessors); for (var _sType in oViewClass.PreprocessorType) { // build the array structure var sType = oViewClass.PreprocessorType[_sType]; if (oView.mPreprocessors[sType] && !Array.isArray(oView.mPreprocessors[sType])) { oView.mPreprocessors[sType] = [oView.mPreprocessors[sType]]; } else if (!oView.mPreprocessors[sType]) { oView.mPreprocessors[sType] = []; } oView.mPreprocessors[sType].forEach(alignPreprocessorStructure); oView.mPreprocessors[sType] = getPreprocessorQueue.call(oView, oViewClass._sType, sType); oView.mPreprocessors[sType].forEach(resolvePreprocessors); } }
javascript
function initPreprocessorQueues(oView, mSettings) { var oViewClass = oView.getMetadata().getClass(); function resolvePreprocessors(oPreprocessor) { oPreprocessor.preprocessor = initPreprocessor(oPreprocessor, mSettings.async); } // shallow copy to avoid issues when manipulating the internal object structure oView.mPreprocessors = jQuery.extend({}, mSettings.preprocessors); for (var _sType in oViewClass.PreprocessorType) { // build the array structure var sType = oViewClass.PreprocessorType[_sType]; if (oView.mPreprocessors[sType] && !Array.isArray(oView.mPreprocessors[sType])) { oView.mPreprocessors[sType] = [oView.mPreprocessors[sType]]; } else if (!oView.mPreprocessors[sType]) { oView.mPreprocessors[sType] = []; } oView.mPreprocessors[sType].forEach(alignPreprocessorStructure); oView.mPreprocessors[sType] = getPreprocessorQueue.call(oView, oViewClass._sType, sType); oView.mPreprocessors[sType].forEach(resolvePreprocessors); } }
[ "function", "initPreprocessorQueues", "(", "oView", ",", "mSettings", ")", "{", "var", "oViewClass", "=", "oView", ".", "getMetadata", "(", ")", ".", "getClass", "(", ")", ";", "function", "resolvePreprocessors", "(", "oPreprocessor", ")", "{", "oPreprocessor", ".", "preprocessor", "=", "initPreprocessor", "(", "oPreprocessor", ",", "mSettings", ".", "async", ")", ";", "}", "// shallow copy to avoid issues when manipulating the internal object structure", "oView", ".", "mPreprocessors", "=", "jQuery", ".", "extend", "(", "{", "}", ",", "mSettings", ".", "preprocessors", ")", ";", "for", "(", "var", "_sType", "in", "oViewClass", ".", "PreprocessorType", ")", "{", "// build the array structure", "var", "sType", "=", "oViewClass", ".", "PreprocessorType", "[", "_sType", "]", ";", "if", "(", "oView", ".", "mPreprocessors", "[", "sType", "]", "&&", "!", "Array", ".", "isArray", "(", "oView", ".", "mPreprocessors", "[", "sType", "]", ")", ")", "{", "oView", ".", "mPreprocessors", "[", "sType", "]", "=", "[", "oView", ".", "mPreprocessors", "[", "sType", "]", "]", ";", "}", "else", "if", "(", "!", "oView", ".", "mPreprocessors", "[", "sType", "]", ")", "{", "oView", ".", "mPreprocessors", "[", "sType", "]", "=", "[", "]", ";", "}", "oView", ".", "mPreprocessors", "[", "sType", "]", ".", "forEach", "(", "alignPreprocessorStructure", ")", ";", "oView", ".", "mPreprocessors", "[", "sType", "]", "=", "getPreprocessorQueue", ".", "call", "(", "oView", ",", "oViewClass", ".", "_sType", ",", "sType", ")", ";", "oView", ".", "mPreprocessors", "[", "sType", "]", ".", "forEach", "(", "resolvePreprocessors", ")", ";", "}", "}" ]
init internal registry and convert single declarations to array, for compatibility @param {sap.ui.core.mvc.View} oView This view instance @param {object} mSettings Settings for the view @private
[ "init", "internal", "registry", "and", "convert", "single", "declarations", "to", "array", "for", "compatibility" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/mvc/View.js#L308-L329
4,305
SAP/openui5
src/sap.ui.core/src/sap/ui/core/mvc/View.js
function(oThis, mSettings) { if (!sap.ui.getCore().getConfiguration().getControllerCodeDeactivated()) { // only set when used internally var oController = mSettings.controller, sName = oController && typeof oController.getMetadata === "function" && oController.getMetadata().getName(), bAsync = mSettings.async; if (!oController && oThis.getControllerName) { // get optional default controller name var defaultController = oThis.getControllerName(); if (defaultController) { // check for controller replacement var CustomizingConfiguration = sap.ui.require('sap/ui/core/CustomizingConfiguration'); var sControllerReplacement = CustomizingConfiguration && CustomizingConfiguration.getControllerReplacement(defaultController, ManagedObject._sOwnerId); if (sControllerReplacement) { defaultController = typeof sControllerReplacement === "string" ? sControllerReplacement : sControllerReplacement.controllerName; } // create controller if (bAsync) { oController = Controller.create({name: defaultController}); } else { oController = sap.ui.controller(defaultController, true /* oControllerImpl = true: do not extend controller inside factory; happens below (potentially async)! */); } } } else if (oController) { // if passed controller is not extended yet we need to do it. var sOwnerId = ManagedObject._sOwnerId; if (!oController._isExtended()) { if (bAsync) { oController = Controller.extendByCustomizing(oController, sName, bAsync) .then(function(oController) { return Controller.extendByProvider(oController, sName, sOwnerId, bAsync); }); } else { oController = Controller.extendByCustomizing(oController, sName, bAsync); oController = Controller.extendByProvider(oController, sName, sOwnerId, bAsync); } } else if (bAsync) { oController = Promise.resolve(oController); } } if ( oController ) { var connectToView = function(oController) { oThis.oController = oController; oController.oView = oThis; }; if (bAsync) { if (!oThis.oAsyncState) { throw new Error("The view " + oThis.sViewName + " runs in sync mode and therefore cannot use async controller extensions!"); } return oController.then(connectToView); } else { connectToView(oController); } } } else { sap.ui.controller("sap.ui.core.mvc.EmptyControllerImpl", {"_sap.ui.core.mvc.EmptyControllerImpl":true}); oThis.oController = sap.ui.controller("sap.ui.core.mvc.EmptyControllerImpl"); } }
javascript
function(oThis, mSettings) { if (!sap.ui.getCore().getConfiguration().getControllerCodeDeactivated()) { // only set when used internally var oController = mSettings.controller, sName = oController && typeof oController.getMetadata === "function" && oController.getMetadata().getName(), bAsync = mSettings.async; if (!oController && oThis.getControllerName) { // get optional default controller name var defaultController = oThis.getControllerName(); if (defaultController) { // check for controller replacement var CustomizingConfiguration = sap.ui.require('sap/ui/core/CustomizingConfiguration'); var sControllerReplacement = CustomizingConfiguration && CustomizingConfiguration.getControllerReplacement(defaultController, ManagedObject._sOwnerId); if (sControllerReplacement) { defaultController = typeof sControllerReplacement === "string" ? sControllerReplacement : sControllerReplacement.controllerName; } // create controller if (bAsync) { oController = Controller.create({name: defaultController}); } else { oController = sap.ui.controller(defaultController, true /* oControllerImpl = true: do not extend controller inside factory; happens below (potentially async)! */); } } } else if (oController) { // if passed controller is not extended yet we need to do it. var sOwnerId = ManagedObject._sOwnerId; if (!oController._isExtended()) { if (bAsync) { oController = Controller.extendByCustomizing(oController, sName, bAsync) .then(function(oController) { return Controller.extendByProvider(oController, sName, sOwnerId, bAsync); }); } else { oController = Controller.extendByCustomizing(oController, sName, bAsync); oController = Controller.extendByProvider(oController, sName, sOwnerId, bAsync); } } else if (bAsync) { oController = Promise.resolve(oController); } } if ( oController ) { var connectToView = function(oController) { oThis.oController = oController; oController.oView = oThis; }; if (bAsync) { if (!oThis.oAsyncState) { throw new Error("The view " + oThis.sViewName + " runs in sync mode and therefore cannot use async controller extensions!"); } return oController.then(connectToView); } else { connectToView(oController); } } } else { sap.ui.controller("sap.ui.core.mvc.EmptyControllerImpl", {"_sap.ui.core.mvc.EmptyControllerImpl":true}); oThis.oController = sap.ui.controller("sap.ui.core.mvc.EmptyControllerImpl"); } }
[ "function", "(", "oThis", ",", "mSettings", ")", "{", "if", "(", "!", "sap", ".", "ui", ".", "getCore", "(", ")", ".", "getConfiguration", "(", ")", ".", "getControllerCodeDeactivated", "(", ")", ")", "{", "// only set when used internally", "var", "oController", "=", "mSettings", ".", "controller", ",", "sName", "=", "oController", "&&", "typeof", "oController", ".", "getMetadata", "===", "\"function\"", "&&", "oController", ".", "getMetadata", "(", ")", ".", "getName", "(", ")", ",", "bAsync", "=", "mSettings", ".", "async", ";", "if", "(", "!", "oController", "&&", "oThis", ".", "getControllerName", ")", "{", "// get optional default controller name", "var", "defaultController", "=", "oThis", ".", "getControllerName", "(", ")", ";", "if", "(", "defaultController", ")", "{", "// check for controller replacement", "var", "CustomizingConfiguration", "=", "sap", ".", "ui", ".", "require", "(", "'sap/ui/core/CustomizingConfiguration'", ")", ";", "var", "sControllerReplacement", "=", "CustomizingConfiguration", "&&", "CustomizingConfiguration", ".", "getControllerReplacement", "(", "defaultController", ",", "ManagedObject", ".", "_sOwnerId", ")", ";", "if", "(", "sControllerReplacement", ")", "{", "defaultController", "=", "typeof", "sControllerReplacement", "===", "\"string\"", "?", "sControllerReplacement", ":", "sControllerReplacement", ".", "controllerName", ";", "}", "// create controller", "if", "(", "bAsync", ")", "{", "oController", "=", "Controller", ".", "create", "(", "{", "name", ":", "defaultController", "}", ")", ";", "}", "else", "{", "oController", "=", "sap", ".", "ui", ".", "controller", "(", "defaultController", ",", "true", "/* oControllerImpl = true: do not extend controller inside factory; happens below (potentially async)! */", ")", ";", "}", "}", "}", "else", "if", "(", "oController", ")", "{", "// if passed controller is not extended yet we need to do it.", "var", "sOwnerId", "=", "ManagedObject", ".", "_sOwnerId", ";", "if", "(", "!", "oController", ".", "_isExtended", "(", ")", ")", "{", "if", "(", "bAsync", ")", "{", "oController", "=", "Controller", ".", "extendByCustomizing", "(", "oController", ",", "sName", ",", "bAsync", ")", ".", "then", "(", "function", "(", "oController", ")", "{", "return", "Controller", ".", "extendByProvider", "(", "oController", ",", "sName", ",", "sOwnerId", ",", "bAsync", ")", ";", "}", ")", ";", "}", "else", "{", "oController", "=", "Controller", ".", "extendByCustomizing", "(", "oController", ",", "sName", ",", "bAsync", ")", ";", "oController", "=", "Controller", ".", "extendByProvider", "(", "oController", ",", "sName", ",", "sOwnerId", ",", "bAsync", ")", ";", "}", "}", "else", "if", "(", "bAsync", ")", "{", "oController", "=", "Promise", ".", "resolve", "(", "oController", ")", ";", "}", "}", "if", "(", "oController", ")", "{", "var", "connectToView", "=", "function", "(", "oController", ")", "{", "oThis", ".", "oController", "=", "oController", ";", "oController", ".", "oView", "=", "oThis", ";", "}", ";", "if", "(", "bAsync", ")", "{", "if", "(", "!", "oThis", ".", "oAsyncState", ")", "{", "throw", "new", "Error", "(", "\"The view \"", "+", "oThis", ".", "sViewName", "+", "\" runs in sync mode and therefore cannot use async controller extensions!\"", ")", ";", "}", "return", "oController", ".", "then", "(", "connectToView", ")", ";", "}", "else", "{", "connectToView", "(", "oController", ")", ";", "}", "}", "}", "else", "{", "sap", ".", "ui", ".", "controller", "(", "\"sap.ui.core.mvc.EmptyControllerImpl\"", ",", "{", "\"_sap.ui.core.mvc.EmptyControllerImpl\"", ":", "true", "}", ")", ";", "oThis", ".", "oController", "=", "sap", ".", "ui", ".", "controller", "(", "\"sap.ui.core.mvc.EmptyControllerImpl\"", ")", ";", "}", "}" ]
Creates and connects the controller if the controller is not given in the mSettings @param {sap.ui.core.mvc.XMLView} oThis the instance of the view that should be processed @param {object} [mSettings] Settings @returns {Promise|undefined} A promise for asynchronous or undefined for synchronous controllers @throws {Error} @private
[ "Creates", "and", "connects", "the", "controller", "if", "the", "controller", "is", "not", "given", "in", "the", "mSettings" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/mvc/View.js#L346-L408
4,306
SAP/openui5
lib/jsdoc/transform-apijson-for-sdk.js
preProcessSymbols
function preProcessSymbols(symbols) { // Create treeName and modify module names symbols.forEach(oSymbol => { let sModuleClearName = oSymbol.name.replace(/^module:/, ""); oSymbol.displayName = sModuleClearName; oSymbol.treeName = sModuleClearName.replace(/\//g, "."); }); // Create missing - virtual namespaces symbols.forEach(oSymbol => { oSymbol.treeName.split(".").forEach((sPart, i, a) => { let sName = a.slice(0, (i + 1)).join("."); if (!symbols.find(o => o.treeName === sName)) { symbols.push({ name: sName, displayName: sName, treeName: sName, lib: oSymbol.lib, kind: "namespace" }); } }); }); // Discover parents symbols.forEach(oSymbol => { let aParent = oSymbol.treeName.split("."), sParent; // Extract parent name aParent.pop(); sParent = aParent.join("."); // Mark parent if (symbols.find(({treeName}) => treeName === sParent)) { oSymbol.parent = sParent; } }); // Attach children info symbols.forEach(oSymbol => { if (oSymbol.parent) { let oParent = symbols.find(({treeName}) => treeName === oSymbol.parent); if (!oParent.nodes) oParent.nodes = []; oParent.nodes.push({ name: oSymbol.displayName, description: formatters._preProcessLinksInTextBlock(oSymbol.description), href: "#/api/" + encodeURIComponent(oSymbol.name) }); } }); // Clean list - keep file size down symbols.forEach(o => { delete o.treeName; delete o.parent; }); }
javascript
function preProcessSymbols(symbols) { // Create treeName and modify module names symbols.forEach(oSymbol => { let sModuleClearName = oSymbol.name.replace(/^module:/, ""); oSymbol.displayName = sModuleClearName; oSymbol.treeName = sModuleClearName.replace(/\//g, "."); }); // Create missing - virtual namespaces symbols.forEach(oSymbol => { oSymbol.treeName.split(".").forEach((sPart, i, a) => { let sName = a.slice(0, (i + 1)).join("."); if (!symbols.find(o => o.treeName === sName)) { symbols.push({ name: sName, displayName: sName, treeName: sName, lib: oSymbol.lib, kind: "namespace" }); } }); }); // Discover parents symbols.forEach(oSymbol => { let aParent = oSymbol.treeName.split("."), sParent; // Extract parent name aParent.pop(); sParent = aParent.join("."); // Mark parent if (symbols.find(({treeName}) => treeName === sParent)) { oSymbol.parent = sParent; } }); // Attach children info symbols.forEach(oSymbol => { if (oSymbol.parent) { let oParent = symbols.find(({treeName}) => treeName === oSymbol.parent); if (!oParent.nodes) oParent.nodes = []; oParent.nodes.push({ name: oSymbol.displayName, description: formatters._preProcessLinksInTextBlock(oSymbol.description), href: "#/api/" + encodeURIComponent(oSymbol.name) }); } }); // Clean list - keep file size down symbols.forEach(o => { delete o.treeName; delete o.parent; }); }
[ "function", "preProcessSymbols", "(", "symbols", ")", "{", "// Create treeName and modify module names", "symbols", ".", "forEach", "(", "oSymbol", "=>", "{", "let", "sModuleClearName", "=", "oSymbol", ".", "name", ".", "replace", "(", "/", "^module:", "/", ",", "\"\"", ")", ";", "oSymbol", ".", "displayName", "=", "sModuleClearName", ";", "oSymbol", ".", "treeName", "=", "sModuleClearName", ".", "replace", "(", "/", "\\/", "/", "g", ",", "\".\"", ")", ";", "}", ")", ";", "// Create missing - virtual namespaces", "symbols", ".", "forEach", "(", "oSymbol", "=>", "{", "oSymbol", ".", "treeName", ".", "split", "(", "\".\"", ")", ".", "forEach", "(", "(", "sPart", ",", "i", ",", "a", ")", "=>", "{", "let", "sName", "=", "a", ".", "slice", "(", "0", ",", "(", "i", "+", "1", ")", ")", ".", "join", "(", "\".\"", ")", ";", "if", "(", "!", "symbols", ".", "find", "(", "o", "=>", "o", ".", "treeName", "===", "sName", ")", ")", "{", "symbols", ".", "push", "(", "{", "name", ":", "sName", ",", "displayName", ":", "sName", ",", "treeName", ":", "sName", ",", "lib", ":", "oSymbol", ".", "lib", ",", "kind", ":", "\"namespace\"", "}", ")", ";", "}", "}", ")", ";", "}", ")", ";", "// Discover parents", "symbols", ".", "forEach", "(", "oSymbol", "=>", "{", "let", "aParent", "=", "oSymbol", ".", "treeName", ".", "split", "(", "\".\"", ")", ",", "sParent", ";", "// Extract parent name", "aParent", ".", "pop", "(", ")", ";", "sParent", "=", "aParent", ".", "join", "(", "\".\"", ")", ";", "// Mark parent", "if", "(", "symbols", ".", "find", "(", "(", "{", "treeName", "}", ")", "=>", "treeName", "===", "sParent", ")", ")", "{", "oSymbol", ".", "parent", "=", "sParent", ";", "}", "}", ")", ";", "// Attach children info", "symbols", ".", "forEach", "(", "oSymbol", "=>", "{", "if", "(", "oSymbol", ".", "parent", ")", "{", "let", "oParent", "=", "symbols", ".", "find", "(", "(", "{", "treeName", "}", ")", "=>", "treeName", "===", "oSymbol", ".", "parent", ")", ";", "if", "(", "!", "oParent", ".", "nodes", ")", "oParent", ".", "nodes", "=", "[", "]", ";", "oParent", ".", "nodes", ".", "push", "(", "{", "name", ":", "oSymbol", ".", "displayName", ",", "description", ":", "formatters", ".", "_preProcessLinksInTextBlock", "(", "oSymbol", ".", "description", ")", ",", "href", ":", "\"#/api/\"", "+", "encodeURIComponent", "(", "oSymbol", ".", "name", ")", "}", ")", ";", "}", "}", ")", ";", "// Clean list - keep file size down", "symbols", ".", "forEach", "(", "o", "=>", "{", "delete", "o", ".", "treeName", ";", "delete", "o", ".", "parent", ";", "}", ")", ";", "}" ]
Pre-processes the symbols list - creating virtual namespace records and attaching children list to namespace records. @param {object} symbols list
[ "Pre", "-", "processes", "the", "symbols", "list", "-", "creating", "virtual", "namespace", "records", "and", "attaching", "children", "list", "to", "namespace", "records", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/lib/jsdoc/transform-apijson-for-sdk.js#L92-L151
4,307
SAP/openui5
lib/jsdoc/transform-apijson-for-sdk.js
createApiRefApiJson
function createApiRefApiJson(oChainObject) { if (returnOutputFiles) { // If requested, return data instead of writing to FS (required by UI5 Tooling/UI5 Builder) return JSON.stringify(oChainObject.parsedData); } let sOutputDir = path.dirname(oChainObject.outputFile); // Create dir if it does not exist if (!fs.existsSync(sOutputDir)) { fs.mkdirSync(sOutputDir); } // Write result to file fs.writeFileSync(oChainObject.outputFile, JSON.stringify(oChainObject.parsedData) /* Transform back to string */, 'utf8'); }
javascript
function createApiRefApiJson(oChainObject) { if (returnOutputFiles) { // If requested, return data instead of writing to FS (required by UI5 Tooling/UI5 Builder) return JSON.stringify(oChainObject.parsedData); } let sOutputDir = path.dirname(oChainObject.outputFile); // Create dir if it does not exist if (!fs.existsSync(sOutputDir)) { fs.mkdirSync(sOutputDir); } // Write result to file fs.writeFileSync(oChainObject.outputFile, JSON.stringify(oChainObject.parsedData) /* Transform back to string */, 'utf8'); }
[ "function", "createApiRefApiJson", "(", "oChainObject", ")", "{", "if", "(", "returnOutputFiles", ")", "{", "// If requested, return data instead of writing to FS (required by UI5 Tooling/UI5 Builder)", "return", "JSON", ".", "stringify", "(", "oChainObject", ".", "parsedData", ")", ";", "}", "let", "sOutputDir", "=", "path", ".", "dirname", "(", "oChainObject", ".", "outputFile", ")", ";", "// Create dir if it does not exist", "if", "(", "!", "fs", ".", "existsSync", "(", "sOutputDir", ")", ")", "{", "fs", ".", "mkdirSync", "(", "sOutputDir", ")", ";", "}", "// Write result to file", "fs", ".", "writeFileSync", "(", "oChainObject", ".", "outputFile", ",", "JSON", ".", "stringify", "(", "oChainObject", ".", "parsedData", ")", "/* Transform back to string */", ",", "'utf8'", ")", ";", "}" ]
Create api.json from parsed data @param oChainObject chain object
[ "Create", "api", ".", "json", "from", "parsed", "data" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/lib/jsdoc/transform-apijson-for-sdk.js#L747-L761
4,308
SAP/openui5
lib/jsdoc/transform-apijson-for-sdk.js
getLibraryPromise
function getLibraryPromise(oChainObject) { return new Promise(function(oResolve) { fs.readFile(oChainObject.libraryFile, 'utf8', (oError, oData) => { oChainObject.libraryFileData = oData; oResolve(oChainObject); }); }); }
javascript
function getLibraryPromise(oChainObject) { return new Promise(function(oResolve) { fs.readFile(oChainObject.libraryFile, 'utf8', (oError, oData) => { oChainObject.libraryFileData = oData; oResolve(oChainObject); }); }); }
[ "function", "getLibraryPromise", "(", "oChainObject", ")", "{", "return", "new", "Promise", "(", "function", "(", "oResolve", ")", "{", "fs", ".", "readFile", "(", "oChainObject", ".", "libraryFile", ",", "'utf8'", ",", "(", "oError", ",", "oData", ")", "=>", "{", "oChainObject", ".", "libraryFileData", "=", "oData", ";", "oResolve", "(", "oChainObject", ")", ";", "}", ")", ";", "}", ")", ";", "}" ]
Load .library file @param oChainObject chain return object @returns {Promise} library file promise
[ "Load", ".", "library", "file" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/lib/jsdoc/transform-apijson-for-sdk.js#L768-L775
4,309
SAP/openui5
lib/jsdoc/transform-apijson-for-sdk.js
extractComponentAndDocuindexUrl
function extractComponentAndDocuindexUrl(oChainObject) { oChainObject.modules = []; if (oChainObject.libraryFileData) { let $ = cheerio.load(oChainObject.libraryFileData, { ignoreWhitespace: true, xmlMode: true, lowerCaseTags: false }); // Extract documentation URL oChainObject.docuPath = $("appData documentation").attr("indexUrl"); // Extract components $("ownership > component").each((i, oComponent) => { if (oComponent.children) { if (oComponent.children.length === 1) { oChainObject.defaultComponent = $(oComponent).text(); } else { let sCurrentComponentName = $(oComponent).find("name").text(); let aCurrentModules = []; $(oComponent).find("module").each((a, oC) => { aCurrentModules.push($(oC).text().replace(/\//g, ".")); }); oChainObject.modules.push({ componentName: sCurrentComponentName, modules: aCurrentModules }); } } }); } return oChainObject; }
javascript
function extractComponentAndDocuindexUrl(oChainObject) { oChainObject.modules = []; if (oChainObject.libraryFileData) { let $ = cheerio.load(oChainObject.libraryFileData, { ignoreWhitespace: true, xmlMode: true, lowerCaseTags: false }); // Extract documentation URL oChainObject.docuPath = $("appData documentation").attr("indexUrl"); // Extract components $("ownership > component").each((i, oComponent) => { if (oComponent.children) { if (oComponent.children.length === 1) { oChainObject.defaultComponent = $(oComponent).text(); } else { let sCurrentComponentName = $(oComponent).find("name").text(); let aCurrentModules = []; $(oComponent).find("module").each((a, oC) => { aCurrentModules.push($(oC).text().replace(/\//g, ".")); }); oChainObject.modules.push({ componentName: sCurrentComponentName, modules: aCurrentModules }); } } }); } return oChainObject; }
[ "function", "extractComponentAndDocuindexUrl", "(", "oChainObject", ")", "{", "oChainObject", ".", "modules", "=", "[", "]", ";", "if", "(", "oChainObject", ".", "libraryFileData", ")", "{", "let", "$", "=", "cheerio", ".", "load", "(", "oChainObject", ".", "libraryFileData", ",", "{", "ignoreWhitespace", ":", "true", ",", "xmlMode", ":", "true", ",", "lowerCaseTags", ":", "false", "}", ")", ";", "// Extract documentation URL", "oChainObject", ".", "docuPath", "=", "$", "(", "\"appData documentation\"", ")", ".", "attr", "(", "\"indexUrl\"", ")", ";", "// Extract components", "$", "(", "\"ownership > component\"", ")", ".", "each", "(", "(", "i", ",", "oComponent", ")", "=>", "{", "if", "(", "oComponent", ".", "children", ")", "{", "if", "(", "oComponent", ".", "children", ".", "length", "===", "1", ")", "{", "oChainObject", ".", "defaultComponent", "=", "$", "(", "oComponent", ")", ".", "text", "(", ")", ";", "}", "else", "{", "let", "sCurrentComponentName", "=", "$", "(", "oComponent", ")", ".", "find", "(", "\"name\"", ")", ".", "text", "(", ")", ";", "let", "aCurrentModules", "=", "[", "]", ";", "$", "(", "oComponent", ")", ".", "find", "(", "\"module\"", ")", ".", "each", "(", "(", "a", ",", "oC", ")", "=>", "{", "aCurrentModules", ".", "push", "(", "$", "(", "oC", ")", ".", "text", "(", ")", ".", "replace", "(", "/", "\\/", "/", "g", ",", "\".\"", ")", ")", ";", "}", ")", ";", "oChainObject", ".", "modules", ".", "push", "(", "{", "componentName", ":", "sCurrentComponentName", ",", "modules", ":", "aCurrentModules", "}", ")", ";", "}", "}", "}", ")", ";", "}", "return", "oChainObject", ";", "}" ]
Extracts components list and docuindex.json relative path from .library file data @param {object} oChainObject chain object @returns {object} chain object
[ "Extracts", "components", "list", "and", "docuindex", ".", "json", "relative", "path", "from", ".", "library", "file", "data" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/lib/jsdoc/transform-apijson-for-sdk.js#L782-L820
4,310
SAP/openui5
lib/jsdoc/transform-apijson-for-sdk.js
flattenComponents
function flattenComponents(oChainObject) { if (oChainObject.modules && oChainObject.modules.length > 0) { oChainObject.customSymbolComponents = {}; oChainObject.modules.forEach(oComponent => { let sCurrentComponent = oComponent.componentName; oComponent.modules.forEach(sModule => { oChainObject.customSymbolComponents[sModule] = sCurrentComponent; }); }); } return oChainObject; }
javascript
function flattenComponents(oChainObject) { if (oChainObject.modules && oChainObject.modules.length > 0) { oChainObject.customSymbolComponents = {}; oChainObject.modules.forEach(oComponent => { let sCurrentComponent = oComponent.componentName; oComponent.modules.forEach(sModule => { oChainObject.customSymbolComponents[sModule] = sCurrentComponent; }); }); } return oChainObject; }
[ "function", "flattenComponents", "(", "oChainObject", ")", "{", "if", "(", "oChainObject", ".", "modules", "&&", "oChainObject", ".", "modules", ".", "length", ">", "0", ")", "{", "oChainObject", ".", "customSymbolComponents", "=", "{", "}", ";", "oChainObject", ".", "modules", ".", "forEach", "(", "oComponent", "=>", "{", "let", "sCurrentComponent", "=", "oComponent", ".", "componentName", ";", "oComponent", ".", "modules", ".", "forEach", "(", "sModule", "=>", "{", "oChainObject", ".", "customSymbolComponents", "[", "sModule", "]", "=", "sCurrentComponent", ";", "}", ")", ";", "}", ")", ";", "}", "return", "oChainObject", ";", "}" ]
Adds to the passed object custom symbol component map generated from the extracted components list to be easily searchable later @param {object} oChainObject chain object @returns {object} chain object
[ "Adds", "to", "the", "passed", "object", "custom", "symbol", "component", "map", "generated", "from", "the", "extracted", "components", "list", "to", "be", "easily", "searchable", "later" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/lib/jsdoc/transform-apijson-for-sdk.js#L828-L840
4,311
SAP/openui5
lib/jsdoc/transform-apijson-for-sdk.js
extractSamplesFromDocuIndex
function extractSamplesFromDocuIndex(oChainObject) { // If we have not extracted docuPath we return early if (!oChainObject.docuPath) { return oChainObject; } return new Promise(function(oResolve) { // Join .library path with relative docuindex.json path let sPath = path.join(path.dirname(oChainObject.libraryFile), oChainObject.docuPath); // Normalize path to resolve relative path sPath = path.normalize(sPath); fs.readFile(sPath, 'utf8', (oError, oFileData) => { if (!oError) { oFileData = JSON.parse(oFileData); if (oFileData.explored && oFileData.explored.entities && oFileData.explored.entities.length > 0) { oChainObject.entitiesWithSamples = []; oFileData.explored.entities.forEach(oEntity => { oChainObject.entitiesWithSamples.push(oEntity.id); }); } } // We aways resolve as this data is not mandatory oResolve(oChainObject); }); }); }
javascript
function extractSamplesFromDocuIndex(oChainObject) { // If we have not extracted docuPath we return early if (!oChainObject.docuPath) { return oChainObject; } return new Promise(function(oResolve) { // Join .library path with relative docuindex.json path let sPath = path.join(path.dirname(oChainObject.libraryFile), oChainObject.docuPath); // Normalize path to resolve relative path sPath = path.normalize(sPath); fs.readFile(sPath, 'utf8', (oError, oFileData) => { if (!oError) { oFileData = JSON.parse(oFileData); if (oFileData.explored && oFileData.explored.entities && oFileData.explored.entities.length > 0) { oChainObject.entitiesWithSamples = []; oFileData.explored.entities.forEach(oEntity => { oChainObject.entitiesWithSamples.push(oEntity.id); }); } } // We aways resolve as this data is not mandatory oResolve(oChainObject); }); }); }
[ "function", "extractSamplesFromDocuIndex", "(", "oChainObject", ")", "{", "// If we have not extracted docuPath we return early", "if", "(", "!", "oChainObject", ".", "docuPath", ")", "{", "return", "oChainObject", ";", "}", "return", "new", "Promise", "(", "function", "(", "oResolve", ")", "{", "// Join .library path with relative docuindex.json path", "let", "sPath", "=", "path", ".", "join", "(", "path", ".", "dirname", "(", "oChainObject", ".", "libraryFile", ")", ",", "oChainObject", ".", "docuPath", ")", ";", "// Normalize path to resolve relative path", "sPath", "=", "path", ".", "normalize", "(", "sPath", ")", ";", "fs", ".", "readFile", "(", "sPath", ",", "'utf8'", ",", "(", "oError", ",", "oFileData", ")", "=>", "{", "if", "(", "!", "oError", ")", "{", "oFileData", "=", "JSON", ".", "parse", "(", "oFileData", ")", ";", "if", "(", "oFileData", ".", "explored", "&&", "oFileData", ".", "explored", ".", "entities", "&&", "oFileData", ".", "explored", ".", "entities", ".", "length", ">", "0", ")", "{", "oChainObject", ".", "entitiesWithSamples", "=", "[", "]", ";", "oFileData", ".", "explored", ".", "entities", ".", "forEach", "(", "oEntity", "=>", "{", "oChainObject", ".", "entitiesWithSamples", ".", "push", "(", "oEntity", ".", "id", ")", ";", "}", ")", ";", "}", "}", "// We aways resolve as this data is not mandatory", "oResolve", "(", "oChainObject", ")", ";", "}", ")", ";", "}", ")", ";", "}" ]
Adds to the passed object array with entities which have explored samples @param {object} oChainObject chain object @returns {object} chain object
[ "Adds", "to", "the", "passed", "object", "array", "with", "entities", "which", "have", "explored", "samples" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/lib/jsdoc/transform-apijson-for-sdk.js#L847-L873
4,312
SAP/openui5
lib/jsdoc/transform-apijson-for-sdk.js
getAPIJSONPromise
function getAPIJSONPromise(oChainObject) { return new Promise(function(oResolve, oReject) { fs.readFile(sInputFile, 'utf8', (oError, sFileData) => { if (oError) { oReject(oError); } else { oChainObject.fileData = JSON.parse(sFileData); oResolve(oChainObject); } }); }); }
javascript
function getAPIJSONPromise(oChainObject) { return new Promise(function(oResolve, oReject) { fs.readFile(sInputFile, 'utf8', (oError, sFileData) => { if (oError) { oReject(oError); } else { oChainObject.fileData = JSON.parse(sFileData); oResolve(oChainObject); } }); }); }
[ "function", "getAPIJSONPromise", "(", "oChainObject", ")", "{", "return", "new", "Promise", "(", "function", "(", "oResolve", ",", "oReject", ")", "{", "fs", ".", "readFile", "(", "sInputFile", ",", "'utf8'", ",", "(", "oError", ",", "sFileData", ")", "=>", "{", "if", "(", "oError", ")", "{", "oReject", "(", "oError", ")", ";", "}", "else", "{", "oChainObject", ".", "fileData", "=", "JSON", ".", "parse", "(", "sFileData", ")", ";", "oResolve", "(", "oChainObject", ")", ";", "}", "}", ")", ";", "}", ")", ";", "}" ]
Load api.json file @param {object} oChainObject chain object @returns {object} chain object
[ "Load", "api", ".", "json", "file" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/lib/jsdoc/transform-apijson-for-sdk.js#L880-L891
4,313
SAP/openui5
lib/jsdoc/transform-apijson-for-sdk.js
function (target) { var result = ""; if (target) { target.forEach(function (element) { result += element + '<br>'; }); } result = this._preProcessLinksInTextBlock(result); return result; }
javascript
function (target) { var result = ""; if (target) { target.forEach(function (element) { result += element + '<br>'; }); } result = this._preProcessLinksInTextBlock(result); return result; }
[ "function", "(", "target", ")", "{", "var", "result", "=", "\"\"", ";", "if", "(", "target", ")", "{", "target", ".", "forEach", "(", "function", "(", "element", ")", "{", "result", "+=", "element", "+", "'<br>'", ";", "}", ")", ";", "}", "result", "=", "this", ".", "_preProcessLinksInTextBlock", "(", "result", ")", ";", "return", "result", ";", "}" ]
Formats the target and applies to texts of annotations @param target - the array of texts to be formatted @returns string - the formatted text
[ "Formats", "the", "target", "and", "applies", "to", "texts", "of", "annotations" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/lib/jsdoc/transform-apijson-for-sdk.js#L968-L979
4,314
SAP/openui5
lib/jsdoc/transform-apijson-for-sdk.js
function (namespace) { var result, aNamespaceParts = namespace.split("."); if (aNamespaceParts[0] === "Org" && aNamespaceParts[1] === "OData") { result = '<a href="' + this.ANNOTATIONS_NAMESPACE_LINK + namespace + '.xml">' + namespace + '</a>'; } else { result = namespace; } result = this._preProcessLinksInTextBlock(result); return result; }
javascript
function (namespace) { var result, aNamespaceParts = namespace.split("."); if (aNamespaceParts[0] === "Org" && aNamespaceParts[1] === "OData") { result = '<a href="' + this.ANNOTATIONS_NAMESPACE_LINK + namespace + '.xml">' + namespace + '</a>'; } else { result = namespace; } result = this._preProcessLinksInTextBlock(result); return result; }
[ "function", "(", "namespace", ")", "{", "var", "result", ",", "aNamespaceParts", "=", "namespace", ".", "split", "(", "\".\"", ")", ";", "if", "(", "aNamespaceParts", "[", "0", "]", "===", "\"Org\"", "&&", "aNamespaceParts", "[", "1", "]", "===", "\"OData\"", ")", "{", "result", "=", "'<a href=\"'", "+", "this", ".", "ANNOTATIONS_NAMESPACE_LINK", "+", "namespace", "+", "'.xml\">'", "+", "namespace", "+", "'</a>'", ";", "}", "else", "{", "result", "=", "namespace", ";", "}", "result", "=", "this", ".", "_preProcessLinksInTextBlock", "(", "result", ")", ";", "return", "result", ";", "}" ]
Formats the namespace of annotations @param namespace - the namespace to be formatted @returns string - the formatted text
[ "Formats", "the", "namespace", "of", "annotations" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/lib/jsdoc/transform-apijson-for-sdk.js#L986-L998
4,315
SAP/openui5
lib/jsdoc/transform-apijson-for-sdk.js
function (description, since) { var result = description || ""; result += '<br>For more information, see ' + this.handleExternalUrl(this.ANNOTATIONS_LINK, "OData v4 Annotations"); if (since) { result += '<br><br><i>Since: ' + since + '.</i>'; } result = this._preProcessLinksInTextBlock(result); return result; }
javascript
function (description, since) { var result = description || ""; result += '<br>For more information, see ' + this.handleExternalUrl(this.ANNOTATIONS_LINK, "OData v4 Annotations"); if (since) { result += '<br><br><i>Since: ' + since + '.</i>'; } result = this._preProcessLinksInTextBlock(result); return result; }
[ "function", "(", "description", ",", "since", ")", "{", "var", "result", "=", "description", "||", "\"\"", ";", "result", "+=", "'<br>For more information, see '", "+", "this", ".", "handleExternalUrl", "(", "this", ".", "ANNOTATIONS_LINK", ",", "\"OData v4 Annotations\"", ")", ";", "if", "(", "since", ")", "{", "result", "+=", "'<br><br><i>Since: '", "+", "since", "+", "'.</i>'", ";", "}", "result", "=", "this", ".", "_preProcessLinksInTextBlock", "(", "result", ")", ";", "return", "result", ";", "}" ]
Formats the description of annotations @param description - the description of the annotation @param since - the since version information of the annotation @returns string - the formatted description
[ "Formats", "the", "description", "of", "annotations" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/lib/jsdoc/transform-apijson-for-sdk.js#L1006-L1017
4,316
SAP/openui5
lib/jsdoc/transform-apijson-for-sdk.js
function (description, since) { var result = description || ""; if (since) { result += '<br><br><i>Since: ' + since + '.</i>'; } result = this._preProcessLinksInTextBlock(result); return result; }
javascript
function (description, since) { var result = description || ""; if (since) { result += '<br><br><i>Since: ' + since + '.</i>'; } result = this._preProcessLinksInTextBlock(result); return result; }
[ "function", "(", "description", ",", "since", ")", "{", "var", "result", "=", "description", "||", "\"\"", ";", "if", "(", "since", ")", "{", "result", "+=", "'<br><br><i>Since: '", "+", "since", "+", "'.</i>'", ";", "}", "result", "=", "this", ".", "_preProcessLinksInTextBlock", "(", "result", ")", ";", "return", "result", ";", "}" ]
Formats the description of control properties @param description - the description of the property @param since - the since version information of the property @returns string - the formatted description
[ "Formats", "the", "description", "of", "control", "properties" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/lib/jsdoc/transform-apijson-for-sdk.js#L1084-L1093
4,317
SAP/openui5
lib/jsdoc/transform-apijson-for-sdk.js
function (defaultValue) { var sReturn; switch (defaultValue) { case null: case undefined: sReturn = ''; break; case '': sReturn = 'empty string'; break; default: sReturn = defaultValue; } return Array.isArray(sReturn) ? sReturn.join(', ') : sReturn; }
javascript
function (defaultValue) { var sReturn; switch (defaultValue) { case null: case undefined: sReturn = ''; break; case '': sReturn = 'empty string'; break; default: sReturn = defaultValue; } return Array.isArray(sReturn) ? sReturn.join(', ') : sReturn; }
[ "function", "(", "defaultValue", ")", "{", "var", "sReturn", ";", "switch", "(", "defaultValue", ")", "{", "case", "null", ":", "case", "undefined", ":", "sReturn", "=", "''", ";", "break", ";", "case", "''", ":", "sReturn", "=", "'empty string'", ";", "break", ";", "default", ":", "sReturn", "=", "defaultValue", ";", "}", "return", "Array", ".", "isArray", "(", "sReturn", ")", "?", "sReturn", ".", "join", "(", "', '", ")", ":", "sReturn", ";", "}" ]
Formats the default value of the property as a string. @param defaultValue - the default value of the property @returns string - The default value of the property formatted as a string.
[ "Formats", "the", "default", "value", "of", "the", "property", "as", "a", "string", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/lib/jsdoc/transform-apijson-for-sdk.js#L1100-L1116
4,318
SAP/openui5
lib/jsdoc/transform-apijson-for-sdk.js
function (name, params) { var result = '<pre class="prettyprint">new '; if (name) { result += name + '('; } if (params) { params.forEach(function (element, index, array) { result += element.name; if (element.optional) { result += '?'; } if (index < array.length - 1) { result += ', '; } }); } if (name) { result += ')</pre>'; } return result; }
javascript
function (name, params) { var result = '<pre class="prettyprint">new '; if (name) { result += name + '('; } if (params) { params.forEach(function (element, index, array) { result += element.name; if (element.optional) { result += '?'; } if (index < array.length - 1) { result += ', '; } }); } if (name) { result += ')</pre>'; } return result; }
[ "function", "(", "name", ",", "params", ")", "{", "var", "result", "=", "'<pre class=\"prettyprint\">new '", ";", "if", "(", "name", ")", "{", "result", "+=", "name", "+", "'('", ";", "}", "if", "(", "params", ")", "{", "params", ".", "forEach", "(", "function", "(", "element", ",", "index", ",", "array", ")", "{", "result", "+=", "element", ".", "name", ";", "if", "(", "element", ".", "optional", ")", "{", "result", "+=", "'?'", ";", "}", "if", "(", "index", "<", "array", ".", "length", "-", "1", ")", "{", "result", "+=", "', '", ";", "}", "}", ")", ";", "}", "if", "(", "name", ")", "{", "result", "+=", "')</pre>'", ";", "}", "return", "result", ";", "}" ]
Formats the constructor of the class @param name @param params @returns string - The code needed to create an object of that class
[ "Formats", "the", "constructor", "of", "the", "class" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/lib/jsdoc/transform-apijson-for-sdk.js#L1124-L1150
4,319
SAP/openui5
lib/jsdoc/transform-apijson-for-sdk.js
function ({name, type, className, text=name, local=false, hrefAppend=""}) { let sLink; // handling module's if (className !== undefined && (/^module:/.test(name) || /^module:/.test(className))) { name = name.replace(/^module:/, ""); } name = encodeURIComponent(name); className = encodeURIComponent(className); // Build the link sLink = type ? `${className}/${type}/${name}` : name; if (hrefAppend) { sLink += hrefAppend; } if (local) { return `<a target="_self" class="jsdoclink scrollTo${type === `events` ? `Event` : `Method`}" data-sap-ui-target="${name}" href="#/api/${sLink}">${text}</a>`; } return `<a target="_self" class="jsdoclink" href="#/api/${sLink}">${text}</a>`; }
javascript
function ({name, type, className, text=name, local=false, hrefAppend=""}) { let sLink; // handling module's if (className !== undefined && (/^module:/.test(name) || /^module:/.test(className))) { name = name.replace(/^module:/, ""); } name = encodeURIComponent(name); className = encodeURIComponent(className); // Build the link sLink = type ? `${className}/${type}/${name}` : name; if (hrefAppend) { sLink += hrefAppend; } if (local) { return `<a target="_self" class="jsdoclink scrollTo${type === `events` ? `Event` : `Method`}" data-sap-ui-target="${name}" href="#/api/${sLink}">${text}</a>`; } return `<a target="_self" class="jsdoclink" href="#/api/${sLink}">${text}</a>`; }
[ "function", "(", "{", "name", ",", "type", ",", "className", ",", "text", "=", "name", ",", "local", "=", "false", ",", "hrefAppend", "=", "\"\"", "}", ")", "{", "let", "sLink", ";", "// handling module's", "if", "(", "className", "!==", "undefined", "&&", "(", "/", "^module:", "/", ".", "test", "(", "name", ")", "||", "/", "^module:", "/", ".", "test", "(", "className", ")", ")", ")", "{", "name", "=", "name", ".", "replace", "(", "/", "^module:", "/", ",", "\"\"", ")", ";", "}", "name", "=", "encodeURIComponent", "(", "name", ")", ";", "className", "=", "encodeURIComponent", "(", "className", ")", ";", "// Build the link", "sLink", "=", "type", "?", "`", "${", "className", "}", "${", "type", "}", "${", "name", "}", "`", ":", "name", ";", "if", "(", "hrefAppend", ")", "{", "sLink", "+=", "hrefAppend", ";", "}", "if", "(", "local", ")", "{", "return", "`", "${", "type", "===", "`", "`", "?", "`", "`", ":", "`", "`", "}", "${", "name", "}", "${", "sLink", "}", "${", "text", "}", "`", ";", "}", "return", "`", "${", "sLink", "}", "${", "text", "}", "`", ";", "}" ]
Creates a html link @param {string} name @param {string} type @param {string} className @param {string} [text=name] by default if no text is provided the name will be used @param {boolean} [local=false] @param {string} [hrefAppend=""] @returns {string} link
[ "Creates", "a", "html", "link" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/lib/jsdoc/transform-apijson-for-sdk.js#L1394-L1417
4,320
SAP/openui5
lib/jsdoc/transform-apijson-for-sdk.js
function (sDescription, aReferences) { var iLen, i; // format references if (aReferences && aReferences.length > 0) { sDescription += "<br><br><span>Documentation links:</span><ul>"; iLen = aReferences.length; for (i = 0; i < iLen; i++) { // We treat references as links but as they may not be defined as such we enforce it if needed if (/{@link.*}/.test(aReferences[i])) { sDescription += "<li>" + aReferences[i] + "</li>"; } else { sDescription += "<li>{@link " + aReferences[i] + "}</li>"; } } sDescription += "</ul>"; } // Calling formatDescription so it could handle further formatting return this.formatDescription(sDescription); }
javascript
function (sDescription, aReferences) { var iLen, i; // format references if (aReferences && aReferences.length > 0) { sDescription += "<br><br><span>Documentation links:</span><ul>"; iLen = aReferences.length; for (i = 0; i < iLen; i++) { // We treat references as links but as they may not be defined as such we enforce it if needed if (/{@link.*}/.test(aReferences[i])) { sDescription += "<li>" + aReferences[i] + "</li>"; } else { sDescription += "<li>{@link " + aReferences[i] + "}</li>"; } } sDescription += "</ul>"; } // Calling formatDescription so it could handle further formatting return this.formatDescription(sDescription); }
[ "function", "(", "sDescription", ",", "aReferences", ")", "{", "var", "iLen", ",", "i", ";", "// format references", "if", "(", "aReferences", "&&", "aReferences", ".", "length", ">", "0", ")", "{", "sDescription", "+=", "\"<br><br><span>Documentation links:</span><ul>\"", ";", "iLen", "=", "aReferences", ".", "length", ";", "for", "(", "i", "=", "0", ";", "i", "<", "iLen", ";", "i", "++", ")", "{", "// We treat references as links but as they may not be defined as such we enforce it if needed", "if", "(", "/", "{@link.*}", "/", ".", "test", "(", "aReferences", "[", "i", "]", ")", ")", "{", "sDescription", "+=", "\"<li>\"", "+", "aReferences", "[", "i", "]", "+", "\"</li>\"", ";", "}", "else", "{", "sDescription", "+=", "\"<li>{@link \"", "+", "aReferences", "[", "i", "]", "+", "\"}</li>\"", ";", "}", "}", "sDescription", "+=", "\"</ul>\"", ";", "}", "// Calling formatDescription so it could handle further formatting", "return", "this", ".", "formatDescription", "(", "sDescription", ")", ";", "}" ]
Formatter for Overview section @param {string} sDescription - Class about description @param {array} aReferences - References @returns {string} - formatted text block
[ "Formatter", "for", "Overview", "section" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/lib/jsdoc/transform-apijson-for-sdk.js#L1610-L1634
4,321
SAP/openui5
lib/jsdoc/transform-apijson-for-sdk.js
function (description, deprecatedText, deprecatedSince) { if (!description && !deprecatedText && !deprecatedSince) { return ""; } var result = description || ""; if (deprecatedSince || deprecatedText) { // Note: sapUiDocumentationDeprecated - transformed to sapUiDeprecated to keep json file size low result += "<span class=\"sapUiDeprecated\"><br>"; result += this.formatDeprecated(deprecatedSince, deprecatedText); result += "</span>"; } result = this._preProcessLinksInTextBlock(result); return result; }
javascript
function (description, deprecatedText, deprecatedSince) { if (!description && !deprecatedText && !deprecatedSince) { return ""; } var result = description || ""; if (deprecatedSince || deprecatedText) { // Note: sapUiDocumentationDeprecated - transformed to sapUiDeprecated to keep json file size low result += "<span class=\"sapUiDeprecated\"><br>"; result += this.formatDeprecated(deprecatedSince, deprecatedText); result += "</span>"; } result = this._preProcessLinksInTextBlock(result); return result; }
[ "function", "(", "description", ",", "deprecatedText", ",", "deprecatedSince", ")", "{", "if", "(", "!", "description", "&&", "!", "deprecatedText", "&&", "!", "deprecatedSince", ")", "{", "return", "\"\"", ";", "}", "var", "result", "=", "description", "||", "\"\"", ";", "if", "(", "deprecatedSince", "||", "deprecatedText", ")", "{", "// Note: sapUiDocumentationDeprecated - transformed to sapUiDeprecated to keep json file size low", "result", "+=", "\"<span class=\\\"sapUiDeprecated\\\"><br>\"", ";", "result", "+=", "this", ".", "formatDeprecated", "(", "deprecatedSince", ",", "deprecatedText", ")", ";", "result", "+=", "\"</span>\"", ";", "}", "result", "=", "this", ".", "_preProcessLinksInTextBlock", "(", "result", ")", ";", "return", "result", ";", "}" ]
Formats the description of the property @param description - the description of the property @param deprecatedText - the text explaining this property is deprecated @param deprecatedSince - the version when this property was deprecated @returns string - the formatted description
[ "Formats", "the", "description", "of", "the", "property" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/lib/jsdoc/transform-apijson-for-sdk.js#L1643-L1661
4,322
SAP/openui5
lib/jsdoc/transform-apijson-for-sdk.js
function (sSince, sDescription, sEntityType) { var aResult; // Build deprecation message // Note: there may be no since or no description text available aResult = ["Deprecated"]; if (sSince) { aResult.push(" as of version " + sSince); } if (sDescription) { // Evaluate code blocks - Handle <code>...</code> pattern sDescription = sDescription.replace(/<code>(\S+)<\/code>/gi, function (sMatch, sCodeEntity) { return ['<em>', sCodeEntity, '</em>'].join(""); } ); // Evaluate links in the deprecation description aResult.push(". " + this._preProcessLinksInTextBlock(sDescription, true)); } return aResult.join(""); }
javascript
function (sSince, sDescription, sEntityType) { var aResult; // Build deprecation message // Note: there may be no since or no description text available aResult = ["Deprecated"]; if (sSince) { aResult.push(" as of version " + sSince); } if (sDescription) { // Evaluate code blocks - Handle <code>...</code> pattern sDescription = sDescription.replace(/<code>(\S+)<\/code>/gi, function (sMatch, sCodeEntity) { return ['<em>', sCodeEntity, '</em>'].join(""); } ); // Evaluate links in the deprecation description aResult.push(". " + this._preProcessLinksInTextBlock(sDescription, true)); } return aResult.join(""); }
[ "function", "(", "sSince", ",", "sDescription", ",", "sEntityType", ")", "{", "var", "aResult", ";", "// Build deprecation message", "// Note: there may be no since or no description text available", "aResult", "=", "[", "\"Deprecated\"", "]", ";", "if", "(", "sSince", ")", "{", "aResult", ".", "push", "(", "\" as of version \"", "+", "sSince", ")", ";", "}", "if", "(", "sDescription", ")", "{", "// Evaluate code blocks - Handle <code>...</code> pattern", "sDescription", "=", "sDescription", ".", "replace", "(", "/", "<code>(\\S+)<\\/code>", "/", "gi", ",", "function", "(", "sMatch", ",", "sCodeEntity", ")", "{", "return", "[", "'<em>'", ",", "sCodeEntity", ",", "'</em>'", "]", ".", "join", "(", "\"\"", ")", ";", "}", ")", ";", "// Evaluate links in the deprecation description", "aResult", ".", "push", "(", "\". \"", "+", "this", ".", "_preProcessLinksInTextBlock", "(", "sDescription", ",", "true", ")", ")", ";", "}", "return", "aResult", ".", "join", "(", "\"\"", ")", ";", "}" ]
Formats the entity deprecation message and pre-process jsDoc link and code blocks @param {string} sSince since text @param {string} sDescription deprecation description text @param {string} sEntityType string representation of entity type @returns {string} formatted deprecation message
[ "Formats", "the", "entity", "deprecation", "message", "and", "pre", "-", "process", "jsDoc", "link", "and", "code", "blocks" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/lib/jsdoc/transform-apijson-for-sdk.js#L1670-L1691
4,323
SAP/openui5
lib/jsdoc/transform-apijson-for-sdk.js
function (oSymbol, bCalledOnConstructor) { var bHeaderDocuLinkFound = false, bUXGuidelinesLinkFound = false, aReferences = [], entity = bCalledOnConstructor? oSymbol.constructor.references : oSymbol.references; const UX_GUIDELINES_BASE_URL = "https://experience.sap.com/fiori-design-web/"; if (entity && entity.length > 0) { entity.forEach(function (sReference) { var aParts; // Docu link - For the header we take into account only the first link that matches one of the patterns if (!bHeaderDocuLinkFound) { // Handled patterns: // * topic:59a0e11712e84a648bb990a1dba76bc7 // * {@link topic:59a0e11712e84a648bb990a1dba76bc7} // * {@link topic:59a0e11712e84a648bb990a1dba76bc7 Link text} aParts = sReference.match(/^{@link\s+topic:(\w{32})(\s.+)?}$|^topic:(\w{32})$/); if (aParts) { if (aParts[3]) { // Link is of type topic:GUID oSymbol.docuLink = aParts[3]; oSymbol.docuLinkText = oSymbol.basename; } else if (aParts[1]) { // Link of type {@link topic:GUID} or {@link topic:GUID Link text} oSymbol.docuLink = aParts[1]; oSymbol.docuLinkText = aParts[2] ? aParts[2] : oSymbol.basename; } bHeaderDocuLinkFound = true; return; } } // Fiori link - Handled patterns: // * fiori:flexible-column-layout // * fiori:/flexible-column-layout/ // * fiori:https://experience.sap.com/fiori-design-web/flexible-column-layout/ // * {@link fiori:flexible-column-layout} // * {@link fiori:/flexible-column-layout/} // * {@link fiori:/flexible-column-layout/ Flexible Column Layout} // * {@link fiori:https://experience.sap.com/fiori-design-web/flexible-column-layout/} // * {@link fiori:https://experience.sap.com/fiori-design-web/flexible-column-layout/ Flexible Column Layout} aParts = sReference.match(/^(?:{@link\s)?fiori:(?:https:\/\/experience\.sap\.com\/fiori-design-web\/)?\/?(\S+\b)\/?\s?(.*[^\s}])?}?$/); if (aParts) { let [, sTarget, sTargetName] = aParts; if (bCalledOnConstructor && !bUXGuidelinesLinkFound) { // Extract first found UX Guidelines link as primary oSymbol.uxGuidelinesLink = UX_GUIDELINES_BASE_URL + sTarget; oSymbol.uxGuidelinesLinkText = sTargetName ? sTargetName : oSymbol.basename; bUXGuidelinesLinkFound = true; return; } else { // BCP: 1870155880 - Every consecutive "fiori:" link should be handled as a normal link sReference = "{@link " + UX_GUIDELINES_BASE_URL + sTarget + (sTargetName ? " " + sTargetName : "") + "}"; } } aReferences.push(sReference); }); bCalledOnConstructor? oSymbol.constructor.references = aReferences : oSymbol.references = aReferences; } else { bCalledOnConstructor? oSymbol.constructor.references = [] : oSymbol.references = []; } }
javascript
function (oSymbol, bCalledOnConstructor) { var bHeaderDocuLinkFound = false, bUXGuidelinesLinkFound = false, aReferences = [], entity = bCalledOnConstructor? oSymbol.constructor.references : oSymbol.references; const UX_GUIDELINES_BASE_URL = "https://experience.sap.com/fiori-design-web/"; if (entity && entity.length > 0) { entity.forEach(function (sReference) { var aParts; // Docu link - For the header we take into account only the first link that matches one of the patterns if (!bHeaderDocuLinkFound) { // Handled patterns: // * topic:59a0e11712e84a648bb990a1dba76bc7 // * {@link topic:59a0e11712e84a648bb990a1dba76bc7} // * {@link topic:59a0e11712e84a648bb990a1dba76bc7 Link text} aParts = sReference.match(/^{@link\s+topic:(\w{32})(\s.+)?}$|^topic:(\w{32})$/); if (aParts) { if (aParts[3]) { // Link is of type topic:GUID oSymbol.docuLink = aParts[3]; oSymbol.docuLinkText = oSymbol.basename; } else if (aParts[1]) { // Link of type {@link topic:GUID} or {@link topic:GUID Link text} oSymbol.docuLink = aParts[1]; oSymbol.docuLinkText = aParts[2] ? aParts[2] : oSymbol.basename; } bHeaderDocuLinkFound = true; return; } } // Fiori link - Handled patterns: // * fiori:flexible-column-layout // * fiori:/flexible-column-layout/ // * fiori:https://experience.sap.com/fiori-design-web/flexible-column-layout/ // * {@link fiori:flexible-column-layout} // * {@link fiori:/flexible-column-layout/} // * {@link fiori:/flexible-column-layout/ Flexible Column Layout} // * {@link fiori:https://experience.sap.com/fiori-design-web/flexible-column-layout/} // * {@link fiori:https://experience.sap.com/fiori-design-web/flexible-column-layout/ Flexible Column Layout} aParts = sReference.match(/^(?:{@link\s)?fiori:(?:https:\/\/experience\.sap\.com\/fiori-design-web\/)?\/?(\S+\b)\/?\s?(.*[^\s}])?}?$/); if (aParts) { let [, sTarget, sTargetName] = aParts; if (bCalledOnConstructor && !bUXGuidelinesLinkFound) { // Extract first found UX Guidelines link as primary oSymbol.uxGuidelinesLink = UX_GUIDELINES_BASE_URL + sTarget; oSymbol.uxGuidelinesLinkText = sTargetName ? sTargetName : oSymbol.basename; bUXGuidelinesLinkFound = true; return; } else { // BCP: 1870155880 - Every consecutive "fiori:" link should be handled as a normal link sReference = "{@link " + UX_GUIDELINES_BASE_URL + sTarget + (sTargetName ? " " + sTargetName : "") + "}"; } } aReferences.push(sReference); }); bCalledOnConstructor? oSymbol.constructor.references = aReferences : oSymbol.references = aReferences; } else { bCalledOnConstructor? oSymbol.constructor.references = [] : oSymbol.references = []; } }
[ "function", "(", "oSymbol", ",", "bCalledOnConstructor", ")", "{", "var", "bHeaderDocuLinkFound", "=", "false", ",", "bUXGuidelinesLinkFound", "=", "false", ",", "aReferences", "=", "[", "]", ",", "entity", "=", "bCalledOnConstructor", "?", "oSymbol", ".", "constructor", ".", "references", ":", "oSymbol", ".", "references", ";", "const", "UX_GUIDELINES_BASE_URL", "=", "\"https://experience.sap.com/fiori-design-web/\"", ";", "if", "(", "entity", "&&", "entity", ".", "length", ">", "0", ")", "{", "entity", ".", "forEach", "(", "function", "(", "sReference", ")", "{", "var", "aParts", ";", "// Docu link - For the header we take into account only the first link that matches one of the patterns", "if", "(", "!", "bHeaderDocuLinkFound", ")", "{", "// Handled patterns:", "// * topic:59a0e11712e84a648bb990a1dba76bc7", "// * {@link topic:59a0e11712e84a648bb990a1dba76bc7}", "// * {@link topic:59a0e11712e84a648bb990a1dba76bc7 Link text}", "aParts", "=", "sReference", ".", "match", "(", "/", "^{@link\\s+topic:(\\w{32})(\\s.+)?}$|^topic:(\\w{32})$", "/", ")", ";", "if", "(", "aParts", ")", "{", "if", "(", "aParts", "[", "3", "]", ")", "{", "// Link is of type topic:GUID", "oSymbol", ".", "docuLink", "=", "aParts", "[", "3", "]", ";", "oSymbol", ".", "docuLinkText", "=", "oSymbol", ".", "basename", ";", "}", "else", "if", "(", "aParts", "[", "1", "]", ")", "{", "// Link of type {@link topic:GUID} or {@link topic:GUID Link text}", "oSymbol", ".", "docuLink", "=", "aParts", "[", "1", "]", ";", "oSymbol", ".", "docuLinkText", "=", "aParts", "[", "2", "]", "?", "aParts", "[", "2", "]", ":", "oSymbol", ".", "basename", ";", "}", "bHeaderDocuLinkFound", "=", "true", ";", "return", ";", "}", "}", "// Fiori link - Handled patterns:", "// * fiori:flexible-column-layout", "// * fiori:/flexible-column-layout/", "// * fiori:https://experience.sap.com/fiori-design-web/flexible-column-layout/", "// * {@link fiori:flexible-column-layout}", "// * {@link fiori:/flexible-column-layout/}", "// * {@link fiori:/flexible-column-layout/ Flexible Column Layout}", "// * {@link fiori:https://experience.sap.com/fiori-design-web/flexible-column-layout/}", "// * {@link fiori:https://experience.sap.com/fiori-design-web/flexible-column-layout/ Flexible Column Layout}", "aParts", "=", "sReference", ".", "match", "(", "/", "^(?:{@link\\s)?fiori:(?:https:\\/\\/experience\\.sap\\.com\\/fiori-design-web\\/)?\\/?(\\S+\\b)\\/?\\s?(.*[^\\s}])?}?$", "/", ")", ";", "if", "(", "aParts", ")", "{", "let", "[", ",", "sTarget", ",", "sTargetName", "]", "=", "aParts", ";", "if", "(", "bCalledOnConstructor", "&&", "!", "bUXGuidelinesLinkFound", ")", "{", "// Extract first found UX Guidelines link as primary", "oSymbol", ".", "uxGuidelinesLink", "=", "UX_GUIDELINES_BASE_URL", "+", "sTarget", ";", "oSymbol", ".", "uxGuidelinesLinkText", "=", "sTargetName", "?", "sTargetName", ":", "oSymbol", ".", "basename", ";", "bUXGuidelinesLinkFound", "=", "true", ";", "return", ";", "}", "else", "{", "// BCP: 1870155880 - Every consecutive \"fiori:\" link should be handled as a normal link", "sReference", "=", "\"{@link \"", "+", "UX_GUIDELINES_BASE_URL", "+", "sTarget", "+", "(", "sTargetName", "?", "\" \"", "+", "sTargetName", ":", "\"\"", ")", "+", "\"}\"", ";", "}", "}", "aReferences", ".", "push", "(", "sReference", ")", ";", "}", ")", ";", "bCalledOnConstructor", "?", "oSymbol", ".", "constructor", ".", "references", "=", "aReferences", ":", "oSymbol", ".", "references", "=", "aReferences", ";", "}", "else", "{", "bCalledOnConstructor", "?", "oSymbol", ".", "constructor", ".", "references", "=", "[", "]", ":", "oSymbol", ".", "references", "=", "[", "]", ";", "}", "}" ]
Pre-process and modify references @param {object} oSymbol control data object which will be modified @private
[ "Pre", "-", "process", "and", "modify", "references" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/lib/jsdoc/transform-apijson-for-sdk.js#L1698-L1766
4,324
SAP/openui5
lib/jsdoc/transform-apijson-for-sdk.js
function(oEntity) { if (oEntity.references && Array.isArray(oEntity.references)) { oEntity.references = oEntity.references.map(sReference => { return `<li>${sReference}</li>`; }); if (!oEntity.description) { // If there is no method description - references should be the first line of it oEntity.description = ''; } else { oEntity.description += '<br><br>'; } oEntity.description += `References: <ul>${oEntity.references.join("")}</ul>`; } }
javascript
function(oEntity) { if (oEntity.references && Array.isArray(oEntity.references)) { oEntity.references = oEntity.references.map(sReference => { return `<li>${sReference}</li>`; }); if (!oEntity.description) { // If there is no method description - references should be the first line of it oEntity.description = ''; } else { oEntity.description += '<br><br>'; } oEntity.description += `References: <ul>${oEntity.references.join("")}</ul>`; } }
[ "function", "(", "oEntity", ")", "{", "if", "(", "oEntity", ".", "references", "&&", "Array", ".", "isArray", "(", "oEntity", ".", "references", ")", ")", "{", "oEntity", ".", "references", "=", "oEntity", ".", "references", ".", "map", "(", "sReference", "=>", "{", "return", "`", "${", "sReference", "}", "`", ";", "}", ")", ";", "if", "(", "!", "oEntity", ".", "description", ")", "{", "// If there is no method description - references should be the first line of it", "oEntity", ".", "description", "=", "''", ";", "}", "else", "{", "oEntity", ".", "description", "+=", "'<br><br>'", ";", "}", "oEntity", ".", "description", "+=", "`", "${", "oEntity", ".", "references", ".", "join", "(", "\"\"", ")", "}", "`", ";", "}", "}" ]
Manage References, to apply as an unordered list in the description @param {object} oEntity control data object which will be modified @private
[ "Manage", "References", "to", "apply", "as", "an", "unordered", "list", "in", "the", "description" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/lib/jsdoc/transform-apijson-for-sdk.js#L1773-L1786
4,325
SAP/openui5
lib/jsdoc/transform-apijson-for-sdk.js
function (aMethods) { var fnCreateTypesArr = function (sTypes) { return sTypes.split("|").map(function (sType) { return {value: sType} }); }; var fnExtractParameterProperties = function (oParameter, aParameters, iDepth, aPhoneName) { if (oParameter.parameterProperties) { Object.keys(oParameter.parameterProperties).forEach(function (sProperty) { var oProperty = oParameter.parameterProperties[sProperty]; oProperty.depth = iDepth; // Handle types if (oProperty.type) { oProperty.types = fnCreateTypesArr(oProperty.type); } // Phone name - available only for parameters oProperty.phoneName = [aPhoneName.join("."), oProperty.name].join("."); // Add property to parameter array as we need a simple structure aParameters.push(oProperty); // Handle child parameterProperties fnExtractParameterProperties(oProperty, aParameters, (iDepth + 1), aPhoneName.concat([oProperty.name])); // Keep file size in check delete oProperty.type; }); // Keep file size in check delete oParameter.parameterProperties; } }; aMethods.forEach(function (oMethod) { // New array to hold modified parameters var aParameters = []; // Handle parameters if (oMethod.parameters) { oMethod.parameters.forEach(function (oParameter) { if (oParameter.type) { oParameter.types = fnCreateTypesArr(oParameter.type); } // Keep file size in check delete oParameter.type; // Add the parameter before the properties aParameters.push(oParameter); // Handle Parameter Properties // Note: We flatten the structure fnExtractParameterProperties(oParameter, aParameters, 1, [oParameter.name]); }); // Override the old data oMethod.parameters = aParameters; } // Handle return values if (oMethod.returnValue && oMethod.returnValue.type) { // Handle types oMethod.returnValue.types = fnCreateTypesArr(oMethod.returnValue.type); } }); }
javascript
function (aMethods) { var fnCreateTypesArr = function (sTypes) { return sTypes.split("|").map(function (sType) { return {value: sType} }); }; var fnExtractParameterProperties = function (oParameter, aParameters, iDepth, aPhoneName) { if (oParameter.parameterProperties) { Object.keys(oParameter.parameterProperties).forEach(function (sProperty) { var oProperty = oParameter.parameterProperties[sProperty]; oProperty.depth = iDepth; // Handle types if (oProperty.type) { oProperty.types = fnCreateTypesArr(oProperty.type); } // Phone name - available only for parameters oProperty.phoneName = [aPhoneName.join("."), oProperty.name].join("."); // Add property to parameter array as we need a simple structure aParameters.push(oProperty); // Handle child parameterProperties fnExtractParameterProperties(oProperty, aParameters, (iDepth + 1), aPhoneName.concat([oProperty.name])); // Keep file size in check delete oProperty.type; }); // Keep file size in check delete oParameter.parameterProperties; } }; aMethods.forEach(function (oMethod) { // New array to hold modified parameters var aParameters = []; // Handle parameters if (oMethod.parameters) { oMethod.parameters.forEach(function (oParameter) { if (oParameter.type) { oParameter.types = fnCreateTypesArr(oParameter.type); } // Keep file size in check delete oParameter.type; // Add the parameter before the properties aParameters.push(oParameter); // Handle Parameter Properties // Note: We flatten the structure fnExtractParameterProperties(oParameter, aParameters, 1, [oParameter.name]); }); // Override the old data oMethod.parameters = aParameters; } // Handle return values if (oMethod.returnValue && oMethod.returnValue.type) { // Handle types oMethod.returnValue.types = fnCreateTypesArr(oMethod.returnValue.type); } }); }
[ "function", "(", "aMethods", ")", "{", "var", "fnCreateTypesArr", "=", "function", "(", "sTypes", ")", "{", "return", "sTypes", ".", "split", "(", "\"|\"", ")", ".", "map", "(", "function", "(", "sType", ")", "{", "return", "{", "value", ":", "sType", "}", "}", ")", ";", "}", ";", "var", "fnExtractParameterProperties", "=", "function", "(", "oParameter", ",", "aParameters", ",", "iDepth", ",", "aPhoneName", ")", "{", "if", "(", "oParameter", ".", "parameterProperties", ")", "{", "Object", ".", "keys", "(", "oParameter", ".", "parameterProperties", ")", ".", "forEach", "(", "function", "(", "sProperty", ")", "{", "var", "oProperty", "=", "oParameter", ".", "parameterProperties", "[", "sProperty", "]", ";", "oProperty", ".", "depth", "=", "iDepth", ";", "// Handle types", "if", "(", "oProperty", ".", "type", ")", "{", "oProperty", ".", "types", "=", "fnCreateTypesArr", "(", "oProperty", ".", "type", ")", ";", "}", "// Phone name - available only for parameters", "oProperty", ".", "phoneName", "=", "[", "aPhoneName", ".", "join", "(", "\".\"", ")", ",", "oProperty", ".", "name", "]", ".", "join", "(", "\".\"", ")", ";", "// Add property to parameter array as we need a simple structure", "aParameters", ".", "push", "(", "oProperty", ")", ";", "// Handle child parameterProperties", "fnExtractParameterProperties", "(", "oProperty", ",", "aParameters", ",", "(", "iDepth", "+", "1", ")", ",", "aPhoneName", ".", "concat", "(", "[", "oProperty", ".", "name", "]", ")", ")", ";", "// Keep file size in check", "delete", "oProperty", ".", "type", ";", "}", ")", ";", "// Keep file size in check", "delete", "oParameter", ".", "parameterProperties", ";", "}", "}", ";", "aMethods", ".", "forEach", "(", "function", "(", "oMethod", ")", "{", "// New array to hold modified parameters", "var", "aParameters", "=", "[", "]", ";", "// Handle parameters", "if", "(", "oMethod", ".", "parameters", ")", "{", "oMethod", ".", "parameters", ".", "forEach", "(", "function", "(", "oParameter", ")", "{", "if", "(", "oParameter", ".", "type", ")", "{", "oParameter", ".", "types", "=", "fnCreateTypesArr", "(", "oParameter", ".", "type", ")", ";", "}", "// Keep file size in check", "delete", "oParameter", ".", "type", ";", "// Add the parameter before the properties", "aParameters", ".", "push", "(", "oParameter", ")", ";", "// Handle Parameter Properties", "// Note: We flatten the structure", "fnExtractParameterProperties", "(", "oParameter", ",", "aParameters", ",", "1", ",", "[", "oParameter", ".", "name", "]", ")", ";", "}", ")", ";", "// Override the old data", "oMethod", ".", "parameters", "=", "aParameters", ";", "}", "// Handle return values", "if", "(", "oMethod", ".", "returnValue", "&&", "oMethod", ".", "returnValue", ".", "type", ")", "{", "// Handle types", "oMethod", ".", "returnValue", ".", "types", "=", "fnCreateTypesArr", "(", "oMethod", ".", "returnValue", ".", "type", ")", ";", "}", "}", ")", ";", "}" ]
Adjusts methods info so that it can be easily displayed in a table @param aMethods - the methods array initially coming from the server
[ "Adjusts", "methods", "info", "so", "that", "it", "can", "be", "easily", "displayed", "in", "a", "table" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/lib/jsdoc/transform-apijson-for-sdk.js#L1796-L1865
4,326
SAP/openui5
lib/jsdoc/transform-apijson-for-sdk.js
function (aEvents) { var fnExtractParameterProperties = function (oParameter, aParameters, iDepth, aPhoneName) { if (oParameter.parameterProperties) { Object.keys(oParameter.parameterProperties).forEach(function (sProperty) { var oProperty = oParameter.parameterProperties[sProperty], sPhoneTypeSuffix; oProperty.depth = iDepth; // Phone name - available only for parameters sPhoneTypeSuffix = oProperty.type === "array" ? "[]" : ""; oProperty.phoneName = [aPhoneName.join("."), (oProperty.name + sPhoneTypeSuffix)].join("."); // Add property to parameter array as we need a simple structure aParameters.push(oProperty); // Handle child parameterProperties fnExtractParameterProperties(oProperty, aParameters, (iDepth + 1), aPhoneName.concat([oProperty.name + sPhoneTypeSuffix])); }); // Keep file size in check delete oParameter.parameterProperties; } }; aEvents.forEach(function (aEvents) { // New array to hold modified parameters var aParameters = []; // Handle parameters if (aEvents.parameters) { aEvents.parameters.forEach(function (oParameter) { // Add the parameter before the properties aParameters.push(oParameter); // Handle Parameter Properties // Note: We flatten the structure fnExtractParameterProperties(oParameter, aParameters, 1, [oParameter.name]); }); // Override the old data aEvents.parameters = aParameters; } }); }
javascript
function (aEvents) { var fnExtractParameterProperties = function (oParameter, aParameters, iDepth, aPhoneName) { if (oParameter.parameterProperties) { Object.keys(oParameter.parameterProperties).forEach(function (sProperty) { var oProperty = oParameter.parameterProperties[sProperty], sPhoneTypeSuffix; oProperty.depth = iDepth; // Phone name - available only for parameters sPhoneTypeSuffix = oProperty.type === "array" ? "[]" : ""; oProperty.phoneName = [aPhoneName.join("."), (oProperty.name + sPhoneTypeSuffix)].join("."); // Add property to parameter array as we need a simple structure aParameters.push(oProperty); // Handle child parameterProperties fnExtractParameterProperties(oProperty, aParameters, (iDepth + 1), aPhoneName.concat([oProperty.name + sPhoneTypeSuffix])); }); // Keep file size in check delete oParameter.parameterProperties; } }; aEvents.forEach(function (aEvents) { // New array to hold modified parameters var aParameters = []; // Handle parameters if (aEvents.parameters) { aEvents.parameters.forEach(function (oParameter) { // Add the parameter before the properties aParameters.push(oParameter); // Handle Parameter Properties // Note: We flatten the structure fnExtractParameterProperties(oParameter, aParameters, 1, [oParameter.name]); }); // Override the old data aEvents.parameters = aParameters; } }); }
[ "function", "(", "aEvents", ")", "{", "var", "fnExtractParameterProperties", "=", "function", "(", "oParameter", ",", "aParameters", ",", "iDepth", ",", "aPhoneName", ")", "{", "if", "(", "oParameter", ".", "parameterProperties", ")", "{", "Object", ".", "keys", "(", "oParameter", ".", "parameterProperties", ")", ".", "forEach", "(", "function", "(", "sProperty", ")", "{", "var", "oProperty", "=", "oParameter", ".", "parameterProperties", "[", "sProperty", "]", ",", "sPhoneTypeSuffix", ";", "oProperty", ".", "depth", "=", "iDepth", ";", "// Phone name - available only for parameters", "sPhoneTypeSuffix", "=", "oProperty", ".", "type", "===", "\"array\"", "?", "\"[]\"", ":", "\"\"", ";", "oProperty", ".", "phoneName", "=", "[", "aPhoneName", ".", "join", "(", "\".\"", ")", ",", "(", "oProperty", ".", "name", "+", "sPhoneTypeSuffix", ")", "]", ".", "join", "(", "\".\"", ")", ";", "// Add property to parameter array as we need a simple structure", "aParameters", ".", "push", "(", "oProperty", ")", ";", "// Handle child parameterProperties", "fnExtractParameterProperties", "(", "oProperty", ",", "aParameters", ",", "(", "iDepth", "+", "1", ")", ",", "aPhoneName", ".", "concat", "(", "[", "oProperty", ".", "name", "+", "sPhoneTypeSuffix", "]", ")", ")", ";", "}", ")", ";", "// Keep file size in check", "delete", "oParameter", ".", "parameterProperties", ";", "}", "}", ";", "aEvents", ".", "forEach", "(", "function", "(", "aEvents", ")", "{", "// New array to hold modified parameters", "var", "aParameters", "=", "[", "]", ";", "// Handle parameters", "if", "(", "aEvents", ".", "parameters", ")", "{", "aEvents", ".", "parameters", ".", "forEach", "(", "function", "(", "oParameter", ")", "{", "// Add the parameter before the properties", "aParameters", ".", "push", "(", "oParameter", ")", ";", "// Handle Parameter Properties", "// Note: We flatten the structure", "fnExtractParameterProperties", "(", "oParameter", ",", "aParameters", ",", "1", ",", "[", "oParameter", ".", "name", "]", ")", ";", "}", ")", ";", "// Override the old data", "aEvents", ".", "parameters", "=", "aParameters", ";", "}", "}", ")", ";", "}" ]
Adjusts events info so that it can be easily displayed in a table @param {Array} aEvents - the events array initially coming from the server
[ "Adjusts", "events", "info", "so", "that", "it", "can", "be", "easily", "displayed", "in", "a", "table" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/lib/jsdoc/transform-apijson-for-sdk.js#L1871-L1915
4,327
SAP/openui5
lib/jsdoc/transform-apijson-for-sdk.js
function (aParameters) { // New array to hold modified parameters var aNodes = [], processNode = function (oNode, sPhoneName, iDepth, aNodes) { // Handle phone name oNode.phoneName = sPhoneName ? [sPhoneName, oNode.name].join(".") : oNode.name; // Depth oNode.depth = iDepth; // Add to array aNodes.push(oNode); // Handle nesting if (oNode.parameterProperties) { Object.keys(oNode.parameterProperties).forEach(function (sNode) { processNode(oNode.parameterProperties[sNode], oNode.phoneName, (iDepth + 1), aNodes); }); } delete oNode.parameterProperties; }; aParameters.forEach(function (oParameter) { // Handle Parameter Properties // Note: We flatten the structure processNode(oParameter, undefined, 0, aNodes); }); return aNodes; }
javascript
function (aParameters) { // New array to hold modified parameters var aNodes = [], processNode = function (oNode, sPhoneName, iDepth, aNodes) { // Handle phone name oNode.phoneName = sPhoneName ? [sPhoneName, oNode.name].join(".") : oNode.name; // Depth oNode.depth = iDepth; // Add to array aNodes.push(oNode); // Handle nesting if (oNode.parameterProperties) { Object.keys(oNode.parameterProperties).forEach(function (sNode) { processNode(oNode.parameterProperties[sNode], oNode.phoneName, (iDepth + 1), aNodes); }); } delete oNode.parameterProperties; }; aParameters.forEach(function (oParameter) { // Handle Parameter Properties // Note: We flatten the structure processNode(oParameter, undefined, 0, aNodes); }); return aNodes; }
[ "function", "(", "aParameters", ")", "{", "// New array to hold modified parameters", "var", "aNodes", "=", "[", "]", ",", "processNode", "=", "function", "(", "oNode", ",", "sPhoneName", ",", "iDepth", ",", "aNodes", ")", "{", "// Handle phone name", "oNode", ".", "phoneName", "=", "sPhoneName", "?", "[", "sPhoneName", ",", "oNode", ".", "name", "]", ".", "join", "(", "\".\"", ")", ":", "oNode", ".", "name", ";", "// Depth", "oNode", ".", "depth", "=", "iDepth", ";", "// Add to array", "aNodes", ".", "push", "(", "oNode", ")", ";", "// Handle nesting", "if", "(", "oNode", ".", "parameterProperties", ")", "{", "Object", ".", "keys", "(", "oNode", ".", "parameterProperties", ")", ".", "forEach", "(", "function", "(", "sNode", ")", "{", "processNode", "(", "oNode", ".", "parameterProperties", "[", "sNode", "]", ",", "oNode", ".", "phoneName", ",", "(", "iDepth", "+", "1", ")", ",", "aNodes", ")", ";", "}", ")", ";", "}", "delete", "oNode", ".", "parameterProperties", ";", "}", ";", "aParameters", ".", "forEach", "(", "function", "(", "oParameter", ")", "{", "// Handle Parameter Properties", "// Note: We flatten the structure", "processNode", "(", "oParameter", ",", "undefined", ",", "0", ",", "aNodes", ")", ";", "}", ")", ";", "return", "aNodes", ";", "}" ]
Adjusts constructor parameters info so that it can be easily displayed in a table @param {Array} aParameters - the events array initially coming from the server
[ "Adjusts", "constructor", "parameters", "info", "so", "that", "it", "can", "be", "easily", "displayed", "in", "a", "table" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/lib/jsdoc/transform-apijson-for-sdk.js#L1921-L1951
4,328
SAP/openui5
src/sap.ui.core/src/sap/ui/model/odata/ODataTreeBindingFlat.js
function (oNode) { // if there are subnodes added to the current node -> traverse them first (added nodes are at the top, before any children) if (oNode.addedSubtrees.length > 0 && !oNode.nodeState.collapsed) { // an added subtree can be either a deep or a flat tree (depending on the addContexts) call for (var j = 0; j < oNode.addedSubtrees.length; j++) { var oSubtreeHandle = oNode.addedSubtrees[j]; fnTraverseAddedSubtree(oNode, oSubtreeHandle); if (oRecursionBreaker.broken) { return; } } } }
javascript
function (oNode) { // if there are subnodes added to the current node -> traverse them first (added nodes are at the top, before any children) if (oNode.addedSubtrees.length > 0 && !oNode.nodeState.collapsed) { // an added subtree can be either a deep or a flat tree (depending on the addContexts) call for (var j = 0; j < oNode.addedSubtrees.length; j++) { var oSubtreeHandle = oNode.addedSubtrees[j]; fnTraverseAddedSubtree(oNode, oSubtreeHandle); if (oRecursionBreaker.broken) { return; } } } }
[ "function", "(", "oNode", ")", "{", "// if there are subnodes added to the current node -> traverse them first (added nodes are at the top, before any children)", "if", "(", "oNode", ".", "addedSubtrees", ".", "length", ">", "0", "&&", "!", "oNode", ".", "nodeState", ".", "collapsed", ")", "{", "// an added subtree can be either a deep or a flat tree (depending on the addContexts) call", "for", "(", "var", "j", "=", "0", ";", "j", "<", "oNode", ".", "addedSubtrees", ".", "length", ";", "j", "++", ")", "{", "var", "oSubtreeHandle", "=", "oNode", ".", "addedSubtrees", "[", "j", "]", ";", "fnTraverseAddedSubtree", "(", "oNode", ",", "oSubtreeHandle", ")", ";", "if", "(", "oRecursionBreaker", ".", "broken", ")", "{", "return", ";", "}", "}", "}", "}" ]
Helper function to iterate all added subtrees of a node.
[ "Helper", "function", "to", "iterate", "all", "added", "subtrees", "of", "a", "node", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/ODataTreeBindingFlat.js#L302-L314
4,329
SAP/openui5
src/sap.ui.core/src/sap/ui/model/odata/ODataTreeBindingFlat.js
function (oNode, oSubtreeHandle) { var oSubtree = oSubtreeHandle._getSubtree(); if (oSubtreeHandle) { // subtree is flat if (Array.isArray(oSubtree)) { if (oSubtreeHandle._oSubtreeRoot) { // jump to a certain position in the flat structure and map the nodes fnTraverseFlatSubtree(oSubtree, oSubtreeHandle._oSubtreeRoot.serverIndex, oSubtreeHandle._oSubtreeRoot, oSubtreeHandle._oSubtreeRoot.originalLevel || 0, oNode.level + 1); } else { // newly added nodes fnTraverseFlatSubtree(oSubtree, null, null, 0, oNode.level + 1); } } else { // subtree is deep oSubtreeHandle._oSubtreeRoot.level = oNode.level + 1; fnTraverseDeepSubtree(oSubtreeHandle._oSubtreeRoot, false, oSubtreeHandle._oNewParentNode, -1, oSubtreeHandle._oSubtreeRoot); } } }
javascript
function (oNode, oSubtreeHandle) { var oSubtree = oSubtreeHandle._getSubtree(); if (oSubtreeHandle) { // subtree is flat if (Array.isArray(oSubtree)) { if (oSubtreeHandle._oSubtreeRoot) { // jump to a certain position in the flat structure and map the nodes fnTraverseFlatSubtree(oSubtree, oSubtreeHandle._oSubtreeRoot.serverIndex, oSubtreeHandle._oSubtreeRoot, oSubtreeHandle._oSubtreeRoot.originalLevel || 0, oNode.level + 1); } else { // newly added nodes fnTraverseFlatSubtree(oSubtree, null, null, 0, oNode.level + 1); } } else { // subtree is deep oSubtreeHandle._oSubtreeRoot.level = oNode.level + 1; fnTraverseDeepSubtree(oSubtreeHandle._oSubtreeRoot, false, oSubtreeHandle._oNewParentNode, -1, oSubtreeHandle._oSubtreeRoot); } } }
[ "function", "(", "oNode", ",", "oSubtreeHandle", ")", "{", "var", "oSubtree", "=", "oSubtreeHandle", ".", "_getSubtree", "(", ")", ";", "if", "(", "oSubtreeHandle", ")", "{", "// subtree is flat", "if", "(", "Array", ".", "isArray", "(", "oSubtree", ")", ")", "{", "if", "(", "oSubtreeHandle", ".", "_oSubtreeRoot", ")", "{", "// jump to a certain position in the flat structure and map the nodes", "fnTraverseFlatSubtree", "(", "oSubtree", ",", "oSubtreeHandle", ".", "_oSubtreeRoot", ".", "serverIndex", ",", "oSubtreeHandle", ".", "_oSubtreeRoot", ",", "oSubtreeHandle", ".", "_oSubtreeRoot", ".", "originalLevel", "||", "0", ",", "oNode", ".", "level", "+", "1", ")", ";", "}", "else", "{", "// newly added nodes", "fnTraverseFlatSubtree", "(", "oSubtree", ",", "null", ",", "null", ",", "0", ",", "oNode", ".", "level", "+", "1", ")", ";", "}", "}", "else", "{", "// subtree is deep", "oSubtreeHandle", ".", "_oSubtreeRoot", ".", "level", "=", "oNode", ".", "level", "+", "1", ";", "fnTraverseDeepSubtree", "(", "oSubtreeHandle", ".", "_oSubtreeRoot", ",", "false", ",", "oSubtreeHandle", ".", "_oNewParentNode", ",", "-", "1", ",", "oSubtreeHandle", ".", "_oSubtreeRoot", ")", ";", "}", "}", "}" ]
Traverses a re-inserted or newly added subtree. This can be a combination of flat and deep trees. Decides if the traversal has to branche over to a flat or a deep part of the tree. @param {object} oNode the parent node @param {object} the subtree handle, inside there is either a deep or a flat tree stored
[ "Traverses", "a", "re", "-", "inserted", "or", "newly", "added", "subtree", ".", "This", "can", "be", "a", "combination", "of", "flat", "and", "deep", "trees", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/ODataTreeBindingFlat.js#L325-L345
4,330
SAP/openui5
src/sap.ui.core/src/sap/ui/model/odata/ODataTreeBindingFlat.js
function (oNode, bIgnore, oParent, iPositionInParent, oIgnoreRemoveForNode) { // ignore node if it was already mapped or is removed (except if it was reinserted, denoted by oIgnoreRemoveForNode) if (!bIgnore) { if (!oNode.nodeState.removed || oIgnoreRemoveForNode == oNode) { fnMap(oNode, oRecursionBreaker, "positionInParent", iPositionInParent, oParent); if (oRecursionBreaker.broken) { return; } } } fnCheckNodeForAddedSubtrees(oNode); if (oRecursionBreaker.broken) { return; } // if the node also has children AND is expanded, dig deeper if (oNode && oNode.children && oNode.nodeState.expanded) { for (var i = 0; i < oNode.children.length; i++) { var oChildNode = oNode.children[i]; // Make sure that the level of all child nodes are adapted to the parent level, // this is necessary if the parent node was placed in a different leveled subtree. // Ignore removed nodes, which are not re-inserted. // Re-inserted deep nodes will be regarded in fnTraverseAddedSubtree. if (oChildNode && !oChildNode.nodeState.removed && !oChildNode.nodeState.reinserted) { oChildNode.level = oNode.level + 1; } // only dive deeper if we have a gap (entry which has to be loaded) or a defined node is NOT removed if (oChildNode && !oChildNode.nodeState.removed) { fnTraverseDeepSubtree(oChildNode, false, oNode, i, oIgnoreRemoveForNode); } else if (!oChildNode) { fnMap(oChildNode, oRecursionBreaker, "positionInParent", i, oNode); } if (oRecursionBreaker.broken) { return; } } } }
javascript
function (oNode, bIgnore, oParent, iPositionInParent, oIgnoreRemoveForNode) { // ignore node if it was already mapped or is removed (except if it was reinserted, denoted by oIgnoreRemoveForNode) if (!bIgnore) { if (!oNode.nodeState.removed || oIgnoreRemoveForNode == oNode) { fnMap(oNode, oRecursionBreaker, "positionInParent", iPositionInParent, oParent); if (oRecursionBreaker.broken) { return; } } } fnCheckNodeForAddedSubtrees(oNode); if (oRecursionBreaker.broken) { return; } // if the node also has children AND is expanded, dig deeper if (oNode && oNode.children && oNode.nodeState.expanded) { for (var i = 0; i < oNode.children.length; i++) { var oChildNode = oNode.children[i]; // Make sure that the level of all child nodes are adapted to the parent level, // this is necessary if the parent node was placed in a different leveled subtree. // Ignore removed nodes, which are not re-inserted. // Re-inserted deep nodes will be regarded in fnTraverseAddedSubtree. if (oChildNode && !oChildNode.nodeState.removed && !oChildNode.nodeState.reinserted) { oChildNode.level = oNode.level + 1; } // only dive deeper if we have a gap (entry which has to be loaded) or a defined node is NOT removed if (oChildNode && !oChildNode.nodeState.removed) { fnTraverseDeepSubtree(oChildNode, false, oNode, i, oIgnoreRemoveForNode); } else if (!oChildNode) { fnMap(oChildNode, oRecursionBreaker, "positionInParent", i, oNode); } if (oRecursionBreaker.broken) { return; } } } }
[ "function", "(", "oNode", ",", "bIgnore", ",", "oParent", ",", "iPositionInParent", ",", "oIgnoreRemoveForNode", ")", "{", "// ignore node if it was already mapped or is removed (except if it was reinserted, denoted by oIgnoreRemoveForNode)", "if", "(", "!", "bIgnore", ")", "{", "if", "(", "!", "oNode", ".", "nodeState", ".", "removed", "||", "oIgnoreRemoveForNode", "==", "oNode", ")", "{", "fnMap", "(", "oNode", ",", "oRecursionBreaker", ",", "\"positionInParent\"", ",", "iPositionInParent", ",", "oParent", ")", ";", "if", "(", "oRecursionBreaker", ".", "broken", ")", "{", "return", ";", "}", "}", "}", "fnCheckNodeForAddedSubtrees", "(", "oNode", ")", ";", "if", "(", "oRecursionBreaker", ".", "broken", ")", "{", "return", ";", "}", "// if the node also has children AND is expanded, dig deeper", "if", "(", "oNode", "&&", "oNode", ".", "children", "&&", "oNode", ".", "nodeState", ".", "expanded", ")", "{", "for", "(", "var", "i", "=", "0", ";", "i", "<", "oNode", ".", "children", ".", "length", ";", "i", "++", ")", "{", "var", "oChildNode", "=", "oNode", ".", "children", "[", "i", "]", ";", "// Make sure that the level of all child nodes are adapted to the parent level,", "// this is necessary if the parent node was placed in a different leveled subtree.", "// Ignore removed nodes, which are not re-inserted.", "// Re-inserted deep nodes will be regarded in fnTraverseAddedSubtree.", "if", "(", "oChildNode", "&&", "!", "oChildNode", ".", "nodeState", ".", "removed", "&&", "!", "oChildNode", ".", "nodeState", ".", "reinserted", ")", "{", "oChildNode", ".", "level", "=", "oNode", ".", "level", "+", "1", ";", "}", "// only dive deeper if we have a gap (entry which has to be loaded) or a defined node is NOT removed", "if", "(", "oChildNode", "&&", "!", "oChildNode", ".", "nodeState", ".", "removed", ")", "{", "fnTraverseDeepSubtree", "(", "oChildNode", ",", "false", ",", "oNode", ",", "i", ",", "oIgnoreRemoveForNode", ")", ";", "}", "else", "if", "(", "!", "oChildNode", ")", "{", "fnMap", "(", "oChildNode", ",", "oRecursionBreaker", ",", "\"positionInParent\"", ",", "i", ",", "oNode", ")", ";", "}", "if", "(", "oRecursionBreaker", ".", "broken", ")", "{", "return", ";", "}", "}", "}", "}" ]
Recursive Tree Traversal @param {object} oNode the current node @param {boolean} bIgnore a flag to indicate if the node should be mapped @param {object} oParent the parent node of oNode @param {int} iPositionInParent the position of oNode in the children-array of oParent
[ "Recursive", "Tree", "Traversal" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/ODataTreeBindingFlat.js#L354-L391
4,331
SAP/openui5
src/sap.ui.core/src/sap/ui/model/odata/ODataTreeBindingFlat.js
function (oNode) { if (oNode) { if (oNode.nodeState.selected && !oNode.isArtificial) { aResultContexts.push(oNode.context); } } }
javascript
function (oNode) { if (oNode) { if (oNode.nodeState.selected && !oNode.isArtificial) { aResultContexts.push(oNode.context); } } }
[ "function", "(", "oNode", ")", "{", "if", "(", "oNode", ")", "{", "if", "(", "oNode", ".", "nodeState", ".", "selected", "&&", "!", "oNode", ".", "isArtificial", ")", "{", "aResultContexts", ".", "push", "(", "oNode", ".", "context", ")", ";", "}", "}", "}" ]
collect the indices of all selected nodes
[ "collect", "the", "indices", "of", "all", "selected", "nodes" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/ODataTreeBindingFlat.js#L2217-L2223
4,332
SAP/openui5
grunt/config/aliases.js
function(mode) { if (!mode || (mode !== 'src' && mode !== 'target')) { mode = 'src'; } grunt.option('port', 0); // use random port // listen to the connect server startup grunt.event.on('connect.*.listening', function(hostname, port) { // 0.0.0.0 does not work in windows if (hostname === '0.0.0.0') { hostname = 'localhost'; } // set baseUrl (using hostname / port from connect task) grunt.config(['selenium_qunit', 'options', 'baseUrl'], 'http://' + hostname + ':' + port); // run selenium task grunt.task.run(['selenium_qunit:run']); }); // cleanup and start connect server grunt.task.run([ 'clean:surefire-reports', 'openui5_connect:' + mode ]); }
javascript
function(mode) { if (!mode || (mode !== 'src' && mode !== 'target')) { mode = 'src'; } grunt.option('port', 0); // use random port // listen to the connect server startup grunt.event.on('connect.*.listening', function(hostname, port) { // 0.0.0.0 does not work in windows if (hostname === '0.0.0.0') { hostname = 'localhost'; } // set baseUrl (using hostname / port from connect task) grunt.config(['selenium_qunit', 'options', 'baseUrl'], 'http://' + hostname + ':' + port); // run selenium task grunt.task.run(['selenium_qunit:run']); }); // cleanup and start connect server grunt.task.run([ 'clean:surefire-reports', 'openui5_connect:' + mode ]); }
[ "function", "(", "mode", ")", "{", "if", "(", "!", "mode", "||", "(", "mode", "!==", "'src'", "&&", "mode", "!==", "'target'", ")", ")", "{", "mode", "=", "'src'", ";", "}", "grunt", ".", "option", "(", "'port'", ",", "0", ")", ";", "// use random port", "// listen to the connect server startup", "grunt", ".", "event", ".", "on", "(", "'connect.*.listening'", ",", "function", "(", "hostname", ",", "port", ")", "{", "// 0.0.0.0 does not work in windows", "if", "(", "hostname", "===", "'0.0.0.0'", ")", "{", "hostname", "=", "'localhost'", ";", "}", "// set baseUrl (using hostname / port from connect task)", "grunt", ".", "config", "(", "[", "'selenium_qunit'", ",", "'options'", ",", "'baseUrl'", "]", ",", "'http://'", "+", "hostname", "+", "':'", "+", "port", ")", ";", "// run selenium task", "grunt", ".", "task", ".", "run", "(", "[", "'selenium_qunit:run'", "]", ")", ";", "}", ")", ";", "// cleanup and start connect server", "grunt", ".", "task", ".", "run", "(", "[", "'clean:surefire-reports'", ",", "'openui5_connect:'", "+", "mode", "]", ")", ";", "}" ]
QUnit test task
[ "QUnit", "test", "task" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/grunt/config/aliases.js#L41-L69
4,333
SAP/openui5
src/sap.ui.core/src/sap/ui/thirdparty/zyngascroll.js
function(id) { var cleared = running[id] != null; if (cleared) { running[id] = null; } return cleared; }
javascript
function(id) { var cleared = running[id] != null; if (cleared) { running[id] = null; } return cleared; }
[ "function", "(", "id", ")", "{", "var", "cleared", "=", "running", "[", "id", "]", "!=", "null", ";", "if", "(", "cleared", ")", "{", "running", "[", "id", "]", "=", "null", ";", "}", "return", "cleared", ";", "}" ]
Stops the given animation. @param {Integer} id Unique animation ID @return {Boolean} Whether the animation was stopped (aka, was running before)
[ "Stops", "the", "given", "animation", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/thirdparty/zyngascroll.js#L182-L189
4,334
SAP/openui5
src/sap.ui.core/src/sap/ui/thirdparty/zyngascroll.js
function(left, top, animate) { var self = this; var startLeft = self.__isAnimating ? self.__scheduledLeft : self.__scrollLeft; var startTop = self.__isAnimating ? self.__scheduledTop : self.__scrollTop; self.scrollTo(startLeft + (left || 0), startTop + (top || 0), animate); }
javascript
function(left, top, animate) { var self = this; var startLeft = self.__isAnimating ? self.__scheduledLeft : self.__scrollLeft; var startTop = self.__isAnimating ? self.__scheduledTop : self.__scrollTop; self.scrollTo(startLeft + (left || 0), startTop + (top || 0), animate); }
[ "function", "(", "left", ",", "top", ",", "animate", ")", "{", "var", "self", "=", "this", ";", "var", "startLeft", "=", "self", ".", "__isAnimating", "?", "self", ".", "__scheduledLeft", ":", "self", ".", "__scrollLeft", ";", "var", "startTop", "=", "self", ".", "__isAnimating", "?", "self", ".", "__scheduledTop", ":", "self", ".", "__scrollTop", ";", "self", ".", "scrollTo", "(", "startLeft", "+", "(", "left", "||", "0", ")", ",", "startTop", "+", "(", "top", "||", "0", ")", ",", "animate", ")", ";", "}" ]
Scroll by the given offset @param {Number ? 0} left Scroll x-axis by given offset @param {Number ? 0} top Scroll x-axis by given offset @param {Boolean ? false} animate Whether to animate the given change
[ "Scroll", "by", "the", "given", "offset" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/thirdparty/zyngascroll.js#L872-L881
4,335
SAP/openui5
src/sap.ui.core/src/sap/ui/core/routing/async/Targets.js
function (vTargets, vData, sTitleTarget) { var oSequencePromise = Promise.resolve(); return this._display(vTargets, vData, sTitleTarget, oSequencePromise); }
javascript
function (vTargets, vData, sTitleTarget) { var oSequencePromise = Promise.resolve(); return this._display(vTargets, vData, sTitleTarget, oSequencePromise); }
[ "function", "(", "vTargets", ",", "vData", ",", "sTitleTarget", ")", "{", "var", "oSequencePromise", "=", "Promise", ".", "resolve", "(", ")", ";", "return", "this", ".", "_display", "(", "vTargets", ",", "vData", ",", "sTitleTarget", ",", "oSequencePromise", ")", ";", "}" ]
Creates a view and puts it in an aggregation of the specified control. @param {string|string[]} vTargets the key of the target as specified in the {@link #constructor}. To display multiple targets you may also pass an array of keys. @param {object} [vData] an object that will be passed to the display event in the data property. If the target has parents, the data will also be passed to them. @param {string} [sTitleTarget] the name of the target from which the title option is taken for firing the {@link sap.ui.core.routing.Targets#event:titleChanged titleChanged} event @private @returns {Promise} resolving with {{name: *, view: *, control: *}|undefined} for every vTargets, object for single, array for multiple
[ "Creates", "a", "view", "and", "puts", "it", "in", "an", "aggregation", "of", "the", "specified", "control", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/routing/async/Targets.js#L23-L26
4,336
SAP/openui5
src/sap.ui.core/src/sap/ui/core/routing/async/Targets.js
function (oTargetInfo, vData, oSequencePromise, oTargetCreateInfo) { var sName = oTargetInfo.name, oTarget = this.getTarget(sName); if (oTarget !== undefined) { return oTarget._display(vData, oSequencePromise, oTargetCreateInfo); } else { var sErrorMessage = "The target with the name \"" + sName + "\" does not exist!"; Log.error(sErrorMessage, this); return Promise.resolve({ name: sName, error: sErrorMessage }); } }
javascript
function (oTargetInfo, vData, oSequencePromise, oTargetCreateInfo) { var sName = oTargetInfo.name, oTarget = this.getTarget(sName); if (oTarget !== undefined) { return oTarget._display(vData, oSequencePromise, oTargetCreateInfo); } else { var sErrorMessage = "The target with the name \"" + sName + "\" does not exist!"; Log.error(sErrorMessage, this); return Promise.resolve({ name: sName, error: sErrorMessage }); } }
[ "function", "(", "oTargetInfo", ",", "vData", ",", "oSequencePromise", ",", "oTargetCreateInfo", ")", "{", "var", "sName", "=", "oTargetInfo", ".", "name", ",", "oTarget", "=", "this", ".", "getTarget", "(", "sName", ")", ";", "if", "(", "oTarget", "!==", "undefined", ")", "{", "return", "oTarget", ".", "_display", "(", "vData", ",", "oSequencePromise", ",", "oTargetCreateInfo", ")", ";", "}", "else", "{", "var", "sErrorMessage", "=", "\"The target with the name \\\"\"", "+", "sName", "+", "\"\\\" does not exist!\"", ";", "Log", ".", "error", "(", "sErrorMessage", ",", "this", ")", ";", "return", "Promise", ".", "resolve", "(", "{", "name", ":", "sName", ",", "error", ":", "sErrorMessage", "}", ")", ";", "}", "}" ]
Displays a single target @param {string} sName name of the single target @param {any} vData an object that will be passed to the display event in the data property. @param {Promise} oSequencePromise the promise which for chaining @param {object} [oTargetCreateInfo] the object which contains extra information for the creation of the target @param {function} [oTargetCreateInfo.afterCreate] the function which is called after a target View/Component is instantiated @param {string} [oTargetCreateInfo.prefix] the prefix which will be used by the RouterHashChanger of the target @private
[ "Displays", "a", "single", "target" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/routing/async/Targets.js#L86-L100
4,337
SAP/openui5
src/sap.ui.core/src/sap/ui/core/hyphenation/Hyphenation.js
initializeLanguage
function initializeLanguage(sLanguage, oConfig, resolve) { Log.info( "[UI5 Hyphenation] Initializing third-party module for language " + getLanguageDisplayName(sLanguage), "sap.ui.core.hyphenation.Hyphenation.initialize()" ); window.hyphenopoly.initializeLanguage(oConfig) .then(onLanguageInitialized.bind(this, sLanguage, resolve)); }
javascript
function initializeLanguage(sLanguage, oConfig, resolve) { Log.info( "[UI5 Hyphenation] Initializing third-party module for language " + getLanguageDisplayName(sLanguage), "sap.ui.core.hyphenation.Hyphenation.initialize()" ); window.hyphenopoly.initializeLanguage(oConfig) .then(onLanguageInitialized.bind(this, sLanguage, resolve)); }
[ "function", "initializeLanguage", "(", "sLanguage", ",", "oConfig", ",", "resolve", ")", "{", "Log", ".", "info", "(", "\"[UI5 Hyphenation] Initializing third-party module for language \"", "+", "getLanguageDisplayName", "(", "sLanguage", ")", ",", "\"sap.ui.core.hyphenation.Hyphenation.initialize()\"", ")", ";", "window", ".", "hyphenopoly", ".", "initializeLanguage", "(", "oConfig", ")", ".", "then", "(", "onLanguageInitialized", ".", "bind", "(", "this", ",", "sLanguage", ",", "resolve", ")", ")", ";", "}" ]
Calls Hyphenopoly to initialize a language. Loads language-specific resources. @param {string} sLanguage What language to initialize @param {map} oConfig What config to sent to Hyphenopoly @param {function} resolve Callback to resolve the promise created on initialize @private
[ "Calls", "Hyphenopoly", "to", "initialize", "a", "language", ".", "Loads", "language", "-", "specific", "resources", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/hyphenation/Hyphenation.js#L133-L141
4,338
SAP/openui5
src/sap.ui.core/src/sap/ui/core/hyphenation/Hyphenation.js
onLanguageInitialized
function onLanguageInitialized(sLanguage, resolve, hyphenateMethod) { oHyphenateMethods[sLanguage] = hyphenateMethod; oHyphenationInstance.bIsInitialized = true; if (aLanguagesQueue.length > 0) { aLanguagesQueue.forEach(function (oElement) { initializeLanguage(oElement.sLanguage, oElement.oConfig, oElement.resolve); }); aLanguagesQueue = []; } oHyphenationInstance.bLoading = false; resolve( getLanguageFromPattern(sLanguage) ); }
javascript
function onLanguageInitialized(sLanguage, resolve, hyphenateMethod) { oHyphenateMethods[sLanguage] = hyphenateMethod; oHyphenationInstance.bIsInitialized = true; if (aLanguagesQueue.length > 0) { aLanguagesQueue.forEach(function (oElement) { initializeLanguage(oElement.sLanguage, oElement.oConfig, oElement.resolve); }); aLanguagesQueue = []; } oHyphenationInstance.bLoading = false; resolve( getLanguageFromPattern(sLanguage) ); }
[ "function", "onLanguageInitialized", "(", "sLanguage", ",", "resolve", ",", "hyphenateMethod", ")", "{", "oHyphenateMethods", "[", "sLanguage", "]", "=", "hyphenateMethod", ";", "oHyphenationInstance", ".", "bIsInitialized", "=", "true", ";", "if", "(", "aLanguagesQueue", ".", "length", ">", "0", ")", "{", "aLanguagesQueue", ".", "forEach", "(", "function", "(", "oElement", ")", "{", "initializeLanguage", "(", "oElement", ".", "sLanguage", ",", "oElement", ".", "oConfig", ",", "oElement", ".", "resolve", ")", ";", "}", ")", ";", "aLanguagesQueue", "=", "[", "]", ";", "}", "oHyphenationInstance", ".", "bLoading", "=", "false", ";", "resolve", "(", "getLanguageFromPattern", "(", "sLanguage", ")", ")", ";", "}" ]
A callback for when language initialization is ready. @param {string} sLanguage What language was initialized @param {function} resolve Callback to resolve the promise created on initialize @param {string} hyphenateMethod Is it asm or wasm @private
[ "A", "callback", "for", "when", "language", "initialization", "is", "ready", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/hyphenation/Hyphenation.js#L169-L182
4,339
SAP/openui5
src/sap.ui.core/src/sap/ui/core/hyphenation/Hyphenation.js
prepareConfig
function prepareConfig(sLanguage, oConfig) { //Creating default configuration var oConfigurationForLanguage = { "require": [sLanguage], "hyphen": "\u00AD", "leftmin": 3, // The minimum of chars to remain on the old line. "rightmin": 3,// The minimum of chars to go on the new line "compound": "all", // factory-made -> fac-tory-[ZWSP]made "path": jQuery.sap.getResourcePath("sap/ui/thirdparty/hyphenopoly") }; // we are passing only 3 properties to hyphenopoly: hyphen, exceptions and minWordLength if (oConfig) { if ("hyphen" in oConfig) { oConfigurationForLanguage.hyphen = oConfig.hyphen; } if ("minWordLength" in oConfig) { oConfigurationForLanguage.minWordLength = oConfig.minWordLength; } if ("exceptions" in oConfig) { Log.info( "[UI5 Hyphenation] Add hyphenation exceptions '" + JSON.stringify(oConfig.exceptions) + "' for language " + getLanguageDisplayName(sLanguage), "sap.ui.core.hyphenation.Hyphenation" ); // transform "exceptions: {word1: "w-o-r-d-1", word2: "w-o-r-d-2"}" to "exceptions: {en-us: 'w-o-r-d-1,w-o-r-d-2'}" var aWordsExceptions = []; Object.keys(oConfig.exceptions).forEach(function(sWord) { aWordsExceptions.push(oConfig.exceptions[sWord]); }); if (aWordsExceptions.length > 0) { oConfigurationForLanguage.exceptions = {}; oConfigurationForLanguage.exceptions[sLanguage] = aWordsExceptions.join(", "); } } } return oConfigurationForLanguage; }
javascript
function prepareConfig(sLanguage, oConfig) { //Creating default configuration var oConfigurationForLanguage = { "require": [sLanguage], "hyphen": "\u00AD", "leftmin": 3, // The minimum of chars to remain on the old line. "rightmin": 3,// The minimum of chars to go on the new line "compound": "all", // factory-made -> fac-tory-[ZWSP]made "path": jQuery.sap.getResourcePath("sap/ui/thirdparty/hyphenopoly") }; // we are passing only 3 properties to hyphenopoly: hyphen, exceptions and minWordLength if (oConfig) { if ("hyphen" in oConfig) { oConfigurationForLanguage.hyphen = oConfig.hyphen; } if ("minWordLength" in oConfig) { oConfigurationForLanguage.minWordLength = oConfig.minWordLength; } if ("exceptions" in oConfig) { Log.info( "[UI5 Hyphenation] Add hyphenation exceptions '" + JSON.stringify(oConfig.exceptions) + "' for language " + getLanguageDisplayName(sLanguage), "sap.ui.core.hyphenation.Hyphenation" ); // transform "exceptions: {word1: "w-o-r-d-1", word2: "w-o-r-d-2"}" to "exceptions: {en-us: 'w-o-r-d-1,w-o-r-d-2'}" var aWordsExceptions = []; Object.keys(oConfig.exceptions).forEach(function(sWord) { aWordsExceptions.push(oConfig.exceptions[sWord]); }); if (aWordsExceptions.length > 0) { oConfigurationForLanguage.exceptions = {}; oConfigurationForLanguage.exceptions[sLanguage] = aWordsExceptions.join(", "); } } } return oConfigurationForLanguage; }
[ "function", "prepareConfig", "(", "sLanguage", ",", "oConfig", ")", "{", "//Creating default configuration", "var", "oConfigurationForLanguage", "=", "{", "\"require\"", ":", "[", "sLanguage", "]", ",", "\"hyphen\"", ":", "\"\\u00AD\"", ",", "\"leftmin\"", ":", "3", ",", "// The minimum of chars to remain on the old line.", "\"rightmin\"", ":", "3", ",", "// The minimum of chars to go on the new line", "\"compound\"", ":", "\"all\"", ",", "// factory-made -> fac-tory-[ZWSP]made", "\"path\"", ":", "jQuery", ".", "sap", ".", "getResourcePath", "(", "\"sap/ui/thirdparty/hyphenopoly\"", ")", "}", ";", "// we are passing only 3 properties to hyphenopoly: hyphen, exceptions and minWordLength", "if", "(", "oConfig", ")", "{", "if", "(", "\"hyphen\"", "in", "oConfig", ")", "{", "oConfigurationForLanguage", ".", "hyphen", "=", "oConfig", ".", "hyphen", ";", "}", "if", "(", "\"minWordLength\"", "in", "oConfig", ")", "{", "oConfigurationForLanguage", ".", "minWordLength", "=", "oConfig", ".", "minWordLength", ";", "}", "if", "(", "\"exceptions\"", "in", "oConfig", ")", "{", "Log", ".", "info", "(", "\"[UI5 Hyphenation] Add hyphenation exceptions '\"", "+", "JSON", ".", "stringify", "(", "oConfig", ".", "exceptions", ")", "+", "\"' for language \"", "+", "getLanguageDisplayName", "(", "sLanguage", ")", ",", "\"sap.ui.core.hyphenation.Hyphenation\"", ")", ";", "// transform \"exceptions: {word1: \"w-o-r-d-1\", word2: \"w-o-r-d-2\"}\" to \"exceptions: {en-us: 'w-o-r-d-1,w-o-r-d-2'}\"", "var", "aWordsExceptions", "=", "[", "]", ";", "Object", ".", "keys", "(", "oConfig", ".", "exceptions", ")", ".", "forEach", "(", "function", "(", "sWord", ")", "{", "aWordsExceptions", ".", "push", "(", "oConfig", ".", "exceptions", "[", "sWord", "]", ")", ";", "}", ")", ";", "if", "(", "aWordsExceptions", ".", "length", ">", "0", ")", "{", "oConfigurationForLanguage", ".", "exceptions", "=", "{", "}", ";", "oConfigurationForLanguage", ".", "exceptions", "[", "sLanguage", "]", "=", "aWordsExceptions", ".", "join", "(", "\", \"", ")", ";", "}", "}", "}", "return", "oConfigurationForLanguage", ";", "}" ]
Transforms the given config so it can be sent to Hyphenopoly. @param {string} sLanguage The language for which a config is prepared. @param {map} oConfig Object map with configuration @returns {Object} {{require: [*], hyphen: string, path: (string|*)}} @private
[ "Transforms", "the", "given", "config", "so", "it", "can", "be", "sent", "to", "Hyphenopoly", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/hyphenation/Hyphenation.js#L192-L233
4,340
SAP/openui5
src/sap.ui.core/src/sap/ui/core/hyphenation/Hyphenation.js
getLanguage
function getLanguage(sLang) { var oLocale; if (sLang) { oLocale = new Locale(sLang); } else { oLocale = sap.ui.getCore().getConfiguration().getLocale(); } var sLanguage = oLocale.getLanguage().toLowerCase(); // adjustment of the language to corresponds to Hyphenopoly pattern files (.hpb files) switch (sLanguage) { case "en": sLanguage = "en-us"; break; case "nb": sLanguage = "nb-no"; break; case "no": sLanguage = "nb-no"; break; case "el": sLanguage = "el-monoton"; break; } return sLanguage; }
javascript
function getLanguage(sLang) { var oLocale; if (sLang) { oLocale = new Locale(sLang); } else { oLocale = sap.ui.getCore().getConfiguration().getLocale(); } var sLanguage = oLocale.getLanguage().toLowerCase(); // adjustment of the language to corresponds to Hyphenopoly pattern files (.hpb files) switch (sLanguage) { case "en": sLanguage = "en-us"; break; case "nb": sLanguage = "nb-no"; break; case "no": sLanguage = "nb-no"; break; case "el": sLanguage = "el-monoton"; break; } return sLanguage; }
[ "function", "getLanguage", "(", "sLang", ")", "{", "var", "oLocale", ";", "if", "(", "sLang", ")", "{", "oLocale", "=", "new", "Locale", "(", "sLang", ")", ";", "}", "else", "{", "oLocale", "=", "sap", ".", "ui", ".", "getCore", "(", ")", ".", "getConfiguration", "(", ")", ".", "getLocale", "(", ")", ";", "}", "var", "sLanguage", "=", "oLocale", ".", "getLanguage", "(", ")", ".", "toLowerCase", "(", ")", ";", "// adjustment of the language to corresponds to Hyphenopoly pattern files (.hpb files)", "switch", "(", "sLanguage", ")", "{", "case", "\"en\"", ":", "sLanguage", "=", "\"en-us\"", ";", "break", ";", "case", "\"nb\"", ":", "sLanguage", "=", "\"nb-no\"", ";", "break", ";", "case", "\"no\"", ":", "sLanguage", "=", "\"nb-no\"", ";", "break", ";", "case", "\"el\"", ":", "sLanguage", "=", "\"el-monoton\"", ";", "break", ";", "}", "return", "sLanguage", ";", "}" ]
Gets global language code or the given language code. @param {string} [sLang] The language to get. If left empty - the global application language will be returned @returns {string} The language code @private
[ "Gets", "global", "language", "code", "or", "the", "given", "language", "code", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/hyphenation/Hyphenation.js#L348-L375
4,341
SAP/openui5
src/sap.ui.core/src/sap/ui/core/hyphenation/Hyphenation.js
getLanguageDisplayName
function getLanguageDisplayName(sPatternName) { var sLang = getLanguageFromPattern(sPatternName); if (mLanguageNamesInEnglish.hasOwnProperty(sLang)) { return "'" + mLanguageNamesInEnglish[sLang] + "' (code:'" + sLang + "')"; } else { return "'" + sLang + "'"; } }
javascript
function getLanguageDisplayName(sPatternName) { var sLang = getLanguageFromPattern(sPatternName); if (mLanguageNamesInEnglish.hasOwnProperty(sLang)) { return "'" + mLanguageNamesInEnglish[sLang] + "' (code:'" + sLang + "')"; } else { return "'" + sLang + "'"; } }
[ "function", "getLanguageDisplayName", "(", "sPatternName", ")", "{", "var", "sLang", "=", "getLanguageFromPattern", "(", "sPatternName", ")", ";", "if", "(", "mLanguageNamesInEnglish", ".", "hasOwnProperty", "(", "sLang", ")", ")", "{", "return", "\"'\"", "+", "mLanguageNamesInEnglish", "[", "sLang", "]", "+", "\"' (code:'\"", "+", "sLang", "+", "\"')\"", ";", "}", "else", "{", "return", "\"'\"", "+", "sLang", "+", "\"'\"", ";", "}", "}" ]
Gets a human readable english name for the language. If not found - returns a string with the language code. @param {string} sPatternName The pattern name (hpb file name) @return {string} Returns a human readable english name for the language
[ "Gets", "a", "human", "readable", "english", "name", "for", "the", "language", ".", "If", "not", "found", "-", "returns", "a", "string", "with", "the", "language", "code", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/hyphenation/Hyphenation.js#L398-L406
4,342
SAP/openui5
src/sap.m/src/sap/m/Support.js
line
function line(buffer, right, border, label, content) { buffer.push("<tr class='sapUiSelectable'><td class='sapUiSupportTechInfoBorder sapUiSelectable'><label class='sapUiSupportLabel sapUiSelectable'>", encodeXML(label), "</label><br>"); var ctnt = content; if (jQuery.isFunction(content)) { ctnt = content(buffer) || ""; } buffer.push(encodeXML(ctnt)); buffer.push("</td></tr>"); }
javascript
function line(buffer, right, border, label, content) { buffer.push("<tr class='sapUiSelectable'><td class='sapUiSupportTechInfoBorder sapUiSelectable'><label class='sapUiSupportLabel sapUiSelectable'>", encodeXML(label), "</label><br>"); var ctnt = content; if (jQuery.isFunction(content)) { ctnt = content(buffer) || ""; } buffer.push(encodeXML(ctnt)); buffer.push("</td></tr>"); }
[ "function", "line", "(", "buffer", ",", "right", ",", "border", ",", "label", ",", "content", ")", "{", "buffer", ".", "push", "(", "\"<tr class='sapUiSelectable'><td class='sapUiSupportTechInfoBorder sapUiSelectable'><label class='sapUiSupportLabel sapUiSelectable'>\"", ",", "encodeXML", "(", "label", ")", ",", "\"</label><br>\"", ")", ";", "var", "ctnt", "=", "content", ";", "if", "(", "jQuery", ".", "isFunction", "(", "content", ")", ")", "{", "ctnt", "=", "content", "(", "buffer", ")", "||", "\"\"", ";", "}", "buffer", ".", "push", "(", "encodeXML", "(", "ctnt", ")", ")", ";", "buffer", ".", "push", "(", "\"</td></tr>\"", ")", ";", "}" ]
variable used to open the support dialog on windows phone copied from core
[ "variable", "used", "to", "open", "the", "support", "dialog", "on", "windows", "phone", "copied", "from", "core" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.m/src/sap/m/Support.js#L79-L87
4,343
SAP/openui5
src/sap.m/src/sap/m/Support.js
setupDialog
function setupDialog() { // setup e2e values as log level and content if (dialog.traceXml) { dialog.$(e2eTraceConst.taContent).text(dialog.traceXml); } if (dialog.e2eLogLevel) { dialog.$(e2eTraceConst.selLevel).val(dialog.e2eLogLevel); } fillPanelContent(controlIDs.dvLoadedModules, oData.modules); // bind button Start event dialog.$(e2eTraceConst.btnStart).one("tap", function () { dialog.e2eLogLevel = dialog.$(e2eTraceConst.selLevel).val(); dialog.$(e2eTraceConst.btnStart).addClass("sapUiSupportRunningTrace").text("Running..."); dialog.traceXml = ""; dialog.$(e2eTraceConst.taContent).text(""); sap.ui.core.support.trace.E2eTraceLib.start(dialog.e2eLogLevel, function (traceXml) { dialog.traceXml = traceXml; }); // show info message about the E2E trace activation sap.m.MessageToast.show(e2eTraceConst.infoText, {duration: e2eTraceConst.infoDuration}); //close the dialog, but keep it for later use dialog.close(); }); }
javascript
function setupDialog() { // setup e2e values as log level and content if (dialog.traceXml) { dialog.$(e2eTraceConst.taContent).text(dialog.traceXml); } if (dialog.e2eLogLevel) { dialog.$(e2eTraceConst.selLevel).val(dialog.e2eLogLevel); } fillPanelContent(controlIDs.dvLoadedModules, oData.modules); // bind button Start event dialog.$(e2eTraceConst.btnStart).one("tap", function () { dialog.e2eLogLevel = dialog.$(e2eTraceConst.selLevel).val(); dialog.$(e2eTraceConst.btnStart).addClass("sapUiSupportRunningTrace").text("Running..."); dialog.traceXml = ""; dialog.$(e2eTraceConst.taContent).text(""); sap.ui.core.support.trace.E2eTraceLib.start(dialog.e2eLogLevel, function (traceXml) { dialog.traceXml = traceXml; }); // show info message about the E2E trace activation sap.m.MessageToast.show(e2eTraceConst.infoText, {duration: e2eTraceConst.infoDuration}); //close the dialog, but keep it for later use dialog.close(); }); }
[ "function", "setupDialog", "(", ")", "{", "// setup e2e values as log level and content", "if", "(", "dialog", ".", "traceXml", ")", "{", "dialog", ".", "$", "(", "e2eTraceConst", ".", "taContent", ")", ".", "text", "(", "dialog", ".", "traceXml", ")", ";", "}", "if", "(", "dialog", ".", "e2eLogLevel", ")", "{", "dialog", ".", "$", "(", "e2eTraceConst", ".", "selLevel", ")", ".", "val", "(", "dialog", ".", "e2eLogLevel", ")", ";", "}", "fillPanelContent", "(", "controlIDs", ".", "dvLoadedModules", ",", "oData", ".", "modules", ")", ";", "// bind button Start event", "dialog", ".", "$", "(", "e2eTraceConst", ".", "btnStart", ")", ".", "one", "(", "\"tap\"", ",", "function", "(", ")", "{", "dialog", ".", "e2eLogLevel", "=", "dialog", ".", "$", "(", "e2eTraceConst", ".", "selLevel", ")", ".", "val", "(", ")", ";", "dialog", ".", "$", "(", "e2eTraceConst", ".", "btnStart", ")", ".", "addClass", "(", "\"sapUiSupportRunningTrace\"", ")", ".", "text", "(", "\"Running...\"", ")", ";", "dialog", ".", "traceXml", "=", "\"\"", ";", "dialog", ".", "$", "(", "e2eTraceConst", ".", "taContent", ")", ".", "text", "(", "\"\"", ")", ";", "sap", ".", "ui", ".", "core", ".", "support", ".", "trace", ".", "E2eTraceLib", ".", "start", "(", "dialog", ".", "e2eLogLevel", ",", "function", "(", "traceXml", ")", "{", "dialog", ".", "traceXml", "=", "traceXml", ";", "}", ")", ";", "// show info message about the E2E trace activation", "sap", ".", "m", ".", "MessageToast", ".", "show", "(", "e2eTraceConst", ".", "infoText", ",", "{", "duration", ":", "e2eTraceConst", ".", "infoDuration", "}", ")", ";", "//close the dialog, but keep it for later use", "dialog", ".", "close", "(", ")", ";", "}", ")", ";", "}" ]
setup dialog elements and bind some events
[ "setup", "dialog", "elements", "and", "bind", "some", "events" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.m/src/sap/m/Support.js#L208-L238
4,344
SAP/openui5
src/sap.m/src/sap/m/Support.js
getDialog
function getDialog() { if (dialog) { return dialog; } var Dialog = sap.ui.requireSync("sap/m/Dialog"); var Button = sap.ui.requireSync("sap/m/Button"); sap.ui.requireSync("sap/ui/core/HTML"); sap.ui.requireSync("sap/m/MessageToast"); sap.ui.requireSync("sap/ui/core/support/trace/E2eTraceLib"); dialog = new Dialog({ title: "Technical Information", horizontalScrolling: true, verticalScrolling: true, stretch: Device.system.phone, buttons: [ new Button({ text: "Close", press: function () { dialog.close(); } }) ], afterOpen: function () { Support.off(); }, afterClose: function () { Support.on(); } }).addStyleClass("sapMSupport"); return dialog; }
javascript
function getDialog() { if (dialog) { return dialog; } var Dialog = sap.ui.requireSync("sap/m/Dialog"); var Button = sap.ui.requireSync("sap/m/Button"); sap.ui.requireSync("sap/ui/core/HTML"); sap.ui.requireSync("sap/m/MessageToast"); sap.ui.requireSync("sap/ui/core/support/trace/E2eTraceLib"); dialog = new Dialog({ title: "Technical Information", horizontalScrolling: true, verticalScrolling: true, stretch: Device.system.phone, buttons: [ new Button({ text: "Close", press: function () { dialog.close(); } }) ], afterOpen: function () { Support.off(); }, afterClose: function () { Support.on(); } }).addStyleClass("sapMSupport"); return dialog; }
[ "function", "getDialog", "(", ")", "{", "if", "(", "dialog", ")", "{", "return", "dialog", ";", "}", "var", "Dialog", "=", "sap", ".", "ui", ".", "requireSync", "(", "\"sap/m/Dialog\"", ")", ";", "var", "Button", "=", "sap", ".", "ui", ".", "requireSync", "(", "\"sap/m/Button\"", ")", ";", "sap", ".", "ui", ".", "requireSync", "(", "\"sap/ui/core/HTML\"", ")", ";", "sap", ".", "ui", ".", "requireSync", "(", "\"sap/m/MessageToast\"", ")", ";", "sap", ".", "ui", ".", "requireSync", "(", "\"sap/ui/core/support/trace/E2eTraceLib\"", ")", ";", "dialog", "=", "new", "Dialog", "(", "{", "title", ":", "\"Technical Information\"", ",", "horizontalScrolling", ":", "true", ",", "verticalScrolling", ":", "true", ",", "stretch", ":", "Device", ".", "system", ".", "phone", ",", "buttons", ":", "[", "new", "Button", "(", "{", "text", ":", "\"Close\"", ",", "press", ":", "function", "(", ")", "{", "dialog", ".", "close", "(", ")", ";", "}", "}", ")", "]", ",", "afterOpen", ":", "function", "(", ")", "{", "Support", ".", "off", "(", ")", ";", "}", ",", "afterClose", ":", "function", "(", ")", "{", "Support", ".", "on", "(", ")", ";", "}", "}", ")", ".", "addStyleClass", "(", "\"sapMSupport\"", ")", ";", "return", "dialog", ";", "}" ]
get or create dialog instance and return
[ "get", "or", "create", "dialog", "instance", "and", "return" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.m/src/sap/m/Support.js#L241-L274
4,345
SAP/openui5
src/sap.m/src/sap/m/Support.js
onTouchStart
function onTouchStart(oEvent) { if (oEvent.touches) { var currentTouches = oEvent.touches.length; if (Device.browser.mobile && (Device.browser.name === Device.browser.BROWSER.INTERNET_EXPLORER ||// TODO remove after 1.62 version Device.browser.name === Device.browser.BROWSER.EDGE)) { windowsPhoneTouches = currentTouches; } if (currentTouches > maxFingersAllowed) { document.removeEventListener('touchend', onTouchEnd); return; } switch (currentTouches) { case holdFingersNumber: startTime = Date.now(); document.addEventListener('touchend', onTouchEnd); break; case maxFingersAllowed: if (startTime) { timeDiff = Date.now() - startTime; lastTouchUID = oEvent.touches[currentTouches - 1].identifier; } break; } } }
javascript
function onTouchStart(oEvent) { if (oEvent.touches) { var currentTouches = oEvent.touches.length; if (Device.browser.mobile && (Device.browser.name === Device.browser.BROWSER.INTERNET_EXPLORER ||// TODO remove after 1.62 version Device.browser.name === Device.browser.BROWSER.EDGE)) { windowsPhoneTouches = currentTouches; } if (currentTouches > maxFingersAllowed) { document.removeEventListener('touchend', onTouchEnd); return; } switch (currentTouches) { case holdFingersNumber: startTime = Date.now(); document.addEventListener('touchend', onTouchEnd); break; case maxFingersAllowed: if (startTime) { timeDiff = Date.now() - startTime; lastTouchUID = oEvent.touches[currentTouches - 1].identifier; } break; } } }
[ "function", "onTouchStart", "(", "oEvent", ")", "{", "if", "(", "oEvent", ".", "touches", ")", "{", "var", "currentTouches", "=", "oEvent", ".", "touches", ".", "length", ";", "if", "(", "Device", ".", "browser", ".", "mobile", "&&", "(", "Device", ".", "browser", ".", "name", "===", "Device", ".", "browser", ".", "BROWSER", ".", "INTERNET_EXPLORER", "||", "// TODO remove after 1.62 version", "Device", ".", "browser", ".", "name", "===", "Device", ".", "browser", ".", "BROWSER", ".", "EDGE", ")", ")", "{", "windowsPhoneTouches", "=", "currentTouches", ";", "}", "if", "(", "currentTouches", ">", "maxFingersAllowed", ")", "{", "document", ".", "removeEventListener", "(", "'touchend'", ",", "onTouchEnd", ")", ";", "return", ";", "}", "switch", "(", "currentTouches", ")", "{", "case", "holdFingersNumber", ":", "startTime", "=", "Date", ".", "now", "(", ")", ";", "document", ".", "addEventListener", "(", "'touchend'", ",", "onTouchEnd", ")", ";", "break", ";", "case", "maxFingersAllowed", ":", "if", "(", "startTime", ")", "{", "timeDiff", "=", "Date", ".", "now", "(", ")", "-", "startTime", ";", "lastTouchUID", "=", "oEvent", ".", "touches", "[", "currentTouches", "-", "1", "]", ".", "identifier", ";", "}", "break", ";", "}", "}", "}" ]
function is triggered when a touch is detected
[ "function", "is", "triggered", "when", "a", "touch", "is", "detected" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.m/src/sap/m/Support.js#L277-L308
4,346
SAP/openui5
src/sap.ui.core/src/sap/ui/core/Renderer.js
createExtendedRenderer
function createExtendedRenderer(sName, oRendererInfo) { assert(this != null, 'BaseRenderer must be a non-null object'); assert(typeof sName === 'string' && sName, 'Renderer.extend must be called with a non-empty name for the new renderer'); assert(oRendererInfo == null || (isPlainObject(oRendererInfo) && Object.keys(oRendererInfo).every(function(key) { return oRendererInfo[key] !== undefined; })), 'oRendererInfo can be omitted or must be a plain object without any undefined property values'); var oChildRenderer = Object.create(this); // subclasses should expose the modern signature variant only oChildRenderer.extend = createExtendedRenderer; jQuery.extend(oChildRenderer, oRendererInfo); // expose the renderer globally ObjectPath.set(sName, oChildRenderer); return oChildRenderer; }
javascript
function createExtendedRenderer(sName, oRendererInfo) { assert(this != null, 'BaseRenderer must be a non-null object'); assert(typeof sName === 'string' && sName, 'Renderer.extend must be called with a non-empty name for the new renderer'); assert(oRendererInfo == null || (isPlainObject(oRendererInfo) && Object.keys(oRendererInfo).every(function(key) { return oRendererInfo[key] !== undefined; })), 'oRendererInfo can be omitted or must be a plain object without any undefined property values'); var oChildRenderer = Object.create(this); // subclasses should expose the modern signature variant only oChildRenderer.extend = createExtendedRenderer; jQuery.extend(oChildRenderer, oRendererInfo); // expose the renderer globally ObjectPath.set(sName, oChildRenderer); return oChildRenderer; }
[ "function", "createExtendedRenderer", "(", "sName", ",", "oRendererInfo", ")", "{", "assert", "(", "this", "!=", "null", ",", "'BaseRenderer must be a non-null object'", ")", ";", "assert", "(", "typeof", "sName", "===", "'string'", "&&", "sName", ",", "'Renderer.extend must be called with a non-empty name for the new renderer'", ")", ";", "assert", "(", "oRendererInfo", "==", "null", "||", "(", "isPlainObject", "(", "oRendererInfo", ")", "&&", "Object", ".", "keys", "(", "oRendererInfo", ")", ".", "every", "(", "function", "(", "key", ")", "{", "return", "oRendererInfo", "[", "key", "]", "!==", "undefined", ";", "}", ")", ")", ",", "'oRendererInfo can be omitted or must be a plain object without any undefined property values'", ")", ";", "var", "oChildRenderer", "=", "Object", ".", "create", "(", "this", ")", ";", "// subclasses should expose the modern signature variant only", "oChildRenderer", ".", "extend", "=", "createExtendedRenderer", ";", "jQuery", ".", "extend", "(", "oChildRenderer", ",", "oRendererInfo", ")", ";", "// expose the renderer globally", "ObjectPath", ".", "set", "(", "sName", ",", "oChildRenderer", ")", ";", "return", "oChildRenderer", ";", "}" ]
Helper to create a new renderer by extending an existing one. @this {sap.ui.core.Renderer} The base renderer to extend @param {string} sName Global name of the new renderer @param {object} oRendererInfo Methods and static properties of the new renderer @returns {object} New static renderer class @private
[ "Helper", "to", "create", "a", "new", "renderer", "by", "extending", "an", "existing", "one", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/Renderer.js#L38-L56
4,347
SAP/openui5
src/sap.ui.core/src/sap/base/i18n/ResourceBundle.js
nextFallbackLocale
function nextFallbackLocale(sLocale) { // there is no fallback for the 'raw' locale or for null/undefined if ( !sLocale ) { return null; } // special (legacy) handling for zh_HK: try zh_TW (for Traditional Chinese) first before falling back to 'zh' if ( sLocale === "zh_HK" ) { return "zh_TW"; } // if there are multiple segments (separated by underscores), remove the last one var p = sLocale.lastIndexOf('_'); if ( p >= 0 ) { return sLocale.slice(0,p); } // invariant: only a single segment, must be a language // for any language but 'en', fallback to 'en' first before falling back to the 'raw' language (empty string) return sLocale !== 'en' ? 'en' : ''; }
javascript
function nextFallbackLocale(sLocale) { // there is no fallback for the 'raw' locale or for null/undefined if ( !sLocale ) { return null; } // special (legacy) handling for zh_HK: try zh_TW (for Traditional Chinese) first before falling back to 'zh' if ( sLocale === "zh_HK" ) { return "zh_TW"; } // if there are multiple segments (separated by underscores), remove the last one var p = sLocale.lastIndexOf('_'); if ( p >= 0 ) { return sLocale.slice(0,p); } // invariant: only a single segment, must be a language // for any language but 'en', fallback to 'en' first before falling back to the 'raw' language (empty string) return sLocale !== 'en' ? 'en' : ''; }
[ "function", "nextFallbackLocale", "(", "sLocale", ")", "{", "// there is no fallback for the 'raw' locale or for null/undefined", "if", "(", "!", "sLocale", ")", "{", "return", "null", ";", "}", "// special (legacy) handling for zh_HK: try zh_TW (for Traditional Chinese) first before falling back to 'zh'", "if", "(", "sLocale", "===", "\"zh_HK\"", ")", "{", "return", "\"zh_TW\"", ";", "}", "// if there are multiple segments (separated by underscores), remove the last one", "var", "p", "=", "sLocale", ".", "lastIndexOf", "(", "'_'", ")", ";", "if", "(", "p", ">=", "0", ")", "{", "return", "sLocale", ".", "slice", "(", "0", ",", "p", ")", ";", "}", "// invariant: only a single segment, must be a language", "// for any language but 'en', fallback to 'en' first before falling back to the 'raw' language (empty string)", "return", "sLocale", "!==", "'en'", "?", "'en'", ":", "''", ";", "}" ]
Calculate the next fallback locale for the given locale. Note: always keep this in sync with the fallback mechanism in Java, ABAP (MIME & BSP) resource handler (Java: Peter M., MIME: Sebastian A., BSP: Silke A.) @param {string} sLocale Locale string in Java format (underscores) or null @returns {string|null} Next fallback Locale or null if there is no more fallback @private
[ "Calculate", "the", "next", "fallback", "locale", "for", "the", "given", "locale", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/base/i18n/ResourceBundle.js#L129-L150
4,348
SAP/openui5
src/sap.ui.core/src/sap/base/i18n/ResourceBundle.js
splitUrl
function splitUrl(sUrl) { var m = rUrl.exec(sUrl); if ( !m || A_VALID_FILE_TYPES.indexOf( m[2] ) < 0 ) { throw new Error("resource URL '" + sUrl + "' has unknown type (should be one of " + A_VALID_FILE_TYPES.join(",") + ")"); } return { url : sUrl, prefix : m[1], ext : m[2], query: m[4], hash: (m[5] || ""), suffix : m[2] + (m[3] || "") }; }
javascript
function splitUrl(sUrl) { var m = rUrl.exec(sUrl); if ( !m || A_VALID_FILE_TYPES.indexOf( m[2] ) < 0 ) { throw new Error("resource URL '" + sUrl + "' has unknown type (should be one of " + A_VALID_FILE_TYPES.join(",") + ")"); } return { url : sUrl, prefix : m[1], ext : m[2], query: m[4], hash: (m[5] || ""), suffix : m[2] + (m[3] || "") }; }
[ "function", "splitUrl", "(", "sUrl", ")", "{", "var", "m", "=", "rUrl", ".", "exec", "(", "sUrl", ")", ";", "if", "(", "!", "m", "||", "A_VALID_FILE_TYPES", ".", "indexOf", "(", "m", "[", "2", "]", ")", "<", "0", ")", "{", "throw", "new", "Error", "(", "\"resource URL '\"", "+", "sUrl", "+", "\"' has unknown type (should be one of \"", "+", "A_VALID_FILE_TYPES", ".", "join", "(", "\",\"", ")", "+", "\")\"", ")", ";", "}", "return", "{", "url", ":", "sUrl", ",", "prefix", ":", "m", "[", "1", "]", ",", "ext", ":", "m", "[", "2", "]", ",", "query", ":", "m", "[", "4", "]", ",", "hash", ":", "(", "m", "[", "5", "]", "||", "\"\"", ")", ",", "suffix", ":", "m", "[", "2", "]", "+", "(", "m", "[", "3", "]", "||", "\"\"", ")", "}", ";", "}" ]
Helper to split a URL with the above regex. Either returns an object with the parts or undefined. @param {string} sUrl URL to analyze / split into pieces. @returns {object} an object with properties for the individual URL parts
[ "Helper", "to", "split", "a", "URL", "with", "the", "above", "regex", ".", "Either", "returns", "an", "object", "with", "the", "parts", "or", "undefined", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/base/i18n/ResourceBundle.js#L197-L203
4,349
SAP/openui5
src/sap.ui.rta/src/sap/ui/rta/plugin/additionalElements/AdditionalElementsAnalyzer.js
_isComplexType
function _isComplexType (mProperty) { if (mProperty && mProperty.type) { if (mProperty.type.toLowerCase().indexOf("edm") !== 0) { return true; } } return false; }
javascript
function _isComplexType (mProperty) { if (mProperty && mProperty.type) { if (mProperty.type.toLowerCase().indexOf("edm") !== 0) { return true; } } return false; }
[ "function", "_isComplexType", "(", "mProperty", ")", "{", "if", "(", "mProperty", "&&", "mProperty", ".", "type", ")", "{", "if", "(", "mProperty", ".", "type", ".", "toLowerCase", "(", ")", ".", "indexOf", "(", "\"edm\"", ")", "!==", "0", ")", "{", "return", "true", ";", "}", "}", "return", "false", ";", "}" ]
Is field using a complex type @param {Object} mProperty - property from entityType @returns {Boolean} - Returns true if property is using a complex type
[ "Is", "field", "using", "a", "complex", "type" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.rta/src/sap/ui/rta/plugin/additionalElements/AdditionalElementsAnalyzer.js#L52-L59
4,350
SAP/openui5
src/sap.ui.rta/src/sap/ui/rta/plugin/additionalElements/AdditionalElementsAnalyzer.js
_getODataPropertiesOfModel
function _getODataPropertiesOfModel(oElement, sAggregationName) { var oModel = oElement.getModel(); var mData = { property: [], navigationProperty: [], navigationEntityNames: [] }; if (oModel) { var sModelName = oModel.getMetadata().getName(); if (sModelName === "sap.ui.model.odata.ODataModel" || sModelName === "sap.ui.model.odata.v2.ODataModel") { var oMetaModel = oModel.getMetaModel(); return oMetaModel.loaded().then(function(){ var sBindingContextPath = _getBindingPath(oElement, sAggregationName); if (sBindingContextPath) { var oMetaModelContext = oMetaModel.getMetaContext(sBindingContextPath); var mODataEntity = oMetaModelContext.getObject(); var oDefaultAggregation = oElement.getMetadata().getAggregation(); if (oDefaultAggregation) { var oBinding = oElement.getBindingInfo(oDefaultAggregation.name); var oTemplate = oBinding && oBinding.template; if (oTemplate) { var sPath = oElement.getBindingPath(oDefaultAggregation.name); var oODataAssociationEnd = oMetaModel.getODataAssociationEnd(mODataEntity, sPath); var sFullyQualifiedEntityName = oODataAssociationEnd && oODataAssociationEnd.type; if (sFullyQualifiedEntityName) { var oEntityType = oMetaModel.getODataEntityType(sFullyQualifiedEntityName); mODataEntity = oEntityType; } } } mData.property = mODataEntity.property || []; mData.property = _expandComplexProperties(mData.property, oMetaModel, mODataEntity); mData.property = _filterInvisibleProperties(mData.property, oElement, sAggregationName); if (mODataEntity.navigationProperty){ mData.navigationProperty = mODataEntity.navigationProperty; mODataEntity.navigationProperty.forEach(function(oNavProp){ var sFullyQualifiedEntityName = ( oMetaModel.getODataAssociationEnd(mODataEntity, oNavProp.name) && oMetaModel.getODataAssociationEnd(mODataEntity, oNavProp.name).type ); var oEntityType = oMetaModel.getODataEntityType(sFullyQualifiedEntityName); if (oEntityType && oEntityType.name){ if (mData.navigationEntityNames.indexOf(oEntityType.name) === -1){ mData.navigationEntityNames.push(oEntityType.name); } } }); } } return mData; }); } } return Promise.resolve(mData); }
javascript
function _getODataPropertiesOfModel(oElement, sAggregationName) { var oModel = oElement.getModel(); var mData = { property: [], navigationProperty: [], navigationEntityNames: [] }; if (oModel) { var sModelName = oModel.getMetadata().getName(); if (sModelName === "sap.ui.model.odata.ODataModel" || sModelName === "sap.ui.model.odata.v2.ODataModel") { var oMetaModel = oModel.getMetaModel(); return oMetaModel.loaded().then(function(){ var sBindingContextPath = _getBindingPath(oElement, sAggregationName); if (sBindingContextPath) { var oMetaModelContext = oMetaModel.getMetaContext(sBindingContextPath); var mODataEntity = oMetaModelContext.getObject(); var oDefaultAggregation = oElement.getMetadata().getAggregation(); if (oDefaultAggregation) { var oBinding = oElement.getBindingInfo(oDefaultAggregation.name); var oTemplate = oBinding && oBinding.template; if (oTemplate) { var sPath = oElement.getBindingPath(oDefaultAggregation.name); var oODataAssociationEnd = oMetaModel.getODataAssociationEnd(mODataEntity, sPath); var sFullyQualifiedEntityName = oODataAssociationEnd && oODataAssociationEnd.type; if (sFullyQualifiedEntityName) { var oEntityType = oMetaModel.getODataEntityType(sFullyQualifiedEntityName); mODataEntity = oEntityType; } } } mData.property = mODataEntity.property || []; mData.property = _expandComplexProperties(mData.property, oMetaModel, mODataEntity); mData.property = _filterInvisibleProperties(mData.property, oElement, sAggregationName); if (mODataEntity.navigationProperty){ mData.navigationProperty = mODataEntity.navigationProperty; mODataEntity.navigationProperty.forEach(function(oNavProp){ var sFullyQualifiedEntityName = ( oMetaModel.getODataAssociationEnd(mODataEntity, oNavProp.name) && oMetaModel.getODataAssociationEnd(mODataEntity, oNavProp.name).type ); var oEntityType = oMetaModel.getODataEntityType(sFullyQualifiedEntityName); if (oEntityType && oEntityType.name){ if (mData.navigationEntityNames.indexOf(oEntityType.name) === -1){ mData.navigationEntityNames.push(oEntityType.name); } } }); } } return mData; }); } } return Promise.resolve(mData); }
[ "function", "_getODataPropertiesOfModel", "(", "oElement", ",", "sAggregationName", ")", "{", "var", "oModel", "=", "oElement", ".", "getModel", "(", ")", ";", "var", "mData", "=", "{", "property", ":", "[", "]", ",", "navigationProperty", ":", "[", "]", ",", "navigationEntityNames", ":", "[", "]", "}", ";", "if", "(", "oModel", ")", "{", "var", "sModelName", "=", "oModel", ".", "getMetadata", "(", ")", ".", "getName", "(", ")", ";", "if", "(", "sModelName", "===", "\"sap.ui.model.odata.ODataModel\"", "||", "sModelName", "===", "\"sap.ui.model.odata.v2.ODataModel\"", ")", "{", "var", "oMetaModel", "=", "oModel", ".", "getMetaModel", "(", ")", ";", "return", "oMetaModel", ".", "loaded", "(", ")", ".", "then", "(", "function", "(", ")", "{", "var", "sBindingContextPath", "=", "_getBindingPath", "(", "oElement", ",", "sAggregationName", ")", ";", "if", "(", "sBindingContextPath", ")", "{", "var", "oMetaModelContext", "=", "oMetaModel", ".", "getMetaContext", "(", "sBindingContextPath", ")", ";", "var", "mODataEntity", "=", "oMetaModelContext", ".", "getObject", "(", ")", ";", "var", "oDefaultAggregation", "=", "oElement", ".", "getMetadata", "(", ")", ".", "getAggregation", "(", ")", ";", "if", "(", "oDefaultAggregation", ")", "{", "var", "oBinding", "=", "oElement", ".", "getBindingInfo", "(", "oDefaultAggregation", ".", "name", ")", ";", "var", "oTemplate", "=", "oBinding", "&&", "oBinding", ".", "template", ";", "if", "(", "oTemplate", ")", "{", "var", "sPath", "=", "oElement", ".", "getBindingPath", "(", "oDefaultAggregation", ".", "name", ")", ";", "var", "oODataAssociationEnd", "=", "oMetaModel", ".", "getODataAssociationEnd", "(", "mODataEntity", ",", "sPath", ")", ";", "var", "sFullyQualifiedEntityName", "=", "oODataAssociationEnd", "&&", "oODataAssociationEnd", ".", "type", ";", "if", "(", "sFullyQualifiedEntityName", ")", "{", "var", "oEntityType", "=", "oMetaModel", ".", "getODataEntityType", "(", "sFullyQualifiedEntityName", ")", ";", "mODataEntity", "=", "oEntityType", ";", "}", "}", "}", "mData", ".", "property", "=", "mODataEntity", ".", "property", "||", "[", "]", ";", "mData", ".", "property", "=", "_expandComplexProperties", "(", "mData", ".", "property", ",", "oMetaModel", ",", "mODataEntity", ")", ";", "mData", ".", "property", "=", "_filterInvisibleProperties", "(", "mData", ".", "property", ",", "oElement", ",", "sAggregationName", ")", ";", "if", "(", "mODataEntity", ".", "navigationProperty", ")", "{", "mData", ".", "navigationProperty", "=", "mODataEntity", ".", "navigationProperty", ";", "mODataEntity", ".", "navigationProperty", ".", "forEach", "(", "function", "(", "oNavProp", ")", "{", "var", "sFullyQualifiedEntityName", "=", "(", "oMetaModel", ".", "getODataAssociationEnd", "(", "mODataEntity", ",", "oNavProp", ".", "name", ")", "&&", "oMetaModel", ".", "getODataAssociationEnd", "(", "mODataEntity", ",", "oNavProp", ".", "name", ")", ".", "type", ")", ";", "var", "oEntityType", "=", "oMetaModel", ".", "getODataEntityType", "(", "sFullyQualifiedEntityName", ")", ";", "if", "(", "oEntityType", "&&", "oEntityType", ".", "name", ")", "{", "if", "(", "mData", ".", "navigationEntityNames", ".", "indexOf", "(", "oEntityType", ".", "name", ")", "===", "-", "1", ")", "{", "mData", ".", "navigationEntityNames", ".", "push", "(", "oEntityType", ".", "name", ")", ";", "}", "}", "}", ")", ";", "}", "}", "return", "mData", ";", "}", ")", ";", "}", "}", "return", "Promise", ".", "resolve", "(", "mData", ")", ";", "}" ]
Fetching all available properties of the Element's Model @param {sap.ui.core.Control} oElement - Control instance @param {string} sAggregationName - aggregation name of the action @return {Promise} - Returns Promise with results @private
[ "Fetching", "all", "available", "properties", "of", "the", "Element", "s", "Model" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.rta/src/sap/ui/rta/plugin/additionalElements/AdditionalElementsAnalyzer.js#L157-L217
4,351
SAP/openui5
src/sap.ui.rta/src/sap/ui/rta/plugin/additionalElements/AdditionalElementsAnalyzer.js
_checkForDuplicateLabels
function _checkForDuplicateLabels(oInvisibleElement, aODataProperties) { return aODataProperties.some(function(oDataProperty) { return oDataProperty.fieldLabel === oInvisibleElement.fieldLabel; }); }
javascript
function _checkForDuplicateLabels(oInvisibleElement, aODataProperties) { return aODataProperties.some(function(oDataProperty) { return oDataProperty.fieldLabel === oInvisibleElement.fieldLabel; }); }
[ "function", "_checkForDuplicateLabels", "(", "oInvisibleElement", ",", "aODataProperties", ")", "{", "return", "aODataProperties", ".", "some", "(", "function", "(", "oDataProperty", ")", "{", "return", "oDataProperty", ".", "fieldLabel", "===", "oInvisibleElement", ".", "fieldLabel", ";", "}", ")", ";", "}" ]
check for duplicate labels to later add the referenced complexTypeName if available
[ "check", "for", "duplicate", "labels", "to", "later", "add", "the", "referenced", "complexTypeName", "if", "available" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.rta/src/sap/ui/rta/plugin/additionalElements/AdditionalElementsAnalyzer.js#L301-L305
4,352
SAP/openui5
src/sap.ui.rta/src/sap/ui/rta/plugin/additionalElements/AdditionalElementsAnalyzer.js
_hasNavigationBindings
function _hasNavigationBindings(aBindingPaths, aNavigationProperties, aNavigationEntityNames, aBindingContextPaths) { var bNavigationInBindingPath = _hasBindings(aBindingPaths) && aBindingPaths.some(function (sPath) { var aParts = sPath.trim().replace(/^\//gi, '').split('/'); if (aParts.length > 1) { return aNavigationProperties.indexOf(aParts.shift()) !== -1; } }); // BindingContextPath : "/SEPMRA_C_PD_Supplier('100000001')" // NavigationEntityName : "SEPMRA_C_PD_Supplier" var bNavigationInEntity = aBindingContextPaths.some(function(sContextPath){ sContextPath = sContextPath.match(/^\/?([A-Za-z0-9_]+)/)[0]; return (aNavigationEntityNames.indexOf(sContextPath) >= 0); }); return bNavigationInBindingPath || bNavigationInEntity; }
javascript
function _hasNavigationBindings(aBindingPaths, aNavigationProperties, aNavigationEntityNames, aBindingContextPaths) { var bNavigationInBindingPath = _hasBindings(aBindingPaths) && aBindingPaths.some(function (sPath) { var aParts = sPath.trim().replace(/^\//gi, '').split('/'); if (aParts.length > 1) { return aNavigationProperties.indexOf(aParts.shift()) !== -1; } }); // BindingContextPath : "/SEPMRA_C_PD_Supplier('100000001')" // NavigationEntityName : "SEPMRA_C_PD_Supplier" var bNavigationInEntity = aBindingContextPaths.some(function(sContextPath){ sContextPath = sContextPath.match(/^\/?([A-Za-z0-9_]+)/)[0]; return (aNavigationEntityNames.indexOf(sContextPath) >= 0); }); return bNavigationInBindingPath || bNavigationInEntity; }
[ "function", "_hasNavigationBindings", "(", "aBindingPaths", ",", "aNavigationProperties", ",", "aNavigationEntityNames", ",", "aBindingContextPaths", ")", "{", "var", "bNavigationInBindingPath", "=", "_hasBindings", "(", "aBindingPaths", ")", "&&", "aBindingPaths", ".", "some", "(", "function", "(", "sPath", ")", "{", "var", "aParts", "=", "sPath", ".", "trim", "(", ")", ".", "replace", "(", "/", "^\\/", "/", "gi", ",", "''", ")", ".", "split", "(", "'/'", ")", ";", "if", "(", "aParts", ".", "length", ">", "1", ")", "{", "return", "aNavigationProperties", ".", "indexOf", "(", "aParts", ".", "shift", "(", ")", ")", "!==", "-", "1", ";", "}", "}", ")", ";", "// BindingContextPath : \"/SEPMRA_C_PD_Supplier('100000001')\"", "// NavigationEntityName : \"SEPMRA_C_PD_Supplier\"", "var", "bNavigationInEntity", "=", "aBindingContextPaths", ".", "some", "(", "function", "(", "sContextPath", ")", "{", "sContextPath", "=", "sContextPath", ".", "match", "(", "/", "^\\/?([A-Za-z0-9_]+)", "/", ")", "[", "0", "]", ";", "return", "(", "aNavigationEntityNames", ".", "indexOf", "(", "sContextPath", ")", ">=", "0", ")", ";", "}", ")", ";", "return", "bNavigationInBindingPath", "||", "bNavigationInEntity", ";", "}" ]
Checks if array of paths contains bindings through navigation @param {Array.<String>} aBindingPaths - Array of collected binding paths @param {Array.<Object>} aNavigationProperties - Array of Navigation Properties @param {Array.<String>} aNavigationEntityNames - Array of Navigation Entity Names @param {Array.<String>} aBindingContextPaths - Array of Binding Context Paths @return {Boolean} - true if it has at least one navigational binding
[ "Checks", "if", "array", "of", "paths", "contains", "bindings", "through", "navigation" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.rta/src/sap/ui/rta/plugin/additionalElements/AdditionalElementsAnalyzer.js#L327-L344
4,353
SAP/openui5
src/sap.ui.rta/src/sap/ui/rta/plugin/additionalElements/AdditionalElementsAnalyzer.js
_findODataProperty
function _findODataProperty(aBindingPaths, aODataProperties) { return aODataProperties.filter(function (oDataProperty) { return aBindingPaths.indexOf(oDataProperty.bindingPath) !== -1; }).pop(); }
javascript
function _findODataProperty(aBindingPaths, aODataProperties) { return aODataProperties.filter(function (oDataProperty) { return aBindingPaths.indexOf(oDataProperty.bindingPath) !== -1; }).pop(); }
[ "function", "_findODataProperty", "(", "aBindingPaths", ",", "aODataProperties", ")", "{", "return", "aODataProperties", ".", "filter", "(", "function", "(", "oDataProperty", ")", "{", "return", "aBindingPaths", ".", "indexOf", "(", "oDataProperty", ".", "bindingPath", ")", "!==", "-", "1", ";", "}", ")", ".", "pop", "(", ")", ";", "}" ]
Looks for a ODataProperty for a set of bindings paths @param {Array.<String>} aBindingPaths - Array of collected binding paths @param {Array.<Object>} aODataProperties - Array of Fields @return {Object|undefined} - returns first found Object with Field (Property) description, undefined if not found @private
[ "Looks", "for", "a", "ODataProperty", "for", "a", "set", "of", "bindings", "paths" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.rta/src/sap/ui/rta/plugin/additionalElements/AdditionalElementsAnalyzer.js#L356-L360
4,354
SAP/openui5
src/sap.ui.rta/src/sap/ui/rta/plugin/additionalElements/AdditionalElementsAnalyzer.js
_enhanceInvisibleElement
function _enhanceInvisibleElement(oInvisibleElement, mODataOrCustomItem) { // mODataOrCustomItem.fieldLabel - oData, mODataOrCustomItem.label - custom oInvisibleElement.originalLabel = mODataOrCustomItem.fieldLabel || mODataOrCustomItem.label; // mODataOrCustomItem.quickInfo - oData, mODataOrCustomItem.tooltip - custom oInvisibleElement.quickInfo = mODataOrCustomItem.quickInfo || mODataOrCustomItem.tooltip; // mODataOrCustomItem.name - oData oInvisibleElement.name = mODataOrCustomItem.name; // oInvisibleElement.fieldLabel has the current label if (oInvisibleElement.fieldLabel !== oInvisibleElement.originalLabel) { oInvisibleElement.renamedLabel = true; } if (mODataOrCustomItem.referencedComplexPropertyName) { oInvisibleElement.referencedComplexPropertyName = mODataOrCustomItem.referencedComplexPropertyName; } }
javascript
function _enhanceInvisibleElement(oInvisibleElement, mODataOrCustomItem) { // mODataOrCustomItem.fieldLabel - oData, mODataOrCustomItem.label - custom oInvisibleElement.originalLabel = mODataOrCustomItem.fieldLabel || mODataOrCustomItem.label; // mODataOrCustomItem.quickInfo - oData, mODataOrCustomItem.tooltip - custom oInvisibleElement.quickInfo = mODataOrCustomItem.quickInfo || mODataOrCustomItem.tooltip; // mODataOrCustomItem.name - oData oInvisibleElement.name = mODataOrCustomItem.name; // oInvisibleElement.fieldLabel has the current label if (oInvisibleElement.fieldLabel !== oInvisibleElement.originalLabel) { oInvisibleElement.renamedLabel = true; } if (mODataOrCustomItem.referencedComplexPropertyName) { oInvisibleElement.referencedComplexPropertyName = mODataOrCustomItem.referencedComplexPropertyName; } }
[ "function", "_enhanceInvisibleElement", "(", "oInvisibleElement", ",", "mODataOrCustomItem", ")", "{", "// mODataOrCustomItem.fieldLabel - oData, mODataOrCustomItem.label - custom", "oInvisibleElement", ".", "originalLabel", "=", "mODataOrCustomItem", ".", "fieldLabel", "||", "mODataOrCustomItem", ".", "label", ";", "// mODataOrCustomItem.quickInfo - oData, mODataOrCustomItem.tooltip - custom", "oInvisibleElement", ".", "quickInfo", "=", "mODataOrCustomItem", ".", "quickInfo", "||", "mODataOrCustomItem", ".", "tooltip", ";", "// mODataOrCustomItem.name - oData", "oInvisibleElement", ".", "name", "=", "mODataOrCustomItem", ".", "name", ";", "// oInvisibleElement.fieldLabel has the current label", "if", "(", "oInvisibleElement", ".", "fieldLabel", "!==", "oInvisibleElement", ".", "originalLabel", ")", "{", "oInvisibleElement", ".", "renamedLabel", "=", "true", ";", "}", "if", "(", "mODataOrCustomItem", ".", "referencedComplexPropertyName", ")", "{", "oInvisibleElement", ".", "referencedComplexPropertyName", "=", "mODataOrCustomItem", ".", "referencedComplexPropertyName", ";", "}", "}" ]
Enhance Invisible Element with extra data from OData property @param {sap.ui.core.Control} oInvisibleElement - Invisible Element @param {Object} mODataProperty - ODataProperty as a source of data enhancement process @private
[ "Enhance", "Invisible", "Element", "with", "extra", "data", "from", "OData", "property" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.rta/src/sap/ui/rta/plugin/additionalElements/AdditionalElementsAnalyzer.js#L370-L387
4,355
SAP/openui5
src/sap.ui.rta/src/sap/ui/rta/plugin/additionalElements/AdditionalElementsAnalyzer.js
_checkAndEnhanceODataProperty
function _checkAndEnhanceODataProperty(oInvisibleElement, aODataProperties, aNavigationProperties, aNavigationEntityNames, mBindingPaths) { var aBindingPaths = mBindingPaths.bindingPaths, aBindingContextPaths = mBindingPaths.bindingContextPaths, mODataProperty; return ( // include it if the field has no bindings (bindings can be added in runtime) !_hasBindings(aBindingPaths) // include it if some properties got binding through valid navigations of the current Model || _hasNavigationBindings(aBindingPaths, aNavigationProperties, aNavigationEntityNames, aBindingContextPaths) // looking for a corresponding OData property, if it exists oInvisibleElement is being enhanced // with extra data from it || ( (mODataProperty = _findODataProperty(aBindingPaths, aODataProperties)) && (_enhanceInvisibleElement(oInvisibleElement, mODataProperty) || true) ) ); }
javascript
function _checkAndEnhanceODataProperty(oInvisibleElement, aODataProperties, aNavigationProperties, aNavigationEntityNames, mBindingPaths) { var aBindingPaths = mBindingPaths.bindingPaths, aBindingContextPaths = mBindingPaths.bindingContextPaths, mODataProperty; return ( // include it if the field has no bindings (bindings can be added in runtime) !_hasBindings(aBindingPaths) // include it if some properties got binding through valid navigations of the current Model || _hasNavigationBindings(aBindingPaths, aNavigationProperties, aNavigationEntityNames, aBindingContextPaths) // looking for a corresponding OData property, if it exists oInvisibleElement is being enhanced // with extra data from it || ( (mODataProperty = _findODataProperty(aBindingPaths, aODataProperties)) && (_enhanceInvisibleElement(oInvisibleElement, mODataProperty) || true) ) ); }
[ "function", "_checkAndEnhanceODataProperty", "(", "oInvisibleElement", ",", "aODataProperties", ",", "aNavigationProperties", ",", "aNavigationEntityNames", ",", "mBindingPaths", ")", "{", "var", "aBindingPaths", "=", "mBindingPaths", ".", "bindingPaths", ",", "aBindingContextPaths", "=", "mBindingPaths", ".", "bindingContextPaths", ",", "mODataProperty", ";", "return", "(", "// include it if the field has no bindings (bindings can be added in runtime)", "!", "_hasBindings", "(", "aBindingPaths", ")", "// include it if some properties got binding through valid navigations of the current Model", "||", "_hasNavigationBindings", "(", "aBindingPaths", ",", "aNavigationProperties", ",", "aNavigationEntityNames", ",", "aBindingContextPaths", ")", "// looking for a corresponding OData property, if it exists oInvisibleElement is being enhanced", "// with extra data from it", "||", "(", "(", "mODataProperty", "=", "_findODataProperty", "(", "aBindingPaths", ",", "aODataProperties", ")", ")", "&&", "(", "_enhanceInvisibleElement", "(", "oInvisibleElement", ",", "mODataProperty", ")", "||", "true", ")", ")", ")", ";", "}" ]
Checks if this InvisibleProperty should be included in resulting list and adds information from oDataProperty to the InvisibleProperty if available @param {sap.ui.core.Control} oInvisibleElement - Invisible Element @param {Array.<Object>} aODataProperties - Array of Fields @param {Array.<Object>} aNavigationProperties - Array of Navigation Properties @param {Array.<Object>} aNavigationEntityNames - Array of Navigation Entity names @param {Object} mBindingPaths - Map of all binding paths and binding context paths of the passed invisible element @return {Boolean} - whether this field is @private
[ "Checks", "if", "this", "InvisibleProperty", "should", "be", "included", "in", "resulting", "list", "and", "adds", "information", "from", "oDataProperty", "to", "the", "InvisibleProperty", "if", "available" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.rta/src/sap/ui/rta/plugin/additionalElements/AdditionalElementsAnalyzer.js#L403-L420
4,356
SAP/openui5
src/sap.ui.rta/src/sap/ui/rta/plugin/additionalElements/AdditionalElementsAnalyzer.js
function(oElement, mActions){ var oModel = oElement.getModel(); var mRevealData = mActions.reveal; var mAddODataProperty = mActions.addODataProperty; var mCustom = mActions.custom; var oDefaultAggregation = oElement.getMetadata().getAggregation(); var sAggregationName = oDefaultAggregation ? oDefaultAggregation.name : mActions.aggregation; return Promise.resolve() .then(function () { return _getODataPropertiesOfModel(oElement, sAggregationName); }) .then(function(mData) { var aODataProperties = mData.property; var aODataNavigationProperties = mData.navigationProperty.map(function (mNavigation) { return mNavigation.name; }); var aODataNavigationEntityNames = mData.navigationEntityNames; aODataProperties = _checkForComplexDuplicates(aODataProperties); var aAllElementData = []; var aInvisibleElements = mRevealData.elements || []; aInvisibleElements.forEach(function(mInvisibleElement) { var oInvisibleElement = mInvisibleElement.element; var mAction = mInvisibleElement.action; var bIncludeElement = true; var mBindingPathCollection = {}; oInvisibleElement.fieldLabel = ElementUtil.getLabelForElement(oInvisibleElement, mAction.getLabel); // BCP: 1880498671 if (mAddODataProperty) { if (_getBindingPath(oElement, sAggregationName) === _getBindingPath(oInvisibleElement, sAggregationName)) { //TODO fix with stashed type support mBindingPathCollection = BindingsExtractor.collectBindingPaths(oInvisibleElement, oModel); oInvisibleElement.duplicateComplexName = _checkForDuplicateLabels(oInvisibleElement, aODataProperties); //Add information from the oDataProperty to the InvisibleProperty if available; //if oData is available and the element is not present in it, do not include it //Example use case: custom field which was hidden and then removed from system //should not be available for adding after the removal if (aODataProperties.length > 0){ bIncludeElement = _checkAndEnhanceODataProperty( oInvisibleElement, aODataProperties, aODataNavigationProperties, aODataNavigationEntityNames, mBindingPathCollection); } } else if (BindingsExtractor.getBindings(oInvisibleElement, oModel).length > 0) { bIncludeElement = false; } } if (mCustom && bIncludeElement) { mCustom.items.forEach(function(oCustomItem) { _assignCustomItemIds(oElement.getParent().getId(), oCustomItem); if (oCustomItem.itemId === oInvisibleElement.getId()) { _enhanceInvisibleElement(oInvisibleElement, oCustomItem); } }); } if (bIncludeElement) { aAllElementData.push({ element : oInvisibleElement, action : mAction, bindingPathCollection: mBindingPathCollection }); } }); return aAllElementData; }) .then(function(aAllElementData) { return aAllElementData.map(_elementToAdditionalElementInfo); }); }
javascript
function(oElement, mActions){ var oModel = oElement.getModel(); var mRevealData = mActions.reveal; var mAddODataProperty = mActions.addODataProperty; var mCustom = mActions.custom; var oDefaultAggregation = oElement.getMetadata().getAggregation(); var sAggregationName = oDefaultAggregation ? oDefaultAggregation.name : mActions.aggregation; return Promise.resolve() .then(function () { return _getODataPropertiesOfModel(oElement, sAggregationName); }) .then(function(mData) { var aODataProperties = mData.property; var aODataNavigationProperties = mData.navigationProperty.map(function (mNavigation) { return mNavigation.name; }); var aODataNavigationEntityNames = mData.navigationEntityNames; aODataProperties = _checkForComplexDuplicates(aODataProperties); var aAllElementData = []; var aInvisibleElements = mRevealData.elements || []; aInvisibleElements.forEach(function(mInvisibleElement) { var oInvisibleElement = mInvisibleElement.element; var mAction = mInvisibleElement.action; var bIncludeElement = true; var mBindingPathCollection = {}; oInvisibleElement.fieldLabel = ElementUtil.getLabelForElement(oInvisibleElement, mAction.getLabel); // BCP: 1880498671 if (mAddODataProperty) { if (_getBindingPath(oElement, sAggregationName) === _getBindingPath(oInvisibleElement, sAggregationName)) { //TODO fix with stashed type support mBindingPathCollection = BindingsExtractor.collectBindingPaths(oInvisibleElement, oModel); oInvisibleElement.duplicateComplexName = _checkForDuplicateLabels(oInvisibleElement, aODataProperties); //Add information from the oDataProperty to the InvisibleProperty if available; //if oData is available and the element is not present in it, do not include it //Example use case: custom field which was hidden and then removed from system //should not be available for adding after the removal if (aODataProperties.length > 0){ bIncludeElement = _checkAndEnhanceODataProperty( oInvisibleElement, aODataProperties, aODataNavigationProperties, aODataNavigationEntityNames, mBindingPathCollection); } } else if (BindingsExtractor.getBindings(oInvisibleElement, oModel).length > 0) { bIncludeElement = false; } } if (mCustom && bIncludeElement) { mCustom.items.forEach(function(oCustomItem) { _assignCustomItemIds(oElement.getParent().getId(), oCustomItem); if (oCustomItem.itemId === oInvisibleElement.getId()) { _enhanceInvisibleElement(oInvisibleElement, oCustomItem); } }); } if (bIncludeElement) { aAllElementData.push({ element : oInvisibleElement, action : mAction, bindingPathCollection: mBindingPathCollection }); } }); return aAllElementData; }) .then(function(aAllElementData) { return aAllElementData.map(_elementToAdditionalElementInfo); }); }
[ "function", "(", "oElement", ",", "mActions", ")", "{", "var", "oModel", "=", "oElement", ".", "getModel", "(", ")", ";", "var", "mRevealData", "=", "mActions", ".", "reveal", ";", "var", "mAddODataProperty", "=", "mActions", ".", "addODataProperty", ";", "var", "mCustom", "=", "mActions", ".", "custom", ";", "var", "oDefaultAggregation", "=", "oElement", ".", "getMetadata", "(", ")", ".", "getAggregation", "(", ")", ";", "var", "sAggregationName", "=", "oDefaultAggregation", "?", "oDefaultAggregation", ".", "name", ":", "mActions", ".", "aggregation", ";", "return", "Promise", ".", "resolve", "(", ")", ".", "then", "(", "function", "(", ")", "{", "return", "_getODataPropertiesOfModel", "(", "oElement", ",", "sAggregationName", ")", ";", "}", ")", ".", "then", "(", "function", "(", "mData", ")", "{", "var", "aODataProperties", "=", "mData", ".", "property", ";", "var", "aODataNavigationProperties", "=", "mData", ".", "navigationProperty", ".", "map", "(", "function", "(", "mNavigation", ")", "{", "return", "mNavigation", ".", "name", ";", "}", ")", ";", "var", "aODataNavigationEntityNames", "=", "mData", ".", "navigationEntityNames", ";", "aODataProperties", "=", "_checkForComplexDuplicates", "(", "aODataProperties", ")", ";", "var", "aAllElementData", "=", "[", "]", ";", "var", "aInvisibleElements", "=", "mRevealData", ".", "elements", "||", "[", "]", ";", "aInvisibleElements", ".", "forEach", "(", "function", "(", "mInvisibleElement", ")", "{", "var", "oInvisibleElement", "=", "mInvisibleElement", ".", "element", ";", "var", "mAction", "=", "mInvisibleElement", ".", "action", ";", "var", "bIncludeElement", "=", "true", ";", "var", "mBindingPathCollection", "=", "{", "}", ";", "oInvisibleElement", ".", "fieldLabel", "=", "ElementUtil", ".", "getLabelForElement", "(", "oInvisibleElement", ",", "mAction", ".", "getLabel", ")", ";", "// BCP: 1880498671", "if", "(", "mAddODataProperty", ")", "{", "if", "(", "_getBindingPath", "(", "oElement", ",", "sAggregationName", ")", "===", "_getBindingPath", "(", "oInvisibleElement", ",", "sAggregationName", ")", ")", "{", "//TODO fix with stashed type support", "mBindingPathCollection", "=", "BindingsExtractor", ".", "collectBindingPaths", "(", "oInvisibleElement", ",", "oModel", ")", ";", "oInvisibleElement", ".", "duplicateComplexName", "=", "_checkForDuplicateLabels", "(", "oInvisibleElement", ",", "aODataProperties", ")", ";", "//Add information from the oDataProperty to the InvisibleProperty if available;", "//if oData is available and the element is not present in it, do not include it", "//Example use case: custom field which was hidden and then removed from system", "//should not be available for adding after the removal", "if", "(", "aODataProperties", ".", "length", ">", "0", ")", "{", "bIncludeElement", "=", "_checkAndEnhanceODataProperty", "(", "oInvisibleElement", ",", "aODataProperties", ",", "aODataNavigationProperties", ",", "aODataNavigationEntityNames", ",", "mBindingPathCollection", ")", ";", "}", "}", "else", "if", "(", "BindingsExtractor", ".", "getBindings", "(", "oInvisibleElement", ",", "oModel", ")", ".", "length", ">", "0", ")", "{", "bIncludeElement", "=", "false", ";", "}", "}", "if", "(", "mCustom", "&&", "bIncludeElement", ")", "{", "mCustom", ".", "items", ".", "forEach", "(", "function", "(", "oCustomItem", ")", "{", "_assignCustomItemIds", "(", "oElement", ".", "getParent", "(", ")", ".", "getId", "(", ")", ",", "oCustomItem", ")", ";", "if", "(", "oCustomItem", ".", "itemId", "===", "oInvisibleElement", ".", "getId", "(", ")", ")", "{", "_enhanceInvisibleElement", "(", "oInvisibleElement", ",", "oCustomItem", ")", ";", "}", "}", ")", ";", "}", "if", "(", "bIncludeElement", ")", "{", "aAllElementData", ".", "push", "(", "{", "element", ":", "oInvisibleElement", ",", "action", ":", "mAction", ",", "bindingPathCollection", ":", "mBindingPathCollection", "}", ")", ";", "}", "}", ")", ";", "return", "aAllElementData", ";", "}", ")", ".", "then", "(", "function", "(", "aAllElementData", ")", "{", "return", "aAllElementData", ".", "map", "(", "_elementToAdditionalElementInfo", ")", ";", "}", ")", ";", "}" ]
Filters available invisible elements whether they could be shown or not @param {sap.ui.core.Control} oElement - Container Element where to start search for a invisible @param {Object} mActions - Container with actions @return {Promise} - returns a Promise which resolves with a list of hidden controls are available to display
[ "Filters", "available", "invisible", "elements", "whether", "they", "could", "be", "shown", "or", "not" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.rta/src/sap/ui/rta/plugin/additionalElements/AdditionalElementsAnalyzer.js#L432-L509
4,357
SAP/openui5
src/sap.ui.rta/src/sap/ui/rta/plugin/additionalElements/AdditionalElementsAnalyzer.js
function (oElement, mAction) { var oDefaultAggregation = oElement.getMetadata().getAggregation(); var sAggregationName = oDefaultAggregation ? oDefaultAggregation.name : mAction.action.aggregation; var oModel = oElement.getModel(); return Promise.resolve() .then(function () { return _getODataPropertiesOfModel(oElement, sAggregationName); }) .then(function(mData) { var aODataProperties = mData.property; var aRelevantElements = _getRelevantElements(oElement, mAction.relevantContainer, sAggregationName); var aBindings = []; aRelevantElements.forEach(function(oElement){ aBindings = aBindings.concat(BindingsExtractor.getBindings(oElement, oModel)); }); var fnFilter = mAction.action.filter ? mAction.action.filter : function() {return true;}; aODataProperties = aODataProperties.filter(function(oDataProperty) { var bHasBindingPath = false; if (aBindings){ bHasBindingPath = aBindings.some(function(vBinding) { return ( jQuery.isPlainObject(vBinding) ? vBinding.parts[0].path : !!vBinding.getPath && vBinding.getPath() ) === oDataProperty.bindingPath; }); } return !bHasBindingPath && fnFilter(mAction.relevantContainer, oDataProperty); }); aODataProperties = _checkForComplexDuplicates(aODataProperties); return aODataProperties; }) .then(function(aUnboundODataProperties) { return aUnboundODataProperties.map(_oDataPropertyToAdditionalElementInfo); }); }
javascript
function (oElement, mAction) { var oDefaultAggregation = oElement.getMetadata().getAggregation(); var sAggregationName = oDefaultAggregation ? oDefaultAggregation.name : mAction.action.aggregation; var oModel = oElement.getModel(); return Promise.resolve() .then(function () { return _getODataPropertiesOfModel(oElement, sAggregationName); }) .then(function(mData) { var aODataProperties = mData.property; var aRelevantElements = _getRelevantElements(oElement, mAction.relevantContainer, sAggregationName); var aBindings = []; aRelevantElements.forEach(function(oElement){ aBindings = aBindings.concat(BindingsExtractor.getBindings(oElement, oModel)); }); var fnFilter = mAction.action.filter ? mAction.action.filter : function() {return true;}; aODataProperties = aODataProperties.filter(function(oDataProperty) { var bHasBindingPath = false; if (aBindings){ bHasBindingPath = aBindings.some(function(vBinding) { return ( jQuery.isPlainObject(vBinding) ? vBinding.parts[0].path : !!vBinding.getPath && vBinding.getPath() ) === oDataProperty.bindingPath; }); } return !bHasBindingPath && fnFilter(mAction.relevantContainer, oDataProperty); }); aODataProperties = _checkForComplexDuplicates(aODataProperties); return aODataProperties; }) .then(function(aUnboundODataProperties) { return aUnboundODataProperties.map(_oDataPropertyToAdditionalElementInfo); }); }
[ "function", "(", "oElement", ",", "mAction", ")", "{", "var", "oDefaultAggregation", "=", "oElement", ".", "getMetadata", "(", ")", ".", "getAggregation", "(", ")", ";", "var", "sAggregationName", "=", "oDefaultAggregation", "?", "oDefaultAggregation", ".", "name", ":", "mAction", ".", "action", ".", "aggregation", ";", "var", "oModel", "=", "oElement", ".", "getModel", "(", ")", ";", "return", "Promise", ".", "resolve", "(", ")", ".", "then", "(", "function", "(", ")", "{", "return", "_getODataPropertiesOfModel", "(", "oElement", ",", "sAggregationName", ")", ";", "}", ")", ".", "then", "(", "function", "(", "mData", ")", "{", "var", "aODataProperties", "=", "mData", ".", "property", ";", "var", "aRelevantElements", "=", "_getRelevantElements", "(", "oElement", ",", "mAction", ".", "relevantContainer", ",", "sAggregationName", ")", ";", "var", "aBindings", "=", "[", "]", ";", "aRelevantElements", ".", "forEach", "(", "function", "(", "oElement", ")", "{", "aBindings", "=", "aBindings", ".", "concat", "(", "BindingsExtractor", ".", "getBindings", "(", "oElement", ",", "oModel", ")", ")", ";", "}", ")", ";", "var", "fnFilter", "=", "mAction", ".", "action", ".", "filter", "?", "mAction", ".", "action", ".", "filter", ":", "function", "(", ")", "{", "return", "true", ";", "}", ";", "aODataProperties", "=", "aODataProperties", ".", "filter", "(", "function", "(", "oDataProperty", ")", "{", "var", "bHasBindingPath", "=", "false", ";", "if", "(", "aBindings", ")", "{", "bHasBindingPath", "=", "aBindings", ".", "some", "(", "function", "(", "vBinding", ")", "{", "return", "(", "jQuery", ".", "isPlainObject", "(", "vBinding", ")", "?", "vBinding", ".", "parts", "[", "0", "]", ".", "path", ":", "!", "!", "vBinding", ".", "getPath", "&&", "vBinding", ".", "getPath", "(", ")", ")", "===", "oDataProperty", ".", "bindingPath", ";", "}", ")", ";", "}", "return", "!", "bHasBindingPath", "&&", "fnFilter", "(", "mAction", ".", "relevantContainer", ",", "oDataProperty", ")", ";", "}", ")", ";", "aODataProperties", "=", "_checkForComplexDuplicates", "(", "aODataProperties", ")", ";", "return", "aODataProperties", ";", "}", ")", ".", "then", "(", "function", "(", "aUnboundODataProperties", ")", "{", "return", "aUnboundODataProperties", ".", "map", "(", "_oDataPropertyToAdditionalElementInfo", ")", ";", "}", ")", ";", "}" ]
Retrieves available OData properties from the metadata @param {sap.ui.core.Control} oElement - Source element of which Model we're looking for additional properties @param {Object} mAction - Action descriptor @return {Promise} - returns a Promise which resolves with a list of available to display OData properties
[ "Retrieves", "available", "OData", "properties", "from", "the", "metadata" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.rta/src/sap/ui/rta/plugin/additionalElements/AdditionalElementsAnalyzer.js#L519-L560
4,358
SAP/openui5
src/sap.ui.core/src/sap/ui/thirdparty/jquery-mobile-custom.js
function( prop ) { if ( !prop ) { return; } return nsNormalizeDict[ prop ] || ( nsNormalizeDict[ prop ] = $.camelCase( $.mobile.ns + prop ) ); }
javascript
function( prop ) { if ( !prop ) { return; } return nsNormalizeDict[ prop ] || ( nsNormalizeDict[ prop ] = $.camelCase( $.mobile.ns + prop ) ); }
[ "function", "(", "prop", ")", "{", "if", "(", "!", "prop", ")", "{", "return", ";", "}", "return", "nsNormalizeDict", "[", "prop", "]", "||", "(", "nsNormalizeDict", "[", "prop", "]", "=", "$", ".", "camelCase", "(", "$", ".", "mobile", ".", "ns", "+", "prop", ")", ")", ";", "}" ]
Take a data attribute property, prepend the namespace and then camel case the attribute string. Add the result to our nsNormalizeDict so we don't have to do this again.
[ "Take", "a", "data", "attribute", "property", "prepend", "the", "namespace", "and", "then", "camel", "case", "the", "attribute", "string", ".", "Add", "the", "result", "to", "our", "nsNormalizeDict", "so", "we", "don", "t", "have", "to", "do", "this", "again", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/thirdparty/jquery-mobile-custom.js#L462-L468
4,359
SAP/openui5
src/sap.ui.core/src/sap/ui/thirdparty/jquery-mobile-custom.js
validStyle
function validStyle( prop, value, check_vend ) { var div = document.createElement( 'div' ), uc = function( txt ) { return txt.charAt( 0 ).toUpperCase() + txt.substr( 1 ); }, vend_pref = function( vend ) { if( vend === "" ) { return ""; } else { return "-" + vend.charAt( 0 ).toLowerCase() + vend.substr( 1 ) + "-"; } }, check_style = function( vend ) { var vend_prop = vend_pref( vend ) + prop + ": " + value + ";", uc_vend = uc( vend ), propStyle = uc_vend + ( uc_vend === "" ? prop : uc( prop ) ); div.setAttribute( "style", vend_prop ); if ( !!div.style[ propStyle ] ) { ret = true; } }, check_vends = check_vend ? check_vend : vendors, ret; for( var i = 0; i < check_vends.length; i++ ) { check_style( check_vends[i] ); } return !!ret; }
javascript
function validStyle( prop, value, check_vend ) { var div = document.createElement( 'div' ), uc = function( txt ) { return txt.charAt( 0 ).toUpperCase() + txt.substr( 1 ); }, vend_pref = function( vend ) { if( vend === "" ) { return ""; } else { return "-" + vend.charAt( 0 ).toLowerCase() + vend.substr( 1 ) + "-"; } }, check_style = function( vend ) { var vend_prop = vend_pref( vend ) + prop + ": " + value + ";", uc_vend = uc( vend ), propStyle = uc_vend + ( uc_vend === "" ? prop : uc( prop ) ); div.setAttribute( "style", vend_prop ); if ( !!div.style[ propStyle ] ) { ret = true; } }, check_vends = check_vend ? check_vend : vendors, ret; for( var i = 0; i < check_vends.length; i++ ) { check_style( check_vends[i] ); } return !!ret; }
[ "function", "validStyle", "(", "prop", ",", "value", ",", "check_vend", ")", "{", "var", "div", "=", "document", ".", "createElement", "(", "'div'", ")", ",", "uc", "=", "function", "(", "txt", ")", "{", "return", "txt", ".", "charAt", "(", "0", ")", ".", "toUpperCase", "(", ")", "+", "txt", ".", "substr", "(", "1", ")", ";", "}", ",", "vend_pref", "=", "function", "(", "vend", ")", "{", "if", "(", "vend", "===", "\"\"", ")", "{", "return", "\"\"", ";", "}", "else", "{", "return", "\"-\"", "+", "vend", ".", "charAt", "(", "0", ")", ".", "toLowerCase", "(", ")", "+", "vend", ".", "substr", "(", "1", ")", "+", "\"-\"", ";", "}", "}", ",", "check_style", "=", "function", "(", "vend", ")", "{", "var", "vend_prop", "=", "vend_pref", "(", "vend", ")", "+", "prop", "+", "\": \"", "+", "value", "+", "\";\"", ",", "uc_vend", "=", "uc", "(", "vend", ")", ",", "propStyle", "=", "uc_vend", "+", "(", "uc_vend", "===", "\"\"", "?", "prop", ":", "uc", "(", "prop", ")", ")", ";", "div", ".", "setAttribute", "(", "\"style\"", ",", "vend_prop", ")", ";", "if", "(", "!", "!", "div", ".", "style", "[", "propStyle", "]", ")", "{", "ret", "=", "true", ";", "}", "}", ",", "check_vends", "=", "check_vend", "?", "check_vend", ":", "vendors", ",", "ret", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "check_vends", ".", "length", ";", "i", "++", ")", "{", "check_style", "(", "check_vends", "[", "i", "]", ")", ";", "}", "return", "!", "!", "ret", ";", "}" ]
only used to rule out box shadow, as it's filled opaque on BB 5 and lower
[ "only", "used", "to", "rule", "out", "box", "shadow", "as", "it", "s", "filled", "opaque", "on", "BB", "5", "and", "lower" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/thirdparty/jquery-mobile-custom.js#L746-L776
4,360
SAP/openui5
src/sap.ui.core/src/sap/ui/thirdparty/jquery-mobile-custom.js
handler
function handler() { // Get the current orientation. var orientation = get_orientation(); if ( orientation !== last_orientation ) { // The orientation has changed, so trigger the orientationchange event. last_orientation = orientation; win.trigger( event_name ); } }
javascript
function handler() { // Get the current orientation. var orientation = get_orientation(); if ( orientation !== last_orientation ) { // The orientation has changed, so trigger the orientationchange event. last_orientation = orientation; win.trigger( event_name ); } }
[ "function", "handler", "(", ")", "{", "// Get the current orientation.", "var", "orientation", "=", "get_orientation", "(", ")", ";", "if", "(", "orientation", "!==", "last_orientation", ")", "{", "// The orientation has changed, so trigger the orientationchange event.", "last_orientation", "=", "orientation", ";", "win", ".", "trigger", "(", "event_name", ")", ";", "}", "}" ]
If the event is not supported natively, this handler will be bound to the window resize event to simulate the orientationchange event.
[ "If", "the", "event", "is", "not", "supported", "natively", "this", "handler", "will", "be", "bound", "to", "the", "window", "resize", "event", "to", "simulate", "the", "orientationchange", "event", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/thirdparty/jquery-mobile-custom.js#L1228-L1237
4,361
SAP/openui5
src/sap.ui.core/src/sap/ui/thirdparty/jquery-mobile-custom.js
function( event ) { // SAP MODIFICATION: if jQuery event is created programatically there's no originalEvent property. Therefore the existence of event.originalEvent needs to be checked. var data = event.originalEvent && event.originalEvent.touches ? event.originalEvent.touches[ 0 ] : event; return { time: ( new Date() ).getTime(), coords: [ data.pageX, data.pageY ], origin: $( event.target ) }; }
javascript
function( event ) { // SAP MODIFICATION: if jQuery event is created programatically there's no originalEvent property. Therefore the existence of event.originalEvent needs to be checked. var data = event.originalEvent && event.originalEvent.touches ? event.originalEvent.touches[ 0 ] : event; return { time: ( new Date() ).getTime(), coords: [ data.pageX, data.pageY ], origin: $( event.target ) }; }
[ "function", "(", "event", ")", "{", "// SAP MODIFICATION: if jQuery event is created programatically there's no originalEvent property. Therefore the existence of event.originalEvent needs to be checked.", "var", "data", "=", "event", ".", "originalEvent", "&&", "event", ".", "originalEvent", ".", "touches", "?", "event", ".", "originalEvent", ".", "touches", "[", "0", "]", ":", "event", ";", "return", "{", "time", ":", "(", "new", "Date", "(", ")", ")", ".", "getTime", "(", ")", ",", "coords", ":", "[", "data", ".", "pageX", ",", "data", ".", "pageY", "]", ",", "origin", ":", "$", "(", "event", ".", "target", ")", "}", ";", "}" ]
Swipe vertical displacement must be less than this.
[ "Swipe", "vertical", "displacement", "must", "be", "less", "than", "this", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/thirdparty/jquery-mobile-custom.js#L2031-L2040
4,362
SAP/openui5
src/sap.ui.core/src/sap/ui/thirdparty/jquery-mobile-custom.js
stopHandler
function stopHandler( event ) { $this.unbind( touchMoveEvent, moveHandler ) .unbind( touchStopEvent, stopHandler ); if ( start && stop ) { $.event.special.swipe.handleSwipe( start, stop ); } start = stop = undefined; }
javascript
function stopHandler( event ) { $this.unbind( touchMoveEvent, moveHandler ) .unbind( touchStopEvent, stopHandler ); if ( start && stop ) { $.event.special.swipe.handleSwipe( start, stop ); } start = stop = undefined; }
[ "function", "stopHandler", "(", "event", ")", "{", "$this", ".", "unbind", "(", "touchMoveEvent", ",", "moveHandler", ")", ".", "unbind", "(", "touchStopEvent", ",", "stopHandler", ")", ";", "if", "(", "start", "&&", "stop", ")", "{", "$", ".", "event", ".", "special", ".", "swipe", ".", "handleSwipe", "(", "start", ",", "stop", ")", ";", "}", "start", "=", "stop", "=", "undefined", ";", "}" ]
SAP MODIFICATION Because touchcancel is used together with touchend, jQuery.fn.bind is used to replace jQuery.fn.one due to the fact that jQuery.fn.one doesn't work for multiple events.
[ "SAP", "MODIFICATION", "Because", "touchcancel", "is", "used", "together", "with", "touchend", "jQuery", ".", "fn", ".", "bind", "is", "used", "to", "replace", "jQuery", ".", "fn", ".", "one", "due", "to", "the", "fact", "that", "jQuery", ".", "fn", ".", "one", "doesn", "t", "work", "for", "multiple", "events", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/thirdparty/jquery-mobile-custom.js#L2096-L2104
4,363
SAP/openui5
src/sap.ui.core/src/sap/ui/model/odata/ODataUtils.js
parseDecimal
function parseDecimal(sValue) { var aMatches; if (typeof sValue !== "string") { return undefined; } aMatches = rDecimal.exec(sValue); if (!aMatches) { return undefined; } return { sign: aMatches[1] === "-" ? -1 : 1, integerLength: aMatches[2].length, // remove trailing decimal zeroes and poss. the point afterwards abs: aMatches[2] + aMatches[3].replace(rTrailingZeroes, "") .replace(rTrailingDecimal, "") }; }
javascript
function parseDecimal(sValue) { var aMatches; if (typeof sValue !== "string") { return undefined; } aMatches = rDecimal.exec(sValue); if (!aMatches) { return undefined; } return { sign: aMatches[1] === "-" ? -1 : 1, integerLength: aMatches[2].length, // remove trailing decimal zeroes and poss. the point afterwards abs: aMatches[2] + aMatches[3].replace(rTrailingZeroes, "") .replace(rTrailingDecimal, "") }; }
[ "function", "parseDecimal", "(", "sValue", ")", "{", "var", "aMatches", ";", "if", "(", "typeof", "sValue", "!==", "\"string\"", ")", "{", "return", "undefined", ";", "}", "aMatches", "=", "rDecimal", ".", "exec", "(", "sValue", ")", ";", "if", "(", "!", "aMatches", ")", "{", "return", "undefined", ";", "}", "return", "{", "sign", ":", "aMatches", "[", "1", "]", "===", "\"-\"", "?", "-", "1", ":", "1", ",", "integerLength", ":", "aMatches", "[", "2", "]", ".", "length", ",", "// remove trailing decimal zeroes and poss. the point afterwards", "abs", ":", "aMatches", "[", "2", "]", "+", "aMatches", "[", "3", "]", ".", "replace", "(", "rTrailingZeroes", ",", "\"\"", ")", ".", "replace", "(", "rTrailingDecimal", ",", "\"\"", ")", "}", ";", "}" ]
Parses a decimal given in a string. @param {string} sValue the value @returns {object} the result with the sign in <code>sign</code>, the number of integer digits in <code>integerLength</code> and the trimmed absolute value in <code>abs</code>
[ "Parses", "a", "decimal", "given", "in", "a", "string", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/ODataUtils.js#L571-L588
4,364
SAP/openui5
src/sap.ui.core/src/sap/ui/model/odata/ODataUtils.js
decimalCompare
function decimalCompare(sValue1, sValue2) { var oDecimal1, oDecimal2, iResult; if (sValue1 === sValue2) { return 0; } oDecimal1 = parseDecimal(sValue1); oDecimal2 = parseDecimal(sValue2); if (!oDecimal1 || !oDecimal2) { return NaN; } if (oDecimal1.sign !== oDecimal2.sign) { return oDecimal1.sign > oDecimal2.sign ? 1 : -1; } // So they have the same sign. // If the number of integer digits equals, we can simply compare the strings iResult = simpleCompare(oDecimal1.integerLength, oDecimal2.integerLength) || simpleCompare(oDecimal1.abs, oDecimal2.abs); return oDecimal1.sign * iResult; }
javascript
function decimalCompare(sValue1, sValue2) { var oDecimal1, oDecimal2, iResult; if (sValue1 === sValue2) { return 0; } oDecimal1 = parseDecimal(sValue1); oDecimal2 = parseDecimal(sValue2); if (!oDecimal1 || !oDecimal2) { return NaN; } if (oDecimal1.sign !== oDecimal2.sign) { return oDecimal1.sign > oDecimal2.sign ? 1 : -1; } // So they have the same sign. // If the number of integer digits equals, we can simply compare the strings iResult = simpleCompare(oDecimal1.integerLength, oDecimal2.integerLength) || simpleCompare(oDecimal1.abs, oDecimal2.abs); return oDecimal1.sign * iResult; }
[ "function", "decimalCompare", "(", "sValue1", ",", "sValue2", ")", "{", "var", "oDecimal1", ",", "oDecimal2", ",", "iResult", ";", "if", "(", "sValue1", "===", "sValue2", ")", "{", "return", "0", ";", "}", "oDecimal1", "=", "parseDecimal", "(", "sValue1", ")", ";", "oDecimal2", "=", "parseDecimal", "(", "sValue2", ")", ";", "if", "(", "!", "oDecimal1", "||", "!", "oDecimal2", ")", "{", "return", "NaN", ";", "}", "if", "(", "oDecimal1", ".", "sign", "!==", "oDecimal2", ".", "sign", ")", "{", "return", "oDecimal1", ".", "sign", ">", "oDecimal2", ".", "sign", "?", "1", ":", "-", "1", ";", "}", "// So they have the same sign.", "// If the number of integer digits equals, we can simply compare the strings", "iResult", "=", "simpleCompare", "(", "oDecimal1", ".", "integerLength", ",", "oDecimal2", ".", "integerLength", ")", "||", "simpleCompare", "(", "oDecimal1", ".", "abs", ",", "oDecimal2", ".", "abs", ")", ";", "return", "oDecimal1", ".", "sign", "*", "iResult", ";", "}" ]
Compares two decimal values given as strings. @param {string} sValue1 the first value to compare @param {string} sValue2 the second value to compare @return {int} the result of the compare: <code>0</code> if the values are equal, <code>-1</code> if the first value is smaller, <code>1</code> if the first value is larger, <code>NaN</code> if they cannot be compared
[ "Compares", "two", "decimal", "values", "given", "as", "strings", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/ODataUtils.js#L602-L621
4,365
SAP/openui5
src/sap.ui.core/src/sap/ui/core/mvc/ControllerExtension.js
function(sId) { var sNamespace = this.getMetadata().getNamespace(); sId = sNamespace + "." + sId; return this.base ? this.base.byId(sId) : undefined; }
javascript
function(sId) { var sNamespace = this.getMetadata().getNamespace(); sId = sNamespace + "." + sId; return this.base ? this.base.byId(sId) : undefined; }
[ "function", "(", "sId", ")", "{", "var", "sNamespace", "=", "this", ".", "getMetadata", "(", ")", ".", "getNamespace", "(", ")", ";", "sId", "=", "sNamespace", "+", "\".\"", "+", "sId", ";", "return", "this", ".", "base", "?", "this", ".", "base", ".", "byId", "(", "sId", ")", ":", "undefined", ";", "}" ]
Returns an Element of the connected view with the given local ID. Views automatically prepend their own ID as a prefix to created Elements to make the IDs unique even in the case of multiple view instances. For Controller extension the namespace of the control id gets also prefixed with the namespace of the extension. This method helps to find an element by its local ID only. If no view is connected or if the view doesn't contain an element with the given local ID, undefined is returned. @param {string} sId View-local ID @return {sap.ui.core.Element} Element by its (view local) ID @public
[ "Returns", "an", "Element", "of", "the", "connected", "view", "with", "the", "given", "local", "ID", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/mvc/ControllerExtension.js#L52-L56
4,366
SAP/openui5
src/sap.ui.core/src/sap/ui/core/mvc/ControllerExtension.js
function() { var mMethods = {}; var oMetadata = this.getMetadata(); var aPublicMethods = oMetadata.getAllPublicMethods(); aPublicMethods.forEach(function(sMethod) { var fnFunction = this[sMethod]; if (typeof fnFunction === 'function') { mMethods[sMethod] = function() { var tmp = fnFunction.apply(this, arguments); return (tmp instanceof ControllerExtension) ? tmp.getInterface() : tmp; }.bind(this); } //} }.bind(this)); this.getInterface = function() { return mMethods; }; return mMethods; }
javascript
function() { var mMethods = {}; var oMetadata = this.getMetadata(); var aPublicMethods = oMetadata.getAllPublicMethods(); aPublicMethods.forEach(function(sMethod) { var fnFunction = this[sMethod]; if (typeof fnFunction === 'function') { mMethods[sMethod] = function() { var tmp = fnFunction.apply(this, arguments); return (tmp instanceof ControllerExtension) ? tmp.getInterface() : tmp; }.bind(this); } //} }.bind(this)); this.getInterface = function() { return mMethods; }; return mMethods; }
[ "function", "(", ")", "{", "var", "mMethods", "=", "{", "}", ";", "var", "oMetadata", "=", "this", ".", "getMetadata", "(", ")", ";", "var", "aPublicMethods", "=", "oMetadata", ".", "getAllPublicMethods", "(", ")", ";", "aPublicMethods", ".", "forEach", "(", "function", "(", "sMethod", ")", "{", "var", "fnFunction", "=", "this", "[", "sMethod", "]", ";", "if", "(", "typeof", "fnFunction", "===", "'function'", ")", "{", "mMethods", "[", "sMethod", "]", "=", "function", "(", ")", "{", "var", "tmp", "=", "fnFunction", ".", "apply", "(", "this", ",", "arguments", ")", ";", "return", "(", "tmp", "instanceof", "ControllerExtension", ")", "?", "tmp", ".", "getInterface", "(", ")", ":", "tmp", ";", "}", ".", "bind", "(", "this", ")", ";", "}", "//}", "}", ".", "bind", "(", "this", ")", ")", ";", "this", ".", "getInterface", "=", "function", "(", ")", "{", "return", "mMethods", ";", "}", ";", "return", "mMethods", ";", "}" ]
Returns the public interface for this exetension @returns {object} oInterface The public interface for this extension @private
[ "Returns", "the", "public", "interface", "for", "this", "exetension" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/mvc/ControllerExtension.js#L73-L92
4,367
SAP/openui5
lib/jsdoc/ui5/template/publish.js
Version
function Version(versionStr) { var match = rVersion.exec(versionStr) || []; function norm(v) { v = parseInt(v); return isNaN(v) ? 0 : v; } Object.defineProperty(this, "major", { enumerable: true, value: norm(match[0]) }); Object.defineProperty(this, "minor", { enumerable: true, value: norm(match[1]) }); Object.defineProperty(this, "patch", { enumerable: true, value: norm(match[2]) }); Object.defineProperty(this, "suffix", { enumerable: true, value: String(match[3] || "") }); }
javascript
function Version(versionStr) { var match = rVersion.exec(versionStr) || []; function norm(v) { v = parseInt(v); return isNaN(v) ? 0 : v; } Object.defineProperty(this, "major", { enumerable: true, value: norm(match[0]) }); Object.defineProperty(this, "minor", { enumerable: true, value: norm(match[1]) }); Object.defineProperty(this, "patch", { enumerable: true, value: norm(match[2]) }); Object.defineProperty(this, "suffix", { enumerable: true, value: String(match[3] || "") }); }
[ "function", "Version", "(", "versionStr", ")", "{", "var", "match", "=", "rVersion", ".", "exec", "(", "versionStr", ")", "||", "[", "]", ";", "function", "norm", "(", "v", ")", "{", "v", "=", "parseInt", "(", "v", ")", ";", "return", "isNaN", "(", "v", ")", "?", "0", ":", "v", ";", "}", "Object", ".", "defineProperty", "(", "this", ",", "\"major\"", ",", "{", "enumerable", ":", "true", ",", "value", ":", "norm", "(", "match", "[", "0", "]", ")", "}", ")", ";", "Object", ".", "defineProperty", "(", "this", ",", "\"minor\"", ",", "{", "enumerable", ":", "true", ",", "value", ":", "norm", "(", "match", "[", "1", "]", ")", "}", ")", ";", "Object", ".", "defineProperty", "(", "this", ",", "\"patch\"", ",", "{", "enumerable", ":", "true", ",", "value", ":", "norm", "(", "match", "[", "2", "]", ")", "}", ")", ";", "Object", ".", "defineProperty", "(", "this", ",", "\"suffix\"", ",", "{", "enumerable", ":", "true", ",", "value", ":", "String", "(", "match", "[", "3", "]", "||", "\"\"", ")", "}", ")", ";", "}" ]
Creates a Version object from the given version string. @param {string} versionStr A dot-separated version string @classdesc Represents a version consisting of major, minor, patch version and suffix, e.g. '1.2.7-SNAPSHOT'. All parts after the major version are optional. @class
[ "Creates", "a", "Version", "object", "from", "the", "given", "version", "string", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/lib/jsdoc/ui5/template/publish.js#L211-L237
4,368
SAP/openui5
lib/jsdoc/ui5/template/publish.js
getConstructorDescription
function getConstructorDescription(symbol) { var description = symbol.description; var tags = symbol.tags; if ( tags ) { for (var i = 0; i < tags.length; i++) { if ( tags[i].title === "ui5-settings" && tags[i].text) { description += "\n</p><p>\n" + tags[i].text; break; } } } return description; }
javascript
function getConstructorDescription(symbol) { var description = symbol.description; var tags = symbol.tags; if ( tags ) { for (var i = 0; i < tags.length; i++) { if ( tags[i].title === "ui5-settings" && tags[i].text) { description += "\n</p><p>\n" + tags[i].text; break; } } } return description; }
[ "function", "getConstructorDescription", "(", "symbol", ")", "{", "var", "description", "=", "symbol", ".", "description", ";", "var", "tags", "=", "symbol", ".", "tags", ";", "if", "(", "tags", ")", "{", "for", "(", "var", "i", "=", "0", ";", "i", "<", "tags", ".", "length", ";", "i", "++", ")", "{", "if", "(", "tags", "[", "i", "]", ".", "title", "===", "\"ui5-settings\"", "&&", "tags", "[", "i", "]", ".", "text", ")", "{", "description", "+=", "\"\\n</p><p>\\n\"", "+", "tags", "[", "i", "]", ".", "text", ";", "break", ";", "}", "}", "}", "return", "description", ";", "}" ]
Description + Settings
[ "Description", "+", "Settings" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/lib/jsdoc/ui5/template/publish.js#L4094-L4106
4,369
SAP/openui5
src/sap.ui.core/src/sap/ui/core/date/Persian.js
toPersian
function toPersian(oGregorian) { var iJulianDayNumber = g2d(oGregorian.year, oGregorian.month + 1, oGregorian.day); return d2j(iJulianDayNumber); }
javascript
function toPersian(oGregorian) { var iJulianDayNumber = g2d(oGregorian.year, oGregorian.month + 1, oGregorian.day); return d2j(iJulianDayNumber); }
[ "function", "toPersian", "(", "oGregorian", ")", "{", "var", "iJulianDayNumber", "=", "g2d", "(", "oGregorian", ".", "year", ",", "oGregorian", ".", "month", "+", "1", ",", "oGregorian", ".", "day", ")", ";", "return", "d2j", "(", "iJulianDayNumber", ")", ";", "}" ]
Calculate Persian date from gregorian @param {object} oGregorian a JS object containing day, month and year in the gregorian calendar @private
[ "Calculate", "Persian", "date", "from", "gregorian" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/date/Persian.js#L50-L53
4,370
SAP/openui5
src/sap.ui.core/src/sap/ui/core/date/Persian.js
toGregorian
function toGregorian(oPersian) { var iJulianDayNumber = j2d(oPersian.year, oPersian.month + 1, oPersian.day); return d2g(iJulianDayNumber); }
javascript
function toGregorian(oPersian) { var iJulianDayNumber = j2d(oPersian.year, oPersian.month + 1, oPersian.day); return d2g(iJulianDayNumber); }
[ "function", "toGregorian", "(", "oPersian", ")", "{", "var", "iJulianDayNumber", "=", "j2d", "(", "oPersian", ".", "year", ",", "oPersian", ".", "month", "+", "1", ",", "oPersian", ".", "day", ")", ";", "return", "d2g", "(", "iJulianDayNumber", ")", ";", "}" ]
Calculate gregorian date from Persian @param {object} oPersian a JS object containing day, month and year in the Persian calendar @private
[ "Calculate", "gregorian", "date", "from", "Persian" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/date/Persian.js#L61-L64
4,371
SAP/openui5
src/sap.ui.demokit/src/sap/ui/demokit/demoapps/model/libraryData.js
createDemoAppData
function createDemoAppData(oDemoAppMetadata, sLibUrl, sLibNamespace) { // transform simple demo app link to a configuration object var aLinks = []; // transform link object to a bindable array of objects if (jQuery.isPlainObject(oDemoAppMetadata.links)) { aLinks = Object.keys(oDemoAppMetadata.links).map(function (sKey) { return { name: sKey, ref: oDemoAppMetadata.links[sKey] }; }); } var oApp = { lib : oDemoAppMetadata.namespace || sLibNamespace, name : oDemoAppMetadata.text, icon : oDemoAppMetadata.icon, desc : oDemoAppMetadata.desc, config : oDemoAppMetadata.config, teaser : oDemoAppMetadata.teaser, category : oDemoAppMetadata.category, ref : (oDemoAppMetadata.resolve === "lib" ? sLibUrl : "") + oDemoAppMetadata.ref, links : aLinks }; return oApp; }
javascript
function createDemoAppData(oDemoAppMetadata, sLibUrl, sLibNamespace) { // transform simple demo app link to a configuration object var aLinks = []; // transform link object to a bindable array of objects if (jQuery.isPlainObject(oDemoAppMetadata.links)) { aLinks = Object.keys(oDemoAppMetadata.links).map(function (sKey) { return { name: sKey, ref: oDemoAppMetadata.links[sKey] }; }); } var oApp = { lib : oDemoAppMetadata.namespace || sLibNamespace, name : oDemoAppMetadata.text, icon : oDemoAppMetadata.icon, desc : oDemoAppMetadata.desc, config : oDemoAppMetadata.config, teaser : oDemoAppMetadata.teaser, category : oDemoAppMetadata.category, ref : (oDemoAppMetadata.resolve === "lib" ? sLibUrl : "") + oDemoAppMetadata.ref, links : aLinks }; return oApp; }
[ "function", "createDemoAppData", "(", "oDemoAppMetadata", ",", "sLibUrl", ",", "sLibNamespace", ")", "{", "// transform simple demo app link to a configuration object", "var", "aLinks", "=", "[", "]", ";", "// transform link object to a bindable array of objects", "if", "(", "jQuery", ".", "isPlainObject", "(", "oDemoAppMetadata", ".", "links", ")", ")", "{", "aLinks", "=", "Object", ".", "keys", "(", "oDemoAppMetadata", ".", "links", ")", ".", "map", "(", "function", "(", "sKey", ")", "{", "return", "{", "name", ":", "sKey", ",", "ref", ":", "oDemoAppMetadata", ".", "links", "[", "sKey", "]", "}", ";", "}", ")", ";", "}", "var", "oApp", "=", "{", "lib", ":", "oDemoAppMetadata", ".", "namespace", "||", "sLibNamespace", ",", "name", ":", "oDemoAppMetadata", ".", "text", ",", "icon", ":", "oDemoAppMetadata", ".", "icon", ",", "desc", ":", "oDemoAppMetadata", ".", "desc", ",", "config", ":", "oDemoAppMetadata", ".", "config", ",", "teaser", ":", "oDemoAppMetadata", ".", "teaser", ",", "category", ":", "oDemoAppMetadata", ".", "category", ",", "ref", ":", "(", "oDemoAppMetadata", ".", "resolve", "===", "\"lib\"", "?", "sLibUrl", ":", "\"\"", ")", "+", "oDemoAppMetadata", ".", "ref", ",", "links", ":", "aLinks", "}", ";", "return", "oApp", ";", "}" ]
function to compute the app objects for a demo object
[ "function", "to", "compute", "the", "app", "objects", "for", "a", "demo", "object" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.demokit/src/sap/ui/demokit/demoapps/model/libraryData.js#L12-L38
4,372
SAP/openui5
src/sap.ui.commons/src/sap/ui/commons/layout/AbsoluteLayoutRenderer.js
function(oPosition) { var oPos = oPosition.getComputedPosition(); var addStyle = function(oPosition, aBuffer, sPos, sVal){ if (sVal) { aBuffer.push(sPos + ":" + sVal + ";"); } }; var aBuffer = []; addStyle(oPosition, aBuffer, "top", oPos.top); addStyle(oPosition, aBuffer, "bottom", oPos.bottom); addStyle(oPosition, aBuffer, "left", oPos.left); addStyle(oPosition, aBuffer, "right", oPos.right); addStyle(oPosition, aBuffer, "width", oPos.width); addStyle(oPosition, aBuffer, "height", oPos.height); return aBuffer.join(""); }
javascript
function(oPosition) { var oPos = oPosition.getComputedPosition(); var addStyle = function(oPosition, aBuffer, sPos, sVal){ if (sVal) { aBuffer.push(sPos + ":" + sVal + ";"); } }; var aBuffer = []; addStyle(oPosition, aBuffer, "top", oPos.top); addStyle(oPosition, aBuffer, "bottom", oPos.bottom); addStyle(oPosition, aBuffer, "left", oPos.left); addStyle(oPosition, aBuffer, "right", oPos.right); addStyle(oPosition, aBuffer, "width", oPos.width); addStyle(oPosition, aBuffer, "height", oPos.height); return aBuffer.join(""); }
[ "function", "(", "oPosition", ")", "{", "var", "oPos", "=", "oPosition", ".", "getComputedPosition", "(", ")", ";", "var", "addStyle", "=", "function", "(", "oPosition", ",", "aBuffer", ",", "sPos", ",", "sVal", ")", "{", "if", "(", "sVal", ")", "{", "aBuffer", ".", "push", "(", "sPos", "+", "\":\"", "+", "sVal", "+", "\";\"", ")", ";", "}", "}", ";", "var", "aBuffer", "=", "[", "]", ";", "addStyle", "(", "oPosition", ",", "aBuffer", ",", "\"top\"", ",", "oPos", ".", "top", ")", ";", "addStyle", "(", "oPosition", ",", "aBuffer", ",", "\"bottom\"", ",", "oPos", ".", "bottom", ")", ";", "addStyle", "(", "oPosition", ",", "aBuffer", ",", "\"left\"", ",", "oPos", ".", "left", ")", ";", "addStyle", "(", "oPosition", ",", "aBuffer", ",", "\"right\"", ",", "oPos", ".", "right", ")", ";", "addStyle", "(", "oPosition", ",", "aBuffer", ",", "\"width\"", ",", "oPos", ".", "width", ")", ";", "addStyle", "(", "oPosition", ",", "aBuffer", ",", "\"height\"", ",", "oPos", ".", "height", ")", ";", "return", "aBuffer", ".", "join", "(", "\"\"", ")", ";", "}" ]
Computes and returns the CSS styles for the given position. @private
[ "Computes", "and", "returns", "the", "CSS", "styles", "for", "the", "given", "position", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.commons/src/sap/ui/commons/layout/AbsoluteLayoutRenderer.js#L173-L191
4,373
SAP/openui5
src/sap.ui.core/src/sap/ui/model/analytics/AnalyticalBinding.js
logUnsupportedPropertyInSelect
function logUnsupportedPropertyInSelect(sPath, sSelectedProperty, oDimensionOrMeasure) { var sDimensionOrMeasure = oDimensionOrMeasure instanceof sap.ui.model.analytics.odata4analytics.Dimension ? "dimension" : "measure"; if (oDimensionOrMeasure.getName() === sSelectedProperty) { oLogger.warning("Ignored the 'select' binding parameter, because it contains" + " the " + sDimensionOrMeasure + " property '" + sSelectedProperty + "' which is not contained in the analytical info (see updateAnalyticalInfo)", sPath); } else { oLogger.warning("Ignored the 'select' binding parameter, because the property '" + sSelectedProperty + "' is associated with the " + sDimensionOrMeasure + " property '" + oDimensionOrMeasure.getName() + "' which is not contained in the analytical" + " info (see updateAnalyticalInfo)", sPath); } }
javascript
function logUnsupportedPropertyInSelect(sPath, sSelectedProperty, oDimensionOrMeasure) { var sDimensionOrMeasure = oDimensionOrMeasure instanceof sap.ui.model.analytics.odata4analytics.Dimension ? "dimension" : "measure"; if (oDimensionOrMeasure.getName() === sSelectedProperty) { oLogger.warning("Ignored the 'select' binding parameter, because it contains" + " the " + sDimensionOrMeasure + " property '" + sSelectedProperty + "' which is not contained in the analytical info (see updateAnalyticalInfo)", sPath); } else { oLogger.warning("Ignored the 'select' binding parameter, because the property '" + sSelectedProperty + "' is associated with the " + sDimensionOrMeasure + " property '" + oDimensionOrMeasure.getName() + "' which is not contained in the analytical" + " info (see updateAnalyticalInfo)", sPath); } }
[ "function", "logUnsupportedPropertyInSelect", "(", "sPath", ",", "sSelectedProperty", ",", "oDimensionOrMeasure", ")", "{", "var", "sDimensionOrMeasure", "=", "oDimensionOrMeasure", "instanceof", "sap", ".", "ui", ".", "model", ".", "analytics", ".", "odata4analytics", ".", "Dimension", "?", "\"dimension\"", ":", "\"measure\"", ";", "if", "(", "oDimensionOrMeasure", ".", "getName", "(", ")", "===", "sSelectedProperty", ")", "{", "oLogger", ".", "warning", "(", "\"Ignored the 'select' binding parameter, because it contains\"", "+", "\" the \"", "+", "sDimensionOrMeasure", "+", "\" property '\"", "+", "sSelectedProperty", "+", "\"' which is not contained in the analytical info (see updateAnalyticalInfo)\"", ",", "sPath", ")", ";", "}", "else", "{", "oLogger", ".", "warning", "(", "\"Ignored the 'select' binding parameter, because the property '\"", "+", "sSelectedProperty", "+", "\"' is associated with the \"", "+", "sDimensionOrMeasure", "+", "\" property '\"", "+", "oDimensionOrMeasure", ".", "getName", "(", ")", "+", "\"' which is not contained in the analytical\"", "+", "\" info (see updateAnalyticalInfo)\"", ",", "sPath", ")", ";", "}", "}" ]
Logs a warning that the given select property is not supported. Either it is a dimension or a measure or it is associated with a dimension or a measure which is not part of the analytical info. @param {string} sPath The binding path @param {string} sSelectedProperty The name of the selected property @param {sap.ui.model.analytics.odata4analytics.Dimension |sap.ui.model.analytics.odata4analytics.Measure} oDimensionOrMeasure The dimension or measure that causes the issue
[ "Logs", "a", "warning", "that", "the", "given", "select", "property", "is", "not", "supported", ".", "Either", "it", "is", "a", "dimension", "or", "a", "measure", "or", "it", "is", "associated", "with", "a", "dimension", "or", "a", "measure", "which", "is", "not", "part", "of", "the", "analytical", "info", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/analytics/AnalyticalBinding.js#L157-L177
4,374
SAP/openui5
src/sap.ui.core/src/sap/ui/model/analytics/AnalyticalBinding.js
trimAndCheckForDuplicates
function trimAndCheckForDuplicates(aSelect, sPath) { var sCurrentProperty, bError = false, i, n; // replace all white-spaces before and after the value for (i = 0, n = aSelect.length; i < n; i++) { aSelect[i] = aSelect[i].trim(); } // check for duplicate entries and remove from list for (i = aSelect.length - 1; i >= 0; i--) { sCurrentProperty = aSelect[i]; if (aSelect.indexOf(sCurrentProperty) !== i) { // found duplicate oLogger.warning("Ignored the 'select' binding parameter, because it" + " contains the property '" + sCurrentProperty + "' multiple times", sPath); aSelect.splice(i, 1); bError = true; } } return bError; }
javascript
function trimAndCheckForDuplicates(aSelect, sPath) { var sCurrentProperty, bError = false, i, n; // replace all white-spaces before and after the value for (i = 0, n = aSelect.length; i < n; i++) { aSelect[i] = aSelect[i].trim(); } // check for duplicate entries and remove from list for (i = aSelect.length - 1; i >= 0; i--) { sCurrentProperty = aSelect[i]; if (aSelect.indexOf(sCurrentProperty) !== i) { // found duplicate oLogger.warning("Ignored the 'select' binding parameter, because it" + " contains the property '" + sCurrentProperty + "' multiple times", sPath); aSelect.splice(i, 1); bError = true; } } return bError; }
[ "function", "trimAndCheckForDuplicates", "(", "aSelect", ",", "sPath", ")", "{", "var", "sCurrentProperty", ",", "bError", "=", "false", ",", "i", ",", "n", ";", "// replace all white-spaces before and after the value", "for", "(", "i", "=", "0", ",", "n", "=", "aSelect", ".", "length", ";", "i", "<", "n", ";", "i", "++", ")", "{", "aSelect", "[", "i", "]", "=", "aSelect", "[", "i", "]", ".", "trim", "(", ")", ";", "}", "// check for duplicate entries and remove from list", "for", "(", "i", "=", "aSelect", ".", "length", "-", "1", ";", "i", ">=", "0", ";", "i", "--", ")", "{", "sCurrentProperty", "=", "aSelect", "[", "i", "]", ";", "if", "(", "aSelect", ".", "indexOf", "(", "sCurrentProperty", ")", "!==", "i", ")", "{", "// found duplicate", "oLogger", ".", "warning", "(", "\"Ignored the 'select' binding parameter, because it\"", "+", "\" contains the property '\"", "+", "sCurrentProperty", "+", "\"' multiple times\"", ",", "sPath", ")", ";", "aSelect", ".", "splice", "(", "i", ",", "1", ")", ";", "bError", "=", "true", ";", "}", "}", "return", "bError", ";", "}" ]
Iterate over the given array, trim each value and check whether there are duplicate entries in the array. If there are duplicate entries a warning is logged and the duplicate is removed from the array. @param {string[]} aSelect An array of strings @param {string} sPath The binding path @returns {boolean} <code>true</code> if there is at least one duplicate entry in the array.
[ "Iterate", "over", "the", "given", "array", "trim", "each", "value", "and", "check", "whether", "there", "are", "duplicate", "entries", "in", "the", "array", ".", "If", "there", "are", "duplicate", "entries", "a", "warning", "is", "logged", "and", "the", "duplicate", "is", "removed", "from", "the", "array", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/analytics/AnalyticalBinding.js#L188-L211
4,375
SAP/openui5
src/sap.ui.core/src/sap/ui/model/analytics/AnalyticalBinding.js
function(sGroupId, iAutoExpandGroupsToLevel, iStartIndex, iLength) { var iLevel = that._getGroupIdLevel(sGroupId); if (iLevel == iAutoExpandGroupsToLevel) { var aContext = that._getLoadedContextsForGroup(sGroupId, iStartIndex, iLength); var iLastLoadedIndex = iStartIndex + aContext.length - 1; if (aContext.length >= iLength) { return oNO_MISSING_MEMBER; } else if (that.mFinalLength[sGroupId]) { if (aContext.length >= that.mLength[sGroupId]) { return { groupId_Missing: null, length_Missing: iLength - aContext.length }; // group completely loaded, but some members are still missing } else { return { groupId_Missing: sGroupId, startIndex_Missing: iLastLoadedIndex + 1, length_Missing: iLength - aContext.length }; // loading must start here } } else { return { groupId_Missing: sGroupId, startIndex_Missing: iLastLoadedIndex + 1, length_Missing: iLength - aContext.length }; // loading must start here } } // deepest expansion level not yet reached, so traverse groups in depth-first order var aContext2 = that._getLoadedContextsForGroup(sGroupId, iStartIndex, iLength); var iLength_Missing = iLength, iLastLoadedIndex2 = iStartIndex + aContext2.length - 1; for (var i = -1, oContext; (oContext = aContext2[++i]) !== undefined; ) { iLength_Missing--; // count the current context var oGroupExpansionFirstMember = calculateRequiredSubGroupExpansion(that._getGroupIdFromContext(oContext, iLevel + 1), iAutoExpandGroupsToLevel, 0, iLength_Missing); if (oGroupExpansionFirstMember.groupId_Missing == null) { if (oGroupExpansionFirstMember.length_Missing == 0) { return oGroupExpansionFirstMember; // finished - everything is loaded } else { iLength_Missing = oGroupExpansionFirstMember.length_Missing; } } else { return oGroupExpansionFirstMember; // loading must start here } if (iLength_Missing == 0) { break; } } if (that.mFinalLength[sGroupId] || iLength_Missing == 0) { return { groupId_Missing: null, length_Missing: iLength_Missing }; // group completely loaded; maybe some members are still missing } else { return { groupId_Missing: sGroupId, startIndex_Missing: iLastLoadedIndex2 + 1, length_Missing: iLength_Missing }; // loading must start here } }
javascript
function(sGroupId, iAutoExpandGroupsToLevel, iStartIndex, iLength) { var iLevel = that._getGroupIdLevel(sGroupId); if (iLevel == iAutoExpandGroupsToLevel) { var aContext = that._getLoadedContextsForGroup(sGroupId, iStartIndex, iLength); var iLastLoadedIndex = iStartIndex + aContext.length - 1; if (aContext.length >= iLength) { return oNO_MISSING_MEMBER; } else if (that.mFinalLength[sGroupId]) { if (aContext.length >= that.mLength[sGroupId]) { return { groupId_Missing: null, length_Missing: iLength - aContext.length }; // group completely loaded, but some members are still missing } else { return { groupId_Missing: sGroupId, startIndex_Missing: iLastLoadedIndex + 1, length_Missing: iLength - aContext.length }; // loading must start here } } else { return { groupId_Missing: sGroupId, startIndex_Missing: iLastLoadedIndex + 1, length_Missing: iLength - aContext.length }; // loading must start here } } // deepest expansion level not yet reached, so traverse groups in depth-first order var aContext2 = that._getLoadedContextsForGroup(sGroupId, iStartIndex, iLength); var iLength_Missing = iLength, iLastLoadedIndex2 = iStartIndex + aContext2.length - 1; for (var i = -1, oContext; (oContext = aContext2[++i]) !== undefined; ) { iLength_Missing--; // count the current context var oGroupExpansionFirstMember = calculateRequiredSubGroupExpansion(that._getGroupIdFromContext(oContext, iLevel + 1), iAutoExpandGroupsToLevel, 0, iLength_Missing); if (oGroupExpansionFirstMember.groupId_Missing == null) { if (oGroupExpansionFirstMember.length_Missing == 0) { return oGroupExpansionFirstMember; // finished - everything is loaded } else { iLength_Missing = oGroupExpansionFirstMember.length_Missing; } } else { return oGroupExpansionFirstMember; // loading must start here } if (iLength_Missing == 0) { break; } } if (that.mFinalLength[sGroupId] || iLength_Missing == 0) { return { groupId_Missing: null, length_Missing: iLength_Missing }; // group completely loaded; maybe some members are still missing } else { return { groupId_Missing: sGroupId, startIndex_Missing: iLastLoadedIndex2 + 1, length_Missing: iLength_Missing }; // loading must start here } }
[ "function", "(", "sGroupId", ",", "iAutoExpandGroupsToLevel", ",", "iStartIndex", ",", "iLength", ")", "{", "var", "iLevel", "=", "that", ".", "_getGroupIdLevel", "(", "sGroupId", ")", ";", "if", "(", "iLevel", "==", "iAutoExpandGroupsToLevel", ")", "{", "var", "aContext", "=", "that", ".", "_getLoadedContextsForGroup", "(", "sGroupId", ",", "iStartIndex", ",", "iLength", ")", ";", "var", "iLastLoadedIndex", "=", "iStartIndex", "+", "aContext", ".", "length", "-", "1", ";", "if", "(", "aContext", ".", "length", ">=", "iLength", ")", "{", "return", "oNO_MISSING_MEMBER", ";", "}", "else", "if", "(", "that", ".", "mFinalLength", "[", "sGroupId", "]", ")", "{", "if", "(", "aContext", ".", "length", ">=", "that", ".", "mLength", "[", "sGroupId", "]", ")", "{", "return", "{", "groupId_Missing", ":", "null", ",", "length_Missing", ":", "iLength", "-", "aContext", ".", "length", "}", ";", "// group completely loaded, but some members are still missing", "}", "else", "{", "return", "{", "groupId_Missing", ":", "sGroupId", ",", "startIndex_Missing", ":", "iLastLoadedIndex", "+", "1", ",", "length_Missing", ":", "iLength", "-", "aContext", ".", "length", "}", ";", "// loading must start here", "}", "}", "else", "{", "return", "{", "groupId_Missing", ":", "sGroupId", ",", "startIndex_Missing", ":", "iLastLoadedIndex", "+", "1", ",", "length_Missing", ":", "iLength", "-", "aContext", ".", "length", "}", ";", "// loading must start here", "}", "}", "// deepest expansion level not yet reached, so traverse groups in depth-first order", "var", "aContext2", "=", "that", ".", "_getLoadedContextsForGroup", "(", "sGroupId", ",", "iStartIndex", ",", "iLength", ")", ";", "var", "iLength_Missing", "=", "iLength", ",", "iLastLoadedIndex2", "=", "iStartIndex", "+", "aContext2", ".", "length", "-", "1", ";", "for", "(", "var", "i", "=", "-", "1", ",", "oContext", ";", "(", "oContext", "=", "aContext2", "[", "++", "i", "]", ")", "!==", "undefined", ";", ")", "{", "iLength_Missing", "--", ";", "// count the current context", "var", "oGroupExpansionFirstMember", "=", "calculateRequiredSubGroupExpansion", "(", "that", ".", "_getGroupIdFromContext", "(", "oContext", ",", "iLevel", "+", "1", ")", ",", "iAutoExpandGroupsToLevel", ",", "0", ",", "iLength_Missing", ")", ";", "if", "(", "oGroupExpansionFirstMember", ".", "groupId_Missing", "==", "null", ")", "{", "if", "(", "oGroupExpansionFirstMember", ".", "length_Missing", "==", "0", ")", "{", "return", "oGroupExpansionFirstMember", ";", "// finished - everything is loaded", "}", "else", "{", "iLength_Missing", "=", "oGroupExpansionFirstMember", ".", "length_Missing", ";", "}", "}", "else", "{", "return", "oGroupExpansionFirstMember", ";", "// loading must start here", "}", "if", "(", "iLength_Missing", "==", "0", ")", "{", "break", ";", "}", "}", "if", "(", "that", ".", "mFinalLength", "[", "sGroupId", "]", "||", "iLength_Missing", "==", "0", ")", "{", "return", "{", "groupId_Missing", ":", "null", ",", "length_Missing", ":", "iLength_Missing", "}", ";", "// group completely loaded; maybe some members are still missing", "}", "else", "{", "return", "{", "groupId_Missing", ":", "sGroupId", ",", "startIndex_Missing", ":", "iLastLoadedIndex2", "+", "1", ",", "length_Missing", ":", "iLength_Missing", "}", ";", "// loading must start here", "}", "}" ]
helper function Searches for missing members in the sub groups of the given sGroupId @returns {Object} Either { groupId_Missing, startIndex_Missing, length_Missing } expressing the number (length_Missing) of missing contexts starting in group (groupId_Missing) at position (startIndex_Missing) using depth-first traversal of loaded data, or { null, length_Missing } if the group with given ID (sGroupId) is completely loaded and still (length_Missing) further members (of other groups) are missing. Special case: { null, 0 } denotes that everything is loaded.
[ "helper", "function", "Searches", "for", "missing", "members", "in", "the", "sub", "groups", "of", "the", "given", "sGroupId" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/analytics/AnalyticalBinding.js#L3635-L3678
4,376
SAP/openui5
src/sap.ui.core/src/sap/ui/events/TouchToMouseMapping.js
function(sType, oEvent) { if (!bHandleEvent) { return; } // we need mapping of the different event types to get the correct target var oMappedEvent = oEvent.type == "touchend" ? oEvent.changedTouches[0] : oEvent.touches[0]; // create the synthetic event var newEvent = oDocument.createEvent('MouseEvent'); // trying to create an actual TouchEvent will create an error newEvent.initMouseEvent(sType, true, true, window, oEvent.detail, oMappedEvent.screenX, oMappedEvent.screenY, oMappedEvent.clientX, oMappedEvent.clientY, oEvent.ctrlKey, oEvent.shiftKey, oEvent.altKey, oEvent.metaKey, oEvent.button, oEvent.relatedTarget); newEvent.isSynthetic = true; // Timeout needed. Do not interrupt the native event handling. window.setTimeout(function() { oTarget.dispatchEvent(newEvent); }, 0); }
javascript
function(sType, oEvent) { if (!bHandleEvent) { return; } // we need mapping of the different event types to get the correct target var oMappedEvent = oEvent.type == "touchend" ? oEvent.changedTouches[0] : oEvent.touches[0]; // create the synthetic event var newEvent = oDocument.createEvent('MouseEvent'); // trying to create an actual TouchEvent will create an error newEvent.initMouseEvent(sType, true, true, window, oEvent.detail, oMappedEvent.screenX, oMappedEvent.screenY, oMappedEvent.clientX, oMappedEvent.clientY, oEvent.ctrlKey, oEvent.shiftKey, oEvent.altKey, oEvent.metaKey, oEvent.button, oEvent.relatedTarget); newEvent.isSynthetic = true; // Timeout needed. Do not interrupt the native event handling. window.setTimeout(function() { oTarget.dispatchEvent(newEvent); }, 0); }
[ "function", "(", "sType", ",", "oEvent", ")", "{", "if", "(", "!", "bHandleEvent", ")", "{", "return", ";", "}", "// we need mapping of the different event types to get the correct target", "var", "oMappedEvent", "=", "oEvent", ".", "type", "==", "\"touchend\"", "?", "oEvent", ".", "changedTouches", "[", "0", "]", ":", "oEvent", ".", "touches", "[", "0", "]", ";", "// create the synthetic event", "var", "newEvent", "=", "oDocument", ".", "createEvent", "(", "'MouseEvent'", ")", ";", "// trying to create an actual TouchEvent will create an error", "newEvent", ".", "initMouseEvent", "(", "sType", ",", "true", ",", "true", ",", "window", ",", "oEvent", ".", "detail", ",", "oMappedEvent", ".", "screenX", ",", "oMappedEvent", ".", "screenY", ",", "oMappedEvent", ".", "clientX", ",", "oMappedEvent", ".", "clientY", ",", "oEvent", ".", "ctrlKey", ",", "oEvent", ".", "shiftKey", ",", "oEvent", ".", "altKey", ",", "oEvent", ".", "metaKey", ",", "oEvent", ".", "button", ",", "oEvent", ".", "relatedTarget", ")", ";", "newEvent", ".", "isSynthetic", "=", "true", ";", "// Timeout needed. Do not interrupt the native event handling.", "window", ".", "setTimeout", "(", "function", "(", ")", "{", "oTarget", ".", "dispatchEvent", "(", "newEvent", ")", ";", "}", ",", "0", ")", ";", "}" ]
Fires a synthetic mouse event for a given type and native touch event. @param {string} sType the type of the synthetic event to fire, e.g. "mousedown" @param {jQuery.Event} oEvent the event object @private
[ "Fires", "a", "synthetic", "mouse", "event", "for", "a", "given", "type", "and", "native", "touch", "event", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/events/TouchToMouseMapping.js#L36-L58
4,377
SAP/openui5
src/sap.ui.core/src/sap/ui/events/TouchToMouseMapping.js
function(oEvent) { var oTouches = oEvent.touches, oTouch; bHandleEvent = (oTouches.length == 1 && !isInputField(oEvent)); bIsMoved = false; if (bHandleEvent) { oTouch = oTouches[0]; // As we are only interested in the first touch target, we remember it oTarget = oTouch.target; if (oTarget.nodeType === 3) { // no text node oTarget = oTarget.parentNode; } // Remember the start position of the first touch to determine if a click was performed or not. iStartX = oTouch.clientX; iStartY = oTouch.clientY; fireMouseEvent("mousedown", oEvent); } }
javascript
function(oEvent) { var oTouches = oEvent.touches, oTouch; bHandleEvent = (oTouches.length == 1 && !isInputField(oEvent)); bIsMoved = false; if (bHandleEvent) { oTouch = oTouches[0]; // As we are only interested in the first touch target, we remember it oTarget = oTouch.target; if (oTarget.nodeType === 3) { // no text node oTarget = oTarget.parentNode; } // Remember the start position of the first touch to determine if a click was performed or not. iStartX = oTouch.clientX; iStartY = oTouch.clientY; fireMouseEvent("mousedown", oEvent); } }
[ "function", "(", "oEvent", ")", "{", "var", "oTouches", "=", "oEvent", ".", "touches", ",", "oTouch", ";", "bHandleEvent", "=", "(", "oTouches", ".", "length", "==", "1", "&&", "!", "isInputField", "(", "oEvent", ")", ")", ";", "bIsMoved", "=", "false", ";", "if", "(", "bHandleEvent", ")", "{", "oTouch", "=", "oTouches", "[", "0", "]", ";", "// As we are only interested in the first touch target, we remember it", "oTarget", "=", "oTouch", ".", "target", ";", "if", "(", "oTarget", ".", "nodeType", "===", "3", ")", "{", "// no text node", "oTarget", "=", "oTarget", ".", "parentNode", ";", "}", "// Remember the start position of the first touch to determine if a click was performed or not.", "iStartX", "=", "oTouch", ".", "clientX", ";", "iStartY", "=", "oTouch", ".", "clientY", ";", "fireMouseEvent", "(", "\"mousedown\"", ",", "oEvent", ")", ";", "}", "}" ]
Touch start event handler. Called whenever a finger is added to the surface. Fires mouse start event. @param {jQuery.Event} oEvent the event object @private
[ "Touch", "start", "event", "handler", ".", "Called", "whenever", "a", "finger", "is", "added", "to", "the", "surface", ".", "Fires", "mouse", "start", "event", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/events/TouchToMouseMapping.js#L86-L109
4,378
SAP/openui5
src/sap.ui.core/src/sap/ui/events/TouchToMouseMapping.js
function(oEvent) { var oTouch; if (bHandleEvent) { oTouch = oEvent.touches[0]; // Check if the finger is moved. When the finger was moved, no "click" event is fired. if (Math.abs(oTouch.clientX - iStartX) > 10 || Math.abs(oTouch.clientY - iStartY) > 10) { bIsMoved = true; } if (bIsMoved) { // Fire "mousemove" event only when the finger was moved. This is to prevent unwanted movements. fireMouseEvent("mousemove", oEvent); } } }
javascript
function(oEvent) { var oTouch; if (bHandleEvent) { oTouch = oEvent.touches[0]; // Check if the finger is moved. When the finger was moved, no "click" event is fired. if (Math.abs(oTouch.clientX - iStartX) > 10 || Math.abs(oTouch.clientY - iStartY) > 10) { bIsMoved = true; } if (bIsMoved) { // Fire "mousemove" event only when the finger was moved. This is to prevent unwanted movements. fireMouseEvent("mousemove", oEvent); } } }
[ "function", "(", "oEvent", ")", "{", "var", "oTouch", ";", "if", "(", "bHandleEvent", ")", "{", "oTouch", "=", "oEvent", ".", "touches", "[", "0", "]", ";", "// Check if the finger is moved. When the finger was moved, no \"click\" event is fired.", "if", "(", "Math", ".", "abs", "(", "oTouch", ".", "clientX", "-", "iStartX", ")", ">", "10", "||", "Math", ".", "abs", "(", "oTouch", ".", "clientY", "-", "iStartY", ")", ">", "10", ")", "{", "bIsMoved", "=", "true", ";", "}", "if", "(", "bIsMoved", ")", "{", "// Fire \"mousemove\" event only when the finger was moved. This is to prevent unwanted movements.", "fireMouseEvent", "(", "\"mousemove\"", ",", "oEvent", ")", ";", "}", "}", "}" ]
Touch move event handler. Fires mouse move event. @param {jQuery.Event} oEvent the event object @private
[ "Touch", "move", "event", "handler", ".", "Fires", "mouse", "move", "event", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/events/TouchToMouseMapping.js#L116-L133
4,379
SAP/openui5
src/sap.ui.fl/src/sap/ui/fl/variants/VariantModel.js
function() { var aVariantManagementReferences = Object.keys(this.oData); aVariantManagementReferences.forEach(function(sVariantManagementReference) { var mPropertyBag = { variantManagementReference: sVariantManagementReference, currentVariantReference: this.oData[sVariantManagementReference].currentVariant || this.oData[sVariantManagementReference].defaultVariant , newVariantReference: true // since new variant is not known - true will lead to no new changes for variant switch }; var mChangesToBeSwitched = this.oChangePersistence.loadSwitchChangesMapForComponent(mPropertyBag); this._oVariantSwitchPromise = this._oVariantSwitchPromise .then(this.oFlexController.revertChangesOnControl.bind(this.oFlexController, mChangesToBeSwitched.changesToBeReverted, this.oAppComponent)) .then(function() { delete this.oData[sVariantManagementReference]; delete this.oVariantController.getChangeFileContent()[sVariantManagementReference]; this._ensureStandardVariantExists(sVariantManagementReference); }.bind(this)); }.bind(this)); //re-initialize hash register and remove existing parameters VariantUtil.initializeHashRegister.call(this); this.updateHasherEntry({ parameters: [] }); return this._oVariantSwitchPromise; }
javascript
function() { var aVariantManagementReferences = Object.keys(this.oData); aVariantManagementReferences.forEach(function(sVariantManagementReference) { var mPropertyBag = { variantManagementReference: sVariantManagementReference, currentVariantReference: this.oData[sVariantManagementReference].currentVariant || this.oData[sVariantManagementReference].defaultVariant , newVariantReference: true // since new variant is not known - true will lead to no new changes for variant switch }; var mChangesToBeSwitched = this.oChangePersistence.loadSwitchChangesMapForComponent(mPropertyBag); this._oVariantSwitchPromise = this._oVariantSwitchPromise .then(this.oFlexController.revertChangesOnControl.bind(this.oFlexController, mChangesToBeSwitched.changesToBeReverted, this.oAppComponent)) .then(function() { delete this.oData[sVariantManagementReference]; delete this.oVariantController.getChangeFileContent()[sVariantManagementReference]; this._ensureStandardVariantExists(sVariantManagementReference); }.bind(this)); }.bind(this)); //re-initialize hash register and remove existing parameters VariantUtil.initializeHashRegister.call(this); this.updateHasherEntry({ parameters: [] }); return this._oVariantSwitchPromise; }
[ "function", "(", ")", "{", "var", "aVariantManagementReferences", "=", "Object", ".", "keys", "(", "this", ".", "oData", ")", ";", "aVariantManagementReferences", ".", "forEach", "(", "function", "(", "sVariantManagementReference", ")", "{", "var", "mPropertyBag", "=", "{", "variantManagementReference", ":", "sVariantManagementReference", ",", "currentVariantReference", ":", "this", ".", "oData", "[", "sVariantManagementReference", "]", ".", "currentVariant", "||", "this", ".", "oData", "[", "sVariantManagementReference", "]", ".", "defaultVariant", ",", "newVariantReference", ":", "true", "// since new variant is not known - true will lead to no new changes for variant switch", "}", ";", "var", "mChangesToBeSwitched", "=", "this", ".", "oChangePersistence", ".", "loadSwitchChangesMapForComponent", "(", "mPropertyBag", ")", ";", "this", ".", "_oVariantSwitchPromise", "=", "this", ".", "_oVariantSwitchPromise", ".", "then", "(", "this", ".", "oFlexController", ".", "revertChangesOnControl", ".", "bind", "(", "this", ".", "oFlexController", ",", "mChangesToBeSwitched", ".", "changesToBeReverted", ",", "this", ".", "oAppComponent", ")", ")", ".", "then", "(", "function", "(", ")", "{", "delete", "this", ".", "oData", "[", "sVariantManagementReference", "]", ";", "delete", "this", ".", "oVariantController", ".", "getChangeFileContent", "(", ")", "[", "sVariantManagementReference", "]", ";", "this", ".", "_ensureStandardVariantExists", "(", "sVariantManagementReference", ")", ";", "}", ".", "bind", "(", "this", ")", ")", ";", "}", ".", "bind", "(", "this", ")", ")", ";", "//re-initialize hash register and remove existing parameters", "VariantUtil", ".", "initializeHashRegister", ".", "call", "(", "this", ")", ";", "this", ".", "updateHasherEntry", "(", "{", "parameters", ":", "[", "]", "}", ")", ";", "return", "this", ".", "_oVariantSwitchPromise", ";", "}" ]
When VariantController map is reset at runtime, this listener is called. It reverts all applied changes and resets all variant management controls to default state. @returns {Promise} Promise which resolves when all applied changes have been reverted
[ "When", "VariantController", "map", "is", "reset", "at", "runtime", "this", "listener", "is", "called", ".", "It", "reverts", "all", "applied", "changes", "and", "resets", "all", "variant", "management", "controls", "to", "default", "state", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.fl/src/sap/ui/fl/variants/VariantModel.js#L38-L61
4,380
SAP/openui5
src/sap.ui.support/src/sap/ui/support/supportRules/report/ReportProvider.js
getReportHtml
function getReportHtml(oData) { return getResources().then(function () { var styles = [], scripts = [], html = '', i, template = {}, reportContext = {}; for (i = 0; i < arguments.length; i++) { switch (arguments[i].type) { case 'template': html = arguments[i].content; break; case 'css': styles.push(arguments[i].content); break; case 'js': scripts.push(arguments[i].content); break; } } template = Handlebars.compile(html); reportContext = { technicalInfo: oData.technical, issues: oData.issues, appInfo: oData.application, rules: oData.rules, rulePreset: oData.rulePreset, metadata: { title: oData.name + ' Analysis Results', title_TechnicalInfo: 'Technical Information', title_Issues: 'Issues', title_AppInfo: 'Application Information', title_SelectedRules: 'Available and (<span class="checked"></span>) Selected Rules', timestamp: new Date(), scope: oData.scope, analysisDuration: oData.analysisDuration, analysisDurationTitle: oData.analysisDurationTitle, styles: styles, scripts: scripts } }; return template(reportContext); }); }
javascript
function getReportHtml(oData) { return getResources().then(function () { var styles = [], scripts = [], html = '', i, template = {}, reportContext = {}; for (i = 0; i < arguments.length; i++) { switch (arguments[i].type) { case 'template': html = arguments[i].content; break; case 'css': styles.push(arguments[i].content); break; case 'js': scripts.push(arguments[i].content); break; } } template = Handlebars.compile(html); reportContext = { technicalInfo: oData.technical, issues: oData.issues, appInfo: oData.application, rules: oData.rules, rulePreset: oData.rulePreset, metadata: { title: oData.name + ' Analysis Results', title_TechnicalInfo: 'Technical Information', title_Issues: 'Issues', title_AppInfo: 'Application Information', title_SelectedRules: 'Available and (<span class="checked"></span>) Selected Rules', timestamp: new Date(), scope: oData.scope, analysisDuration: oData.analysisDuration, analysisDurationTitle: oData.analysisDurationTitle, styles: styles, scripts: scripts } }; return template(reportContext); }); }
[ "function", "getReportHtml", "(", "oData", ")", "{", "return", "getResources", "(", ")", ".", "then", "(", "function", "(", ")", "{", "var", "styles", "=", "[", "]", ",", "scripts", "=", "[", "]", ",", "html", "=", "''", ",", "i", ",", "template", "=", "{", "}", ",", "reportContext", "=", "{", "}", ";", "for", "(", "i", "=", "0", ";", "i", "<", "arguments", ".", "length", ";", "i", "++", ")", "{", "switch", "(", "arguments", "[", "i", "]", ".", "type", ")", "{", "case", "'template'", ":", "html", "=", "arguments", "[", "i", "]", ".", "content", ";", "break", ";", "case", "'css'", ":", "styles", ".", "push", "(", "arguments", "[", "i", "]", ".", "content", ")", ";", "break", ";", "case", "'js'", ":", "scripts", ".", "push", "(", "arguments", "[", "i", "]", ".", "content", ")", ";", "break", ";", "}", "}", "template", "=", "Handlebars", ".", "compile", "(", "html", ")", ";", "reportContext", "=", "{", "technicalInfo", ":", "oData", ".", "technical", ",", "issues", ":", "oData", ".", "issues", ",", "appInfo", ":", "oData", ".", "application", ",", "rules", ":", "oData", ".", "rules", ",", "rulePreset", ":", "oData", ".", "rulePreset", ",", "metadata", ":", "{", "title", ":", "oData", ".", "name", "+", "' Analysis Results'", ",", "title_TechnicalInfo", ":", "'Technical Information'", ",", "title_Issues", ":", "'Issues'", ",", "title_AppInfo", ":", "'Application Information'", ",", "title_SelectedRules", ":", "'Available and (<span class=\"checked\"></span>) Selected Rules'", ",", "timestamp", ":", "new", "Date", "(", ")", ",", "scope", ":", "oData", ".", "scope", ",", "analysisDuration", ":", "oData", ".", "analysisDuration", ",", "analysisDurationTitle", ":", "oData", ".", "analysisDurationTitle", ",", "styles", ":", "styles", ",", "scripts", ":", "scripts", "}", "}", ";", "return", "template", "(", "reportContext", ")", ";", "}", ")", ";", "}" ]
Public functions Creates an html string containing the whole report. @param {Object} oData - the data required to create a report @returns {String}
[ "Public", "functions", "Creates", "an", "html", "string", "containing", "the", "whole", "report", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.support/src/sap/ui/support/supportRules/report/ReportProvider.js#L352-L394
4,381
SAP/openui5
src/sap.ui.support/src/sap/ui/support/supportRules/report/ReportProvider.js
downloadReportZip
function downloadReportZip(oData) { this.getReportHtml(oData).done(function (html) { var report = '<!DOCTYPE HTML><html><head><title>Report</title></head><body><div id="sap-report-content">' + html + '</div></body></html>'; var issues = { 'issues': oData.issues }; var appInfos = { 'appInfos': oData.application }; var technicalInfo = { 'technicalInfo': oData.technical }; var archiver = new Archiver(); archiver.add('technicalInfo.json', technicalInfo, 'json'); archiver.add('issues.json', issues, 'json'); archiver.add('appInfos.json', appInfos, 'json'); archiver.add('report.html', report); archiver.add('abap.json', oData.abap, 'json'); archiver.download("SupportAssistantReport"); archiver.clear(); }); }
javascript
function downloadReportZip(oData) { this.getReportHtml(oData).done(function (html) { var report = '<!DOCTYPE HTML><html><head><title>Report</title></head><body><div id="sap-report-content">' + html + '</div></body></html>'; var issues = { 'issues': oData.issues }; var appInfos = { 'appInfos': oData.application }; var technicalInfo = { 'technicalInfo': oData.technical }; var archiver = new Archiver(); archiver.add('technicalInfo.json', technicalInfo, 'json'); archiver.add('issues.json', issues, 'json'); archiver.add('appInfos.json', appInfos, 'json'); archiver.add('report.html', report); archiver.add('abap.json', oData.abap, 'json'); archiver.download("SupportAssistantReport"); archiver.clear(); }); }
[ "function", "downloadReportZip", "(", "oData", ")", "{", "this", ".", "getReportHtml", "(", "oData", ")", ".", "done", "(", "function", "(", "html", ")", "{", "var", "report", "=", "'<!DOCTYPE HTML><html><head><title>Report</title></head><body><div id=\"sap-report-content\">'", "+", "html", "+", "'</div></body></html>'", ";", "var", "issues", "=", "{", "'issues'", ":", "oData", ".", "issues", "}", ";", "var", "appInfos", "=", "{", "'appInfos'", ":", "oData", ".", "application", "}", ";", "var", "technicalInfo", "=", "{", "'technicalInfo'", ":", "oData", ".", "technical", "}", ";", "var", "archiver", "=", "new", "Archiver", "(", ")", ";", "archiver", ".", "add", "(", "'technicalInfo.json'", ",", "technicalInfo", ",", "'json'", ")", ";", "archiver", ".", "add", "(", "'issues.json'", ",", "issues", ",", "'json'", ")", ";", "archiver", ".", "add", "(", "'appInfos.json'", ",", "appInfos", ",", "'json'", ")", ";", "archiver", ".", "add", "(", "'report.html'", ",", "report", ")", ";", "archiver", ".", "add", "(", "'abap.json'", ",", "oData", ".", "abap", ",", "'json'", ")", ";", "archiver", ".", "download", "(", "\"SupportAssistantReport\"", ")", ";", "archiver", ".", "clear", "(", ")", ";", "}", ")", ";", "}" ]
Creates a zip file containing the report.html, appInfo.json, technicalInfo.json, issues.json. @param {Object} oData - the data required to create a report
[ "Creates", "a", "zip", "file", "containing", "the", "report", ".", "html", "appInfo", ".", "json", "technicalInfo", ".", "json", "issues", ".", "json", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.support/src/sap/ui/support/supportRules/report/ReportProvider.js#L400-L415
4,382
SAP/openui5
src/sap.ui.support/src/sap/ui/support/supportRules/report/ReportProvider.js
openReport
function openReport(oData) { // Create a hidden anchor. Open window outside of the promise otherwise browsers blocks the window.open. var content = ''; var a = jQuery('<a style="display: none;"/>'); a.on('click', function () { var reportWindow = window.open('', '_blank'); jQuery(reportWindow.document).ready(function () { // Sometimes document.write overwrites the document html and sometimes it appends to it so we need a wrapper div. if (reportWindow.document.getElementById('sap-report-content')) { reportWindow.document.getElementById('sap-report-content').innerHtml = content; } else { reportWindow.document.write('<div id="sap-report-content">' + content + '</div>'); } reportWindow.document.title = 'Report'; }); }); jQuery('body').append(a); this.getReportHtml(oData).then(function (html) { content = html; a[0].click(); a.remove(); }); }
javascript
function openReport(oData) { // Create a hidden anchor. Open window outside of the promise otherwise browsers blocks the window.open. var content = ''; var a = jQuery('<a style="display: none;"/>'); a.on('click', function () { var reportWindow = window.open('', '_blank'); jQuery(reportWindow.document).ready(function () { // Sometimes document.write overwrites the document html and sometimes it appends to it so we need a wrapper div. if (reportWindow.document.getElementById('sap-report-content')) { reportWindow.document.getElementById('sap-report-content').innerHtml = content; } else { reportWindow.document.write('<div id="sap-report-content">' + content + '</div>'); } reportWindow.document.title = 'Report'; }); }); jQuery('body').append(a); this.getReportHtml(oData).then(function (html) { content = html; a[0].click(); a.remove(); }); }
[ "function", "openReport", "(", "oData", ")", "{", "// Create a hidden anchor. Open window outside of the promise otherwise browsers blocks the window.open.", "var", "content", "=", "''", ";", "var", "a", "=", "jQuery", "(", "'<a style=\"display: none;\"/>'", ")", ";", "a", ".", "on", "(", "'click'", ",", "function", "(", ")", "{", "var", "reportWindow", "=", "window", ".", "open", "(", "''", ",", "'_blank'", ")", ";", "jQuery", "(", "reportWindow", ".", "document", ")", ".", "ready", "(", "function", "(", ")", "{", "// Sometimes document.write overwrites the document html and sometimes it appends to it so we need a wrapper div.", "if", "(", "reportWindow", ".", "document", ".", "getElementById", "(", "'sap-report-content'", ")", ")", "{", "reportWindow", ".", "document", ".", "getElementById", "(", "'sap-report-content'", ")", ".", "innerHtml", "=", "content", ";", "}", "else", "{", "reportWindow", ".", "document", ".", "write", "(", "'<div id=\"sap-report-content\">'", "+", "content", "+", "'</div>'", ")", ";", "}", "reportWindow", ".", "document", ".", "title", "=", "'Report'", ";", "}", ")", ";", "}", ")", ";", "jQuery", "(", "'body'", ")", ".", "append", "(", "a", ")", ";", "this", ".", "getReportHtml", "(", "oData", ")", ".", "then", "(", "function", "(", "html", ")", "{", "content", "=", "html", ";", "a", "[", "0", "]", ".", "click", "(", ")", ";", "a", ".", "remove", "(", ")", ";", "}", ")", ";", "}" ]
Opens a report in a new window. @param {Object} oData - the data required to create a report
[ "Opens", "a", "report", "in", "a", "new", "window", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.support/src/sap/ui/support/supportRules/report/ReportProvider.js#L421-L444
4,383
SAP/openui5
src/sap.ui.core/src/sap/ui/events/jquery/EventSimulation.js
function(oHandle) { var that = this, $this = jQuery(this), oAdditionalConfig = { domRef: that, eventName: sSimEventName, sapEventName: sSapSimEventName, eventHandle: oHandle }; var fnHandlerWrapper = function(oEvent) { fnHandler(oEvent, oAdditionalConfig); }; oHandle.__sapSimulatedEventHandler = fnHandlerWrapper; for (var i = 0; i < aOrigEvents.length; i++) { $this.on(aOrigEvents[i], fnHandlerWrapper); } }
javascript
function(oHandle) { var that = this, $this = jQuery(this), oAdditionalConfig = { domRef: that, eventName: sSimEventName, sapEventName: sSapSimEventName, eventHandle: oHandle }; var fnHandlerWrapper = function(oEvent) { fnHandler(oEvent, oAdditionalConfig); }; oHandle.__sapSimulatedEventHandler = fnHandlerWrapper; for (var i = 0; i < aOrigEvents.length; i++) { $this.on(aOrigEvents[i], fnHandlerWrapper); } }
[ "function", "(", "oHandle", ")", "{", "var", "that", "=", "this", ",", "$this", "=", "jQuery", "(", "this", ")", ",", "oAdditionalConfig", "=", "{", "domRef", ":", "that", ",", "eventName", ":", "sSimEventName", ",", "sapEventName", ":", "sSapSimEventName", ",", "eventHandle", ":", "oHandle", "}", ";", "var", "fnHandlerWrapper", "=", "function", "(", "oEvent", ")", "{", "fnHandler", "(", "oEvent", ",", "oAdditionalConfig", ")", ";", "}", ";", "oHandle", ".", "__sapSimulatedEventHandler", "=", "fnHandlerWrapper", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "aOrigEvents", ".", "length", ";", "i", "++", ")", "{", "$this", ".", "on", "(", "aOrigEvents", "[", "i", "]", ",", "fnHandlerWrapper", ")", ";", "}", "}" ]
When binding to the simulated event with prefix is done through jQuery, this function is called and redirect the registration to the original events. Doing in this way we can simulate the event from listening to the original events.
[ "When", "binding", "to", "the", "simulated", "event", "with", "prefix", "is", "done", "through", "jQuery", "this", "function", "is", "called", "and", "redirect", "the", "registration", "to", "the", "original", "events", ".", "Doing", "in", "this", "way", "we", "can", "simulate", "the", "event", "from", "listening", "to", "the", "original", "events", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/events/jquery/EventSimulation.js#L60-L78
4,384
SAP/openui5
src/sap.ui.core/src/sap/ui/events/jquery/EventSimulation.js
function(oHandle) { var $this = jQuery(this); var fnHandler = oHandle.__sapSimulatedEventHandler; $this.removeData(sHandlerKey + oHandle.guid); for (var i = 0; i < aOrigEvents.length; i++) { jQuery.event.remove(this, aOrigEvents[i], fnHandler); } }
javascript
function(oHandle) { var $this = jQuery(this); var fnHandler = oHandle.__sapSimulatedEventHandler; $this.removeData(sHandlerKey + oHandle.guid); for (var i = 0; i < aOrigEvents.length; i++) { jQuery.event.remove(this, aOrigEvents[i], fnHandler); } }
[ "function", "(", "oHandle", ")", "{", "var", "$this", "=", "jQuery", "(", "this", ")", ";", "var", "fnHandler", "=", "oHandle", ".", "__sapSimulatedEventHandler", ";", "$this", ".", "removeData", "(", "sHandlerKey", "+", "oHandle", ".", "guid", ")", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "aOrigEvents", ".", "length", ";", "i", "++", ")", "{", "jQuery", ".", "event", ".", "remove", "(", "this", ",", "aOrigEvents", "[", "i", "]", ",", "fnHandler", ")", ";", "}", "}" ]
When unbinding to the simulated event with prefix is done through jQuery, this function is called and redirect the deregistration to the original events.
[ "When", "unbinding", "to", "the", "simulated", "event", "with", "prefix", "is", "done", "through", "jQuery", "this", "function", "is", "called", "and", "redirect", "the", "deregistration", "to", "the", "original", "events", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/events/jquery/EventSimulation.js#L82-L89
4,385
SAP/openui5
src/sap.ui.fl/src/sap/ui/fl/registry/ChangeHandlerRegistration.js
function () { var oCore = sap.ui.getCore(); var oAlreadyLoadedLibraries = oCore.getLoadedLibraries(); var aPromises = []; jQuery.each(oAlreadyLoadedLibraries, function (sLibraryName, oLibrary) { if (oLibrary.extensions && oLibrary.extensions.flChangeHandlers) { aPromises.push(this._registerFlexChangeHandlers(oLibrary.extensions.flChangeHandlers)); } }.bind(this)); oCore.attachLibraryChanged(this._handleLibraryRegistrationAfterFlexLibraryIsLoaded.bind(this)); return Promise.all(aPromises); }
javascript
function () { var oCore = sap.ui.getCore(); var oAlreadyLoadedLibraries = oCore.getLoadedLibraries(); var aPromises = []; jQuery.each(oAlreadyLoadedLibraries, function (sLibraryName, oLibrary) { if (oLibrary.extensions && oLibrary.extensions.flChangeHandlers) { aPromises.push(this._registerFlexChangeHandlers(oLibrary.extensions.flChangeHandlers)); } }.bind(this)); oCore.attachLibraryChanged(this._handleLibraryRegistrationAfterFlexLibraryIsLoaded.bind(this)); return Promise.all(aPromises); }
[ "function", "(", ")", "{", "var", "oCore", "=", "sap", ".", "ui", ".", "getCore", "(", ")", ";", "var", "oAlreadyLoadedLibraries", "=", "oCore", ".", "getLoadedLibraries", "(", ")", ";", "var", "aPromises", "=", "[", "]", ";", "jQuery", ".", "each", "(", "oAlreadyLoadedLibraries", ",", "function", "(", "sLibraryName", ",", "oLibrary", ")", "{", "if", "(", "oLibrary", ".", "extensions", "&&", "oLibrary", ".", "extensions", ".", "flChangeHandlers", ")", "{", "aPromises", ".", "push", "(", "this", ".", "_registerFlexChangeHandlers", "(", "oLibrary", ".", "extensions", ".", "flChangeHandlers", ")", ")", ";", "}", "}", ".", "bind", "(", "this", ")", ")", ";", "oCore", ".", "attachLibraryChanged", "(", "this", ".", "_handleLibraryRegistrationAfterFlexLibraryIsLoaded", ".", "bind", "(", "this", ")", ")", ";", "return", "Promise", ".", "all", "(", "aPromises", ")", ";", "}" ]
Detects already loaded libraries and registers defined changeHandlers. @returns {Promise} Returns an empty promise when all changeHandlers from all liblraries are registered.
[ "Detects", "already", "loaded", "libraries", "and", "registers", "defined", "changeHandlers", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.fl/src/sap/ui/fl/registry/ChangeHandlerRegistration.js#L32-L46
4,386
SAP/openui5
src/sap.ui.core/src/sap/base/security/URLWhitelist.js
URLWhitelistEntry
function URLWhitelistEntry(protocol, host, port, path){ if (protocol) { this.protocol = protocol.toUpperCase(); } if (host) { this.host = host.toUpperCase(); } this.port = port; this.path = path; }
javascript
function URLWhitelistEntry(protocol, host, port, path){ if (protocol) { this.protocol = protocol.toUpperCase(); } if (host) { this.host = host.toUpperCase(); } this.port = port; this.path = path; }
[ "function", "URLWhitelistEntry", "(", "protocol", ",", "host", ",", "port", ",", "path", ")", "{", "if", "(", "protocol", ")", "{", "this", ".", "protocol", "=", "protocol", ".", "toUpperCase", "(", ")", ";", "}", "if", "(", "host", ")", "{", "this", ".", "host", "=", "host", ".", "toUpperCase", "(", ")", ";", "}", "this", ".", "port", "=", "port", ";", "this", ".", "path", "=", "path", ";", "}" ]
Entry object of the URLWhitelist @public @typedef {object} module:sap/base/security/URLWhitelist.Entry @property {string} protocol The protocol of the URL @property {string} host The host of the URL @property {string} port The port of the URL @property {string} path the path of the URL
[ "Entry", "object", "of", "the", "URLWhitelist" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/base/security/URLWhitelist.js#L28-L37
4,387
SAP/openui5
src/sap.ui.dt/src/sap/ui/dt/ContextMenuControl.js
function (aButtons) { var iButtonsEnabled = this._getNumberOfEnabledButtons(aButtons); if (iButtonsEnabled !== 0) { this._hideDisabledButtons(aButtons); } this._iButtonsVisible = this._hideButtonsInOverflow(aButtons); if (this._iButtonsVisible === this.getMaxButtonsDisplayed() && this._iButtonsVisible !== aButtons.length) { this._replaceLastVisibleButtonWithOverflowButton(aButtons); } else if (iButtonsEnabled < aButtons.length - 1 && iButtonsEnabled !== 0) { this.addOverflowButton(); } iButtonsEnabled = null; }
javascript
function (aButtons) { var iButtonsEnabled = this._getNumberOfEnabledButtons(aButtons); if (iButtonsEnabled !== 0) { this._hideDisabledButtons(aButtons); } this._iButtonsVisible = this._hideButtonsInOverflow(aButtons); if (this._iButtonsVisible === this.getMaxButtonsDisplayed() && this._iButtonsVisible !== aButtons.length) { this._replaceLastVisibleButtonWithOverflowButton(aButtons); } else if (iButtonsEnabled < aButtons.length - 1 && iButtonsEnabled !== 0) { this.addOverflowButton(); } iButtonsEnabled = null; }
[ "function", "(", "aButtons", ")", "{", "var", "iButtonsEnabled", "=", "this", ".", "_getNumberOfEnabledButtons", "(", "aButtons", ")", ";", "if", "(", "iButtonsEnabled", "!==", "0", ")", "{", "this", ".", "_hideDisabledButtons", "(", "aButtons", ")", ";", "}", "this", ".", "_iButtonsVisible", "=", "this", ".", "_hideButtonsInOverflow", "(", "aButtons", ")", ";", "if", "(", "this", ".", "_iButtonsVisible", "===", "this", ".", "getMaxButtonsDisplayed", "(", ")", "&&", "this", ".", "_iButtonsVisible", "!==", "aButtons", ".", "length", ")", "{", "this", ".", "_replaceLastVisibleButtonWithOverflowButton", "(", "aButtons", ")", ";", "}", "else", "if", "(", "iButtonsEnabled", "<", "aButtons", ".", "length", "-", "1", "&&", "iButtonsEnabled", "!==", "0", ")", "{", "this", ".", "addOverflowButton", "(", ")", ";", "}", "iButtonsEnabled", "=", "null", ";", "}" ]
Sets all parameters of the buttons in the non-expanded ContextMenu @param {array} aButtons some buttons
[ "Sets", "all", "parameters", "of", "the", "buttons", "in", "the", "non", "-", "expanded", "ContextMenu" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.dt/src/sap/ui/dt/ContextMenuControl.js#L215-L229
4,388
SAP/openui5
src/sap.ui.dt/src/sap/ui/dt/ContextMenuControl.js
function (aButtons) { this._iFirstVisibleButtonIndex = 0; aButtons.forEach(function (oButton) { oButton.setVisible(true); oButton._bInOverflow = true; }); }
javascript
function (aButtons) { this._iFirstVisibleButtonIndex = 0; aButtons.forEach(function (oButton) { oButton.setVisible(true); oButton._bInOverflow = true; }); }
[ "function", "(", "aButtons", ")", "{", "this", ".", "_iFirstVisibleButtonIndex", "=", "0", ";", "aButtons", ".", "forEach", "(", "function", "(", "oButton", ")", "{", "oButton", ".", "setVisible", "(", "true", ")", ";", "oButton", ".", "_bInOverflow", "=", "true", ";", "}", ")", ";", "}" ]
Makes all buttons and their text visible @param {array} aButtons some buttons
[ "Makes", "all", "buttons", "and", "their", "text", "visible" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.dt/src/sap/ui/dt/ContextMenuControl.js#L235-L241
4,389
SAP/openui5
src/sap.ui.dt/src/sap/ui/dt/ContextMenuControl.js
function (aButtons) { var iButtonsEnabled = 0; for (var i = 0; i < aButtons.length; i++) { if (aButtons[i].getEnabled()) { iButtonsEnabled++; if (!this._iFirstVisibleButtonIndex) { this._iFirstVisibleButtonIndex = i; } } } return iButtonsEnabled; }
javascript
function (aButtons) { var iButtonsEnabled = 0; for (var i = 0; i < aButtons.length; i++) { if (aButtons[i].getEnabled()) { iButtonsEnabled++; if (!this._iFirstVisibleButtonIndex) { this._iFirstVisibleButtonIndex = i; } } } return iButtonsEnabled; }
[ "function", "(", "aButtons", ")", "{", "var", "iButtonsEnabled", "=", "0", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "aButtons", ".", "length", ";", "i", "++", ")", "{", "if", "(", "aButtons", "[", "i", "]", ".", "getEnabled", "(", ")", ")", "{", "iButtonsEnabled", "++", ";", "if", "(", "!", "this", ".", "_iFirstVisibleButtonIndex", ")", "{", "this", ".", "_iFirstVisibleButtonIndex", "=", "i", ";", "}", "}", "}", "return", "iButtonsEnabled", ";", "}" ]
Returns the number of enabled button Sets firstVisibleButtonIndex @param {array} aButtons some buttons @return {int} number of enabled buttons
[ "Returns", "the", "number", "of", "enabled", "button", "Sets", "firstVisibleButtonIndex" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.dt/src/sap/ui/dt/ContextMenuControl.js#L249-L261
4,390
SAP/openui5
src/sap.ui.dt/src/sap/ui/dt/ContextMenuControl.js
function (aButtons) { var iVisibleButtons = 0; aButtons.forEach(function (oButton) { oButton.setVisible(oButton.getEnabled()); if (oButton.getEnabled()) { iVisibleButtons++; } }); return iVisibleButtons; }
javascript
function (aButtons) { var iVisibleButtons = 0; aButtons.forEach(function (oButton) { oButton.setVisible(oButton.getEnabled()); if (oButton.getEnabled()) { iVisibleButtons++; } }); return iVisibleButtons; }
[ "function", "(", "aButtons", ")", "{", "var", "iVisibleButtons", "=", "0", ";", "aButtons", ".", "forEach", "(", "function", "(", "oButton", ")", "{", "oButton", ".", "setVisible", "(", "oButton", ".", "getEnabled", "(", ")", ")", ";", "if", "(", "oButton", ".", "getEnabled", "(", ")", ")", "{", "iVisibleButtons", "++", ";", "}", "}", ")", ";", "return", "iVisibleButtons", ";", "}" ]
Hiddes all disabled buttons and returns the number if visible buttons @param {array} aButtons some Buttons @return {int} the number of visible buttons
[ "Hiddes", "all", "disabled", "buttons", "and", "returns", "the", "number", "if", "visible", "buttons" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.dt/src/sap/ui/dt/ContextMenuControl.js#L268-L278
4,391
SAP/openui5
src/sap.ui.dt/src/sap/ui/dt/ContextMenuControl.js
function (aButtons) { var iVisibleButtons = 0; for (var i = 0; i < aButtons.length; i++) { if (iVisibleButtons < this.getMaxButtonsDisplayed() && aButtons[i].getVisible()) { iVisibleButtons++; } else { aButtons[i].setVisible(false); } } return iVisibleButtons; }
javascript
function (aButtons) { var iVisibleButtons = 0; for (var i = 0; i < aButtons.length; i++) { if (iVisibleButtons < this.getMaxButtonsDisplayed() && aButtons[i].getVisible()) { iVisibleButtons++; } else { aButtons[i].setVisible(false); } } return iVisibleButtons; }
[ "function", "(", "aButtons", ")", "{", "var", "iVisibleButtons", "=", "0", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "aButtons", ".", "length", ";", "i", "++", ")", "{", "if", "(", "iVisibleButtons", "<", "this", ".", "getMaxButtonsDisplayed", "(", ")", "&&", "aButtons", "[", "i", "]", ".", "getVisible", "(", ")", ")", "{", "iVisibleButtons", "++", ";", "}", "else", "{", "aButtons", "[", "i", "]", ".", "setVisible", "(", "false", ")", ";", "}", "}", "return", "iVisibleButtons", ";", "}" ]
Hides the buttons in overflow @param {array} aButtons some Buttons @return {int} the number of visible buttons
[ "Hides", "the", "buttons", "in", "overflow" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.dt/src/sap/ui/dt/ContextMenuControl.js#L285-L296
4,392
SAP/openui5
src/sap.ui.dt/src/sap/ui/dt/ContextMenuControl.js
function (aButtons) { for (var i = aButtons.length - 1; i >= 0; i--) { if (aButtons[i].getVisible()) { aButtons[i].setVisible(false); this.addOverflowButton(); return; } } }
javascript
function (aButtons) { for (var i = aButtons.length - 1; i >= 0; i--) { if (aButtons[i].getVisible()) { aButtons[i].setVisible(false); this.addOverflowButton(); return; } } }
[ "function", "(", "aButtons", ")", "{", "for", "(", "var", "i", "=", "aButtons", ".", "length", "-", "1", ";", "i", ">=", "0", ";", "i", "--", ")", "{", "if", "(", "aButtons", "[", "i", "]", ".", "getVisible", "(", ")", ")", "{", "aButtons", "[", "i", "]", ".", "setVisible", "(", "false", ")", ";", "this", ".", "addOverflowButton", "(", ")", ";", "return", ";", "}", "}", "}" ]
Hides the last visible button and adds an OverflowButton @param {array} aButtons some buttons
[ "Hides", "the", "last", "visible", "button", "and", "adds", "an", "OverflowButton" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.dt/src/sap/ui/dt/ContextMenuControl.js#L302-L310
4,393
SAP/openui5
src/sap.ui.dt/src/sap/ui/dt/ContextMenuControl.js
function (oSource, bContextMenu) { this.getPopover().setShowArrow(true); var sOverlayId = (oSource.getId && oSource.getId()) || oSource.getAttribute("overlay"); var sFakeDivId = "contextMenuFakeDiv"; // get Dimensions of Overlay and Viewport var oOverlayDimensions = this._getOverlayDimensions(sOverlayId); var oViewportDimensions = this._getViewportDimensions(); this._oContextMenuPosition.x = this._oContextMenuPosition.x || parseInt(oOverlayDimensions.left + 20); this._oContextMenuPosition.y = this._oContextMenuPosition.y || parseInt(oOverlayDimensions.top + 20); // if the Overlay is near the top position of the Viewport, the Popover makes wrong calculation for positioning it. // The MiniMenu has been placed above the Overlay even if there has not been enough place. // Therefore we have to calculate the top position and also consider the high of the Toolbar (46 Pixels). var iFakeDivTop = oOverlayDimensions.top - 50 > oViewportDimensions.top ? 0 : oViewportDimensions.top - (oOverlayDimensions.top - 50); // place a Target DIV (for the moment at wrong position) jQuery("#" + sFakeDivId).remove(); jQuery("#" + sOverlayId).append("<div id=\"" + sFakeDivId + "\" overlay=\"" + sOverlayId + "\" style = \"position: absolute; top: " + iFakeDivTop + "px; left: 0px;\" />"); var oFakeDiv = document.getElementById(sFakeDivId); // place the Popover invisible this.getPopover().setContentWidth(undefined); this.getPopover().setContentHeight(undefined); this.getPopover().openBy(oFakeDiv); // get Dimensions of Popover var oPopoverDimensions = this._getPopoverDimensions(!bContextMenu); // check if vertical scrolling should be done if (oPopoverDimensions.height >= oViewportDimensions.height * 2 / 3) { this.getPopover().setVerticalScrolling(true); oPopoverDimensions.height = (oViewportDimensions.height * 2 / 3).toFixed(0); this.getPopover().setContentHeight(oPopoverDimensions.height + "px"); } else { this.getPopover().setVerticalScrolling(false); this.getPopover().setContentHeight(undefined); } // check if horizontal size is too big if (oPopoverDimensions.width > 400) { oPopoverDimensions.width = 400; this.getPopover().setContentWidth("400px"); } else { this.getPopover().setContentWidth(undefined); } // calculate exact position var oPosition = {}; if (bContextMenu) { oPosition = this._placeAsExpandedContextMenu(this._oContextMenuPosition, oPopoverDimensions, oViewportDimensions); } else { oPosition = this._placeAsCompactContextMenu(this._oContextMenuPosition, oPopoverDimensions, oViewportDimensions); } oPosition.top -= oOverlayDimensions.top; oPosition.left -= oOverlayDimensions.left; oPosition.top = (oPosition.top < 0) ? 0 : oPosition.top; oPosition.left = (oPosition.left < 0) ? 0 : oPosition.left; // set the correct position to the target DIV oFakeDiv.style.top = oPosition.top.toFixed(0) + "px"; oFakeDiv.style.left = oPosition.left.toFixed(0) + "px"; sOverlayId = null; return oFakeDiv; }
javascript
function (oSource, bContextMenu) { this.getPopover().setShowArrow(true); var sOverlayId = (oSource.getId && oSource.getId()) || oSource.getAttribute("overlay"); var sFakeDivId = "contextMenuFakeDiv"; // get Dimensions of Overlay and Viewport var oOverlayDimensions = this._getOverlayDimensions(sOverlayId); var oViewportDimensions = this._getViewportDimensions(); this._oContextMenuPosition.x = this._oContextMenuPosition.x || parseInt(oOverlayDimensions.left + 20); this._oContextMenuPosition.y = this._oContextMenuPosition.y || parseInt(oOverlayDimensions.top + 20); // if the Overlay is near the top position of the Viewport, the Popover makes wrong calculation for positioning it. // The MiniMenu has been placed above the Overlay even if there has not been enough place. // Therefore we have to calculate the top position and also consider the high of the Toolbar (46 Pixels). var iFakeDivTop = oOverlayDimensions.top - 50 > oViewportDimensions.top ? 0 : oViewportDimensions.top - (oOverlayDimensions.top - 50); // place a Target DIV (for the moment at wrong position) jQuery("#" + sFakeDivId).remove(); jQuery("#" + sOverlayId).append("<div id=\"" + sFakeDivId + "\" overlay=\"" + sOverlayId + "\" style = \"position: absolute; top: " + iFakeDivTop + "px; left: 0px;\" />"); var oFakeDiv = document.getElementById(sFakeDivId); // place the Popover invisible this.getPopover().setContentWidth(undefined); this.getPopover().setContentHeight(undefined); this.getPopover().openBy(oFakeDiv); // get Dimensions of Popover var oPopoverDimensions = this._getPopoverDimensions(!bContextMenu); // check if vertical scrolling should be done if (oPopoverDimensions.height >= oViewportDimensions.height * 2 / 3) { this.getPopover().setVerticalScrolling(true); oPopoverDimensions.height = (oViewportDimensions.height * 2 / 3).toFixed(0); this.getPopover().setContentHeight(oPopoverDimensions.height + "px"); } else { this.getPopover().setVerticalScrolling(false); this.getPopover().setContentHeight(undefined); } // check if horizontal size is too big if (oPopoverDimensions.width > 400) { oPopoverDimensions.width = 400; this.getPopover().setContentWidth("400px"); } else { this.getPopover().setContentWidth(undefined); } // calculate exact position var oPosition = {}; if (bContextMenu) { oPosition = this._placeAsExpandedContextMenu(this._oContextMenuPosition, oPopoverDimensions, oViewportDimensions); } else { oPosition = this._placeAsCompactContextMenu(this._oContextMenuPosition, oPopoverDimensions, oViewportDimensions); } oPosition.top -= oOverlayDimensions.top; oPosition.left -= oOverlayDimensions.left; oPosition.top = (oPosition.top < 0) ? 0 : oPosition.top; oPosition.left = (oPosition.left < 0) ? 0 : oPosition.left; // set the correct position to the target DIV oFakeDiv.style.top = oPosition.top.toFixed(0) + "px"; oFakeDiv.style.left = oPosition.left.toFixed(0) + "px"; sOverlayId = null; return oFakeDiv; }
[ "function", "(", "oSource", ",", "bContextMenu", ")", "{", "this", ".", "getPopover", "(", ")", ".", "setShowArrow", "(", "true", ")", ";", "var", "sOverlayId", "=", "(", "oSource", ".", "getId", "&&", "oSource", ".", "getId", "(", ")", ")", "||", "oSource", ".", "getAttribute", "(", "\"overlay\"", ")", ";", "var", "sFakeDivId", "=", "\"contextMenuFakeDiv\"", ";", "// get Dimensions of Overlay and Viewport", "var", "oOverlayDimensions", "=", "this", ".", "_getOverlayDimensions", "(", "sOverlayId", ")", ";", "var", "oViewportDimensions", "=", "this", ".", "_getViewportDimensions", "(", ")", ";", "this", ".", "_oContextMenuPosition", ".", "x", "=", "this", ".", "_oContextMenuPosition", ".", "x", "||", "parseInt", "(", "oOverlayDimensions", ".", "left", "+", "20", ")", ";", "this", ".", "_oContextMenuPosition", ".", "y", "=", "this", ".", "_oContextMenuPosition", ".", "y", "||", "parseInt", "(", "oOverlayDimensions", ".", "top", "+", "20", ")", ";", "// if the Overlay is near the top position of the Viewport, the Popover makes wrong calculation for positioning it.", "// The MiniMenu has been placed above the Overlay even if there has not been enough place.", "// Therefore we have to calculate the top position and also consider the high of the Toolbar (46 Pixels).", "var", "iFakeDivTop", "=", "oOverlayDimensions", ".", "top", "-", "50", ">", "oViewportDimensions", ".", "top", "?", "0", ":", "oViewportDimensions", ".", "top", "-", "(", "oOverlayDimensions", ".", "top", "-", "50", ")", ";", "// place a Target DIV (for the moment at wrong position)", "jQuery", "(", "\"#\"", "+", "sFakeDivId", ")", ".", "remove", "(", ")", ";", "jQuery", "(", "\"#\"", "+", "sOverlayId", ")", ".", "append", "(", "\"<div id=\\\"\"", "+", "sFakeDivId", "+", "\"\\\" overlay=\\\"\"", "+", "sOverlayId", "+", "\"\\\" style = \\\"position: absolute; top: \"", "+", "iFakeDivTop", "+", "\"px; left: 0px;\\\" />\"", ")", ";", "var", "oFakeDiv", "=", "document", ".", "getElementById", "(", "sFakeDivId", ")", ";", "// place the Popover invisible", "this", ".", "getPopover", "(", ")", ".", "setContentWidth", "(", "undefined", ")", ";", "this", ".", "getPopover", "(", ")", ".", "setContentHeight", "(", "undefined", ")", ";", "this", ".", "getPopover", "(", ")", ".", "openBy", "(", "oFakeDiv", ")", ";", "// get Dimensions of Popover", "var", "oPopoverDimensions", "=", "this", ".", "_getPopoverDimensions", "(", "!", "bContextMenu", ")", ";", "// check if vertical scrolling should be done", "if", "(", "oPopoverDimensions", ".", "height", ">=", "oViewportDimensions", ".", "height", "*", "2", "/", "3", ")", "{", "this", ".", "getPopover", "(", ")", ".", "setVerticalScrolling", "(", "true", ")", ";", "oPopoverDimensions", ".", "height", "=", "(", "oViewportDimensions", ".", "height", "*", "2", "/", "3", ")", ".", "toFixed", "(", "0", ")", ";", "this", ".", "getPopover", "(", ")", ".", "setContentHeight", "(", "oPopoverDimensions", ".", "height", "+", "\"px\"", ")", ";", "}", "else", "{", "this", ".", "getPopover", "(", ")", ".", "setVerticalScrolling", "(", "false", ")", ";", "this", ".", "getPopover", "(", ")", ".", "setContentHeight", "(", "undefined", ")", ";", "}", "// check if horizontal size is too big", "if", "(", "oPopoverDimensions", ".", "width", ">", "400", ")", "{", "oPopoverDimensions", ".", "width", "=", "400", ";", "this", ".", "getPopover", "(", ")", ".", "setContentWidth", "(", "\"400px\"", ")", ";", "}", "else", "{", "this", ".", "getPopover", "(", ")", ".", "setContentWidth", "(", "undefined", ")", ";", "}", "// calculate exact position", "var", "oPosition", "=", "{", "}", ";", "if", "(", "bContextMenu", ")", "{", "oPosition", "=", "this", ".", "_placeAsExpandedContextMenu", "(", "this", ".", "_oContextMenuPosition", ",", "oPopoverDimensions", ",", "oViewportDimensions", ")", ";", "}", "else", "{", "oPosition", "=", "this", ".", "_placeAsCompactContextMenu", "(", "this", ".", "_oContextMenuPosition", ",", "oPopoverDimensions", ",", "oViewportDimensions", ")", ";", "}", "oPosition", ".", "top", "-=", "oOverlayDimensions", ".", "top", ";", "oPosition", ".", "left", "-=", "oOverlayDimensions", ".", "left", ";", "oPosition", ".", "top", "=", "(", "oPosition", ".", "top", "<", "0", ")", "?", "0", ":", "oPosition", ".", "top", ";", "oPosition", ".", "left", "=", "(", "oPosition", ".", "left", "<", "0", ")", "?", "0", ":", "oPosition", ".", "left", ";", "// set the correct position to the target DIV", "oFakeDiv", ".", "style", ".", "top", "=", "oPosition", ".", "top", ".", "toFixed", "(", "0", ")", "+", "\"px\"", ";", "oFakeDiv", ".", "style", ".", "left", "=", "oPosition", ".", "left", ".", "toFixed", "(", "0", ")", "+", "\"px\"", ";", "sOverlayId", "=", "null", ";", "return", "oFakeDiv", ";", "}" ]
Works out how the ContextMenu shall be placed Sets the placement property of the popover Places a "fakeDiv" in the DOM which the popover can be opened by @param {sap.m.Control} oSource the overlay @param {boolean} bContextMenu whether the ContextMenu should be opened as a context menu @return {div} the "fakeDiv" @private
[ "Works", "out", "how", "the", "ContextMenu", "shall", "be", "placed", "Sets", "the", "placement", "property", "of", "the", "popover", "Places", "a", "fakeDiv", "in", "the", "DOM", "which", "the", "popover", "can", "be", "opened", "by" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.dt/src/sap/ui/dt/ContextMenuControl.js#L321-L391
4,394
SAP/openui5
src/sap.ui.dt/src/sap/ui/dt/ContextMenuControl.js
function (bWithArrow) { var oPopover = {}; var bCompact = this._bCompactMode; var fArrowHeight = this._getArrowHeight(bCompact); var iBaseFontsize = this._getBaseFontSize(); this._iFirstVisibleButtonIndex = null; oPopover.height = parseInt(jQuery("#" + this.getPopover().getId()).css("height")) || 40; oPopover.width = parseInt(jQuery("#" + this.getPopover().getId()).css("width")) || 80; if (bWithArrow) { var iArr = iBaseFontsize * fArrowHeight; if (iArr) { oPopover.height += iArr; oPopover.width += iArr; } } return oPopover; }
javascript
function (bWithArrow) { var oPopover = {}; var bCompact = this._bCompactMode; var fArrowHeight = this._getArrowHeight(bCompact); var iBaseFontsize = this._getBaseFontSize(); this._iFirstVisibleButtonIndex = null; oPopover.height = parseInt(jQuery("#" + this.getPopover().getId()).css("height")) || 40; oPopover.width = parseInt(jQuery("#" + this.getPopover().getId()).css("width")) || 80; if (bWithArrow) { var iArr = iBaseFontsize * fArrowHeight; if (iArr) { oPopover.height += iArr; oPopover.width += iArr; } } return oPopover; }
[ "function", "(", "bWithArrow", ")", "{", "var", "oPopover", "=", "{", "}", ";", "var", "bCompact", "=", "this", ".", "_bCompactMode", ";", "var", "fArrowHeight", "=", "this", ".", "_getArrowHeight", "(", "bCompact", ")", ";", "var", "iBaseFontsize", "=", "this", ".", "_getBaseFontSize", "(", ")", ";", "this", ".", "_iFirstVisibleButtonIndex", "=", "null", ";", "oPopover", ".", "height", "=", "parseInt", "(", "jQuery", "(", "\"#\"", "+", "this", ".", "getPopover", "(", ")", ".", "getId", "(", ")", ")", ".", "css", "(", "\"height\"", ")", ")", "||", "40", ";", "oPopover", ".", "width", "=", "parseInt", "(", "jQuery", "(", "\"#\"", "+", "this", ".", "getPopover", "(", ")", ".", "getId", "(", ")", ")", ".", "css", "(", "\"width\"", ")", ")", "||", "80", ";", "if", "(", "bWithArrow", ")", "{", "var", "iArr", "=", "iBaseFontsize", "*", "fArrowHeight", ";", "if", "(", "iArr", ")", "{", "oPopover", ".", "height", "+=", "iArr", ";", "oPopover", ".", "width", "+=", "iArr", ";", "}", "}", "return", "oPopover", ";", "}" ]
Gets the dimensions of the ContextMenu's popover @param {boolean} bWithArrow whether the arrow width should be added @return {object} the dimensions of the ContextMenu's popover
[ "Gets", "the", "dimensions", "of", "the", "ContextMenu", "s", "popover" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.dt/src/sap/ui/dt/ContextMenuControl.js#L471-L490
4,395
SAP/openui5
src/sap.ui.dt/src/sap/ui/dt/ContextMenuControl.js
function (bCompact) { if (sap.ui.Device.browser.internet_explorer || sap.ui.Device.browser.edge) { return bCompact ? 0.5 : 0.5; } else { return bCompact ? 0.5625 : 0.5625; } }
javascript
function (bCompact) { if (sap.ui.Device.browser.internet_explorer || sap.ui.Device.browser.edge) { return bCompact ? 0.5 : 0.5; } else { return bCompact ? 0.5625 : 0.5625; } }
[ "function", "(", "bCompact", ")", "{", "if", "(", "sap", ".", "ui", ".", "Device", ".", "browser", ".", "internet_explorer", "||", "sap", ".", "ui", ".", "Device", ".", "browser", ".", "edge", ")", "{", "return", "bCompact", "?", "0.5", ":", "0.5", ";", "}", "else", "{", "return", "bCompact", "?", "0.5625", ":", "0.5625", ";", "}", "}" ]
Returns the height of a popover arrow @param {boolean} bCompact wheter ContextMenu is compact @return {float} the height of a popover arrow
[ "Returns", "the", "height", "of", "a", "popover", "arrow" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.dt/src/sap/ui/dt/ContextMenuControl.js#L497-L503
4,396
SAP/openui5
src/sap.ui.dt/src/sap/ui/dt/ContextMenuControl.js
function (sOverlayId) { var oOverlayDimensions = jQuery("#" + sOverlayId).rect(); oOverlayDimensions.right = oOverlayDimensions.left + oOverlayDimensions.width; oOverlayDimensions.bottom = oOverlayDimensions.top + oOverlayDimensions.height; return oOverlayDimensions; }
javascript
function (sOverlayId) { var oOverlayDimensions = jQuery("#" + sOverlayId).rect(); oOverlayDimensions.right = oOverlayDimensions.left + oOverlayDimensions.width; oOverlayDimensions.bottom = oOverlayDimensions.top + oOverlayDimensions.height; return oOverlayDimensions; }
[ "function", "(", "sOverlayId", ")", "{", "var", "oOverlayDimensions", "=", "jQuery", "(", "\"#\"", "+", "sOverlayId", ")", ".", "rect", "(", ")", ";", "oOverlayDimensions", ".", "right", "=", "oOverlayDimensions", ".", "left", "+", "oOverlayDimensions", ".", "width", ";", "oOverlayDimensions", ".", "bottom", "=", "oOverlayDimensions", ".", "top", "+", "oOverlayDimensions", ".", "height", ";", "return", "oOverlayDimensions", ";", "}" ]
Gets the dimensions of an overlay @param {String} sOverlayId the overlay @return {object} the dimensions of the overlay
[ "Gets", "the", "dimensions", "of", "an", "overlay" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.dt/src/sap/ui/dt/ContextMenuControl.js#L518-L524
4,397
SAP/openui5
src/sap.ui.dt/src/sap/ui/dt/ContextMenuControl.js
function () { var oViewport = {}; oViewport.width = window.innerWidth; oViewport.height = window.innerHeight; oViewport.top = parseInt(jQuery(".type_standalone").css("height")) || 0; oViewport.bottom = oViewport.top + oViewport.height; return oViewport; }
javascript
function () { var oViewport = {}; oViewport.width = window.innerWidth; oViewport.height = window.innerHeight; oViewport.top = parseInt(jQuery(".type_standalone").css("height")) || 0; oViewport.bottom = oViewport.top + oViewport.height; return oViewport; }
[ "function", "(", ")", "{", "var", "oViewport", "=", "{", "}", ";", "oViewport", ".", "width", "=", "window", ".", "innerWidth", ";", "oViewport", ".", "height", "=", "window", ".", "innerHeight", ";", "oViewport", ".", "top", "=", "parseInt", "(", "jQuery", "(", "\".type_standalone\"", ")", ".", "css", "(", "\"height\"", ")", ")", "||", "0", ";", "oViewport", ".", "bottom", "=", "oViewport", ".", "top", "+", "oViewport", ".", "height", ";", "return", "oViewport", ";", "}" ]
Gets the dimensions of the viewport @return {object} the dimensions of the viewport
[ "Gets", "the", "dimensions", "of", "the", "viewport" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.dt/src/sap/ui/dt/ContextMenuControl.js#L530-L538
4,398
SAP/openui5
src/sap.ui.dt/src/sap/ui/dt/ContextMenuControl.js
function() { var sOverflowButtonId = "OVERFLOW_BUTTON", oButtonOptions = { icon: "sap-icon://overflow", type: "Transparent", enabled: true, press: this._onOverflowPress.bind(this), layoutData: new FlexItemData({}) }; return this._addButton(sOverflowButtonId, oButtonOptions); }
javascript
function() { var sOverflowButtonId = "OVERFLOW_BUTTON", oButtonOptions = { icon: "sap-icon://overflow", type: "Transparent", enabled: true, press: this._onOverflowPress.bind(this), layoutData: new FlexItemData({}) }; return this._addButton(sOverflowButtonId, oButtonOptions); }
[ "function", "(", ")", "{", "var", "sOverflowButtonId", "=", "\"OVERFLOW_BUTTON\"", ",", "oButtonOptions", "=", "{", "icon", ":", "\"sap-icon://overflow\"", ",", "type", ":", "\"Transparent\"", ",", "enabled", ":", "true", ",", "press", ":", "this", ".", "_onOverflowPress", ".", "bind", "(", "this", ")", ",", "layoutData", ":", "new", "FlexItemData", "(", "{", "}", ")", "}", ";", "return", "this", ".", "_addButton", "(", "sOverflowButtonId", ",", "oButtonOptions", ")", ";", "}" ]
Adds a overflowButton to the ContextMenu. @return {sap.m.ContextMenu} Reference to this in order to allow method chaining @public
[ "Adds", "a", "overflowButton", "to", "the", "ContextMenu", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.dt/src/sap/ui/dt/ContextMenuControl.js#L555-L565
4,399
SAP/openui5
src/sap.ui.dt/src/sap/ui/dt/ContextMenuControl.js
function(oButtonItem, fnContextMenuHandler, aElementOverlays) { var fnHandler = function(oEvent) { this.bOpen = false; this.bOpenNew = false; fnContextMenuHandler(this); }; var sText = typeof oButtonItem.text === "function" ? oButtonItem.text(aElementOverlays[0]) : oButtonItem.text; var bEnabled = typeof oButtonItem.enabled === "function" ? oButtonItem.enabled(aElementOverlays) : oButtonItem.enabled; var oButtonOptions = { icon: this._getIcon(oButtonItem.icon), text: sText, tooltip: sText, type: "Transparent", enabled: bEnabled, press: fnHandler, layoutData: new FlexItemData({}) }; return this._addButton(oButtonItem.id, oButtonOptions); }
javascript
function(oButtonItem, fnContextMenuHandler, aElementOverlays) { var fnHandler = function(oEvent) { this.bOpen = false; this.bOpenNew = false; fnContextMenuHandler(this); }; var sText = typeof oButtonItem.text === "function" ? oButtonItem.text(aElementOverlays[0]) : oButtonItem.text; var bEnabled = typeof oButtonItem.enabled === "function" ? oButtonItem.enabled(aElementOverlays) : oButtonItem.enabled; var oButtonOptions = { icon: this._getIcon(oButtonItem.icon), text: sText, tooltip: sText, type: "Transparent", enabled: bEnabled, press: fnHandler, layoutData: new FlexItemData({}) }; return this._addButton(oButtonItem.id, oButtonOptions); }
[ "function", "(", "oButtonItem", ",", "fnContextMenuHandler", ",", "aElementOverlays", ")", "{", "var", "fnHandler", "=", "function", "(", "oEvent", ")", "{", "this", ".", "bOpen", "=", "false", ";", "this", ".", "bOpenNew", "=", "false", ";", "fnContextMenuHandler", "(", "this", ")", ";", "}", ";", "var", "sText", "=", "typeof", "oButtonItem", ".", "text", "===", "\"function\"", "?", "oButtonItem", ".", "text", "(", "aElementOverlays", "[", "0", "]", ")", ":", "oButtonItem", ".", "text", ";", "var", "bEnabled", "=", "typeof", "oButtonItem", ".", "enabled", "===", "\"function\"", "?", "oButtonItem", ".", "enabled", "(", "aElementOverlays", ")", ":", "oButtonItem", ".", "enabled", ";", "var", "oButtonOptions", "=", "{", "icon", ":", "this", ".", "_getIcon", "(", "oButtonItem", ".", "icon", ")", ",", "text", ":", "sText", ",", "tooltip", ":", "sText", ",", "type", ":", "\"Transparent\"", ",", "enabled", ":", "bEnabled", ",", "press", ":", "fnHandler", ",", "layoutData", ":", "new", "FlexItemData", "(", "{", "}", ")", "}", ";", "return", "this", ".", "_addButton", "(", "oButtonItem", ".", "id", ",", "oButtonOptions", ")", ";", "}" ]
Adds a menu action button to the contextMenu @param {Object} oButtonItem the button configuration item @param {function} fnContextMenuHandler the handler function for button press event @param {sap.ui.dt.ElementOverlay[]} aElementOverlays - Target overlays @return {sap.m.ContextMenu} Reference to this in order to allow method chaining @public
[ "Adds", "a", "menu", "action", "button", "to", "the", "contextMenu" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.dt/src/sap/ui/dt/ContextMenuControl.js#L575-L594