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
list
docstring
stringlengths
4
11.8k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
86
226
partition
stringclasses
1 value
SAP/openui5
src/sap.ui.fl/src/sap/ui/fl/FakeLrepConnector.js
handleGetTransports
function handleGetTransports(sUri, sMethod, oData, mOptions, resolve, reject){ if (sUri.match(/^\/sap\/bc\/lrep\/actions\/gettransports\//)){ resolve({ response: { "transports": [ { "transportId": "U31K008488", "description": "The Ultimate Transport", "owner": "Fantasy Owner", "locked": true } ], "localonly": false, "errorCode": "" } }); } }
javascript
function handleGetTransports(sUri, sMethod, oData, mOptions, resolve, reject){ if (sUri.match(/^\/sap\/bc\/lrep\/actions\/gettransports\//)){ resolve({ response: { "transports": [ { "transportId": "U31K008488", "description": "The Ultimate Transport", "owner": "Fantasy Owner", "locked": true } ], "localonly": false, "errorCode": "" } }); } }
[ "function", "handleGetTransports", "(", "sUri", ",", "sMethod", ",", "oData", ",", "mOptions", ",", "resolve", ",", "reject", ")", "{", "if", "(", "sUri", ".", "match", "(", "/", "^\\/sap\\/bc\\/lrep\\/actions\\/gettransports\\/", "/", ")", ")", "{", "resolve", "(", "{", "response", ":", "{", "\"transports\"", ":", "[", "{", "\"transportId\"", ":", "\"U31K008488\"", ",", "\"description\"", ":", "\"The Ultimate Transport\"", ",", "\"owner\"", ":", "\"Fantasy Owner\"", ",", "\"locked\"", ":", "true", "}", "]", ",", "\"localonly\"", ":", "false", ",", "\"errorCode\"", ":", "\"\"", "}", "}", ")", ";", "}", "}" ]
REVISE Make response configurable
[ "REVISE", "Make", "response", "configurable" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.fl/src/sap/ui/fl/FakeLrepConnector.js#L216-L233
train
SAP/openui5
src/sap.ui.fl/src/sap/ui/fl/context/ContextManager.js
function (oChange, aActiveContexts) { var sChangeContext = oChange.context || ""; if (!sChangeContext) { // change is free of context (always applied) return true; } return aActiveContexts && aActiveContexts.indexOf(sChangeContext) !== -1; }
javascript
function (oChange, aActiveContexts) { var sChangeContext = oChange.context || ""; if (!sChangeContext) { // change is free of context (always applied) return true; } return aActiveContexts && aActiveContexts.indexOf(sChangeContext) !== -1; }
[ "function", "(", "oChange", ",", "aActiveContexts", ")", "{", "var", "sChangeContext", "=", "oChange", ".", "context", "||", "\"\"", ";", "if", "(", "!", "sChangeContext", ")", "{", "return", "true", ";", "}", "return", "aActiveContexts", "&&", "aActiveContexts", ".", "indexOf", "(", "sChangeContext", ")", "!==", "-", "1", ";", "}" ]
Helper to check if a passed change is free of contexts or in a matching context. @param {sap.ui.fl.Change} oChange - change object which has to be filtered @param {sap.ui.fl.Context[]} aActiveContexts - active runtime or designtime context @returns {boolean} is change context free or has a valid context
[ "Helper", "to", "check", "if", "a", "passed", "change", "is", "free", "of", "contexts", "or", "in", "a", "matching", "context", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.fl/src/sap/ui/fl/context/ContextManager.js#L41-L50
train
SAP/openui5
src/sap.ui.fl/src/sap/ui/fl/context/ContextManager.js
function (aContextObjects) { var aDesignTimeContextIdsByUrl = this._getContextIdsFromUrl(); if (aDesignTimeContextIdsByUrl.length === 0) { // [default: runtime] use runtime contexts return this._getContextParametersFromAPI(aContextObjects) .then(this._getActiveContextsByAPIParameters.bind(this, aContextObjects)); } else { // [designtime] use url parameters to determine the current active context(s) return Promise.resolve(this._getActiveContextsByUrlParameters(aContextObjects, aDesignTimeContextIdsByUrl)); } }
javascript
function (aContextObjects) { var aDesignTimeContextIdsByUrl = this._getContextIdsFromUrl(); if (aDesignTimeContextIdsByUrl.length === 0) { // [default: runtime] use runtime contexts return this._getContextParametersFromAPI(aContextObjects) .then(this._getActiveContextsByAPIParameters.bind(this, aContextObjects)); } else { // [designtime] use url parameters to determine the current active context(s) return Promise.resolve(this._getActiveContextsByUrlParameters(aContextObjects, aDesignTimeContextIdsByUrl)); } }
[ "function", "(", "aContextObjects", ")", "{", "var", "aDesignTimeContextIdsByUrl", "=", "this", ".", "_getContextIdsFromUrl", "(", ")", ";", "if", "(", "aDesignTimeContextIdsByUrl", ".", "length", "===", "0", ")", "{", "return", "this", ".", "_getContextParametersFromAPI", "(", "aContextObjects", ")", ".", "then", "(", "this", ".", "_getActiveContextsByAPIParameters", ".", "bind", "(", "this", ",", "aContextObjects", ")", ")", ";", "}", "else", "{", "return", "Promise", ".", "resolve", "(", "this", ".", "_getActiveContextsByUrlParameters", "(", "aContextObjects", ",", "aDesignTimeContextIdsByUrl", ")", ")", ";", "}", "}" ]
Helper to filter passed context objects. This method loops over each context object and check for its current validity @param {sap.ui.fl.Context[]} aContextObjects - context objects within the application @returns {Promise|string[]} aActiveContexts - Promise returning or direct build array containing ids of context objects
[ "Helper", "to", "filter", "passed", "context", "objects", ".", "This", "method", "loops", "over", "each", "context", "object", "and", "check", "for", "its", "current", "validity" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.fl/src/sap/ui/fl/context/ContextManager.js#L59-L70
train
SAP/openui5
src/sap.ui.fl/src/sap/ui/fl/context/ContextManager.js
function (aContextObjects) { var aRequiredContextParameters = []; aContextObjects.forEach(function (oContext) { oContext.parameters.forEach(function (oContextParameter) { var sSelector = oContextParameter.selector; if (aRequiredContextParameters.indexOf(sSelector) === -1) { aRequiredContextParameters.push(sSelector); } }); }); return this._oContext.getValue(aRequiredContextParameters); }
javascript
function (aContextObjects) { var aRequiredContextParameters = []; aContextObjects.forEach(function (oContext) { oContext.parameters.forEach(function (oContextParameter) { var sSelector = oContextParameter.selector; if (aRequiredContextParameters.indexOf(sSelector) === -1) { aRequiredContextParameters.push(sSelector); } }); }); return this._oContext.getValue(aRequiredContextParameters); }
[ "function", "(", "aContextObjects", ")", "{", "var", "aRequiredContextParameters", "=", "[", "]", ";", "aContextObjects", ".", "forEach", "(", "function", "(", "oContext", ")", "{", "oContext", ".", "parameters", ".", "forEach", "(", "function", "(", "oContextParameter", ")", "{", "var", "sSelector", "=", "oContextParameter", ".", "selector", ";", "if", "(", "aRequiredContextParameters", ".", "indexOf", "(", "sSelector", ")", "===", "-", "1", ")", "{", "aRequiredContextParameters", ".", "push", "(", "sSelector", ")", ";", "}", "}", ")", ";", "}", ")", ";", "return", "this", ".", "_oContext", ".", "getValue", "(", "aRequiredContextParameters", ")", ";", "}" ]
Helper to retreive the context parameters from the instanciated context api @param {sap.ui.fl.Context[]} aContextObjects - context objects within the application @returns {Promise} aRuntimeContextParameters - Promise resolving with a map of context keys and their current values
[ "Helper", "to", "retreive", "the", "context", "parameters", "from", "the", "instanciated", "context", "api" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.fl/src/sap/ui/fl/context/ContextManager.js#L78-L91
train
SAP/openui5
src/sap.ui.fl/src/sap/ui/fl/context/ContextManager.js
function (aContextObjects, aRuntimeContextParameters) { var that = this; var aActiveContexts = []; aContextObjects.forEach(function (oContext) { if (that._isContextObjectActive(oContext, aRuntimeContextParameters)) { aActiveContexts.push(oContext.id); } }); return aActiveContexts; }
javascript
function (aContextObjects, aRuntimeContextParameters) { var that = this; var aActiveContexts = []; aContextObjects.forEach(function (oContext) { if (that._isContextObjectActive(oContext, aRuntimeContextParameters)) { aActiveContexts.push(oContext.id); } }); return aActiveContexts; }
[ "function", "(", "aContextObjects", ",", "aRuntimeContextParameters", ")", "{", "var", "that", "=", "this", ";", "var", "aActiveContexts", "=", "[", "]", ";", "aContextObjects", ".", "forEach", "(", "function", "(", "oContext", ")", "{", "if", "(", "that", ".", "_isContextObjectActive", "(", "oContext", ",", "aRuntimeContextParameters", ")", ")", "{", "aActiveContexts", ".", "push", "(", "oContext", ".", "id", ")", ";", "}", "}", ")", ";", "return", "aActiveContexts", ";", "}" ]
Function to filter all contexts by the passed runtime context parameters. @param {object[]} aContextObjects - context objects within the application @param {object} aRuntimeContextParameters - map of context keys and their current values @returns {string[]} aActiveContexts - id list of all active contexts
[ "Function", "to", "filter", "all", "contexts", "by", "the", "passed", "runtime", "context", "parameters", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.fl/src/sap/ui/fl/context/ContextManager.js#L100-L111
train
SAP/openui5
src/sap.ui.fl/src/sap/ui/fl/context/ContextManager.js
function(aContextObjects, aDesignTimeContextIdsByUrl) { var aActiveContexts = []; aContextObjects.forEach(function (oContext) { var bContextActive = ((aDesignTimeContextIdsByUrl ? Array.prototype.indexOf.call(aDesignTimeContextIdsByUrl, oContext.id) : -1)) !== -1; if (bContextActive) { aActiveContexts.push(oContext.id); } }); return aActiveContexts; }
javascript
function(aContextObjects, aDesignTimeContextIdsByUrl) { var aActiveContexts = []; aContextObjects.forEach(function (oContext) { var bContextActive = ((aDesignTimeContextIdsByUrl ? Array.prototype.indexOf.call(aDesignTimeContextIdsByUrl, oContext.id) : -1)) !== -1; if (bContextActive) { aActiveContexts.push(oContext.id); } }); return aActiveContexts; }
[ "function", "(", "aContextObjects", ",", "aDesignTimeContextIdsByUrl", ")", "{", "var", "aActiveContexts", "=", "[", "]", ";", "aContextObjects", ".", "forEach", "(", "function", "(", "oContext", ")", "{", "var", "bContextActive", "=", "(", "(", "aDesignTimeContextIdsByUrl", "?", "Array", ".", "prototype", ".", "indexOf", ".", "call", "(", "aDesignTimeContextIdsByUrl", ",", "oContext", ".", "id", ")", ":", "-", "1", ")", ")", "!==", "-", "1", ";", "if", "(", "bContextActive", ")", "{", "aActiveContexts", ".", "push", "(", "oContext", ".", "id", ")", ";", "}", "}", ")", ";", "return", "aActiveContexts", ";", "}" ]
Function to filter all contexts by the context URL parameters. @param {string[]} aDesignTimeContextIdsByUrl - list of ids passed via URL @param {object[]} aContextObjects - context objects within the application @returns {string[]} aActiveContexts - id list of all active contexts
[ "Function", "to", "filter", "all", "contexts", "by", "the", "context", "URL", "parameters", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.fl/src/sap/ui/fl/context/ContextManager.js#L120-L132
train
SAP/openui5
src/sap.ui.fl/src/sap/ui/fl/context/ContextManager.js
function(oContext, aRuntimeContextParameters) { var that = this; var bContextActive = true; var aParameterOfContext = oContext.parameters; aParameterOfContext.every(function (oParameter) { bContextActive = bContextActive && that._checkContextParameter(oParameter, aRuntimeContextParameters); return bContextActive; // breaks loop on false }); return bContextActive; }
javascript
function(oContext, aRuntimeContextParameters) { var that = this; var bContextActive = true; var aParameterOfContext = oContext.parameters; aParameterOfContext.every(function (oParameter) { bContextActive = bContextActive && that._checkContextParameter(oParameter, aRuntimeContextParameters); return bContextActive; // breaks loop on false }); return bContextActive; }
[ "function", "(", "oContext", ",", "aRuntimeContextParameters", ")", "{", "var", "that", "=", "this", ";", "var", "bContextActive", "=", "true", ";", "var", "aParameterOfContext", "=", "oContext", ".", "parameters", ";", "aParameterOfContext", ".", "every", "(", "function", "(", "oParameter", ")", "{", "bContextActive", "=", "bContextActive", "&&", "that", ".", "_checkContextParameter", "(", "oParameter", ",", "aRuntimeContextParameters", ")", ";", "return", "bContextActive", ";", "}", ")", ";", "return", "bContextActive", ";", "}" ]
Helper to filter passed context object. If a passed context is not within the context objects of the given application the context is filtered. The filtering is done [At runtime] by comparing the parameters of the context objects with the actual runtime context. [At designtime] by comparing the id of the context objects with the set url parameter "sap-ui-designTimeContexts" @param {object} oContext - context object to be validated @param {object[]} aRuntimeContextParameters - context parameter returned form the context providers @returns {boolean} bContextActive - determines if the passed context matches the context of the current environment @private
[ "Helper", "to", "filter", "passed", "context", "object", ".", "If", "a", "passed", "context", "is", "not", "within", "the", "context", "objects", "of", "the", "given", "application", "the", "context", "is", "filtered", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.fl/src/sap/ui/fl/context/ContextManager.js#L147-L158
train
SAP/openui5
src/sap.ui.fl/src/sap/ui/fl/context/ContextManager.js
function (oParameter, aRuntimeContext) { var sSelector = oParameter.selector; var sOperator = oParameter.operator; var oValue = oParameter.value; switch (sOperator) { case "EQ": return this._checkEquals(sSelector, oValue, aRuntimeContext); case "NE": return !this._checkEquals(sSelector, oValue, aRuntimeContext); default: Log.info("A context within a flexibility change with the operator '" + sOperator + "' could not be verified"); return false; } }
javascript
function (oParameter, aRuntimeContext) { var sSelector = oParameter.selector; var sOperator = oParameter.operator; var oValue = oParameter.value; switch (sOperator) { case "EQ": return this._checkEquals(sSelector, oValue, aRuntimeContext); case "NE": return !this._checkEquals(sSelector, oValue, aRuntimeContext); default: Log.info("A context within a flexibility change with the operator '" + sOperator + "' could not be verified"); return false; } }
[ "function", "(", "oParameter", ",", "aRuntimeContext", ")", "{", "var", "sSelector", "=", "oParameter", ".", "selector", ";", "var", "sOperator", "=", "oParameter", ".", "operator", ";", "var", "oValue", "=", "oParameter", ".", "value", ";", "switch", "(", "sOperator", ")", "{", "case", "\"EQ\"", ":", "return", "this", ".", "_checkEquals", "(", "sSelector", ",", "oValue", ",", "aRuntimeContext", ")", ";", "case", "\"NE\"", ":", "return", "!", "this", ".", "_checkEquals", "(", "sSelector", ",", "oValue", ",", "aRuntimeContext", ")", ";", "default", ":", "Log", ".", "info", "(", "\"A context within a flexibility change with the operator '\"", "+", "sOperator", "+", "\"' could not be verified\"", ")", ";", "return", "false", ";", "}", "}" ]
Checks a single condition of a context object. Returns true if the condition matches the current runtime context. @param {Object} oParameter - context within an sap.ui.fl.Change @param {string} oParameter.selector - key of a runtime context @param {string} oParameter.operator - determine which comparison has to be executed @param {string} oParameter.value - value which has to be matched within the key @param {Object} aRuntimeContext - key value pairs of the current runtime context @returns {boolean} bContextValid - context of the changes matches @private
[ "Checks", "a", "single", "condition", "of", "a", "context", "object", ".", "Returns", "true", "if", "the", "condition", "matches", "the", "current", "runtime", "context", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.fl/src/sap/ui/fl/context/ContextManager.js#L187-L201
train
SAP/openui5
src/sap.ui.support/src/sap/ui/support/supportRules/ExecutionScope.js
function () { var aPublicElements = []; var mComponents = core.mObjects.component; var mUIAreas = core.mUIAreas; for (var i in mComponents) { aPublicElements = aPublicElements.concat( getPublicElementsInside(mComponents[i]) ); } for (var key in mUIAreas) { aPublicElements = aPublicElements.concat( getPublicElementsInside(mUIAreas[key]) ); } return aPublicElements; }
javascript
function () { var aPublicElements = []; var mComponents = core.mObjects.component; var mUIAreas = core.mUIAreas; for (var i in mComponents) { aPublicElements = aPublicElements.concat( getPublicElementsInside(mComponents[i]) ); } for (var key in mUIAreas) { aPublicElements = aPublicElements.concat( getPublicElementsInside(mUIAreas[key]) ); } return aPublicElements; }
[ "function", "(", ")", "{", "var", "aPublicElements", "=", "[", "]", ";", "var", "mComponents", "=", "core", ".", "mObjects", ".", "component", ";", "var", "mUIAreas", "=", "core", ".", "mUIAreas", ";", "for", "(", "var", "i", "in", "mComponents", ")", "{", "aPublicElements", "=", "aPublicElements", ".", "concat", "(", "getPublicElementsInside", "(", "mComponents", "[", "i", "]", ")", ")", ";", "}", "for", "(", "var", "key", "in", "mUIAreas", ")", "{", "aPublicElements", "=", "aPublicElements", ".", "concat", "(", "getPublicElementsInside", "(", "mUIAreas", "[", "key", "]", ")", ")", ";", "}", "return", "aPublicElements", ";", "}" ]
Returns all public elements, i.e. elements that are part of public API aggregations @public @function @returns {Array} Array of matched elements @alias sap.ui.support.ExecutionScope.getPublicElements
[ "Returns", "all", "public", "elements", "i", ".", "e", ".", "elements", "that", "are", "part", "of", "public", "API", "aggregations" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.support/src/sap/ui/support/supportRules/ExecutionScope.js#L249-L267
train
SAP/openui5
src/sap.ui.support/src/sap/ui/support/supportRules/ExecutionScope.js
function (classNameSelector) { if (typeof classNameSelector === "string") { return elements.filter(function (element) { return element.getMetadata().getName() === classNameSelector; }); } if (typeof classNameSelector === "function") { return elements.filter(function (element) { return element instanceof classNameSelector; }); } }
javascript
function (classNameSelector) { if (typeof classNameSelector === "string") { return elements.filter(function (element) { return element.getMetadata().getName() === classNameSelector; }); } if (typeof classNameSelector === "function") { return elements.filter(function (element) { return element instanceof classNameSelector; }); } }
[ "function", "(", "classNameSelector", ")", "{", "if", "(", "typeof", "classNameSelector", "===", "\"string\"", ")", "{", "return", "elements", ".", "filter", "(", "function", "(", "element", ")", "{", "return", "element", ".", "getMetadata", "(", ")", ".", "getName", "(", ")", "===", "classNameSelector", ";", "}", ")", ";", "}", "if", "(", "typeof", "classNameSelector", "===", "\"function\"", ")", "{", "return", "elements", ".", "filter", "(", "function", "(", "element", ")", "{", "return", "element", "instanceof", "classNameSelector", ";", "}", ")", ";", "}", "}" ]
Gets elements by their type @public @function @param {string|function} classNameSelector Either string or function to be used when selecting a subset of elements @returns {Array} Array of matched elements @alias sap.ui.support.ExecutionScope.getElementsByClassName
[ "Gets", "elements", "by", "their", "type" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.support/src/sap/ui/support/supportRules/ExecutionScope.js#L277-L289
train
SAP/openui5
src/sap.ui.support/src/sap/ui/support/supportRules/ExecutionScope.js
function (type) { var log = jQuery.sap.log.getLogEntries(), loggedObjects = [], elemIds; // Add logEntries that have support info object, // and that have the same type as the type provided log.forEach(function (logEntry) { if (!logEntry.supportInfo) { return; } if (!elemIds){ elemIds = elements.map(function (element) { return element.getId(); }); } var hasElemId = !!logEntry.supportInfo.elementId, typeMatch = logEntry.supportInfo.type === type || type === undefined, scopeMatch = !hasElemId || jQuery.inArray(logEntry.supportInfo.elementId, elemIds) > -1; /** * Give the developer the ability to pass filtering function */ if (typeof type === "function" && type(logEntry) && scopeMatch) { loggedObjects.push(logEntry); return; } if (typeMatch && scopeMatch) { loggedObjects.push(logEntry); } }); return loggedObjects; }
javascript
function (type) { var log = jQuery.sap.log.getLogEntries(), loggedObjects = [], elemIds; // Add logEntries that have support info object, // and that have the same type as the type provided log.forEach(function (logEntry) { if (!logEntry.supportInfo) { return; } if (!elemIds){ elemIds = elements.map(function (element) { return element.getId(); }); } var hasElemId = !!logEntry.supportInfo.elementId, typeMatch = logEntry.supportInfo.type === type || type === undefined, scopeMatch = !hasElemId || jQuery.inArray(logEntry.supportInfo.elementId, elemIds) > -1; /** * Give the developer the ability to pass filtering function */ if (typeof type === "function" && type(logEntry) && scopeMatch) { loggedObjects.push(logEntry); return; } if (typeMatch && scopeMatch) { loggedObjects.push(logEntry); } }); return loggedObjects; }
[ "function", "(", "type", ")", "{", "var", "log", "=", "jQuery", ".", "sap", ".", "log", ".", "getLogEntries", "(", ")", ",", "loggedObjects", "=", "[", "]", ",", "elemIds", ";", "log", ".", "forEach", "(", "function", "(", "logEntry", ")", "{", "if", "(", "!", "logEntry", ".", "supportInfo", ")", "{", "return", ";", "}", "if", "(", "!", "elemIds", ")", "{", "elemIds", "=", "elements", ".", "map", "(", "function", "(", "element", ")", "{", "return", "element", ".", "getId", "(", ")", ";", "}", ")", ";", "}", "var", "hasElemId", "=", "!", "!", "logEntry", ".", "supportInfo", ".", "elementId", ",", "typeMatch", "=", "logEntry", ".", "supportInfo", ".", "type", "===", "type", "||", "type", "===", "undefined", ",", "scopeMatch", "=", "!", "hasElemId", "||", "jQuery", ".", "inArray", "(", "logEntry", ".", "supportInfo", ".", "elementId", ",", "elemIds", ")", ">", "-", "1", ";", "if", "(", "typeof", "type", "===", "\"function\"", "&&", "type", "(", "logEntry", ")", "&&", "scopeMatch", ")", "{", "loggedObjects", ".", "push", "(", "logEntry", ")", ";", "return", ";", "}", "if", "(", "typeMatch", "&&", "scopeMatch", ")", "{", "loggedObjects", ".", "push", "(", "logEntry", ")", ";", "}", "}", ")", ";", "return", "loggedObjects", ";", "}" ]
Gets the logged objects by object type @public @function @param {any} type Type of logged objects @returns {Array} Array of logged objects @alias sap.ui.support.ExecutionScope.getLoggedObjects
[ "Gets", "the", "logged", "objects", "by", "object", "type" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.support/src/sap/ui/support/supportRules/ExecutionScope.js#L298-L336
train
SAP/openui5
src/sap.ui.unified/src/sap/ui/unified/calendar/CalendarDate.js
createUniversalUTCDate
function createUniversalUTCDate(oDate, sCalendarType) { if (sCalendarType) { return UniversalDate.getInstance(createUTCDate(oDate), sCalendarType); } else { return new UniversalDate(createUTCDate(oDate).getTime()); } }
javascript
function createUniversalUTCDate(oDate, sCalendarType) { if (sCalendarType) { return UniversalDate.getInstance(createUTCDate(oDate), sCalendarType); } else { return new UniversalDate(createUTCDate(oDate).getTime()); } }
[ "function", "createUniversalUTCDate", "(", "oDate", ",", "sCalendarType", ")", "{", "if", "(", "sCalendarType", ")", "{", "return", "UniversalDate", ".", "getInstance", "(", "createUTCDate", "(", "oDate", ")", ",", "sCalendarType", ")", ";", "}", "else", "{", "return", "new", "UniversalDate", "(", "createUTCDate", "(", "oDate", ")", ".", "getTime", "(", ")", ")", ";", "}", "}" ]
Creates an UniversalDate corresponding to the given date and calendar type. @param {Date} oDate JavaScript date object to create the UniversalDate from. Local date information is used. @param {sap.ui.core.CalendarType} sCalendarType The type to be used. If not specified, the calendar type from configuration will be used. For more details on the Configuration, please check sap.ui.core.Configuration#getCalendarType @returns {sap.ui.core.date.UniversalDate} The created date
[ "Creates", "an", "UniversalDate", "corresponding", "to", "the", "given", "date", "and", "calendar", "type", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.unified/src/sap/ui/unified/calendar/CalendarDate.js#L328-L334
train
SAP/openui5
src/sap.ui.unified/src/sap/ui/unified/calendar/CalendarDate.js
createUTCDate
function createUTCDate(oDate) { var oUTCDate = new Date(Date.UTC(0, 0, 1)); oUTCDate.setUTCFullYear(oDate.getFullYear(), oDate.getMonth(), oDate.getDate()); return oUTCDate; }
javascript
function createUTCDate(oDate) { var oUTCDate = new Date(Date.UTC(0, 0, 1)); oUTCDate.setUTCFullYear(oDate.getFullYear(), oDate.getMonth(), oDate.getDate()); return oUTCDate; }
[ "function", "createUTCDate", "(", "oDate", ")", "{", "var", "oUTCDate", "=", "new", "Date", "(", "Date", ".", "UTC", "(", "0", ",", "0", ",", "1", ")", ")", ";", "oUTCDate", ".", "setUTCFullYear", "(", "oDate", ".", "getFullYear", "(", ")", ",", "oDate", ".", "getMonth", "(", ")", ",", "oDate", ".", "getDate", "(", ")", ")", ";", "return", "oUTCDate", ";", "}" ]
Creates a JavaScript UTC Date corresponding to the given JavaScript Date. @param {Date} oDate JavaScript date object. Time related information is cut. @returns {Date} JavaScript date created from the date object, but this time considered as UTC date information.
[ "Creates", "a", "JavaScript", "UTC", "Date", "corresponding", "to", "the", "given", "JavaScript", "Date", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.unified/src/sap/ui/unified/calendar/CalendarDate.js#L341-L347
train
SAP/openui5
src/sap.ui.unified/src/sap/ui/unified/calendar/CalendarDate.js
checkNumericLike
function checkNumericLike(value, message) { if (value == undefined || value === Infinity || isNaN(value)) {//checks also for null. throw message; } }
javascript
function checkNumericLike(value, message) { if (value == undefined || value === Infinity || isNaN(value)) {//checks also for null. throw message; } }
[ "function", "checkNumericLike", "(", "value", ",", "message", ")", "{", "if", "(", "value", "==", "undefined", "||", "value", "===", "Infinity", "||", "isNaN", "(", "value", ")", ")", "{", "throw", "message", ";", "}", "}" ]
Verifies the given value is numeric like, i.e. 3, "3" and throws an error if it is not. @param {any} value The value of any type to check. If null or undefined, this method throws an error. @param {string} message The message to be used if an error is to be thrown @throws will throw an error if the value is null or undefined or is not like a number
[ "Verifies", "the", "given", "value", "is", "numeric", "like", "i", ".", "e", ".", "3", "3", "and", "throws", "an", "error", "if", "it", "is", "not", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.unified/src/sap/ui/unified/calendar/CalendarDate.js#L361-L365
train
SAP/openui5
src/sap.ui.documentation/src/sap/ui/documentation/sdk/controller/util/XML2JSONUtils.js
function(element) { var links = element.querySelectorAll("a.xref, a.link, area"), i, link, href, startsWithHash, startsWithHTTP; for (i = 0; i < links.length; i++) { link = links[i]; href = link.getAttribute("href"); startsWithHash = href.indexOf("#") == 0; startsWithHTTP = href.indexOf("http") == 0; // absolute links should open in a new window if (startsWithHTTP) { link.setAttribute('target', '_blank'); } // absolute links and links starting with # are ok and should not be modified if (startsWithHTTP || startsWithHash) { continue; } // API reference are recognized by "/docs/api/" string if (href.indexOf("/docs/api/") > -1) { href = href.substr(0, href.lastIndexOf(".html")); href = href.substr(href.lastIndexOf('/') + 1); href = "#/api/" + href; } else if (href.indexOf("explored.html") > -1) { // explored app links have explored.html in them href = href.split("../").join(""); href = oConfig.exploredURI + href; } else { // we assume all other links are links to other documentation pages href = href.substr(0, href.lastIndexOf(".html")); href = "#/topic/" + href; } link.setAttribute("href", href); } }
javascript
function(element) { var links = element.querySelectorAll("a.xref, a.link, area"), i, link, href, startsWithHash, startsWithHTTP; for (i = 0; i < links.length; i++) { link = links[i]; href = link.getAttribute("href"); startsWithHash = href.indexOf("#") == 0; startsWithHTTP = href.indexOf("http") == 0; // absolute links should open in a new window if (startsWithHTTP) { link.setAttribute('target', '_blank'); } // absolute links and links starting with # are ok and should not be modified if (startsWithHTTP || startsWithHash) { continue; } // API reference are recognized by "/docs/api/" string if (href.indexOf("/docs/api/") > -1) { href = href.substr(0, href.lastIndexOf(".html")); href = href.substr(href.lastIndexOf('/') + 1); href = "#/api/" + href; } else if (href.indexOf("explored.html") > -1) { // explored app links have explored.html in them href = href.split("../").join(""); href = oConfig.exploredURI + href; } else { // we assume all other links are links to other documentation pages href = href.substr(0, href.lastIndexOf(".html")); href = "#/topic/" + href; } link.setAttribute("href", href); } }
[ "function", "(", "element", ")", "{", "var", "links", "=", "element", ".", "querySelectorAll", "(", "\"a.xref, a.link, area\"", ")", ",", "i", ",", "link", ",", "href", ",", "startsWithHash", ",", "startsWithHTTP", ";", "for", "(", "i", "=", "0", ";", "i", "<", "links", ".", "length", ";", "i", "++", ")", "{", "link", "=", "links", "[", "i", "]", ";", "href", "=", "link", ".", "getAttribute", "(", "\"href\"", ")", ";", "startsWithHash", "=", "href", ".", "indexOf", "(", "\"#\"", ")", "==", "0", ";", "startsWithHTTP", "=", "href", ".", "indexOf", "(", "\"http\"", ")", "==", "0", ";", "if", "(", "startsWithHTTP", ")", "{", "link", ".", "setAttribute", "(", "'target'", ",", "'_blank'", ")", ";", "}", "if", "(", "startsWithHTTP", "||", "startsWithHash", ")", "{", "continue", ";", "}", "if", "(", "href", ".", "indexOf", "(", "\"/docs/api/\"", ")", ">", "-", "1", ")", "{", "href", "=", "href", ".", "substr", "(", "0", ",", "href", ".", "lastIndexOf", "(", "\".html\"", ")", ")", ";", "href", "=", "href", ".", "substr", "(", "href", ".", "lastIndexOf", "(", "'/'", ")", "+", "1", ")", ";", "href", "=", "\"#/api/\"", "+", "href", ";", "}", "else", "if", "(", "href", ".", "indexOf", "(", "\"explored.html\"", ")", ">", "-", "1", ")", "{", "href", "=", "href", ".", "split", "(", "\"../\"", ")", ".", "join", "(", "\"\"", ")", ";", "href", "=", "oConfig", ".", "exploredURI", "+", "href", ";", "}", "else", "{", "href", "=", "href", ".", "substr", "(", "0", ",", "href", ".", "lastIndexOf", "(", "\".html\"", ")", ")", ";", "href", "=", "\"#/topic/\"", "+", "href", ";", "}", "link", ".", "setAttribute", "(", "\"href\"", ",", "href", ")", ";", "}", "}" ]
Adjusts link href values @param element The DOM element which may contain cross reference links
[ "Adjusts", "link", "href", "values" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.documentation/src/sap/ui/documentation/sdk/controller/util/XML2JSONUtils.js#L32-L70
train
SAP/openui5
src/sap.ui.documentation/src/sap/ui/documentation/sdk/controller/Welcome.controller.js
function (event) { var href = event.oSource.getHref() || event.oSource.getTarget(); href = href.replace("#/", "").split('/'); /** @type string */ var page = href[0]; /** @type string */ var parameter = href[1]; event.preventDefault(); this.getRouter().navTo(page, {id: parameter}, true); }
javascript
function (event) { var href = event.oSource.getHref() || event.oSource.getTarget(); href = href.replace("#/", "").split('/'); /** @type string */ var page = href[0]; /** @type string */ var parameter = href[1]; event.preventDefault(); this.getRouter().navTo(page, {id: parameter}, true); }
[ "function", "(", "event", ")", "{", "var", "href", "=", "event", ".", "oSource", ".", "getHref", "(", ")", "||", "event", ".", "oSource", ".", "getTarget", "(", ")", ";", "href", "=", "href", ".", "replace", "(", "\"#/\"", ",", "\"\"", ")", ".", "split", "(", "'/'", ")", ";", "var", "page", "=", "href", "[", "0", "]", ";", "var", "parameter", "=", "href", "[", "1", "]", ";", "event", ".", "preventDefault", "(", ")", ";", "this", ".", "getRouter", "(", ")", ".", "navTo", "(", "page", ",", "{", "id", ":", "parameter", "}", ",", "true", ")", ";", "}" ]
Opens the control's details page @param event
[ "Opens", "the", "control", "s", "details", "page" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.documentation/src/sap/ui/documentation/sdk/controller/Welcome.controller.js#L73-L83
train
SAP/openui5
src/sap.ui.documentation/src/sap/ui/documentation/sdk/controller/Welcome.controller.js
function (oEvent) { var isOpenUI5 = this.getView().getModel("welcomeView").getProperty("/isOpenUI5"), sUrl = isOpenUI5 ? "http://openui5.org/download.html" : "https://tools.hana.ondemand.com/#sapui5"; window.open(sUrl, "_blank"); }
javascript
function (oEvent) { var isOpenUI5 = this.getView().getModel("welcomeView").getProperty("/isOpenUI5"), sUrl = isOpenUI5 ? "http://openui5.org/download.html" : "https://tools.hana.ondemand.com/#sapui5"; window.open(sUrl, "_blank"); }
[ "function", "(", "oEvent", ")", "{", "var", "isOpenUI5", "=", "this", ".", "getView", "(", ")", ".", "getModel", "(", "\"welcomeView\"", ")", ".", "getProperty", "(", "\"/isOpenUI5\"", ")", ",", "sUrl", "=", "isOpenUI5", "?", "\"http://openui5.org/download.html\"", ":", "\"https://tools.hana.ondemand.com/#sapui5\"", ";", "window", ".", "open", "(", "sUrl", ",", "\"_blank\"", ")", ";", "}" ]
Redirects to the UI5 download page @param {sap.ui.base.Event} oEvent the Button press event @public
[ "Redirects", "to", "the", "UI5", "download", "page" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.documentation/src/sap/ui/documentation/sdk/controller/Welcome.controller.js#L97-L101
train
SAP/openui5
src/sap.ui.core/src/sap/ui/thirdparty/jszip.js
function(size) { var result = 0, i; this.checkOffset(size); for (i = this.index + size - 1; i >= this.index; i--) { result = (result << 8) + this.byteAt(i); } this.index += size; return result; }
javascript
function(size) { var result = 0, i; this.checkOffset(size); for (i = this.index + size - 1; i >= this.index; i--) { result = (result << 8) + this.byteAt(i); } this.index += size; return result; }
[ "function", "(", "size", ")", "{", "var", "result", "=", "0", ",", "i", ";", "this", ".", "checkOffset", "(", "size", ")", ";", "for", "(", "i", "=", "this", ".", "index", "+", "size", "-", "1", ";", "i", ">=", "this", ".", "index", ";", "i", "--", ")", "{", "result", "=", "(", "result", "<<", "8", ")", "+", "this", ".", "byteAt", "(", "i", ")", ";", "}", "this", ".", "index", "+=", "size", ";", "return", "result", ";", "}" ]
Get the next number with a given byte size. @param {number} size the number of bytes to read. @return {number} the corresponding number.
[ "Get", "the", "next", "number", "with", "a", "given", "byte", "size", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/thirdparty/jszip.js#L188-L197
train
SAP/openui5
src/sap.ui.core/src/sap/ui/thirdparty/jszip.js
function(asUTF8) { var result = getRawData(this); if (result === null || typeof result === "undefined") { return ""; } // if the data is a base64 string, we decode it before checking the encoding ! if (this.options.base64) { result = base64.decode(result); } if (asUTF8 && this.options.binary) { // JSZip.prototype.utf8decode supports arrays as input // skip to array => string step, utf8decode will do it. result = out.utf8decode(result); } else { // no utf8 transformation, do the array => string step. result = utils.transformTo("string", result); } if (!asUTF8 && !this.options.binary) { result = out.utf8encode(result); } return result; }
javascript
function(asUTF8) { var result = getRawData(this); if (result === null || typeof result === "undefined") { return ""; } // if the data is a base64 string, we decode it before checking the encoding ! if (this.options.base64) { result = base64.decode(result); } if (asUTF8 && this.options.binary) { // JSZip.prototype.utf8decode supports arrays as input // skip to array => string step, utf8decode will do it. result = out.utf8decode(result); } else { // no utf8 transformation, do the array => string step. result = utils.transformTo("string", result); } if (!asUTF8 && !this.options.binary) { result = out.utf8encode(result); } return result; }
[ "function", "(", "asUTF8", ")", "{", "var", "result", "=", "getRawData", "(", "this", ")", ";", "if", "(", "result", "===", "null", "||", "typeof", "result", "===", "\"undefined\"", ")", "{", "return", "\"\"", ";", "}", "if", "(", "this", ".", "options", ".", "base64", ")", "{", "result", "=", "base64", ".", "decode", "(", "result", ")", ";", "}", "if", "(", "asUTF8", "&&", "this", ".", "options", ".", "binary", ")", "{", "result", "=", "out", ".", "utf8decode", "(", "result", ")", ";", "}", "else", "{", "result", "=", "utils", ".", "transformTo", "(", "\"string\"", ",", "result", ")", ";", "}", "if", "(", "!", "asUTF8", "&&", "!", "this", ".", "options", ".", "binary", ")", "{", "result", "=", "out", ".", "utf8encode", "(", "result", ")", ";", "}", "return", "result", ";", "}" ]
Transform this._data into a string. @param {function} filter a function String -> String, applied if not null on the result. @return {String} the string representing this._data.
[ "Transform", "this", ".", "_data", "into", "a", "string", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/thirdparty/jszip.js#L422-L445
train
SAP/openui5
src/sap.ui.core/src/sap/ui/thirdparty/jszip.js
function(dec, bytes) { var hex = "", i; for (i = 0; i < bytes; i++) { hex += String.fromCharCode(dec & 0xff); dec = dec >>> 8; } return hex; }
javascript
function(dec, bytes) { var hex = "", i; for (i = 0; i < bytes; i++) { hex += String.fromCharCode(dec & 0xff); dec = dec >>> 8; } return hex; }
[ "function", "(", "dec", ",", "bytes", ")", "{", "var", "hex", "=", "\"\"", ",", "i", ";", "for", "(", "i", "=", "0", ";", "i", "<", "bytes", ";", "i", "++", ")", "{", "hex", "+=", "String", ".", "fromCharCode", "(", "dec", "&", "0xff", ")", ";", "dec", "=", "dec", ">>>", "8", ";", "}", "return", "hex", ";", "}" ]
Transform an integer into a string in hexadecimal. @private @param {number} dec the number to convert. @param {number} bytes the number of bytes to generate. @returns {string} the result.
[ "Transform", "an", "integer", "into", "a", "string", "in", "hexadecimal", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/thirdparty/jszip.js#L506-L514
train
SAP/openui5
src/sap.ui.core/src/sap/ui/thirdparty/jszip.js
function() { var result = {}, i, attr; for (i = 0; i < arguments.length; i++) { // arguments is not enumerable in some browsers for (attr in arguments[i]) { if (arguments[i].hasOwnProperty(attr) && typeof result[attr] === "undefined") { result[attr] = arguments[i][attr]; } } } return result; }
javascript
function() { var result = {}, i, attr; for (i = 0; i < arguments.length; i++) { // arguments is not enumerable in some browsers for (attr in arguments[i]) { if (arguments[i].hasOwnProperty(attr) && typeof result[attr] === "undefined") { result[attr] = arguments[i][attr]; } } } return result; }
[ "function", "(", ")", "{", "var", "result", "=", "{", "}", ",", "i", ",", "attr", ";", "for", "(", "i", "=", "0", ";", "i", "<", "arguments", ".", "length", ";", "i", "++", ")", "{", "for", "(", "attr", "in", "arguments", "[", "i", "]", ")", "{", "if", "(", "arguments", "[", "i", "]", ".", "hasOwnProperty", "(", "attr", ")", "&&", "typeof", "result", "[", "attr", "]", "===", "\"undefined\"", ")", "{", "result", "[", "attr", "]", "=", "arguments", "[", "i", "]", "[", "attr", "]", ";", "}", "}", "}", "return", "result", ";", "}" ]
Merge the objects passed as parameters into a new one. @private @param {...Object} var_args All objects to merge. @return {Object} a new object with the data of the others.
[ "Merge", "the", "objects", "passed", "as", "parameters", "into", "a", "new", "one", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/thirdparty/jszip.js#L522-L532
train
SAP/openui5
src/sap.ui.core/src/sap/ui/thirdparty/jszip.js
function(path) { if (path.slice(-1) == '/') { path = path.substring(0, path.length - 1); } var lastSlash = path.lastIndexOf('/'); return (lastSlash > 0) ? path.substring(0, lastSlash) : ""; }
javascript
function(path) { if (path.slice(-1) == '/') { path = path.substring(0, path.length - 1); } var lastSlash = path.lastIndexOf('/'); return (lastSlash > 0) ? path.substring(0, lastSlash) : ""; }
[ "function", "(", "path", ")", "{", "if", "(", "path", ".", "slice", "(", "-", "1", ")", "==", "'/'", ")", "{", "path", "=", "path", ".", "substring", "(", "0", ",", "path", ".", "length", "-", "1", ")", ";", "}", "var", "lastSlash", "=", "path", ".", "lastIndexOf", "(", "'/'", ")", ";", "return", "(", "lastSlash", ">", "0", ")", "?", "path", ".", "substring", "(", "0", ",", "lastSlash", ")", ":", "\"\"", ";", "}" ]
Find the parent folder of the path. @private @param {string} path the path to use @return {string} the parent folder, or ""
[ "Find", "the", "parent", "folder", "of", "the", "path", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/thirdparty/jszip.js#L612-L618
train
SAP/openui5
src/sap.ui.core/src/sap/ui/thirdparty/jszip.js
function(input) { if (input.length !== 0) { // with an empty Uint8Array, Opera fails with a "Offset larger than array size" input = utils.transformTo("uint8array", input); this.data.set(input, this.index); this.index += input.length; } }
javascript
function(input) { if (input.length !== 0) { // with an empty Uint8Array, Opera fails with a "Offset larger than array size" input = utils.transformTo("uint8array", input); this.data.set(input, this.index); this.index += input.length; } }
[ "function", "(", "input", ")", "{", "if", "(", "input", ".", "length", "!==", "0", ")", "{", "input", "=", "utils", ".", "transformTo", "(", "\"uint8array\"", ",", "input", ")", ";", "this", ".", "data", ".", "set", "(", "input", ",", "this", ".", "index", ")", ";", "this", ".", "index", "+=", "input", ".", "length", ";", "}", "}" ]
Append any content to the current array. @param {Object} input the content to add.
[ "Append", "any", "content", "to", "the", "current", "array", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/thirdparty/jszip.js#L843-L850
train
SAP/openui5
src/sap.ui.core/src/sap/ui/thirdparty/jszip.js
function(name, data, o) { if (arguments.length === 1) { if (utils.isRegExp(name)) { var regexp = name; return this.filter(function(relativePath, file) { return !file.options.dir && regexp.test(relativePath); }); } else { // text return this.filter(function(relativePath, file) { return !file.options.dir && relativePath === name; })[0] || null; } } else { // more than one argument : we have data ! name = this.root + name; fileAdd.call(this, name, data, o); } return this; }
javascript
function(name, data, o) { if (arguments.length === 1) { if (utils.isRegExp(name)) { var regexp = name; return this.filter(function(relativePath, file) { return !file.options.dir && regexp.test(relativePath); }); } else { // text return this.filter(function(relativePath, file) { return !file.options.dir && relativePath === name; })[0] || null; } } else { // more than one argument : we have data ! name = this.root + name; fileAdd.call(this, name, data, o); } return this; }
[ "function", "(", "name", ",", "data", ",", "o", ")", "{", "if", "(", "arguments", ".", "length", "===", "1", ")", "{", "if", "(", "utils", ".", "isRegExp", "(", "name", ")", ")", "{", "var", "regexp", "=", "name", ";", "return", "this", ".", "filter", "(", "function", "(", "relativePath", ",", "file", ")", "{", "return", "!", "file", ".", "options", ".", "dir", "&&", "regexp", ".", "test", "(", "relativePath", ")", ";", "}", ")", ";", "}", "else", "{", "return", "this", ".", "filter", "(", "function", "(", "relativePath", ",", "file", ")", "{", "return", "!", "file", ".", "options", ".", "dir", "&&", "relativePath", "===", "name", ";", "}", ")", "[", "0", "]", "||", "null", ";", "}", "}", "else", "{", "name", "=", "this", ".", "root", "+", "name", ";", "fileAdd", ".", "call", "(", "this", ",", "name", ",", "data", ",", "o", ")", ";", "}", "return", "this", ";", "}" ]
Add a file to the zip file, or search a file. @param {string|RegExp} name The name of the file to add (if data is defined), the name of the file to find (if no data) or a regex to match files. @param {String|ArrayBuffer|Uint8Array|Buffer} data The file data, either raw or base64 encoded @param {Object} o File options @return {JSZip|Object|Array} this JSZip object (when adding a file), a file (when searching by string) or an array of files (when searching by regex).
[ "Add", "a", "file", "to", "the", "zip", "file", "or", "search", "a", "file", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/thirdparty/jszip.js#L932-L951
train
SAP/openui5
src/sap.ui.core/src/sap/ui/thirdparty/jszip.js
function(options) { options = extend(options || {}, { base64: true, compression: "STORE", type: "base64" }); utils.checkSupport(options.type); var zipData = [], localDirLength = 0, centralDirLength = 0, writer, i; // first, generate all the zip parts. for (var name in this.files) { if (!this.files.hasOwnProperty(name)) { continue; } var file = this.files[name]; var compressionName = file.options.compression || options.compression.toUpperCase(); var compression = compressions[compressionName]; if (!compression) { throw new Error(compressionName + " is not a valid compression method !"); } var compressedObject = generateCompressedObjectFrom.call(this, file, compression); var zipPart = generateZipParts.call(this, name, file, compressedObject, localDirLength); localDirLength += zipPart.fileRecord.length + compressedObject.compressedSize; centralDirLength += zipPart.dirRecord.length; zipData.push(zipPart); } var dirEnd = ""; // end of central dir signature dirEnd = signature.CENTRAL_DIRECTORY_END + // number of this disk "\x00\x00" + // number of the disk with the start of the central directory "\x00\x00" + // total number of entries in the central directory on this disk decToHex(zipData.length, 2) + // total number of entries in the central directory decToHex(zipData.length, 2) + // size of the central directory 4 bytes decToHex(centralDirLength, 4) + // offset of start of central directory with respect to the starting disk number decToHex(localDirLength, 4) + // .ZIP file comment length "\x00\x00"; // we have all the parts (and the total length) // time to create a writer ! var typeName = options.type.toLowerCase(); if(typeName==="uint8array"||typeName==="arraybuffer"||typeName==="blob"||typeName==="nodebuffer") { writer = new Uint8ArrayWriter(localDirLength + centralDirLength + dirEnd.length); }else{ writer = new StringWriter(localDirLength + centralDirLength + dirEnd.length); } for (i = 0; i < zipData.length; i++) { writer.append(zipData[i].fileRecord); writer.append(zipData[i].compressedObject.compressedContent); } for (i = 0; i < zipData.length; i++) { writer.append(zipData[i].dirRecord); } writer.append(dirEnd); var zip = writer.finalize(); switch(options.type.toLowerCase()) { // case "zip is an Uint8Array" case "uint8array" : case "arraybuffer" : case "nodebuffer" : return utils.transformTo(options.type.toLowerCase(), zip); case "blob" : return utils.arrayBuffer2Blob(utils.transformTo("arraybuffer", zip)); // case "zip is a string" case "base64" : return (options.base64) ? base64.encode(zip) : zip; default : // case "string" : return zip; } }
javascript
function(options) { options = extend(options || {}, { base64: true, compression: "STORE", type: "base64" }); utils.checkSupport(options.type); var zipData = [], localDirLength = 0, centralDirLength = 0, writer, i; // first, generate all the zip parts. for (var name in this.files) { if (!this.files.hasOwnProperty(name)) { continue; } var file = this.files[name]; var compressionName = file.options.compression || options.compression.toUpperCase(); var compression = compressions[compressionName]; if (!compression) { throw new Error(compressionName + " is not a valid compression method !"); } var compressedObject = generateCompressedObjectFrom.call(this, file, compression); var zipPart = generateZipParts.call(this, name, file, compressedObject, localDirLength); localDirLength += zipPart.fileRecord.length + compressedObject.compressedSize; centralDirLength += zipPart.dirRecord.length; zipData.push(zipPart); } var dirEnd = ""; // end of central dir signature dirEnd = signature.CENTRAL_DIRECTORY_END + // number of this disk "\x00\x00" + // number of the disk with the start of the central directory "\x00\x00" + // total number of entries in the central directory on this disk decToHex(zipData.length, 2) + // total number of entries in the central directory decToHex(zipData.length, 2) + // size of the central directory 4 bytes decToHex(centralDirLength, 4) + // offset of start of central directory with respect to the starting disk number decToHex(localDirLength, 4) + // .ZIP file comment length "\x00\x00"; // we have all the parts (and the total length) // time to create a writer ! var typeName = options.type.toLowerCase(); if(typeName==="uint8array"||typeName==="arraybuffer"||typeName==="blob"||typeName==="nodebuffer") { writer = new Uint8ArrayWriter(localDirLength + centralDirLength + dirEnd.length); }else{ writer = new StringWriter(localDirLength + centralDirLength + dirEnd.length); } for (i = 0; i < zipData.length; i++) { writer.append(zipData[i].fileRecord); writer.append(zipData[i].compressedObject.compressedContent); } for (i = 0; i < zipData.length; i++) { writer.append(zipData[i].dirRecord); } writer.append(dirEnd); var zip = writer.finalize(); switch(options.type.toLowerCase()) { // case "zip is an Uint8Array" case "uint8array" : case "arraybuffer" : case "nodebuffer" : return utils.transformTo(options.type.toLowerCase(), zip); case "blob" : return utils.arrayBuffer2Blob(utils.transformTo("arraybuffer", zip)); // case "zip is a string" case "base64" : return (options.base64) ? base64.encode(zip) : zip; default : // case "string" : return zip; } }
[ "function", "(", "options", ")", "{", "options", "=", "extend", "(", "options", "||", "{", "}", ",", "{", "base64", ":", "true", ",", "compression", ":", "\"STORE\"", ",", "type", ":", "\"base64\"", "}", ")", ";", "utils", ".", "checkSupport", "(", "options", ".", "type", ")", ";", "var", "zipData", "=", "[", "]", ",", "localDirLength", "=", "0", ",", "centralDirLength", "=", "0", ",", "writer", ",", "i", ";", "for", "(", "var", "name", "in", "this", ".", "files", ")", "{", "if", "(", "!", "this", ".", "files", ".", "hasOwnProperty", "(", "name", ")", ")", "{", "continue", ";", "}", "var", "file", "=", "this", ".", "files", "[", "name", "]", ";", "var", "compressionName", "=", "file", ".", "options", ".", "compression", "||", "options", ".", "compression", ".", "toUpperCase", "(", ")", ";", "var", "compression", "=", "compressions", "[", "compressionName", "]", ";", "if", "(", "!", "compression", ")", "{", "throw", "new", "Error", "(", "compressionName", "+", "\" is not a valid compression method !\"", ")", ";", "}", "var", "compressedObject", "=", "generateCompressedObjectFrom", ".", "call", "(", "this", ",", "file", ",", "compression", ")", ";", "var", "zipPart", "=", "generateZipParts", ".", "call", "(", "this", ",", "name", ",", "file", ",", "compressedObject", ",", "localDirLength", ")", ";", "localDirLength", "+=", "zipPart", ".", "fileRecord", ".", "length", "+", "compressedObject", ".", "compressedSize", ";", "centralDirLength", "+=", "zipPart", ".", "dirRecord", ".", "length", ";", "zipData", ".", "push", "(", "zipPart", ")", ";", "}", "var", "dirEnd", "=", "\"\"", ";", "dirEnd", "=", "signature", ".", "CENTRAL_DIRECTORY_END", "+", "\"\\x00\\x00\"", "+", "\\x00", "+", "\\x00", "+", "\"\\x00\\x00\"", "+", "\\x00", "+", "\\x00", "+", "decToHex", "(", "zipData", ".", "length", ",", "2", ")", ";", "decToHex", "(", "zipData", ".", "length", ",", "2", ")", "decToHex", "(", "centralDirLength", ",", "4", ")", "decToHex", "(", "localDirLength", ",", "4", ")", "\"\\x00\\x00\"", "\\x00", "\\x00", "var", "typeName", "=", "options", ".", "type", ".", "toLowerCase", "(", ")", ";", "}" ]
Generate the complete zip file @param {Object} options the options to generate the zip file : - base64, (deprecated, use type instead) true to generate base64. - compression, "STORE" by default. - type, "base64" by default. Values are : string, base64, uint8array, arraybuffer, blob. @return {String|Uint8Array|ArrayBuffer|Buffer|Blob} the zip file
[ "Generate", "the", "complete", "zip", "file" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/thirdparty/jszip.js#L1022-L1116
train
SAP/openui5
src/sap.ui.core/src/sap/ui/thirdparty/jszip.js
stringToArrayLike
function stringToArrayLike(str, array) { for (var i = 0; i < str.length; ++i) { array[i] = str.charCodeAt(i) & 0xFF; } return array; }
javascript
function stringToArrayLike(str, array) { for (var i = 0; i < str.length; ++i) { array[i] = str.charCodeAt(i) & 0xFF; } return array; }
[ "function", "stringToArrayLike", "(", "str", ",", "array", ")", "{", "for", "(", "var", "i", "=", "0", ";", "i", "<", "str", ".", "length", ";", "++", "i", ")", "{", "array", "[", "i", "]", "=", "str", ".", "charCodeAt", "(", "i", ")", "&", "0xFF", ";", "}", "return", "array", ";", "}" ]
Fill in an array with a string. @param {String} str the string to use. @param {Array|ArrayBuffer|Uint8Array|Buffer} array the array to fill in (will be mutated). @return {Array|ArrayBuffer|Uint8Array|Buffer} the updated array.
[ "Fill", "in", "an", "array", "with", "a", "string", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/thirdparty/jszip.js#L1419-L1424
train
SAP/openui5
src/sap.ui.core/src/sap/ui/thirdparty/jszip.js
arrayLikeToArrayLike
function arrayLikeToArrayLike(arrayFrom, arrayTo) { for (var i = 0; i < arrayFrom.length; i++) { arrayTo[i] = arrayFrom[i]; } return arrayTo; }
javascript
function arrayLikeToArrayLike(arrayFrom, arrayTo) { for (var i = 0; i < arrayFrom.length; i++) { arrayTo[i] = arrayFrom[i]; } return arrayTo; }
[ "function", "arrayLikeToArrayLike", "(", "arrayFrom", ",", "arrayTo", ")", "{", "for", "(", "var", "i", "=", "0", ";", "i", "<", "arrayFrom", ".", "length", ";", "i", "++", ")", "{", "arrayTo", "[", "i", "]", "=", "arrayFrom", "[", "i", "]", ";", "}", "return", "arrayTo", ";", "}" ]
Copy the data from an array-like to an other array-like. @param {Array|ArrayBuffer|Uint8Array|Buffer} arrayFrom the origin array. @param {Array|ArrayBuffer|Uint8Array|Buffer} arrayTo the destination array which will be mutated. @return {Array|ArrayBuffer|Uint8Array|Buffer} the updated destination array.
[ "Copy", "the", "data", "from", "an", "array", "-", "like", "to", "an", "other", "array", "-", "like", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/thirdparty/jszip.js#L1492-L1497
train
SAP/openui5
src/sap.ui.core/src/sap/ui/thirdparty/jszip.js
function(expectedSignature) { var signature = this.reader.readString(4); if (signature !== expectedSignature) { throw new Error("Corrupted zip or bug : unexpected signature " + "(" + utils.pretty(signature) + ", expected " + utils.pretty(expectedSignature) + ")"); } }
javascript
function(expectedSignature) { var signature = this.reader.readString(4); if (signature !== expectedSignature) { throw new Error("Corrupted zip or bug : unexpected signature " + "(" + utils.pretty(signature) + ", expected " + utils.pretty(expectedSignature) + ")"); } }
[ "function", "(", "expectedSignature", ")", "{", "var", "signature", "=", "this", ".", "reader", ".", "readString", "(", "4", ")", ";", "if", "(", "signature", "!==", "expectedSignature", ")", "{", "throw", "new", "Error", "(", "\"Corrupted zip or bug : unexpected signature \"", "+", "\"(\"", "+", "utils", ".", "pretty", "(", "signature", ")", "+", "\", expected \"", "+", "utils", ".", "pretty", "(", "expectedSignature", ")", "+", "\")\"", ")", ";", "}", "}" ]
Check that the reader is on the speficied signature. @param {string} expectedSignature the expected signature. @throws {Error} if it is an other signature.
[ "Check", "that", "the", "reader", "is", "on", "the", "speficied", "signature", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/thirdparty/jszip.js#L1713-L1718
train
SAP/openui5
src/sap.ui.core/src/sap/ui/thirdparty/jszip.js
function() { var i, file; for (i = 0; i < this.files.length; i++) { file = this.files[i]; this.reader.setIndex(file.localHeaderOffset); this.checkSignature(sig.LOCAL_FILE_HEADER); file.readLocalPart(this.reader); file.handleUTF8(); } }
javascript
function() { var i, file; for (i = 0; i < this.files.length; i++) { file = this.files[i]; this.reader.setIndex(file.localHeaderOffset); this.checkSignature(sig.LOCAL_FILE_HEADER); file.readLocalPart(this.reader); file.handleUTF8(); } }
[ "function", "(", ")", "{", "var", "i", ",", "file", ";", "for", "(", "i", "=", "0", ";", "i", "<", "this", ".", "files", ".", "length", ";", "i", "++", ")", "{", "file", "=", "this", ".", "files", "[", "i", "]", ";", "this", ".", "reader", ".", "setIndex", "(", "file", ".", "localHeaderOffset", ")", ";", "this", ".", "checkSignature", "(", "sig", ".", "LOCAL_FILE_HEADER", ")", ";", "file", ".", "readLocalPart", "(", "this", ".", "reader", ")", ";", "file", ".", "handleUTF8", "(", ")", ";", "}", "}" ]
Read the local files, based on the offset read in the central part.
[ "Read", "the", "local", "files", "based", "on", "the", "offset", "read", "in", "the", "central", "part", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/thirdparty/jszip.js#L1781-L1790
train
SAP/openui5
src/sap.ui.core/src/sap/ui/thirdparty/jszip.js
function() { var offset = this.reader.lastIndexOfSignature(sig.CENTRAL_DIRECTORY_END); if (offset === -1) { throw new Error("Corrupted zip : can't find end of central directory"); } this.reader.setIndex(offset); this.checkSignature(sig.CENTRAL_DIRECTORY_END); this.readBlockEndOfCentral(); /* extract from the zip spec : 4) If one of the fields in the end of central directory record is too small to hold required data, the field should be set to -1 (0xFFFF or 0xFFFFFFFF) and the ZIP64 format record should be created. 5) The end of central directory record and the Zip64 end of central directory locator record must reside on the same disk when splitting or spanning an archive. */ if (this.diskNumber === utils.MAX_VALUE_16BITS || this.diskWithCentralDirStart === utils.MAX_VALUE_16BITS || this.centralDirRecordsOnThisDisk === utils.MAX_VALUE_16BITS || this.centralDirRecords === utils.MAX_VALUE_16BITS || this.centralDirSize === utils.MAX_VALUE_32BITS || this.centralDirOffset === utils.MAX_VALUE_32BITS) { this.zip64 = true; /* Warning : the zip64 extension is supported, but ONLY if the 64bits integer read from the zip file can fit into a 32bits integer. This cannot be solved : Javascript represents all numbers as 64-bit double precision IEEE 754 floating point numbers. So, we have 53bits for integers and bitwise operations treat everything as 32bits. see https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Operators/Bitwise_Operators and http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-262.pdf section 8.5 */ // should look for a zip64 EOCD locator offset = this.reader.lastIndexOfSignature(sig.ZIP64_CENTRAL_DIRECTORY_LOCATOR); if (offset === -1) { throw new Error("Corrupted zip : can't find the ZIP64 end of central directory locator"); } this.reader.setIndex(offset); this.checkSignature(sig.ZIP64_CENTRAL_DIRECTORY_LOCATOR); this.readBlockZip64EndOfCentralLocator(); // now the zip64 EOCD record this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir); this.checkSignature(sig.ZIP64_CENTRAL_DIRECTORY_END); this.readBlockZip64EndOfCentral(); } }
javascript
function() { var offset = this.reader.lastIndexOfSignature(sig.CENTRAL_DIRECTORY_END); if (offset === -1) { throw new Error("Corrupted zip : can't find end of central directory"); } this.reader.setIndex(offset); this.checkSignature(sig.CENTRAL_DIRECTORY_END); this.readBlockEndOfCentral(); /* extract from the zip spec : 4) If one of the fields in the end of central directory record is too small to hold required data, the field should be set to -1 (0xFFFF or 0xFFFFFFFF) and the ZIP64 format record should be created. 5) The end of central directory record and the Zip64 end of central directory locator record must reside on the same disk when splitting or spanning an archive. */ if (this.diskNumber === utils.MAX_VALUE_16BITS || this.diskWithCentralDirStart === utils.MAX_VALUE_16BITS || this.centralDirRecordsOnThisDisk === utils.MAX_VALUE_16BITS || this.centralDirRecords === utils.MAX_VALUE_16BITS || this.centralDirSize === utils.MAX_VALUE_32BITS || this.centralDirOffset === utils.MAX_VALUE_32BITS) { this.zip64 = true; /* Warning : the zip64 extension is supported, but ONLY if the 64bits integer read from the zip file can fit into a 32bits integer. This cannot be solved : Javascript represents all numbers as 64-bit double precision IEEE 754 floating point numbers. So, we have 53bits for integers and bitwise operations treat everything as 32bits. see https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Operators/Bitwise_Operators and http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-262.pdf section 8.5 */ // should look for a zip64 EOCD locator offset = this.reader.lastIndexOfSignature(sig.ZIP64_CENTRAL_DIRECTORY_LOCATOR); if (offset === -1) { throw new Error("Corrupted zip : can't find the ZIP64 end of central directory locator"); } this.reader.setIndex(offset); this.checkSignature(sig.ZIP64_CENTRAL_DIRECTORY_LOCATOR); this.readBlockZip64EndOfCentralLocator(); // now the zip64 EOCD record this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir); this.checkSignature(sig.ZIP64_CENTRAL_DIRECTORY_END); this.readBlockZip64EndOfCentral(); } }
[ "function", "(", ")", "{", "var", "offset", "=", "this", ".", "reader", ".", "lastIndexOfSignature", "(", "sig", ".", "CENTRAL_DIRECTORY_END", ")", ";", "if", "(", "offset", "===", "-", "1", ")", "{", "throw", "new", "Error", "(", "\"Corrupted zip : can't find end of central directory\"", ")", ";", "}", "this", ".", "reader", ".", "setIndex", "(", "offset", ")", ";", "this", ".", "checkSignature", "(", "sig", ".", "CENTRAL_DIRECTORY_END", ")", ";", "this", ".", "readBlockEndOfCentral", "(", ")", ";", "if", "(", "this", ".", "diskNumber", "===", "utils", ".", "MAX_VALUE_16BITS", "||", "this", ".", "diskWithCentralDirStart", "===", "utils", ".", "MAX_VALUE_16BITS", "||", "this", ".", "centralDirRecordsOnThisDisk", "===", "utils", ".", "MAX_VALUE_16BITS", "||", "this", ".", "centralDirRecords", "===", "utils", ".", "MAX_VALUE_16BITS", "||", "this", ".", "centralDirSize", "===", "utils", ".", "MAX_VALUE_32BITS", "||", "this", ".", "centralDirOffset", "===", "utils", ".", "MAX_VALUE_32BITS", ")", "{", "this", ".", "zip64", "=", "true", ";", "offset", "=", "this", ".", "reader", ".", "lastIndexOfSignature", "(", "sig", ".", "ZIP64_CENTRAL_DIRECTORY_LOCATOR", ")", ";", "if", "(", "offset", "===", "-", "1", ")", "{", "throw", "new", "Error", "(", "\"Corrupted zip : can't find the ZIP64 end of central directory locator\"", ")", ";", "}", "this", ".", "reader", ".", "setIndex", "(", "offset", ")", ";", "this", ".", "checkSignature", "(", "sig", ".", "ZIP64_CENTRAL_DIRECTORY_LOCATOR", ")", ";", "this", ".", "readBlockZip64EndOfCentralLocator", "(", ")", ";", "this", ".", "reader", ".", "setIndex", "(", "this", ".", "relativeOffsetEndOfZip64CentralDir", ")", ";", "this", ".", "checkSignature", "(", "sig", ".", "ZIP64_CENTRAL_DIRECTORY_END", ")", ";", "this", ".", "readBlockZip64EndOfCentral", "(", ")", ";", "}", "}" ]
Read the end of central directory.
[ "Read", "the", "end", "of", "central", "directory", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/thirdparty/jszip.js#L1809-L1855
train
SAP/openui5
src/sap.ui.core/src/sap/ui/thirdparty/jszip.js
function(reader, from, length, compression, uncompressedSize) { return function() { var compressedFileData = utils.transformTo(compression.uncompressInputType, this.getCompressedContent()); var uncompressedFileData = compression.uncompress(compressedFileData); if (uncompressedFileData.length !== uncompressedSize) { throw new Error("Bug : uncompressed data size mismatch"); } return uncompressedFileData; }; }
javascript
function(reader, from, length, compression, uncompressedSize) { return function() { var compressedFileData = utils.transformTo(compression.uncompressInputType, this.getCompressedContent()); var uncompressedFileData = compression.uncompress(compressedFileData); if (uncompressedFileData.length !== uncompressedSize) { throw new Error("Bug : uncompressed data size mismatch"); } return uncompressedFileData; }; }
[ "function", "(", "reader", ",", "from", ",", "length", ",", "compression", ",", "uncompressedSize", ")", "{", "return", "function", "(", ")", "{", "var", "compressedFileData", "=", "utils", ".", "transformTo", "(", "compression", ".", "uncompressInputType", ",", "this", ".", "getCompressedContent", "(", ")", ")", ";", "var", "uncompressedFileData", "=", "compression", ".", "uncompress", "(", "compressedFileData", ")", ";", "if", "(", "uncompressedFileData", ".", "length", "!==", "uncompressedSize", ")", "{", "throw", "new", "Error", "(", "\"Bug : uncompressed data size mismatch\"", ")", ";", "}", "return", "uncompressedFileData", ";", "}", ";", "}" ]
Prepare the function used to generate the uncompressed content from this ZipFile. @param {DataReader} reader the reader to use. @param {number} from the offset from where we should read the data. @param {number} length the length of the data to read. @param {JSZip.compression} compression the compression used on this file. @param {number} uncompressedSize the uncompressed size to expect. @return {Function} the callback to get the uncompressed content (the type depends of the DataReader class).
[ "Prepare", "the", "function", "used", "to", "generate", "the", "uncompressed", "content", "from", "this", "ZipFile", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/thirdparty/jszip.js#L1942-L1954
train
SAP/openui5
src/sap.ui.support/src/sap/ui/support/supportRules/ui/models/SelectionUtils.js
function (oTreeViewModelRules) { var aSelectedRules = storage.getSelectedRules(); if (!aSelectedRules) { return null; } if (!oTreeViewModelRules) { return null; } aSelectedRules.forEach(function (oRuleDescriptor) { Object.keys(oTreeViewModelRules).forEach(function(iKey) { oTreeViewModelRules[iKey].nodes.forEach(function(oRule) { if (oRule.id === oRuleDescriptor.ruleId) { oRule.selected = oRuleDescriptor.selected; if (!oRule.selected) { oTreeViewModelRules[iKey].selected = false; } } }); }); }); return oTreeViewModelRules; }
javascript
function (oTreeViewModelRules) { var aSelectedRules = storage.getSelectedRules(); if (!aSelectedRules) { return null; } if (!oTreeViewModelRules) { return null; } aSelectedRules.forEach(function (oRuleDescriptor) { Object.keys(oTreeViewModelRules).forEach(function(iKey) { oTreeViewModelRules[iKey].nodes.forEach(function(oRule) { if (oRule.id === oRuleDescriptor.ruleId) { oRule.selected = oRuleDescriptor.selected; if (!oRule.selected) { oTreeViewModelRules[iKey].selected = false; } } }); }); }); return oTreeViewModelRules; }
[ "function", "(", "oTreeViewModelRules", ")", "{", "var", "aSelectedRules", "=", "storage", ".", "getSelectedRules", "(", ")", ";", "if", "(", "!", "aSelectedRules", ")", "{", "return", "null", ";", "}", "if", "(", "!", "oTreeViewModelRules", ")", "{", "return", "null", ";", "}", "aSelectedRules", ".", "forEach", "(", "function", "(", "oRuleDescriptor", ")", "{", "Object", ".", "keys", "(", "oTreeViewModelRules", ")", ".", "forEach", "(", "function", "(", "iKey", ")", "{", "oTreeViewModelRules", "[", "iKey", "]", ".", "nodes", ".", "forEach", "(", "function", "(", "oRule", ")", "{", "if", "(", "oRule", ".", "id", "===", "oRuleDescriptor", ".", "ruleId", ")", "{", "oRule", ".", "selected", "=", "oRuleDescriptor", ".", "selected", ";", "if", "(", "!", "oRule", ".", "selected", ")", "{", "oTreeViewModelRules", "[", "iKey", "]", ".", "selected", "=", "false", ";", "}", "}", "}", ")", ";", "}", ")", ";", "}", ")", ";", "return", "oTreeViewModelRules", ";", "}" ]
Traverses the model and updates the selection flag for the selected rules @returns {Array} Rule selections array
[ "Traverses", "the", "model", "and", "updates", "the", "selection", "flag", "for", "the", "selected", "rules" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.support/src/sap/ui/support/supportRules/ui/models/SelectionUtils.js#L72-L98
train
SAP/openui5
src/sap.ui.support/src/sap/ui/support/supportRules/ui/models/SelectionUtils.js
function (aSelectedRules) { var oTreeViewModelRules = this.model.getProperty("/treeModel"); // deselect all Object.keys(oTreeViewModelRules).forEach(function(iKey) { oTreeViewModelRules[iKey].nodes.forEach(function(oRule) { oRule.selected = false; }); }); // select those from aSelectedRules aSelectedRules.forEach(function (oRuleDescriptor) { Object.keys(oTreeViewModelRules).forEach(function(iKey) { oTreeViewModelRules[iKey].nodes.forEach(function(oRule) { if (oRule.id === oRuleDescriptor.ruleId) { oRule.selected = true; } }); }); }); // syncs the parent and child selected/deselected state this.treeTable.syncParentNoteWithChildrenNotes(oTreeViewModelRules); // apply selection to ui this.treeTable.updateSelectionFromModel(); // update the count in ui this.getSelectedRules(); if (storage.readPersistenceCookie(constants.COOKIE_NAME)) { this.persistSelection(); } }
javascript
function (aSelectedRules) { var oTreeViewModelRules = this.model.getProperty("/treeModel"); // deselect all Object.keys(oTreeViewModelRules).forEach(function(iKey) { oTreeViewModelRules[iKey].nodes.forEach(function(oRule) { oRule.selected = false; }); }); // select those from aSelectedRules aSelectedRules.forEach(function (oRuleDescriptor) { Object.keys(oTreeViewModelRules).forEach(function(iKey) { oTreeViewModelRules[iKey].nodes.forEach(function(oRule) { if (oRule.id === oRuleDescriptor.ruleId) { oRule.selected = true; } }); }); }); // syncs the parent and child selected/deselected state this.treeTable.syncParentNoteWithChildrenNotes(oTreeViewModelRules); // apply selection to ui this.treeTable.updateSelectionFromModel(); // update the count in ui this.getSelectedRules(); if (storage.readPersistenceCookie(constants.COOKIE_NAME)) { this.persistSelection(); } }
[ "function", "(", "aSelectedRules", ")", "{", "var", "oTreeViewModelRules", "=", "this", ".", "model", ".", "getProperty", "(", "\"/treeModel\"", ")", ";", "Object", ".", "keys", "(", "oTreeViewModelRules", ")", ".", "forEach", "(", "function", "(", "iKey", ")", "{", "oTreeViewModelRules", "[", "iKey", "]", ".", "nodes", ".", "forEach", "(", "function", "(", "oRule", ")", "{", "oRule", ".", "selected", "=", "false", ";", "}", ")", ";", "}", ")", ";", "aSelectedRules", ".", "forEach", "(", "function", "(", "oRuleDescriptor", ")", "{", "Object", ".", "keys", "(", "oTreeViewModelRules", ")", ".", "forEach", "(", "function", "(", "iKey", ")", "{", "oTreeViewModelRules", "[", "iKey", "]", ".", "nodes", ".", "forEach", "(", "function", "(", "oRule", ")", "{", "if", "(", "oRule", ".", "id", "===", "oRuleDescriptor", ".", "ruleId", ")", "{", "oRule", ".", "selected", "=", "true", ";", "}", "}", ")", ";", "}", ")", ";", "}", ")", ";", "this", ".", "treeTable", ".", "syncParentNoteWithChildrenNotes", "(", "oTreeViewModelRules", ")", ";", "this", ".", "treeTable", ".", "updateSelectionFromModel", "(", ")", ";", "this", ".", "getSelectedRules", "(", ")", ";", "if", "(", "storage", ".", "readPersistenceCookie", "(", "constants", ".", "COOKIE_NAME", ")", ")", "{", "this", ".", "persistSelection", "(", ")", ";", "}", "}" ]
Sets the selected rules in the same format in which they are imported @param {Array} aSelectedRules The selected rules - same as the result of getSelectedRulesPlain
[ "Sets", "the", "selected", "rules", "in", "the", "same", "format", "in", "which", "they", "are", "imported" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.support/src/sap/ui/support/supportRules/ui/models/SelectionUtils.js#L114-L147
train
SAP/openui5
src/sap.ui.support/src/sap/ui/support/supportRules/ui/models/SelectionUtils.js
function (tempTreeModelWithAdditionalRuleSets, oTreeModelWithSelection) { Object.keys(tempTreeModelWithAdditionalRuleSets).forEach(function(iKey) { Object.keys(oTreeModelWithSelection).forEach(function(iKey) { if (tempTreeModelWithAdditionalRuleSets[iKey].id === oTreeModelWithSelection[iKey].id) { tempTreeModelWithAdditionalRuleSets[iKey] = oTreeModelWithSelection[iKey]; } }); }); return tempTreeModelWithAdditionalRuleSets; }
javascript
function (tempTreeModelWithAdditionalRuleSets, oTreeModelWithSelection) { Object.keys(tempTreeModelWithAdditionalRuleSets).forEach(function(iKey) { Object.keys(oTreeModelWithSelection).forEach(function(iKey) { if (tempTreeModelWithAdditionalRuleSets[iKey].id === oTreeModelWithSelection[iKey].id) { tempTreeModelWithAdditionalRuleSets[iKey] = oTreeModelWithSelection[iKey]; } }); }); return tempTreeModelWithAdditionalRuleSets; }
[ "function", "(", "tempTreeModelWithAdditionalRuleSets", ",", "oTreeModelWithSelection", ")", "{", "Object", ".", "keys", "(", "tempTreeModelWithAdditionalRuleSets", ")", ".", "forEach", "(", "function", "(", "iKey", ")", "{", "Object", ".", "keys", "(", "oTreeModelWithSelection", ")", ".", "forEach", "(", "function", "(", "iKey", ")", "{", "if", "(", "tempTreeModelWithAdditionalRuleSets", "[", "iKey", "]", ".", "id", "===", "oTreeModelWithSelection", "[", "iKey", "]", ".", "id", ")", "{", "tempTreeModelWithAdditionalRuleSets", "[", "iKey", "]", "=", "oTreeModelWithSelection", "[", "iKey", "]", ";", "}", "}", ")", ";", "}", ")", ";", "return", "tempTreeModelWithAdditionalRuleSets", ";", "}" ]
Applies selection to the tree model after reinitializing model with additional rulesets. @param {Object} tempTreeModelWithAdditionalRuleSets tree model with no selection @param {Object} oTreeModelWithSelection tree model with selection before loading additional rulesets @returns {Object} oTreeModelWhitAdditionalRuleSets updated selection model
[ "Applies", "selection", "to", "the", "tree", "model", "after", "reinitializing", "model", "with", "additional", "rulesets", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.support/src/sap/ui/support/supportRules/ui/models/SelectionUtils.js#L156-L167
train
SAP/openui5
src/sap.ui.support/src/sap/ui/support/supportRules/ui/models/SelectionUtils.js
function (oTreeModel, aAdditionalRuleSetsNames) { if (!aAdditionalRuleSetsNames) { return; } aAdditionalRuleSetsNames.forEach(function (sRuleName) { Object.keys(oTreeModel).forEach(function(iKey) { if (oTreeModel[iKey].name === sRuleName) { oTreeModel[iKey].selected = false; oTreeModel[iKey].nodes.forEach(function(oRule){ oRule.selected = false; }); } }); }); return oTreeModel; }
javascript
function (oTreeModel, aAdditionalRuleSetsNames) { if (!aAdditionalRuleSetsNames) { return; } aAdditionalRuleSetsNames.forEach(function (sRuleName) { Object.keys(oTreeModel).forEach(function(iKey) { if (oTreeModel[iKey].name === sRuleName) { oTreeModel[iKey].selected = false; oTreeModel[iKey].nodes.forEach(function(oRule){ oRule.selected = false; }); } }); }); return oTreeModel; }
[ "function", "(", "oTreeModel", ",", "aAdditionalRuleSetsNames", ")", "{", "if", "(", "!", "aAdditionalRuleSetsNames", ")", "{", "return", ";", "}", "aAdditionalRuleSetsNames", ".", "forEach", "(", "function", "(", "sRuleName", ")", "{", "Object", ".", "keys", "(", "oTreeModel", ")", ".", "forEach", "(", "function", "(", "iKey", ")", "{", "if", "(", "oTreeModel", "[", "iKey", "]", ".", "name", "===", "sRuleName", ")", "{", "oTreeModel", "[", "iKey", "]", ".", "selected", "=", "false", ";", "oTreeModel", "[", "iKey", "]", ".", "nodes", ".", "forEach", "(", "function", "(", "oRule", ")", "{", "oRule", ".", "selected", "=", "false", ";", "}", ")", ";", "}", "}", ")", ";", "}", ")", ";", "return", "oTreeModel", ";", "}" ]
Deselect additional rulesets in model @param {Object} oTreeModel tree model with loaded additional ruleset(s) @param {Array} aAdditionalRuleSetsNames additional ruleset(s) name @returns {Object} oTreeModel updated selection model
[ "Deselect", "additional", "rulesets", "in", "model" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.support/src/sap/ui/support/supportRules/ui/models/SelectionUtils.js#L175-L193
train
SAP/openui5
src/sap.m/src/sap/m/TimePicker.js
genValidHourValues
function genValidHourValues(b24H, sLeadingChar) { var iStart = b24H ? 0 : 1, b2400 = this._oTimePicker.getSupport2400() ? 24 : 23,//if getSupport2400, the user could type 24 in the input iEnd = b24H ? b2400 : 12; return genValues(iStart, iEnd, sLeadingChar); }
javascript
function genValidHourValues(b24H, sLeadingChar) { var iStart = b24H ? 0 : 1, b2400 = this._oTimePicker.getSupport2400() ? 24 : 23,//if getSupport2400, the user could type 24 in the input iEnd = b24H ? b2400 : 12; return genValues(iStart, iEnd, sLeadingChar); }
[ "function", "genValidHourValues", "(", "b24H", ",", "sLeadingChar", ")", "{", "var", "iStart", "=", "b24H", "?", "0", ":", "1", ",", "b2400", "=", "this", ".", "_oTimePicker", ".", "getSupport2400", "(", ")", "?", "24", ":", "23", ",", "iEnd", "=", "b24H", "?", "b2400", ":", "12", ";", "return", "genValues", "(", "iStart", ",", "iEnd", ",", "sLeadingChar", ")", ";", "}" ]
not too expensive to generate all values that are valid hour values
[ "not", "too", "expensive", "to", "generate", "all", "values", "that", "are", "valid", "hour", "values" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.m/src/sap/m/TimePicker.js#L1462-L1468
train
SAP/openui5
src/sap.ui.core/src/sap/ui/core/routing/TargetCache.js
function (oOptions, sType) { var oObject; try { if (sType === "Component" && !this.async) { Log.error("sap.ui.core.routing.Target doesn't support loading component in synchronous mode, please switch routing to async"); throw new Error("sap.ui.core.routing.Target doesn't support loading component in synchronous mode, please switch routing to async"); } if (!oOptions) { Log.error("the oOptions parameter of getObject is mandatory", this); throw new Error("the oOptions parameter of getObject is mandatory"); } oObject = this._get(oOptions, sType); } catch (e) { return Promise.reject(e); } if (oObject instanceof Promise) { return oObject; } else if (oObject.isA("sap.ui.core.mvc.View")) { return oObject.loaded(); } else { return Promise.resolve(oObject); } }
javascript
function (oOptions, sType) { var oObject; try { if (sType === "Component" && !this.async) { Log.error("sap.ui.core.routing.Target doesn't support loading component in synchronous mode, please switch routing to async"); throw new Error("sap.ui.core.routing.Target doesn't support loading component in synchronous mode, please switch routing to async"); } if (!oOptions) { Log.error("the oOptions parameter of getObject is mandatory", this); throw new Error("the oOptions parameter of getObject is mandatory"); } oObject = this._get(oOptions, sType); } catch (e) { return Promise.reject(e); } if (oObject instanceof Promise) { return oObject; } else if (oObject.isA("sap.ui.core.mvc.View")) { return oObject.loaded(); } else { return Promise.resolve(oObject); } }
[ "function", "(", "oOptions", ",", "sType", ")", "{", "var", "oObject", ";", "try", "{", "if", "(", "sType", "===", "\"Component\"", "&&", "!", "this", ".", "async", ")", "{", "Log", ".", "error", "(", "\"sap.ui.core.routing.Target doesn't support loading component in synchronous mode, please switch routing to async\"", ")", ";", "throw", "new", "Error", "(", "\"sap.ui.core.routing.Target doesn't support loading component in synchronous mode, please switch routing to async\"", ")", ";", "}", "if", "(", "!", "oOptions", ")", "{", "Log", ".", "error", "(", "\"the oOptions parameter of getObject is mandatory\"", ",", "this", ")", ";", "throw", "new", "Error", "(", "\"the oOptions parameter of getObject is mandatory\"", ")", ";", "}", "oObject", "=", "this", ".", "_get", "(", "oOptions", ",", "sType", ")", ";", "}", "catch", "(", "e", ")", "{", "return", "Promise", ".", "reject", "(", "e", ")", ";", "}", "if", "(", "oObject", "instanceof", "Promise", ")", "{", "return", "oObject", ";", "}", "else", "if", "(", "oObject", ".", "isA", "(", "\"sap.ui.core.mvc.View\"", ")", ")", "{", "return", "oObject", ".", "loaded", "(", ")", ";", "}", "else", "{", "return", "Promise", ".", "resolve", "(", "oObject", ")", ";", "}", "}" ]
Returns a cached view or component, for a given name. If it does not exist yet, it will create the view or component with the provided options. If you provide a "id" in the "oOptions", it will be prefixed with the id of the component. @param {object} oOptions see {@link sap.ui.core.mvc.View.create} or {@link sap.ui.core.Component.create} for the documentation. @param {string} oOptions.name If you do not use setView please see {@link sap.ui.core.mvc.View.create} or {@link sap.ui.core.Component.create} for the documentation. This is used as a key in the cache of the view or component instance. If you want to retrieve a view or a component that has been given an alternative name in {@link #set}, you need to provide the same name here and you can skip all the other options. @param {string} [oOptions.id] The id you pass into the options will be prefixed with the id of the component you pass into the constructor. So you can retrieve the view later by calling the {@link sap.ui.core.UIComponent#byId} function of the UIComponent. @param {string} sType whether the object is a "View" or "Component". Views and components are stored separately in the cache. This means that a view and a component instance could be stored under the same name. @return {Promise} A promise that is resolved when the view or component is loaded. The view or component instance will be passed to the resolve function. @private
[ "Returns", "a", "cached", "view", "or", "component", "for", "a", "given", "name", ".", "If", "it", "does", "not", "exist", "yet", "it", "will", "create", "the", "view", "or", "component", "with", "the", "provided", "options", ".", "If", "you", "provide", "a", "id", "in", "the", "oOptions", "it", "will", "be", "prefixed", "with", "the", "id", "of", "the", "component", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/routing/TargetCache.js#L91-L117
train
SAP/openui5
src/sap.ui.core/src/sap/ui/core/routing/TargetCache.js
function (sName, sType, oObject) { var oInstanceCache; this._checkName(sName, sType); assert(sType === "View" || sType === "Component", "sType must be either 'View' or 'Component'"); oInstanceCache = this._oCache[sType.toLowerCase()][sName]; if (!oInstanceCache) { oInstanceCache = this._oCache[sType.toLowerCase()][sName] = {}; } oInstanceCache[undefined] = oObject; return this; }
javascript
function (sName, sType, oObject) { var oInstanceCache; this._checkName(sName, sType); assert(sType === "View" || sType === "Component", "sType must be either 'View' or 'Component'"); oInstanceCache = this._oCache[sType.toLowerCase()][sName]; if (!oInstanceCache) { oInstanceCache = this._oCache[sType.toLowerCase()][sName] = {}; } oInstanceCache[undefined] = oObject; return this; }
[ "function", "(", "sName", ",", "sType", ",", "oObject", ")", "{", "var", "oInstanceCache", ";", "this", ".", "_checkName", "(", "sName", ",", "sType", ")", ";", "assert", "(", "sType", "===", "\"View\"", "||", "sType", "===", "\"Component\"", ",", "\"sType must be either 'View' or 'Component'\"", ")", ";", "oInstanceCache", "=", "this", ".", "_oCache", "[", "sType", ".", "toLowerCase", "(", ")", "]", "[", "sName", "]", ";", "if", "(", "!", "oInstanceCache", ")", "{", "oInstanceCache", "=", "this", ".", "_oCache", "[", "sType", ".", "toLowerCase", "(", ")", "]", "[", "sName", "]", "=", "{", "}", ";", "}", "oInstanceCache", "[", "undefined", "]", "=", "oObject", ";", "return", "this", ";", "}" ]
Adds or overwrites a view or a component in the TargetCache. The given object is cached under its name and the 'undefined' key. If the third parameter is set to null or undefined, the previous cache view or component under the same name isn't managed by the TargetCache instance. The lifecycle (for example the destroy) of the view or component instance should be maintained by additional code. @param {string} sName Name of the view or component, may differ from the actual name of the oObject parameter provided, since you can retrieve this view or component per {@link #.getObject}. @param {string} sType whether the object is a "View" or "Component". Views and components are stored separately in the cache. This means that a view and a component instance could be stored under the same name. @param {sap.ui.core.mvc.View|sap.ui.core.UIComponent|null|undefined} oObject the view or component instance @return {sap.ui.core.routing.TargetCache} this for chaining. @private
[ "Adds", "or", "overwrites", "a", "view", "or", "a", "component", "in", "the", "TargetCache", ".", "The", "given", "object", "is", "cached", "under", "its", "name", "and", "the", "undefined", "key", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/routing/TargetCache.js#L133-L148
train
SAP/openui5
src/sap.ui.core/src/sap/ui/core/routing/TargetCache.js
function () { EventProvider.prototype.destroy.apply(this); if (this.bIsDestroyed) { return this; } function destroyObject(oObject) { if (oObject && oObject.destroy) { oObject.destroy(); } } Object.keys(this._oCache).forEach(function (sType) { var oTypeCache = this._oCache[sType]; Object.keys(oTypeCache).forEach(function (sKey) { var oInstanceCache = oTypeCache[sKey]; Object.keys(oInstanceCache).forEach(function(sId) { var vObject = oInstanceCache[sId]; if (vObject instanceof Promise) { // if the promise isn't replaced by the real object yet // wait until the promise resolves to destroy the object vObject.then(destroyObject); } else { destroyObject(vObject); } }); }); }.bind(this)); this._oCache = undefined; this.bIsDestroyed = true; return this; }
javascript
function () { EventProvider.prototype.destroy.apply(this); if (this.bIsDestroyed) { return this; } function destroyObject(oObject) { if (oObject && oObject.destroy) { oObject.destroy(); } } Object.keys(this._oCache).forEach(function (sType) { var oTypeCache = this._oCache[sType]; Object.keys(oTypeCache).forEach(function (sKey) { var oInstanceCache = oTypeCache[sKey]; Object.keys(oInstanceCache).forEach(function(sId) { var vObject = oInstanceCache[sId]; if (vObject instanceof Promise) { // if the promise isn't replaced by the real object yet // wait until the promise resolves to destroy the object vObject.then(destroyObject); } else { destroyObject(vObject); } }); }); }.bind(this)); this._oCache = undefined; this.bIsDestroyed = true; return this; }
[ "function", "(", ")", "{", "EventProvider", ".", "prototype", ".", "destroy", ".", "apply", "(", "this", ")", ";", "if", "(", "this", ".", "bIsDestroyed", ")", "{", "return", "this", ";", "}", "function", "destroyObject", "(", "oObject", ")", "{", "if", "(", "oObject", "&&", "oObject", ".", "destroy", ")", "{", "oObject", ".", "destroy", "(", ")", ";", "}", "}", "Object", ".", "keys", "(", "this", ".", "_oCache", ")", ".", "forEach", "(", "function", "(", "sType", ")", "{", "var", "oTypeCache", "=", "this", ".", "_oCache", "[", "sType", "]", ";", "Object", ".", "keys", "(", "oTypeCache", ")", ".", "forEach", "(", "function", "(", "sKey", ")", "{", "var", "oInstanceCache", "=", "oTypeCache", "[", "sKey", "]", ";", "Object", ".", "keys", "(", "oInstanceCache", ")", ".", "forEach", "(", "function", "(", "sId", ")", "{", "var", "vObject", "=", "oInstanceCache", "[", "sId", "]", ";", "if", "(", "vObject", "instanceof", "Promise", ")", "{", "vObject", ".", "then", "(", "destroyObject", ")", ";", "}", "else", "{", "destroyObject", "(", "vObject", ")", ";", "}", "}", ")", ";", "}", ")", ";", "}", ".", "bind", "(", "this", ")", ")", ";", "this", ".", "_oCache", "=", "undefined", ";", "this", ".", "bIsDestroyed", "=", "true", ";", "return", "this", ";", "}" ]
Destroys all the views and components created by this instance. @returns {sap.ui.core.routing.TargetCache} this for chaining.
[ "Destroys", "all", "the", "views", "and", "components", "created", "by", "this", "instance", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/routing/TargetCache.js#L155-L188
train
SAP/openui5
src/sap.ui.core/src/sap/ui/core/routing/TargetCache.js
function (sName, sType) { if (!sName) { var sMessage = "A name for the " + sType.toLowerCase() + " has to be defined"; Log.error(sMessage, this); throw Error(sMessage); } }
javascript
function (sName, sType) { if (!sName) { var sMessage = "A name for the " + sType.toLowerCase() + " has to be defined"; Log.error(sMessage, this); throw Error(sMessage); } }
[ "function", "(", "sName", ",", "sType", ")", "{", "if", "(", "!", "sName", ")", "{", "var", "sMessage", "=", "\"A name for the \"", "+", "sType", ".", "toLowerCase", "(", ")", "+", "\" has to be defined\"", ";", "Log", ".", "error", "(", "sMessage", ",", "this", ")", ";", "throw", "Error", "(", "sMessage", ")", ";", "}", "}" ]
hook for the deprecated property viewId on the route, will not prefix the id with the component @name sap.ui.core.routing.TargetCache#_getViewWithGlobalId @returns {*} @private @param {string} sName logs an error if it is empty or undefined @param {string} sType whether it's a 'View' or 'Component' @private
[ "hook", "for", "the", "deprecated", "property", "viewId", "on", "the", "route", "will", "not", "prefix", "the", "id", "with", "the", "component" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/routing/TargetCache.js#L305-L313
train
SAP/openui5
src/sap.ui.core/src/sap/ui/core/HTMLRenderer.js
function(oRM, oControl) { // render an invisible, but easily identifiable placeholder for the content oRM.write("<div id=\"" + RenderPrefixes.Dummy + oControl.getId() + "\" style=\"display:none\">"); // Note: we do not render the content string here, but only in onAfterRendering // This has the advantage that syntax errors don't affect the whole control tree // but only this control... oRM.write("</div>"); }
javascript
function(oRM, oControl) { // render an invisible, but easily identifiable placeholder for the content oRM.write("<div id=\"" + RenderPrefixes.Dummy + oControl.getId() + "\" style=\"display:none\">"); // Note: we do not render the content string here, but only in onAfterRendering // This has the advantage that syntax errors don't affect the whole control tree // but only this control... oRM.write("</div>"); }
[ "function", "(", "oRM", ",", "oControl", ")", "{", "oRM", ".", "write", "(", "\"<div id=\\\"\"", "+", "\\\"", "+", "RenderPrefixes", ".", "Dummy", "+", "oControl", ".", "getId", "(", ")", ")", ";", "\"\\\" style=\\\"display:none\\\">\"", "}" ]
Renders either the configured content or a dummy div that will be replaced after rendering @param {sap.ui.core.RenderManager} [oRM] The RenderManager instance @param {sap.ui.core.Control} [oControl] The instance of the invisible control
[ "Renders", "either", "the", "configured", "content", "or", "a", "dummy", "div", "that", "will", "be", "replaced", "after", "rendering" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/HTMLRenderer.js#L21-L30
train
SAP/openui5
lib/jsdoc/create-api-index.js
cleanTree
function cleanTree (oSymbol) { delete oSymbol.treeName; delete oSymbol.parent; if (oSymbol.children) { oSymbol.children.forEach(o => cleanTree(o)); } }
javascript
function cleanTree (oSymbol) { delete oSymbol.treeName; delete oSymbol.parent; if (oSymbol.children) { oSymbol.children.forEach(o => cleanTree(o)); } }
[ "function", "cleanTree", "(", "oSymbol", ")", "{", "delete", "oSymbol", ".", "treeName", ";", "delete", "oSymbol", ".", "parent", ";", "if", "(", "oSymbol", ".", "children", ")", "{", "oSymbol", ".", "children", ".", "forEach", "(", "o", "=>", "cleanTree", "(", "o", ")", ")", ";", "}", "}" ]
Clean tree - keep file size down
[ "Clean", "tree", "-", "keep", "file", "size", "down" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/lib/jsdoc/create-api-index.js#L329-L335
train
SAP/openui5
src/sap.ui.core/src/sap/ui/model/odata/v4/lib/_Parser.js
addInfixOperator
function addInfixOperator(sId, iLbp) { // Note: this function is executed at load time only! mFilterParserSymbols[sId] = { lbp : iLbp, led : function (oToken, oLeft) { oToken.type = "Edm.Boolean"; // Note: currently we only support logical operators oToken.precedence = iLbp; oToken.left = oLeft; oToken.right = this.expression(iLbp); return oToken; } }; }
javascript
function addInfixOperator(sId, iLbp) { // Note: this function is executed at load time only! mFilterParserSymbols[sId] = { lbp : iLbp, led : function (oToken, oLeft) { oToken.type = "Edm.Boolean"; // Note: currently we only support logical operators oToken.precedence = iLbp; oToken.left = oLeft; oToken.right = this.expression(iLbp); return oToken; } }; }
[ "function", "addInfixOperator", "(", "sId", ",", "iLbp", ")", "{", "mFilterParserSymbols", "[", "sId", "]", "=", "{", "lbp", ":", "iLbp", ",", "led", ":", "function", "(", "oToken", ",", "oLeft", ")", "{", "oToken", ".", "type", "=", "\"Edm.Boolean\"", ";", "oToken", ".", "precedence", "=", "iLbp", ";", "oToken", ".", "left", "=", "oLeft", ";", "oToken", ".", "right", "=", "this", ".", "expression", "(", "iLbp", ")", ";", "return", "oToken", ";", "}", "}", ";", "}" ]
Adds an infix operator to mFilterParserSymbols. @param {string} sId The token ID @param {number} iLbp The "left binding power"
[ "Adds", "an", "infix", "operator", "to", "mFilterParserSymbols", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/v4/lib/_Parser.js#L170-L182
train
SAP/openui5
src/sap.ui.core/src/sap/ui/model/odata/v4/lib/_Parser.js
addLeafSymbol
function addLeafSymbol(sId) { // Note: this function is executed at load time only! mFilterParserSymbols[sId] = { lbp : 0, nud : function (oToken) { oToken.precedence = 99; // prevent it from being enclosed in brackets return oToken; } }; }
javascript
function addLeafSymbol(sId) { // Note: this function is executed at load time only! mFilterParserSymbols[sId] = { lbp : 0, nud : function (oToken) { oToken.precedence = 99; // prevent it from being enclosed in brackets return oToken; } }; }
[ "function", "addLeafSymbol", "(", "sId", ")", "{", "mFilterParserSymbols", "[", "sId", "]", "=", "{", "lbp", ":", "0", ",", "nud", ":", "function", "(", "oToken", ")", "{", "oToken", ".", "precedence", "=", "99", ";", "return", "oToken", ";", "}", "}", ";", "}" ]
Adds a leaf symbol to mFilterParserSymbols. @param {string} sId The token ID
[ "Adds", "a", "leaf", "symbol", "to", "mFilterParserSymbols", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/v4/lib/_Parser.js#L189-L198
train
SAP/openui5
src/sap.ui.core/src/sap/ui/model/odata/v4/lib/_Parser.js
brackets
function brackets() { for (;;) { oToken = that.advance(); if (!oToken || oToken.id === ';') { that.expected("')'", oToken); } sValue += oToken.value; if (oToken.id === ")") { return; } if (oToken.id === "(") { brackets(); } } }
javascript
function brackets() { for (;;) { oToken = that.advance(); if (!oToken || oToken.id === ';') { that.expected("')'", oToken); } sValue += oToken.value; if (oToken.id === ")") { return; } if (oToken.id === "(") { brackets(); } } }
[ "function", "brackets", "(", ")", "{", "for", "(", ";", ";", ")", "{", "oToken", "=", "that", ".", "advance", "(", ")", ";", "if", "(", "!", "oToken", "||", "oToken", ".", "id", "===", "';'", ")", "{", "that", ".", "expected", "(", "\"')'\"", ",", "oToken", ")", ";", "}", "sValue", "+=", "oToken", ".", "value", ";", "if", "(", "oToken", ".", "id", "===", "\")\"", ")", "{", "return", ";", "}", "if", "(", "oToken", ".", "id", "===", "\"(\"", ")", "{", "brackets", "(", ")", ";", "}", "}", "}" ]
recursive function that advances and adds to sValue until the matching closing bracket has been consumed
[ "recursive", "function", "that", "advances", "and", "adds", "to", "sValue", "until", "the", "matching", "closing", "bracket", "has", "been", "consumed" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/v4/lib/_Parser.js#L482-L496
train
SAP/openui5
src/sap.ui.core/src/sap/ui/model/odata/v4/lib/_Parser.js
tokenizeDoubleQuotedString
function tokenizeDoubleQuotedString(sNext, sOption, iAt) { var c, sEscape, bEscaping = false, i; for (i = 1; i < sNext.length; i += 1) { if (bEscaping) { bEscaping = false; } else { c = sNext[i]; if (c === "%") { sEscape = sNext.slice(i + 1, i + 3); if (rEscapeDigits.test(sEscape)) { c = unescape(sEscape); i += 2; } } if (c === '"') { return sNext.slice(0, i + 1); } bEscaping = c === '\\'; } } throw new SyntaxError("Unterminated string at " + iAt + ": " + sOption); }
javascript
function tokenizeDoubleQuotedString(sNext, sOption, iAt) { var c, sEscape, bEscaping = false, i; for (i = 1; i < sNext.length; i += 1) { if (bEscaping) { bEscaping = false; } else { c = sNext[i]; if (c === "%") { sEscape = sNext.slice(i + 1, i + 3); if (rEscapeDigits.test(sEscape)) { c = unescape(sEscape); i += 2; } } if (c === '"') { return sNext.slice(0, i + 1); } bEscaping = c === '\\'; } } throw new SyntaxError("Unterminated string at " + iAt + ": " + sOption); }
[ "function", "tokenizeDoubleQuotedString", "(", "sNext", ",", "sOption", ",", "iAt", ")", "{", "var", "c", ",", "sEscape", ",", "bEscaping", "=", "false", ",", "i", ";", "for", "(", "i", "=", "1", ";", "i", "<", "sNext", ".", "length", ";", "i", "+=", "1", ")", "{", "if", "(", "bEscaping", ")", "{", "bEscaping", "=", "false", ";", "}", "else", "{", "c", "=", "sNext", "[", "i", "]", ";", "if", "(", "c", "===", "\"%\"", ")", "{", "sEscape", "=", "sNext", ".", "slice", "(", "i", "+", "1", ",", "i", "+", "3", ")", ";", "if", "(", "rEscapeDigits", ".", "test", "(", "sEscape", ")", ")", "{", "c", "=", "unescape", "(", "sEscape", ")", ";", "i", "+=", "2", ";", "}", "}", "if", "(", "c", "===", "'\"'", ")", "{", "return", "sNext", ".", "slice", "(", "0", ",", "i", "+", "1", ")", ";", "}", "bEscaping", "=", "c", "===", "'\\\\'", ";", "}", "}", "\\\\", "}" ]
Tokenizes a c-like string. It starts and ends with a double quote, backslash is the escape character. Both characters may be %-encoded. @param {string} sNext The untokenized input starting with the opening quote @param {string} sOption The option string (for an error message) @param {number} iAt The position in the option string (for an error message) @returns {string} The unconverted string including the quotes.
[ "Tokenizes", "a", "c", "-", "like", "string", ".", "It", "starts", "and", "ends", "with", "a", "double", "quote", "backslash", "is", "the", "escape", "character", ".", "Both", "characters", "may", "be", "%", "-", "encoded", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/v4/lib/_Parser.js#L655-L680
train
SAP/openui5
src/sap.ui.core/src/sap/ui/model/odata/v4/lib/_Parser.js
tokenize
function tokenize(sOption) { var iAt = 1, // The token's position for error messages; we count starting with 1 sId, aMatches, sNext = sOption, iOffset, oToken, aTokens = [], sValue; while (sNext.length) { aMatches = rToken.exec(sNext); iOffset = 0; if (aMatches) { sValue = aMatches[0]; if (aMatches[7]) { sId = "OPTION"; } else if (aMatches[6] || aMatches[4]) { sId = "VALUE"; } else if (aMatches[5]) { sId = "PATH"; if (sValue === "false" || sValue === "true" || sValue === "null") { sId = "VALUE"; } else if (sValue === "not") { sId = "not"; aMatches = rNot.exec(sNext); if (aMatches) { sValue = aMatches[0]; } } } else if (aMatches[3]) { // a %-escaped delimiter sId = unescape(aMatches[3]); } else if (aMatches[2]) { // an operator sId = aMatches[2]; iOffset = aMatches[1].length; } else { // a delimiter sId = aMatches[0]; } if (sId === '"') { sId = "VALUE"; sValue = tokenizeDoubleQuotedString(sNext, sOption, iAt); } else if (sId === "'") { sId = "VALUE"; sValue = tokenizeSingleQuotedString(sNext, sOption, iAt); } oToken = { at : iAt + iOffset, id : sId, value : sValue }; } else { throw new SyntaxError("Unknown character '" + sNext[0] + "' at " + iAt + ": " + sOption); } sNext = sNext.slice(sValue.length); iAt += sValue.length; aTokens.push(oToken); } return aTokens; }
javascript
function tokenize(sOption) { var iAt = 1, // The token's position for error messages; we count starting with 1 sId, aMatches, sNext = sOption, iOffset, oToken, aTokens = [], sValue; while (sNext.length) { aMatches = rToken.exec(sNext); iOffset = 0; if (aMatches) { sValue = aMatches[0]; if (aMatches[7]) { sId = "OPTION"; } else if (aMatches[6] || aMatches[4]) { sId = "VALUE"; } else if (aMatches[5]) { sId = "PATH"; if (sValue === "false" || sValue === "true" || sValue === "null") { sId = "VALUE"; } else if (sValue === "not") { sId = "not"; aMatches = rNot.exec(sNext); if (aMatches) { sValue = aMatches[0]; } } } else if (aMatches[3]) { // a %-escaped delimiter sId = unescape(aMatches[3]); } else if (aMatches[2]) { // an operator sId = aMatches[2]; iOffset = aMatches[1].length; } else { // a delimiter sId = aMatches[0]; } if (sId === '"') { sId = "VALUE"; sValue = tokenizeDoubleQuotedString(sNext, sOption, iAt); } else if (sId === "'") { sId = "VALUE"; sValue = tokenizeSingleQuotedString(sNext, sOption, iAt); } oToken = { at : iAt + iOffset, id : sId, value : sValue }; } else { throw new SyntaxError("Unknown character '" + sNext[0] + "' at " + iAt + ": " + sOption); } sNext = sNext.slice(sValue.length); iAt += sValue.length; aTokens.push(oToken); } return aTokens; }
[ "function", "tokenize", "(", "sOption", ")", "{", "var", "iAt", "=", "1", ",", "sId", ",", "aMatches", ",", "sNext", "=", "sOption", ",", "iOffset", ",", "oToken", ",", "aTokens", "=", "[", "]", ",", "sValue", ";", "while", "(", "sNext", ".", "length", ")", "{", "aMatches", "=", "rToken", ".", "exec", "(", "sNext", ")", ";", "iOffset", "=", "0", ";", "if", "(", "aMatches", ")", "{", "sValue", "=", "aMatches", "[", "0", "]", ";", "if", "(", "aMatches", "[", "7", "]", ")", "{", "sId", "=", "\"OPTION\"", ";", "}", "else", "if", "(", "aMatches", "[", "6", "]", "||", "aMatches", "[", "4", "]", ")", "{", "sId", "=", "\"VALUE\"", ";", "}", "else", "if", "(", "aMatches", "[", "5", "]", ")", "{", "sId", "=", "\"PATH\"", ";", "if", "(", "sValue", "===", "\"false\"", "||", "sValue", "===", "\"true\"", "||", "sValue", "===", "\"null\"", ")", "{", "sId", "=", "\"VALUE\"", ";", "}", "else", "if", "(", "sValue", "===", "\"not\"", ")", "{", "sId", "=", "\"not\"", ";", "aMatches", "=", "rNot", ".", "exec", "(", "sNext", ")", ";", "if", "(", "aMatches", ")", "{", "sValue", "=", "aMatches", "[", "0", "]", ";", "}", "}", "}", "else", "if", "(", "aMatches", "[", "3", "]", ")", "{", "sId", "=", "unescape", "(", "aMatches", "[", "3", "]", ")", ";", "}", "else", "if", "(", "aMatches", "[", "2", "]", ")", "{", "sId", "=", "aMatches", "[", "2", "]", ";", "iOffset", "=", "aMatches", "[", "1", "]", ".", "length", ";", "}", "else", "{", "sId", "=", "aMatches", "[", "0", "]", ";", "}", "if", "(", "sId", "===", "'\"'", ")", "{", "sId", "=", "\"VALUE\"", ";", "sValue", "=", "tokenizeDoubleQuotedString", "(", "sNext", ",", "sOption", ",", "iAt", ")", ";", "}", "else", "if", "(", "sId", "===", "\"'\"", ")", "{", "sId", "=", "\"VALUE\"", ";", "sValue", "=", "tokenizeSingleQuotedString", "(", "sNext", ",", "sOption", ",", "iAt", ")", ";", "}", "oToken", "=", "{", "at", ":", "iAt", "+", "iOffset", ",", "id", ":", "sId", ",", "value", ":", "sValue", "}", ";", "}", "else", "{", "throw", "new", "SyntaxError", "(", "\"Unknown character '\"", "+", "sNext", "[", "0", "]", "+", "\"' at \"", "+", "iAt", "+", "\": \"", "+", "sOption", ")", ";", "}", "sNext", "=", "sNext", ".", "slice", "(", "sValue", ".", "length", ")", ";", "iAt", "+=", "sValue", ".", "length", ";", "aTokens", ".", "push", "(", "oToken", ")", ";", "}", "return", "aTokens", ";", "}" ]
Splits the option string into an array of tokens. @param {string} sOption The option string @returns {object[]} The array of tokens.
[ "Splits", "the", "option", "string", "into", "an", "array", "of", "tokens", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/v4/lib/_Parser.js#L688-L748
train
SAP/openui5
src/sap.ui.documentation/src/sap/ui/documentation/sdk/controller/Sample.controller.js
function (sSampleId, sIframePath) { var aIFramePathParts = sIframePath.split("/"), i; for (i = 0; i < aIFramePathParts.length - 1; i++) { if (aIFramePathParts[i] == "..") { // iframe path has parts pointing one folder up so remove last part of the sSampleId sSampleId = sSampleId.substring(0, sSampleId.lastIndexOf(".")); } else { // append the part of the iframe path to the sample's id sSampleId += "." + aIFramePathParts[i]; } } return sSampleId; }
javascript
function (sSampleId, sIframePath) { var aIFramePathParts = sIframePath.split("/"), i; for (i = 0; i < aIFramePathParts.length - 1; i++) { if (aIFramePathParts[i] == "..") { // iframe path has parts pointing one folder up so remove last part of the sSampleId sSampleId = sSampleId.substring(0, sSampleId.lastIndexOf(".")); } else { // append the part of the iframe path to the sample's id sSampleId += "." + aIFramePathParts[i]; } } return sSampleId; }
[ "function", "(", "sSampleId", ",", "sIframePath", ")", "{", "var", "aIFramePathParts", "=", "sIframePath", ".", "split", "(", "\"/\"", ")", ",", "i", ";", "for", "(", "i", "=", "0", ";", "i", "<", "aIFramePathParts", ".", "length", "-", "1", ";", "i", "++", ")", "{", "if", "(", "aIFramePathParts", "[", "i", "]", "==", "\"..\"", ")", "{", "sSampleId", "=", "sSampleId", ".", "substring", "(", "0", ",", "sSampleId", ".", "lastIndexOf", "(", "\".\"", ")", ")", ";", "}", "else", "{", "sSampleId", "+=", "\".\"", "+", "aIFramePathParts", "[", "i", "]", ";", "}", "}", "return", "sSampleId", ";", "}" ]
Extends the sSampleId with the relative path defined in sIframePath and returns the resulting path. @param {string} sSampleId @param {string} sIframe @returns {string} @private
[ "Extends", "the", "sSampleId", "with", "the", "relative", "path", "defined", "in", "sIframePath", "and", "returns", "the", "resulting", "path", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.documentation/src/sap/ui/documentation/sdk/controller/Sample.controller.js#L208-L223
train
SAP/openui5
src/sap.ui.core/src/sap/ui/core/AppCacheBuster.js
function(oSyncPoint) { // application cachebuster mechanism (copy of array for later modification) var oConfig = oConfiguration.getAppCacheBuster(); if (oConfig && oConfig.length > 0) { oConfig = oConfig.slice(); // flag to activate the cachebuster var bActive = true; // fallback for old boolean configuration (only 1 string entry) // restriction: the values true, false and x are reserved as fallback values // and cannot be used as base url locations var sValue = String(oConfig[0]).toLowerCase(); if (oConfig.length === 1) { if (sValue === "true" || sValue === "x") { // register the current base URL (if it is a relative URL) // hint: if UI5 is referenced relative on a server it might be possible // with the mechanism to register another base URL. var oUri = URI(sOrgBaseUrl); oConfig = oUri.is("relative") ? [oUri.toString()] : []; } else if (sValue === "false") { bActive = false; } } // activate the cachebuster if (bActive) { // initialize the AppCacheBuster AppCacheBuster.init(); // register the components fnRegister(oConfig, oSyncPoint); } } }
javascript
function(oSyncPoint) { // application cachebuster mechanism (copy of array for later modification) var oConfig = oConfiguration.getAppCacheBuster(); if (oConfig && oConfig.length > 0) { oConfig = oConfig.slice(); // flag to activate the cachebuster var bActive = true; // fallback for old boolean configuration (only 1 string entry) // restriction: the values true, false and x are reserved as fallback values // and cannot be used as base url locations var sValue = String(oConfig[0]).toLowerCase(); if (oConfig.length === 1) { if (sValue === "true" || sValue === "x") { // register the current base URL (if it is a relative URL) // hint: if UI5 is referenced relative on a server it might be possible // with the mechanism to register another base URL. var oUri = URI(sOrgBaseUrl); oConfig = oUri.is("relative") ? [oUri.toString()] : []; } else if (sValue === "false") { bActive = false; } } // activate the cachebuster if (bActive) { // initialize the AppCacheBuster AppCacheBuster.init(); // register the components fnRegister(oConfig, oSyncPoint); } } }
[ "function", "(", "oSyncPoint", ")", "{", "var", "oConfig", "=", "oConfiguration", ".", "getAppCacheBuster", "(", ")", ";", "if", "(", "oConfig", "&&", "oConfig", ".", "length", ">", "0", ")", "{", "oConfig", "=", "oConfig", ".", "slice", "(", ")", ";", "var", "bActive", "=", "true", ";", "var", "sValue", "=", "String", "(", "oConfig", "[", "0", "]", ")", ".", "toLowerCase", "(", ")", ";", "if", "(", "oConfig", ".", "length", "===", "1", ")", "{", "if", "(", "sValue", "===", "\"true\"", "||", "sValue", "===", "\"x\"", ")", "{", "var", "oUri", "=", "URI", "(", "sOrgBaseUrl", ")", ";", "oConfig", "=", "oUri", ".", "is", "(", "\"relative\"", ")", "?", "[", "oUri", ".", "toString", "(", ")", "]", ":", "[", "]", ";", "}", "else", "if", "(", "sValue", "===", "\"false\"", ")", "{", "bActive", "=", "false", ";", "}", "}", "if", "(", "bActive", ")", "{", "AppCacheBuster", ".", "init", "(", ")", ";", "fnRegister", "(", "oConfig", ",", "oSyncPoint", ")", ";", "}", "}", "}" ]
Boots the AppCacheBuster by initializing and registering the base URLs configured in the UI5 bootstrap. @param {Object} [oSyncPoint] the sync point which is used to chain the execution of the AppCacheBuster @private
[ "Boots", "the", "AppCacheBuster", "by", "initializing", "and", "registering", "the", "base", "URLs", "configured", "in", "the", "UI5", "bootstrap", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/AppCacheBuster.js#L274-L315
train
SAP/openui5
src/sap.ui.core/src/sap/ui/core/AppCacheBuster.js
function() { // activate the session (do not create the session for compatibility reasons with mIndex previously) oSession.active = true; // store the original function / property description to intercept fnValidateProperty = ManagedObject.prototype.validateProperty; descScriptSrc = Object.getOwnPropertyDescriptor(HTMLScriptElement.prototype, "src"); descLinkHref = Object.getOwnPropertyDescriptor(HTMLLinkElement.prototype, "href"); // function shortcuts (better performance when used frequently!) var fnConvertUrl = AppCacheBuster.convertURL; var fnNormalizeUrl = AppCacheBuster.normalizeURL; // resources URL's will be handled via standard // UI5 cachebuster mechanism (so we simply ignore them) var fnIsACBUrl = function(sUrl) { if (this.active === true && sUrl && typeof (sUrl) === "string") { sUrl = fnNormalizeUrl(sUrl); return !sUrl.match(oFilter); } return false; }.bind(oSession); // enhance xhr with appCacheBuster functionality fnXhrOpenOrig = XMLHttpRequest.prototype.open; XMLHttpRequest.prototype.open = function(sMethod, sUrl) { if (sUrl && fnIsACBUrl(sUrl)) { arguments[1] = fnConvertUrl(sUrl); } fnXhrOpenOrig.apply(this, arguments); }; fnEnhancedXhrOpen = XMLHttpRequest.prototype.open; // enhance the validateProperty function to intercept URI types // test via: new sap.ui.commons.Image({src: "acctest/img/Employee.png"}).getSrc() // new sap.ui.commons.Image({src: "./acctest/../acctest/img/Employee.png"}).getSrc() ManagedObject.prototype.validateProperty = function(sPropertyName, oValue) { var oMetadata = this.getMetadata(), oProperty = oMetadata.getProperty(sPropertyName), oArgs; if (oProperty && oProperty.type === "sap.ui.core.URI") { oArgs = Array.prototype.slice.apply(arguments); try { if (fnIsACBUrl(oArgs[1] /* oValue */)) { oArgs[1] = fnConvertUrl(oArgs[1] /* oValue */); } } catch (e) { // URI normalization or conversion failed, fall back to normal processing } } // either forward the modified or the original arguments return fnValidateProperty.apply(this, oArgs || arguments); }; // create an interceptor description which validates the value // of the setter whether to rewrite the URL or not var fnCreateInterceptorDescriptor = function(descriptor) { var newDescriptor = { get: descriptor.get, set: function(val) { if (fnIsACBUrl(val)) { val = fnConvertUrl(val); } descriptor.set.call(this, val); }, enumerable: descriptor.enumerable, configurable: descriptor.configurable }; newDescriptor.set._sapUiCoreACB = true; return newDescriptor; }; // try to setup the property descriptor interceptors (not supported on all browsers, e.g. iOS9) var bError = false; try { Object.defineProperty(HTMLScriptElement.prototype, "src", fnCreateInterceptorDescriptor(descScriptSrc)); } catch (ex) { Log.error("Your browser doesn't support redefining the src property of the script tag. Disabling AppCacheBuster as it is not supported on your browser!\nError: " + ex); bError = true; } try { Object.defineProperty(HTMLLinkElement.prototype, "href", fnCreateInterceptorDescriptor(descLinkHref)); } catch (ex) { Log.error("Your browser doesn't support redefining the href property of the link tag. Disabling AppCacheBuster as it is not supported on your browser!\nError: " + ex); bError = true; } // in case of setup issues we stop the AppCacheBuster support if (bError) { this.exit(); } }
javascript
function() { // activate the session (do not create the session for compatibility reasons with mIndex previously) oSession.active = true; // store the original function / property description to intercept fnValidateProperty = ManagedObject.prototype.validateProperty; descScriptSrc = Object.getOwnPropertyDescriptor(HTMLScriptElement.prototype, "src"); descLinkHref = Object.getOwnPropertyDescriptor(HTMLLinkElement.prototype, "href"); // function shortcuts (better performance when used frequently!) var fnConvertUrl = AppCacheBuster.convertURL; var fnNormalizeUrl = AppCacheBuster.normalizeURL; // resources URL's will be handled via standard // UI5 cachebuster mechanism (so we simply ignore them) var fnIsACBUrl = function(sUrl) { if (this.active === true && sUrl && typeof (sUrl) === "string") { sUrl = fnNormalizeUrl(sUrl); return !sUrl.match(oFilter); } return false; }.bind(oSession); // enhance xhr with appCacheBuster functionality fnXhrOpenOrig = XMLHttpRequest.prototype.open; XMLHttpRequest.prototype.open = function(sMethod, sUrl) { if (sUrl && fnIsACBUrl(sUrl)) { arguments[1] = fnConvertUrl(sUrl); } fnXhrOpenOrig.apply(this, arguments); }; fnEnhancedXhrOpen = XMLHttpRequest.prototype.open; // enhance the validateProperty function to intercept URI types // test via: new sap.ui.commons.Image({src: "acctest/img/Employee.png"}).getSrc() // new sap.ui.commons.Image({src: "./acctest/../acctest/img/Employee.png"}).getSrc() ManagedObject.prototype.validateProperty = function(sPropertyName, oValue) { var oMetadata = this.getMetadata(), oProperty = oMetadata.getProperty(sPropertyName), oArgs; if (oProperty && oProperty.type === "sap.ui.core.URI") { oArgs = Array.prototype.slice.apply(arguments); try { if (fnIsACBUrl(oArgs[1] /* oValue */)) { oArgs[1] = fnConvertUrl(oArgs[1] /* oValue */); } } catch (e) { // URI normalization or conversion failed, fall back to normal processing } } // either forward the modified or the original arguments return fnValidateProperty.apply(this, oArgs || arguments); }; // create an interceptor description which validates the value // of the setter whether to rewrite the URL or not var fnCreateInterceptorDescriptor = function(descriptor) { var newDescriptor = { get: descriptor.get, set: function(val) { if (fnIsACBUrl(val)) { val = fnConvertUrl(val); } descriptor.set.call(this, val); }, enumerable: descriptor.enumerable, configurable: descriptor.configurable }; newDescriptor.set._sapUiCoreACB = true; return newDescriptor; }; // try to setup the property descriptor interceptors (not supported on all browsers, e.g. iOS9) var bError = false; try { Object.defineProperty(HTMLScriptElement.prototype, "src", fnCreateInterceptorDescriptor(descScriptSrc)); } catch (ex) { Log.error("Your browser doesn't support redefining the src property of the script tag. Disabling AppCacheBuster as it is not supported on your browser!\nError: " + ex); bError = true; } try { Object.defineProperty(HTMLLinkElement.prototype, "href", fnCreateInterceptorDescriptor(descLinkHref)); } catch (ex) { Log.error("Your browser doesn't support redefining the href property of the link tag. Disabling AppCacheBuster as it is not supported on your browser!\nError: " + ex); bError = true; } // in case of setup issues we stop the AppCacheBuster support if (bError) { this.exit(); } }
[ "function", "(", ")", "{", "oSession", ".", "active", "=", "true", ";", "fnValidateProperty", "=", "ManagedObject", ".", "prototype", ".", "validateProperty", ";", "descScriptSrc", "=", "Object", ".", "getOwnPropertyDescriptor", "(", "HTMLScriptElement", ".", "prototype", ",", "\"src\"", ")", ";", "descLinkHref", "=", "Object", ".", "getOwnPropertyDescriptor", "(", "HTMLLinkElement", ".", "prototype", ",", "\"href\"", ")", ";", "var", "fnConvertUrl", "=", "AppCacheBuster", ".", "convertURL", ";", "var", "fnNormalizeUrl", "=", "AppCacheBuster", ".", "normalizeURL", ";", "var", "fnIsACBUrl", "=", "function", "(", "sUrl", ")", "{", "if", "(", "this", ".", "active", "===", "true", "&&", "sUrl", "&&", "typeof", "(", "sUrl", ")", "===", "\"string\"", ")", "{", "sUrl", "=", "fnNormalizeUrl", "(", "sUrl", ")", ";", "return", "!", "sUrl", ".", "match", "(", "oFilter", ")", ";", "}", "return", "false", ";", "}", ".", "bind", "(", "oSession", ")", ";", "fnXhrOpenOrig", "=", "XMLHttpRequest", ".", "prototype", ".", "open", ";", "XMLHttpRequest", ".", "prototype", ".", "open", "=", "function", "(", "sMethod", ",", "sUrl", ")", "{", "if", "(", "sUrl", "&&", "fnIsACBUrl", "(", "sUrl", ")", ")", "{", "arguments", "[", "1", "]", "=", "fnConvertUrl", "(", "sUrl", ")", ";", "}", "fnXhrOpenOrig", ".", "apply", "(", "this", ",", "arguments", ")", ";", "}", ";", "fnEnhancedXhrOpen", "=", "XMLHttpRequest", ".", "prototype", ".", "open", ";", "ManagedObject", ".", "prototype", ".", "validateProperty", "=", "function", "(", "sPropertyName", ",", "oValue", ")", "{", "var", "oMetadata", "=", "this", ".", "getMetadata", "(", ")", ",", "oProperty", "=", "oMetadata", ".", "getProperty", "(", "sPropertyName", ")", ",", "oArgs", ";", "if", "(", "oProperty", "&&", "oProperty", ".", "type", "===", "\"sap.ui.core.URI\"", ")", "{", "oArgs", "=", "Array", ".", "prototype", ".", "slice", ".", "apply", "(", "arguments", ")", ";", "try", "{", "if", "(", "fnIsACBUrl", "(", "oArgs", "[", "1", "]", ")", ")", "{", "oArgs", "[", "1", "]", "=", "fnConvertUrl", "(", "oArgs", "[", "1", "]", ")", ";", "}", "}", "catch", "(", "e", ")", "{", "}", "}", "return", "fnValidateProperty", ".", "apply", "(", "this", ",", "oArgs", "||", "arguments", ")", ";", "}", ";", "var", "fnCreateInterceptorDescriptor", "=", "function", "(", "descriptor", ")", "{", "var", "newDescriptor", "=", "{", "get", ":", "descriptor", ".", "get", ",", "set", ":", "function", "(", "val", ")", "{", "if", "(", "fnIsACBUrl", "(", "val", ")", ")", "{", "val", "=", "fnConvertUrl", "(", "val", ")", ";", "}", "descriptor", ".", "set", ".", "call", "(", "this", ",", "val", ")", ";", "}", ",", "enumerable", ":", "descriptor", ".", "enumerable", ",", "configurable", ":", "descriptor", ".", "configurable", "}", ";", "newDescriptor", ".", "set", ".", "_sapUiCoreACB", "=", "true", ";", "return", "newDescriptor", ";", "}", ";", "var", "bError", "=", "false", ";", "try", "{", "Object", ".", "defineProperty", "(", "HTMLScriptElement", ".", "prototype", ",", "\"src\"", ",", "fnCreateInterceptorDescriptor", "(", "descScriptSrc", ")", ")", ";", "}", "catch", "(", "ex", ")", "{", "Log", ".", "error", "(", "\"Your browser doesn't support redefining the src property of the script tag. Disabling AppCacheBuster as it is not supported on your browser!\\nError: \"", "+", "\\n", ")", ";", "ex", "}", "bError", "=", "true", ";", "try", "{", "Object", ".", "defineProperty", "(", "HTMLLinkElement", ".", "prototype", ",", "\"href\"", ",", "fnCreateInterceptorDescriptor", "(", "descLinkHref", ")", ")", ";", "}", "catch", "(", "ex", ")", "{", "Log", ".", "error", "(", "\"Your browser doesn't support redefining the href property of the link tag. Disabling AppCacheBuster as it is not supported on your browser!\\nError: \"", "+", "\\n", ")", ";", "ex", "}", "}" ]
Initializes the AppCacheBuster. Hooks into the relevant functions in the Core to intercept the code which are dealing with URLs and converts those URLs into cachebuster URLs. The intercepted functions are: <ul> <li><code>XMLHttpRequest.prototype.open</code></li> <li><code>HTMLScriptElement.prototype.src</code></li> <li><code>HTMLLinkElement.prototype.href</code></li> <li><code>sap.ui.base.ManagedObject.prototype.validateProperty</code></li> </ul> @private
[ "Initializes", "the", "AppCacheBuster", ".", "Hooks", "into", "the", "relevant", "functions", "in", "the", "Core", "to", "intercept", "the", "code", "which", "are", "dealing", "with", "URLs", "and", "converts", "those", "URLs", "into", "cachebuster", "URLs", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/AppCacheBuster.js#L332-L425
train
SAP/openui5
src/sap.ui.core/src/sap/ui/core/AppCacheBuster.js
function(descriptor) { var newDescriptor = { get: descriptor.get, set: function(val) { if (fnIsACBUrl(val)) { val = fnConvertUrl(val); } descriptor.set.call(this, val); }, enumerable: descriptor.enumerable, configurable: descriptor.configurable }; newDescriptor.set._sapUiCoreACB = true; return newDescriptor; }
javascript
function(descriptor) { var newDescriptor = { get: descriptor.get, set: function(val) { if (fnIsACBUrl(val)) { val = fnConvertUrl(val); } descriptor.set.call(this, val); }, enumerable: descriptor.enumerable, configurable: descriptor.configurable }; newDescriptor.set._sapUiCoreACB = true; return newDescriptor; }
[ "function", "(", "descriptor", ")", "{", "var", "newDescriptor", "=", "{", "get", ":", "descriptor", ".", "get", ",", "set", ":", "function", "(", "val", ")", "{", "if", "(", "fnIsACBUrl", "(", "val", ")", ")", "{", "val", "=", "fnConvertUrl", "(", "val", ")", ";", "}", "descriptor", ".", "set", ".", "call", "(", "this", ",", "val", ")", ";", "}", ",", "enumerable", ":", "descriptor", ".", "enumerable", ",", "configurable", ":", "descriptor", ".", "configurable", "}", ";", "newDescriptor", ".", "set", ".", "_sapUiCoreACB", "=", "true", ";", "return", "newDescriptor", ";", "}" ]
create an interceptor description which validates the value of the setter whether to rewrite the URL or not
[ "create", "an", "interceptor", "description", "which", "validates", "the", "value", "of", "the", "setter", "whether", "to", "rewrite", "the", "URL", "or", "not" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/AppCacheBuster.js#L389-L403
train
SAP/openui5
src/sap.ui.core/src/sap/ui/core/AppCacheBuster.js
function() { // remove the function interceptions ManagedObject.prototype.validateProperty = fnValidateProperty; // only remove xhr interception if xhr#open was not modified meanwhile if (XMLHttpRequest.prototype.open === fnEnhancedXhrOpen) { XMLHttpRequest.prototype.open = fnXhrOpenOrig; } // remove the property descriptor interceptions (but only if not overridden again) var descriptor; if ((descriptor = Object.getOwnPropertyDescriptor(HTMLScriptElement.prototype, "src")) && descriptor.set && descriptor.set._sapUiCoreACB === true) { Object.defineProperty(HTMLScriptElement.prototype, "src", descScriptSrc); } if ((descriptor = Object.getOwnPropertyDescriptor(HTMLLinkElement.prototype, "href")) && descriptor.set && descriptor.set._sapUiCoreACB === true) { Object.defineProperty(HTMLLinkElement.prototype, "href", descLinkHref); } // clear the session (disables URL rewrite for session) oSession.index = {}; oSession.active = false; // create a new session for the next initialization oSession = { index: {}, active: false }; }
javascript
function() { // remove the function interceptions ManagedObject.prototype.validateProperty = fnValidateProperty; // only remove xhr interception if xhr#open was not modified meanwhile if (XMLHttpRequest.prototype.open === fnEnhancedXhrOpen) { XMLHttpRequest.prototype.open = fnXhrOpenOrig; } // remove the property descriptor interceptions (but only if not overridden again) var descriptor; if ((descriptor = Object.getOwnPropertyDescriptor(HTMLScriptElement.prototype, "src")) && descriptor.set && descriptor.set._sapUiCoreACB === true) { Object.defineProperty(HTMLScriptElement.prototype, "src", descScriptSrc); } if ((descriptor = Object.getOwnPropertyDescriptor(HTMLLinkElement.prototype, "href")) && descriptor.set && descriptor.set._sapUiCoreACB === true) { Object.defineProperty(HTMLLinkElement.prototype, "href", descLinkHref); } // clear the session (disables URL rewrite for session) oSession.index = {}; oSession.active = false; // create a new session for the next initialization oSession = { index: {}, active: false }; }
[ "function", "(", ")", "{", "ManagedObject", ".", "prototype", ".", "validateProperty", "=", "fnValidateProperty", ";", "if", "(", "XMLHttpRequest", ".", "prototype", ".", "open", "===", "fnEnhancedXhrOpen", ")", "{", "XMLHttpRequest", ".", "prototype", ".", "open", "=", "fnXhrOpenOrig", ";", "}", "var", "descriptor", ";", "if", "(", "(", "descriptor", "=", "Object", ".", "getOwnPropertyDescriptor", "(", "HTMLScriptElement", ".", "prototype", ",", "\"src\"", ")", ")", "&&", "descriptor", ".", "set", "&&", "descriptor", ".", "set", ".", "_sapUiCoreACB", "===", "true", ")", "{", "Object", ".", "defineProperty", "(", "HTMLScriptElement", ".", "prototype", ",", "\"src\"", ",", "descScriptSrc", ")", ";", "}", "if", "(", "(", "descriptor", "=", "Object", ".", "getOwnPropertyDescriptor", "(", "HTMLLinkElement", ".", "prototype", ",", "\"href\"", ")", ")", "&&", "descriptor", ".", "set", "&&", "descriptor", ".", "set", ".", "_sapUiCoreACB", "===", "true", ")", "{", "Object", ".", "defineProperty", "(", "HTMLLinkElement", ".", "prototype", ",", "\"href\"", ",", "descLinkHref", ")", ";", "}", "oSession", ".", "index", "=", "{", "}", ";", "oSession", ".", "active", "=", "false", ";", "oSession", "=", "{", "index", ":", "{", "}", ",", "active", ":", "false", "}", ";", "}" ]
Terminates the AppCacheBuster and removes the hooks from the URL specific functions. This will also clear the index which is used to prefix matching URLs. @private
[ "Terminates", "the", "AppCacheBuster", "and", "removes", "the", "hooks", "from", "the", "URL", "specific", "functions", ".", "This", "will", "also", "clear", "the", "index", "which", "is", "used", "to", "prefix", "matching", "URLs", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/AppCacheBuster.js#L434-L463
train
SAP/openui5
src/sap.ui.core/src/sap/ui/core/AppCacheBuster.js
function(sUrl) { // local resources are registered with "./" => we remove the leading "./"! // (code location for this: sap/ui/Global.js:sap.ui.localResources) // we by default normalize all relative URLs for a common base var oUri = URI(sUrl || "./"); if (oUri.is("relative")) { //(sUrl.match(/^\.\/|\..\//g)) { oUri = oUri.absoluteTo(sLocation); } //return oUri.normalize().toString(); // prevent to normalize the search and hash to avoid "+" in the search string // because for search strings the space will be normalized as "+" return oUri.normalizeProtocol().normalizeHostname().normalizePort().normalizePath().toString(); }
javascript
function(sUrl) { // local resources are registered with "./" => we remove the leading "./"! // (code location for this: sap/ui/Global.js:sap.ui.localResources) // we by default normalize all relative URLs for a common base var oUri = URI(sUrl || "./"); if (oUri.is("relative")) { //(sUrl.match(/^\.\/|\..\//g)) { oUri = oUri.absoluteTo(sLocation); } //return oUri.normalize().toString(); // prevent to normalize the search and hash to avoid "+" in the search string // because for search strings the space will be normalized as "+" return oUri.normalizeProtocol().normalizeHostname().normalizePort().normalizePath().toString(); }
[ "function", "(", "sUrl", ")", "{", "var", "oUri", "=", "URI", "(", "sUrl", "||", "\"./\"", ")", ";", "if", "(", "oUri", ".", "is", "(", "\"relative\"", ")", ")", "{", "oUri", "=", "oUri", ".", "absoluteTo", "(", "sLocation", ")", ";", "}", "return", "oUri", ".", "normalizeProtocol", "(", ")", ".", "normalizeHostname", "(", ")", ".", "normalizePort", "(", ")", ".", "normalizePath", "(", ")", ".", "toString", "(", ")", ";", "}" ]
Normalizes the given URL and make it absolute. @param {string} sUrl any URL @return {string} normalized URL @public
[ "Normalizes", "the", "given", "URL", "and", "make", "it", "absolute", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/AppCacheBuster.js#L540-L554
train
SAP/openui5
src/sap.ui.core/src/sap/ui/model/Model.js
_traverseFilter
function _traverseFilter (vFilters, fnCheck) { vFilters = vFilters || []; if (vFilters instanceof Filter) { vFilters = [vFilters]; } // filter has more sub-filter instances (we ignore the subfilters below the any/all operators) for (var i = 0; i < vFilters.length; i++) { // check single Filter var oFilter = vFilters[i]; fnCheck(oFilter); // check subfilter for lambda expressions (e.g. Any, All, ...) _traverseFilter(oFilter.oCondition, fnCheck); // check multi filter if necessary _traverseFilter(oFilter.aFilters, fnCheck); } }
javascript
function _traverseFilter (vFilters, fnCheck) { vFilters = vFilters || []; if (vFilters instanceof Filter) { vFilters = [vFilters]; } // filter has more sub-filter instances (we ignore the subfilters below the any/all operators) for (var i = 0; i < vFilters.length; i++) { // check single Filter var oFilter = vFilters[i]; fnCheck(oFilter); // check subfilter for lambda expressions (e.g. Any, All, ...) _traverseFilter(oFilter.oCondition, fnCheck); // check multi filter if necessary _traverseFilter(oFilter.aFilters, fnCheck); } }
[ "function", "_traverseFilter", "(", "vFilters", ",", "fnCheck", ")", "{", "vFilters", "=", "vFilters", "||", "[", "]", ";", "if", "(", "vFilters", "instanceof", "Filter", ")", "{", "vFilters", "=", "[", "vFilters", "]", ";", "}", "for", "(", "var", "i", "=", "0", ";", "i", "<", "vFilters", ".", "length", ";", "i", "++", ")", "{", "var", "oFilter", "=", "vFilters", "[", "i", "]", ";", "fnCheck", "(", "oFilter", ")", ";", "_traverseFilter", "(", "oFilter", ".", "oCondition", ",", "fnCheck", ")", ";", "_traverseFilter", "(", "oFilter", ".", "aFilters", ",", "fnCheck", ")", ";", "}", "}" ]
Traverses the given filter tree. @param {sap.ui.model.Filter[]|sap.ui.model.Filter} vFilters Array of filters or a single filter instance, which will be checked for unsupported filter operators @param {function} fnCheck Check function which is called for each filter instance in the tree @private
[ "Traverses", "the", "given", "filter", "tree", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/Model.js#L1030-L1049
train
SAP/openui5
src/sap.ui.dt/src/sap/ui/dt/util/ZIndexManager.js
function () { //get all open popups from InstanceManager var aAllOpenPopups = fnGetPopups(); var aValidatedPopups = []; var aInvalidatedPopups = []; aAllOpenPopups.forEach(function(oOpenPopup) { // check if non-adaptable popup var bValid = _aPopupFilters.every(function (fnFilter) { return fnFilter(oOpenPopup); }); bValid && _aPopupFilters.length > 0 ? aValidatedPopups.push(oOpenPopup) : aInvalidatedPopups.push(oOpenPopup); }); // get max Z-Index from validated popups var iMaxValidatedZIndex = aValidatedPopups.length > 0 ? Math.max.apply(null, fnGetZIndexFromPopups(aValidatedPopups)) : -1; // get minimum Z-Index from invalidated popups var iMinInvalidatedZIndex = aInvalidatedPopups.length > 0 ? Math.min.apply(null, fnGetZIndexFromPopups(aInvalidatedPopups)) : -1; // compare Z-Index of adaptable and non-adaptable popups - the higher one wins if (iMaxValidatedZIndex < iMinInvalidatedZIndex) { return this._getNextMinZIndex(iMinInvalidatedZIndex); } else { return Popup.getNextZIndex(); } }
javascript
function () { //get all open popups from InstanceManager var aAllOpenPopups = fnGetPopups(); var aValidatedPopups = []; var aInvalidatedPopups = []; aAllOpenPopups.forEach(function(oOpenPopup) { // check if non-adaptable popup var bValid = _aPopupFilters.every(function (fnFilter) { return fnFilter(oOpenPopup); }); bValid && _aPopupFilters.length > 0 ? aValidatedPopups.push(oOpenPopup) : aInvalidatedPopups.push(oOpenPopup); }); // get max Z-Index from validated popups var iMaxValidatedZIndex = aValidatedPopups.length > 0 ? Math.max.apply(null, fnGetZIndexFromPopups(aValidatedPopups)) : -1; // get minimum Z-Index from invalidated popups var iMinInvalidatedZIndex = aInvalidatedPopups.length > 0 ? Math.min.apply(null, fnGetZIndexFromPopups(aInvalidatedPopups)) : -1; // compare Z-Index of adaptable and non-adaptable popups - the higher one wins if (iMaxValidatedZIndex < iMinInvalidatedZIndex) { return this._getNextMinZIndex(iMinInvalidatedZIndex); } else { return Popup.getNextZIndex(); } }
[ "function", "(", ")", "{", "var", "aAllOpenPopups", "=", "fnGetPopups", "(", ")", ";", "var", "aValidatedPopups", "=", "[", "]", ";", "var", "aInvalidatedPopups", "=", "[", "]", ";", "aAllOpenPopups", ".", "forEach", "(", "function", "(", "oOpenPopup", ")", "{", "var", "bValid", "=", "_aPopupFilters", ".", "every", "(", "function", "(", "fnFilter", ")", "{", "return", "fnFilter", "(", "oOpenPopup", ")", ";", "}", ")", ";", "bValid", "&&", "_aPopupFilters", ".", "length", ">", "0", "?", "aValidatedPopups", ".", "push", "(", "oOpenPopup", ")", ":", "aInvalidatedPopups", ".", "push", "(", "oOpenPopup", ")", ";", "}", ")", ";", "var", "iMaxValidatedZIndex", "=", "aValidatedPopups", ".", "length", ">", "0", "?", "Math", ".", "max", ".", "apply", "(", "null", ",", "fnGetZIndexFromPopups", "(", "aValidatedPopups", ")", ")", ":", "-", "1", ";", "var", "iMinInvalidatedZIndex", "=", "aInvalidatedPopups", ".", "length", ">", "0", "?", "Math", ".", "min", ".", "apply", "(", "null", ",", "fnGetZIndexFromPopups", "(", "aInvalidatedPopups", ")", ")", ":", "-", "1", ";", "if", "(", "iMaxValidatedZIndex", "<", "iMinInvalidatedZIndex", ")", "{", "return", "this", ".", "_getNextMinZIndex", "(", "iMinInvalidatedZIndex", ")", ";", "}", "else", "{", "return", "Popup", ".", "getNextZIndex", "(", ")", ";", "}", "}" ]
Calculates the reliable z-index in the current window considering the global BusyIndicator dialog. Algorithm: 1) When popups are already open on the screen: the highest z-index of validated popups is compared with the lowest z-index of invalidated popups. The invalidated popups also include any BusyIndicator that might be open. 2) If the invalidated popups have the higher value then the next z-index is first decremented by 10, which gives the last popup z-index and then 1 is added to it. 3) After incrementing 1 in Step 2), the resultant z-index value is compared against an array of assigned z-index values by the ZIndexManager. Step 3) is repeated as long as it stays under a max value and a unique value is calculated. The max value is the next possible popup z-index - 3 (hardcoded by variable Z_INDICES_RESERVED). Example: when BusyIndicator has a z-index 100, then available indexes are: 91, 92, 93, 94, 95, 96, 97. Indexes 98 & 99 are used by BusyIndicator internally, therefore we can't rely on them. The reason we start from the index 91 is that in sap.ui.core.Popup.getNextZIndex() there is a hardcoded step with a value 10 which means there are only 10 reliable indexes between the opened BusyIndicator and the previous absolutely positioned element on the screen; 4) If no popups are open or if validated popups have a higher z-index, then simply the next possible z-index is returned by calling sap.ui.core.Popup.getNextZIndex(). @returns {int} the next available z-index value @public
[ "Calculates", "the", "reliable", "z", "-", "index", "in", "the", "current", "window", "considering", "the", "global", "BusyIndicator", "dialog", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.dt/src/sap/ui/dt/util/ZIndexManager.js#L97-L129
train
SAP/openui5
src/sap.ui.dt/src/sap/ui/dt/util/ZIndexManager.js
function (iCurrent) { // deduct indices reserved from current z-index var iMaxZIndex = iCurrent - Z_INDICES_RESERVED; // initial minimum z-index var iMinZIndex = iCurrent - Z_INDEX_STEP; var iNextZIndex = fnGetLastZIndex(iMinZIndex, iMaxZIndex, aAssignedZIndices); aAssignedZIndices.push(iNextZIndex); return iNextZIndex; }
javascript
function (iCurrent) { // deduct indices reserved from current z-index var iMaxZIndex = iCurrent - Z_INDICES_RESERVED; // initial minimum z-index var iMinZIndex = iCurrent - Z_INDEX_STEP; var iNextZIndex = fnGetLastZIndex(iMinZIndex, iMaxZIndex, aAssignedZIndices); aAssignedZIndices.push(iNextZIndex); return iNextZIndex; }
[ "function", "(", "iCurrent", ")", "{", "var", "iMaxZIndex", "=", "iCurrent", "-", "Z_INDICES_RESERVED", ";", "var", "iMinZIndex", "=", "iCurrent", "-", "Z_INDEX_STEP", ";", "var", "iNextZIndex", "=", "fnGetLastZIndex", "(", "iMinZIndex", ",", "iMaxZIndex", ",", "aAssignedZIndices", ")", ";", "aAssignedZIndices", ".", "push", "(", "iNextZIndex", ")", ";", "return", "iNextZIndex", ";", "}" ]
Returns the next minimum possible z-index based on the passed z-index value. @param {int} iCurrent Current z-index value @returns {int} The next minimum z-index value @private
[ "Returns", "the", "next", "minimum", "possible", "z", "-", "index", "based", "on", "the", "passed", "z", "-", "index", "value", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.dt/src/sap/ui/dt/util/ZIndexManager.js#L185-L193
train
SAP/openui5
src/sap.ui.core/src/sap/ui/performance/trace/FESR.js
setClientDevice
function setClientDevice() { var iClientId = 0; if (Device.system.combi) { iClientId = 1; } else if (Device.system.desktop) { iClientId = 2; } else if (Device.system.tablet) { iClientId = 4; } else if (Device.system.phone) { iClientId = 3; } return iClientId; }
javascript
function setClientDevice() { var iClientId = 0; if (Device.system.combi) { iClientId = 1; } else if (Device.system.desktop) { iClientId = 2; } else if (Device.system.tablet) { iClientId = 4; } else if (Device.system.phone) { iClientId = 3; } return iClientId; }
[ "function", "setClientDevice", "(", ")", "{", "var", "iClientId", "=", "0", ";", "if", "(", "Device", ".", "system", ".", "combi", ")", "{", "iClientId", "=", "1", ";", "}", "else", "if", "(", "Device", ".", "system", ".", "desktop", ")", "{", "iClientId", "=", "2", ";", "}", "else", "if", "(", "Device", ".", "system", ".", "tablet", ")", "{", "iClientId", "=", "4", ";", "}", "else", "if", "(", "Device", ".", "system", ".", "phone", ")", "{", "iClientId", "=", "3", ";", "}", "return", "iClientId", ";", "}" ]
current header string
[ "current", "header", "string" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/performance/trace/FESR.js#L33-L45
train
SAP/openui5
src/sap.ui.core/src/sap/ui/performance/trace/FESR.js
createFESR
function createFESR(oInteraction, oFESRHandle) { return [ format(ROOT_ID, 32), // root_context_id format(sFESRTransactionId, 32), // transaction_id format(oInteraction.navigation, 16), // client_navigation_time format(oInteraction.roundtrip, 16), // client_round_trip_time format(oFESRHandle.timeToInteractive, 16), // end_to_end_time format(oInteraction.completeRoundtrips, 8), // completed network_round_trips format(sPassportAction, 40), // passport_action format(oInteraction.networkTime, 16), // network_time format(oInteraction.requestTime, 16), // request_time format(CLIENT_OS, 20), // client_os "SAP_UI5" // client_type ].join(","); }
javascript
function createFESR(oInteraction, oFESRHandle) { return [ format(ROOT_ID, 32), // root_context_id format(sFESRTransactionId, 32), // transaction_id format(oInteraction.navigation, 16), // client_navigation_time format(oInteraction.roundtrip, 16), // client_round_trip_time format(oFESRHandle.timeToInteractive, 16), // end_to_end_time format(oInteraction.completeRoundtrips, 8), // completed network_round_trips format(sPassportAction, 40), // passport_action format(oInteraction.networkTime, 16), // network_time format(oInteraction.requestTime, 16), // request_time format(CLIENT_OS, 20), // client_os "SAP_UI5" // client_type ].join(","); }
[ "function", "createFESR", "(", "oInteraction", ",", "oFESRHandle", ")", "{", "return", "[", "format", "(", "ROOT_ID", ",", "32", ")", ",", "format", "(", "sFESRTransactionId", ",", "32", ")", ",", "format", "(", "oInteraction", ".", "navigation", ",", "16", ")", ",", "format", "(", "oInteraction", ".", "roundtrip", ",", "16", ")", ",", "format", "(", "oFESRHandle", ".", "timeToInteractive", ",", "16", ")", ",", "format", "(", "oInteraction", ".", "completeRoundtrips", ",", "8", ")", ",", "format", "(", "sPassportAction", ",", "40", ")", ",", "format", "(", "oInteraction", ".", "networkTime", ",", "16", ")", ",", "format", "(", "oInteraction", ".", "requestTime", ",", "16", ")", ",", "format", "(", "CLIENT_OS", ",", "20", ")", ",", "\"SAP_UI5\"", "]", ".", "join", "(", "\",\"", ")", ";", "}" ]
creates mandatory FESR header string
[ "creates", "mandatory", "FESR", "header", "string" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/performance/trace/FESR.js#L109-L123
train
SAP/openui5
src/sap.ui.core/src/sap/ui/performance/trace/FESR.js
createFESRopt
function createFESRopt(oInteraction, oFESRHandle) { return [ format(oFESRHandle.appNameShort, 20, true), // application_name format(oFESRHandle.stepName, 20, true), // step_name "", // not assigned format(CLIENT_MODEL, 20), // client_model format(oInteraction.bytesSent, 16), // client_data_sent format(oInteraction.bytesReceived, 16), // client_data_received "", // network_protocol "", // network_provider format(oInteraction.processing, 16), // client_processing_time oInteraction.requestCompression ? "X" : "", // compressed - empty if not compressed "", // not assigned "", // persistency_accesses "", // persistency_time "", // persistency_data_transferred format(oInteraction.busyDuration, 16), // extension_1 - busy duration "", // extension_2 format(CLIENT_DEVICE, 1), // extension_3 - client device "", // extension_4 format(formatInteractionStartTimestamp(oInteraction.start), 20), // extension_5 - interaction start time format(oFESRHandle.appNameLong, 70, true) // application_name with 70 characters, trimmed from left ].join(","); }
javascript
function createFESRopt(oInteraction, oFESRHandle) { return [ format(oFESRHandle.appNameShort, 20, true), // application_name format(oFESRHandle.stepName, 20, true), // step_name "", // not assigned format(CLIENT_MODEL, 20), // client_model format(oInteraction.bytesSent, 16), // client_data_sent format(oInteraction.bytesReceived, 16), // client_data_received "", // network_protocol "", // network_provider format(oInteraction.processing, 16), // client_processing_time oInteraction.requestCompression ? "X" : "", // compressed - empty if not compressed "", // not assigned "", // persistency_accesses "", // persistency_time "", // persistency_data_transferred format(oInteraction.busyDuration, 16), // extension_1 - busy duration "", // extension_2 format(CLIENT_DEVICE, 1), // extension_3 - client device "", // extension_4 format(formatInteractionStartTimestamp(oInteraction.start), 20), // extension_5 - interaction start time format(oFESRHandle.appNameLong, 70, true) // application_name with 70 characters, trimmed from left ].join(","); }
[ "function", "createFESRopt", "(", "oInteraction", ",", "oFESRHandle", ")", "{", "return", "[", "format", "(", "oFESRHandle", ".", "appNameShort", ",", "20", ",", "true", ")", ",", "format", "(", "oFESRHandle", ".", "stepName", ",", "20", ",", "true", ")", ",", "\"\"", ",", "format", "(", "CLIENT_MODEL", ",", "20", ")", ",", "format", "(", "oInteraction", ".", "bytesSent", ",", "16", ")", ",", "format", "(", "oInteraction", ".", "bytesReceived", ",", "16", ")", ",", "\"\"", ",", "\"\"", ",", "format", "(", "oInteraction", ".", "processing", ",", "16", ")", ",", "oInteraction", ".", "requestCompression", "?", "\"X\"", ":", "\"\"", ",", "\"\"", ",", "\"\"", ",", "\"\"", ",", "\"\"", ",", "format", "(", "oInteraction", ".", "busyDuration", ",", "16", ")", ",", "\"\"", ",", "format", "(", "CLIENT_DEVICE", ",", "1", ")", ",", "\"\"", ",", "format", "(", "formatInteractionStartTimestamp", "(", "oInteraction", ".", "start", ")", ",", "20", ")", ",", "format", "(", "oFESRHandle", ".", "appNameLong", ",", "70", ",", "true", ")", "]", ".", "join", "(", "\",\"", ")", ";", "}" ]
creates optional FESR header string
[ "creates", "optional", "FESR", "header", "string" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/performance/trace/FESR.js#L126-L149
train
SAP/openui5
src/sap.ui.core/src/sap/ui/performance/trace/FESR.js
format
function format(vField, iLength, bCutFromFront) { if (!vField) { vField = vField === 0 ? "0" : ""; } else if (typeof vField === "number") { var iField = vField; vField = Math.round(vField).toString(); // Calculation of figures may be erroneous because incomplete performance entries lead to negative // numbers. In that case we set a -1, so the "dirty" record can be identified as such. if (vField.length > iLength || iField < 0) { vField = "-1"; } } else { vField = bCutFromFront ? vField.substr(-iLength, iLength) : vField.substr(0, iLength); } return vField; }
javascript
function format(vField, iLength, bCutFromFront) { if (!vField) { vField = vField === 0 ? "0" : ""; } else if (typeof vField === "number") { var iField = vField; vField = Math.round(vField).toString(); // Calculation of figures may be erroneous because incomplete performance entries lead to negative // numbers. In that case we set a -1, so the "dirty" record can be identified as such. if (vField.length > iLength || iField < 0) { vField = "-1"; } } else { vField = bCutFromFront ? vField.substr(-iLength, iLength) : vField.substr(0, iLength); } return vField; }
[ "function", "format", "(", "vField", ",", "iLength", ",", "bCutFromFront", ")", "{", "if", "(", "!", "vField", ")", "{", "vField", "=", "vField", "===", "0", "?", "\"0\"", ":", "\"\"", ";", "}", "else", "if", "(", "typeof", "vField", "===", "\"number\"", ")", "{", "var", "iField", "=", "vField", ";", "vField", "=", "Math", ".", "round", "(", "vField", ")", ".", "toString", "(", ")", ";", "if", "(", "vField", ".", "length", ">", "iLength", "||", "iField", "<", "0", ")", "{", "vField", "=", "\"-1\"", ";", "}", "}", "else", "{", "vField", "=", "bCutFromFront", "?", "vField", ".", "substr", "(", "-", "iLength", ",", "iLength", ")", ":", "vField", ".", "substr", "(", "0", ",", "iLength", ")", ";", "}", "return", "vField", ";", "}" ]
format string to fesr compliant string
[ "format", "string", "to", "fesr", "compliant", "string" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/performance/trace/FESR.js#L152-L167
train
SAP/openui5
src/sap.ui.fl/src/sap/ui/fl/variants/util/VariantUtil.js
function(oComponent) { var aTechnicalParameters = flUtils.getTechnicalParametersForComponent(oComponent); return aTechnicalParameters && aTechnicalParameters[VariantUtil.variantTechnicalParameterName] && Array.isArray(aTechnicalParameters[VariantUtil.variantTechnicalParameterName]) && aTechnicalParameters[VariantUtil.variantTechnicalParameterName][0]; }
javascript
function(oComponent) { var aTechnicalParameters = flUtils.getTechnicalParametersForComponent(oComponent); return aTechnicalParameters && aTechnicalParameters[VariantUtil.variantTechnicalParameterName] && Array.isArray(aTechnicalParameters[VariantUtil.variantTechnicalParameterName]) && aTechnicalParameters[VariantUtil.variantTechnicalParameterName][0]; }
[ "function", "(", "oComponent", ")", "{", "var", "aTechnicalParameters", "=", "flUtils", ".", "getTechnicalParametersForComponent", "(", "oComponent", ")", ";", "return", "aTechnicalParameters", "&&", "aTechnicalParameters", "[", "VariantUtil", ".", "variantTechnicalParameterName", "]", "&&", "Array", ".", "isArray", "(", "aTechnicalParameters", "[", "VariantUtil", ".", "variantTechnicalParameterName", "]", ")", "&&", "aTechnicalParameters", "[", "VariantUtil", ".", "variantTechnicalParameterName", "]", "[", "0", "]", ";", "}" ]
Returns control variant technical parameter for the passed component. @param {object} oComponent - Component instance used to get the technical parameters @returns {string|undefined} Returns the control variant technical parameter
[ "Returns", "control", "variant", "technical", "parameter", "for", "the", "passed", "component", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.fl/src/sap/ui/fl/variants/util/VariantUtil.js#L118-L124
train
SAP/openui5
src/sap.ui.table/src/sap/ui/table/TablePointerExtension.js
function() { this._ExtensionHelper = ExtensionHelper; this._ColumnResizeHelper = ColumnResizeHelper; this._InteractiveResizeHelper = InteractiveResizeHelper; this._ReorderHelper = ReorderHelper; this._ExtensionDelegate = ExtensionDelegate; this._RowHoverHandler = RowHoverHandler; this._KNOWNCLICKABLECONTROLS = KNOWNCLICKABLECONTROLS; }
javascript
function() { this._ExtensionHelper = ExtensionHelper; this._ColumnResizeHelper = ColumnResizeHelper; this._InteractiveResizeHelper = InteractiveResizeHelper; this._ReorderHelper = ReorderHelper; this._ExtensionDelegate = ExtensionDelegate; this._RowHoverHandler = RowHoverHandler; this._KNOWNCLICKABLECONTROLS = KNOWNCLICKABLECONTROLS; }
[ "function", "(", ")", "{", "this", ".", "_ExtensionHelper", "=", "ExtensionHelper", ";", "this", ".", "_ColumnResizeHelper", "=", "ColumnResizeHelper", ";", "this", ".", "_InteractiveResizeHelper", "=", "InteractiveResizeHelper", ";", "this", ".", "_ReorderHelper", "=", "ReorderHelper", ";", "this", ".", "_ExtensionDelegate", "=", "ExtensionDelegate", ";", "this", ".", "_RowHoverHandler", "=", "RowHoverHandler", ";", "this", ".", "_KNOWNCLICKABLECONTROLS", "=", "KNOWNCLICKABLECONTROLS", ";", "}" ]
Enables debugging for the extension. Internal helper classes become accessible. @private
[ "Enables", "debugging", "for", "the", "extension", ".", "Internal", "helper", "classes", "become", "accessible", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/TablePointerExtension.js#L979-L987
train
SAP/openui5
src/sap.ui.table/src/sap/ui/table/TablePointerExtension.js
function(iColIndex, oEvent) { var oTable = this.getTable(); if (oTable && TableUtils.Column.isColumnMovable(oTable.getColumns()[iColIndex])) { // Starting column drag & drop. We wait 200ms to make sure it is no click on the column to open the menu. oTable._mTimeouts.delayedColumnReorderTimerId = setTimeout(function() { ReorderHelper.initReordering(this, iColIndex, oEvent); }.bind(oTable), 200); } }
javascript
function(iColIndex, oEvent) { var oTable = this.getTable(); if (oTable && TableUtils.Column.isColumnMovable(oTable.getColumns()[iColIndex])) { // Starting column drag & drop. We wait 200ms to make sure it is no click on the column to open the menu. oTable._mTimeouts.delayedColumnReorderTimerId = setTimeout(function() { ReorderHelper.initReordering(this, iColIndex, oEvent); }.bind(oTable), 200); } }
[ "function", "(", "iColIndex", ",", "oEvent", ")", "{", "var", "oTable", "=", "this", ".", "getTable", "(", ")", ";", "if", "(", "oTable", "&&", "TableUtils", ".", "Column", ".", "isColumnMovable", "(", "oTable", ".", "getColumns", "(", ")", "[", "iColIndex", "]", ")", ")", "{", "oTable", ".", "_mTimeouts", ".", "delayedColumnReorderTimerId", "=", "setTimeout", "(", "function", "(", ")", "{", "ReorderHelper", ".", "initReordering", "(", "this", ",", "iColIndex", ",", "oEvent", ")", ";", "}", ".", "bind", "(", "oTable", ")", ",", "200", ")", ";", "}", "}" ]
Initialize the basic event handling for column reordering and starts the reordering. @param {int} iColIndex The index of the column to resize. @param {jQuery.Event} oEvent The event object.
[ "Initialize", "the", "basic", "event", "handling", "for", "column", "reordering", "and", "starts", "the", "reordering", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/TablePointerExtension.js#L1007-L1015
train
SAP/openui5
src/sap.m/src/sap/m/GrowingEnablement.js
function(oRm) { oRm.write("<div"); oRm.addClass("sapMListUl"); oRm.addClass("sapMGrowingList"); oRm.writeAttribute("id", this._oControl.getId() + "-triggerList"); oRm.addStyle("display", "none"); oRm.writeClasses(); oRm.writeStyles(); oRm.write(">"); oRm.renderControl(this._getTrigger()); oRm.write("</div>"); }
javascript
function(oRm) { oRm.write("<div"); oRm.addClass("sapMListUl"); oRm.addClass("sapMGrowingList"); oRm.writeAttribute("id", this._oControl.getId() + "-triggerList"); oRm.addStyle("display", "none"); oRm.writeClasses(); oRm.writeStyles(); oRm.write(">"); oRm.renderControl(this._getTrigger()); oRm.write("</div>"); }
[ "function", "(", "oRm", ")", "{", "oRm", ".", "write", "(", "\"<div\"", ")", ";", "oRm", ".", "addClass", "(", "\"sapMListUl\"", ")", ";", "oRm", ".", "addClass", "(", "\"sapMGrowingList\"", ")", ";", "oRm", ".", "writeAttribute", "(", "\"id\"", ",", "this", ".", "_oControl", ".", "getId", "(", ")", "+", "\"-triggerList\"", ")", ";", "oRm", ".", "addStyle", "(", "\"display\"", ",", "\"none\"", ")", ";", "oRm", ".", "writeClasses", "(", ")", ";", "oRm", ".", "writeStyles", "(", ")", ";", "oRm", ".", "write", "(", "\">\"", ")", ";", "oRm", ".", "renderControl", "(", "this", ".", "_getTrigger", "(", ")", ")", ";", "oRm", ".", "write", "(", "\"</div>\"", ")", ";", "}" ]
renders load more trigger
[ "renders", "load", "more", "trigger" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.m/src/sap/m/GrowingEnablement.js#L96-L107
train
SAP/openui5
src/sap.m/src/sap/m/GrowingEnablement.js
function() { if (!this._oControl || this._bLoading) { return; } // if max item count not reached or if we do not know the count var oBinding = this._oControl.getBinding("items"); if (oBinding && !oBinding.isLengthFinal() || this._iLimit < this._oControl.getMaxItemsCount()) { // The GrowingEnablement has its own busy indicator. Do not show the busy indicator, if existing, of the parent control. if (this._oControl.getMetadata().hasProperty("enableBusyIndicator")) { this._bParentEnableBusyIndicator = this._oControl.getEnableBusyIndicator(); this._oControl.setEnableBusyIndicator(false); } this._iLimit += this._oControl.getGrowingThreshold(); this._updateTriggerDelayed(true); this.updateItems("Growing"); } }
javascript
function() { if (!this._oControl || this._bLoading) { return; } // if max item count not reached or if we do not know the count var oBinding = this._oControl.getBinding("items"); if (oBinding && !oBinding.isLengthFinal() || this._iLimit < this._oControl.getMaxItemsCount()) { // The GrowingEnablement has its own busy indicator. Do not show the busy indicator, if existing, of the parent control. if (this._oControl.getMetadata().hasProperty("enableBusyIndicator")) { this._bParentEnableBusyIndicator = this._oControl.getEnableBusyIndicator(); this._oControl.setEnableBusyIndicator(false); } this._iLimit += this._oControl.getGrowingThreshold(); this._updateTriggerDelayed(true); this.updateItems("Growing"); } }
[ "function", "(", ")", "{", "if", "(", "!", "this", ".", "_oControl", "||", "this", ".", "_bLoading", ")", "{", "return", ";", "}", "var", "oBinding", "=", "this", ".", "_oControl", ".", "getBinding", "(", "\"items\"", ")", ";", "if", "(", "oBinding", "&&", "!", "oBinding", ".", "isLengthFinal", "(", ")", "||", "this", ".", "_iLimit", "<", "this", ".", "_oControl", ".", "getMaxItemsCount", "(", ")", ")", "{", "if", "(", "this", ".", "_oControl", ".", "getMetadata", "(", ")", ".", "hasProperty", "(", "\"enableBusyIndicator\"", ")", ")", "{", "this", ".", "_bParentEnableBusyIndicator", "=", "this", ".", "_oControl", ".", "getEnableBusyIndicator", "(", ")", ";", "this", ".", "_oControl", ".", "setEnableBusyIndicator", "(", "false", ")", ";", "}", "this", ".", "_iLimit", "+=", "this", ".", "_oControl", ".", "getGrowingThreshold", "(", ")", ";", "this", ".", "_updateTriggerDelayed", "(", "true", ")", ";", "this", ".", "updateItems", "(", "\"Growing\"", ")", ";", "}", "}" ]
call to request new page
[ "call", "to", "request", "new", "page" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.m/src/sap/m/GrowingEnablement.js#L173-L191
train
SAP/openui5
src/sap.m/src/sap/m/GrowingEnablement.js
function(sChangeReason) { this._bLoading = false; this._updateTriggerDelayed(false); this._oControl.onAfterPageLoaded(this.getInfo(), sChangeReason); // After the data has been loaded, restore the busy indicator handling of the parent control. if (this._oControl.setEnableBusyIndicator) { this._oControl.setEnableBusyIndicator(this._bParentEnableBusyIndicator); } }
javascript
function(sChangeReason) { this._bLoading = false; this._updateTriggerDelayed(false); this._oControl.onAfterPageLoaded(this.getInfo(), sChangeReason); // After the data has been loaded, restore the busy indicator handling of the parent control. if (this._oControl.setEnableBusyIndicator) { this._oControl.setEnableBusyIndicator(this._bParentEnableBusyIndicator); } }
[ "function", "(", "sChangeReason", ")", "{", "this", ".", "_bLoading", "=", "false", ";", "this", ".", "_updateTriggerDelayed", "(", "false", ")", ";", "this", ".", "_oControl", ".", "onAfterPageLoaded", "(", "this", ".", "getInfo", "(", ")", ",", "sChangeReason", ")", ";", "if", "(", "this", ".", "_oControl", ".", "setEnableBusyIndicator", ")", "{", "this", ".", "_oControl", ".", "setEnableBusyIndicator", "(", "this", ".", "_bParentEnableBusyIndicator", ")", ";", "}", "}" ]
called after new page loaded
[ "called", "after", "new", "page", "loaded" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.m/src/sap/m/GrowingEnablement.js#L200-L209
train
SAP/openui5
src/sap.m/src/sap/m/GrowingEnablement.js
function() { var sTriggerID = this._oControl.getId() + "-trigger", sTriggerText = this._oControl.getGrowingTriggerText(); sTriggerText = sTriggerText || sap.ui.getCore().getLibraryResourceBundle("sap.m").getText("LOAD_MORE_DATA"); this._oControl.addNavSection(sTriggerID); if (this._oTrigger) { this.setTriggerText(sTriggerText); return this._oTrigger; } // The growing button is changed to span tag as h1 tag was semantically incorrect. this._oTrigger = new CustomListItem({ id: sTriggerID, busyIndicatorDelay: 0, type: ListType.Active, content: new HTML({ content: '<div class="sapMGrowingListTrigger">' + '<div class="sapMSLITitleDiv sapMGrowingListTriggerText">' + '<span class="sapMSLITitle" id="' + sTriggerID + 'Text">' + encodeXML(sTriggerText) + '</span>' + '</div>' + '<div class="sapMGrowingListDescription sapMSLIDescription" id="' + sTriggerID + 'Info"></div>' + '</div>' }) }).setParent(this._oControl, null, true).attachPress(this.requestNewPage, this).addEventDelegate({ onsapenter : function(oEvent) { this.requestNewPage(); oEvent.preventDefault(); }, onsapspace : function(oEvent) { this.requestNewPage(); oEvent.preventDefault(); }, onAfterRendering : function(oEvent) { this._oTrigger.$().attr({ "tabindex": 0, "role": "button", "aria-labelledby": sTriggerID + "Text" + " " + sTriggerID + "Info" }); } }, this); // stop the eventing between item and the list this._oTrigger.getList = function() {}; // defines the tag name this._oTrigger.TagName = "div"; return this._oTrigger; }
javascript
function() { var sTriggerID = this._oControl.getId() + "-trigger", sTriggerText = this._oControl.getGrowingTriggerText(); sTriggerText = sTriggerText || sap.ui.getCore().getLibraryResourceBundle("sap.m").getText("LOAD_MORE_DATA"); this._oControl.addNavSection(sTriggerID); if (this._oTrigger) { this.setTriggerText(sTriggerText); return this._oTrigger; } // The growing button is changed to span tag as h1 tag was semantically incorrect. this._oTrigger = new CustomListItem({ id: sTriggerID, busyIndicatorDelay: 0, type: ListType.Active, content: new HTML({ content: '<div class="sapMGrowingListTrigger">' + '<div class="sapMSLITitleDiv sapMGrowingListTriggerText">' + '<span class="sapMSLITitle" id="' + sTriggerID + 'Text">' + encodeXML(sTriggerText) + '</span>' + '</div>' + '<div class="sapMGrowingListDescription sapMSLIDescription" id="' + sTriggerID + 'Info"></div>' + '</div>' }) }).setParent(this._oControl, null, true).attachPress(this.requestNewPage, this).addEventDelegate({ onsapenter : function(oEvent) { this.requestNewPage(); oEvent.preventDefault(); }, onsapspace : function(oEvent) { this.requestNewPage(); oEvent.preventDefault(); }, onAfterRendering : function(oEvent) { this._oTrigger.$().attr({ "tabindex": 0, "role": "button", "aria-labelledby": sTriggerID + "Text" + " " + sTriggerID + "Info" }); } }, this); // stop the eventing between item and the list this._oTrigger.getList = function() {}; // defines the tag name this._oTrigger.TagName = "div"; return this._oTrigger; }
[ "function", "(", ")", "{", "var", "sTriggerID", "=", "this", ".", "_oControl", ".", "getId", "(", ")", "+", "\"-trigger\"", ",", "sTriggerText", "=", "this", ".", "_oControl", ".", "getGrowingTriggerText", "(", ")", ";", "sTriggerText", "=", "sTriggerText", "||", "sap", ".", "ui", ".", "getCore", "(", ")", ".", "getLibraryResourceBundle", "(", "\"sap.m\"", ")", ".", "getText", "(", "\"LOAD_MORE_DATA\"", ")", ";", "this", ".", "_oControl", ".", "addNavSection", "(", "sTriggerID", ")", ";", "if", "(", "this", ".", "_oTrigger", ")", "{", "this", ".", "setTriggerText", "(", "sTriggerText", ")", ";", "return", "this", ".", "_oTrigger", ";", "}", "this", ".", "_oTrigger", "=", "new", "CustomListItem", "(", "{", "id", ":", "sTriggerID", ",", "busyIndicatorDelay", ":", "0", ",", "type", ":", "ListType", ".", "Active", ",", "content", ":", "new", "HTML", "(", "{", "content", ":", "'<div class=\"sapMGrowingListTrigger\">'", "+", "'<div class=\"sapMSLITitleDiv sapMGrowingListTriggerText\">'", "+", "'<span class=\"sapMSLITitle\" id=\"'", "+", "sTriggerID", "+", "'Text\">'", "+", "encodeXML", "(", "sTriggerText", ")", "+", "'</span>'", "+", "'</div>'", "+", "'<div class=\"sapMGrowingListDescription sapMSLIDescription\" id=\"'", "+", "sTriggerID", "+", "'Info\"></div>'", "+", "'</div>'", "}", ")", "}", ")", ".", "setParent", "(", "this", ".", "_oControl", ",", "null", ",", "true", ")", ".", "attachPress", "(", "this", ".", "requestNewPage", ",", "this", ")", ".", "addEventDelegate", "(", "{", "onsapenter", ":", "function", "(", "oEvent", ")", "{", "this", ".", "requestNewPage", "(", ")", ";", "oEvent", ".", "preventDefault", "(", ")", ";", "}", ",", "onsapspace", ":", "function", "(", "oEvent", ")", "{", "this", ".", "requestNewPage", "(", ")", ";", "oEvent", ".", "preventDefault", "(", ")", ";", "}", ",", "onAfterRendering", ":", "function", "(", "oEvent", ")", "{", "this", ".", "_oTrigger", ".", "$", "(", ")", ".", "attr", "(", "{", "\"tabindex\"", ":", "0", ",", "\"role\"", ":", "\"button\"", ",", "\"aria-labelledby\"", ":", "sTriggerID", "+", "\"Text\"", "+", "\" \"", "+", "sTriggerID", "+", "\"Info\"", "}", ")", ";", "}", "}", ",", "this", ")", ";", "this", ".", "_oTrigger", ".", "getList", "=", "function", "(", ")", "{", "}", ";", "this", ".", "_oTrigger", ".", "TagName", "=", "\"div\"", ";", "return", "this", ".", "_oTrigger", ";", "}" ]
created and returns load more trigger
[ "created", "and", "returns", "load", "more", "trigger" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.m/src/sap/m/GrowingEnablement.js#L212-L261
train
SAP/openui5
src/sap.m/src/sap/m/GrowingEnablement.js
function(oBinding) { var aSorters = oBinding.aSorters || []; var oSorter = aSorters[0] || {}; return (oSorter.fnGroup) ? oSorter.sPath || "" : ""; }
javascript
function(oBinding) { var aSorters = oBinding.aSorters || []; var oSorter = aSorters[0] || {}; return (oSorter.fnGroup) ? oSorter.sPath || "" : ""; }
[ "function", "(", "oBinding", ")", "{", "var", "aSorters", "=", "oBinding", ".", "aSorters", "||", "[", "]", ";", "var", "oSorter", "=", "aSorters", "[", "0", "]", "||", "{", "}", ";", "return", "(", "oSorter", ".", "fnGroup", ")", "?", "oSorter", ".", "sPath", "||", "\"\"", ":", "\"\"", ";", "}" ]
returns the first sorters grouping path when available
[ "returns", "the", "first", "sorters", "grouping", "path", "when", "available" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.m/src/sap/m/GrowingEnablement.js#L269-L273
train
SAP/openui5
src/sap.m/src/sap/m/GrowingEnablement.js
function(oContext, oBindingInfo, bSuppressInvalidate) { var oControl = this._oControl, oBinding = oBindingInfo.binding, oItem = this.createListItem(oContext, oBindingInfo); if (oBinding.isGrouped()) { // creates group header if need var aItems = oControl.getItems(true), oLastItem = aItems[aItems.length - 1], sModelName = oBindingInfo.model, oGroupInfo = oBinding.getGroup(oItem.getBindingContext(sModelName)); if (oLastItem && oLastItem.isGroupHeader()) { oControl.removeAggregation("items", oLastItem, true); this._fnAppendGroupItem = this.appendGroupItem.bind(this, oGroupInfo, oLastItem, bSuppressInvalidate); oLastItem = aItems[aItems.length - 1]; } if (!oLastItem || oGroupInfo.key !== oBinding.getGroup(oLastItem.getBindingContext(sModelName)).key) { var oGroupHeader = (oBindingInfo.groupHeaderFactory) ? oBindingInfo.groupHeaderFactory(oGroupInfo) : null; if (oControl.getGrowingDirection() == ListGrowingDirection.Upwards) { this.applyPendingGroupItem(); this._fnAppendGroupItem = this.appendGroupItem.bind(this, oGroupInfo, oGroupHeader, bSuppressInvalidate); } else { this.appendGroupItem(oGroupInfo, oGroupHeader, bSuppressInvalidate); } } } oControl.addAggregation("items", oItem, bSuppressInvalidate); if (bSuppressInvalidate) { this._aChunk.push(oItem); } }
javascript
function(oContext, oBindingInfo, bSuppressInvalidate) { var oControl = this._oControl, oBinding = oBindingInfo.binding, oItem = this.createListItem(oContext, oBindingInfo); if (oBinding.isGrouped()) { // creates group header if need var aItems = oControl.getItems(true), oLastItem = aItems[aItems.length - 1], sModelName = oBindingInfo.model, oGroupInfo = oBinding.getGroup(oItem.getBindingContext(sModelName)); if (oLastItem && oLastItem.isGroupHeader()) { oControl.removeAggregation("items", oLastItem, true); this._fnAppendGroupItem = this.appendGroupItem.bind(this, oGroupInfo, oLastItem, bSuppressInvalidate); oLastItem = aItems[aItems.length - 1]; } if (!oLastItem || oGroupInfo.key !== oBinding.getGroup(oLastItem.getBindingContext(sModelName)).key) { var oGroupHeader = (oBindingInfo.groupHeaderFactory) ? oBindingInfo.groupHeaderFactory(oGroupInfo) : null; if (oControl.getGrowingDirection() == ListGrowingDirection.Upwards) { this.applyPendingGroupItem(); this._fnAppendGroupItem = this.appendGroupItem.bind(this, oGroupInfo, oGroupHeader, bSuppressInvalidate); } else { this.appendGroupItem(oGroupInfo, oGroupHeader, bSuppressInvalidate); } } } oControl.addAggregation("items", oItem, bSuppressInvalidate); if (bSuppressInvalidate) { this._aChunk.push(oItem); } }
[ "function", "(", "oContext", ",", "oBindingInfo", ",", "bSuppressInvalidate", ")", "{", "var", "oControl", "=", "this", ".", "_oControl", ",", "oBinding", "=", "oBindingInfo", ".", "binding", ",", "oItem", "=", "this", ".", "createListItem", "(", "oContext", ",", "oBindingInfo", ")", ";", "if", "(", "oBinding", ".", "isGrouped", "(", ")", ")", "{", "var", "aItems", "=", "oControl", ".", "getItems", "(", "true", ")", ",", "oLastItem", "=", "aItems", "[", "aItems", ".", "length", "-", "1", "]", ",", "sModelName", "=", "oBindingInfo", ".", "model", ",", "oGroupInfo", "=", "oBinding", ".", "getGroup", "(", "oItem", ".", "getBindingContext", "(", "sModelName", ")", ")", ";", "if", "(", "oLastItem", "&&", "oLastItem", ".", "isGroupHeader", "(", ")", ")", "{", "oControl", ".", "removeAggregation", "(", "\"items\"", ",", "oLastItem", ",", "true", ")", ";", "this", ".", "_fnAppendGroupItem", "=", "this", ".", "appendGroupItem", ".", "bind", "(", "this", ",", "oGroupInfo", ",", "oLastItem", ",", "bSuppressInvalidate", ")", ";", "oLastItem", "=", "aItems", "[", "aItems", ".", "length", "-", "1", "]", ";", "}", "if", "(", "!", "oLastItem", "||", "oGroupInfo", ".", "key", "!==", "oBinding", ".", "getGroup", "(", "oLastItem", ".", "getBindingContext", "(", "sModelName", ")", ")", ".", "key", ")", "{", "var", "oGroupHeader", "=", "(", "oBindingInfo", ".", "groupHeaderFactory", ")", "?", "oBindingInfo", ".", "groupHeaderFactory", "(", "oGroupInfo", ")", ":", "null", ";", "if", "(", "oControl", ".", "getGrowingDirection", "(", ")", "==", "ListGrowingDirection", ".", "Upwards", ")", "{", "this", ".", "applyPendingGroupItem", "(", ")", ";", "this", ".", "_fnAppendGroupItem", "=", "this", ".", "appendGroupItem", ".", "bind", "(", "this", ",", "oGroupInfo", ",", "oGroupHeader", ",", "bSuppressInvalidate", ")", ";", "}", "else", "{", "this", ".", "appendGroupItem", "(", "oGroupInfo", ",", "oGroupHeader", ",", "bSuppressInvalidate", ")", ";", "}", "}", "}", "oControl", ".", "addAggregation", "(", "\"items\"", ",", "oItem", ",", "bSuppressInvalidate", ")", ";", "if", "(", "bSuppressInvalidate", ")", "{", "this", ".", "_aChunk", ".", "push", "(", "oItem", ")", ";", "}", "}" ]
appends single list item to the list
[ "appends", "single", "list", "item", "to", "the", "list" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.m/src/sap/m/GrowingEnablement.js#L310-L344
train
SAP/openui5
src/sap.m/src/sap/m/GrowingEnablement.js
function(oContext, oBindingInfo) { this._iRenderedDataItems++; var oItem = oBindingInfo.factory(ManagedObjectMetadata.uid("clone"), oContext); return oItem.setBindingContext(oContext, oBindingInfo.model); }
javascript
function(oContext, oBindingInfo) { this._iRenderedDataItems++; var oItem = oBindingInfo.factory(ManagedObjectMetadata.uid("clone"), oContext); return oItem.setBindingContext(oContext, oBindingInfo.model); }
[ "function", "(", "oContext", ",", "oBindingInfo", ")", "{", "this", ".", "_iRenderedDataItems", "++", ";", "var", "oItem", "=", "oBindingInfo", ".", "factory", "(", "ManagedObjectMetadata", ".", "uid", "(", "\"clone\"", ")", ",", "oContext", ")", ";", "return", "oItem", ".", "setBindingContext", "(", "oContext", ",", "oBindingInfo", ".", "model", ")", ";", "}" ]
creates list item from the factory
[ "creates", "list", "item", "from", "the", "factory" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.m/src/sap/m/GrowingEnablement.js#L361-L365
train
SAP/openui5
src/sap.m/src/sap/m/GrowingEnablement.js
function(aContexts, oModel) { if (!aContexts.length) { return; } var aItems = this._oControl.getItems(true); for (var i = 0, c = 0, oItem; i < aItems.length; i++) { oItem = aItems[i]; // group headers are not in binding context if (!oItem.isGroupHeader()) { oItem.setBindingContext(aContexts[c++], oModel); } } }
javascript
function(aContexts, oModel) { if (!aContexts.length) { return; } var aItems = this._oControl.getItems(true); for (var i = 0, c = 0, oItem; i < aItems.length; i++) { oItem = aItems[i]; // group headers are not in binding context if (!oItem.isGroupHeader()) { oItem.setBindingContext(aContexts[c++], oModel); } } }
[ "function", "(", "aContexts", ",", "oModel", ")", "{", "if", "(", "!", "aContexts", ".", "length", ")", "{", "return", ";", "}", "var", "aItems", "=", "this", ".", "_oControl", ".", "getItems", "(", "true", ")", ";", "for", "(", "var", "i", "=", "0", ",", "c", "=", "0", ",", "oItem", ";", "i", "<", "aItems", ".", "length", ";", "i", "++", ")", "{", "oItem", "=", "aItems", "[", "i", "]", ";", "if", "(", "!", "oItem", ".", "isGroupHeader", "(", ")", ")", "{", "oItem", ".", "setBindingContext", "(", "aContexts", "[", "c", "++", "]", ",", "oModel", ")", ";", "}", "}", "}" ]
update context on all items except group headers
[ "update", "context", "on", "all", "items", "except", "group", "headers" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.m/src/sap/m/GrowingEnablement.js#L368-L382
train
SAP/openui5
src/sap.m/src/sap/m/GrowingEnablement.js
function(aContexts, oBindingInfo, bSuppressInvalidate) { for (var i = 0; i < aContexts.length; i++) { this.addListItem(aContexts[i], oBindingInfo, bSuppressInvalidate); } }
javascript
function(aContexts, oBindingInfo, bSuppressInvalidate) { for (var i = 0; i < aContexts.length; i++) { this.addListItem(aContexts[i], oBindingInfo, bSuppressInvalidate); } }
[ "function", "(", "aContexts", ",", "oBindingInfo", ",", "bSuppressInvalidate", ")", "{", "for", "(", "var", "i", "=", "0", ";", "i", "<", "aContexts", ".", "length", ";", "i", "++", ")", "{", "this", ".", "addListItem", "(", "aContexts", "[", "i", "]", ",", "oBindingInfo", ",", "bSuppressInvalidate", ")", ";", "}", "}" ]
add multiple items to the list via BindingContext
[ "add", "multiple", "items", "to", "the", "list", "via", "BindingContext" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.m/src/sap/m/GrowingEnablement.js#L415-L419
train
SAP/openui5
src/sap.m/src/sap/m/GrowingEnablement.js
function(aContexts, oBindingInfo, bSuppressInvalidate) { this.destroyListItems(bSuppressInvalidate); this.addListItems(aContexts, oBindingInfo, bSuppressInvalidate); if (bSuppressInvalidate) { var bHasFocus = this._oContainerDomRef.contains(document.activeElement); this.applyChunk(false); bHasFocus && this._oControl.focus(); } else { this.applyPendingGroupItem(); } }
javascript
function(aContexts, oBindingInfo, bSuppressInvalidate) { this.destroyListItems(bSuppressInvalidate); this.addListItems(aContexts, oBindingInfo, bSuppressInvalidate); if (bSuppressInvalidate) { var bHasFocus = this._oContainerDomRef.contains(document.activeElement); this.applyChunk(false); bHasFocus && this._oControl.focus(); } else { this.applyPendingGroupItem(); } }
[ "function", "(", "aContexts", ",", "oBindingInfo", ",", "bSuppressInvalidate", ")", "{", "this", ".", "destroyListItems", "(", "bSuppressInvalidate", ")", ";", "this", ".", "addListItems", "(", "aContexts", ",", "oBindingInfo", ",", "bSuppressInvalidate", ")", ";", "if", "(", "bSuppressInvalidate", ")", "{", "var", "bHasFocus", "=", "this", ".", "_oContainerDomRef", ".", "contains", "(", "document", ".", "activeElement", ")", ";", "this", ".", "applyChunk", "(", "false", ")", ";", "bHasFocus", "&&", "this", ".", "_oControl", ".", "focus", "(", ")", ";", "}", "else", "{", "this", ".", "applyPendingGroupItem", "(", ")", ";", "}", "}" ]
destroy all the items and create from scratch
[ "destroy", "all", "the", "items", "and", "create", "from", "scratch" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.m/src/sap/m/GrowingEnablement.js#L422-L432
train
SAP/openui5
src/sap.m/src/sap/m/GrowingEnablement.js
function(oContext, oBindingInfo, iIndex) { var oItem = this.createListItem(oContext, oBindingInfo); this._oControl.insertAggregation("items", oItem, iIndex, true); this._aChunk.push(oItem); }
javascript
function(oContext, oBindingInfo, iIndex) { var oItem = this.createListItem(oContext, oBindingInfo); this._oControl.insertAggregation("items", oItem, iIndex, true); this._aChunk.push(oItem); }
[ "function", "(", "oContext", ",", "oBindingInfo", ",", "iIndex", ")", "{", "var", "oItem", "=", "this", ".", "createListItem", "(", "oContext", ",", "oBindingInfo", ")", ";", "this", ".", "_oControl", ".", "insertAggregation", "(", "\"items\"", ",", "oItem", ",", "iIndex", ",", "true", ")", ";", "this", ".", "_aChunk", ".", "push", "(", "oItem", ")", ";", "}" ]
inserts a single list item
[ "inserts", "a", "single", "list", "item" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.m/src/sap/m/GrowingEnablement.js#L435-L439
train
SAP/openui5
src/sap.m/src/sap/m/GrowingEnablement.js
function(sChangeReason) { if (!this._bDataRequested) { this._bDataRequested = true; this._onBeforePageLoaded(sChangeReason); } // set iItemCount to initial value if not set or no items at the control yet if (!this._iLimit || this.shouldReset(sChangeReason) || !this._oControl.getItems(true).length) { this._iLimit = this._oControl.getGrowingThreshold(); } // send the request to get the context this._oControl.getBinding("items").getContexts(0, this._iLimit); }
javascript
function(sChangeReason) { if (!this._bDataRequested) { this._bDataRequested = true; this._onBeforePageLoaded(sChangeReason); } // set iItemCount to initial value if not set or no items at the control yet if (!this._iLimit || this.shouldReset(sChangeReason) || !this._oControl.getItems(true).length) { this._iLimit = this._oControl.getGrowingThreshold(); } // send the request to get the context this._oControl.getBinding("items").getContexts(0, this._iLimit); }
[ "function", "(", "sChangeReason", ")", "{", "if", "(", "!", "this", ".", "_bDataRequested", ")", "{", "this", ".", "_bDataRequested", "=", "true", ";", "this", ".", "_onBeforePageLoaded", "(", "sChangeReason", ")", ";", "}", "if", "(", "!", "this", ".", "_iLimit", "||", "this", ".", "shouldReset", "(", "sChangeReason", ")", "||", "!", "this", ".", "_oControl", ".", "getItems", "(", "true", ")", ".", "length", ")", "{", "this", ".", "_iLimit", "=", "this", ".", "_oControl", ".", "getGrowingThreshold", "(", ")", ";", "}", "this", ".", "_oControl", ".", "getBinding", "(", "\"items\"", ")", ".", "getContexts", "(", "0", ",", "this", ".", "_iLimit", ")", ";", "}" ]
refresh items only for OData model.
[ "refresh", "items", "only", "for", "OData", "model", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.m/src/sap/m/GrowingEnablement.js#L450-L463
train
SAP/openui5
src/sap.m/src/sap/m/GrowingEnablement.js
function(bLoading) { var oTrigger = this._oTrigger, oControl = this._oControl; // If there are no visible columns then also hide the trigger. if (!oTrigger || !oControl || !oControl.shouldRenderItems() || !oControl.getDomRef()) { return; } var oBinding = oControl.getBinding("items"); if (!oBinding) { return; } // update busy state oTrigger.setBusy(bLoading); oTrigger.$().toggleClass("sapMGrowingListBusyIndicatorVisible", bLoading); if (bLoading) { oTrigger.setActive(false); oControl.$("triggerList").css("display", ""); } else { var aItems = oControl.getItems(true), iItemsLength = aItems.length, iBindingLength = oBinding.getLength() || 0, bLengthFinal = oBinding.isLengthFinal(), bHasScrollToLoad = oControl.getGrowingScrollToLoad(), oTriggerDomRef = oTrigger.getDomRef(); // put the focus to the newly added item if growing button is pressed if (oTriggerDomRef && oTriggerDomRef.contains(document.activeElement)) { (aItems[this._iLastItemsCount] || oControl).focus(); } // show, update or hide the growing button if (!iItemsLength || !this._iLimit || (bLengthFinal && this._iLimit >= iBindingLength) || (bHasScrollToLoad && this._getHasScrollbars())) { oControl.$("triggerList").css("display", "none"); } else { if (bLengthFinal) { oControl.$("triggerInfo").css("display", "block").text(this._getListItemInfo()); } oTrigger.$().removeClass("sapMGrowingListBusyIndicatorVisible"); oControl.$("triggerList").css("display", ""); } // store the last item count to be able to focus to the newly added item when the growing button is pressed this._iLastItemsCount = this._oControl.getItems(true).length; // at the beginning we should scroll to last item if (bHasScrollToLoad && this._oScrollPosition === undefined && oControl.getGrowingDirection() == ListGrowingDirection.Upwards) { this._oScrollPosition = { left : 0, top : 0 }; } // scroll to last position if (iItemsLength > 0 && this._oScrollPosition) { var oScrollDelegate = this._oScrollDelegate, oScrollPosition = this._oScrollPosition; oScrollDelegate.scrollTo(oScrollPosition.left, oScrollDelegate.getScrollHeight() - oScrollPosition.top); this._oScrollPosition = null; } } }
javascript
function(bLoading) { var oTrigger = this._oTrigger, oControl = this._oControl; // If there are no visible columns then also hide the trigger. if (!oTrigger || !oControl || !oControl.shouldRenderItems() || !oControl.getDomRef()) { return; } var oBinding = oControl.getBinding("items"); if (!oBinding) { return; } // update busy state oTrigger.setBusy(bLoading); oTrigger.$().toggleClass("sapMGrowingListBusyIndicatorVisible", bLoading); if (bLoading) { oTrigger.setActive(false); oControl.$("triggerList").css("display", ""); } else { var aItems = oControl.getItems(true), iItemsLength = aItems.length, iBindingLength = oBinding.getLength() || 0, bLengthFinal = oBinding.isLengthFinal(), bHasScrollToLoad = oControl.getGrowingScrollToLoad(), oTriggerDomRef = oTrigger.getDomRef(); // put the focus to the newly added item if growing button is pressed if (oTriggerDomRef && oTriggerDomRef.contains(document.activeElement)) { (aItems[this._iLastItemsCount] || oControl).focus(); } // show, update or hide the growing button if (!iItemsLength || !this._iLimit || (bLengthFinal && this._iLimit >= iBindingLength) || (bHasScrollToLoad && this._getHasScrollbars())) { oControl.$("triggerList").css("display", "none"); } else { if (bLengthFinal) { oControl.$("triggerInfo").css("display", "block").text(this._getListItemInfo()); } oTrigger.$().removeClass("sapMGrowingListBusyIndicatorVisible"); oControl.$("triggerList").css("display", ""); } // store the last item count to be able to focus to the newly added item when the growing button is pressed this._iLastItemsCount = this._oControl.getItems(true).length; // at the beginning we should scroll to last item if (bHasScrollToLoad && this._oScrollPosition === undefined && oControl.getGrowingDirection() == ListGrowingDirection.Upwards) { this._oScrollPosition = { left : 0, top : 0 }; } // scroll to last position if (iItemsLength > 0 && this._oScrollPosition) { var oScrollDelegate = this._oScrollDelegate, oScrollPosition = this._oScrollPosition; oScrollDelegate.scrollTo(oScrollPosition.left, oScrollDelegate.getScrollHeight() - oScrollPosition.top); this._oScrollPosition = null; } } }
[ "function", "(", "bLoading", ")", "{", "var", "oTrigger", "=", "this", ".", "_oTrigger", ",", "oControl", "=", "this", ".", "_oControl", ";", "if", "(", "!", "oTrigger", "||", "!", "oControl", "||", "!", "oControl", ".", "shouldRenderItems", "(", ")", "||", "!", "oControl", ".", "getDomRef", "(", ")", ")", "{", "return", ";", "}", "var", "oBinding", "=", "oControl", ".", "getBinding", "(", "\"items\"", ")", ";", "if", "(", "!", "oBinding", ")", "{", "return", ";", "}", "oTrigger", ".", "setBusy", "(", "bLoading", ")", ";", "oTrigger", ".", "$", "(", ")", ".", "toggleClass", "(", "\"sapMGrowingListBusyIndicatorVisible\"", ",", "bLoading", ")", ";", "if", "(", "bLoading", ")", "{", "oTrigger", ".", "setActive", "(", "false", ")", ";", "oControl", ".", "$", "(", "\"triggerList\"", ")", ".", "css", "(", "\"display\"", ",", "\"\"", ")", ";", "}", "else", "{", "var", "aItems", "=", "oControl", ".", "getItems", "(", "true", ")", ",", "iItemsLength", "=", "aItems", ".", "length", ",", "iBindingLength", "=", "oBinding", ".", "getLength", "(", ")", "||", "0", ",", "bLengthFinal", "=", "oBinding", ".", "isLengthFinal", "(", ")", ",", "bHasScrollToLoad", "=", "oControl", ".", "getGrowingScrollToLoad", "(", ")", ",", "oTriggerDomRef", "=", "oTrigger", ".", "getDomRef", "(", ")", ";", "if", "(", "oTriggerDomRef", "&&", "oTriggerDomRef", ".", "contains", "(", "document", ".", "activeElement", ")", ")", "{", "(", "aItems", "[", "this", ".", "_iLastItemsCount", "]", "||", "oControl", ")", ".", "focus", "(", ")", ";", "}", "if", "(", "!", "iItemsLength", "||", "!", "this", ".", "_iLimit", "||", "(", "bLengthFinal", "&&", "this", ".", "_iLimit", ">=", "iBindingLength", ")", "||", "(", "bHasScrollToLoad", "&&", "this", ".", "_getHasScrollbars", "(", ")", ")", ")", "{", "oControl", ".", "$", "(", "\"triggerList\"", ")", ".", "css", "(", "\"display\"", ",", "\"none\"", ")", ";", "}", "else", "{", "if", "(", "bLengthFinal", ")", "{", "oControl", ".", "$", "(", "\"triggerInfo\"", ")", ".", "css", "(", "\"display\"", ",", "\"block\"", ")", ".", "text", "(", "this", ".", "_getListItemInfo", "(", ")", ")", ";", "}", "oTrigger", ".", "$", "(", ")", ".", "removeClass", "(", "\"sapMGrowingListBusyIndicatorVisible\"", ")", ";", "oControl", ".", "$", "(", "\"triggerList\"", ")", ".", "css", "(", "\"display\"", ",", "\"\"", ")", ";", "}", "this", ".", "_iLastItemsCount", "=", "this", ".", "_oControl", ".", "getItems", "(", "true", ")", ".", "length", ";", "if", "(", "bHasScrollToLoad", "&&", "this", ".", "_oScrollPosition", "===", "undefined", "&&", "oControl", ".", "getGrowingDirection", "(", ")", "==", "ListGrowingDirection", ".", "Upwards", ")", "{", "this", ".", "_oScrollPosition", "=", "{", "left", ":", "0", ",", "top", ":", "0", "}", ";", "}", "if", "(", "iItemsLength", ">", "0", "&&", "this", ".", "_oScrollPosition", ")", "{", "var", "oScrollDelegate", "=", "this", ".", "_oScrollDelegate", ",", "oScrollPosition", "=", "this", ".", "_oScrollPosition", ";", "oScrollDelegate", ".", "scrollTo", "(", "oScrollPosition", ".", "left", ",", "oScrollDelegate", ".", "getScrollHeight", "(", ")", "-", "oScrollPosition", ".", "top", ")", ";", "this", ".", "_oScrollPosition", "=", "null", ";", "}", "}", "}" ]
updates the trigger state
[ "updates", "the", "trigger", "state" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.m/src/sap/m/GrowingEnablement.js#L611-L679
train
SAP/openui5
src/sap.ui.core/src/sap/ui/core/routing/Targets.js
function () { var sTargetName; EventProvider.prototype.destroy.apply(this); for (sTargetName in this._mTargets) { if (this._mTargets.hasOwnProperty(sTargetName)) { this._mTargets[sTargetName].destroy(); } } this._mTargets = null; this._oCache = null; this._oConfig = null; this.bIsDestroyed = true; return this; }
javascript
function () { var sTargetName; EventProvider.prototype.destroy.apply(this); for (sTargetName in this._mTargets) { if (this._mTargets.hasOwnProperty(sTargetName)) { this._mTargets[sTargetName].destroy(); } } this._mTargets = null; this._oCache = null; this._oConfig = null; this.bIsDestroyed = true; return this; }
[ "function", "(", ")", "{", "var", "sTargetName", ";", "EventProvider", ".", "prototype", ".", "destroy", ".", "apply", "(", "this", ")", ";", "for", "(", "sTargetName", "in", "this", ".", "_mTargets", ")", "{", "if", "(", "this", ".", "_mTargets", ".", "hasOwnProperty", "(", "sTargetName", ")", ")", "{", "this", ".", "_mTargets", "[", "sTargetName", "]", ".", "destroy", "(", ")", ";", "}", "}", "this", ".", "_mTargets", "=", "null", ";", "this", ".", "_oCache", "=", "null", ";", "this", ".", "_oConfig", "=", "null", ";", "this", ".", "bIsDestroyed", "=", "true", ";", "return", "this", ";", "}" ]
Destroys the targets instance and all created targets. Does not destroy the views instance passed to the constructor. It has to be destroyed separately. @public @returns { sap.ui.core.routing.Targets } this for chaining.
[ "Destroys", "the", "targets", "instance", "and", "all", "created", "targets", ".", "Does", "not", "destroy", "the", "views", "instance", "passed", "to", "the", "constructor", ".", "It", "has", "to", "be", "destroyed", "separately", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/routing/Targets.js#L347-L363
train
SAP/openui5
src/sap.ui.core/src/sap/ui/core/routing/Targets.js
function (sName, oTargetOptions) { var oOldTarget = this.getTarget(sName), oTarget; if (oOldTarget) { Log.error("Target with name " + sName + " already exists", this); } else { oTarget = this._createTarget(sName, oTargetOptions); this._addParentTo(oTarget); } return this; }
javascript
function (sName, oTargetOptions) { var oOldTarget = this.getTarget(sName), oTarget; if (oOldTarget) { Log.error("Target with name " + sName + " already exists", this); } else { oTarget = this._createTarget(sName, oTargetOptions); this._addParentTo(oTarget); } return this; }
[ "function", "(", "sName", ",", "oTargetOptions", ")", "{", "var", "oOldTarget", "=", "this", ".", "getTarget", "(", "sName", ")", ",", "oTarget", ";", "if", "(", "oOldTarget", ")", "{", "Log", ".", "error", "(", "\"Target with name \"", "+", "sName", "+", "\" already exists\"", ",", "this", ")", ";", "}", "else", "{", "oTarget", "=", "this", ".", "_createTarget", "(", "sName", ",", "oTargetOptions", ")", ";", "this", ".", "_addParentTo", "(", "oTarget", ")", ";", "}", "return", "this", ";", "}" ]
Creates a target by using the given name and options. If there's already a target with the same name exists, the existing target is kept from being overwritten and an error log will be written to the development console. @param {string} sName the name of a target @param {object} oTarget the options of a target. The option names are the same as the ones in "oOptions.targets.anyName" of {@link #constructor}. @returns {sap.ui.core.routing.Targets} Targets itself for method chaining @public
[ "Creates", "a", "target", "by", "using", "the", "given", "name", "and", "options", ".", "If", "there", "s", "already", "a", "target", "with", "the", "same", "name", "exists", "the", "existing", "target", "is", "kept", "from", "being", "overwritten", "and", "an", "error", "log", "will", "be", "written", "to", "the", "development", "console", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/routing/Targets.js#L427-L439
train
SAP/openui5
src/sap.ui.core/src/sap/ui/core/routing/Targets.js
function (sName, oTargetOptions) { var oTarget, oOptions; oOptions = jQuery.extend(true, { _name: sName }, this._oConfig, oTargetOptions); oTarget = this._constructTarget(oOptions); oTarget.attachDisplay(function (oEvent) { var oParameters = oEvent.getParameters(); this.fireDisplay({ name : sName, view : oParameters.view, control : oParameters.control, config : oParameters.config, data: oParameters.data }); }, this); this._mTargets[sName] = oTarget; return oTarget; }
javascript
function (sName, oTargetOptions) { var oTarget, oOptions; oOptions = jQuery.extend(true, { _name: sName }, this._oConfig, oTargetOptions); oTarget = this._constructTarget(oOptions); oTarget.attachDisplay(function (oEvent) { var oParameters = oEvent.getParameters(); this.fireDisplay({ name : sName, view : oParameters.view, control : oParameters.control, config : oParameters.config, data: oParameters.data }); }, this); this._mTargets[sName] = oTarget; return oTarget; }
[ "function", "(", "sName", ",", "oTargetOptions", ")", "{", "var", "oTarget", ",", "oOptions", ";", "oOptions", "=", "jQuery", ".", "extend", "(", "true", ",", "{", "_name", ":", "sName", "}", ",", "this", ".", "_oConfig", ",", "oTargetOptions", ")", ";", "oTarget", "=", "this", ".", "_constructTarget", "(", "oOptions", ")", ";", "oTarget", ".", "attachDisplay", "(", "function", "(", "oEvent", ")", "{", "var", "oParameters", "=", "oEvent", ".", "getParameters", "(", ")", ";", "this", ".", "fireDisplay", "(", "{", "name", ":", "sName", ",", "view", ":", "oParameters", ".", "view", ",", "control", ":", "oParameters", ".", "control", ",", "config", ":", "oParameters", ".", "config", ",", "data", ":", "oParameters", ".", "data", "}", ")", ";", "}", ",", "this", ")", ";", "this", ".", "_mTargets", "[", "sName", "]", "=", "oTarget", ";", "return", "oTarget", ";", "}" ]
created all targets @param {string} sName @param {object} oTargetOptions @return {sap.ui.core.routing.Target} The created target object @private
[ "created", "all", "targets" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/routing/Targets.js#L564-L583
train
SAP/openui5
src/sap.ui.core/src/sap/ui/core/Component.js
addSapParams
function addSapParams(oUri) { ['sap-client', 'sap-server'].forEach(function(sName) { if (!oUri.hasSearch(sName)) { var sValue = sap.ui.getCore().getConfiguration().getSAPParam(sName); if (sValue) { oUri.addSearch(sName, sValue); } } }); }
javascript
function addSapParams(oUri) { ['sap-client', 'sap-server'].forEach(function(sName) { if (!oUri.hasSearch(sName)) { var sValue = sap.ui.getCore().getConfiguration().getSAPParam(sName); if (sValue) { oUri.addSearch(sName, sValue); } } }); }
[ "function", "addSapParams", "(", "oUri", ")", "{", "[", "'sap-client'", ",", "'sap-server'", "]", ".", "forEach", "(", "function", "(", "sName", ")", "{", "if", "(", "!", "oUri", ".", "hasSearch", "(", "sName", ")", ")", "{", "var", "sValue", "=", "sap", ".", "ui", ".", "getCore", "(", ")", ".", "getConfiguration", "(", ")", ".", "getSAPParam", "(", "sName", ")", ";", "if", "(", "sValue", ")", "{", "oUri", ".", "addSearch", "(", "sName", ",", "sValue", ")", ";", "}", "}", "}", ")", ";", "}" ]
Utility function which adds SAP-specific parameters to a URI instance @param {URI} oUri URI.js instance @private
[ "Utility", "function", "which", "adds", "SAP", "-", "specific", "parameters", "to", "a", "URI", "instance" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/Component.js#L56-L65
train
SAP/openui5
src/sap.ui.core/src/sap/ui/core/Component.js
mergeDefinitionSource
function mergeDefinitionSource(mDefinitions, mDefinitionSource, mSourceData, oSource) { if (mSourceData) { for (var sName in mDefinitions) { if (!mDefinitionSource[sName] && mSourceData[sName] && mSourceData[sName].uri) { mDefinitionSource[sName] = oSource; } } } }
javascript
function mergeDefinitionSource(mDefinitions, mDefinitionSource, mSourceData, oSource) { if (mSourceData) { for (var sName in mDefinitions) { if (!mDefinitionSource[sName] && mSourceData[sName] && mSourceData[sName].uri) { mDefinitionSource[sName] = oSource; } } } }
[ "function", "mergeDefinitionSource", "(", "mDefinitions", ",", "mDefinitionSource", ",", "mSourceData", ",", "oSource", ")", "{", "if", "(", "mSourceData", ")", "{", "for", "(", "var", "sName", "in", "mDefinitions", ")", "{", "if", "(", "!", "mDefinitionSource", "[", "sName", "]", "&&", "mSourceData", "[", "sName", "]", "&&", "mSourceData", "[", "sName", "]", ".", "uri", ")", "{", "mDefinitionSource", "[", "sName", "]", "=", "oSource", ";", "}", "}", "}", "}" ]
Utility function which merges a map of property definitions to track from which "source" a property was defined. This function is used to find out which Component has defined which "dataSource/model". @param {object} mDefinitions Map with definitions to check @param {object} mDefinitionSource Object to extend with definition - source mapping @param {object} mSourceData Actual map with definitions @param {object} oSource Corresponding source object which should be assigned to the definitions-source map @private
[ "Utility", "function", "which", "merges", "a", "map", "of", "property", "definitions", "to", "track", "from", "which", "source", "a", "property", "was", "defined", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/Component.js#L80-L88
train
SAP/openui5
src/sap.ui.core/src/sap/ui/core/Component.js
getManifestEntry
function getManifestEntry(oMetadata, oManifest, sKey, bMerged) { var oData = oManifest.getEntry(sKey); // merge / extend should only be done for objects or when entry wasn't found if (oData !== undefined && !isPlainObject(oData)) { return oData; } // merge the configuration of the parent manifest with local manifest // the configuration of the static component metadata will be ignored var oParent, oParentData; if (bMerged && (oParent = oMetadata.getParent()) instanceof ComponentMetadata) { oParentData = oParent.getManifestEntry(sKey, bMerged); } // only extend / clone if there is data // otherwise "null" will be converted into an empty object if (oParentData || oData) { oData = jQuery.extend(true, {}, oParentData, oData); } return oData; }
javascript
function getManifestEntry(oMetadata, oManifest, sKey, bMerged) { var oData = oManifest.getEntry(sKey); // merge / extend should only be done for objects or when entry wasn't found if (oData !== undefined && !isPlainObject(oData)) { return oData; } // merge the configuration of the parent manifest with local manifest // the configuration of the static component metadata will be ignored var oParent, oParentData; if (bMerged && (oParent = oMetadata.getParent()) instanceof ComponentMetadata) { oParentData = oParent.getManifestEntry(sKey, bMerged); } // only extend / clone if there is data // otherwise "null" will be converted into an empty object if (oParentData || oData) { oData = jQuery.extend(true, {}, oParentData, oData); } return oData; }
[ "function", "getManifestEntry", "(", "oMetadata", ",", "oManifest", ",", "sKey", ",", "bMerged", ")", "{", "var", "oData", "=", "oManifest", ".", "getEntry", "(", "sKey", ")", ";", "if", "(", "oData", "!==", "undefined", "&&", "!", "isPlainObject", "(", "oData", ")", ")", "{", "return", "oData", ";", "}", "var", "oParent", ",", "oParentData", ";", "if", "(", "bMerged", "&&", "(", "oParent", "=", "oMetadata", ".", "getParent", "(", ")", ")", "instanceof", "ComponentMetadata", ")", "{", "oParentData", "=", "oParent", ".", "getManifestEntry", "(", "sKey", ",", "bMerged", ")", ";", "}", "if", "(", "oParentData", "||", "oData", ")", "{", "oData", "=", "jQuery", ".", "extend", "(", "true", ",", "{", "}", ",", "oParentData", ",", "oData", ")", ";", "}", "return", "oData", ";", "}" ]
Returns the configuration of a manifest section or the value for a specific path. If no section or key is specified, the return value is null. @param {sap.ui.core.ComponentMetadata} oMetadata the Component metadata @param {sap.ui.core.Manifest} oManifest the manifest @param {string} sKey Either the manifest section name (namespace) or a concrete path @param {boolean} [bMerged] Indicates whether the manifest entry is merged with the manifest entries of the parent component. @return {any|null} Value of the manifest section or the key (could be any kind of value) @private @see {@link sap.ui.core.Component#getManifestEntry}
[ "Returns", "the", "configuration", "of", "a", "manifest", "section", "or", "the", "value", "for", "a", "specific", "path", ".", "If", "no", "section", "or", "key", "is", "specified", "the", "return", "value", "is", "null", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/Component.js#L102-L124
train
SAP/openui5
src/sap.ui.core/src/sap/ui/core/Component.js
createMetadataProxy
function createMetadataProxy(oMetadata, oManifest) { // create a proxy for the metadata object and simulate to be an // instance of the original metadata object of the Component // => retrieving the prototype from the original metadata to // support to proxy sub-classes of ComponentMetadata var oMetadataProxy = Object.create(Object.getPrototypeOf(oMetadata)); // provide internal access to the static metadata object oMetadataProxy._oMetadata = oMetadata; oMetadataProxy._oManifest = oManifest; // copy all functions from the metadata object except of the // manifest related functions which will be instance specific now for (var m in oMetadata) { if (!/^(getManifest|getManifestObject|getManifestEntry|getMetadataVersion)$/.test(m) && typeof oMetadata[m] === "function") { oMetadataProxy[m] = oMetadata[m].bind(oMetadata); } } // return the content of the manifest instead of the static metadata oMetadataProxy.getManifest = function() { return oManifest && oManifest.getJson(); }; oMetadataProxy.getManifestObject = function() { return oManifest; }; oMetadataProxy.getManifestEntry = function(sKey, bMerged) { return getManifestEntry(oMetadata, oManifest, sKey, bMerged); }; oMetadataProxy.getMetadataVersion = function() { return 2; // instance specific manifest => metadata version 2! }; return oMetadataProxy; }
javascript
function createMetadataProxy(oMetadata, oManifest) { // create a proxy for the metadata object and simulate to be an // instance of the original metadata object of the Component // => retrieving the prototype from the original metadata to // support to proxy sub-classes of ComponentMetadata var oMetadataProxy = Object.create(Object.getPrototypeOf(oMetadata)); // provide internal access to the static metadata object oMetadataProxy._oMetadata = oMetadata; oMetadataProxy._oManifest = oManifest; // copy all functions from the metadata object except of the // manifest related functions which will be instance specific now for (var m in oMetadata) { if (!/^(getManifest|getManifestObject|getManifestEntry|getMetadataVersion)$/.test(m) && typeof oMetadata[m] === "function") { oMetadataProxy[m] = oMetadata[m].bind(oMetadata); } } // return the content of the manifest instead of the static metadata oMetadataProxy.getManifest = function() { return oManifest && oManifest.getJson(); }; oMetadataProxy.getManifestObject = function() { return oManifest; }; oMetadataProxy.getManifestEntry = function(sKey, bMerged) { return getManifestEntry(oMetadata, oManifest, sKey, bMerged); }; oMetadataProxy.getMetadataVersion = function() { return 2; // instance specific manifest => metadata version 2! }; return oMetadataProxy; }
[ "function", "createMetadataProxy", "(", "oMetadata", ",", "oManifest", ")", "{", "var", "oMetadataProxy", "=", "Object", ".", "create", "(", "Object", ".", "getPrototypeOf", "(", "oMetadata", ")", ")", ";", "oMetadataProxy", ".", "_oMetadata", "=", "oMetadata", ";", "oMetadataProxy", ".", "_oManifest", "=", "oManifest", ";", "for", "(", "var", "m", "in", "oMetadata", ")", "{", "if", "(", "!", "/", "^(getManifest|getManifestObject|getManifestEntry|getMetadataVersion)$", "/", ".", "test", "(", "m", ")", "&&", "typeof", "oMetadata", "[", "m", "]", "===", "\"function\"", ")", "{", "oMetadataProxy", "[", "m", "]", "=", "oMetadata", "[", "m", "]", ".", "bind", "(", "oMetadata", ")", ";", "}", "}", "oMetadataProxy", ".", "getManifest", "=", "function", "(", ")", "{", "return", "oManifest", "&&", "oManifest", ".", "getJson", "(", ")", ";", "}", ";", "oMetadataProxy", ".", "getManifestObject", "=", "function", "(", ")", "{", "return", "oManifest", ";", "}", ";", "oMetadataProxy", ".", "getManifestEntry", "=", "function", "(", "sKey", ",", "bMerged", ")", "{", "return", "getManifestEntry", "(", "oMetadata", ",", "oManifest", ",", "sKey", ",", "bMerged", ")", ";", "}", ";", "oMetadataProxy", ".", "getMetadataVersion", "=", "function", "(", ")", "{", "return", "2", ";", "}", ";", "return", "oMetadataProxy", ";", "}" ]
Utility function which creates a metadata proxy object for the given metadata object @param {sap.ui.core.ComponentMetadata} oMetadata the Component metadata @param {sap.ui.core.Manifest} oManifest the manifest @return {sap.ui.core.ComponentMetadata} a metadata proxy object
[ "Utility", "function", "which", "creates", "a", "metadata", "proxy", "object", "for", "the", "given", "metadata", "object" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/Component.js#L134-L170
train
SAP/openui5
src/sap.ui.core/src/sap/ui/core/Component.js
activateServices
function activateServices(oComponent) { var oServices = oComponent.getManifestEntry("/sap.ui5/services"); for (var sService in oServices) { if (oServices[sService].lazy === false) { oComponent.getService(sService); } } }
javascript
function activateServices(oComponent) { var oServices = oComponent.getManifestEntry("/sap.ui5/services"); for (var sService in oServices) { if (oServices[sService].lazy === false) { oComponent.getService(sService); } } }
[ "function", "activateServices", "(", "oComponent", ")", "{", "var", "oServices", "=", "oComponent", ".", "getManifestEntry", "(", "\"/sap.ui5/services\"", ")", ";", "for", "(", "var", "sService", "in", "oServices", ")", "{", "if", "(", "oServices", "[", "sService", "]", ".", "lazy", "===", "false", ")", "{", "oComponent", ".", "getService", "(", "sService", ")", ";", "}", "}", "}" ]
Internal activation function for non lazy services which should be started immediately @param {sap.ui.core.Component} oComponent The Component instance @private
[ "Internal", "activation", "function", "for", "non", "lazy", "services", "which", "should", "be", "started", "immediately" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/Component.js#L933-L940
train
SAP/openui5
src/sap.ui.core/src/sap/ui/core/Component.js
getPreloadModelConfigsFromManifest
function getPreloadModelConfigsFromManifest(oManifest, oComponentData, mCacheTokens) { var mModelConfigs = { afterManifest: {}, afterPreload: {} }; // deep clone is needed as the mainfest only returns a read-only copy (freezed object) var oManifestDataSources = jQuery.extend(true, {}, oManifest.getEntry("/sap.app/dataSources")); var oManifestModels = jQuery.extend(true, {}, oManifest.getEntry("/sap.ui5/models")); var mAllModelConfigurations = Component._createManifestModelConfigurations({ models: oManifestModels, dataSources: oManifestDataSources, manifest: oManifest, componentData: oComponentData, cacheTokens: mCacheTokens }); // Read internal URI parameter to enable model preload for testing purposes // Specify comma separated list of model names. Use an empty segment for the "default" model // Examples: // sap-ui-xx-preload-component-models-<componentName>=, => prelaod default model (empty string key) // sap-ui-xx-preload-component-models-<componentName>=foo, => prelaod "foo" + default model (empty string key) // sap-ui-xx-preload-component-models-<componentName>=foo,bar => prelaod "foo" + "bar" models var sPreloadModels = new UriParameters(window.location.href).get("sap-ui-xx-preload-component-models-" + oManifest.getComponentName()); var aPreloadModels = sPreloadModels && sPreloadModels.split(","); for (var sModelName in mAllModelConfigurations) { var mModelConfig = mAllModelConfigurations[sModelName]; // activate "preload" flag in case URI parameter for testing is used (see code above) if (!mModelConfig.preload && aPreloadModels && aPreloadModels.indexOf(sModelName) > -1 ) { mModelConfig.preload = true; Log.warning("FOR TESTING ONLY!!! Activating preload for model \"" + sModelName + "\" (" + mModelConfig.type + ")", oManifest.getComponentName(), "sap.ui.core.Component"); } // ResourceModels with async=false should be always loaded beforehand to get rid of sync requests under the hood (regardless of the "preload" flag) if (mModelConfig.type === "sap.ui.model.resource.ResourceModel" && Array.isArray(mModelConfig.settings) && mModelConfig.settings.length > 0 && mModelConfig.settings[0].async !== true ) { // Use separate config object for ResourceModels as the resourceBundle might be // part of the Component-preload which isn't available when the regular "preloaded"-models are created mModelConfigs.afterPreload[sModelName] = mModelConfig; } else if (mModelConfig.preload) { // Only create models: // - which are flagged for preload (mModelConfig.preload) or activated via internal URI param (see above) // - in case the model class is already loaded (otherwise log a warning) if (sap.ui.loader._.getModuleState(mModelConfig.type.replace(/\./g, "/") + ".js")) { mModelConfigs.afterManifest[sModelName] = mModelConfig; } else { Log.warning("Can not preload model \"" + sModelName + "\" as required class has not been loaded: \"" + mModelConfig.type + "\"", oManifest.getComponentName(), "sap.ui.core.Component"); } } } return mModelConfigs; }
javascript
function getPreloadModelConfigsFromManifest(oManifest, oComponentData, mCacheTokens) { var mModelConfigs = { afterManifest: {}, afterPreload: {} }; // deep clone is needed as the mainfest only returns a read-only copy (freezed object) var oManifestDataSources = jQuery.extend(true, {}, oManifest.getEntry("/sap.app/dataSources")); var oManifestModels = jQuery.extend(true, {}, oManifest.getEntry("/sap.ui5/models")); var mAllModelConfigurations = Component._createManifestModelConfigurations({ models: oManifestModels, dataSources: oManifestDataSources, manifest: oManifest, componentData: oComponentData, cacheTokens: mCacheTokens }); // Read internal URI parameter to enable model preload for testing purposes // Specify comma separated list of model names. Use an empty segment for the "default" model // Examples: // sap-ui-xx-preload-component-models-<componentName>=, => prelaod default model (empty string key) // sap-ui-xx-preload-component-models-<componentName>=foo, => prelaod "foo" + default model (empty string key) // sap-ui-xx-preload-component-models-<componentName>=foo,bar => prelaod "foo" + "bar" models var sPreloadModels = new UriParameters(window.location.href).get("sap-ui-xx-preload-component-models-" + oManifest.getComponentName()); var aPreloadModels = sPreloadModels && sPreloadModels.split(","); for (var sModelName in mAllModelConfigurations) { var mModelConfig = mAllModelConfigurations[sModelName]; // activate "preload" flag in case URI parameter for testing is used (see code above) if (!mModelConfig.preload && aPreloadModels && aPreloadModels.indexOf(sModelName) > -1 ) { mModelConfig.preload = true; Log.warning("FOR TESTING ONLY!!! Activating preload for model \"" + sModelName + "\" (" + mModelConfig.type + ")", oManifest.getComponentName(), "sap.ui.core.Component"); } // ResourceModels with async=false should be always loaded beforehand to get rid of sync requests under the hood (regardless of the "preload" flag) if (mModelConfig.type === "sap.ui.model.resource.ResourceModel" && Array.isArray(mModelConfig.settings) && mModelConfig.settings.length > 0 && mModelConfig.settings[0].async !== true ) { // Use separate config object for ResourceModels as the resourceBundle might be // part of the Component-preload which isn't available when the regular "preloaded"-models are created mModelConfigs.afterPreload[sModelName] = mModelConfig; } else if (mModelConfig.preload) { // Only create models: // - which are flagged for preload (mModelConfig.preload) or activated via internal URI param (see above) // - in case the model class is already loaded (otherwise log a warning) if (sap.ui.loader._.getModuleState(mModelConfig.type.replace(/\./g, "/") + ".js")) { mModelConfigs.afterManifest[sModelName] = mModelConfig; } else { Log.warning("Can not preload model \"" + sModelName + "\" as required class has not been loaded: \"" + mModelConfig.type + "\"", oManifest.getComponentName(), "sap.ui.core.Component"); } } } return mModelConfigs; }
[ "function", "getPreloadModelConfigsFromManifest", "(", "oManifest", ",", "oComponentData", ",", "mCacheTokens", ")", "{", "var", "mModelConfigs", "=", "{", "afterManifest", ":", "{", "}", ",", "afterPreload", ":", "{", "}", "}", ";", "var", "oManifestDataSources", "=", "jQuery", ".", "extend", "(", "true", ",", "{", "}", ",", "oManifest", ".", "getEntry", "(", "\"/sap.app/dataSources\"", ")", ")", ";", "var", "oManifestModels", "=", "jQuery", ".", "extend", "(", "true", ",", "{", "}", ",", "oManifest", ".", "getEntry", "(", "\"/sap.ui5/models\"", ")", ")", ";", "var", "mAllModelConfigurations", "=", "Component", ".", "_createManifestModelConfigurations", "(", "{", "models", ":", "oManifestModels", ",", "dataSources", ":", "oManifestDataSources", ",", "manifest", ":", "oManifest", ",", "componentData", ":", "oComponentData", ",", "cacheTokens", ":", "mCacheTokens", "}", ")", ";", "var", "sPreloadModels", "=", "new", "UriParameters", "(", "window", ".", "location", ".", "href", ")", ".", "get", "(", "\"sap-ui-xx-preload-component-models-\"", "+", "oManifest", ".", "getComponentName", "(", ")", ")", ";", "var", "aPreloadModels", "=", "sPreloadModels", "&&", "sPreloadModels", ".", "split", "(", "\",\"", ")", ";", "for", "(", "var", "sModelName", "in", "mAllModelConfigurations", ")", "{", "var", "mModelConfig", "=", "mAllModelConfigurations", "[", "sModelName", "]", ";", "if", "(", "!", "mModelConfig", ".", "preload", "&&", "aPreloadModels", "&&", "aPreloadModels", ".", "indexOf", "(", "sModelName", ")", ">", "-", "1", ")", "{", "mModelConfig", ".", "preload", "=", "true", ";", "Log", ".", "warning", "(", "\"FOR TESTING ONLY!!! Activating preload for model \\\"\"", "+", "\\\"", "+", "sModelName", "+", "\"\\\" (\"", "+", "\\\"", ",", "mModelConfig", ".", "type", ",", "\")\"", ")", ";", "}", "oManifest", ".", "getComponentName", "(", ")", "}", "\"sap.ui.core.Component\"", "}" ]
Returns two maps of model configurations to be used for the model "preload" feature. Used within loadComponent to create models during component load. "afterManifest" Models that are activated for preload via "preload=true" or URI parameter. They will be created after the manifest is available. "afterPreload" Currently only for ResourceModels with async=false (default) to prevent sync requests by loading the corresponding ResourceBundle in advance. They will be created after the Component-preload has been loaded, as most apps package their ResourceBundles within the Component-preload. @param {sap.ui.core.Manifest} oManifest Manifest instance @param {object} [oComponentData] optional component data object @param {object} [mCacheTokens] optional cache tokens for OData models @returns {object} object with two maps, see above
[ "Returns", "two", "maps", "of", "model", "configurations", "to", "be", "used", "for", "the", "model", "preload", "feature", ".", "Used", "within", "loadComponent", "to", "create", "models", "during", "component", "load", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/Component.js#L1728-L1789
train
SAP/openui5
src/sap.ui.core/src/sap/ui/core/Component.js
collectLoadManifestPromises
function collectLoadManifestPromises(oMetadata, oManifest) { // ComponentMetadata classes with a static manifest or with legacy metadata // do already have a manifest, so no action required if (!oMetadata._oManifest) { // TODO: If the "manifest" property is set, the code to load the manifest.json could be moved up to run in // parallel with the ResourceModels that are created (after the Component-preload has finished) to trigger // a potential request a bit earlier. Right now the whole component loading would be delayed by the async request. var sName = oMetadata.getComponentName(); var sDefaultManifestUrl = getManifestUrl(sName); var pLoadManifest; if (oManifest) { // Apply a copy of the already loaded manifest to be used by the static metadata class pLoadManifest = Promise.resolve(JSON.parse(JSON.stringify(oManifest.getRawJson()))); } else { // We need to load the manifest.json for the metadata class as // it might differ from the one already loaded // If the manifest.json is part of the Component-preload it will be taken from there pLoadManifest = LoaderExtensions.loadResource({ url: sDefaultManifestUrl, dataType: "json", async: true }).catch(function(oError) { Log.error( "Failed to load component manifest from \"" + sDefaultManifestUrl + "\" (component " + sName + ")! Reason: " + oError ); // If the request fails, ignoring the error would end up in a sync call, which would fail, too. return {}; }); } aManifestsToLoad.push(pLoadManifest); aMetadataObjects.push(oMetadata); } var oParentMetadata = oMetadata.getParent(); if (oParentMetadata && (oParentMetadata instanceof ComponentMetadata) && !oParentMetadata.isBaseClass()) { collectLoadManifestPromises(oParentMetadata); } }
javascript
function collectLoadManifestPromises(oMetadata, oManifest) { // ComponentMetadata classes with a static manifest or with legacy metadata // do already have a manifest, so no action required if (!oMetadata._oManifest) { // TODO: If the "manifest" property is set, the code to load the manifest.json could be moved up to run in // parallel with the ResourceModels that are created (after the Component-preload has finished) to trigger // a potential request a bit earlier. Right now the whole component loading would be delayed by the async request. var sName = oMetadata.getComponentName(); var sDefaultManifestUrl = getManifestUrl(sName); var pLoadManifest; if (oManifest) { // Apply a copy of the already loaded manifest to be used by the static metadata class pLoadManifest = Promise.resolve(JSON.parse(JSON.stringify(oManifest.getRawJson()))); } else { // We need to load the manifest.json for the metadata class as // it might differ from the one already loaded // If the manifest.json is part of the Component-preload it will be taken from there pLoadManifest = LoaderExtensions.loadResource({ url: sDefaultManifestUrl, dataType: "json", async: true }).catch(function(oError) { Log.error( "Failed to load component manifest from \"" + sDefaultManifestUrl + "\" (component " + sName + ")! Reason: " + oError ); // If the request fails, ignoring the error would end up in a sync call, which would fail, too. return {}; }); } aManifestsToLoad.push(pLoadManifest); aMetadataObjects.push(oMetadata); } var oParentMetadata = oMetadata.getParent(); if (oParentMetadata && (oParentMetadata instanceof ComponentMetadata) && !oParentMetadata.isBaseClass()) { collectLoadManifestPromises(oParentMetadata); } }
[ "function", "collectLoadManifestPromises", "(", "oMetadata", ",", "oManifest", ")", "{", "if", "(", "!", "oMetadata", ".", "_oManifest", ")", "{", "var", "sName", "=", "oMetadata", ".", "getComponentName", "(", ")", ";", "var", "sDefaultManifestUrl", "=", "getManifestUrl", "(", "sName", ")", ";", "var", "pLoadManifest", ";", "if", "(", "oManifest", ")", "{", "pLoadManifest", "=", "Promise", ".", "resolve", "(", "JSON", ".", "parse", "(", "JSON", ".", "stringify", "(", "oManifest", ".", "getRawJson", "(", ")", ")", ")", ")", ";", "}", "else", "{", "pLoadManifest", "=", "LoaderExtensions", ".", "loadResource", "(", "{", "url", ":", "sDefaultManifestUrl", ",", "dataType", ":", "\"json\"", ",", "async", ":", "true", "}", ")", ".", "catch", "(", "function", "(", "oError", ")", "{", "Log", ".", "error", "(", "\"Failed to load component manifest from \\\"\"", "+", "\\\"", "+", "sDefaultManifestUrl", "+", "\"\\\" (component \"", "+", "\\\"", "+", "sName", ")", ";", "\")! Reason: \"", "}", ")", ";", "}", "oError", "return", "{", "}", ";", "}", "aManifestsToLoad", ".", "push", "(", "pLoadManifest", ")", ";", "aMetadataObjects", ".", "push", "(", "oMetadata", ")", ";", "}" ]
Collects the promises to load the manifest content and all of its parents manifest files. Gathers promises within aManifestsToLoad. Gathers associates meta data objects within aMetadataObjects. @param {object} oMetadata The metadata object @param {sap.ui.core.Manifest} [oManifest] root manifest, which is possibly already loaded
[ "Collects", "the", "promises", "to", "load", "the", "manifest", "content", "and", "all", "of", "its", "parents", "manifest", "files", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/Component.js#L1821-L1862
train
SAP/openui5
src/sap.ui.core/src/sap/ui/core/Component.js
function() { // create a copy of arguments for local modification // and later handover to Component constructor var args = Array.prototype.slice.call(arguments); // inject the manifest to the settings object var mSettings; if (args.length === 0 || typeof args[0] === "object") { mSettings = args[0] = args[0] || {}; } else if (typeof args[0] === "string") { mSettings = args[1] = args[1] || {}; } mSettings._metadataProxy = oMetadataProxy; // mixin created "models" into "mSettings" if (mModels) { mSettings._manifestModels = mModels; } // call the original constructor of the component class var oInstance = Object.create(oClass.prototype); oClass.apply(oInstance, args); return oInstance; }
javascript
function() { // create a copy of arguments for local modification // and later handover to Component constructor var args = Array.prototype.slice.call(arguments); // inject the manifest to the settings object var mSettings; if (args.length === 0 || typeof args[0] === "object") { mSettings = args[0] = args[0] || {}; } else if (typeof args[0] === "string") { mSettings = args[1] = args[1] || {}; } mSettings._metadataProxy = oMetadataProxy; // mixin created "models" into "mSettings" if (mModels) { mSettings._manifestModels = mModels; } // call the original constructor of the component class var oInstance = Object.create(oClass.prototype); oClass.apply(oInstance, args); return oInstance; }
[ "function", "(", ")", "{", "var", "args", "=", "Array", ".", "prototype", ".", "slice", ".", "call", "(", "arguments", ")", ";", "var", "mSettings", ";", "if", "(", "args", ".", "length", "===", "0", "||", "typeof", "args", "[", "0", "]", "===", "\"object\"", ")", "{", "mSettings", "=", "args", "[", "0", "]", "=", "args", "[", "0", "]", "||", "{", "}", ";", "}", "else", "if", "(", "typeof", "args", "[", "0", "]", "===", "\"string\"", ")", "{", "mSettings", "=", "args", "[", "1", "]", "=", "args", "[", "1", "]", "||", "{", "}", ";", "}", "mSettings", ".", "_metadataProxy", "=", "oMetadataProxy", ";", "if", "(", "mModels", ")", "{", "mSettings", ".", "_manifestModels", "=", "mModels", ";", "}", "var", "oInstance", "=", "Object", ".", "create", "(", "oClass", ".", "prototype", ")", ";", "oClass", ".", "apply", "(", "oInstance", ",", "args", ")", ";", "return", "oInstance", ";", "}" ]
create the proxy class for passing the manifest
[ "create", "the", "proxy", "class", "for", "passing", "the", "manifest" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/Component.js#L2496-L2521
train
SAP/openui5
src/sap.ui.core/src/sap/ui/core/Component.js
function(oPromise) { // In order to make the error handling of the Promise.all() happen after all Promises finish, we catch all rejected Promises and make them resolve with an marked object. oPromise = oPromise.then( function(v) { return { result: v, rejected: false }; }, function(v) { return { result: v, rejected: true }; } ); return oPromise; }
javascript
function(oPromise) { // In order to make the error handling of the Promise.all() happen after all Promises finish, we catch all rejected Promises and make them resolve with an marked object. oPromise = oPromise.then( function(v) { return { result: v, rejected: false }; }, function(v) { return { result: v, rejected: true }; } ); return oPromise; }
[ "function", "(", "oPromise", ")", "{", "oPromise", "=", "oPromise", ".", "then", "(", "function", "(", "v", ")", "{", "return", "{", "result", ":", "v", ",", "rejected", ":", "false", "}", ";", "}", ",", "function", "(", "v", ")", "{", "return", "{", "result", ":", "v", ",", "rejected", ":", "true", "}", ";", "}", ")", ";", "return", "oPromise", ";", "}" ]
trigger loading of libraries and component preloads and collect the given promises
[ "trigger", "loading", "of", "libraries", "and", "component", "preloads", "and", "collect", "the", "given", "promises" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/Component.js#L2670-L2687
train
SAP/openui5
src/sap.ui.core/src/sap/ui/core/Fragment.js
function(sTemplateName) { var sUrl = sap.ui.require.toUrl(sTemplateName.replace(/\./g, "/")) + ".fragment.html"; var sHTML = _mHTMLTemplates[sUrl]; var sResourceName; if (!sHTML) { sResourceName = sTemplateName.replace(/\./g, "/") + ".fragment.html"; sHTML = LoaderExtensions.loadResource(sResourceName); // TODO discuss // a) why caching at all (more precise: why for HTML fragment although we refused to do it for other view/fragment types - risk of a memory leak!) // b) why cached via URL instead of via name? Any special scenario in mind? _mHTMLTemplates[sUrl] = sHTML; } return sHTML; }
javascript
function(sTemplateName) { var sUrl = sap.ui.require.toUrl(sTemplateName.replace(/\./g, "/")) + ".fragment.html"; var sHTML = _mHTMLTemplates[sUrl]; var sResourceName; if (!sHTML) { sResourceName = sTemplateName.replace(/\./g, "/") + ".fragment.html"; sHTML = LoaderExtensions.loadResource(sResourceName); // TODO discuss // a) why caching at all (more precise: why for HTML fragment although we refused to do it for other view/fragment types - risk of a memory leak!) // b) why cached via URL instead of via name? Any special scenario in mind? _mHTMLTemplates[sUrl] = sHTML; } return sHTML; }
[ "function", "(", "sTemplateName", ")", "{", "var", "sUrl", "=", "sap", ".", "ui", ".", "require", ".", "toUrl", "(", "sTemplateName", ".", "replace", "(", "/", "\\.", "/", "g", ",", "\"/\"", ")", ")", "+", "\".fragment.html\"", ";", "var", "sHTML", "=", "_mHTMLTemplates", "[", "sUrl", "]", ";", "var", "sResourceName", ";", "if", "(", "!", "sHTML", ")", "{", "sResourceName", "=", "sTemplateName", ".", "replace", "(", "/", "\\.", "/", "g", ",", "\"/\"", ")", "+", "\".fragment.html\"", ";", "sHTML", "=", "LoaderExtensions", ".", "loadResource", "(", "sResourceName", ")", ";", "_mHTMLTemplates", "[", "sUrl", "]", "=", "sHTML", ";", "}", "return", "sHTML", ";", "}" ]
Loads and returns a template for the given template name. Templates are only loaded once. @param {string} sTemplateName The name of the template @return {string} the template data @private
[ "Loads", "and", "returns", "a", "template", "for", "the", "given", "template", "name", ".", "Templates", "are", "only", "loaded", "once", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/Fragment.js#L759-L773
train
SAP/openui5
src/sap.ui.core/src/sap/ui/core/Configuration.js
function() { var sName; // lazy load of LocaleData to avoid cyclic dependencies if ( !LocaleData ) { LocaleData = sap.ui.requireSync("sap/ui/core/LocaleData"); } if (this.calendarType) { for (sName in CalendarType) { if (sName.toLowerCase() === this.calendarType.toLowerCase()) { this.calendarType = sName; return this.calendarType; } } Log.warning("Parameter 'calendarType' is set to " + this.calendarType + " which isn't a valid value and therefore ignored. The calendar type is determined from format setting and current locale"); } var sLegacyDateFormat = this.oFormatSettings.getLegacyDateFormat(); switch (sLegacyDateFormat) { case "1": case "2": case "3": case "4": case "5": case "6": return CalendarType.Gregorian; case "7": case "8": case "9": return CalendarType.Japanese; case "A": case "B": return CalendarType.Islamic; case "C": return CalendarType.Persian; } return LocaleData.getInstance(this.getLocale()).getPreferredCalendarType(); }
javascript
function() { var sName; // lazy load of LocaleData to avoid cyclic dependencies if ( !LocaleData ) { LocaleData = sap.ui.requireSync("sap/ui/core/LocaleData"); } if (this.calendarType) { for (sName in CalendarType) { if (sName.toLowerCase() === this.calendarType.toLowerCase()) { this.calendarType = sName; return this.calendarType; } } Log.warning("Parameter 'calendarType' is set to " + this.calendarType + " which isn't a valid value and therefore ignored. The calendar type is determined from format setting and current locale"); } var sLegacyDateFormat = this.oFormatSettings.getLegacyDateFormat(); switch (sLegacyDateFormat) { case "1": case "2": case "3": case "4": case "5": case "6": return CalendarType.Gregorian; case "7": case "8": case "9": return CalendarType.Japanese; case "A": case "B": return CalendarType.Islamic; case "C": return CalendarType.Persian; } return LocaleData.getInstance(this.getLocale()).getPreferredCalendarType(); }
[ "function", "(", ")", "{", "var", "sName", ";", "if", "(", "!", "LocaleData", ")", "{", "LocaleData", "=", "sap", ".", "ui", ".", "requireSync", "(", "\"sap/ui/core/LocaleData\"", ")", ";", "}", "if", "(", "this", ".", "calendarType", ")", "{", "for", "(", "sName", "in", "CalendarType", ")", "{", "if", "(", "sName", ".", "toLowerCase", "(", ")", "===", "this", ".", "calendarType", ".", "toLowerCase", "(", ")", ")", "{", "this", ".", "calendarType", "=", "sName", ";", "return", "this", ".", "calendarType", ";", "}", "}", "Log", ".", "warning", "(", "\"Parameter 'calendarType' is set to \"", "+", "this", ".", "calendarType", "+", "\" which isn't a valid value and therefore ignored. The calendar type is determined from format setting and current locale\"", ")", ";", "}", "var", "sLegacyDateFormat", "=", "this", ".", "oFormatSettings", ".", "getLegacyDateFormat", "(", ")", ";", "switch", "(", "sLegacyDateFormat", ")", "{", "case", "\"1\"", ":", "case", "\"2\"", ":", "case", "\"3\"", ":", "case", "\"4\"", ":", "case", "\"5\"", ":", "case", "\"6\"", ":", "return", "CalendarType", ".", "Gregorian", ";", "case", "\"7\"", ":", "case", "\"8\"", ":", "case", "\"9\"", ":", "return", "CalendarType", ".", "Japanese", ";", "case", "\"A\"", ":", "case", "\"B\"", ":", "return", "CalendarType", ".", "Islamic", ";", "case", "\"C\"", ":", "return", "CalendarType", ".", "Persian", ";", "}", "return", "LocaleData", ".", "getInstance", "(", "this", ".", "getLocale", "(", ")", ")", ".", "getPreferredCalendarType", "(", ")", ";", "}" ]
Returns the calendar type which is being used in locale dependent functionality. When it's explicitly set by calling <code>setCalendar</code>, the set calendar type is returned. Otherwise, the calendar type is determined by checking the format settings and current locale. @return {sap.ui.core.CalendarType} the current calendar type @since 1.28.6
[ "Returns", "the", "calendar", "type", "which", "is", "being", "used", "in", "locale", "dependent", "functionality", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/Configuration.js#L820-L860
train
SAP/openui5
src/sap.ui.core/src/sap/ui/core/Configuration.js
function(sFormatLocale) { var oFormatLocale = convertToLocaleOrNull(sFormatLocale), mChanges; check(sFormatLocale == null || typeof sFormatLocale === "string" && oFormatLocale, "sFormatLocale must be a BCP47 language tag or Java Locale id or null"); if ( toLanguageTag(oFormatLocale) !== toLanguageTag(this.formatLocale) ) { this.formatLocale = oFormatLocale; mChanges = this._collect(); mChanges.formatLocale = toLanguageTag(oFormatLocale); this._endCollect(); } return this; }
javascript
function(sFormatLocale) { var oFormatLocale = convertToLocaleOrNull(sFormatLocale), mChanges; check(sFormatLocale == null || typeof sFormatLocale === "string" && oFormatLocale, "sFormatLocale must be a BCP47 language tag or Java Locale id or null"); if ( toLanguageTag(oFormatLocale) !== toLanguageTag(this.formatLocale) ) { this.formatLocale = oFormatLocale; mChanges = this._collect(); mChanges.formatLocale = toLanguageTag(oFormatLocale); this._endCollect(); } return this; }
[ "function", "(", "sFormatLocale", ")", "{", "var", "oFormatLocale", "=", "convertToLocaleOrNull", "(", "sFormatLocale", ")", ",", "mChanges", ";", "check", "(", "sFormatLocale", "==", "null", "||", "typeof", "sFormatLocale", "===", "\"string\"", "&&", "oFormatLocale", ",", "\"sFormatLocale must be a BCP47 language tag or Java Locale id or null\"", ")", ";", "if", "(", "toLanguageTag", "(", "oFormatLocale", ")", "!==", "toLanguageTag", "(", "this", ".", "formatLocale", ")", ")", "{", "this", ".", "formatLocale", "=", "oFormatLocale", ";", "mChanges", "=", "this", ".", "_collect", "(", ")", ";", "mChanges", ".", "formatLocale", "=", "toLanguageTag", "(", "oFormatLocale", ")", ";", "this", ".", "_endCollect", "(", ")", ";", "}", "return", "this", ";", "}" ]
Sets a new format locale to be used from now on for retrieving locale specific formatters. Modifying this setting does not have an impact on the retrieval of translated texts! Can either be set to a concrete value (a BCP47 or Java locale compliant language tag) or to <code>null</code>. When set to <code>null</code> (default value) then locale specific formatters are retrieved for the current language. After changing the format locale, the framework tries to update localization specific parts of the UI. See the documentation of {@link #setLanguage} for details and restrictions. <b>Note</b>: When a format locale is set, it has higher priority than a number, date or time format defined with a call to <code>setLegacyNumberFormat</code>, <code>setLegacyDateFormat</code> or <code>setLegacyTimeFormat</code>. <b>Note</b>: See documentation of {@link #setLanguage} for restrictions. @param {string|null} sFormatLocale the new format locale as a BCP47 compliant language tag; case doesn't matter and underscores can be used instead of dashes to separate components (compatibility with Java Locale IDs) @return {sap.ui.core.Configuration} <code>this</code> to allow method chaining @public @throws {Error} When <code>sFormatLocale</code> is given, but is not a valid BCP47 language tag or Java locale identifier
[ "Sets", "a", "new", "format", "locale", "to", "be", "used", "from", "now", "on", "for", "retrieving", "locale", "specific", "formatters", ".", "Modifying", "this", "setting", "does", "not", "have", "an", "impact", "on", "the", "retrieval", "of", "translated", "texts!" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/Configuration.js#L921-L934
train
SAP/openui5
src/sap.ui.core/src/sap/ui/core/Configuration.js
function(sAnimationMode) { checkEnum(Configuration.AnimationMode, sAnimationMode, "animationMode"); // Set the animation to on or off depending on the animation mode to ensure backward compatibility. this.animation = (sAnimationMode !== Configuration.AnimationMode.minimal && sAnimationMode !== Configuration.AnimationMode.none); // Set the animation mode and update html attributes. this.animationMode = sAnimationMode; if (this._oCore && this._oCore._setupAnimation) { this._oCore._setupAnimation(); } }
javascript
function(sAnimationMode) { checkEnum(Configuration.AnimationMode, sAnimationMode, "animationMode"); // Set the animation to on or off depending on the animation mode to ensure backward compatibility. this.animation = (sAnimationMode !== Configuration.AnimationMode.minimal && sAnimationMode !== Configuration.AnimationMode.none); // Set the animation mode and update html attributes. this.animationMode = sAnimationMode; if (this._oCore && this._oCore._setupAnimation) { this._oCore._setupAnimation(); } }
[ "function", "(", "sAnimationMode", ")", "{", "checkEnum", "(", "Configuration", ".", "AnimationMode", ",", "sAnimationMode", ",", "\"animationMode\"", ")", ";", "this", ".", "animation", "=", "(", "sAnimationMode", "!==", "Configuration", ".", "AnimationMode", ".", "minimal", "&&", "sAnimationMode", "!==", "Configuration", ".", "AnimationMode", ".", "none", ")", ";", "this", ".", "animationMode", "=", "sAnimationMode", ";", "if", "(", "this", ".", "_oCore", "&&", "this", ".", "_oCore", ".", "_setupAnimation", ")", "{", "this", ".", "_oCore", ".", "_setupAnimation", "(", ")", ";", "}", "}" ]
Sets the current animation mode. Expects an animation mode as string and validates it. If a wrong animation mode was set, an error is thrown. If the mode is valid it is set, then the attributes <code>data-sap-ui-animation</code> and <code>data-sap-ui-animation-mode</code> of the HTML document root element are also updated. If the <code>animationMode</code> is <code>Configuration.AnimationMode.none</code> the old <code>animation</code> property is set to <code>false</code>, otherwise it is set to <code>true</code>. @param {sap.ui.core.Configuration.AnimationMode} sAnimationMode A valid animation mode @throws {Error} If the provided <code>sAnimationMode</code> does not exist, an error is thrown @since 1.50.0 @public
[ "Sets", "the", "current", "animation", "mode", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/Configuration.js#L1016-L1027
train
SAP/openui5
src/sap.ui.core/src/sap/ui/core/Configuration.js
function(bRTL) { check(bRTL === null || typeof bRTL === "boolean", "bRTL must be null or a boolean"); var oldRTL = this.getRTL(), mChanges; this.rtl = bRTL; if ( oldRTL != this.getRTL() ) { // also take the derived RTL flag into account for the before/after comparison! mChanges = this._collect(); mChanges.rtl = this.getRTL(); this._endCollect(); } return this; }
javascript
function(bRTL) { check(bRTL === null || typeof bRTL === "boolean", "bRTL must be null or a boolean"); var oldRTL = this.getRTL(), mChanges; this.rtl = bRTL; if ( oldRTL != this.getRTL() ) { // also take the derived RTL flag into account for the before/after comparison! mChanges = this._collect(); mChanges.rtl = this.getRTL(); this._endCollect(); } return this; }
[ "function", "(", "bRTL", ")", "{", "check", "(", "bRTL", "===", "null", "||", "typeof", "bRTL", "===", "\"boolean\"", ",", "\"bRTL must be null or a boolean\"", ")", ";", "var", "oldRTL", "=", "this", ".", "getRTL", "(", ")", ",", "mChanges", ";", "this", ".", "rtl", "=", "bRTL", ";", "if", "(", "oldRTL", "!=", "this", ".", "getRTL", "(", ")", ")", "{", "mChanges", "=", "this", ".", "_collect", "(", ")", ";", "mChanges", ".", "rtl", "=", "this", ".", "getRTL", "(", ")", ";", "this", ".", "_endCollect", "(", ")", ";", "}", "return", "this", ";", "}" ]
Sets the character orientation mode to be used from now on. Can either be set to a concrete value (true meaning right-to-left, false meaning left-to-right) or to <code>null</code> which means that the character orientation mode should be derived from the current language (incl. region) setting. After changing the character orientation mode, the framework tries to update localization specific parts of the UI. See the documentation of {@link #setLanguage} for details and restrictions. <b>Note</b>: See documentation of {@link #setLanguage} for restrictions. @param {boolean|null} bRTL new character orientation mode or <code>null</code> @return {sap.ui.core.Configuration} <code>this</code> to allow method chaining @public
[ "Sets", "the", "character", "orientation", "mode", "to", "be", "used", "from", "now", "on", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/Configuration.js#L1071-L1083
train
SAP/openui5
src/sap.ui.core/src/sap/ui/core/Configuration.js
function(mSettings) { function applyAll(ctx, m) { var sName, sMethod; for ( sName in m ) { sMethod = "set" + sName.slice(0,1).toUpperCase() + sName.slice(1); if ( sName === 'formatSettings' && ctx.oFormatSettings ) { applyAll(ctx.oFormatSettings, m[sName]); } else if ( typeof ctx[sMethod] === 'function' ) { ctx[sMethod](m[sName]); } else { Log.warning("Configuration.applySettings: unknown setting '" + sName + "' ignored"); } } } assert(typeof mSettings === 'object', "mSettings must be an object"); this._collect(); // block events applyAll(this, mSettings); this._endCollect(); // might fire localizationChanged return this; }
javascript
function(mSettings) { function applyAll(ctx, m) { var sName, sMethod; for ( sName in m ) { sMethod = "set" + sName.slice(0,1).toUpperCase() + sName.slice(1); if ( sName === 'formatSettings' && ctx.oFormatSettings ) { applyAll(ctx.oFormatSettings, m[sName]); } else if ( typeof ctx[sMethod] === 'function' ) { ctx[sMethod](m[sName]); } else { Log.warning("Configuration.applySettings: unknown setting '" + sName + "' ignored"); } } } assert(typeof mSettings === 'object', "mSettings must be an object"); this._collect(); // block events applyAll(this, mSettings); this._endCollect(); // might fire localizationChanged return this; }
[ "function", "(", "mSettings", ")", "{", "function", "applyAll", "(", "ctx", ",", "m", ")", "{", "var", "sName", ",", "sMethod", ";", "for", "(", "sName", "in", "m", ")", "{", "sMethod", "=", "\"set\"", "+", "sName", ".", "slice", "(", "0", ",", "1", ")", ".", "toUpperCase", "(", ")", "+", "sName", ".", "slice", "(", "1", ")", ";", "if", "(", "sName", "===", "'formatSettings'", "&&", "ctx", ".", "oFormatSettings", ")", "{", "applyAll", "(", "ctx", ".", "oFormatSettings", ",", "m", "[", "sName", "]", ")", ";", "}", "else", "if", "(", "typeof", "ctx", "[", "sMethod", "]", "===", "'function'", ")", "{", "ctx", "[", "sMethod", "]", "(", "m", "[", "sName", "]", ")", ";", "}", "else", "{", "Log", ".", "warning", "(", "\"Configuration.applySettings: unknown setting '\"", "+", "sName", "+", "\"' ignored\"", ")", ";", "}", "}", "}", "assert", "(", "typeof", "mSettings", "===", "'object'", ",", "\"mSettings must be an object\"", ")", ";", "this", ".", "_collect", "(", ")", ";", "applyAll", "(", "this", ",", "mSettings", ")", ";", "this", ".", "_endCollect", "(", ")", ";", "return", "this", ";", "}" ]
Applies multiple changes to the configuration at once. If the changed settings contain localization related settings like <code>language</code> or <ode>calendarType</code>, then only a single <code>localizationChanged</code> event will be fired. As the framework has to inform all existing components, elements, models etc. about localization changes, using <code>applySettings</code> can significantly reduce the overhead for multiple changes, esp. when they occur after the UI has been created already. The <code>mSettings</code> can contain any property <code><i>xyz</i></code> for which a setter method <code>set<i>XYZ</i></code> exists in the API of this class. Similarly, values for the {@link sap.ui.core.Configuration.FormatSettings format settings} API can be provided in a nested object with name <code>formatSettings</code>. @example <caption>Apply <code>language</code>, <code>calendarType</code> and several legacy format settings in one call</caption> sap.ui.getCore().getConfiguration().applySettings({ language: 'de', calendarType: sap.ui.core.CalendarType.Gregorian, formatSettings: { legacyDateFormat: '1', legacyTimeFormat: '1', legacyNumberFormat: '1' } }); @param {object} mSettings Configuration options to apply @returns {sap.ui.core.Configuration} Returns <code>this</code> to allow method chaining @public @since 1.38.6
[ "Applies", "multiple", "changes", "to", "the", "configuration", "at", "once", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/Configuration.js#L1475-L1498
train
SAP/openui5
src/sap.ui.core/src/sap/ui/core/Configuration.js
checkEnum
function checkEnum(oEnum, sValue, sPropertyName) { var aValidValues = []; for (var sKey in oEnum) { if (oEnum.hasOwnProperty(sKey)) { if (oEnum[sKey] === sValue) { return; } aValidValues.push(oEnum[sKey]); } } throw new Error("Unsupported Enumeration value for " + sPropertyName + ", valid values are: " + aValidValues.join(", ")); }
javascript
function checkEnum(oEnum, sValue, sPropertyName) { var aValidValues = []; for (var sKey in oEnum) { if (oEnum.hasOwnProperty(sKey)) { if (oEnum[sKey] === sValue) { return; } aValidValues.push(oEnum[sKey]); } } throw new Error("Unsupported Enumeration value for " + sPropertyName + ", valid values are: " + aValidValues.join(", ")); }
[ "function", "checkEnum", "(", "oEnum", ",", "sValue", ",", "sPropertyName", ")", "{", "var", "aValidValues", "=", "[", "]", ";", "for", "(", "var", "sKey", "in", "oEnum", ")", "{", "if", "(", "oEnum", ".", "hasOwnProperty", "(", "sKey", ")", ")", "{", "if", "(", "oEnum", "[", "sKey", "]", "===", "sValue", ")", "{", "return", ";", "}", "aValidValues", ".", "push", "(", "oEnum", "[", "sKey", "]", ")", ";", "}", "}", "throw", "new", "Error", "(", "\"Unsupported Enumeration value for \"", "+", "sPropertyName", "+", "\", valid values are: \"", "+", "aValidValues", ".", "join", "(", "\", \"", ")", ")", ";", "}" ]
Checks if a value exists within an enumerable list. @param {object} oEnum Enumeration object with values for validation @param {string} sValue Value to check against enumerable list @param {string} sPropertyName Name of the property which is checked @throws {Error} If the value could not be found, an error is thrown
[ "Checks", "if", "a", "value", "exists", "within", "an", "enumerable", "list", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/Configuration.js#L1613-L1624
train
SAP/openui5
src/sap.ui.core/src/sap/ui/core/Configuration.js
function() { function fallback(that) { var oLocale = that.oConfiguration.language; // if any user settings have been defined, add the private use subtag "sapufmt" if ( !jQuery.isEmptyObject(that.mSettings) ) { // TODO move to Locale/LocaleData var l = oLocale.toString(); if ( l.indexOf("-x-") < 0 ) { l = l + "-x-sapufmt"; } else if ( l.indexOf("-sapufmt") <= l.indexOf("-x-") ) { l = l + "-sapufmt"; } oLocale = new Locale(l); } return oLocale; } return this.oConfiguration.formatLocale || fallback(this); }
javascript
function() { function fallback(that) { var oLocale = that.oConfiguration.language; // if any user settings have been defined, add the private use subtag "sapufmt" if ( !jQuery.isEmptyObject(that.mSettings) ) { // TODO move to Locale/LocaleData var l = oLocale.toString(); if ( l.indexOf("-x-") < 0 ) { l = l + "-x-sapufmt"; } else if ( l.indexOf("-sapufmt") <= l.indexOf("-x-") ) { l = l + "-sapufmt"; } oLocale = new Locale(l); } return oLocale; } return this.oConfiguration.formatLocale || fallback(this); }
[ "function", "(", ")", "{", "function", "fallback", "(", "that", ")", "{", "var", "oLocale", "=", "that", ".", "oConfiguration", ".", "language", ";", "if", "(", "!", "jQuery", ".", "isEmptyObject", "(", "that", ".", "mSettings", ")", ")", "{", "var", "l", "=", "oLocale", ".", "toString", "(", ")", ";", "if", "(", "l", ".", "indexOf", "(", "\"-x-\"", ")", "<", "0", ")", "{", "l", "=", "l", "+", "\"-x-sapufmt\"", ";", "}", "else", "if", "(", "l", ".", "indexOf", "(", "\"-sapufmt\"", ")", "<=", "l", ".", "indexOf", "(", "\"-x-\"", ")", ")", "{", "l", "=", "l", "+", "\"-sapufmt\"", ";", "}", "oLocale", "=", "new", "Locale", "(", "l", ")", ";", "}", "return", "oLocale", ";", "}", "return", "this", ".", "oConfiguration", ".", "formatLocale", "||", "fallback", "(", "this", ")", ";", "}" ]
Returns the locale to be used for formatting. If no such locale has been defined, this method falls back to the language, see {@link sap.ui.core.Configuration#getLanguage Configuration.getLanguage()}. If any user preferences for date, time or number formatting have been set, and if no format locale has been specified, then a special private use subtag is added to the locale, indicating to the framework that these user preferences should be applied. @return {sap.ui.core.Locale} the format locale @public
[ "Returns", "the", "locale", "to", "be", "used", "for", "formatting", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/Configuration.js#L1661-L1678
train
SAP/openui5
src/sap.ui.core/src/sap/ui/core/Configuration.js
function(sStyle, sPattern) { check(sStyle == "short" || sStyle == "medium" || sStyle == "long" || sStyle == "full", "sStyle must be short, medium, long or full"); this._set("dateFormats-" + sStyle, sPattern); return this; }
javascript
function(sStyle, sPattern) { check(sStyle == "short" || sStyle == "medium" || sStyle == "long" || sStyle == "full", "sStyle must be short, medium, long or full"); this._set("dateFormats-" + sStyle, sPattern); return this; }
[ "function", "(", "sStyle", ",", "sPattern", ")", "{", "check", "(", "sStyle", "==", "\"short\"", "||", "sStyle", "==", "\"medium\"", "||", "sStyle", "==", "\"long\"", "||", "sStyle", "==", "\"full\"", ",", "\"sStyle must be short, medium, long or full\"", ")", ";", "this", ".", "_set", "(", "\"dateFormats-\"", "+", "sStyle", ",", "sPattern", ")", ";", "return", "this", ";", "}" ]
Defines the preferred format pattern for the given date format style. Calling this method with a null or undefined pattern removes a previously set pattern. If a pattern is defined, it will be preferred over patterns derived from the current locale. See class {@link sap.ui.core.format.DateFormat} for details about the pattern syntax. After changing the date pattern, the framework tries to update localization specific parts of the UI. See the documentation of {@link sap.ui.core.Configuration#setLanguage} for details and restrictions. @param {string} sStyle must be one of short, medium, long or full. @param {string} sPattern the format pattern to be used in LDML syntax. @return {sap.ui.core.Configuration.FormatSettings} Returns <code>this</code> to allow method chaining @public
[ "Defines", "the", "preferred", "format", "pattern", "for", "the", "given", "date", "format", "style", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/Configuration.js#L1846-L1850
train
SAP/openui5
src/sap.ui.core/src/sap/ui/core/Configuration.js
function(sType, sSymbol) { check(sType == "decimal" || sType == "group" || sType == "plusSign" || sType == "minusSign", "sType must be decimal, group, plusSign or minusSign"); this._set("symbols-latn-" + sType, sSymbol); return this; }
javascript
function(sType, sSymbol) { check(sType == "decimal" || sType == "group" || sType == "plusSign" || sType == "minusSign", "sType must be decimal, group, plusSign or minusSign"); this._set("symbols-latn-" + sType, sSymbol); return this; }
[ "function", "(", "sType", ",", "sSymbol", ")", "{", "check", "(", "sType", "==", "\"decimal\"", "||", "sType", "==", "\"group\"", "||", "sType", "==", "\"plusSign\"", "||", "sType", "==", "\"minusSign\"", ",", "\"sType must be decimal, group, plusSign or minusSign\"", ")", ";", "this", ".", "_set", "(", "\"symbols-latn-\"", "+", "sType", ",", "sSymbol", ")", ";", "return", "this", ";", "}" ]
Defines the string to be used for the given number symbol. Calling this method with a null or undefined symbol removes a previously set symbol string. Note that an empty string is explicitly allowed. If a symbol is defined, it will be preferred over symbols derived from the current locale. See class {@link sap.ui.core.format.NumberFormat} for details about the symbols. After changing the number symbol, the framework tries to update localization specific parts of the UI. See the documentation of {@link sap.ui.core.Configuration#setLanguage} for details and restrictions. @param {string} sStyle must be one of decimal, group, plusSign, minusSign. @param {string} sSymbol will be used to represent the given symbol type @return {sap.ui.core.Configuration.FormatSettings} Returns <code>this</code> to allow method chaining @public
[ "Defines", "the", "string", "to", "be", "used", "for", "the", "given", "number", "symbol", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/Configuration.js#L1913-L1917
train
SAP/openui5
src/sap.ui.core/src/sap/ui/core/Configuration.js
function(mCurrencies) { check(typeof mCurrencies === "object" || mCurrencies == null, "mCurrencyDigits must be an object"); Object.keys(mCurrencies || {}).forEach(function(sCurrencyDigit) { check(typeof sCurrencyDigit === "string"); check(typeof mCurrencies[sCurrencyDigit] === "object"); }); this._set("currency", mCurrencies); return this; }
javascript
function(mCurrencies) { check(typeof mCurrencies === "object" || mCurrencies == null, "mCurrencyDigits must be an object"); Object.keys(mCurrencies || {}).forEach(function(sCurrencyDigit) { check(typeof sCurrencyDigit === "string"); check(typeof mCurrencies[sCurrencyDigit] === "object"); }); this._set("currency", mCurrencies); return this; }
[ "function", "(", "mCurrencies", ")", "{", "check", "(", "typeof", "mCurrencies", "===", "\"object\"", "||", "mCurrencies", "==", "null", ",", "\"mCurrencyDigits must be an object\"", ")", ";", "Object", ".", "keys", "(", "mCurrencies", "||", "{", "}", ")", ".", "forEach", "(", "function", "(", "sCurrencyDigit", ")", "{", "check", "(", "typeof", "sCurrencyDigit", "===", "\"string\"", ")", ";", "check", "(", "typeof", "mCurrencies", "[", "sCurrencyDigit", "]", "===", "\"object\"", ")", ";", "}", ")", ";", "this", ".", "_set", "(", "\"currency\"", ",", "mCurrencies", ")", ";", "return", "this", ";", "}" ]
Sets custom currencies and replaces existing entries. There is a special currency code named "DEFAULT" that is optional. In case it is set it will be used for all currencies not contained in the list, otherwise currency digits as defined by the CLDR will be used as a fallback. Example: To use CLDR, but override single currencies <code> { "KWD": {"digits": 3}, "TND" : {"digits": 3} } </code> To replace the CLDR currency digits completely <code> { "DEFAULT": {"digits": 2}, "ADP": {"digits": 0}, ... "XPF": {"digits": 0} } </code> Note: To unset the custom currencies: call with <code>undefined</code> @public @param {object} mCurrencies currency map which is set @returns {sap.ui.core.Configuration.FormatSettings}
[ "Sets", "custom", "currencies", "and", "replaces", "existing", "entries", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/Configuration.js#L1967-L1975
train
SAP/openui5
src/sap.ui.core/src/sap/ui/core/Configuration.js
function(sFormatId) { sFormatId = sFormatId ? String(sFormatId).toUpperCase() : ""; check(!sFormatId || M_ABAP_DATE_FORMAT_PATTERN.hasOwnProperty(sFormatId), "sFormatId must be one of ['1','2','3','4','5','6','7','8','9','A','B','C'] or empty"); var mChanges = this.oConfiguration._collect(); this.sLegacyDateFormat = mChanges.legacyDateFormat = sFormatId; this.setDatePattern("short", M_ABAP_DATE_FORMAT_PATTERN[sFormatId].pattern); this.setDatePattern("medium", M_ABAP_DATE_FORMAT_PATTERN[sFormatId].pattern); this.oConfiguration._endCollect(); return this; }
javascript
function(sFormatId) { sFormatId = sFormatId ? String(sFormatId).toUpperCase() : ""; check(!sFormatId || M_ABAP_DATE_FORMAT_PATTERN.hasOwnProperty(sFormatId), "sFormatId must be one of ['1','2','3','4','5','6','7','8','9','A','B','C'] or empty"); var mChanges = this.oConfiguration._collect(); this.sLegacyDateFormat = mChanges.legacyDateFormat = sFormatId; this.setDatePattern("short", M_ABAP_DATE_FORMAT_PATTERN[sFormatId].pattern); this.setDatePattern("medium", M_ABAP_DATE_FORMAT_PATTERN[sFormatId].pattern); this.oConfiguration._endCollect(); return this; }
[ "function", "(", "sFormatId", ")", "{", "sFormatId", "=", "sFormatId", "?", "String", "(", "sFormatId", ")", ".", "toUpperCase", "(", ")", ":", "\"\"", ";", "check", "(", "!", "sFormatId", "||", "M_ABAP_DATE_FORMAT_PATTERN", ".", "hasOwnProperty", "(", "sFormatId", ")", ",", "\"sFormatId must be one of ['1','2','3','4','5','6','7','8','9','A','B','C'] or empty\"", ")", ";", "var", "mChanges", "=", "this", ".", "oConfiguration", ".", "_collect", "(", ")", ";", "this", ".", "sLegacyDateFormat", "=", "mChanges", ".", "legacyDateFormat", "=", "sFormatId", ";", "this", ".", "setDatePattern", "(", "\"short\"", ",", "M_ABAP_DATE_FORMAT_PATTERN", "[", "sFormatId", "]", ".", "pattern", ")", ";", "this", ".", "setDatePattern", "(", "\"medium\"", ",", "M_ABAP_DATE_FORMAT_PATTERN", "[", "sFormatId", "]", ".", "pattern", ")", ";", "this", ".", "oConfiguration", ".", "_endCollect", "(", ")", ";", "return", "this", ";", "}" ]
Allows to specify one of the legacy ABAP date formats. This method modifies the date patterns for 'short' and 'medium' style with the corresponding ABAP format. When called with a null or undefined format id, any previously applied format will be removed. After changing the legacy date format, the framework tries to update localization specific parts of the UI. See the documentation of {@link sap.ui.core.Configuration#setLanguage} for details and restrictions. @param {string} sFormatId id of the ABAP data format (one of '1','2','3','4','5','6','7','8','9','A','B','C') @return {sap.ui.core.Configuration.FormatSettings} Returns <code>this</code> to allow method chaining @public
[ "Allows", "to", "specify", "one", "of", "the", "legacy", "ABAP", "date", "formats", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/Configuration.js#L2057-L2066
train