id
int32
0
58k
repo
stringlengths
5
67
path
stringlengths
4
116
func_name
stringlengths
0
58
original_string
stringlengths
52
373k
language
stringclasses
1 value
code
stringlengths
52
373k
code_tokens
sequence
docstring
stringlengths
4
11.8k
docstring_tokens
sequence
sha
stringlengths
40
40
url
stringlengths
86
226
4,200
SAP/openui5
src/sap.ui.documentation/src/sap/ui/documentation/sdk/controller/BaseController.js
function(oEvent) { var oImage = this.byId("phoneImage"); if (Device.system.phone && oImage) { oImage.toggleStyleClass("phoneHeaderImageLandscape", oEvent.landscape); } }
javascript
function(oEvent) { var oImage = this.byId("phoneImage"); if (Device.system.phone && oImage) { oImage.toggleStyleClass("phoneHeaderImageLandscape", oEvent.landscape); } }
[ "function", "(", "oEvent", ")", "{", "var", "oImage", "=", "this", ".", "byId", "(", "\"phoneImage\"", ")", ";", "if", "(", "Device", ".", "system", ".", "phone", "&&", "oImage", ")", "{", "oImage", ".", "toggleStyleClass", "(", "\"phoneHeaderImageLandscape\"", ",", "oEvent", ".", "landscape", ")", ";", "}", "}" ]
Switches the maximum height of the phone image for optimal display in landscape mode @param {sap.ui.base.Event} oEvent Device orientation change event @private
[ "Switches", "the", "maximum", "height", "of", "the", "phone", "image", "for", "optimal", "display", "in", "landscape", "mode" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.documentation/src/sap/ui/documentation/sdk/controller/BaseController.js#L170-L176
4,201
SAP/openui5
src/sap.ui.documentation/src/sap/ui/documentation/sdk/controller/BaseController.js
function (sControlName) { return APIInfo.getIndexJsonPromise().then(function (aData) { function findSymbol (a) { return a.some(function (o) { var bFound = o.name === sControlName; if (!bFound && o.nodes) { return findSymbol(o.nodes); } return bFound; }); } return findSymbol(aData); }); }
javascript
function (sControlName) { return APIInfo.getIndexJsonPromise().then(function (aData) { function findSymbol (a) { return a.some(function (o) { var bFound = o.name === sControlName; if (!bFound && o.nodes) { return findSymbol(o.nodes); } return bFound; }); } return findSymbol(aData); }); }
[ "function", "(", "sControlName", ")", "{", "return", "APIInfo", ".", "getIndexJsonPromise", "(", ")", ".", "then", "(", "function", "(", "aData", ")", "{", "function", "findSymbol", "(", "a", ")", "{", "return", "a", ".", "some", "(", "function", "(", "o", ")", "{", "var", "bFound", "=", "o", ".", "name", "===", "sControlName", ";", "if", "(", "!", "bFound", "&&", "o", ".", "nodes", ")", "{", "return", "findSymbol", "(", "o", ".", "nodes", ")", ";", "}", "return", "bFound", ";", "}", ")", ";", "}", "return", "findSymbol", "(", "aData", ")", ";", "}", ")", ";", "}" ]
Checks if a control has API Reference @param {string} sControlName @return {Promise} A promise that resolves to {boolean}
[ "Checks", "if", "a", "control", "has", "API", "Reference" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.documentation/src/sap/ui/documentation/sdk/controller/BaseController.js#L206-L219
4,202
SAP/openui5
src/sap.f/src/sap/f/GridContainerSettings.js
cssSizeToPx
function cssSizeToPx(sCssSize) { if (sCssSize === 0 || sCssSize === "0") { return 0; } var aMatch = sCssSize.match(/^(\d+(\.\d+)?)(px|rem)$/), iValue; if (aMatch) { if (aMatch[3] === "px") { iValue = parseFloat(aMatch[1]); } else { iValue = Rem.toPx(parseFloat(aMatch[1])); } } else { Log.error("Css size '" + sCssSize + "' is not supported for GridContainer. Only 'px' and 'rem' are supported."); iValue = NaN; } return Math.ceil(iValue); }
javascript
function cssSizeToPx(sCssSize) { if (sCssSize === 0 || sCssSize === "0") { return 0; } var aMatch = sCssSize.match(/^(\d+(\.\d+)?)(px|rem)$/), iValue; if (aMatch) { if (aMatch[3] === "px") { iValue = parseFloat(aMatch[1]); } else { iValue = Rem.toPx(parseFloat(aMatch[1])); } } else { Log.error("Css size '" + sCssSize + "' is not supported for GridContainer. Only 'px' and 'rem' are supported."); iValue = NaN; } return Math.ceil(iValue); }
[ "function", "cssSizeToPx", "(", "sCssSize", ")", "{", "if", "(", "sCssSize", "===", "0", "||", "sCssSize", "===", "\"0\"", ")", "{", "return", "0", ";", "}", "var", "aMatch", "=", "sCssSize", ".", "match", "(", "/", "^(\\d+(\\.\\d+)?)(px|rem)$", "/", ")", ",", "iValue", ";", "if", "(", "aMatch", ")", "{", "if", "(", "aMatch", "[", "3", "]", "===", "\"px\"", ")", "{", "iValue", "=", "parseFloat", "(", "aMatch", "[", "1", "]", ")", ";", "}", "else", "{", "iValue", "=", "Rem", ".", "toPx", "(", "parseFloat", "(", "aMatch", "[", "1", "]", ")", ")", ";", "}", "}", "else", "{", "Log", ".", "error", "(", "\"Css size '\"", "+", "sCssSize", "+", "\"' is not supported for GridContainer. Only 'px' and 'rem' are supported.\"", ")", ";", "iValue", "=", "NaN", ";", "}", "return", "Math", ".", "ceil", "(", "iValue", ")", ";", "}" ]
Converts the given css size to its corresponding 'px' value. @private @param {string} sCssSize The css size to parse. For example '5rem'. @returns {int} The size in 'px'. The result is rounded up with Math.ceil(). Returns NaN if the size can not be parsed.
[ "Converts", "the", "given", "css", "size", "to", "its", "corresponding", "px", "value", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.f/src/sap/f/GridContainerSettings.js#L22-L41
4,203
SAP/openui5
src/sap.ui.core/src/sap/ui/model/TreeBindingAdapter.js
function (oNode) { // do not count the artifical root node if (!oNode || !oNode.isArtificial) { iNodeCounter++; } if (oNode) { // Always reset selectAllMode oNode.nodeState.selectAllMode = false; if (this._mTreeState.selected[oNode.groupID]) { // remember changed index, push it to the limit! if (!oNode.isArtificial) { aChangedIndices.push(iNodeCounter); } // deslect the node this.setNodeSelection(oNode.nodeState, false); //also remember the old lead index if (oNode.groupID === this._sLeadSelectionGroupID) { iOldLeadIndex = iNodeCounter; } return true; } } }
javascript
function (oNode) { // do not count the artifical root node if (!oNode || !oNode.isArtificial) { iNodeCounter++; } if (oNode) { // Always reset selectAllMode oNode.nodeState.selectAllMode = false; if (this._mTreeState.selected[oNode.groupID]) { // remember changed index, push it to the limit! if (!oNode.isArtificial) { aChangedIndices.push(iNodeCounter); } // deslect the node this.setNodeSelection(oNode.nodeState, false); //also remember the old lead index if (oNode.groupID === this._sLeadSelectionGroupID) { iOldLeadIndex = iNodeCounter; } return true; } } }
[ "function", "(", "oNode", ")", "{", "// do not count the artifical root node", "if", "(", "!", "oNode", "||", "!", "oNode", ".", "isArtificial", ")", "{", "iNodeCounter", "++", ";", "}", "if", "(", "oNode", ")", "{", "// Always reset selectAllMode", "oNode", ".", "nodeState", ".", "selectAllMode", "=", "false", ";", "if", "(", "this", ".", "_mTreeState", ".", "selected", "[", "oNode", ".", "groupID", "]", ")", "{", "// remember changed index, push it to the limit!", "if", "(", "!", "oNode", ".", "isArtificial", ")", "{", "aChangedIndices", ".", "push", "(", "iNodeCounter", ")", ";", "}", "// deslect the node", "this", ".", "setNodeSelection", "(", "oNode", ".", "nodeState", ",", "false", ")", ";", "//also remember the old lead index", "if", "(", "oNode", ".", "groupID", "===", "this", ".", "_sLeadSelectionGroupID", ")", "{", "iOldLeadIndex", "=", "iNodeCounter", ";", "}", "return", "true", ";", "}", "}", "}" ]
matches all selected nodes and retrieves their absolute row index
[ "matches", "all", "selected", "nodes", "and", "retrieves", "their", "absolute", "row", "index" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/TreeBindingAdapter.js#L1547-L1574
4,204
SAP/openui5
src/sap.m/src/sap/m/HyphenationSupport.js
isValidTextKey
function isValidTextKey(oControl, sKey) { var mTexts = oControl.getTextsToBeHyphenated(); if (typeof mTexts !== "object") { Log.error("[UI5 Hyphenation] The result of getTextsToBeHyphenated method is not a map object.", oControl.getId()); return false; } if (Object.keys(mTexts).indexOf(sKey) < 0) { Log.error("[UI5 Hyphenation] The key " + sKey + " is not found in the result of getTextsToBeHyphenated method.", oControl.getId()); return false; } return true; }
javascript
function isValidTextKey(oControl, sKey) { var mTexts = oControl.getTextsToBeHyphenated(); if (typeof mTexts !== "object") { Log.error("[UI5 Hyphenation] The result of getTextsToBeHyphenated method is not a map object.", oControl.getId()); return false; } if (Object.keys(mTexts).indexOf(sKey) < 0) { Log.error("[UI5 Hyphenation] The key " + sKey + " is not found in the result of getTextsToBeHyphenated method.", oControl.getId()); return false; } return true; }
[ "function", "isValidTextKey", "(", "oControl", ",", "sKey", ")", "{", "var", "mTexts", "=", "oControl", ".", "getTextsToBeHyphenated", "(", ")", ";", "if", "(", "typeof", "mTexts", "!==", "\"object\"", ")", "{", "Log", ".", "error", "(", "\"[UI5 Hyphenation] The result of getTextsToBeHyphenated method is not a map object.\"", ",", "oControl", ".", "getId", "(", ")", ")", ";", "return", "false", ";", "}", "if", "(", "Object", ".", "keys", "(", "mTexts", ")", ".", "indexOf", "(", "sKey", ")", "<", "0", ")", "{", "Log", ".", "error", "(", "\"[UI5 Hyphenation] The key \"", "+", "sKey", "+", "\" is not found in the result of getTextsToBeHyphenated method.\"", ",", "oControl", ".", "getId", "(", ")", ")", ";", "return", "false", ";", "}", "return", "true", ";", "}" ]
Checks if the required text key is present in the texts map. @param {sap.m.IHyphenation} oControl The control to be checked @param {string} sKey The key to look for @returns {boolean} True if the key is correct @private
[ "Checks", "if", "the", "required", "text", "key", "is", "present", "in", "the", "texts", "map", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.m/src/sap/m/HyphenationSupport.js#L47-L61
4,205
SAP/openui5
src/sap.m/src/sap/m/HyphenationSupport.js
diffTexts
function diffTexts(mTextsMain, mTextsToDiff) { var aDiffs = []; Object.keys(mTextsMain).forEach(function(sKey) { if (!(sKey in mTextsToDiff && mTextsMain[sKey] === mTextsToDiff[sKey])) { aDiffs.push(sKey); } }); return aDiffs; }
javascript
function diffTexts(mTextsMain, mTextsToDiff) { var aDiffs = []; Object.keys(mTextsMain).forEach(function(sKey) { if (!(sKey in mTextsToDiff && mTextsMain[sKey] === mTextsToDiff[sKey])) { aDiffs.push(sKey); } }); return aDiffs; }
[ "function", "diffTexts", "(", "mTextsMain", ",", "mTextsToDiff", ")", "{", "var", "aDiffs", "=", "[", "]", ";", "Object", ".", "keys", "(", "mTextsMain", ")", ".", "forEach", "(", "function", "(", "sKey", ")", "{", "if", "(", "!", "(", "sKey", "in", "mTextsToDiff", "&&", "mTextsMain", "[", "sKey", "]", "===", "mTextsToDiff", "[", "sKey", "]", ")", ")", "{", "aDiffs", ".", "push", "(", "sKey", ")", ";", "}", "}", ")", ";", "return", "aDiffs", ";", "}" ]
Checks which keys are not present in mTextsToDiff or their values are different @param {map} mTextsMain The map of texts to compare @param {map} mTextsToDiff The map of texts to compare against @returns {Array} An array containing all keys for which there is difference @private
[ "Checks", "which", "keys", "are", "not", "present", "in", "mTextsToDiff", "or", "their", "values", "are", "different" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.m/src/sap/m/HyphenationSupport.js#L89-L97
4,206
SAP/openui5
src/sap.m/src/sap/m/HyphenationSupport.js
shouldUseThirdParty
function shouldUseThirdParty() { var sHyphenationConfig = Core.getConfiguration().getHyphenation(), oHyphenationInstance = Hyphenation.getInstance(); if (sHyphenationConfig === "native" || sHyphenationConfig === "disable") { return false; } if (sHyphenationConfig === "thirdparty") { return true; } return oHyphenationInstance.isLanguageSupported() && !oHyphenationInstance.canUseNativeHyphenation() && oHyphenationInstance.canUseThirdPartyHyphenation(); }
javascript
function shouldUseThirdParty() { var sHyphenationConfig = Core.getConfiguration().getHyphenation(), oHyphenationInstance = Hyphenation.getInstance(); if (sHyphenationConfig === "native" || sHyphenationConfig === "disable") { return false; } if (sHyphenationConfig === "thirdparty") { return true; } return oHyphenationInstance.isLanguageSupported() && !oHyphenationInstance.canUseNativeHyphenation() && oHyphenationInstance.canUseThirdPartyHyphenation(); }
[ "function", "shouldUseThirdParty", "(", ")", "{", "var", "sHyphenationConfig", "=", "Core", ".", "getConfiguration", "(", ")", ".", "getHyphenation", "(", ")", ",", "oHyphenationInstance", "=", "Hyphenation", ".", "getInstance", "(", ")", ";", "if", "(", "sHyphenationConfig", "===", "\"native\"", "||", "sHyphenationConfig", "===", "\"disable\"", ")", "{", "return", "false", ";", "}", "if", "(", "sHyphenationConfig", "===", "\"thirdparty\"", ")", "{", "return", "true", ";", "}", "return", "oHyphenationInstance", ".", "isLanguageSupported", "(", ")", "&&", "!", "oHyphenationInstance", ".", "canUseNativeHyphenation", "(", ")", "&&", "oHyphenationInstance", ".", "canUseThirdPartyHyphenation", "(", ")", ";", "}" ]
Checks if the third-party hyphenation is required. @returns {boolean} True if third-party hyphenation is required. False if native hyphenation is available or required @private
[ "Checks", "if", "the", "third", "-", "party", "hyphenation", "is", "required", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.m/src/sap/m/HyphenationSupport.js#L105-L120
4,207
SAP/openui5
src/sap.m/src/sap/m/HyphenationSupport.js
shouldControlHyphenate
function shouldControlHyphenate(oControl) { var sHyphenationConfig = Core.getConfiguration().getHyphenation(); if (sHyphenationConfig === 'disable') { return false; } if (oControl.getWrappingType() === WrappingType.Hyphenated && !oControl.getWrapping()) { Log.warning("[UI5 Hyphenation] The property wrappingType=Hyphenated will not take effect unless wrapping=true.", oControl.getId()); } return oControl.getWrapping() && oControl.getWrappingType() === WrappingType.Hyphenated; }
javascript
function shouldControlHyphenate(oControl) { var sHyphenationConfig = Core.getConfiguration().getHyphenation(); if (sHyphenationConfig === 'disable') { return false; } if (oControl.getWrappingType() === WrappingType.Hyphenated && !oControl.getWrapping()) { Log.warning("[UI5 Hyphenation] The property wrappingType=Hyphenated will not take effect unless wrapping=true.", oControl.getId()); } return oControl.getWrapping() && oControl.getWrappingType() === WrappingType.Hyphenated; }
[ "function", "shouldControlHyphenate", "(", "oControl", ")", "{", "var", "sHyphenationConfig", "=", "Core", ".", "getConfiguration", "(", ")", ".", "getHyphenation", "(", ")", ";", "if", "(", "sHyphenationConfig", "===", "'disable'", ")", "{", "return", "false", ";", "}", "if", "(", "oControl", ".", "getWrappingType", "(", ")", "===", "WrappingType", ".", "Hyphenated", "&&", "!", "oControl", ".", "getWrapping", "(", ")", ")", "{", "Log", ".", "warning", "(", "\"[UI5 Hyphenation] The property wrappingType=Hyphenated will not take effect unless wrapping=true.\"", ",", "oControl", ".", "getId", "(", ")", ")", ";", "}", "return", "oControl", ".", "getWrapping", "(", ")", "&&", "oControl", ".", "getWrappingType", "(", ")", "===", "WrappingType", ".", "Hyphenated", ";", "}" ]
Checks whether the control's text should be hyphenated. @param {sap.m.IHyphenation} oControl The control to be checked @returns {boolean} True if the control should hyphenate @private
[ "Checks", "whether", "the", "control", "s", "text", "should", "be", "hyphenated", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.m/src/sap/m/HyphenationSupport.js#L129-L140
4,208
SAP/openui5
src/sap.m/src/sap/m/HyphenationSupport.js
hyphenateTexts
function hyphenateTexts(oControl) { if (!shouldControlHyphenate(oControl) || !shouldUseThirdParty()) { // no hyphenation needed oControl._mHyphenatedTexts = {}; oControl._mUnhyphenatedTexts = {}; return; } var mTexts = oControl.getTextsToBeHyphenated(), aChangedTextKeys = diffTexts(mTexts, oControl._mUnhyphenatedTexts); if (aChangedTextKeys.length > 0) { oControl._mUnhyphenatedTexts = mTexts; aChangedTextKeys.forEach(function(sKey) { delete oControl._mHyphenatedTexts[sKey]; }); var oHyphenation = Hyphenation.getInstance(); if (!oHyphenation.isLanguageInitialized()) { oHyphenation.initialize().then(function () { var mDomRefs = oControl.isActive() ? oControl.getDomRefsForHyphenatedTexts() : null, bNeedInvalidate = false; aChangedTextKeys.forEach(function(sKey) { oControl._mHyphenatedTexts[sKey] = oHyphenation.hyphenate(mTexts[sKey]); if (mDomRefs && sKey in mDomRefs) { setNodeValue(mDomRefs[sKey], oControl._mHyphenatedTexts[sKey]); } else { bNeedInvalidate = true; } }); if (bNeedInvalidate) { oControl.invalidate(); } }); } else { aChangedTextKeys.forEach(function(sKey) { oControl._mHyphenatedTexts[sKey] = oHyphenation.hyphenate(mTexts[sKey]); }); } } }
javascript
function hyphenateTexts(oControl) { if (!shouldControlHyphenate(oControl) || !shouldUseThirdParty()) { // no hyphenation needed oControl._mHyphenatedTexts = {}; oControl._mUnhyphenatedTexts = {}; return; } var mTexts = oControl.getTextsToBeHyphenated(), aChangedTextKeys = diffTexts(mTexts, oControl._mUnhyphenatedTexts); if (aChangedTextKeys.length > 0) { oControl._mUnhyphenatedTexts = mTexts; aChangedTextKeys.forEach(function(sKey) { delete oControl._mHyphenatedTexts[sKey]; }); var oHyphenation = Hyphenation.getInstance(); if (!oHyphenation.isLanguageInitialized()) { oHyphenation.initialize().then(function () { var mDomRefs = oControl.isActive() ? oControl.getDomRefsForHyphenatedTexts() : null, bNeedInvalidate = false; aChangedTextKeys.forEach(function(sKey) { oControl._mHyphenatedTexts[sKey] = oHyphenation.hyphenate(mTexts[sKey]); if (mDomRefs && sKey in mDomRefs) { setNodeValue(mDomRefs[sKey], oControl._mHyphenatedTexts[sKey]); } else { bNeedInvalidate = true; } }); if (bNeedInvalidate) { oControl.invalidate(); } }); } else { aChangedTextKeys.forEach(function(sKey) { oControl._mHyphenatedTexts[sKey] = oHyphenation.hyphenate(mTexts[sKey]); }); } } }
[ "function", "hyphenateTexts", "(", "oControl", ")", "{", "if", "(", "!", "shouldControlHyphenate", "(", "oControl", ")", "||", "!", "shouldUseThirdParty", "(", ")", ")", "{", "// no hyphenation needed", "oControl", ".", "_mHyphenatedTexts", "=", "{", "}", ";", "oControl", ".", "_mUnhyphenatedTexts", "=", "{", "}", ";", "return", ";", "}", "var", "mTexts", "=", "oControl", ".", "getTextsToBeHyphenated", "(", ")", ",", "aChangedTextKeys", "=", "diffTexts", "(", "mTexts", ",", "oControl", ".", "_mUnhyphenatedTexts", ")", ";", "if", "(", "aChangedTextKeys", ".", "length", ">", "0", ")", "{", "oControl", ".", "_mUnhyphenatedTexts", "=", "mTexts", ";", "aChangedTextKeys", ".", "forEach", "(", "function", "(", "sKey", ")", "{", "delete", "oControl", ".", "_mHyphenatedTexts", "[", "sKey", "]", ";", "}", ")", ";", "var", "oHyphenation", "=", "Hyphenation", ".", "getInstance", "(", ")", ";", "if", "(", "!", "oHyphenation", ".", "isLanguageInitialized", "(", ")", ")", "{", "oHyphenation", ".", "initialize", "(", ")", ".", "then", "(", "function", "(", ")", "{", "var", "mDomRefs", "=", "oControl", ".", "isActive", "(", ")", "?", "oControl", ".", "getDomRefsForHyphenatedTexts", "(", ")", ":", "null", ",", "bNeedInvalidate", "=", "false", ";", "aChangedTextKeys", ".", "forEach", "(", "function", "(", "sKey", ")", "{", "oControl", ".", "_mHyphenatedTexts", "[", "sKey", "]", "=", "oHyphenation", ".", "hyphenate", "(", "mTexts", "[", "sKey", "]", ")", ";", "if", "(", "mDomRefs", "&&", "sKey", "in", "mDomRefs", ")", "{", "setNodeValue", "(", "mDomRefs", "[", "sKey", "]", ",", "oControl", ".", "_mHyphenatedTexts", "[", "sKey", "]", ")", ";", "}", "else", "{", "bNeedInvalidate", "=", "true", ";", "}", "}", ")", ";", "if", "(", "bNeedInvalidate", ")", "{", "oControl", ".", "invalidate", "(", ")", ";", "}", "}", ")", ";", "}", "else", "{", "aChangedTextKeys", ".", "forEach", "(", "function", "(", "sKey", ")", "{", "oControl", ".", "_mHyphenatedTexts", "[", "sKey", "]", "=", "oHyphenation", ".", "hyphenate", "(", "mTexts", "[", "sKey", "]", ")", ";", "}", ")", ";", "}", "}", "}" ]
Hyphenates all texts needed for the given control. @param {sap.m.IHyphenation} oControl The control whose texts need hyphenation @private
[ "Hyphenates", "all", "texts", "needed", "for", "the", "given", "control", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.m/src/sap/m/HyphenationSupport.js#L148-L192
4,209
SAP/openui5
src/sap.ui.core/src/sap/ui/core/format/NumberFormat.js
parseNumberAndUnit
function parseNumberAndUnit(mUnitPatterns, sValue) { var oBestMatch = { numberValue: undefined, cldrCode: [] }; if (typeof sValue !== "string") { return oBestMatch; } var iBestLength = Number.POSITIVE_INFINITY; var sUnitCode, sKey; for (sUnitCode in mUnitPatterns) { for (sKey in mUnitPatterns[sUnitCode]) { //use only unit patterns if (sKey.indexOf("unitPattern") === 0) { var sUnitPattern = mUnitPatterns[sUnitCode][sKey]; // IMPORTANT: // To increase performance we are using native string operations instead of regex, // to match the patterns against the input. // // sample input: e.g. "mi 12 tsd. ms²" // unit pattern: e.g. "mi {0} ms²" // The smallest resulting number (String length) will be the best match var iNumberPatternIndex = sUnitPattern.indexOf("{0}"); var bContainsExpression = iNumberPatternIndex > -1; if (bContainsExpression) { //escape regex characters to match it properly var sPrefix = sUnitPattern.substring(0, iNumberPatternIndex); var sPostfix = sUnitPattern.substring(iNumberPatternIndex + "{0}".length); var bMatches = sValue.startsWith(sPrefix) && sValue.endsWith(sPostfix); var match = bMatches && sValue.substring(sPrefix.length, sValue.length - sPostfix.length); if (match) { //get the match with the shortest result. // e.g. 1km -> (.+)m -> "1k" -> length 2 // e.g. 1km -> (.+)km -> "1" -> length 1 if (match.length < iBestLength) { iBestLength = match.length; oBestMatch.numberValue = match; oBestMatch.cldrCode = [sUnitCode]; } else if (match.length === iBestLength && oBestMatch.cldrCode.indexOf(sUnitCode) === -1) { //ambiguous unit (en locale) // e.g. 100 c -> (.+) c -> duration-century // e.g. 100 c -> (.+) c -> volume-cup oBestMatch.cldrCode.push(sUnitCode); } } } else if (sUnitPattern === sValue) { oBestMatch.cldrCode = [sUnitCode]; //for units which do not have a number representation, get the number from the pattern var sNumber; if (sKey.endsWith("-zero")) { sNumber = "0"; } else if (sKey.endsWith("-one")) { sNumber = "1"; } else if (sKey.endsWith("-two")) { sNumber = "2"; } oBestMatch.numberValue = sNumber; return oBestMatch; } } } } return oBestMatch; }
javascript
function parseNumberAndUnit(mUnitPatterns, sValue) { var oBestMatch = { numberValue: undefined, cldrCode: [] }; if (typeof sValue !== "string") { return oBestMatch; } var iBestLength = Number.POSITIVE_INFINITY; var sUnitCode, sKey; for (sUnitCode in mUnitPatterns) { for (sKey in mUnitPatterns[sUnitCode]) { //use only unit patterns if (sKey.indexOf("unitPattern") === 0) { var sUnitPattern = mUnitPatterns[sUnitCode][sKey]; // IMPORTANT: // To increase performance we are using native string operations instead of regex, // to match the patterns against the input. // // sample input: e.g. "mi 12 tsd. ms²" // unit pattern: e.g. "mi {0} ms²" // The smallest resulting number (String length) will be the best match var iNumberPatternIndex = sUnitPattern.indexOf("{0}"); var bContainsExpression = iNumberPatternIndex > -1; if (bContainsExpression) { //escape regex characters to match it properly var sPrefix = sUnitPattern.substring(0, iNumberPatternIndex); var sPostfix = sUnitPattern.substring(iNumberPatternIndex + "{0}".length); var bMatches = sValue.startsWith(sPrefix) && sValue.endsWith(sPostfix); var match = bMatches && sValue.substring(sPrefix.length, sValue.length - sPostfix.length); if (match) { //get the match with the shortest result. // e.g. 1km -> (.+)m -> "1k" -> length 2 // e.g. 1km -> (.+)km -> "1" -> length 1 if (match.length < iBestLength) { iBestLength = match.length; oBestMatch.numberValue = match; oBestMatch.cldrCode = [sUnitCode]; } else if (match.length === iBestLength && oBestMatch.cldrCode.indexOf(sUnitCode) === -1) { //ambiguous unit (en locale) // e.g. 100 c -> (.+) c -> duration-century // e.g. 100 c -> (.+) c -> volume-cup oBestMatch.cldrCode.push(sUnitCode); } } } else if (sUnitPattern === sValue) { oBestMatch.cldrCode = [sUnitCode]; //for units which do not have a number representation, get the number from the pattern var sNumber; if (sKey.endsWith("-zero")) { sNumber = "0"; } else if (sKey.endsWith("-one")) { sNumber = "1"; } else if (sKey.endsWith("-two")) { sNumber = "2"; } oBestMatch.numberValue = sNumber; return oBestMatch; } } } } return oBestMatch; }
[ "function", "parseNumberAndUnit", "(", "mUnitPatterns", ",", "sValue", ")", "{", "var", "oBestMatch", "=", "{", "numberValue", ":", "undefined", ",", "cldrCode", ":", "[", "]", "}", ";", "if", "(", "typeof", "sValue", "!==", "\"string\"", ")", "{", "return", "oBestMatch", ";", "}", "var", "iBestLength", "=", "Number", ".", "POSITIVE_INFINITY", ";", "var", "sUnitCode", ",", "sKey", ";", "for", "(", "sUnitCode", "in", "mUnitPatterns", ")", "{", "for", "(", "sKey", "in", "mUnitPatterns", "[", "sUnitCode", "]", ")", "{", "//use only unit patterns", "if", "(", "sKey", ".", "indexOf", "(", "\"unitPattern\"", ")", "===", "0", ")", "{", "var", "sUnitPattern", "=", "mUnitPatterns", "[", "sUnitCode", "]", "[", "sKey", "]", ";", "// IMPORTANT:", "// To increase performance we are using native string operations instead of regex,", "// to match the patterns against the input.", "//", "// sample input: e.g. \"mi 12 tsd. ms²\"", "// unit pattern: e.g. \"mi {0} ms²\"", "// The smallest resulting number (String length) will be the best match", "var", "iNumberPatternIndex", "=", "sUnitPattern", ".", "indexOf", "(", "\"{0}\"", ")", ";", "var", "bContainsExpression", "=", "iNumberPatternIndex", ">", "-", "1", ";", "if", "(", "bContainsExpression", ")", "{", "//escape regex characters to match it properly", "var", "sPrefix", "=", "sUnitPattern", ".", "substring", "(", "0", ",", "iNumberPatternIndex", ")", ";", "var", "sPostfix", "=", "sUnitPattern", ".", "substring", "(", "iNumberPatternIndex", "+", "\"{0}\"", ".", "length", ")", ";", "var", "bMatches", "=", "sValue", ".", "startsWith", "(", "sPrefix", ")", "&&", "sValue", ".", "endsWith", "(", "sPostfix", ")", ";", "var", "match", "=", "bMatches", "&&", "sValue", ".", "substring", "(", "sPrefix", ".", "length", ",", "sValue", ".", "length", "-", "sPostfix", ".", "length", ")", ";", "if", "(", "match", ")", "{", "//get the match with the shortest result.", "// e.g. 1km -> (.+)m -> \"1k\" -> length 2", "// e.g. 1km -> (.+)km -> \"1\" -> length 1", "if", "(", "match", ".", "length", "<", "iBestLength", ")", "{", "iBestLength", "=", "match", ".", "length", ";", "oBestMatch", ".", "numberValue", "=", "match", ";", "oBestMatch", ".", "cldrCode", "=", "[", "sUnitCode", "]", ";", "}", "else", "if", "(", "match", ".", "length", "===", "iBestLength", "&&", "oBestMatch", ".", "cldrCode", ".", "indexOf", "(", "sUnitCode", ")", "===", "-", "1", ")", "{", "//ambiguous unit (en locale)", "// e.g. 100 c -> (.+) c -> duration-century", "// e.g. 100 c -> (.+) c -> volume-cup", "oBestMatch", ".", "cldrCode", ".", "push", "(", "sUnitCode", ")", ";", "}", "}", "}", "else", "if", "(", "sUnitPattern", "===", "sValue", ")", "{", "oBestMatch", ".", "cldrCode", "=", "[", "sUnitCode", "]", ";", "//for units which do not have a number representation, get the number from the pattern", "var", "sNumber", ";", "if", "(", "sKey", ".", "endsWith", "(", "\"-zero\"", ")", ")", "{", "sNumber", "=", "\"0\"", ";", "}", "else", "if", "(", "sKey", ".", "endsWith", "(", "\"-one\"", ")", ")", "{", "sNumber", "=", "\"1\"", ";", "}", "else", "if", "(", "sKey", ".", "endsWith", "(", "\"-two\"", ")", ")", "{", "sNumber", "=", "\"2\"", ";", "}", "oBestMatch", ".", "numberValue", "=", "sNumber", ";", "return", "oBestMatch", ";", "}", "}", "}", "}", "return", "oBestMatch", ";", "}" ]
Returns the cldr code and the number value by checking each pattern and finding the best match. 1. iterate over each unit pattern, e.g. "{0}m", "{0}km" 1a. convert it to a reg exp pattern, e.g. "^(.+)m$" 1b. match it with the input "12km" and store the value "12k" and the unit value "m" 1c. do this for each pattern and update the best result if a better match is found A better match means most of the unit value matched and the number match is shorter. E.g. input: 12km matches for the pattern "^(.+)m$" and the resulting value is "12k" while the pattern "^(.+)km$" results in "12". Since pattern "^(.+)km$" returns a shorter result it is considered the better match. Note: the cldr data is not distinct in its patterns. E.g. "100 c" could be in "en_gb" either 100 units of "volume-cup" or "duration-century" both having the same pattern "{0} c" Therefore best matches will be returned in an array. @param {object} mUnitPatterns the unit patterns @param {string} sValue The value e.g. "12 km" @return {object} An object containing the unit codes (key: <code>[cldrCode]</code>) and the number value (key: <code>numberValue</code>). Values are <code>undefined</code> or an empty array if not found. E.g. <code>{ numberValue: 12, cldrCode: [length-kilometer] }</code>
[ "Returns", "the", "cldr", "code", "and", "the", "number", "value", "by", "checking", "each", "pattern", "and", "finding", "the", "best", "match", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/format/NumberFormat.js#L1884-L1955
4,210
SAP/openui5
src/sap.ui.core/src/sap/ui/core/format/NumberFormat.js
parseNumberAndCurrency
function parseNumberAndCurrency(oConfig) { var sValue = oConfig.value; // Search for known symbols (longest match) // no distinction between default and custom currencies var oMatch = findLongestMatch(sValue, oConfig.currencySymbols); // Search for currency code if (!oMatch.code) { // before falling back to the default regex for ISO codes we check the // codes for custom currencies (if defined) oMatch = findLongestMatch(sValue, oConfig.customCurrencyCodes); if (!oMatch.code && !oConfig.customCurrenciesAvailable) { // Match 3-letter iso code var aIsoMatches = sValue.match(/(^[A-Z]{3}|[A-Z]{3}$)/); oMatch.code = aIsoMatches && aIsoMatches[0]; } } // Remove symbol/code from value if (oMatch.code) { var iLastCodeIndex = oMatch.code.length - 1; var sLastCodeChar = oMatch.code.charAt(iLastCodeIndex); var iDelimiterPos; var rValidDelimiters = /[\-\s]+/; // Check whether last character of matched code is a number if (/\d$/.test(sLastCodeChar)) { // Check whether parse string starts with the matched code if (sValue.startsWith(oMatch.code)) { iDelimiterPos = iLastCodeIndex + 1; // \s matching any whitespace character including // non-breaking ws and invisible non-breaking ws if (!rValidDelimiters.test(sValue.charAt(iDelimiterPos))) { return undefined; } } // Check whether first character of matched code is a number } else if (/^\d/.test(oMatch.code)) { // Check whether parse string ends with the matched code if (sValue.endsWith(oMatch.code)) { iDelimiterPos = sValue.indexOf(oMatch.code) - 1; if (!rValidDelimiters.test(sValue.charAt(iDelimiterPos))) { return undefined; } } } sValue = sValue.replace(oMatch.symbol || oMatch.code, ""); } // Set currency code to undefined, as the defined custom currencies // contain multiple currencies having the same symbol. if (oConfig.duplicatedSymbols && oConfig.duplicatedSymbols[oMatch.symbol]) { oMatch.code = undefined; Log.error("The parsed currency symbol '" + oMatch.symbol + "' is defined multiple " + "times in custom currencies.Therefore the result is not distinct."); } return { numberValue: sValue, currencyCode: oMatch.code || undefined }; }
javascript
function parseNumberAndCurrency(oConfig) { var sValue = oConfig.value; // Search for known symbols (longest match) // no distinction between default and custom currencies var oMatch = findLongestMatch(sValue, oConfig.currencySymbols); // Search for currency code if (!oMatch.code) { // before falling back to the default regex for ISO codes we check the // codes for custom currencies (if defined) oMatch = findLongestMatch(sValue, oConfig.customCurrencyCodes); if (!oMatch.code && !oConfig.customCurrenciesAvailable) { // Match 3-letter iso code var aIsoMatches = sValue.match(/(^[A-Z]{3}|[A-Z]{3}$)/); oMatch.code = aIsoMatches && aIsoMatches[0]; } } // Remove symbol/code from value if (oMatch.code) { var iLastCodeIndex = oMatch.code.length - 1; var sLastCodeChar = oMatch.code.charAt(iLastCodeIndex); var iDelimiterPos; var rValidDelimiters = /[\-\s]+/; // Check whether last character of matched code is a number if (/\d$/.test(sLastCodeChar)) { // Check whether parse string starts with the matched code if (sValue.startsWith(oMatch.code)) { iDelimiterPos = iLastCodeIndex + 1; // \s matching any whitespace character including // non-breaking ws and invisible non-breaking ws if (!rValidDelimiters.test(sValue.charAt(iDelimiterPos))) { return undefined; } } // Check whether first character of matched code is a number } else if (/^\d/.test(oMatch.code)) { // Check whether parse string ends with the matched code if (sValue.endsWith(oMatch.code)) { iDelimiterPos = sValue.indexOf(oMatch.code) - 1; if (!rValidDelimiters.test(sValue.charAt(iDelimiterPos))) { return undefined; } } } sValue = sValue.replace(oMatch.symbol || oMatch.code, ""); } // Set currency code to undefined, as the defined custom currencies // contain multiple currencies having the same symbol. if (oConfig.duplicatedSymbols && oConfig.duplicatedSymbols[oMatch.symbol]) { oMatch.code = undefined; Log.error("The parsed currency symbol '" + oMatch.symbol + "' is defined multiple " + "times in custom currencies.Therefore the result is not distinct."); } return { numberValue: sValue, currencyCode: oMatch.code || undefined }; }
[ "function", "parseNumberAndCurrency", "(", "oConfig", ")", "{", "var", "sValue", "=", "oConfig", ".", "value", ";", "// Search for known symbols (longest match)", "// no distinction between default and custom currencies", "var", "oMatch", "=", "findLongestMatch", "(", "sValue", ",", "oConfig", ".", "currencySymbols", ")", ";", "// Search for currency code", "if", "(", "!", "oMatch", ".", "code", ")", "{", "// before falling back to the default regex for ISO codes we check the", "// codes for custom currencies (if defined)", "oMatch", "=", "findLongestMatch", "(", "sValue", ",", "oConfig", ".", "customCurrencyCodes", ")", ";", "if", "(", "!", "oMatch", ".", "code", "&&", "!", "oConfig", ".", "customCurrenciesAvailable", ")", "{", "// Match 3-letter iso code", "var", "aIsoMatches", "=", "sValue", ".", "match", "(", "/", "(^[A-Z]{3}|[A-Z]{3}$)", "/", ")", ";", "oMatch", ".", "code", "=", "aIsoMatches", "&&", "aIsoMatches", "[", "0", "]", ";", "}", "}", "// Remove symbol/code from value", "if", "(", "oMatch", ".", "code", ")", "{", "var", "iLastCodeIndex", "=", "oMatch", ".", "code", ".", "length", "-", "1", ";", "var", "sLastCodeChar", "=", "oMatch", ".", "code", ".", "charAt", "(", "iLastCodeIndex", ")", ";", "var", "iDelimiterPos", ";", "var", "rValidDelimiters", "=", "/", "[\\-\\s]+", "/", ";", "// Check whether last character of matched code is a number", "if", "(", "/", "\\d$", "/", ".", "test", "(", "sLastCodeChar", ")", ")", "{", "// Check whether parse string starts with the matched code", "if", "(", "sValue", ".", "startsWith", "(", "oMatch", ".", "code", ")", ")", "{", "iDelimiterPos", "=", "iLastCodeIndex", "+", "1", ";", "// \\s matching any whitespace character including", "// non-breaking ws and invisible non-breaking ws", "if", "(", "!", "rValidDelimiters", ".", "test", "(", "sValue", ".", "charAt", "(", "iDelimiterPos", ")", ")", ")", "{", "return", "undefined", ";", "}", "}", "// Check whether first character of matched code is a number", "}", "else", "if", "(", "/", "^\\d", "/", ".", "test", "(", "oMatch", ".", "code", ")", ")", "{", "// Check whether parse string ends with the matched code", "if", "(", "sValue", ".", "endsWith", "(", "oMatch", ".", "code", ")", ")", "{", "iDelimiterPos", "=", "sValue", ".", "indexOf", "(", "oMatch", ".", "code", ")", "-", "1", ";", "if", "(", "!", "rValidDelimiters", ".", "test", "(", "sValue", ".", "charAt", "(", "iDelimiterPos", ")", ")", ")", "{", "return", "undefined", ";", "}", "}", "}", "sValue", "=", "sValue", ".", "replace", "(", "oMatch", ".", "symbol", "||", "oMatch", ".", "code", ",", "\"\"", ")", ";", "}", "// Set currency code to undefined, as the defined custom currencies", "// contain multiple currencies having the same symbol.", "if", "(", "oConfig", ".", "duplicatedSymbols", "&&", "oConfig", ".", "duplicatedSymbols", "[", "oMatch", ".", "symbol", "]", ")", "{", "oMatch", ".", "code", "=", "undefined", ";", "Log", ".", "error", "(", "\"The parsed currency symbol '\"", "+", "oMatch", ".", "symbol", "+", "\"' is defined multiple \"", "+", "\"times in custom currencies.Therefore the result is not distinct.\"", ")", ";", "}", "return", "{", "numberValue", ":", "sValue", ",", "currencyCode", ":", "oMatch", ".", "code", "||", "undefined", "}", ";", "}" ]
Parses number and currency Search for the currency symbol first, looking for the longest match. In case no currency symbol is found, search for a three letter currency code. @param {object} oConfig @param {string} oConfig.value the string value to be parse @param {object} oConfig.currencySymbols the list of currency symbols to respect during parsing @param {object} oConfig.customCurrencyCodes the list of currency codes used for parsing in case no symbol was found in the value string @param {object} oConfig.duplicatedSymbols a list of all duplicated symbols; In case oFormatOptions.currencyCode is set to false and the value string contains a duplicated symbol, the value is not parsable. The result will be a parsed number and <code>undefined</code> for the currency. @param {boolean} oConfig.customCurrenciesAvailable a flag to mark if custom currencies are available on the instance @private @return {object} returns object containing numberValue and currencyCode or null
[ "Parses", "number", "and", "currency" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/format/NumberFormat.js#L2001-L2064
4,211
SAP/openui5
src/sap.ui.core/src/sap/ui/core/support/ToolsAPI.js
_getLibraries
function _getLibraries() { var libraries = Global.versioninfo ? Global.versioninfo.libraries : undefined; var formattedLibraries = Object.create(null); if (libraries !== undefined) { libraries.forEach(function (element, index, array) { formattedLibraries[element.name] = element.version; }); } return formattedLibraries; }
javascript
function _getLibraries() { var libraries = Global.versioninfo ? Global.versioninfo.libraries : undefined; var formattedLibraries = Object.create(null); if (libraries !== undefined) { libraries.forEach(function (element, index, array) { formattedLibraries[element.name] = element.version; }); } return formattedLibraries; }
[ "function", "_getLibraries", "(", ")", "{", "var", "libraries", "=", "Global", ".", "versioninfo", "?", "Global", ".", "versioninfo", ".", "libraries", ":", "undefined", ";", "var", "formattedLibraries", "=", "Object", ".", "create", "(", "null", ")", ";", "if", "(", "libraries", "!==", "undefined", ")", "{", "libraries", ".", "forEach", "(", "function", "(", "element", ",", "index", ",", "array", ")", "{", "formattedLibraries", "[", "element", ".", "name", "]", "=", "element", ".", "version", ";", "}", ")", ";", "}", "return", "formattedLibraries", ";", "}" ]
Creates an object with the libraries and their version from the version info file. @returns {Object} @private
[ "Creates", "an", "object", "with", "the", "libraries", "and", "their", "version", "from", "the", "version", "info", "file", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/support/ToolsAPI.js#L59-L70
4,212
SAP/openui5
src/sap.ui.core/src/sap/ui/core/support/ToolsAPI.js
_getLoadedLibraries
function _getLoadedLibraries() { var libraries = sap.ui.getCore().getLoadedLibraries(); var formattedLibraries = Object.create(null); Object.keys(sap.ui.getCore().getLoadedLibraries()).forEach(function (element, index, array) { formattedLibraries[element] = libraries[element].version; }); return formattedLibraries; }
javascript
function _getLoadedLibraries() { var libraries = sap.ui.getCore().getLoadedLibraries(); var formattedLibraries = Object.create(null); Object.keys(sap.ui.getCore().getLoadedLibraries()).forEach(function (element, index, array) { formattedLibraries[element] = libraries[element].version; }); return formattedLibraries; }
[ "function", "_getLoadedLibraries", "(", ")", "{", "var", "libraries", "=", "sap", ".", "ui", ".", "getCore", "(", ")", ".", "getLoadedLibraries", "(", ")", ";", "var", "formattedLibraries", "=", "Object", ".", "create", "(", "null", ")", ";", "Object", ".", "keys", "(", "sap", ".", "ui", ".", "getCore", "(", ")", ".", "getLoadedLibraries", "(", ")", ")", ".", "forEach", "(", "function", "(", "element", ",", "index", ",", "array", ")", "{", "formattedLibraries", "[", "element", "]", "=", "libraries", "[", "element", "]", ".", "version", ";", "}", ")", ";", "return", "formattedLibraries", ";", "}" ]
Creates an object with the loaded libraries and their version. @returns {Object} @private
[ "Creates", "an", "object", "with", "the", "loaded", "libraries", "and", "their", "version", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/support/ToolsAPI.js#L77-L86
4,213
SAP/openui5
src/sap.ui.core/src/sap/ui/core/support/ToolsAPI.js
_getFrameworkInformation
function _getFrameworkInformation() { return { commonInformation: { frameworkName: _getFrameworkName(), version: Global.version, buildTime: Global.buildinfo.buildtime, lastChange: Global.buildinfo.lastchange, jquery: jQuery.fn.jquery, userAgent: navigator.userAgent, applicationHREF: window.location.href, documentTitle: document.title, documentMode: document.documentMode || '', debugMode: jQuery.sap.debug(), statistics: jQuery.sap.statistics() }, configurationBootstrap: window['sap-ui-config'] || Object.create(null), configurationComputed: { theme: configurationInfo.getTheme(), language: configurationInfo.getLanguage(), formatLocale: configurationInfo.getFormatLocale(), accessibility: configurationInfo.getAccessibility(), animation: configurationInfo.getAnimation(), rtl: configurationInfo.getRTL(), debug: configurationInfo.getDebug(), inspect: configurationInfo.getInspect(), originInfo: configurationInfo.getOriginInfo(), noDuplicateIds: configurationInfo.getNoDuplicateIds() }, libraries: _getLibraries(), loadedLibraries: _getLoadedLibraries(), loadedModules: LoaderExtensions.getAllRequiredModules().sort(), URLParameters: new UriParameters(window.location.href).mParams }; }
javascript
function _getFrameworkInformation() { return { commonInformation: { frameworkName: _getFrameworkName(), version: Global.version, buildTime: Global.buildinfo.buildtime, lastChange: Global.buildinfo.lastchange, jquery: jQuery.fn.jquery, userAgent: navigator.userAgent, applicationHREF: window.location.href, documentTitle: document.title, documentMode: document.documentMode || '', debugMode: jQuery.sap.debug(), statistics: jQuery.sap.statistics() }, configurationBootstrap: window['sap-ui-config'] || Object.create(null), configurationComputed: { theme: configurationInfo.getTheme(), language: configurationInfo.getLanguage(), formatLocale: configurationInfo.getFormatLocale(), accessibility: configurationInfo.getAccessibility(), animation: configurationInfo.getAnimation(), rtl: configurationInfo.getRTL(), debug: configurationInfo.getDebug(), inspect: configurationInfo.getInspect(), originInfo: configurationInfo.getOriginInfo(), noDuplicateIds: configurationInfo.getNoDuplicateIds() }, libraries: _getLibraries(), loadedLibraries: _getLoadedLibraries(), loadedModules: LoaderExtensions.getAllRequiredModules().sort(), URLParameters: new UriParameters(window.location.href).mParams }; }
[ "function", "_getFrameworkInformation", "(", ")", "{", "return", "{", "commonInformation", ":", "{", "frameworkName", ":", "_getFrameworkName", "(", ")", ",", "version", ":", "Global", ".", "version", ",", "buildTime", ":", "Global", ".", "buildinfo", ".", "buildtime", ",", "lastChange", ":", "Global", ".", "buildinfo", ".", "lastchange", ",", "jquery", ":", "jQuery", ".", "fn", ".", "jquery", ",", "userAgent", ":", "navigator", ".", "userAgent", ",", "applicationHREF", ":", "window", ".", "location", ".", "href", ",", "documentTitle", ":", "document", ".", "title", ",", "documentMode", ":", "document", ".", "documentMode", "||", "''", ",", "debugMode", ":", "jQuery", ".", "sap", ".", "debug", "(", ")", ",", "statistics", ":", "jQuery", ".", "sap", ".", "statistics", "(", ")", "}", ",", "configurationBootstrap", ":", "window", "[", "'sap-ui-config'", "]", "||", "Object", ".", "create", "(", "null", ")", ",", "configurationComputed", ":", "{", "theme", ":", "configurationInfo", ".", "getTheme", "(", ")", ",", "language", ":", "configurationInfo", ".", "getLanguage", "(", ")", ",", "formatLocale", ":", "configurationInfo", ".", "getFormatLocale", "(", ")", ",", "accessibility", ":", "configurationInfo", ".", "getAccessibility", "(", ")", ",", "animation", ":", "configurationInfo", ".", "getAnimation", "(", ")", ",", "rtl", ":", "configurationInfo", ".", "getRTL", "(", ")", ",", "debug", ":", "configurationInfo", ".", "getDebug", "(", ")", ",", "inspect", ":", "configurationInfo", ".", "getInspect", "(", ")", ",", "originInfo", ":", "configurationInfo", ".", "getOriginInfo", "(", ")", ",", "noDuplicateIds", ":", "configurationInfo", ".", "getNoDuplicateIds", "(", ")", "}", ",", "libraries", ":", "_getLibraries", "(", ")", ",", "loadedLibraries", ":", "_getLoadedLibraries", "(", ")", ",", "loadedModules", ":", "LoaderExtensions", ".", "getAllRequiredModules", "(", ")", ".", "sort", "(", ")", ",", "URLParameters", ":", "new", "UriParameters", "(", "window", ".", "location", ".", "href", ")", ".", "mParams", "}", ";", "}" ]
Gets all the relevant information for the framework. @returns {Object} @private
[ "Gets", "all", "the", "relevant", "information", "for", "the", "framework", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/support/ToolsAPI.js#L93-L132
4,214
SAP/openui5
src/sap.ui.core/src/sap/ui/core/support/ToolsAPI.js
function (nodeElement, resultArray) { var node = nodeElement; var childNode = node.firstElementChild; var results = resultArray; var subResult = results; var control = sap.ui.getCore().byId(node.id); if (node.getAttribute('data-sap-ui') && control) { results.push({ id: control.getId(), name: control.getMetadata().getName(), type: 'sap-ui-control', content: [] }); subResult = results[results.length - 1].content; } else if (node.getAttribute('data-sap-ui-area')) { results.push({ id: node.id, name: 'sap-ui-area', type: 'data-sap-ui', content: [] }); subResult = results[results.length - 1].content; } while (childNode) { this._createRenderedTreeModel(childNode, subResult); childNode = childNode.nextElementSibling; } }
javascript
function (nodeElement, resultArray) { var node = nodeElement; var childNode = node.firstElementChild; var results = resultArray; var subResult = results; var control = sap.ui.getCore().byId(node.id); if (node.getAttribute('data-sap-ui') && control) { results.push({ id: control.getId(), name: control.getMetadata().getName(), type: 'sap-ui-control', content: [] }); subResult = results[results.length - 1].content; } else if (node.getAttribute('data-sap-ui-area')) { results.push({ id: node.id, name: 'sap-ui-area', type: 'data-sap-ui', content: [] }); subResult = results[results.length - 1].content; } while (childNode) { this._createRenderedTreeModel(childNode, subResult); childNode = childNode.nextElementSibling; } }
[ "function", "(", "nodeElement", ",", "resultArray", ")", "{", "var", "node", "=", "nodeElement", ";", "var", "childNode", "=", "node", ".", "firstElementChild", ";", "var", "results", "=", "resultArray", ";", "var", "subResult", "=", "results", ";", "var", "control", "=", "sap", ".", "ui", ".", "getCore", "(", ")", ".", "byId", "(", "node", ".", "id", ")", ";", "if", "(", "node", ".", "getAttribute", "(", "'data-sap-ui'", ")", "&&", "control", ")", "{", "results", ".", "push", "(", "{", "id", ":", "control", ".", "getId", "(", ")", ",", "name", ":", "control", ".", "getMetadata", "(", ")", ".", "getName", "(", ")", ",", "type", ":", "'sap-ui-control'", ",", "content", ":", "[", "]", "}", ")", ";", "subResult", "=", "results", "[", "results", ".", "length", "-", "1", "]", ".", "content", ";", "}", "else", "if", "(", "node", ".", "getAttribute", "(", "'data-sap-ui-area'", ")", ")", "{", "results", ".", "push", "(", "{", "id", ":", "node", ".", "id", ",", "name", ":", "'sap-ui-area'", ",", "type", ":", "'data-sap-ui'", ",", "content", ":", "[", "]", "}", ")", ";", "subResult", "=", "results", "[", "results", ".", "length", "-", "1", "]", ".", "content", ";", "}", "while", "(", "childNode", ")", "{", "this", ".", "_createRenderedTreeModel", "(", "childNode", ",", "subResult", ")", ";", "childNode", "=", "childNode", ".", "nextElementSibling", ";", "}", "}" ]
Creates data model of the rendered controls as a tree. @param {Element} nodeElement - HTML DOM element from which the function will star searching. @param {Array} resultArray - Array that will contains all the information. @private
[ "Creates", "data", "model", "of", "the", "rendered", "controls", "as", "a", "tree", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/support/ToolsAPI.js#L148-L179
4,215
SAP/openui5
src/sap.ui.core/src/sap/ui/core/support/ToolsAPI.js
function (control, inheritedMetadata) { var inheritedMetadataProperties = inheritedMetadata.getProperties(); var result = Object.create(null); result.meta = Object.create(null); result.meta.controlName = inheritedMetadata.getName(); result.properties = Object.create(null); Object.keys(inheritedMetadataProperties).forEach(function (key) { result.properties[key] = Object.create(null); result.properties[key].value = inheritedMetadataProperties[key].get(control); result.properties[key].type = inheritedMetadataProperties[key].getType().getName ? inheritedMetadataProperties[key].getType().getName() : ''; }); return result; }
javascript
function (control, inheritedMetadata) { var inheritedMetadataProperties = inheritedMetadata.getProperties(); var result = Object.create(null); result.meta = Object.create(null); result.meta.controlName = inheritedMetadata.getName(); result.properties = Object.create(null); Object.keys(inheritedMetadataProperties).forEach(function (key) { result.properties[key] = Object.create(null); result.properties[key].value = inheritedMetadataProperties[key].get(control); result.properties[key].type = inheritedMetadataProperties[key].getType().getName ? inheritedMetadataProperties[key].getType().getName() : ''; }); return result; }
[ "function", "(", "control", ",", "inheritedMetadata", ")", "{", "var", "inheritedMetadataProperties", "=", "inheritedMetadata", ".", "getProperties", "(", ")", ";", "var", "result", "=", "Object", ".", "create", "(", "null", ")", ";", "result", ".", "meta", "=", "Object", ".", "create", "(", "null", ")", ";", "result", ".", "meta", ".", "controlName", "=", "inheritedMetadata", ".", "getName", "(", ")", ";", "result", ".", "properties", "=", "Object", ".", "create", "(", "null", ")", ";", "Object", ".", "keys", "(", "inheritedMetadataProperties", ")", ".", "forEach", "(", "function", "(", "key", ")", "{", "result", ".", "properties", "[", "key", "]", "=", "Object", ".", "create", "(", "null", ")", ";", "result", ".", "properties", "[", "key", "]", ".", "value", "=", "inheritedMetadataProperties", "[", "key", "]", ".", "get", "(", "control", ")", ";", "result", ".", "properties", "[", "key", "]", ".", "type", "=", "inheritedMetadataProperties", "[", "key", "]", ".", "getType", "(", ")", ".", "getName", "?", "inheritedMetadataProperties", "[", "key", "]", ".", "getType", "(", ")", ".", "getName", "(", ")", ":", "''", ";", "}", ")", ";", "return", "result", ";", "}" ]
Copies the inherited properties of a UI5 control from the metadata. @param {Object} control - UI5 Control. @param {Object} inheritedMetadata - UI5 control metadata. @returns {Object} @private
[ "Copies", "the", "inherited", "properties", "of", "a", "UI5", "control", "from", "the", "metadata", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/support/ToolsAPI.js#L224-L239
4,216
SAP/openui5
src/sap.ui.core/src/sap/ui/core/support/ToolsAPI.js
function (control) { var result = []; var inheritedMetadata = control.getMetadata().getParent(); while (inheritedMetadata instanceof ElementMetadata) { result.push(this._copyInheritedProperties(control, inheritedMetadata)); inheritedMetadata = inheritedMetadata.getParent(); } return result; }
javascript
function (control) { var result = []; var inheritedMetadata = control.getMetadata().getParent(); while (inheritedMetadata instanceof ElementMetadata) { result.push(this._copyInheritedProperties(control, inheritedMetadata)); inheritedMetadata = inheritedMetadata.getParent(); } return result; }
[ "function", "(", "control", ")", "{", "var", "result", "=", "[", "]", ";", "var", "inheritedMetadata", "=", "control", ".", "getMetadata", "(", ")", ".", "getParent", "(", ")", ";", "while", "(", "inheritedMetadata", "instanceof", "ElementMetadata", ")", "{", "result", ".", "push", "(", "this", ".", "_copyInheritedProperties", "(", "control", ",", "inheritedMetadata", ")", ")", ";", "inheritedMetadata", "=", "inheritedMetadata", ".", "getParent", "(", ")", ";", "}", "return", "result", ";", "}" ]
Creates an array with the control properties that are inherited. @param {Object} control - UI5 control. @returns {Array} @private
[ "Creates", "an", "array", "with", "the", "control", "properties", "that", "are", "inherited", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/support/ToolsAPI.js#L247-L257
4,217
SAP/openui5
src/sap.ui.core/src/sap/ui/core/support/ToolsAPI.js
function (controlId) { var control = sap.ui.getCore().byId(controlId); var properties = Object.create(null); if (control) { properties.own = this._getOwnProperties(control); properties.inherited = this._getInheritedProperties(control); } return properties; }
javascript
function (controlId) { var control = sap.ui.getCore().byId(controlId); var properties = Object.create(null); if (control) { properties.own = this._getOwnProperties(control); properties.inherited = this._getInheritedProperties(control); } return properties; }
[ "function", "(", "controlId", ")", "{", "var", "control", "=", "sap", ".", "ui", ".", "getCore", "(", ")", ".", "byId", "(", "controlId", ")", ";", "var", "properties", "=", "Object", ".", "create", "(", "null", ")", ";", "if", "(", "control", ")", "{", "properties", ".", "own", "=", "this", ".", "_getOwnProperties", "(", "control", ")", ";", "properties", ".", "inherited", "=", "this", ".", "_getInheritedProperties", "(", "control", ")", ";", "}", "return", "properties", ";", "}" ]
Creates an object with all control properties. @param {string} controlId @returns {Object} @private
[ "Creates", "an", "object", "with", "all", "control", "properties", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/support/ToolsAPI.js#L265-L275
4,218
SAP/openui5
src/sap.ui.core/src/sap/ui/core/support/ToolsAPI.js
function (control) { var properties = control.getMetadata().getAllProperties(); var propertiesBindingData = Object.create(null); for (var key in properties) { if (properties.hasOwnProperty(key) && control.getBinding(key)) { propertiesBindingData[key] = Object.create(null); propertiesBindingData[key].path = control.getBinding(key).getPath(); propertiesBindingData[key].value = control.getBinding(key).getValue(); propertiesBindingData[key].type = control.getMetadata().getProperty(key).getType().getName ? control.getMetadata().getProperty(key).getType().getName() : ''; propertiesBindingData[key].mode = control.getBinding(key).getBindingMode(); propertiesBindingData[key].model = this._getModelFromContext(control, key); } } return propertiesBindingData; }
javascript
function (control) { var properties = control.getMetadata().getAllProperties(); var propertiesBindingData = Object.create(null); for (var key in properties) { if (properties.hasOwnProperty(key) && control.getBinding(key)) { propertiesBindingData[key] = Object.create(null); propertiesBindingData[key].path = control.getBinding(key).getPath(); propertiesBindingData[key].value = control.getBinding(key).getValue(); propertiesBindingData[key].type = control.getMetadata().getProperty(key).getType().getName ? control.getMetadata().getProperty(key).getType().getName() : ''; propertiesBindingData[key].mode = control.getBinding(key).getBindingMode(); propertiesBindingData[key].model = this._getModelFromContext(control, key); } } return propertiesBindingData; }
[ "function", "(", "control", ")", "{", "var", "properties", "=", "control", ".", "getMetadata", "(", ")", ".", "getAllProperties", "(", ")", ";", "var", "propertiesBindingData", "=", "Object", ".", "create", "(", "null", ")", ";", "for", "(", "var", "key", "in", "properties", ")", "{", "if", "(", "properties", ".", "hasOwnProperty", "(", "key", ")", "&&", "control", ".", "getBinding", "(", "key", ")", ")", "{", "propertiesBindingData", "[", "key", "]", "=", "Object", ".", "create", "(", "null", ")", ";", "propertiesBindingData", "[", "key", "]", ".", "path", "=", "control", ".", "getBinding", "(", "key", ")", ".", "getPath", "(", ")", ";", "propertiesBindingData", "[", "key", "]", ".", "value", "=", "control", ".", "getBinding", "(", "key", ")", ".", "getValue", "(", ")", ";", "propertiesBindingData", "[", "key", "]", ".", "type", "=", "control", ".", "getMetadata", "(", ")", ".", "getProperty", "(", "key", ")", ".", "getType", "(", ")", ".", "getName", "?", "control", ".", "getMetadata", "(", ")", ".", "getProperty", "(", "key", ")", ".", "getType", "(", ")", ".", "getName", "(", ")", ":", "''", ";", "propertiesBindingData", "[", "key", "]", ".", "mode", "=", "control", ".", "getBinding", "(", "key", ")", ".", "getBindingMode", "(", ")", ";", "propertiesBindingData", "[", "key", "]", ".", "model", "=", "this", ".", "_getModelFromContext", "(", "control", ",", "key", ")", ";", "}", "}", "return", "propertiesBindingData", ";", "}" ]
Creates an object with the properties bindings of a UI5 control. @param {Object} control @returns {Object} @private
[ "Creates", "an", "object", "with", "the", "properties", "bindings", "of", "a", "UI5", "control", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/support/ToolsAPI.js#L317-L333
4,219
SAP/openui5
src/sap.ui.core/src/sap/ui/core/support/ToolsAPI.js
function (control) { var aggregations = control.getMetadata().getAllAggregations(); var aggregationsBindingData = Object.create(null); for (var key in aggregations) { if (aggregations.hasOwnProperty(key) && control.getBinding(key)) { aggregationsBindingData[key] = Object.create(null); aggregationsBindingData[key].model = this._getModelFromContext(control, key); } } return aggregationsBindingData; }
javascript
function (control) { var aggregations = control.getMetadata().getAllAggregations(); var aggregationsBindingData = Object.create(null); for (var key in aggregations) { if (aggregations.hasOwnProperty(key) && control.getBinding(key)) { aggregationsBindingData[key] = Object.create(null); aggregationsBindingData[key].model = this._getModelFromContext(control, key); } } return aggregationsBindingData; }
[ "function", "(", "control", ")", "{", "var", "aggregations", "=", "control", ".", "getMetadata", "(", ")", ".", "getAllAggregations", "(", ")", ";", "var", "aggregationsBindingData", "=", "Object", ".", "create", "(", "null", ")", ";", "for", "(", "var", "key", "in", "aggregations", ")", "{", "if", "(", "aggregations", ".", "hasOwnProperty", "(", "key", ")", "&&", "control", ".", "getBinding", "(", "key", ")", ")", "{", "aggregationsBindingData", "[", "key", "]", "=", "Object", ".", "create", "(", "null", ")", ";", "aggregationsBindingData", "[", "key", "]", ".", "model", "=", "this", ".", "_getModelFromContext", "(", "control", ",", "key", ")", ";", "}", "}", "return", "aggregationsBindingData", ";", "}" ]
Creates an object with the agregations bindings of a UI5 control. @param {Object} control @returns {Object} @private
[ "Creates", "an", "object", "with", "the", "agregations", "bindings", "of", "a", "UI5", "control", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/support/ToolsAPI.js#L341-L353
4,220
SAP/openui5
src/sap.ui.core/src/sap/ui/core/support/ToolsAPI.js
function (controlId) { var result = Object.create(null); var control = sap.ui.getCore().byId(controlId); var bindingContext; if (!control) { return result; } bindingContext = control.getBindingContext(); result.meta = Object.create(null); result.contextPath = bindingContext ? bindingContext.getPath() : null; result.aggregations = controlInformation._getBindDataForAggregations(control); result.properties = controlInformation._getBindDataForProperties(control); return result; }
javascript
function (controlId) { var result = Object.create(null); var control = sap.ui.getCore().byId(controlId); var bindingContext; if (!control) { return result; } bindingContext = control.getBindingContext(); result.meta = Object.create(null); result.contextPath = bindingContext ? bindingContext.getPath() : null; result.aggregations = controlInformation._getBindDataForAggregations(control); result.properties = controlInformation._getBindDataForProperties(control); return result; }
[ "function", "(", "controlId", ")", "{", "var", "result", "=", "Object", ".", "create", "(", "null", ")", ";", "var", "control", "=", "sap", ".", "ui", ".", "getCore", "(", ")", ".", "byId", "(", "controlId", ")", ";", "var", "bindingContext", ";", "if", "(", "!", "control", ")", "{", "return", "result", ";", "}", "bindingContext", "=", "control", ".", "getBindingContext", "(", ")", ";", "result", ".", "meta", "=", "Object", ".", "create", "(", "null", ")", ";", "result", ".", "contextPath", "=", "bindingContext", "?", "bindingContext", ".", "getPath", "(", ")", ":", "null", ";", "result", ".", "aggregations", "=", "controlInformation", ".", "_getBindDataForAggregations", "(", "control", ")", ";", "result", ".", "properties", "=", "controlInformation", ".", "_getBindDataForProperties", "(", "control", ")", ";", "return", "result", ";", "}" ]
Gets control binding information. @param {string} controlId @returns {Object}
[ "Gets", "control", "binding", "information", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/support/ToolsAPI.js#L397-L414
4,221
SAP/openui5
src/sap.ui.ux3/src/sap/ui/ux3/ToolPopup.js
function (context) { var that = context; assert(!!that, "No ToolPopup instance given for _fnGetInitialFocus"); // if there is an initial focus it was already set to the Popup onBeforeRendering if (!that._bFocusSet) { _fnGetNewFocusElement(that); } else { that._sInitialFocusId = that.oPopup._sInitialFocusId; } return that._sInitialFocusId; }
javascript
function (context) { var that = context; assert(!!that, "No ToolPopup instance given for _fnGetInitialFocus"); // if there is an initial focus it was already set to the Popup onBeforeRendering if (!that._bFocusSet) { _fnGetNewFocusElement(that); } else { that._sInitialFocusId = that.oPopup._sInitialFocusId; } return that._sInitialFocusId; }
[ "function", "(", "context", ")", "{", "var", "that", "=", "context", ";", "assert", "(", "!", "!", "that", ",", "\"No ToolPopup instance given for _fnGetInitialFocus\"", ")", ";", "// if there is an initial focus it was already set to the Popup onBeforeRendering", "if", "(", "!", "that", ".", "_bFocusSet", ")", "{", "_fnGetNewFocusElement", "(", "that", ")", ";", "}", "else", "{", "that", ".", "_sInitialFocusId", "=", "that", ".", "oPopup", ".", "_sInitialFocusId", ";", "}", "return", "that", ".", "_sInitialFocusId", ";", "}" ]
Checks if the ToolPopup already has a tabbable element. If not, it's checked whether the fake-element should be used or if there is an element that could be focused instead. @param {sap.ui.ux3.ToolPopup} context to get/set instance values @returns {string} _sInitialFocusId that has been determined here @private
[ "Checks", "if", "the", "ToolPopup", "already", "has", "a", "tabbable", "element", ".", "If", "not", "it", "s", "checked", "whether", "the", "fake", "-", "element", "should", "be", "used", "or", "if", "there", "is", "an", "element", "that", "could", "be", "focused", "instead", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.ux3/src/sap/ui/ux3/ToolPopup.js#L307-L319
4,222
SAP/openui5
src/sap.ui.ux3/src/sap/ui/ux3/ToolPopup.js
function (context) { var oElement; var oFocusControl; var that = context; var defaultFocusableElements = [that._mParameters.firstFocusable, that._mParameters.lastFocusable]; // jQuery custom selectors ":sapTabbable" var aTabbables = jQuery(":sapTabbable", that.$()).get(); // search the first tabbable element for (var i = 0; i < aTabbables.length; i++) { if (defaultFocusableElements.indexOf(aTabbables[i].id) === -1) { oElement = aTabbables[i]; break; } } // If a tabbable element is part of a control, focus the control instead // jQuery Plugin "control" oFocusControl = jQuery(oElement).control(); if (oFocusControl[0]) { var oFocusDomRef = oFocusControl[0].getFocusDomRef(); oElement = oFocusDomRef || oElement; } else { // if there is no tabbable element in the content use the first fake // element to set the focus to the toolpopup oElement = defaultFocusableElements[0] ? window.document.getElementById(defaultFocusableElements[0]) : null; } // oElement might not be available if this function is called during destroy if (oElement) { if (oElement) { oElement.focus(); } that._sInitialFocusId = oElement.id; } }
javascript
function (context) { var oElement; var oFocusControl; var that = context; var defaultFocusableElements = [that._mParameters.firstFocusable, that._mParameters.lastFocusable]; // jQuery custom selectors ":sapTabbable" var aTabbables = jQuery(":sapTabbable", that.$()).get(); // search the first tabbable element for (var i = 0; i < aTabbables.length; i++) { if (defaultFocusableElements.indexOf(aTabbables[i].id) === -1) { oElement = aTabbables[i]; break; } } // If a tabbable element is part of a control, focus the control instead // jQuery Plugin "control" oFocusControl = jQuery(oElement).control(); if (oFocusControl[0]) { var oFocusDomRef = oFocusControl[0].getFocusDomRef(); oElement = oFocusDomRef || oElement; } else { // if there is no tabbable element in the content use the first fake // element to set the focus to the toolpopup oElement = defaultFocusableElements[0] ? window.document.getElementById(defaultFocusableElements[0]) : null; } // oElement might not be available if this function is called during destroy if (oElement) { if (oElement) { oElement.focus(); } that._sInitialFocusId = oElement.id; } }
[ "function", "(", "context", ")", "{", "var", "oElement", ";", "var", "oFocusControl", ";", "var", "that", "=", "context", ";", "var", "defaultFocusableElements", "=", "[", "that", ".", "_mParameters", ".", "firstFocusable", ",", "that", ".", "_mParameters", ".", "lastFocusable", "]", ";", "// jQuery custom selectors \":sapTabbable\"", "var", "aTabbables", "=", "jQuery", "(", "\":sapTabbable\"", ",", "that", ".", "$", "(", ")", ")", ".", "get", "(", ")", ";", "// search the first tabbable element", "for", "(", "var", "i", "=", "0", ";", "i", "<", "aTabbables", ".", "length", ";", "i", "++", ")", "{", "if", "(", "defaultFocusableElements", ".", "indexOf", "(", "aTabbables", "[", "i", "]", ".", "id", ")", "===", "-", "1", ")", "{", "oElement", "=", "aTabbables", "[", "i", "]", ";", "break", ";", "}", "}", "// If a tabbable element is part of a control, focus the control instead", "// jQuery Plugin \"control\"", "oFocusControl", "=", "jQuery", "(", "oElement", ")", ".", "control", "(", ")", ";", "if", "(", "oFocusControl", "[", "0", "]", ")", "{", "var", "oFocusDomRef", "=", "oFocusControl", "[", "0", "]", ".", "getFocusDomRef", "(", ")", ";", "oElement", "=", "oFocusDomRef", "||", "oElement", ";", "}", "else", "{", "// if there is no tabbable element in the content use the first fake", "// element to set the focus to the toolpopup", "oElement", "=", "defaultFocusableElements", "[", "0", "]", "?", "window", ".", "document", ".", "getElementById", "(", "defaultFocusableElements", "[", "0", "]", ")", ":", "null", ";", "}", "// oElement might not be available if this function is called during destroy", "if", "(", "oElement", ")", "{", "if", "(", "oElement", ")", "{", "oElement", ".", "focus", "(", ")", ";", "}", "that", ".", "_sInitialFocusId", "=", "oElement", ".", "id", ";", "}", "}" ]
Determines the new element which will gain the focus. @param {sap.ui.ux3.ToolPopup} context to get/set instance values @private
[ "Determines", "the", "new", "element", "which", "will", "gain", "the", "focus", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.ux3/src/sap/ui/ux3/ToolPopup.js#L327-L362
4,223
SAP/openui5
src/sap.ui.ux3/src/sap/ui/ux3/ToolPopup.js
_fnGetFocusControlById
function _fnGetFocusControlById(oToolPopup, id) { var oControl, parent; if (!id) { return null; } oControl = sap.ui.getCore().byId(id); while (!oControl && oControl !== oToolPopup) { if (!id || !document.getElementById(id)) { return null; } parent = document.getElementById(id).parentNode; id = parent.id; oControl = sap.ui.getCore().byId(id); } return oControl; }
javascript
function _fnGetFocusControlById(oToolPopup, id) { var oControl, parent; if (!id) { return null; } oControl = sap.ui.getCore().byId(id); while (!oControl && oControl !== oToolPopup) { if (!id || !document.getElementById(id)) { return null; } parent = document.getElementById(id).parentNode; id = parent.id; oControl = sap.ui.getCore().byId(id); } return oControl; }
[ "function", "_fnGetFocusControlById", "(", "oToolPopup", ",", "id", ")", "{", "var", "oControl", ",", "parent", ";", "if", "(", "!", "id", ")", "{", "return", "null", ";", "}", "oControl", "=", "sap", ".", "ui", ".", "getCore", "(", ")", ".", "byId", "(", "id", ")", ";", "while", "(", "!", "oControl", "&&", "oControl", "!==", "oToolPopup", ")", "{", "if", "(", "!", "id", "||", "!", "document", ".", "getElementById", "(", "id", ")", ")", "{", "return", "null", ";", "}", "parent", "=", "document", ".", "getElementById", "(", "id", ")", ".", "parentNode", ";", "id", "=", "parent", ".", "id", ";", "oControl", "=", "sap", ".", "ui", ".", "getCore", "(", ")", ".", "byId", "(", "id", ")", ";", "}", "return", "oControl", ";", "}" ]
Returns a DOM element by its Id. @param {Number} id @returns {Element|sap.ui.core.Element|Object|sap.ui.core.tmpl.Template} @private
[ "Returns", "a", "DOM", "element", "by", "its", "Id", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.ux3/src/sap/ui/ux3/ToolPopup.js#L371-L390
4,224
SAP/openui5
src/sap.ui.ux3/src/sap/ui/ux3/ToolPopup.js
function (oThis) { if (!oThis.getOpener()) { var sId = ""; if (oThis.oPopup) { if (oThis.oPopup._oPosition.of instanceof sap.ui.core.Element) { sId = oThis.oPopup._oPosition.of.getId(); } else { if (oThis.oPopup._oPosition.of.length > 0) { sId = oThis.oPopup._oPosition.of[0].id; } else { sId = oThis.oPopup._oPosition.of.id; } } } if (sId !== "") { oThis.setAssociation("opener", sId, true); } else { Log.error("Neither an opener was set properly nor a corresponding one can be distinguished", "", "sap.ui.ux3.ToolPopup"); } } }
javascript
function (oThis) { if (!oThis.getOpener()) { var sId = ""; if (oThis.oPopup) { if (oThis.oPopup._oPosition.of instanceof sap.ui.core.Element) { sId = oThis.oPopup._oPosition.of.getId(); } else { if (oThis.oPopup._oPosition.of.length > 0) { sId = oThis.oPopup._oPosition.of[0].id; } else { sId = oThis.oPopup._oPosition.of.id; } } } if (sId !== "") { oThis.setAssociation("opener", sId, true); } else { Log.error("Neither an opener was set properly nor a corresponding one can be distinguished", "", "sap.ui.ux3.ToolPopup"); } } }
[ "function", "(", "oThis", ")", "{", "if", "(", "!", "oThis", ".", "getOpener", "(", ")", ")", "{", "var", "sId", "=", "\"\"", ";", "if", "(", "oThis", ".", "oPopup", ")", "{", "if", "(", "oThis", ".", "oPopup", ".", "_oPosition", ".", "of", "instanceof", "sap", ".", "ui", ".", "core", ".", "Element", ")", "{", "sId", "=", "oThis", ".", "oPopup", ".", "_oPosition", ".", "of", ".", "getId", "(", ")", ";", "}", "else", "{", "if", "(", "oThis", ".", "oPopup", ".", "_oPosition", ".", "of", ".", "length", ">", "0", ")", "{", "sId", "=", "oThis", ".", "oPopup", ".", "_oPosition", ".", "of", "[", "0", "]", ".", "id", ";", "}", "else", "{", "sId", "=", "oThis", ".", "oPopup", ".", "_oPosition", ".", "of", ".", "id", ";", "}", "}", "}", "if", "(", "sId", "!==", "\"\"", ")", "{", "oThis", ".", "setAssociation", "(", "\"opener\"", ",", "sId", ",", "true", ")", ";", "}", "else", "{", "Log", ".", "error", "(", "\"Neither an opener was set properly nor a corresponding one can be distinguished\"", ",", "\"\"", ",", "\"sap.ui.ux3.ToolPopup\"", ")", ";", "}", "}", "}" ]
Checks if an opener was set. If not, this functions tries to get the opener from the Popup. @private
[ "Checks", "if", "an", "opener", "was", "set", ".", "If", "not", "this", "functions", "tries", "to", "get", "the", "opener", "from", "the", "Popup", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.ux3/src/sap/ui/ux3/ToolPopup.js#L729-L750
4,225
SAP/openui5
src/sap.ui.ux3/src/sap/ui/ux3/ToolPopup.js
function (oThis) { var sParam = "sapUiUx3ToolPopupArrowWidth"; oThis.sArrowWidth = Parameters.get(sParam); oThis.iArrowWidth = parseInt(oThis.sArrowWidth); sParam = "sapUiUx3ToolPopupArrowHeight"; oThis.sArrowHeight = Parameters.get(sParam); oThis.iArrowHeight = parseInt(oThis.sArrowHeight); sParam = "sapUiUx3ToolPopupArrowRightMarginCorrection"; oThis.sArrowPadding = Parameters.get(sParam); oThis.iArrowPadding = parseInt(oThis.sArrowPadding); sParam = "sapUiUx3ToolPopupArrowRightMarginCorrectionInverted"; oThis.sArrowPaddingInverted = Parameters.get(sParam); oThis.iArrowPaddingInverted = parseInt(oThis.sArrowPaddingInverted); }
javascript
function (oThis) { var sParam = "sapUiUx3ToolPopupArrowWidth"; oThis.sArrowWidth = Parameters.get(sParam); oThis.iArrowWidth = parseInt(oThis.sArrowWidth); sParam = "sapUiUx3ToolPopupArrowHeight"; oThis.sArrowHeight = Parameters.get(sParam); oThis.iArrowHeight = parseInt(oThis.sArrowHeight); sParam = "sapUiUx3ToolPopupArrowRightMarginCorrection"; oThis.sArrowPadding = Parameters.get(sParam); oThis.iArrowPadding = parseInt(oThis.sArrowPadding); sParam = "sapUiUx3ToolPopupArrowRightMarginCorrectionInverted"; oThis.sArrowPaddingInverted = Parameters.get(sParam); oThis.iArrowPaddingInverted = parseInt(oThis.sArrowPaddingInverted); }
[ "function", "(", "oThis", ")", "{", "var", "sParam", "=", "\"sapUiUx3ToolPopupArrowWidth\"", ";", "oThis", ".", "sArrowWidth", "=", "Parameters", ".", "get", "(", "sParam", ")", ";", "oThis", ".", "iArrowWidth", "=", "parseInt", "(", "oThis", ".", "sArrowWidth", ")", ";", "sParam", "=", "\"sapUiUx3ToolPopupArrowHeight\"", ";", "oThis", ".", "sArrowHeight", "=", "Parameters", ".", "get", "(", "sParam", ")", ";", "oThis", ".", "iArrowHeight", "=", "parseInt", "(", "oThis", ".", "sArrowHeight", ")", ";", "sParam", "=", "\"sapUiUx3ToolPopupArrowRightMarginCorrection\"", ";", "oThis", ".", "sArrowPadding", "=", "Parameters", ".", "get", "(", "sParam", ")", ";", "oThis", ".", "iArrowPadding", "=", "parseInt", "(", "oThis", ".", "sArrowPadding", ")", ";", "sParam", "=", "\"sapUiUx3ToolPopupArrowRightMarginCorrectionInverted\"", ";", "oThis", ".", "sArrowPaddingInverted", "=", "Parameters", ".", "get", "(", "sParam", ")", ";", "oThis", ".", "iArrowPaddingInverted", "=", "parseInt", "(", "oThis", ".", "sArrowPaddingInverted", ")", ";", "}" ]
Sets the arrow dimensions. @param {sap.ui.ux3.ToolPopup} oThis The Toolpopup instnace @private
[ "Sets", "the", "arrow", "dimensions", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.ux3/src/sap/ui/ux3/ToolPopup.js#L758-L774
4,226
SAP/openui5
src/sap.ui.ux3/src/sap/ui/ux3/ToolPopup.js
function (oThis) { // do not mirror the arrow direction here in RTL mode, because otherwise the offset is calculated wrong // (Because the offset mirroring happens inside popup) // the arrow is later mirrored at the output... // this is the default case if no match was found var sDirection = "Left"; // if 'my' is not set check if it was previously set via 'setPosition' var my = oThis._my; var at = oThis._at; if (!my && oThis.oPopup) { my = oThis.oPopup._oPosition.my; } if (!at && oThis.oPopup) { at = oThis.oPopup._oPosition.at; } oThis._bHorizontalArrow = false; if (my && at) { var aMy = my.split(" "); var aAt = at.split(" "); // create a rule like "my:top|left at:left|top" var sRule = "my:" + aMy[0] + "|" + aMy[1]; sRule += " at:" + aAt[0] + "|" + aAt[1]; if (ToolPopup.ARROW_LEFT.exec(sRule)) { oThis._bHorizontalArrow = true; sDirection = "Left"; } else if (ToolPopup.ARROW_RIGHT.exec(sRule)) { oThis._bHorizontalArrow = true; sDirection = "Right"; } else if (ToolPopup.ARROW_UP.exec(sRule)) { sDirection = "Up"; } else if (ToolPopup.ARROW_DOWN.exec(sRule)) { sDirection = "Down"; } if (oThis.getDomRef() && oThis.isOpen()) { var $This = oThis.$(); // jQuery Plugin "rect" var oPopRect = $This.rect(); var $Opener = jQuery(document.getElementById(oThis.getOpener())); // jQuery Plugin "rect" var oOpenerRect = $Opener.rect(); if (oOpenerRect) { // check if the ToolPopup was positioned at another side relative to the opener due to any collision. if (oThis._bHorizontalArrow) { // left/right arrow var iPopRight = oPopRect.left + $This.outerWidth(true) + oThis.iArrowWidth; var iOpenerRight = oOpenerRect.left + $Opener.outerWidth(true); if (iPopRight <= iOpenerRight) { sDirection = "Right"; } else { sDirection = "Left"; } } else { // up/down arrow var iPopBottom = oPopRect.top + $This.outerHeight(true) + oThis.iArrowWidth; var iOpenerBottom = oOpenerRect.top + $Opener.outerHeight(true); if (iPopBottom <= iOpenerBottom) { sDirection = "Down"; } else { sDirection = "Up"; } } } } } return sDirection; }
javascript
function (oThis) { // do not mirror the arrow direction here in RTL mode, because otherwise the offset is calculated wrong // (Because the offset mirroring happens inside popup) // the arrow is later mirrored at the output... // this is the default case if no match was found var sDirection = "Left"; // if 'my' is not set check if it was previously set via 'setPosition' var my = oThis._my; var at = oThis._at; if (!my && oThis.oPopup) { my = oThis.oPopup._oPosition.my; } if (!at && oThis.oPopup) { at = oThis.oPopup._oPosition.at; } oThis._bHorizontalArrow = false; if (my && at) { var aMy = my.split(" "); var aAt = at.split(" "); // create a rule like "my:top|left at:left|top" var sRule = "my:" + aMy[0] + "|" + aMy[1]; sRule += " at:" + aAt[0] + "|" + aAt[1]; if (ToolPopup.ARROW_LEFT.exec(sRule)) { oThis._bHorizontalArrow = true; sDirection = "Left"; } else if (ToolPopup.ARROW_RIGHT.exec(sRule)) { oThis._bHorizontalArrow = true; sDirection = "Right"; } else if (ToolPopup.ARROW_UP.exec(sRule)) { sDirection = "Up"; } else if (ToolPopup.ARROW_DOWN.exec(sRule)) { sDirection = "Down"; } if (oThis.getDomRef() && oThis.isOpen()) { var $This = oThis.$(); // jQuery Plugin "rect" var oPopRect = $This.rect(); var $Opener = jQuery(document.getElementById(oThis.getOpener())); // jQuery Plugin "rect" var oOpenerRect = $Opener.rect(); if (oOpenerRect) { // check if the ToolPopup was positioned at another side relative to the opener due to any collision. if (oThis._bHorizontalArrow) { // left/right arrow var iPopRight = oPopRect.left + $This.outerWidth(true) + oThis.iArrowWidth; var iOpenerRight = oOpenerRect.left + $Opener.outerWidth(true); if (iPopRight <= iOpenerRight) { sDirection = "Right"; } else { sDirection = "Left"; } } else { // up/down arrow var iPopBottom = oPopRect.top + $This.outerHeight(true) + oThis.iArrowWidth; var iOpenerBottom = oOpenerRect.top + $Opener.outerHeight(true); if (iPopBottom <= iOpenerBottom) { sDirection = "Down"; } else { sDirection = "Up"; } } } } } return sDirection; }
[ "function", "(", "oThis", ")", "{", "// do not mirror the arrow direction here in RTL mode, because otherwise the offset is calculated wrong", "// (Because the offset mirroring happens inside popup)", "// the arrow is later mirrored at the output...", "// this is the default case if no match was found", "var", "sDirection", "=", "\"Left\"", ";", "// if 'my' is not set check if it was previously set via 'setPosition'", "var", "my", "=", "oThis", ".", "_my", ";", "var", "at", "=", "oThis", ".", "_at", ";", "if", "(", "!", "my", "&&", "oThis", ".", "oPopup", ")", "{", "my", "=", "oThis", ".", "oPopup", ".", "_oPosition", ".", "my", ";", "}", "if", "(", "!", "at", "&&", "oThis", ".", "oPopup", ")", "{", "at", "=", "oThis", ".", "oPopup", ".", "_oPosition", ".", "at", ";", "}", "oThis", ".", "_bHorizontalArrow", "=", "false", ";", "if", "(", "my", "&&", "at", ")", "{", "var", "aMy", "=", "my", ".", "split", "(", "\" \"", ")", ";", "var", "aAt", "=", "at", ".", "split", "(", "\" \"", ")", ";", "// create a rule like \"my:top|left at:left|top\"", "var", "sRule", "=", "\"my:\"", "+", "aMy", "[", "0", "]", "+", "\"|\"", "+", "aMy", "[", "1", "]", ";", "sRule", "+=", "\" at:\"", "+", "aAt", "[", "0", "]", "+", "\"|\"", "+", "aAt", "[", "1", "]", ";", "if", "(", "ToolPopup", ".", "ARROW_LEFT", ".", "exec", "(", "sRule", ")", ")", "{", "oThis", ".", "_bHorizontalArrow", "=", "true", ";", "sDirection", "=", "\"Left\"", ";", "}", "else", "if", "(", "ToolPopup", ".", "ARROW_RIGHT", ".", "exec", "(", "sRule", ")", ")", "{", "oThis", ".", "_bHorizontalArrow", "=", "true", ";", "sDirection", "=", "\"Right\"", ";", "}", "else", "if", "(", "ToolPopup", ".", "ARROW_UP", ".", "exec", "(", "sRule", ")", ")", "{", "sDirection", "=", "\"Up\"", ";", "}", "else", "if", "(", "ToolPopup", ".", "ARROW_DOWN", ".", "exec", "(", "sRule", ")", ")", "{", "sDirection", "=", "\"Down\"", ";", "}", "if", "(", "oThis", ".", "getDomRef", "(", ")", "&&", "oThis", ".", "isOpen", "(", ")", ")", "{", "var", "$This", "=", "oThis", ".", "$", "(", ")", ";", "// jQuery Plugin \"rect\"", "var", "oPopRect", "=", "$This", ".", "rect", "(", ")", ";", "var", "$Opener", "=", "jQuery", "(", "document", ".", "getElementById", "(", "oThis", ".", "getOpener", "(", ")", ")", ")", ";", "// jQuery Plugin \"rect\"", "var", "oOpenerRect", "=", "$Opener", ".", "rect", "(", ")", ";", "if", "(", "oOpenerRect", ")", "{", "// check if the ToolPopup was positioned at another side relative to the opener due to any collision.", "if", "(", "oThis", ".", "_bHorizontalArrow", ")", "{", "// left/right arrow", "var", "iPopRight", "=", "oPopRect", ".", "left", "+", "$This", ".", "outerWidth", "(", "true", ")", "+", "oThis", ".", "iArrowWidth", ";", "var", "iOpenerRight", "=", "oOpenerRect", ".", "left", "+", "$Opener", ".", "outerWidth", "(", "true", ")", ";", "if", "(", "iPopRight", "<=", "iOpenerRight", ")", "{", "sDirection", "=", "\"Right\"", ";", "}", "else", "{", "sDirection", "=", "\"Left\"", ";", "}", "}", "else", "{", "// up/down arrow", "var", "iPopBottom", "=", "oPopRect", ".", "top", "+", "$This", ".", "outerHeight", "(", "true", ")", "+", "oThis", ".", "iArrowWidth", ";", "var", "iOpenerBottom", "=", "oOpenerRect", ".", "top", "+", "$Opener", ".", "outerHeight", "(", "true", ")", ";", "if", "(", "iPopBottom", "<=", "iOpenerBottom", ")", "{", "sDirection", "=", "\"Down\"", ";", "}", "else", "{", "sDirection", "=", "\"Up\"", ";", "}", "}", "}", "}", "}", "return", "sDirection", ";", "}" ]
Calculates the desired arrow direction related to the set docking. This only works when "my" and "at" both use the jQuery-based docking which means they are strings like "begin top". @param {sap.ui.ux3.ToolPopup} oThis the instance of the ToolPopup @returns {string} with arrow's direction @private
[ "Calculates", "the", "desired", "arrow", "direction", "related", "to", "the", "set", "docking", ".", "This", "only", "works", "when", "my", "and", "at", "both", "use", "the", "jQuery", "-", "based", "docking", "which", "means", "they", "are", "strings", "like", "begin", "top", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.ux3/src/sap/ui/ux3/ToolPopup.js#L784-L861
4,227
SAP/openui5
src/sap.ui.core/src/sap/ui/core/tmpl/HandlebarsTemplate.js
function(rm, oControl) { // execute the template with the above options var sHTML = fnTemplate(oControl.getContext() || {}, { data: { renderManager: rm, rootControl: oControl, view: oView }, helpers: HandlebarsTemplate.RENDER_HELPERS }); // write the markup rm.write(sHTML); }
javascript
function(rm, oControl) { // execute the template with the above options var sHTML = fnTemplate(oControl.getContext() || {}, { data: { renderManager: rm, rootControl: oControl, view: oView }, helpers: HandlebarsTemplate.RENDER_HELPERS }); // write the markup rm.write(sHTML); }
[ "function", "(", "rm", ",", "oControl", ")", "{", "// execute the template with the above options", "var", "sHTML", "=", "fnTemplate", "(", "oControl", ".", "getContext", "(", ")", "||", "{", "}", ",", "{", "data", ":", "{", "renderManager", ":", "rm", ",", "rootControl", ":", "oControl", ",", "view", ":", "oView", "}", ",", "helpers", ":", "HandlebarsTemplate", ".", "RENDER_HELPERS", "}", ")", ";", "// write the markup", "rm", ".", "write", "(", "sHTML", ")", ";", "}" ]
create the renderer for the control
[ "create", "the", "renderer", "for", "the", "control" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/tmpl/HandlebarsTemplate.js#L606-L621
4,228
SAP/openui5
src/sap.f/src/sap/f/shellBar/ResponsiveHandler.js
function (oContext) { oControl = oContext; // Get and calculate padding's this._iREMSize = parseInt(jQuery("body").css("font-size")); this._iChildControlMargin = parseInt(Parameters.get("_sap_f_ShellBar_ChildMargin")); this._iDoubleChildControlMargin = this._iChildControlMargin * 2; this._iCoPilotWidth = parseInt(Parameters.get("_sap_f_ShellBar_CoPilotWidth")) + this._iDoubleChildControlMargin; this._iHalfCoPilotWidth = this._iCoPilotWidth / 2; // Delegate used to attach on ShellBar lifecycle events this._oDelegate = { onAfterRendering: this.onAfterRendering, onBeforeRendering: this.onBeforeRendering }; // Attach Event Delegates oControl.addDelegate(this._oDelegate, false, this); // Init resize handler method this._fnResize = this._resize; // Attach events oControl._oOverflowToolbar.attachEvent("_controlWidthChanged", this._handleResize, this); }
javascript
function (oContext) { oControl = oContext; // Get and calculate padding's this._iREMSize = parseInt(jQuery("body").css("font-size")); this._iChildControlMargin = parseInt(Parameters.get("_sap_f_ShellBar_ChildMargin")); this._iDoubleChildControlMargin = this._iChildControlMargin * 2; this._iCoPilotWidth = parseInt(Parameters.get("_sap_f_ShellBar_CoPilotWidth")) + this._iDoubleChildControlMargin; this._iHalfCoPilotWidth = this._iCoPilotWidth / 2; // Delegate used to attach on ShellBar lifecycle events this._oDelegate = { onAfterRendering: this.onAfterRendering, onBeforeRendering: this.onBeforeRendering }; // Attach Event Delegates oControl.addDelegate(this._oDelegate, false, this); // Init resize handler method this._fnResize = this._resize; // Attach events oControl._oOverflowToolbar.attachEvent("_controlWidthChanged", this._handleResize, this); }
[ "function", "(", "oContext", ")", "{", "oControl", "=", "oContext", ";", "// Get and calculate padding's", "this", ".", "_iREMSize", "=", "parseInt", "(", "jQuery", "(", "\"body\"", ")", ".", "css", "(", "\"font-size\"", ")", ")", ";", "this", ".", "_iChildControlMargin", "=", "parseInt", "(", "Parameters", ".", "get", "(", "\"_sap_f_ShellBar_ChildMargin\"", ")", ")", ";", "this", ".", "_iDoubleChildControlMargin", "=", "this", ".", "_iChildControlMargin", "*", "2", ";", "this", ".", "_iCoPilotWidth", "=", "parseInt", "(", "Parameters", ".", "get", "(", "\"_sap_f_ShellBar_CoPilotWidth\"", ")", ")", "+", "this", ".", "_iDoubleChildControlMargin", ";", "this", ".", "_iHalfCoPilotWidth", "=", "this", ".", "_iCoPilotWidth", "/", "2", ";", "// Delegate used to attach on ShellBar lifecycle events", "this", ".", "_oDelegate", "=", "{", "onAfterRendering", ":", "this", ".", "onAfterRendering", ",", "onBeforeRendering", ":", "this", ".", "onBeforeRendering", "}", ";", "// Attach Event Delegates", "oControl", ".", "addDelegate", "(", "this", ".", "_oDelegate", ",", "false", ",", "this", ")", ";", "// Init resize handler method", "this", ".", "_fnResize", "=", "this", ".", "_resize", ";", "// Attach events", "oControl", ".", "_oOverflowToolbar", ".", "attachEvent", "(", "\"_controlWidthChanged\"", ",", "this", ".", "_handleResize", ",", "this", ")", ";", "}" ]
Class taking care of the control responsive behaviour. @alias sap/f/shellBar/ResponsiveHandler @since 1.63 @private @property {object} oContext the context of the ShellBar control instance
[ "Class", "taking", "care", "of", "the", "control", "responsive", "behaviour", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.f/src/sap/f/shellBar/ResponsiveHandler.js#L29-L53
4,229
SAP/openui5
src/sap.ui.core/src/sap/ui/core/util/reflection/BaseTreeModifier.js
function (oSelector, oAppComponent, oView) { var sControlId = this.getControlIdBySelector(oSelector, oAppComponent); return this._byId(sControlId, oView); }
javascript
function (oSelector, oAppComponent, oView) { var sControlId = this.getControlIdBySelector(oSelector, oAppComponent); return this._byId(sControlId, oView); }
[ "function", "(", "oSelector", ",", "oAppComponent", ",", "oView", ")", "{", "var", "sControlId", "=", "this", ".", "getControlIdBySelector", "(", "oSelector", ",", "oAppComponent", ")", ";", "return", "this", ".", "_byId", "(", "sControlId", ",", "oView", ")", ";", "}" ]
Function determining the control targeted by the change. The function distinguishes between local IDs generated starting with 1.40 and the global IDs generated in previous versions. @param {object} oSelector - Target of a flexibility change @param {string} oSelector.id - ID of the control targeted by the change @param {boolean} oSelector.isLocalId - <code>true</code> if the ID within the selector is a local ID or a global ID @param {sap.ui.core.UIComponent} oAppComponent - Application component @param {Element} oView - For XML processing only: XML node of the view @returns {sap.ui.base.ManagedObject|Element} Control representation targeted within the selector @throws {Error} In case no control could be determined, an error is thrown @public
[ "Function", "determining", "the", "control", "targeted", "by", "the", "change", ".", "The", "function", "distinguishes", "between", "local", "IDs", "generated", "starting", "with", "1", ".", "40", "and", "the", "global", "IDs", "generated", "in", "previous", "versions", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/util/reflection/BaseTreeModifier.js#L50-L53
4,230
SAP/openui5
src/sap.ui.core/src/sap/ui/core/util/reflection/BaseTreeModifier.js
function (oSelector, oAppComponent) { if (!oSelector){ return undefined; } if (typeof oSelector === "string") { oSelector = { id: oSelector }; } var sControlId = oSelector.id; if (oSelector.idIsLocal) { if (oAppComponent) { sControlId = oAppComponent.createId(sControlId); } else { throw new Error("App Component instance needed to get a control's ID from selector"); } } else { // does nothing except in the case of a FLP prefix var pattern = /^application-[^-]*-[^-]*-component---/igm; var bHasFlpPrefix = !!pattern.exec(oSelector.id); if (bHasFlpPrefix) { sControlId = sControlId.replace(/^application-[^-]*-[^-]*-component---/g, ""); if (oAppComponent) { sControlId = oAppComponent.createId(sControlId); } else { throw new Error("App Component instance needed to get a control's ID from selector"); } } } return sControlId; }
javascript
function (oSelector, oAppComponent) { if (!oSelector){ return undefined; } if (typeof oSelector === "string") { oSelector = { id: oSelector }; } var sControlId = oSelector.id; if (oSelector.idIsLocal) { if (oAppComponent) { sControlId = oAppComponent.createId(sControlId); } else { throw new Error("App Component instance needed to get a control's ID from selector"); } } else { // does nothing except in the case of a FLP prefix var pattern = /^application-[^-]*-[^-]*-component---/igm; var bHasFlpPrefix = !!pattern.exec(oSelector.id); if (bHasFlpPrefix) { sControlId = sControlId.replace(/^application-[^-]*-[^-]*-component---/g, ""); if (oAppComponent) { sControlId = oAppComponent.createId(sControlId); } else { throw new Error("App Component instance needed to get a control's ID from selector"); } } } return sControlId; }
[ "function", "(", "oSelector", ",", "oAppComponent", ")", "{", "if", "(", "!", "oSelector", ")", "{", "return", "undefined", ";", "}", "if", "(", "typeof", "oSelector", "===", "\"string\"", ")", "{", "oSelector", "=", "{", "id", ":", "oSelector", "}", ";", "}", "var", "sControlId", "=", "oSelector", ".", "id", ";", "if", "(", "oSelector", ".", "idIsLocal", ")", "{", "if", "(", "oAppComponent", ")", "{", "sControlId", "=", "oAppComponent", ".", "createId", "(", "sControlId", ")", ";", "}", "else", "{", "throw", "new", "Error", "(", "\"App Component instance needed to get a control's ID from selector\"", ")", ";", "}", "}", "else", "{", "// does nothing except in the case of a FLP prefix", "var", "pattern", "=", "/", "^application-[^-]*-[^-]*-component---", "/", "igm", ";", "var", "bHasFlpPrefix", "=", "!", "!", "pattern", ".", "exec", "(", "oSelector", ".", "id", ")", ";", "if", "(", "bHasFlpPrefix", ")", "{", "sControlId", "=", "sControlId", ".", "replace", "(", "/", "^application-[^-]*-[^-]*-component---", "/", "g", ",", "\"\"", ")", ";", "if", "(", "oAppComponent", ")", "{", "sControlId", "=", "oAppComponent", ".", "createId", "(", "sControlId", ")", ";", "}", "else", "{", "throw", "new", "Error", "(", "\"App Component instance needed to get a control's ID from selector\"", ")", ";", "}", "}", "}", "return", "sControlId", ";", "}" ]
Function determining the control ID from the selector. The function distinguishes between local IDs generated starting with 1.40 and the global IDs generated in previous versions. @param {object} oSelector - Target of a flexiblity change @param {string} oSelector.id - ID of the control targeted by the change @param {boolean} oSelector.isLocalId - <code>true</code> if the ID within the selector is a local ID or a global ID @param {sap.ui.core.UIComponent} oAppComponent - Application component @returns {string} ID of the control @throws {Error} In case no control could be determined an error is thrown @protected
[ "Function", "determining", "the", "control", "ID", "from", "the", "selector", ".", "The", "function", "distinguishes", "between", "local", "IDs", "generated", "starting", "with", "1", ".", "40", "and", "the", "global", "IDs", "generated", "in", "previous", "versions", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/util/reflection/BaseTreeModifier.js#L65-L99
4,231
SAP/openui5
src/sap.ui.core/src/sap/ui/core/util/reflection/BaseTreeModifier.js
function (vControl, oAppComponent, mAdditionalSelectorInformation) { var sControlId = vControl; if (typeof sControlId !== "string") { sControlId = (vControl) ? this.getId(vControl) : undefined; } else if (!oAppComponent) { throw new Error("App Component instance needed to get a selector from string ID"); } if (mAdditionalSelectorInformation && (mAdditionalSelectorInformation.id || mAdditionalSelectorInformation.idIsLocal)) { throw new Error("A selector of control with the ID '" + sControlId + "' was requested, " + "but core properties were overwritten by the additionally passed information."); } var bValidId = this.checkControlId(sControlId, oAppComponent); if (!bValidId) { throw new Error("Generated ID attribute found - to offer flexibility a stable control ID is needed to assign the changes to, but for this control the ID was generated by SAPUI5 " + sControlId); } var oSelector = Object.assign({}, mAdditionalSelectorInformation, { id: "", idIsLocal: false }); if (this.hasLocalIdSuffix(sControlId, oAppComponent)) { // get local Id for control at root component and use it as selector ID var sLocalId = oAppComponent.getLocalId(sControlId); oSelector.id = sLocalId; oSelector.idIsLocal = true; } else { oSelector.id = sControlId; } return oSelector; }
javascript
function (vControl, oAppComponent, mAdditionalSelectorInformation) { var sControlId = vControl; if (typeof sControlId !== "string") { sControlId = (vControl) ? this.getId(vControl) : undefined; } else if (!oAppComponent) { throw new Error("App Component instance needed to get a selector from string ID"); } if (mAdditionalSelectorInformation && (mAdditionalSelectorInformation.id || mAdditionalSelectorInformation.idIsLocal)) { throw new Error("A selector of control with the ID '" + sControlId + "' was requested, " + "but core properties were overwritten by the additionally passed information."); } var bValidId = this.checkControlId(sControlId, oAppComponent); if (!bValidId) { throw new Error("Generated ID attribute found - to offer flexibility a stable control ID is needed to assign the changes to, but for this control the ID was generated by SAPUI5 " + sControlId); } var oSelector = Object.assign({}, mAdditionalSelectorInformation, { id: "", idIsLocal: false }); if (this.hasLocalIdSuffix(sControlId, oAppComponent)) { // get local Id for control at root component and use it as selector ID var sLocalId = oAppComponent.getLocalId(sControlId); oSelector.id = sLocalId; oSelector.idIsLocal = true; } else { oSelector.id = sControlId; } return oSelector; }
[ "function", "(", "vControl", ",", "oAppComponent", ",", "mAdditionalSelectorInformation", ")", "{", "var", "sControlId", "=", "vControl", ";", "if", "(", "typeof", "sControlId", "!==", "\"string\"", ")", "{", "sControlId", "=", "(", "vControl", ")", "?", "this", ".", "getId", "(", "vControl", ")", ":", "undefined", ";", "}", "else", "if", "(", "!", "oAppComponent", ")", "{", "throw", "new", "Error", "(", "\"App Component instance needed to get a selector from string ID\"", ")", ";", "}", "if", "(", "mAdditionalSelectorInformation", "&&", "(", "mAdditionalSelectorInformation", ".", "id", "||", "mAdditionalSelectorInformation", ".", "idIsLocal", ")", ")", "{", "throw", "new", "Error", "(", "\"A selector of control with the ID '\"", "+", "sControlId", "+", "\"' was requested, \"", "+", "\"but core properties were overwritten by the additionally passed information.\"", ")", ";", "}", "var", "bValidId", "=", "this", ".", "checkControlId", "(", "sControlId", ",", "oAppComponent", ")", ";", "if", "(", "!", "bValidId", ")", "{", "throw", "new", "Error", "(", "\"Generated ID attribute found - to offer flexibility a stable control ID is needed to assign the changes to, but for this control the ID was generated by SAPUI5 \"", "+", "sControlId", ")", ";", "}", "var", "oSelector", "=", "Object", ".", "assign", "(", "{", "}", ",", "mAdditionalSelectorInformation", ",", "{", "id", ":", "\"\"", ",", "idIsLocal", ":", "false", "}", ")", ";", "if", "(", "this", ".", "hasLocalIdSuffix", "(", "sControlId", ",", "oAppComponent", ")", ")", "{", "// get local Id for control at root component and use it as selector ID", "var", "sLocalId", "=", "oAppComponent", ".", "getLocalId", "(", "sControlId", ")", ";", "oSelector", ".", "id", "=", "sLocalId", ";", "oSelector", ".", "idIsLocal", "=", "true", ";", "}", "else", "{", "oSelector", ".", "id", "=", "sControlId", ";", "}", "return", "oSelector", ";", "}" ]
Function for determining the selector that is used later to apply a change for a given control. The function distinguishes between local IDs generated starting with 1.40 and the global IDs generated in previous versions. @param {sap.ui.base.ManagedObject|Element|string} vControl - Control or ID string for which the selector should be determined @param {sap.ui.core.Component} oAppComponent - Application component, needed only if vControl is a string or XML node @param {object} [mAdditionalSelectorInformation] - Additional mapped data which is added to the selector @returns {object} oSelector @returns {string} oSelector.id - ID used for determination of the flexibility target @returns {boolean} oSelector.idIsLocal - <code>true</code> if the selector.id has to be concatenated with the application component ID while applying the change @throws {Error} In case no control could be determined an error is thrown @public
[ "Function", "for", "determining", "the", "selector", "that", "is", "used", "later", "to", "apply", "a", "change", "for", "a", "given", "control", ".", "The", "function", "distinguishes", "between", "local", "IDs", "generated", "starting", "with", "1", ".", "40", "and", "the", "global", "IDs", "generated", "in", "previous", "versions", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/util/reflection/BaseTreeModifier.js#L114-L147
4,232
SAP/openui5
src/sap.ui.core/src/sap/ui/core/util/reflection/BaseTreeModifier.js
function (vControl, oAppComponent, bSuppressLogging) { var sControlId = vControl instanceof ManagedObject ? vControl.getId() : vControl; var bIsGenerated = ManagedObjectMetadata.isGeneratedId(sControlId); if (!bIsGenerated || this.hasLocalIdSuffix(vControl, oAppComponent)) { return true; } else { var sHasConcatenatedId = sControlId.indexOf("--") !== -1; if (!bSuppressLogging && !sHasConcatenatedId) { Log.warning("Control ID was generated dynamically by SAPUI5. To support SAPUI5 flexibility, a stable control ID is needed to assign the changes to.", sControlId); } return false; } }
javascript
function (vControl, oAppComponent, bSuppressLogging) { var sControlId = vControl instanceof ManagedObject ? vControl.getId() : vControl; var bIsGenerated = ManagedObjectMetadata.isGeneratedId(sControlId); if (!bIsGenerated || this.hasLocalIdSuffix(vControl, oAppComponent)) { return true; } else { var sHasConcatenatedId = sControlId.indexOf("--") !== -1; if (!bSuppressLogging && !sHasConcatenatedId) { Log.warning("Control ID was generated dynamically by SAPUI5. To support SAPUI5 flexibility, a stable control ID is needed to assign the changes to.", sControlId); } return false; } }
[ "function", "(", "vControl", ",", "oAppComponent", ",", "bSuppressLogging", ")", "{", "var", "sControlId", "=", "vControl", "instanceof", "ManagedObject", "?", "vControl", ".", "getId", "(", ")", ":", "vControl", ";", "var", "bIsGenerated", "=", "ManagedObjectMetadata", ".", "isGeneratedId", "(", "sControlId", ")", ";", "if", "(", "!", "bIsGenerated", "||", "this", ".", "hasLocalIdSuffix", "(", "vControl", ",", "oAppComponent", ")", ")", "{", "return", "true", ";", "}", "else", "{", "var", "sHasConcatenatedId", "=", "sControlId", ".", "indexOf", "(", "\"--\"", ")", "!==", "-", "1", ";", "if", "(", "!", "bSuppressLogging", "&&", "!", "sHasConcatenatedId", ")", "{", "Log", ".", "warning", "(", "\"Control ID was generated dynamically by SAPUI5. To support SAPUI5 flexibility, a stable control ID is needed to assign the changes to.\"", ",", "sControlId", ")", ";", "}", "return", "false", ";", "}", "}" ]
Checks if the control id is generated or maintained by the application. @param {sap.ui.core.Control|string} vControl - Control instance or ID @param {sap.ui.core.Component} oAppComponent - oAppComponent application component, needed only if vControl is a string (ID) @param {boolean} [bSuppressLogging] bSuppressLogging - Flag to suppress the warning in the console @returns {boolean} <code>true</code> if the ID is maintained by the application @protected
[ "Checks", "if", "the", "control", "id", "is", "generated", "or", "maintained", "by", "the", "application", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/util/reflection/BaseTreeModifier.js#L158-L173
4,233
SAP/openui5
src/sap.ui.core/src/sap/ui/core/util/reflection/BaseTreeModifier.js
function (vControl, oAppComponent) { var sControlId = (vControl instanceof ManagedObject) ? vControl.getId() : vControl; if (!oAppComponent) { Log.error("Determination of a local ID suffix failed due to missing app component for " + sControlId); return false; } return !!oAppComponent.getLocalId(sControlId); }
javascript
function (vControl, oAppComponent) { var sControlId = (vControl instanceof ManagedObject) ? vControl.getId() : vControl; if (!oAppComponent) { Log.error("Determination of a local ID suffix failed due to missing app component for " + sControlId); return false; } return !!oAppComponent.getLocalId(sControlId); }
[ "function", "(", "vControl", ",", "oAppComponent", ")", "{", "var", "sControlId", "=", "(", "vControl", "instanceof", "ManagedObject", ")", "?", "vControl", ".", "getId", "(", ")", ":", "vControl", ";", "if", "(", "!", "oAppComponent", ")", "{", "Log", ".", "error", "(", "\"Determination of a local ID suffix failed due to missing app component for \"", "+", "sControlId", ")", ";", "return", "false", ";", "}", "return", "!", "!", "oAppComponent", ".", "getLocalId", "(", "sControlId", ")", ";", "}" ]
Checks if a control ID has a prefix matching the application component. If this prefix exists, the suffix after the component ID is called the local ID. @param {sap.ui.core.Control|string} vControl - Control or ID to be checked if it is within the generic application @param {sap.ui.core.UIComponent} oAppComponent - Application component, needed only if vControl is string (ID) @returns {boolean} Whether control has a local ID @protected
[ "Checks", "if", "a", "control", "ID", "has", "a", "prefix", "matching", "the", "application", "component", ".", "If", "this", "prefix", "exists", "the", "suffix", "after", "the", "component", "ID", "is", "called", "the", "local", "ID", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/util/reflection/BaseTreeModifier.js#L184-L193
4,234
SAP/openui5
src/sap.ui.core/src/sap/ui/core/util/reflection/BaseTreeModifier.js
function(oFragment, sIdPrefix) { var oParseError = XMLHelper.getParseError(oFragment); if (oParseError.errorCode !== 0) { throw new Error(oFragment.parseError.reason); } var oControlNodes = oFragment.documentElement; var aRootChildren = [], aChildren = []; if (oControlNodes.localName === "FragmentDefinition") { aRootChildren = this._getElementNodeChildren(oControlNodes); } else { aRootChildren = [oControlNodes]; } aChildren = [].concat(aRootChildren); // get all children and their children function oCallback(oChild) { aChildren.push(oChild); } for (var i = 0, n = aRootChildren.length; i < n; i++) { this._traverseXmlTree(oCallback, aRootChildren[i]); } for (var j = 0, m = aChildren.length; j < m; j++) { // aChildren[j].id is not available in IE11, therefore using .getAttribute/.setAttribute if (aChildren[j].getAttribute("id")) { aChildren[j].setAttribute("id", sIdPrefix + "." + aChildren[j].getAttribute("id")); } else { throw new Error("At least one control does not have a stable ID"); } } return oControlNodes; }
javascript
function(oFragment, sIdPrefix) { var oParseError = XMLHelper.getParseError(oFragment); if (oParseError.errorCode !== 0) { throw new Error(oFragment.parseError.reason); } var oControlNodes = oFragment.documentElement; var aRootChildren = [], aChildren = []; if (oControlNodes.localName === "FragmentDefinition") { aRootChildren = this._getElementNodeChildren(oControlNodes); } else { aRootChildren = [oControlNodes]; } aChildren = [].concat(aRootChildren); // get all children and their children function oCallback(oChild) { aChildren.push(oChild); } for (var i = 0, n = aRootChildren.length; i < n; i++) { this._traverseXmlTree(oCallback, aRootChildren[i]); } for (var j = 0, m = aChildren.length; j < m; j++) { // aChildren[j].id is not available in IE11, therefore using .getAttribute/.setAttribute if (aChildren[j].getAttribute("id")) { aChildren[j].setAttribute("id", sIdPrefix + "." + aChildren[j].getAttribute("id")); } else { throw new Error("At least one control does not have a stable ID"); } } return oControlNodes; }
[ "function", "(", "oFragment", ",", "sIdPrefix", ")", "{", "var", "oParseError", "=", "XMLHelper", ".", "getParseError", "(", "oFragment", ")", ";", "if", "(", "oParseError", ".", "errorCode", "!==", "0", ")", "{", "throw", "new", "Error", "(", "oFragment", ".", "parseError", ".", "reason", ")", ";", "}", "var", "oControlNodes", "=", "oFragment", ".", "documentElement", ";", "var", "aRootChildren", "=", "[", "]", ",", "aChildren", "=", "[", "]", ";", "if", "(", "oControlNodes", ".", "localName", "===", "\"FragmentDefinition\"", ")", "{", "aRootChildren", "=", "this", ".", "_getElementNodeChildren", "(", "oControlNodes", ")", ";", "}", "else", "{", "aRootChildren", "=", "[", "oControlNodes", "]", ";", "}", "aChildren", "=", "[", "]", ".", "concat", "(", "aRootChildren", ")", ";", "// get all children and their children", "function", "oCallback", "(", "oChild", ")", "{", "aChildren", ".", "push", "(", "oChild", ")", ";", "}", "for", "(", "var", "i", "=", "0", ",", "n", "=", "aRootChildren", ".", "length", ";", "i", "<", "n", ";", "i", "++", ")", "{", "this", ".", "_traverseXmlTree", "(", "oCallback", ",", "aRootChildren", "[", "i", "]", ")", ";", "}", "for", "(", "var", "j", "=", "0", ",", "m", "=", "aChildren", ".", "length", ";", "j", "<", "m", ";", "j", "++", ")", "{", "// aChildren[j].id is not available in IE11, therefore using .getAttribute/.setAttribute", "if", "(", "aChildren", "[", "j", "]", ".", "getAttribute", "(", "\"id\"", ")", ")", "{", "aChildren", "[", "j", "]", ".", "setAttribute", "(", "\"id\"", ",", "sIdPrefix", "+", "\".\"", "+", "aChildren", "[", "j", "]", ".", "getAttribute", "(", "\"id\"", ")", ")", ";", "}", "else", "{", "throw", "new", "Error", "(", "\"At least one control does not have a stable ID\"", ")", ";", "}", "}", "return", "oControlNodes", ";", "}" ]
This function takes the fragment, goes through all the children and adds a prefix to the control's ID. Can also handle 'FragmentDefinition' as root node, then all the children's IDs are prefixed. Adds a '.' at the end of the prefix to separate it from the original ID. Throws an error if any one of the controls in the fragment have no ID specified. Aggregations will be ignored and don't need an ID. @param {Element} oFragment - Fragment in XML @param {string} sIdPrefix - String which will be used to prefix the IDs @returns {Element} Original fragment in XML with updated IDs
[ "This", "function", "takes", "the", "fragment", "goes", "through", "all", "the", "children", "and", "adds", "a", "prefix", "to", "the", "control", "s", "ID", ".", "Can", "also", "handle", "FragmentDefinition", "as", "root", "node", "then", "all", "the", "children", "s", "IDs", "are", "prefixed", ".", "Adds", "a", ".", "at", "the", "end", "of", "the", "prefix", "to", "separate", "it", "from", "the", "original", "ID", ".", "Throws", "an", "error", "if", "any", "one", "of", "the", "controls", "in", "the", "fragment", "have", "no", "ID", "specified", ".", "Aggregations", "will", "be", "ignored", "and", "don", "t", "need", "an", "ID", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/util/reflection/BaseTreeModifier.js#L206-L240
4,235
SAP/openui5
src/sap.ui.core/src/sap/ui/core/util/reflection/BaseTreeModifier.js
function(oNode) { var aChildren = []; var aNodes = oNode.childNodes; for (var i = 0, n = aNodes.length; i < n; i++) { if (aNodes[i].nodeType === 1) { aChildren.push(aNodes[i]); } } return aChildren; }
javascript
function(oNode) { var aChildren = []; var aNodes = oNode.childNodes; for (var i = 0, n = aNodes.length; i < n; i++) { if (aNodes[i].nodeType === 1) { aChildren.push(aNodes[i]); } } return aChildren; }
[ "function", "(", "oNode", ")", "{", "var", "aChildren", "=", "[", "]", ";", "var", "aNodes", "=", "oNode", ".", "childNodes", ";", "for", "(", "var", "i", "=", "0", ",", "n", "=", "aNodes", ".", "length", ";", "i", "<", "n", ";", "i", "++", ")", "{", "if", "(", "aNodes", "[", "i", "]", ".", "nodeType", "===", "1", ")", "{", "aChildren", ".", "push", "(", "aNodes", "[", "i", "]", ")", ";", "}", "}", "return", "aChildren", ";", "}" ]
Gets all the children of an XML Node that are element nodes. @param {Element} oNode - XML node @returns {Element[]} Array with the children of the node
[ "Gets", "all", "the", "children", "of", "an", "XML", "Node", "that", "are", "element", "nodes", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/util/reflection/BaseTreeModifier.js#L248-L257
4,236
SAP/openui5
src/sap.ui.core/src/sap/ui/core/util/reflection/BaseTreeModifier.js
function(oElement, sType) { var oInstance = ObjectPath.get(sType); if (typeof oInstance === "function") { return oElement instanceof oInstance; } else { return false; } }
javascript
function(oElement, sType) { var oInstance = ObjectPath.get(sType); if (typeof oInstance === "function") { return oElement instanceof oInstance; } else { return false; } }
[ "function", "(", "oElement", ",", "sType", ")", "{", "var", "oInstance", "=", "ObjectPath", ".", "get", "(", "sType", ")", ";", "if", "(", "typeof", "oInstance", "===", "\"function\"", ")", "{", "return", "oElement", "instanceof", "oInstance", ";", "}", "else", "{", "return", "false", ";", "}", "}" ]
Checks if the element is an instance of the type. @param {object} oElement - Element to be checked @param {string} sType - Type that the element should be checked against @returns {boolean} <code>true</code> if the element is an instance of the type
[ "Checks", "if", "the", "element", "is", "an", "instance", "of", "the", "type", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/util/reflection/BaseTreeModifier.js#L266-L273
4,237
SAP/openui5
src/sap.ui.core/src/sap/ui/core/util/reflection/BaseTreeModifier.js
function(oControl) { var sControlType = this._getControlTypeInXml(oControl); jQuery.sap.require(sControlType); var ControlType = ObjectPath.get(sControlType); return ControlType.getMetadata(); }
javascript
function(oControl) { var sControlType = this._getControlTypeInXml(oControl); jQuery.sap.require(sControlType); var ControlType = ObjectPath.get(sControlType); return ControlType.getMetadata(); }
[ "function", "(", "oControl", ")", "{", "var", "sControlType", "=", "this", ".", "_getControlTypeInXml", "(", "oControl", ")", ";", "jQuery", ".", "sap", ".", "require", "(", "sControlType", ")", ";", "var", "ControlType", "=", "ObjectPath", ".", "get", "(", "sControlType", ")", ";", "return", "ControlType", ".", "getMetadata", "(", ")", ";", "}" ]
Gets the metadata of am XML control. @param {Element} oControl - Control in XML @returns {sap.ui.base.Metadata} Metadata of the control
[ "Gets", "the", "metadata", "of", "am", "XML", "control", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/util/reflection/BaseTreeModifier.js#L293-L298
4,238
SAP/openui5
src/sap.ui.core/src/sap/ui/core/util/reflection/BaseTreeModifier.js
function (oControl) { var sControlType = oControl.namespaceURI; sControlType = sControlType ? sControlType + "." : ""; // add a dot if there is already a prefix sControlType += oControl.localName; return sControlType; }
javascript
function (oControl) { var sControlType = oControl.namespaceURI; sControlType = sControlType ? sControlType + "." : ""; // add a dot if there is already a prefix sControlType += oControl.localName; return sControlType; }
[ "function", "(", "oControl", ")", "{", "var", "sControlType", "=", "oControl", ".", "namespaceURI", ";", "sControlType", "=", "sControlType", "?", "sControlType", "+", "\".\"", ":", "\"\"", ";", "// add a dot if there is already a prefix", "sControlType", "+=", "oControl", ".", "localName", ";", "return", "sControlType", ";", "}" ]
Gets the ControlType of an XML control. @param {Element} oControl - Control in XML @returns {string} Control type as a string, e.g. 'sap.m.Button'
[ "Gets", "the", "ControlType", "of", "an", "XML", "control", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/util/reflection/BaseTreeModifier.js#L306-L312
4,239
SAP/openui5
src/sap.ui.core/src/sap/ui/core/util/reflection/BaseTreeModifier.js
function(fnCallback, oRootNode) { function recurse(oParent, oCurrentNode, bIsAggregation) { var oAggregations; if (!bIsAggregation) { var oMetadata = this._getControlMetadataInXml(oCurrentNode); oAggregations = oMetadata.getAllAggregations(); } var aChildren = this._getElementNodeChildren(oCurrentNode); aChildren.forEach(function(oChild) { var bIsCurrentNodeAggregation = oAggregations && oAggregations[oChild.localName]; recurse.call(this, oCurrentNode, oChild, bIsCurrentNodeAggregation); // if it's an aggregation, we don't call the callback function if (!bIsCurrentNodeAggregation) { fnCallback(oChild); } }.bind(this)); } recurse.call(this, oRootNode, oRootNode, false); }
javascript
function(fnCallback, oRootNode) { function recurse(oParent, oCurrentNode, bIsAggregation) { var oAggregations; if (!bIsAggregation) { var oMetadata = this._getControlMetadataInXml(oCurrentNode); oAggregations = oMetadata.getAllAggregations(); } var aChildren = this._getElementNodeChildren(oCurrentNode); aChildren.forEach(function(oChild) { var bIsCurrentNodeAggregation = oAggregations && oAggregations[oChild.localName]; recurse.call(this, oCurrentNode, oChild, bIsCurrentNodeAggregation); // if it's an aggregation, we don't call the callback function if (!bIsCurrentNodeAggregation) { fnCallback(oChild); } }.bind(this)); } recurse.call(this, oRootNode, oRootNode, false); }
[ "function", "(", "fnCallback", ",", "oRootNode", ")", "{", "function", "recurse", "(", "oParent", ",", "oCurrentNode", ",", "bIsAggregation", ")", "{", "var", "oAggregations", ";", "if", "(", "!", "bIsAggregation", ")", "{", "var", "oMetadata", "=", "this", ".", "_getControlMetadataInXml", "(", "oCurrentNode", ")", ";", "oAggregations", "=", "oMetadata", ".", "getAllAggregations", "(", ")", ";", "}", "var", "aChildren", "=", "this", ".", "_getElementNodeChildren", "(", "oCurrentNode", ")", ";", "aChildren", ".", "forEach", "(", "function", "(", "oChild", ")", "{", "var", "bIsCurrentNodeAggregation", "=", "oAggregations", "&&", "oAggregations", "[", "oChild", ".", "localName", "]", ";", "recurse", ".", "call", "(", "this", ",", "oCurrentNode", ",", "oChild", ",", "bIsCurrentNodeAggregation", ")", ";", "// if it's an aggregation, we don't call the callback function", "if", "(", "!", "bIsCurrentNodeAggregation", ")", "{", "fnCallback", "(", "oChild", ")", ";", "}", "}", ".", "bind", "(", "this", ")", ")", ";", "}", "recurse", ".", "call", "(", "this", ",", "oRootNode", ",", "oRootNode", ",", "false", ")", ";", "}" ]
Recursively goes through an XML tree and calls a callback function for every control inside. Does not call the callback function for aggregations. @param {function} fnCallback - Function that will be called for every control with the following arguments: fnCallback(<Element>) @param {Element} oRootNode - Root node from which we start traversing the tree
[ "Recursively", "goes", "through", "an", "XML", "tree", "and", "calls", "a", "callback", "function", "for", "every", "control", "inside", ".", "Does", "not", "call", "the", "callback", "function", "for", "aggregations", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/util/reflection/BaseTreeModifier.js#L321-L339
4,240
SAP/openui5
src/sap.ui.codeeditor/src/sap/ui/codeeditor/js/ace/ace.js
function(parentId, moduleName) { moduleName = normalizeModule(parentId, moduleName); var module = define.modules[moduleName]; if (!module) { module = define.payloads[moduleName]; if (typeof module === 'function') { var exports = {}; var mod = { id: moduleName, uri: '', exports: exports, packaged: true }; var req = function(module, callback) { return _require(moduleName, module, callback); }; var returnValue = module(req, exports, mod); exports = returnValue || mod.exports; define.modules[moduleName] = exports; delete define.payloads[moduleName]; } module = define.modules[moduleName] = exports || module; } return module; }
javascript
function(parentId, moduleName) { moduleName = normalizeModule(parentId, moduleName); var module = define.modules[moduleName]; if (!module) { module = define.payloads[moduleName]; if (typeof module === 'function') { var exports = {}; var mod = { id: moduleName, uri: '', exports: exports, packaged: true }; var req = function(module, callback) { return _require(moduleName, module, callback); }; var returnValue = module(req, exports, mod); exports = returnValue || mod.exports; define.modules[moduleName] = exports; delete define.payloads[moduleName]; } module = define.modules[moduleName] = exports || module; } return module; }
[ "function", "(", "parentId", ",", "moduleName", ")", "{", "moduleName", "=", "normalizeModule", "(", "parentId", ",", "moduleName", ")", ";", "var", "module", "=", "define", ".", "modules", "[", "moduleName", "]", ";", "if", "(", "!", "module", ")", "{", "module", "=", "define", ".", "payloads", "[", "moduleName", "]", ";", "if", "(", "typeof", "module", "===", "'function'", ")", "{", "var", "exports", "=", "{", "}", ";", "var", "mod", "=", "{", "id", ":", "moduleName", ",", "uri", ":", "''", ",", "exports", ":", "exports", ",", "packaged", ":", "true", "}", ";", "var", "req", "=", "function", "(", "module", ",", "callback", ")", "{", "return", "_require", "(", "moduleName", ",", "module", ",", "callback", ")", ";", "}", ";", "var", "returnValue", "=", "module", "(", "req", ",", "exports", ",", "mod", ")", ";", "exports", "=", "returnValue", "||", "mod", ".", "exports", ";", "define", ".", "modules", "[", "moduleName", "]", "=", "exports", ";", "delete", "define", ".", "payloads", "[", "moduleName", "]", ";", "}", "module", "=", "define", ".", "modules", "[", "moduleName", "]", "=", "exports", "||", "module", ";", "}", "return", "module", ";", "}" ]
Internal function to lookup moduleNames and resolve them by calling the definition function if needed.
[ "Internal", "function", "to", "lookup", "moduleNames", "and", "resolve", "them", "by", "calling", "the", "definition", "function", "if", "needed", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.codeeditor/src/sap/ui/codeeditor/js/ace/ace.js#L122-L149
4,241
SAP/openui5
src/sap.ui.core/src/sap/ui/VersionInfo.js
transformVersionInfo
function transformVersionInfo() { // get the transitive dependencies of the given libs from the sap.ui.versioninfo // only do this once if mKnownLibs is not created yet if (sap.ui.versioninfo && sap.ui.versioninfo.libraries && !mKnownLibs) { // flatten dependency lists for all libs mKnownLibs = {}; sap.ui.versioninfo.libraries.forEach(function(oLib, i) { mKnownLibs[oLib.name] = {}; var mDeps = oLib.manifestHints && oLib.manifestHints.dependencies && oLib.manifestHints.dependencies.libs; for (var sDep in mDeps) { if (!mDeps[sDep].lazy) { mKnownLibs[oLib.name][sDep] = true; } } }); } // get transitive dependencies for a component if (sap.ui.versioninfo && sap.ui.versioninfo.components && !mKnownComponents) { mKnownComponents = {}; Object.keys(sap.ui.versioninfo.components).forEach(function(sComponentName) { var oComponentInfo = sap.ui.versioninfo.components[sComponentName]; mKnownComponents[sComponentName] = { library: oComponentInfo.library, dependencies: [] }; var mDeps = oComponentInfo.manifestHints && oComponentInfo.manifestHints.dependencies && oComponentInfo.manifestHints.dependencies.libs; for (var sDep in mDeps) { if (!mDeps[sDep].lazy) { mKnownComponents[sComponentName].dependencies.push(sDep); } } }); } }
javascript
function transformVersionInfo() { // get the transitive dependencies of the given libs from the sap.ui.versioninfo // only do this once if mKnownLibs is not created yet if (sap.ui.versioninfo && sap.ui.versioninfo.libraries && !mKnownLibs) { // flatten dependency lists for all libs mKnownLibs = {}; sap.ui.versioninfo.libraries.forEach(function(oLib, i) { mKnownLibs[oLib.name] = {}; var mDeps = oLib.manifestHints && oLib.manifestHints.dependencies && oLib.manifestHints.dependencies.libs; for (var sDep in mDeps) { if (!mDeps[sDep].lazy) { mKnownLibs[oLib.name][sDep] = true; } } }); } // get transitive dependencies for a component if (sap.ui.versioninfo && sap.ui.versioninfo.components && !mKnownComponents) { mKnownComponents = {}; Object.keys(sap.ui.versioninfo.components).forEach(function(sComponentName) { var oComponentInfo = sap.ui.versioninfo.components[sComponentName]; mKnownComponents[sComponentName] = { library: oComponentInfo.library, dependencies: [] }; var mDeps = oComponentInfo.manifestHints && oComponentInfo.manifestHints.dependencies && oComponentInfo.manifestHints.dependencies.libs; for (var sDep in mDeps) { if (!mDeps[sDep].lazy) { mKnownComponents[sComponentName].dependencies.push(sDep); } } }); } }
[ "function", "transformVersionInfo", "(", ")", "{", "// get the transitive dependencies of the given libs from the sap.ui.versioninfo", "// only do this once if mKnownLibs is not created yet", "if", "(", "sap", ".", "ui", ".", "versioninfo", "&&", "sap", ".", "ui", ".", "versioninfo", ".", "libraries", "&&", "!", "mKnownLibs", ")", "{", "// flatten dependency lists for all libs", "mKnownLibs", "=", "{", "}", ";", "sap", ".", "ui", ".", "versioninfo", ".", "libraries", ".", "forEach", "(", "function", "(", "oLib", ",", "i", ")", "{", "mKnownLibs", "[", "oLib", ".", "name", "]", "=", "{", "}", ";", "var", "mDeps", "=", "oLib", ".", "manifestHints", "&&", "oLib", ".", "manifestHints", ".", "dependencies", "&&", "oLib", ".", "manifestHints", ".", "dependencies", ".", "libs", ";", "for", "(", "var", "sDep", "in", "mDeps", ")", "{", "if", "(", "!", "mDeps", "[", "sDep", "]", ".", "lazy", ")", "{", "mKnownLibs", "[", "oLib", ".", "name", "]", "[", "sDep", "]", "=", "true", ";", "}", "}", "}", ")", ";", "}", "// get transitive dependencies for a component", "if", "(", "sap", ".", "ui", ".", "versioninfo", "&&", "sap", ".", "ui", ".", "versioninfo", ".", "components", "&&", "!", "mKnownComponents", ")", "{", "mKnownComponents", "=", "{", "}", ";", "Object", ".", "keys", "(", "sap", ".", "ui", ".", "versioninfo", ".", "components", ")", ".", "forEach", "(", "function", "(", "sComponentName", ")", "{", "var", "oComponentInfo", "=", "sap", ".", "ui", ".", "versioninfo", ".", "components", "[", "sComponentName", "]", ";", "mKnownComponents", "[", "sComponentName", "]", "=", "{", "library", ":", "oComponentInfo", ".", "library", ",", "dependencies", ":", "[", "]", "}", ";", "var", "mDeps", "=", "oComponentInfo", ".", "manifestHints", "&&", "oComponentInfo", ".", "manifestHints", ".", "dependencies", "&&", "oComponentInfo", ".", "manifestHints", ".", "dependencies", ".", "libs", ";", "for", "(", "var", "sDep", "in", "mDeps", ")", "{", "if", "(", "!", "mDeps", "[", "sDep", "]", ".", "lazy", ")", "{", "mKnownComponents", "[", "sComponentName", "]", ".", "dependencies", ".", "push", "(", "sDep", ")", ";", "}", "}", "}", ")", ";", "}", "}" ]
Transforms the sap.ui.versioninfo to an easier consumable map.
[ "Transforms", "the", "sap", ".", "ui", ".", "versioninfo", "to", "an", "easier", "consumable", "map", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/VersionInfo.js#L188-L229
4,242
SAP/openui5
src/sap.f/src/sap/f/cards/BindingResolver.js
process
function process(vValue, oModel, sPath, iCurrentLevel, iMaxLevel) { var bReachedMaxLevel = iCurrentLevel === iMaxLevel; if (bReachedMaxLevel) { Log.warning("BindingResolver maximum level processing reached. Please check for circular dependencies."); } if (!vValue || bReachedMaxLevel) { return vValue; } if (Array.isArray(vValue)) { vValue.forEach(function (vItem, iIndex, aArray) { if (typeof vItem === "object") { process(vItem, oModel, sPath, iCurrentLevel + 1, iMaxLevel); } else if (typeof vItem === "string") { aArray[iIndex] = resolveBinding(vItem, oModel, sPath); } }, this); return vValue; } else if (typeof vValue === "object") { for (var sProp in vValue) { if (typeof vValue[sProp] === "object") { process(vValue[sProp], oModel, sPath, iCurrentLevel + 1, iMaxLevel); } else if (typeof vValue[sProp] === "string") { vValue[sProp] = resolveBinding(vValue[sProp], oModel, sPath); } } return vValue; } else if (typeof vValue === "string") { return resolveBinding(vValue, oModel, sPath); } else { return vValue; } }
javascript
function process(vValue, oModel, sPath, iCurrentLevel, iMaxLevel) { var bReachedMaxLevel = iCurrentLevel === iMaxLevel; if (bReachedMaxLevel) { Log.warning("BindingResolver maximum level processing reached. Please check for circular dependencies."); } if (!vValue || bReachedMaxLevel) { return vValue; } if (Array.isArray(vValue)) { vValue.forEach(function (vItem, iIndex, aArray) { if (typeof vItem === "object") { process(vItem, oModel, sPath, iCurrentLevel + 1, iMaxLevel); } else if (typeof vItem === "string") { aArray[iIndex] = resolveBinding(vItem, oModel, sPath); } }, this); return vValue; } else if (typeof vValue === "object") { for (var sProp in vValue) { if (typeof vValue[sProp] === "object") { process(vValue[sProp], oModel, sPath, iCurrentLevel + 1, iMaxLevel); } else if (typeof vValue[sProp] === "string") { vValue[sProp] = resolveBinding(vValue[sProp], oModel, sPath); } } return vValue; } else if (typeof vValue === "string") { return resolveBinding(vValue, oModel, sPath); } else { return vValue; } }
[ "function", "process", "(", "vValue", ",", "oModel", ",", "sPath", ",", "iCurrentLevel", ",", "iMaxLevel", ")", "{", "var", "bReachedMaxLevel", "=", "iCurrentLevel", "===", "iMaxLevel", ";", "if", "(", "bReachedMaxLevel", ")", "{", "Log", ".", "warning", "(", "\"BindingResolver maximum level processing reached. Please check for circular dependencies.\"", ")", ";", "}", "if", "(", "!", "vValue", "||", "bReachedMaxLevel", ")", "{", "return", "vValue", ";", "}", "if", "(", "Array", ".", "isArray", "(", "vValue", ")", ")", "{", "vValue", ".", "forEach", "(", "function", "(", "vItem", ",", "iIndex", ",", "aArray", ")", "{", "if", "(", "typeof", "vItem", "===", "\"object\"", ")", "{", "process", "(", "vItem", ",", "oModel", ",", "sPath", ",", "iCurrentLevel", "+", "1", ",", "iMaxLevel", ")", ";", "}", "else", "if", "(", "typeof", "vItem", "===", "\"string\"", ")", "{", "aArray", "[", "iIndex", "]", "=", "resolveBinding", "(", "vItem", ",", "oModel", ",", "sPath", ")", ";", "}", "}", ",", "this", ")", ";", "return", "vValue", ";", "}", "else", "if", "(", "typeof", "vValue", "===", "\"object\"", ")", "{", "for", "(", "var", "sProp", "in", "vValue", ")", "{", "if", "(", "typeof", "vValue", "[", "sProp", "]", "===", "\"object\"", ")", "{", "process", "(", "vValue", "[", "sProp", "]", ",", "oModel", ",", "sPath", ",", "iCurrentLevel", "+", "1", ",", "iMaxLevel", ")", ";", "}", "else", "if", "(", "typeof", "vValue", "[", "sProp", "]", "===", "\"string\"", ")", "{", "vValue", "[", "sProp", "]", "=", "resolveBinding", "(", "vValue", "[", "sProp", "]", ",", "oModel", ",", "sPath", ")", ";", "}", "}", "return", "vValue", ";", "}", "else", "if", "(", "typeof", "vValue", "===", "\"string\"", ")", "{", "return", "resolveBinding", "(", "vValue", ",", "oModel", ",", "sPath", ")", ";", "}", "else", "{", "return", "vValue", ";", "}", "}" ]
Traverses an object and resolves all binding syntaxes. @param {*} vValue The value to resolve. @param {sap.ui.model.Model} oModel The model. @param {string} [sPath] The path to take. @param {number} iCurrentLevel The current level of recursion. @param {number} iMaxLevel The maximum level of recursion. @private @returns {*} The resolved value.
[ "Traverses", "an", "object", "and", "resolves", "all", "binding", "syntaxes", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.f/src/sap/f/cards/BindingResolver.js#L44-L77
4,243
SAP/openui5
src/sap.f/src/sap/f/cards/BindingResolver.js
resolveBinding
function resolveBinding(sBinding, oModel, sPath) { if (!sBinding) { return sBinding; } var oBindingInfo = ManagedObject.bindingParser(sBinding); if (!oBindingInfo) { return sBinding; } if (!sPath) { sPath = "/"; } oSimpleControl.setModel(oModel); oSimpleControl.bindObject(sPath); oSimpleControl.bindProperty("resolved", oBindingInfo); var vValue = oSimpleControl.getResolved(); oSimpleControl.unbindProperty("resolved"); oSimpleControl.unbindObject(); oSimpleControl.setModel(null); return vValue; }
javascript
function resolveBinding(sBinding, oModel, sPath) { if (!sBinding) { return sBinding; } var oBindingInfo = ManagedObject.bindingParser(sBinding); if (!oBindingInfo) { return sBinding; } if (!sPath) { sPath = "/"; } oSimpleControl.setModel(oModel); oSimpleControl.bindObject(sPath); oSimpleControl.bindProperty("resolved", oBindingInfo); var vValue = oSimpleControl.getResolved(); oSimpleControl.unbindProperty("resolved"); oSimpleControl.unbindObject(); oSimpleControl.setModel(null); return vValue; }
[ "function", "resolveBinding", "(", "sBinding", ",", "oModel", ",", "sPath", ")", "{", "if", "(", "!", "sBinding", ")", "{", "return", "sBinding", ";", "}", "var", "oBindingInfo", "=", "ManagedObject", ".", "bindingParser", "(", "sBinding", ")", ";", "if", "(", "!", "oBindingInfo", ")", "{", "return", "sBinding", ";", "}", "if", "(", "!", "sPath", ")", "{", "sPath", "=", "\"/\"", ";", "}", "oSimpleControl", ".", "setModel", "(", "oModel", ")", ";", "oSimpleControl", ".", "bindObject", "(", "sPath", ")", ";", "oSimpleControl", ".", "bindProperty", "(", "\"resolved\"", ",", "oBindingInfo", ")", ";", "var", "vValue", "=", "oSimpleControl", ".", "getResolved", "(", ")", ";", "oSimpleControl", ".", "unbindProperty", "(", "\"resolved\"", ")", ";", "oSimpleControl", ".", "unbindObject", "(", ")", ";", "oSimpleControl", ".", "setModel", "(", "null", ")", ";", "return", "vValue", ";", "}" ]
Resolves a single binding syntax. @param {string} sBinding The value to resolve. @param {sap.ui.model.Model} oModel The model. @param {string} [sPath] The path to the referenced entity which is going to be used as a binding context. @private @returns {*} The resolved value.
[ "Resolves", "a", "single", "binding", "syntax", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.f/src/sap/f/cards/BindingResolver.js#L88-L113
4,244
SAP/openui5
src/sap.ui.core/src/sap/ui/model/odata/v4/lib/_AggregationHelper.js
function (mAggregate) { return !!mAggregate && Object.keys(mAggregate).some(function (sAlias) { return mAggregate[sAlias].grandTotal; }); }
javascript
function (mAggregate) { return !!mAggregate && Object.keys(mAggregate).some(function (sAlias) { return mAggregate[sAlias].grandTotal; }); }
[ "function", "(", "mAggregate", ")", "{", "return", "!", "!", "mAggregate", "&&", "Object", ".", "keys", "(", "mAggregate", ")", ".", "some", "(", "function", "(", "sAlias", ")", "{", "return", "mAggregate", "[", "sAlias", "]", ".", "grandTotal", ";", "}", ")", ";", "}" ]
Tells whether grand total values are needed for at least one aggregatable property. @param {object} [mAggregate] A map from aggregatable property names or aliases to details objects @returns {boolean} Whether grand total values are needed for at least one aggregatable property. @public
[ "Tells", "whether", "grand", "total", "values", "are", "needed", "for", "at", "least", "one", "aggregatable", "property", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/v4/lib/_AggregationHelper.js#L351-L355
4,245
SAP/openui5
src/sap.ui.core/src/sap/ui/model/odata/v4/lib/_AggregationHelper.js
function (mAggregate) { return !!mAggregate && Object.keys(mAggregate).some(function (sAlias) { var oDetails = mAggregate[sAlias]; return oDetails.min || oDetails.max; }); }
javascript
function (mAggregate) { return !!mAggregate && Object.keys(mAggregate).some(function (sAlias) { var oDetails = mAggregate[sAlias]; return oDetails.min || oDetails.max; }); }
[ "function", "(", "mAggregate", ")", "{", "return", "!", "!", "mAggregate", "&&", "Object", ".", "keys", "(", "mAggregate", ")", ".", "some", "(", "function", "(", "sAlias", ")", "{", "var", "oDetails", "=", "mAggregate", "[", "sAlias", "]", ";", "return", "oDetails", ".", "min", "||", "oDetails", ".", "max", ";", "}", ")", ";", "}" ]
Tells whether minimum or maximum values are needed for at least one aggregatable property. @param {object} [mAggregate] A map from aggregatable property names or aliases to details objects @returns {boolean} Whether minimum or maximum values are needed for at least one aggregatable property. @public
[ "Tells", "whether", "minimum", "or", "maximum", "values", "are", "needed", "for", "at", "least", "one", "aggregatable", "property", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/v4/lib/_AggregationHelper.js#L369-L375
4,246
SAP/openui5
src/sap.m/src/sap/m/PlanningCalendar.js
toggleSizeClasses
function toggleSizeClasses(iSize) { var sCurrentSizeClass = 'sapMSize' + iSize, oRef = this.$(), i, sClass; if (oRef) { for (i = 0; i < 3; i++) { sClass = 'sapMSize' + i; if (sClass === sCurrentSizeClass) { oRef.addClass(sClass); } else { oRef.removeClass(sClass); } } } }
javascript
function toggleSizeClasses(iSize) { var sCurrentSizeClass = 'sapMSize' + iSize, oRef = this.$(), i, sClass; if (oRef) { for (i = 0; i < 3; i++) { sClass = 'sapMSize' + i; if (sClass === sCurrentSizeClass) { oRef.addClass(sClass); } else { oRef.removeClass(sClass); } } } }
[ "function", "toggleSizeClasses", "(", "iSize", ")", "{", "var", "sCurrentSizeClass", "=", "'sapMSize'", "+", "iSize", ",", "oRef", "=", "this", ".", "$", "(", ")", ",", "i", ",", "sClass", ";", "if", "(", "oRef", ")", "{", "for", "(", "i", "=", "0", ";", "i", "<", "3", ";", "i", "++", ")", "{", "sClass", "=", "'sapMSize'", "+", "i", ";", "if", "(", "sClass", "===", "sCurrentSizeClass", ")", "{", "oRef", ".", "addClass", "(", "sClass", ")", ";", "}", "else", "{", "oRef", ".", "removeClass", "(", "sClass", ")", ";", "}", "}", "}", "}" ]
as all our css should depend on the main container size, not screen size like sapUiMedia-Std-Tablet...
[ "as", "all", "our", "css", "should", "depend", "on", "the", "main", "container", "size", "not", "screen", "size", "like", "sapUiMedia", "-", "Std", "-", "Tablet", "..." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.m/src/sap/m/PlanningCalendar.js#L3615-L3631
4,247
SAP/openui5
src/sap.ui.core/src/sap/ui/core/StashedControlSupport.js
mixInto
function mixInto(fnClass, bDefaultValue) { // add the properties fnClass.getMetadata().addSpecialSetting("stashed", {type: "boolean", defaultValue: !!bDefaultValue}); // mix the required methods into the target fnClass fnClass.prototype.setStashed = function(bStashed) { if (this.stashed === true && !bStashed) { if (this.sParentId) { var oControl = unstash(this, sap.ui.getCore().byId(this.sParentId)); // we need to set the property to the stashed control oControl.stashed = false; return; } } else if (bStashed) { Log.warning("Cannot re-stash a control", this.getId()); } }; fnClass.prototype.getStashed = function() { return this.stashed; }; var fnDestroy = fnClass.prototype.destroy; fnClass.prototype.destroy = function() { delete stashedControls[this.getId()]; fnDestroy.apply(this, arguments); }; fnClass.prototype._stash = function(sParentId, sParentAggregationName) { // for later unstash these parent infos have to be kept this.sParentId = sParentId; this.sParentAggregationName = sParentAggregationName; stashedControls[this.getId()] = this; }; }
javascript
function mixInto(fnClass, bDefaultValue) { // add the properties fnClass.getMetadata().addSpecialSetting("stashed", {type: "boolean", defaultValue: !!bDefaultValue}); // mix the required methods into the target fnClass fnClass.prototype.setStashed = function(bStashed) { if (this.stashed === true && !bStashed) { if (this.sParentId) { var oControl = unstash(this, sap.ui.getCore().byId(this.sParentId)); // we need to set the property to the stashed control oControl.stashed = false; return; } } else if (bStashed) { Log.warning("Cannot re-stash a control", this.getId()); } }; fnClass.prototype.getStashed = function() { return this.stashed; }; var fnDestroy = fnClass.prototype.destroy; fnClass.prototype.destroy = function() { delete stashedControls[this.getId()]; fnDestroy.apply(this, arguments); }; fnClass.prototype._stash = function(sParentId, sParentAggregationName) { // for later unstash these parent infos have to be kept this.sParentId = sParentId; this.sParentAggregationName = sParentAggregationName; stashedControls[this.getId()] = this; }; }
[ "function", "mixInto", "(", "fnClass", ",", "bDefaultValue", ")", "{", "// add the properties", "fnClass", ".", "getMetadata", "(", ")", ".", "addSpecialSetting", "(", "\"stashed\"", ",", "{", "type", ":", "\"boolean\"", ",", "defaultValue", ":", "!", "!", "bDefaultValue", "}", ")", ";", "// mix the required methods into the target fnClass", "fnClass", ".", "prototype", ".", "setStashed", "=", "function", "(", "bStashed", ")", "{", "if", "(", "this", ".", "stashed", "===", "true", "&&", "!", "bStashed", ")", "{", "if", "(", "this", ".", "sParentId", ")", "{", "var", "oControl", "=", "unstash", "(", "this", ",", "sap", ".", "ui", ".", "getCore", "(", ")", ".", "byId", "(", "this", ".", "sParentId", ")", ")", ";", "// we need to set the property to the stashed control", "oControl", ".", "stashed", "=", "false", ";", "return", ";", "}", "}", "else", "if", "(", "bStashed", ")", "{", "Log", ".", "warning", "(", "\"Cannot re-stash a control\"", ",", "this", ".", "getId", "(", ")", ")", ";", "}", "}", ";", "fnClass", ".", "prototype", ".", "getStashed", "=", "function", "(", ")", "{", "return", "this", ".", "stashed", ";", "}", ";", "var", "fnDestroy", "=", "fnClass", ".", "prototype", ".", "destroy", ";", "fnClass", ".", "prototype", ".", "destroy", "=", "function", "(", ")", "{", "delete", "stashedControls", "[", "this", ".", "getId", "(", ")", "]", ";", "fnDestroy", ".", "apply", "(", "this", ",", "arguments", ")", ";", "}", ";", "fnClass", ".", "prototype", ".", "_stash", "=", "function", "(", "sParentId", ",", "sParentAggregationName", ")", "{", "// for later unstash these parent infos have to be kept", "this", ".", "sParentId", "=", "sParentId", ";", "this", ".", "sParentAggregationName", "=", "sParentAggregationName", ";", "stashedControls", "[", "this", ".", "getId", "(", ")", "]", "=", "this", ";", "}", ";", "}" ]
private function without validity checks
[ "private", "function", "without", "validity", "checks" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/StashedControlSupport.js#L121-L155
4,248
SAP/openui5
src/sap.ui.fl/src/sap/ui/fl/support/apps/contentbrowser/controller/LayerContentMaster.controller.js
function (oRouteMatch) { var that = this; var mRouteArguments = oRouteMatch.getParameter("arguments"); this.sLayer = mRouteArguments.layer; this.sNamespace = mRouteArguments.namespace || ""; var oPage = this.getView().getContent()[0]; oPage.setBusy(true); that.sNamespace = decodeURIComponent(that.sNamespace); oPage.setTitle(this._shortenNamespace()); LRepConnector.getContent(that.sLayer, that.sNamespace).then( that._onContentReceived.bind(that, oPage), function(){ oPage.setBusy(false); }).then(function () { LRepConnector.requestPending = false; }); }
javascript
function (oRouteMatch) { var that = this; var mRouteArguments = oRouteMatch.getParameter("arguments"); this.sLayer = mRouteArguments.layer; this.sNamespace = mRouteArguments.namespace || ""; var oPage = this.getView().getContent()[0]; oPage.setBusy(true); that.sNamespace = decodeURIComponent(that.sNamespace); oPage.setTitle(this._shortenNamespace()); LRepConnector.getContent(that.sLayer, that.sNamespace).then( that._onContentReceived.bind(that, oPage), function(){ oPage.setBusy(false); }).then(function () { LRepConnector.requestPending = false; }); }
[ "function", "(", "oRouteMatch", ")", "{", "var", "that", "=", "this", ";", "var", "mRouteArguments", "=", "oRouteMatch", ".", "getParameter", "(", "\"arguments\"", ")", ";", "this", ".", "sLayer", "=", "mRouteArguments", ".", "layer", ";", "this", ".", "sNamespace", "=", "mRouteArguments", ".", "namespace", "||", "\"\"", ";", "var", "oPage", "=", "this", ".", "getView", "(", ")", ".", "getContent", "(", ")", "[", "0", "]", ";", "oPage", ".", "setBusy", "(", "true", ")", ";", "that", ".", "sNamespace", "=", "decodeURIComponent", "(", "that", ".", "sNamespace", ")", ";", "oPage", ".", "setTitle", "(", "this", ".", "_shortenNamespace", "(", ")", ")", ";", "LRepConnector", ".", "getContent", "(", "that", ".", "sLayer", ",", "that", ".", "sNamespace", ")", ".", "then", "(", "that", ".", "_onContentReceived", ".", "bind", "(", "that", ",", "oPage", ")", ",", "function", "(", ")", "{", "oPage", ".", "setBusy", "(", "false", ")", ";", "}", ")", ".", "then", "(", "function", "(", ")", "{", "LRepConnector", ".", "requestPending", "=", "false", ";", "}", ")", ";", "}" ]
Handler if a route was matched; Checks if the matched route is current route and then requests content from Layered Repository. @param {Object} oRouteMatch - route object specified in the router which was matched via regexp @private
[ "Handler", "if", "a", "route", "was", "matched", ";", "Checks", "if", "the", "matched", "route", "is", "current", "route", "and", "then", "requests", "content", "from", "Layered", "Repository", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.fl/src/sap/ui/fl/support/apps/contentbrowser/controller/LayerContentMaster.controller.js#L46-L63
4,249
SAP/openui5
src/sap.ui.fl/src/sap/ui/fl/support/apps/contentbrowser/controller/LayerContentMaster.controller.js
function (oPage, oData) { var oContentModel = this.getView().getModel("content"); oContentModel.setData(oData); oPage.setBusy(false); this.filterListByQuery(""); this.byId("search").setValue(""); }
javascript
function (oPage, oData) { var oContentModel = this.getView().getModel("content"); oContentModel.setData(oData); oPage.setBusy(false); this.filterListByQuery(""); this.byId("search").setValue(""); }
[ "function", "(", "oPage", ",", "oData", ")", "{", "var", "oContentModel", "=", "this", ".", "getView", "(", ")", ".", "getModel", "(", "\"content\"", ")", ";", "oContentModel", ".", "setData", "(", "oData", ")", ";", "oPage", ".", "setBusy", "(", "false", ")", ";", "this", ".", "filterListByQuery", "(", "\"\"", ")", ";", "this", ".", "byId", "(", "\"search\"", ")", ".", "setValue", "(", "\"\"", ")", ";", "}" ]
Handler if content data was received; Sets the received data to the current content model. @param {Object} oPage @param {Object} oData - data which is received from <code>LRepConnector</code> "getContent" promise @private
[ "Handler", "if", "content", "data", "was", "received", ";", "Sets", "the", "received", "data", "to", "the", "current", "content", "model", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.fl/src/sap/ui/fl/support/apps/contentbrowser/controller/LayerContentMaster.controller.js#L72-L78
4,250
SAP/openui5
src/sap.ui.fl/src/sap/ui/fl/support/apps/contentbrowser/controller/LayerContentMaster.controller.js
function (sQuery) { // add filter for search var aFilters = []; if (sQuery && sQuery.length > 0) { aFilters = new Filter({ filters: [ new Filter("name", FilterOperator.Contains, sQuery), new Filter("fileType", FilterOperator.Contains, sQuery) ], and: false }); } // update list binding var oList = this.byId("masterComponentsList"); var oBinding = oList.getBinding("items"); oBinding.filter(aFilters, "content"); }
javascript
function (sQuery) { // add filter for search var aFilters = []; if (sQuery && sQuery.length > 0) { aFilters = new Filter({ filters: [ new Filter("name", FilterOperator.Contains, sQuery), new Filter("fileType", FilterOperator.Contains, sQuery) ], and: false }); } // update list binding var oList = this.byId("masterComponentsList"); var oBinding = oList.getBinding("items"); oBinding.filter(aFilters, "content"); }
[ "function", "(", "sQuery", ")", "{", "// add filter for search", "var", "aFilters", "=", "[", "]", ";", "if", "(", "sQuery", "&&", "sQuery", ".", "length", ">", "0", ")", "{", "aFilters", "=", "new", "Filter", "(", "{", "filters", ":", "[", "new", "Filter", "(", "\"name\"", ",", "FilterOperator", ".", "Contains", ",", "sQuery", ")", ",", "new", "Filter", "(", "\"fileType\"", ",", "FilterOperator", ".", "Contains", ",", "sQuery", ")", "]", ",", "and", ":", "false", "}", ")", ";", "}", "// update list binding", "var", "oList", "=", "this", ".", "byId", "(", "\"masterComponentsList\"", ")", ";", "var", "oBinding", "=", "oList", ".", "getBinding", "(", "\"items\"", ")", ";", "oBinding", ".", "filter", "(", "aFilters", ",", "\"content\"", ")", ";", "}" ]
Filters the binding of the master list; This function is also called once navigation to the page to clear the filters or input search entry. @param {String} sQuery - entered string within the search field @public
[ "Filters", "the", "binding", "of", "the", "master", "list", ";", "This", "function", "is", "also", "called", "once", "navigation", "to", "the", "page", "to", "clear", "the", "filters", "or", "input", "search", "entry", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.fl/src/sap/ui/fl/support/apps/contentbrowser/controller/LayerContentMaster.controller.js#L96-L113
4,251
SAP/openui5
src/sap.ui.fl/src/sap/ui/fl/support/apps/contentbrowser/controller/LayerContentMaster.controller.js
function (oEvent) { var sSource = oEvent.getSource(); var sContentBindingPath = sSource.getBindingContextPath().substring(1); var sContentModelData = this.getView().getModel("content").getData(); var sContent = sContentModelData[sContentBindingPath]; var sContentName = sContent.name; var sContentFileType = sContentModelData[sContentBindingPath].fileType; var oRouter = UIComponent.getRouterFor(this); this.sNamespace = (this.sNamespace ? this.sNamespace : '/'); if (sContentFileType) { // show details to a file var mRouteParameters = { "layer": this.sLayer, "namespace": encodeURIComponent(this.sNamespace), "fileName": sContentName, "fileType": sContentFileType }; oRouter.navTo("ContentDetails", mRouteParameters); } else { // navigation to a namespace this.sNamespace += sContentName + '/'; oRouter.navTo("LayerContentMaster", {"layer": this.sLayer, "namespace": encodeURIComponent(this.sNamespace)}); } }
javascript
function (oEvent) { var sSource = oEvent.getSource(); var sContentBindingPath = sSource.getBindingContextPath().substring(1); var sContentModelData = this.getView().getModel("content").getData(); var sContent = sContentModelData[sContentBindingPath]; var sContentName = sContent.name; var sContentFileType = sContentModelData[sContentBindingPath].fileType; var oRouter = UIComponent.getRouterFor(this); this.sNamespace = (this.sNamespace ? this.sNamespace : '/'); if (sContentFileType) { // show details to a file var mRouteParameters = { "layer": this.sLayer, "namespace": encodeURIComponent(this.sNamespace), "fileName": sContentName, "fileType": sContentFileType }; oRouter.navTo("ContentDetails", mRouteParameters); } else { // navigation to a namespace this.sNamespace += sContentName + '/'; oRouter.navTo("LayerContentMaster", {"layer": this.sLayer, "namespace": encodeURIComponent(this.sNamespace)}); } }
[ "function", "(", "oEvent", ")", "{", "var", "sSource", "=", "oEvent", ".", "getSource", "(", ")", ";", "var", "sContentBindingPath", "=", "sSource", ".", "getBindingContextPath", "(", ")", ".", "substring", "(", "1", ")", ";", "var", "sContentModelData", "=", "this", ".", "getView", "(", ")", ".", "getModel", "(", "\"content\"", ")", ".", "getData", "(", ")", ";", "var", "sContent", "=", "sContentModelData", "[", "sContentBindingPath", "]", ";", "var", "sContentName", "=", "sContent", ".", "name", ";", "var", "sContentFileType", "=", "sContentModelData", "[", "sContentBindingPath", "]", ".", "fileType", ";", "var", "oRouter", "=", "UIComponent", ".", "getRouterFor", "(", "this", ")", ";", "this", ".", "sNamespace", "=", "(", "this", ".", "sNamespace", "?", "this", ".", "sNamespace", ":", "'/'", ")", ";", "if", "(", "sContentFileType", ")", "{", "// show details to a file", "var", "mRouteParameters", "=", "{", "\"layer\"", ":", "this", ".", "sLayer", ",", "\"namespace\"", ":", "encodeURIComponent", "(", "this", ".", "sNamespace", ")", ",", "\"fileName\"", ":", "sContentName", ",", "\"fileType\"", ":", "sContentFileType", "}", ";", "oRouter", ".", "navTo", "(", "\"ContentDetails\"", ",", "mRouteParameters", ")", ";", "}", "else", "{", "// navigation to a namespace", "this", ".", "sNamespace", "+=", "sContentName", "+", "'/'", ";", "oRouter", ".", "navTo", "(", "\"LayerContentMaster\"", ",", "{", "\"layer\"", ":", "this", ".", "sLayer", ",", "\"namespace\"", ":", "encodeURIComponent", "(", "this", ".", "sNamespace", ")", "}", ")", ";", "}", "}" ]
Handles the selection of a layer entry in the master page; Gathers the selected namespace and the current layer, then navigates to the target. @param {Object} oEvent - press event of master components list @public
[ "Handles", "the", "selection", "of", "a", "layer", "entry", "in", "the", "master", "page", ";", "Gathers", "the", "selected", "namespace", "and", "the", "current", "layer", "then", "navigates", "to", "the", "target", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.fl/src/sap/ui/fl/support/apps/contentbrowser/controller/LayerContentMaster.controller.js#L121-L146
4,252
SAP/openui5
src/sap.ui.fl/src/sap/ui/fl/support/apps/contentbrowser/controller/LayerContentMaster.controller.js
function () { var oRouter = UIComponent.getRouterFor(this); if (!this.sNamespace || this.sNamespace === "/") { oRouter.navTo("Layers"); } else { var sSplittedNamespace = this.sNamespace.split("/"); sSplittedNamespace.splice(-2, 1); var sTargetNamespace = sSplittedNamespace.join("/"); oRouter.navTo("LayerContentMaster", {"layer": this.sLayer, "namespace": encodeURIComponent(sTargetNamespace)}, true); } }
javascript
function () { var oRouter = UIComponent.getRouterFor(this); if (!this.sNamespace || this.sNamespace === "/") { oRouter.navTo("Layers"); } else { var sSplittedNamespace = this.sNamespace.split("/"); sSplittedNamespace.splice(-2, 1); var sTargetNamespace = sSplittedNamespace.join("/"); oRouter.navTo("LayerContentMaster", {"layer": this.sLayer, "namespace": encodeURIComponent(sTargetNamespace)}, true); } }
[ "function", "(", ")", "{", "var", "oRouter", "=", "UIComponent", ".", "getRouterFor", "(", "this", ")", ";", "if", "(", "!", "this", ".", "sNamespace", "||", "this", ".", "sNamespace", "===", "\"/\"", ")", "{", "oRouter", ".", "navTo", "(", "\"Layers\"", ")", ";", "}", "else", "{", "var", "sSplittedNamespace", "=", "this", ".", "sNamespace", ".", "split", "(", "\"/\"", ")", ";", "sSplittedNamespace", ".", "splice", "(", "-", "2", ",", "1", ")", ";", "var", "sTargetNamespace", "=", "sSplittedNamespace", ".", "join", "(", "\"/\"", ")", ";", "oRouter", ".", "navTo", "(", "\"LayerContentMaster\"", ",", "{", "\"layer\"", ":", "this", ".", "sLayer", ",", "\"namespace\"", ":", "encodeURIComponent", "(", "sTargetNamespace", ")", "}", ",", "true", ")", ";", "}", "}" ]
Handles the back navigation in the master list; Calculates the parent namespace, then navigates to the target. @public
[ "Handles", "the", "back", "navigation", "in", "the", "master", "list", ";", "Calculates", "the", "parent", "namespace", "then", "navigates", "to", "the", "target", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.fl/src/sap/ui/fl/support/apps/contentbrowser/controller/LayerContentMaster.controller.js#L153-L163
4,253
SAP/openui5
src/sap.ui.fl/src/sap/ui/fl/support/apps/contentbrowser/controller/LayerContentMaster.controller.js
function () { if (!this.sNamespace || this.sNamespace === '/') { return "[" + this.sLayer + "] /"; } var aSplittedNamespace = this.sNamespace.split('/'); var sNamespaceDepth = aSplittedNamespace.length; if (sNamespaceDepth > 2) { return "[" + this.sLayer + "] .../" + aSplittedNamespace[sNamespaceDepth - 2]; } return "[" + this.sLayer + "] /" + this.sNamespace[sNamespaceDepth - 1]; }
javascript
function () { if (!this.sNamespace || this.sNamespace === '/') { return "[" + this.sLayer + "] /"; } var aSplittedNamespace = this.sNamespace.split('/'); var sNamespaceDepth = aSplittedNamespace.length; if (sNamespaceDepth > 2) { return "[" + this.sLayer + "] .../" + aSplittedNamespace[sNamespaceDepth - 2]; } return "[" + this.sLayer + "] /" + this.sNamespace[sNamespaceDepth - 1]; }
[ "function", "(", ")", "{", "if", "(", "!", "this", ".", "sNamespace", "||", "this", ".", "sNamespace", "===", "'/'", ")", "{", "return", "\"[\"", "+", "this", ".", "sLayer", "+", "\"] /\"", ";", "}", "var", "aSplittedNamespace", "=", "this", ".", "sNamespace", ".", "split", "(", "'/'", ")", ";", "var", "sNamespaceDepth", "=", "aSplittedNamespace", ".", "length", ";", "if", "(", "sNamespaceDepth", ">", "2", ")", "{", "return", "\"[\"", "+", "this", ".", "sLayer", "+", "\"] .../\"", "+", "aSplittedNamespace", "[", "sNamespaceDepth", "-", "2", "]", ";", "}", "return", "\"[\"", "+", "this", ".", "sLayer", "+", "\"] /\"", "+", "this", ".", "sNamespace", "[", "sNamespaceDepth", "-", "1", "]", ";", "}" ]
Formatter to shorten namespaces with multiple hierarchies; If the hierarchy has more than two levels only the first and last levels are shown. @returns {String} - shortened namespace for display @private
[ "Formatter", "to", "shorten", "namespaces", "with", "multiple", "hierarchies", ";", "If", "the", "hierarchy", "has", "more", "than", "two", "levels", "only", "the", "first", "and", "last", "levels", "are", "shown", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.fl/src/sap/ui/fl/support/apps/contentbrowser/controller/LayerContentMaster.controller.js#L171-L183
4,254
SAP/openui5
src/sap.ui.fl/src/sap/ui/fl/support/apps/contentbrowser/controller/LayerContentMaster.controller.js
function (oEvent) { var sSource = oEvent.getSource(); sap.ui.require(["sap/ui/fl/support/apps/contentbrowser/utils/ErrorUtils"], function (ErrorUtils) { ErrorUtils.handleMessagePopoverPress(sSource); }); }
javascript
function (oEvent) { var sSource = oEvent.getSource(); sap.ui.require(["sap/ui/fl/support/apps/contentbrowser/utils/ErrorUtils"], function (ErrorUtils) { ErrorUtils.handleMessagePopoverPress(sSource); }); }
[ "function", "(", "oEvent", ")", "{", "var", "sSource", "=", "oEvent", ".", "getSource", "(", ")", ";", "sap", ".", "ui", ".", "require", "(", "[", "\"sap/ui/fl/support/apps/contentbrowser/utils/ErrorUtils\"", "]", ",", "function", "(", "ErrorUtils", ")", "{", "ErrorUtils", ".", "handleMessagePopoverPress", "(", "sSource", ")", ";", "}", ")", ";", "}" ]
Handler for displaying errors; Calls the "ErrorUtils" helper class for error handling. @param oEvent - press event on the error button @public
[ "Handler", "for", "displaying", "errors", ";", "Calls", "the", "ErrorUtils", "helper", "class", "for", "error", "handling", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.fl/src/sap/ui/fl/support/apps/contentbrowser/controller/LayerContentMaster.controller.js#L191-L196
4,255
SAP/openui5
src/sap.ui.rta/src/sap/ui/rta/plugin/additionalElements/AdditionalElementsPlugin.js
function(oOverlay) { var oModel = oOverlay.getElement().getModel(); if (oModel){ var oMetaModel = oModel.getMetaModel(); if (oMetaModel && oMetaModel.loaded){ oMetaModel.loaded().then(function(){ this.evaluateEditable([oOverlay], {onRegistration: true}); }.bind(this)); } } Plugin.prototype.registerElementOverlay.apply(this, arguments); }
javascript
function(oOverlay) { var oModel = oOverlay.getElement().getModel(); if (oModel){ var oMetaModel = oModel.getMetaModel(); if (oMetaModel && oMetaModel.loaded){ oMetaModel.loaded().then(function(){ this.evaluateEditable([oOverlay], {onRegistration: true}); }.bind(this)); } } Plugin.prototype.registerElementOverlay.apply(this, arguments); }
[ "function", "(", "oOverlay", ")", "{", "var", "oModel", "=", "oOverlay", ".", "getElement", "(", ")", ".", "getModel", "(", ")", ";", "if", "(", "oModel", ")", "{", "var", "oMetaModel", "=", "oModel", ".", "getMetaModel", "(", ")", ";", "if", "(", "oMetaModel", "&&", "oMetaModel", ".", "loaded", ")", "{", "oMetaModel", ".", "loaded", "(", ")", ".", "then", "(", "function", "(", ")", "{", "this", ".", "evaluateEditable", "(", "[", "oOverlay", "]", ",", "{", "onRegistration", ":", "true", "}", ")", ";", "}", ".", "bind", "(", "this", ")", ")", ";", "}", "}", "Plugin", ".", "prototype", ".", "registerElementOverlay", ".", "apply", "(", "this", ",", "arguments", ")", ";", "}" ]
Register an overlay If the MetaModel was not loaded yet when evaluating addODataProperty, the plugin returns editable = false. Therefore we must make an extra check after the MetaModel is loaded. @param {sap.ui.dt.Overlay} oOverlay overlay object @override
[ "Register", "an", "overlay", "If", "the", "MetaModel", "was", "not", "loaded", "yet", "when", "evaluating", "addODataProperty", "the", "plugin", "returns", "editable", "=", "false", ".", "Therefore", "we", "must", "make", "an", "extra", "check", "after", "the", "MetaModel", "is", "loaded", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.rta/src/sap/ui/rta/plugin/additionalElements/AdditionalElementsPlugin.js#L251-L262
4,256
SAP/openui5
src/sap.ui.rta/src/sap/ui/rta/plugin/additionalElements/AdditionalElementsPlugin.js
function (oEvent) { // open field ext ui var oUshellContainer = FlUtils.getUshellContainer(); var oCrossAppNav = oUshellContainer.getService("CrossApplicationNavigation"); var sHrefForFieldExtensionUi = (oCrossAppNav && oCrossAppNav.hrefForExternal({ target : { semanticObject : "CustomField", action : "develop" }, params : { businessContexts : this._oCurrentFieldExtInfo.BusinessContexts.map( function( oBusinessContext){ return oBusinessContext.BusinessContext; }), serviceName : this._oCurrentFieldExtInfo.ServiceName, serviceVersion : this._oCurrentFieldExtInfo.ServiceVersion, entityType : this._oCurrentFieldExtInfo.EntityType } })); Utils.openNewWindow(sHrefForFieldExtensionUi); }
javascript
function (oEvent) { // open field ext ui var oUshellContainer = FlUtils.getUshellContainer(); var oCrossAppNav = oUshellContainer.getService("CrossApplicationNavigation"); var sHrefForFieldExtensionUi = (oCrossAppNav && oCrossAppNav.hrefForExternal({ target : { semanticObject : "CustomField", action : "develop" }, params : { businessContexts : this._oCurrentFieldExtInfo.BusinessContexts.map( function( oBusinessContext){ return oBusinessContext.BusinessContext; }), serviceName : this._oCurrentFieldExtInfo.ServiceName, serviceVersion : this._oCurrentFieldExtInfo.ServiceVersion, entityType : this._oCurrentFieldExtInfo.EntityType } })); Utils.openNewWindow(sHrefForFieldExtensionUi); }
[ "function", "(", "oEvent", ")", "{", "// open field ext ui", "var", "oUshellContainer", "=", "FlUtils", ".", "getUshellContainer", "(", ")", ";", "var", "oCrossAppNav", "=", "oUshellContainer", ".", "getService", "(", "\"CrossApplicationNavigation\"", ")", ";", "var", "sHrefForFieldExtensionUi", "=", "(", "oCrossAppNav", "&&", "oCrossAppNav", ".", "hrefForExternal", "(", "{", "target", ":", "{", "semanticObject", ":", "\"CustomField\"", ",", "action", ":", "\"develop\"", "}", ",", "params", ":", "{", "businessContexts", ":", "this", ".", "_oCurrentFieldExtInfo", ".", "BusinessContexts", ".", "map", "(", "function", "(", "oBusinessContext", ")", "{", "return", "oBusinessContext", ".", "BusinessContext", ";", "}", ")", ",", "serviceName", ":", "this", ".", "_oCurrentFieldExtInfo", ".", "ServiceName", ",", "serviceVersion", ":", "this", ".", "_oCurrentFieldExtInfo", ".", "ServiceVersion", ",", "entityType", ":", "this", ".", "_oCurrentFieldExtInfo", ".", "EntityType", "}", "}", ")", ")", ";", "Utils", ".", "openNewWindow", "(", "sHrefForFieldExtensionUi", ")", ";", "}" ]
Function called when custom field button was pressed @param {sap.ui.base.Event} oEvent event object
[ "Function", "called", "when", "custom", "field", "button", "was", "pressed" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.rta/src/sap/ui/rta/plugin/additionalElements/AdditionalElementsPlugin.js#L598-L617
4,257
SAP/openui5
src/sap.ui.rta/src/sap/ui/rta/plugin/additionalElements/AdditionalElementsPlugin.js
function(oOverlay) { return { asSibling: this._isEditableCheck.call(this, oOverlay, true), asChild: this._isEditableCheck.call(this, oOverlay, false) }; }
javascript
function(oOverlay) { return { asSibling: this._isEditableCheck.call(this, oOverlay, true), asChild: this._isEditableCheck.call(this, oOverlay, false) }; }
[ "function", "(", "oOverlay", ")", "{", "return", "{", "asSibling", ":", "this", ".", "_isEditableCheck", ".", "call", "(", "this", ",", "oOverlay", ",", "true", ")", ",", "asChild", ":", "this", ".", "_isEditableCheck", ".", "call", "(", "this", ",", "oOverlay", ",", "false", ")", "}", ";", "}" ]
This function gets called on startup. It checks if the Overlay is editable by this plugin. @param {sap.ui.dt.Overlay} oOverlay - overlay to be checked @returns {object} Returns object with editable boolean values for "asChild" and "asSibling" @protected
[ "This", "function", "gets", "called", "on", "startup", ".", "It", "checks", "if", "the", "Overlay", "is", "editable", "by", "this", "plugin", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.rta/src/sap/ui/rta/plugin/additionalElements/AdditionalElementsPlugin.js#L897-L902
4,258
SAP/openui5
src/sap.ui.core/src/sap/ui/model/odata/v4/ODataMetaModel.js
addUrlForSchema
function addUrlForSchema(oMetaModel, sSchema, sReferenceUri, sDocumentUri) { var sUrl0, mUrls = oMetaModel.mSchema2MetadataUrl[sSchema]; if (!mUrls) { mUrls = oMetaModel.mSchema2MetadataUrl[sSchema] = {}; mUrls[sReferenceUri] = false; } else if (!(sReferenceUri in mUrls)) { sUrl0 = Object.keys(mUrls)[0]; if (mUrls[sUrl0]) { // document already processed, no different URLs allowed reportAndThrowError(oMetaModel, "A schema cannot span more than one document: " + sSchema + " - expected reference URI " + sUrl0 + " but instead saw " + sReferenceUri, sDocumentUri); } mUrls[sReferenceUri] = false; } }
javascript
function addUrlForSchema(oMetaModel, sSchema, sReferenceUri, sDocumentUri) { var sUrl0, mUrls = oMetaModel.mSchema2MetadataUrl[sSchema]; if (!mUrls) { mUrls = oMetaModel.mSchema2MetadataUrl[sSchema] = {}; mUrls[sReferenceUri] = false; } else if (!(sReferenceUri in mUrls)) { sUrl0 = Object.keys(mUrls)[0]; if (mUrls[sUrl0]) { // document already processed, no different URLs allowed reportAndThrowError(oMetaModel, "A schema cannot span more than one document: " + sSchema + " - expected reference URI " + sUrl0 + " but instead saw " + sReferenceUri, sDocumentUri); } mUrls[sReferenceUri] = false; } }
[ "function", "addUrlForSchema", "(", "oMetaModel", ",", "sSchema", ",", "sReferenceUri", ",", "sDocumentUri", ")", "{", "var", "sUrl0", ",", "mUrls", "=", "oMetaModel", ".", "mSchema2MetadataUrl", "[", "sSchema", "]", ";", "if", "(", "!", "mUrls", ")", "{", "mUrls", "=", "oMetaModel", ".", "mSchema2MetadataUrl", "[", "sSchema", "]", "=", "{", "}", ";", "mUrls", "[", "sReferenceUri", "]", "=", "false", ";", "}", "else", "if", "(", "!", "(", "sReferenceUri", "in", "mUrls", ")", ")", "{", "sUrl0", "=", "Object", ".", "keys", "(", "mUrls", ")", "[", "0", "]", ";", "if", "(", "mUrls", "[", "sUrl0", "]", ")", "{", "// document already processed, no different URLs allowed", "reportAndThrowError", "(", "oMetaModel", ",", "\"A schema cannot span more than one document: \"", "+", "sSchema", "+", "\" - expected reference URI \"", "+", "sUrl0", "+", "\" but instead saw \"", "+", "sReferenceUri", ",", "sDocumentUri", ")", ";", "}", "mUrls", "[", "sReferenceUri", "]", "=", "false", ";", "}", "}" ]
Adds the given reference URI to the map of reference URIs for schemas. @param {sap.ui.model.odata.v4.ODataMetaModel} oMetaModel The OData metadata model @param {string} sSchema A namespace of a schema, for example "foo.bar." @param {string} sReferenceUri A URI to the metadata document for the given schema @param {string} [sDocumentUri] The URI to the metadata document containing the given reference to the given schema @throws {Error} If the schema has already been loaded from a different URI
[ "Adds", "the", "given", "reference", "URI", "to", "the", "map", "of", "reference", "URIs", "for", "schemas", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/v4/ODataMetaModel.js#L111-L128
4,259
SAP/openui5
src/sap.ui.core/src/sap/ui/model/odata/v4/ODataMetaModel.js
getQualifier
function getQualifier(sTerm, sExpectedTerm) { if (sTerm === sExpectedTerm) { return ""; } if (sTerm.indexOf(sExpectedTerm) === 0 && sTerm[sExpectedTerm.length] === "#" && sTerm.indexOf("@", sExpectedTerm.length) < 0) { return sTerm.slice(sExpectedTerm.length + 1); } }
javascript
function getQualifier(sTerm, sExpectedTerm) { if (sTerm === sExpectedTerm) { return ""; } if (sTerm.indexOf(sExpectedTerm) === 0 && sTerm[sExpectedTerm.length] === "#" && sTerm.indexOf("@", sExpectedTerm.length) < 0) { return sTerm.slice(sExpectedTerm.length + 1); } }
[ "function", "getQualifier", "(", "sTerm", ",", "sExpectedTerm", ")", "{", "if", "(", "sTerm", "===", "sExpectedTerm", ")", "{", "return", "\"\"", ";", "}", "if", "(", "sTerm", ".", "indexOf", "(", "sExpectedTerm", ")", "===", "0", "&&", "sTerm", "[", "sExpectedTerm", ".", "length", "]", "===", "\"#\"", "&&", "sTerm", ".", "indexOf", "(", "\"@\"", ",", "sExpectedTerm", ".", "length", ")", "<", "0", ")", "{", "return", "sTerm", ".", "slice", "(", "sExpectedTerm", ".", "length", "+", "1", ")", ";", "}", "}" ]
Checks that the term is the expected term and determines the qualifier. @param {string} sTerm The term @param {string} sExpectedTerm The expected term @returns {string} The qualifier or undefined, if the term is not the expected term
[ "Checks", "that", "the", "term", "is", "the", "expected", "term", "and", "determines", "the", "qualifier", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/v4/ODataMetaModel.js#L221-L229
4,260
SAP/openui5
src/sap.ui.core/src/sap/ui/model/odata/v4/ODataMetaModel.js
getValueListQualifier
function getValueListQualifier(sTerm) { var sQualifier = getQualifier(sTerm, sValueListMapping); return sQualifier !== undefined ? sQualifier : getQualifier(sTerm, sValueList); }
javascript
function getValueListQualifier(sTerm) { var sQualifier = getQualifier(sTerm, sValueListMapping); return sQualifier !== undefined ? sQualifier : getQualifier(sTerm, sValueList); }
[ "function", "getValueListQualifier", "(", "sTerm", ")", "{", "var", "sQualifier", "=", "getQualifier", "(", "sTerm", ",", "sValueListMapping", ")", ";", "return", "sQualifier", "!==", "undefined", "?", "sQualifier", ":", "getQualifier", "(", "sTerm", ",", "sValueList", ")", ";", "}" ]
Checks that the term is a ValueList or a ValueListMapping and determines the qualifier. @param {string} sTerm The term @returns {string} The qualifier or undefined, if the term is not as expected
[ "Checks", "that", "the", "term", "is", "a", "ValueList", "or", "a", "ValueListMapping", "and", "determines", "the", "qualifier", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/v4/ODataMetaModel.js#L239-L243
4,261
SAP/openui5
src/sap.ui.core/src/sap/ui/model/odata/v4/ODataMetaModel.js
maybeParameter
function maybeParameter(sName, aOverloads) { return aOverloads.some(function (oOverload) { return oOverload.$Parameter && oOverload.$Parameter.some(function (oParameter) { return oParameter.$Name === sName; }); }); }
javascript
function maybeParameter(sName, aOverloads) { return aOverloads.some(function (oOverload) { return oOverload.$Parameter && oOverload.$Parameter.some(function (oParameter) { return oParameter.$Name === sName; }); }); }
[ "function", "maybeParameter", "(", "sName", ",", "aOverloads", ")", "{", "return", "aOverloads", ".", "some", "(", "function", "(", "oOverload", ")", "{", "return", "oOverload", ".", "$Parameter", "&&", "oOverload", ".", "$Parameter", ".", "some", "(", "function", "(", "oParameter", ")", "{", "return", "oParameter", ".", "$Name", "===", "sName", ";", "}", ")", ";", "}", ")", ";", "}" ]
Tells whether the given name matches a parameter of at least one of the given overloads. @param {string} sName A path segment which maybe is a parameter name @param {object[]} aOverloads Operation overload(s) @returns {boolean} <code>true</code> iff at least one of the given overloads has a parameter with the given name.
[ "Tells", "whether", "the", "given", "name", "matches", "a", "parameter", "of", "at", "least", "one", "of", "the", "given", "overloads", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/v4/ODataMetaModel.js#L256-L262
4,262
SAP/openui5
src/sap.ui.core/src/sap/ui/model/odata/v4/ODataMetaModel.js
reportAndThrowError
function reportAndThrowError(oMetaModel, sMessage, sDetails) { var oError = new Error(sDetails + ": " + sMessage); oMetaModel.oModel.reportError(sMessage, sODataMetaModel, oError); throw oError; }
javascript
function reportAndThrowError(oMetaModel, sMessage, sDetails) { var oError = new Error(sDetails + ": " + sMessage); oMetaModel.oModel.reportError(sMessage, sODataMetaModel, oError); throw oError; }
[ "function", "reportAndThrowError", "(", "oMetaModel", ",", "sMessage", ",", "sDetails", ")", "{", "var", "oError", "=", "new", "Error", "(", "sDetails", "+", "\": \"", "+", "sMessage", ")", ";", "oMetaModel", ".", "oModel", ".", "reportError", "(", "sMessage", ",", "sODataMetaModel", ",", "oError", ")", ";", "throw", "oError", ";", "}" ]
Reports an error with the given message and details and throws it. @param {sap.ui.model.odata.v4.ODataMetaModel} oMetaModel The OData metadata model @param {string} sMessage Error message @param {string} sDetails Error details @throws {Error}
[ "Reports", "an", "error", "with", "the", "given", "message", "and", "details", "and", "throws", "it", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/v4/ODataMetaModel.js#L316-L321
4,263
SAP/openui5
src/sap.ui.core/src/sap/ui/model/odata/v4/ODataMetaModel.js
function () { var aContexts = [], oPromise = this.fetchContexts(), that = this; if (oPromise.isFulfilled()) { aContexts = oPromise.getResult(); } else { oPromise.then(function (aContexts) { that.setContexts(aContexts); that._fireChange({reason: ChangeReason.Change}); }); aContexts.dataRequested = true; } this.setContexts(aContexts); }
javascript
function () { var aContexts = [], oPromise = this.fetchContexts(), that = this; if (oPromise.isFulfilled()) { aContexts = oPromise.getResult(); } else { oPromise.then(function (aContexts) { that.setContexts(aContexts); that._fireChange({reason: ChangeReason.Change}); }); aContexts.dataRequested = true; } this.setContexts(aContexts); }
[ "function", "(", ")", "{", "var", "aContexts", "=", "[", "]", ",", "oPromise", "=", "this", ".", "fetchContexts", "(", ")", ",", "that", "=", "this", ";", "if", "(", "oPromise", ".", "isFulfilled", "(", ")", ")", "{", "aContexts", "=", "oPromise", ".", "getResult", "(", ")", ";", "}", "else", "{", "oPromise", ".", "then", "(", "function", "(", "aContexts", ")", "{", "that", ".", "setContexts", "(", "aContexts", ")", ";", "that", ".", "_fireChange", "(", "{", "reason", ":", "ChangeReason", ".", "Change", "}", ")", ";", "}", ")", ";", "aContexts", ".", "dataRequested", "=", "true", ";", "}", "this", ".", "setContexts", "(", "aContexts", ")", ";", "}" ]
Updates the list and indices array. Fires a change event if the data was retrieved asynchronously. @private
[ "Updates", "the", "list", "and", "indices", "array", ".", "Fires", "a", "change", "event", "if", "the", "data", "was", "retrieved", "asynchronously", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/v4/ODataMetaModel.js#L499-L514
4,264
SAP/openui5
src/sap.ui.core/src/sap/ui/model/odata/v4/ODataMetaModel.js
prepareKeyPredicate
function prepareKeyPredicate(sSegment) { aEditUrl.push({path : sInstancePath, prefix : sSegment, type : oType}); }
javascript
function prepareKeyPredicate(sSegment) { aEditUrl.push({path : sInstancePath, prefix : sSegment, type : oType}); }
[ "function", "prepareKeyPredicate", "(", "sSegment", ")", "{", "aEditUrl", ".", "push", "(", "{", "path", ":", "sInstancePath", ",", "prefix", ":", "sSegment", ",", "type", ":", "oType", "}", ")", ";", "}" ]
Pushes a request to append the key predicate for oType and the instance at sInstancePath. Does not calculate it yet, because it might be replaced again later.
[ "Pushes", "a", "request", "to", "append", "the", "key", "predicate", "for", "oType", "and", "the", "instance", "at", "sInstancePath", ".", "Does", "not", "calculate", "it", "yet", "because", "it", "might", "be", "replaced", "again", "later", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/v4/ODataMetaModel.js#L1557-L1559
4,265
SAP/openui5
src/sap.ui.core/src/sap/ui/model/odata/v4/ODataMetaModel.js
stripPredicate
function stripPredicate(sSegment) { var i = sSegment.indexOf("("); return i >= 0 ? sSegment.slice(0, i) : sSegment; }
javascript
function stripPredicate(sSegment) { var i = sSegment.indexOf("("); return i >= 0 ? sSegment.slice(0, i) : sSegment; }
[ "function", "stripPredicate", "(", "sSegment", ")", "{", "var", "i", "=", "sSegment", ".", "indexOf", "(", "\"(\"", ")", ";", "return", "i", ">=", "0", "?", "sSegment", ".", "slice", "(", "0", ",", "i", ")", ":", "sSegment", ";", "}" ]
Strips off the predicate from a segment
[ "Strips", "off", "the", "predicate", "from", "a", "segment" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/v4/ODataMetaModel.js#L1562-L1565
4,266
SAP/openui5
src/sap.ui.core/src/sap/ui/model/odata/v4/ODataMetaModel.js
pushToEditUrl
function pushToEditUrl(sSegment) { if (sSegment.includes("($uid=")) { prepareKeyPredicate(stripPredicate(sSegment)); } else { aEditUrl.push(sSegment); } }
javascript
function pushToEditUrl(sSegment) { if (sSegment.includes("($uid=")) { prepareKeyPredicate(stripPredicate(sSegment)); } else { aEditUrl.push(sSegment); } }
[ "function", "pushToEditUrl", "(", "sSegment", ")", "{", "if", "(", "sSegment", ".", "includes", "(", "\"($uid=\"", ")", ")", "{", "prepareKeyPredicate", "(", "stripPredicate", "(", "sSegment", ")", ")", ";", "}", "else", "{", "aEditUrl", ".", "push", "(", "sSegment", ")", ";", "}", "}" ]
The segment is added to the edit URL; transient predicate is converted to real predicate
[ "The", "segment", "is", "added", "to", "the", "edit", "URL", ";", "transient", "predicate", "is", "converted", "to", "real", "predicate" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/v4/ODataMetaModel.js#L1569-L1575
4,267
SAP/openui5
src/sap.ui.documentation/src/sap/ui/documentation/sdk/controller/SearchPage.controller.js
function () { var oView = this.getView(), // Collect all possible items from all lists aItems = [].concat( oView.byId("allList").getItems(), oView.byId("apiList").getItems(), oView.byId("documentationList").getItems(), oView.byId("samplesList").getItems() ), iLen = aItems.length, oItem; while (iLen--) { oItem = aItems[iLen]; // Access control lazy loading method if available if (oItem._getLinkSender) { // Set link href to allow open in new window functionality oItem._getLinkSender().setHref("#/" + oItem.getCustomData()[0].getValue()); } } }
javascript
function () { var oView = this.getView(), // Collect all possible items from all lists aItems = [].concat( oView.byId("allList").getItems(), oView.byId("apiList").getItems(), oView.byId("documentationList").getItems(), oView.byId("samplesList").getItems() ), iLen = aItems.length, oItem; while (iLen--) { oItem = aItems[iLen]; // Access control lazy loading method if available if (oItem._getLinkSender) { // Set link href to allow open in new window functionality oItem._getLinkSender().setHref("#/" + oItem.getCustomData()[0].getValue()); } } }
[ "function", "(", ")", "{", "var", "oView", "=", "this", ".", "getView", "(", ")", ",", "// Collect all possible items from all lists", "aItems", "=", "[", "]", ".", "concat", "(", "oView", ".", "byId", "(", "\"allList\"", ")", ".", "getItems", "(", ")", ",", "oView", ".", "byId", "(", "\"apiList\"", ")", ".", "getItems", "(", ")", ",", "oView", ".", "byId", "(", "\"documentationList\"", ")", ".", "getItems", "(", ")", ",", "oView", ".", "byId", "(", "\"samplesList\"", ")", ".", "getItems", "(", ")", ")", ",", "iLen", "=", "aItems", ".", "length", ",", "oItem", ";", "while", "(", "iLen", "--", ")", "{", "oItem", "=", "aItems", "[", "iLen", "]", ";", "// Access control lazy loading method if available", "if", "(", "oItem", ".", "_getLinkSender", ")", "{", "// Set link href to allow open in new window functionality", "oItem", ".", "_getLinkSender", "(", ")", ".", "setHref", "(", "\"#/\"", "+", "oItem", ".", "getCustomData", "(", ")", "[", "0", "]", ".", "getValue", "(", ")", ")", ";", "}", "}", "}" ]
Modify all search result links @private
[ "Modify", "all", "search", "result", "links" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.documentation/src/sap/ui/documentation/sdk/controller/SearchPage.controller.js#L232-L252
4,268
SAP/openui5
src/sap.ui.unified/src/sap/ui/unified/CalendarMonthInterval.js
_showYearPicker
function _showYearPicker(){ var oDate = this._getFocusedDate(); var oYearPicker = this.getAggregation("yearPicker"); if (oYearPicker.getDomRef()) { // already rendered oYearPicker.$().css("display", ""); } else { var oRm = sap.ui.getCore().createRenderManager(); var $Container = this.$("content"); oRm.renderControl(oYearPicker); oRm.flush($Container[0], false, true); // insert it oRm.destroy(); } this._showOverlay(); oYearPicker.setDate(oDate.toLocalJSDate()); if (this._iMode == 0) { // remove tabindex from month var oMonthsRow = this.getAggregation("monthsRow"); jQuery(oMonthsRow._oItemNavigation.getItemDomRefs()[oMonthsRow._oItemNavigation.getFocusedIndex()]).attr("tabindex", "-1"); } _togglePrevNexYearPicker.call(this); this._iMode = 1; }
javascript
function _showYearPicker(){ var oDate = this._getFocusedDate(); var oYearPicker = this.getAggregation("yearPicker"); if (oYearPicker.getDomRef()) { // already rendered oYearPicker.$().css("display", ""); } else { var oRm = sap.ui.getCore().createRenderManager(); var $Container = this.$("content"); oRm.renderControl(oYearPicker); oRm.flush($Container[0], false, true); // insert it oRm.destroy(); } this._showOverlay(); oYearPicker.setDate(oDate.toLocalJSDate()); if (this._iMode == 0) { // remove tabindex from month var oMonthsRow = this.getAggregation("monthsRow"); jQuery(oMonthsRow._oItemNavigation.getItemDomRefs()[oMonthsRow._oItemNavigation.getFocusedIndex()]).attr("tabindex", "-1"); } _togglePrevNexYearPicker.call(this); this._iMode = 1; }
[ "function", "_showYearPicker", "(", ")", "{", "var", "oDate", "=", "this", ".", "_getFocusedDate", "(", ")", ";", "var", "oYearPicker", "=", "this", ".", "getAggregation", "(", "\"yearPicker\"", ")", ";", "if", "(", "oYearPicker", ".", "getDomRef", "(", ")", ")", "{", "// already rendered", "oYearPicker", ".", "$", "(", ")", ".", "css", "(", "\"display\"", ",", "\"\"", ")", ";", "}", "else", "{", "var", "oRm", "=", "sap", ".", "ui", ".", "getCore", "(", ")", ".", "createRenderManager", "(", ")", ";", "var", "$Container", "=", "this", ".", "$", "(", "\"content\"", ")", ";", "oRm", ".", "renderControl", "(", "oYearPicker", ")", ";", "oRm", ".", "flush", "(", "$Container", "[", "0", "]", ",", "false", ",", "true", ")", ";", "// insert it", "oRm", ".", "destroy", "(", ")", ";", "}", "this", ".", "_showOverlay", "(", ")", ";", "oYearPicker", ".", "setDate", "(", "oDate", ".", "toLocalJSDate", "(", ")", ")", ";", "if", "(", "this", ".", "_iMode", "==", "0", ")", "{", "// remove tabindex from month", "var", "oMonthsRow", "=", "this", ".", "getAggregation", "(", "\"monthsRow\"", ")", ";", "jQuery", "(", "oMonthsRow", ".", "_oItemNavigation", ".", "getItemDomRefs", "(", ")", "[", "oMonthsRow", ".", "_oItemNavigation", ".", "getFocusedIndex", "(", ")", "]", ")", ".", "attr", "(", "\"tabindex\"", ",", "\"-1\"", ")", ";", "}", "_togglePrevNexYearPicker", ".", "call", "(", "this", ")", ";", "this", ".", "_iMode", "=", "1", ";", "}" ]
Opens the year picker. This function assumes its called when a yearPicker aggregation is available, so the caller must take care for it. @private @returns {void}
[ "Opens", "the", "year", "picker", ".", "This", "function", "assumes", "its", "called", "when", "a", "yearPicker", "aggregation", "is", "available", "so", "the", "caller", "must", "take", "care", "for", "it", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.unified/src/sap/ui/unified/CalendarMonthInterval.js#L1074-L1103
4,269
SAP/openui5
src/sap.ui.core/src/sap/ui/model/odata/v4/ODataListBinding.js
replaceLambdaVariables
function replaceLambdaVariables(sPath, mLambdaVariableToPath) { var aSegments = sPath.split("/"); aSegments[0] = mLambdaVariableToPath[aSegments[0]]; return aSegments[0] ? aSegments.join("/") : sPath; }
javascript
function replaceLambdaVariables(sPath, mLambdaVariableToPath) { var aSegments = sPath.split("/"); aSegments[0] = mLambdaVariableToPath[aSegments[0]]; return aSegments[0] ? aSegments.join("/") : sPath; }
[ "function", "replaceLambdaVariables", "(", "sPath", ",", "mLambdaVariableToPath", ")", "{", "var", "aSegments", "=", "sPath", ".", "split", "(", "\"/\"", ")", ";", "aSegments", "[", "0", "]", "=", "mLambdaVariableToPath", "[", "aSegments", "[", "0", "]", "]", ";", "return", "aSegments", "[", "0", "]", "?", "aSegments", ".", "join", "(", "\"/\"", ")", ":", "sPath", ";", "}" ]
Replaces an optional lambda variable in the first segment of the given path by the correct path. @param {string} sPath The path with an optional lambda variable at the beginning @param {object} mLambdaVariableToPath The map from lambda variable to full path @returns {string} The path with replaced lambda variable
[ "Replaces", "an", "optional", "lambda", "variable", "in", "the", "first", "segment", "of", "the", "given", "path", "by", "the", "correct", "path", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/v4/ODataListBinding.js#L968-L973
4,270
SAP/openui5
src/sap.ui.table/src/sap/ui/table/TableColumnUtils.js
function(oTable) { return { columnCount: oTable.getColumns().length, visibleColumnCount: TableColumnUtils.TableUtils.getVisibleColumnCount(oTable), columnMap: TableColumnUtils.getColumnMap(oTable) }; }
javascript
function(oTable) { return { columnCount: oTable.getColumns().length, visibleColumnCount: TableColumnUtils.TableUtils.getVisibleColumnCount(oTable), columnMap: TableColumnUtils.getColumnMap(oTable) }; }
[ "function", "(", "oTable", ")", "{", "return", "{", "columnCount", ":", "oTable", ".", "getColumns", "(", ")", ".", "length", ",", "visibleColumnCount", ":", "TableColumnUtils", ".", "TableUtils", ".", "getVisibleColumnCount", "(", "oTable", ")", ",", "columnMap", ":", "TableColumnUtils", ".", "getColumnMap", "(", "oTable", ")", "}", ";", "}" ]
Collects and returns column info. @param {sap.ui.table.Table} oTable Instance of the table. @returns {ColumnInfo} Map of detailed column information. @private
[ "Collects", "and", "returns", "column", "info", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/TableColumnUtils.js#L74-L80
4,271
SAP/openui5
src/sap.ui.table/src/sap/ui/table/TableColumnUtils.js
function(oTable) { var i; var oColumn; var oColumnMapItem = {}; var oColumnMap = {}; var aColumns = oTable.getColumns(); var iMaxLevel = TableColumnUtils.TableUtils.getHeaderRowCount(oTable); var oParentReferences = {}; for (var iColumnIndex = 0; iColumnIndex < aColumns.length; iColumnIndex++) { oColumn = aColumns[iColumnIndex]; oColumnMapItem = {}; oColumnMapItem.id = oColumn.getId(); oColumnMapItem.column = oColumn; oColumnMapItem.levelInfo = []; oColumnMapItem.parents = []; for (var iLevel = 0; iLevel < iMaxLevel; iLevel++) { oColumnMapItem.levelInfo[iLevel] = {}; oColumnMapItem.levelInfo[iLevel].spannedColumns = []; var iHeaderSpan = TableColumnUtils.getHeaderSpan(oColumn, iLevel); // collect columns which are spanned by the current column for (i = 1; i < iHeaderSpan; i++) { var oSpannedColumn = aColumns[iColumnIndex + i]; if (oSpannedColumn) { var sPannedColumnId = oSpannedColumn.getId(); oColumnMapItem.levelInfo[iLevel].spannedColumns.push(aColumns[iColumnIndex + i]); if (!oParentReferences[sPannedColumnId]) { oParentReferences[sPannedColumnId] = []; } oParentReferences[sPannedColumnId].push({column: oColumn, level: iLevel}); } } } oColumnMap[oColumnMapItem.id] = oColumnMapItem; } var aColumnIds = Object.keys(oParentReferences); for (i = 0; i < aColumnIds.length; i++) { var sColumnId = aColumnIds[i]; oColumnMap[sColumnId].parents = oParentReferences[sColumnId]; } return oColumnMap; }
javascript
function(oTable) { var i; var oColumn; var oColumnMapItem = {}; var oColumnMap = {}; var aColumns = oTable.getColumns(); var iMaxLevel = TableColumnUtils.TableUtils.getHeaderRowCount(oTable); var oParentReferences = {}; for (var iColumnIndex = 0; iColumnIndex < aColumns.length; iColumnIndex++) { oColumn = aColumns[iColumnIndex]; oColumnMapItem = {}; oColumnMapItem.id = oColumn.getId(); oColumnMapItem.column = oColumn; oColumnMapItem.levelInfo = []; oColumnMapItem.parents = []; for (var iLevel = 0; iLevel < iMaxLevel; iLevel++) { oColumnMapItem.levelInfo[iLevel] = {}; oColumnMapItem.levelInfo[iLevel].spannedColumns = []; var iHeaderSpan = TableColumnUtils.getHeaderSpan(oColumn, iLevel); // collect columns which are spanned by the current column for (i = 1; i < iHeaderSpan; i++) { var oSpannedColumn = aColumns[iColumnIndex + i]; if (oSpannedColumn) { var sPannedColumnId = oSpannedColumn.getId(); oColumnMapItem.levelInfo[iLevel].spannedColumns.push(aColumns[iColumnIndex + i]); if (!oParentReferences[sPannedColumnId]) { oParentReferences[sPannedColumnId] = []; } oParentReferences[sPannedColumnId].push({column: oColumn, level: iLevel}); } } } oColumnMap[oColumnMapItem.id] = oColumnMapItem; } var aColumnIds = Object.keys(oParentReferences); for (i = 0; i < aColumnIds.length; i++) { var sColumnId = aColumnIds[i]; oColumnMap[sColumnId].parents = oParentReferences[sColumnId]; } return oColumnMap; }
[ "function", "(", "oTable", ")", "{", "var", "i", ";", "var", "oColumn", ";", "var", "oColumnMapItem", "=", "{", "}", ";", "var", "oColumnMap", "=", "{", "}", ";", "var", "aColumns", "=", "oTable", ".", "getColumns", "(", ")", ";", "var", "iMaxLevel", "=", "TableColumnUtils", ".", "TableUtils", ".", "getHeaderRowCount", "(", "oTable", ")", ";", "var", "oParentReferences", "=", "{", "}", ";", "for", "(", "var", "iColumnIndex", "=", "0", ";", "iColumnIndex", "<", "aColumns", ".", "length", ";", "iColumnIndex", "++", ")", "{", "oColumn", "=", "aColumns", "[", "iColumnIndex", "]", ";", "oColumnMapItem", "=", "{", "}", ";", "oColumnMapItem", ".", "id", "=", "oColumn", ".", "getId", "(", ")", ";", "oColumnMapItem", ".", "column", "=", "oColumn", ";", "oColumnMapItem", ".", "levelInfo", "=", "[", "]", ";", "oColumnMapItem", ".", "parents", "=", "[", "]", ";", "for", "(", "var", "iLevel", "=", "0", ";", "iLevel", "<", "iMaxLevel", ";", "iLevel", "++", ")", "{", "oColumnMapItem", ".", "levelInfo", "[", "iLevel", "]", "=", "{", "}", ";", "oColumnMapItem", ".", "levelInfo", "[", "iLevel", "]", ".", "spannedColumns", "=", "[", "]", ";", "var", "iHeaderSpan", "=", "TableColumnUtils", ".", "getHeaderSpan", "(", "oColumn", ",", "iLevel", ")", ";", "// collect columns which are spanned by the current column", "for", "(", "i", "=", "1", ";", "i", "<", "iHeaderSpan", ";", "i", "++", ")", "{", "var", "oSpannedColumn", "=", "aColumns", "[", "iColumnIndex", "+", "i", "]", ";", "if", "(", "oSpannedColumn", ")", "{", "var", "sPannedColumnId", "=", "oSpannedColumn", ".", "getId", "(", ")", ";", "oColumnMapItem", ".", "levelInfo", "[", "iLevel", "]", ".", "spannedColumns", ".", "push", "(", "aColumns", "[", "iColumnIndex", "+", "i", "]", ")", ";", "if", "(", "!", "oParentReferences", "[", "sPannedColumnId", "]", ")", "{", "oParentReferences", "[", "sPannedColumnId", "]", "=", "[", "]", ";", "}", "oParentReferences", "[", "sPannedColumnId", "]", ".", "push", "(", "{", "column", ":", "oColumn", ",", "level", ":", "iLevel", "}", ")", ";", "}", "}", "}", "oColumnMap", "[", "oColumnMapItem", ".", "id", "]", "=", "oColumnMapItem", ";", "}", "var", "aColumnIds", "=", "Object", ".", "keys", "(", "oParentReferences", ")", ";", "for", "(", "i", "=", "0", ";", "i", "<", "aColumnIds", ".", "length", ";", "i", "++", ")", "{", "var", "sColumnId", "=", "aColumnIds", "[", "i", "]", ";", "oColumnMap", "[", "sColumnId", "]", ".", "parents", "=", "oParentReferences", "[", "sColumnId", "]", ";", "}", "return", "oColumnMap", ";", "}" ]
Collects and returns information about the current column configuration of the table. @param {sap.ui.table.Table} oTable Instance of the table. @type {Object} ColumnMapItemLevelInfo @type {sap.ui.table.Column[]} ColumnMapItemLevelInfo.spannedColumns Array of columns which are spanned by the source column @type {Object} ColumnMapItemParents @type {sap.ui.table.Column} ColumnMapItemParents.column Column reference @type {int} ColumnMapItemParents.level Level as which the parent resides @type {Object} ColumnMapItem @type {string} oColumnMapItem.id Column ID @type {sap.ui.table.Column} oColumnManItem.column Column instance @type {ColumnMapItemLevelInfo[]} oColumnMapItem.levelInfo Array of level information. Each index represents one level of headers @type {ColumnMapItemParents[]} oColumnMapItem.parents Array of parents of the source column @type {Object.<string, ColumnMapItem>} ColumnMap @type {ColumnMapItem} ColumnMap.<columnID> Object with information about column where the column ID is the key @returns {ColumnMap} Map of column information where the key is the column ID, @private
[ "Collects", "and", "returns", "information", "about", "the", "current", "column", "configuration", "of", "the", "table", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/TableColumnUtils.js#L106-L154
4,272
SAP/openui5
src/sap.ui.table/src/sap/ui/table/TableColumnUtils.js
function(oTable, sColumnId, iLevel) { var oColumnMapItem = TableColumnUtils.getColumnMapItem(oTable, sColumnId); if (!oColumnMapItem) { return undefined; } var aParents = []; for (var i = 0; i < oColumnMapItem.parents.length; i++) { var oParent = oColumnMapItem.parents[i]; if (iLevel === undefined || oParent.level === iLevel) { aParents.push(oParent); } } return aParents; }
javascript
function(oTable, sColumnId, iLevel) { var oColumnMapItem = TableColumnUtils.getColumnMapItem(oTable, sColumnId); if (!oColumnMapItem) { return undefined; } var aParents = []; for (var i = 0; i < oColumnMapItem.parents.length; i++) { var oParent = oColumnMapItem.parents[i]; if (iLevel === undefined || oParent.level === iLevel) { aParents.push(oParent); } } return aParents; }
[ "function", "(", "oTable", ",", "sColumnId", ",", "iLevel", ")", "{", "var", "oColumnMapItem", "=", "TableColumnUtils", ".", "getColumnMapItem", "(", "oTable", ",", "sColumnId", ")", ";", "if", "(", "!", "oColumnMapItem", ")", "{", "return", "undefined", ";", "}", "var", "aParents", "=", "[", "]", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "oColumnMapItem", ".", "parents", ".", "length", ";", "i", "++", ")", "{", "var", "oParent", "=", "oColumnMapItem", ".", "parents", "[", "i", "]", ";", "if", "(", "iLevel", "===", "undefined", "||", "oParent", ".", "level", "===", "iLevel", ")", "{", "aParents", ".", "push", "(", "oParent", ")", ";", "}", "}", "return", "aParents", ";", "}" ]
Returns an array of the column information about all columns which span the column identified by sColumnId. If there is no "parent", it returns undefined. @param {sap.ui.table.Table} oTable Instance of the table. @param {string} sColumnId ID of the column for which the Span-parent shall be found. @param {int} [iLevel] Level where the parent is looked up. @returns {Array.<{column: sap.ui.table.Column, level: int}>|undefined} Array of column information.
[ "Returns", "an", "array", "of", "the", "column", "information", "about", "all", "columns", "which", "span", "the", "column", "identified", "by", "sColumnId", ".", "If", "there", "is", "no", "parent", "it", "returns", "undefined", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/TableColumnUtils.js#L183-L198
4,273
SAP/openui5
src/sap.ui.table/src/sap/ui/table/TableColumnUtils.js
function(oTable, sColumnId, iLevel) { var oColumnMapItem = TableColumnUtils.getColumnMapItem(oTable, sColumnId); if (!oColumnMapItem) { return undefined; } var aChildren = []; var iEnd; if (iLevel === undefined) { iEnd = oColumnMapItem.levelInfo.length; } else { iEnd = iLevel + 1; } for (var i = iLevel || 0; i < iEnd; i++) { var oLevelInfo = oColumnMapItem.levelInfo[i]; for (var j = 0; j < oLevelInfo.spannedColumns.length; j++) { aChildren.push({column: oLevelInfo.spannedColumns[j], level: i}); } } return aChildren; }
javascript
function(oTable, sColumnId, iLevel) { var oColumnMapItem = TableColumnUtils.getColumnMapItem(oTable, sColumnId); if (!oColumnMapItem) { return undefined; } var aChildren = []; var iEnd; if (iLevel === undefined) { iEnd = oColumnMapItem.levelInfo.length; } else { iEnd = iLevel + 1; } for (var i = iLevel || 0; i < iEnd; i++) { var oLevelInfo = oColumnMapItem.levelInfo[i]; for (var j = 0; j < oLevelInfo.spannedColumns.length; j++) { aChildren.push({column: oLevelInfo.spannedColumns[j], level: i}); } } return aChildren; }
[ "function", "(", "oTable", ",", "sColumnId", ",", "iLevel", ")", "{", "var", "oColumnMapItem", "=", "TableColumnUtils", ".", "getColumnMapItem", "(", "oTable", ",", "sColumnId", ")", ";", "if", "(", "!", "oColumnMapItem", ")", "{", "return", "undefined", ";", "}", "var", "aChildren", "=", "[", "]", ";", "var", "iEnd", ";", "if", "(", "iLevel", "===", "undefined", ")", "{", "iEnd", "=", "oColumnMapItem", ".", "levelInfo", ".", "length", ";", "}", "else", "{", "iEnd", "=", "iLevel", "+", "1", ";", "}", "for", "(", "var", "i", "=", "iLevel", "||", "0", ";", "i", "<", "iEnd", ";", "i", "++", ")", "{", "var", "oLevelInfo", "=", "oColumnMapItem", ".", "levelInfo", "[", "i", "]", ";", "for", "(", "var", "j", "=", "0", ";", "j", "<", "oLevelInfo", ".", "spannedColumns", ".", "length", ";", "j", "++", ")", "{", "aChildren", ".", "push", "(", "{", "column", ":", "oLevelInfo", ".", "spannedColumns", "[", "j", "]", ",", "level", ":", "i", "}", ")", ";", "}", "}", "return", "aChildren", ";", "}" ]
Returns an array of the column information about all columns which are spanned by the column identified by sColumnId. If there is no "parent", it returns undefined. @param {sap.ui.table.Table} oTable Instance of the table. @param {string} sColumnId ID of the column for which the Span-parent shall be found. @param {int} [iLevel] level where the parent is looked up. @returns {Array.<{column: sap.ui.table.Column, level: int}>|undefined} Array of column information. @private
[ "Returns", "an", "array", "of", "the", "column", "information", "about", "all", "columns", "which", "are", "spanned", "by", "the", "column", "identified", "by", "sColumnId", ".", "If", "there", "is", "no", "parent", "it", "returns", "undefined", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/TableColumnUtils.js#L210-L232
4,274
SAP/openui5
src/sap.ui.table/src/sap/ui/table/TableColumnUtils.js
function(oColumn) { var oTable = oColumn.getParent(); if (!oTable || !oTable.getEnableColumnReordering()) { // Column reordering is not active at all return false; } var iCurrentIndex = oTable.indexOfColumn(oColumn); if (iCurrentIndex < oTable.getComputedFixedColumnCount() || iCurrentIndex < oTable._iFirstReorderableIndex) { // No movement of fixed columns or e.g. the first column in the TreeTable return false; } if (TableColumnUtils.hasHeaderSpan(oColumn) || TableColumnUtils.getParentSpannedColumns(oTable, oColumn.getId()).length != 0) { // No movement if the column is spanned by an other column or itself defines a span return false; } return true; }
javascript
function(oColumn) { var oTable = oColumn.getParent(); if (!oTable || !oTable.getEnableColumnReordering()) { // Column reordering is not active at all return false; } var iCurrentIndex = oTable.indexOfColumn(oColumn); if (iCurrentIndex < oTable.getComputedFixedColumnCount() || iCurrentIndex < oTable._iFirstReorderableIndex) { // No movement of fixed columns or e.g. the first column in the TreeTable return false; } if (TableColumnUtils.hasHeaderSpan(oColumn) || TableColumnUtils.getParentSpannedColumns(oTable, oColumn.getId()).length != 0) { // No movement if the column is spanned by an other column or itself defines a span return false; } return true; }
[ "function", "(", "oColumn", ")", "{", "var", "oTable", "=", "oColumn", ".", "getParent", "(", ")", ";", "if", "(", "!", "oTable", "||", "!", "oTable", ".", "getEnableColumnReordering", "(", ")", ")", "{", "// Column reordering is not active at all", "return", "false", ";", "}", "var", "iCurrentIndex", "=", "oTable", ".", "indexOfColumn", "(", "oColumn", ")", ";", "if", "(", "iCurrentIndex", "<", "oTable", ".", "getComputedFixedColumnCount", "(", ")", "||", "iCurrentIndex", "<", "oTable", ".", "_iFirstReorderableIndex", ")", "{", "// No movement of fixed columns or e.g. the first column in the TreeTable", "return", "false", ";", "}", "if", "(", "TableColumnUtils", ".", "hasHeaderSpan", "(", "oColumn", ")", "||", "TableColumnUtils", ".", "getParentSpannedColumns", "(", "oTable", ",", "oColumn", ".", "getId", "(", ")", ")", ".", "length", "!=", "0", ")", "{", "// No movement if the column is spanned by an other column or itself defines a span", "return", "false", ";", "}", "return", "true", ";", "}" ]
Returns true if the column can be moved to another position. @param {sap.ui.table.Column} oColumn Column of the table. @returns {boolean} Whether the column can be moved to another position.
[ "Returns", "true", "if", "the", "column", "can", "be", "moved", "to", "another", "position", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/TableColumnUtils.js#L386-L406
4,275
SAP/openui5
src/sap.ui.table/src/sap/ui/table/TableColumnUtils.js
function(oColumn, iNewIndex) { var oTable = oColumn.getParent(), iCurrentIndex = oTable.indexOfColumn(oColumn), aColumns = oTable.getColumns(); if (iNewIndex > iCurrentIndex) { // The index is always given for the current table setup // -> A move consists of a remove and an insert, so if a column is moved to a higher index the index must be shifted iNewIndex--; } if (iNewIndex < 0) { iNewIndex = 0; } else if (iNewIndex > aColumns.length) { iNewIndex = aColumns.length; } return iNewIndex; }
javascript
function(oColumn, iNewIndex) { var oTable = oColumn.getParent(), iCurrentIndex = oTable.indexOfColumn(oColumn), aColumns = oTable.getColumns(); if (iNewIndex > iCurrentIndex) { // The index is always given for the current table setup // -> A move consists of a remove and an insert, so if a column is moved to a higher index the index must be shifted iNewIndex--; } if (iNewIndex < 0) { iNewIndex = 0; } else if (iNewIndex > aColumns.length) { iNewIndex = aColumns.length; } return iNewIndex; }
[ "function", "(", "oColumn", ",", "iNewIndex", ")", "{", "var", "oTable", "=", "oColumn", ".", "getParent", "(", ")", ",", "iCurrentIndex", "=", "oTable", ".", "indexOfColumn", "(", "oColumn", ")", ",", "aColumns", "=", "oTable", ".", "getColumns", "(", ")", ";", "if", "(", "iNewIndex", ">", "iCurrentIndex", ")", "{", "// The index is always given for the current table setup", "// -> A move consists of a remove and an insert, so if a column is moved to a higher index the index must be shifted", "iNewIndex", "--", ";", "}", "if", "(", "iNewIndex", "<", "0", ")", "{", "iNewIndex", "=", "0", ";", "}", "else", "if", "(", "iNewIndex", ">", "aColumns", ".", "length", ")", "{", "iNewIndex", "=", "aColumns", ".", "length", ";", "}", "return", "iNewIndex", ";", "}" ]
Checks and adapts the given index if needed. @param {sap.ui.table.Column} oColumn Column of the table. @param {int} iNewIndex The desired new index of the column in the current table setup. @returns {int} The corrected index. @private
[ "Checks", "and", "adapts", "the", "given", "index", "if", "needed", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/TableColumnUtils.js#L416-L433
4,276
SAP/openui5
src/sap.ui.table/src/sap/ui/table/TableColumnUtils.js
function(oColumn, iNewIndex) { var oTable = oColumn.getParent(); if (!oTable || iNewIndex === undefined || !TableColumnUtils.isColumnMovable(oColumn)) { // Column is not movable at all return false; } iNewIndex = TableColumnUtils.normalizeColumnMoveTargetIndex(oColumn, iNewIndex); if (iNewIndex < oTable.getComputedFixedColumnCount() || iNewIndex < oTable._iFirstReorderableIndex) { // No movement of fixed columns or e.g. the first column in the TreeTable return false; } var iCurrentIndex = oTable.indexOfColumn(oColumn), aColumns = oTable.getColumns(); if (iNewIndex > iCurrentIndex) { // Column moved to higher index // The column to be moved will appear after this column. var oBeforeColumn = aColumns[iNewIndex >= aColumns.length ? aColumns.length - 1 : iNewIndex]; var oTargetBoundaries = TableColumnUtils.getColumnBoundaries(oTable, oBeforeColumn.getId()); if (TableColumnUtils.hasHeaderSpan(oBeforeColumn) || oTargetBoundaries.endIndex > iNewIndex) { return false; } } else { var oAfterColumn = aColumns[iNewIndex]; // The column to be moved will appear before this column. if (TableColumnUtils.getParentSpannedColumns(oTable, oAfterColumn.getId()).length != 0) { // If column which is currently at the desired target position is spanned by previous columns // also the column to reorder would be spanned after the move. return false; } } return true; }
javascript
function(oColumn, iNewIndex) { var oTable = oColumn.getParent(); if (!oTable || iNewIndex === undefined || !TableColumnUtils.isColumnMovable(oColumn)) { // Column is not movable at all return false; } iNewIndex = TableColumnUtils.normalizeColumnMoveTargetIndex(oColumn, iNewIndex); if (iNewIndex < oTable.getComputedFixedColumnCount() || iNewIndex < oTable._iFirstReorderableIndex) { // No movement of fixed columns or e.g. the first column in the TreeTable return false; } var iCurrentIndex = oTable.indexOfColumn(oColumn), aColumns = oTable.getColumns(); if (iNewIndex > iCurrentIndex) { // Column moved to higher index // The column to be moved will appear after this column. var oBeforeColumn = aColumns[iNewIndex >= aColumns.length ? aColumns.length - 1 : iNewIndex]; var oTargetBoundaries = TableColumnUtils.getColumnBoundaries(oTable, oBeforeColumn.getId()); if (TableColumnUtils.hasHeaderSpan(oBeforeColumn) || oTargetBoundaries.endIndex > iNewIndex) { return false; } } else { var oAfterColumn = aColumns[iNewIndex]; // The column to be moved will appear before this column. if (TableColumnUtils.getParentSpannedColumns(oTable, oAfterColumn.getId()).length != 0) { // If column which is currently at the desired target position is spanned by previous columns // also the column to reorder would be spanned after the move. return false; } } return true; }
[ "function", "(", "oColumn", ",", "iNewIndex", ")", "{", "var", "oTable", "=", "oColumn", ".", "getParent", "(", ")", ";", "if", "(", "!", "oTable", "||", "iNewIndex", "===", "undefined", "||", "!", "TableColumnUtils", ".", "isColumnMovable", "(", "oColumn", ")", ")", "{", "// Column is not movable at all", "return", "false", ";", "}", "iNewIndex", "=", "TableColumnUtils", ".", "normalizeColumnMoveTargetIndex", "(", "oColumn", ",", "iNewIndex", ")", ";", "if", "(", "iNewIndex", "<", "oTable", ".", "getComputedFixedColumnCount", "(", ")", "||", "iNewIndex", "<", "oTable", ".", "_iFirstReorderableIndex", ")", "{", "// No movement of fixed columns or e.g. the first column in the TreeTable", "return", "false", ";", "}", "var", "iCurrentIndex", "=", "oTable", ".", "indexOfColumn", "(", "oColumn", ")", ",", "aColumns", "=", "oTable", ".", "getColumns", "(", ")", ";", "if", "(", "iNewIndex", ">", "iCurrentIndex", ")", "{", "// Column moved to higher index", "// The column to be moved will appear after this column.", "var", "oBeforeColumn", "=", "aColumns", "[", "iNewIndex", ">=", "aColumns", ".", "length", "?", "aColumns", ".", "length", "-", "1", ":", "iNewIndex", "]", ";", "var", "oTargetBoundaries", "=", "TableColumnUtils", ".", "getColumnBoundaries", "(", "oTable", ",", "oBeforeColumn", ".", "getId", "(", ")", ")", ";", "if", "(", "TableColumnUtils", ".", "hasHeaderSpan", "(", "oBeforeColumn", ")", "||", "oTargetBoundaries", ".", "endIndex", ">", "iNewIndex", ")", "{", "return", "false", ";", "}", "}", "else", "{", "var", "oAfterColumn", "=", "aColumns", "[", "iNewIndex", "]", ";", "// The column to be moved will appear before this column.", "if", "(", "TableColumnUtils", ".", "getParentSpannedColumns", "(", "oTable", ",", "oAfterColumn", ".", "getId", "(", ")", ")", ".", "length", "!=", "0", ")", "{", "// If column which is currently at the desired target position is spanned by previous columns", "// also the column to reorder would be spanned after the move.", "return", "false", ";", "}", "}", "return", "true", ";", "}" ]
Returns true if the column can be moved to the desired position. Note: The index must be given for the current table setup (which includes the column itself). @param {sap.ui.table.Column} oColumn Column of the table. @param {int} iNewIndex the desired new index of the column in the current table setup. @returns {boolean} Whether the column can be moved to the desired position.
[ "Returns", "true", "if", "the", "column", "can", "be", "moved", "to", "the", "desired", "position", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/TableColumnUtils.js#L444-L479
4,277
SAP/openui5
src/sap.ui.table/src/sap/ui/table/TableColumnUtils.js
function(oColumn, iNewIndex) { if (!TableColumnUtils.isColumnMovableTo(oColumn, iNewIndex)) { return false; } var oTable = oColumn.getParent(), iCurrentIndex = oTable.indexOfColumn(oColumn); if (iNewIndex === iCurrentIndex) { return false; } iNewIndex = TableColumnUtils.normalizeColumnMoveTargetIndex(oColumn, iNewIndex); var bExecuteDefault = oTable.fireColumnMove({ column: oColumn, newPos: iNewIndex }); if (!bExecuteDefault) { // No execution of the movement when event default is prevented return false; } oTable._bReorderInProcess = true; /* The AnalyticalBinding does not support calls like: * oBinding.updateAnalyticalInfo(...); * oBinding.getContexts(...); * oBinding.updateAnalyticalInfo(...); * oBinding.getContexts(...); * A call chain like above can lead to some problems: * - A request according to the analytical info passed in line 1 would be sent, but not for the info in line 3. * - After the change event (updateRows) the binding returns an incorrect length of 0. * The solution is to only trigger a request at the end of a process. */ oTable.removeColumn(oColumn, true); oTable.insertColumn(oColumn, iNewIndex); oTable._bReorderInProcess = false; return true; }
javascript
function(oColumn, iNewIndex) { if (!TableColumnUtils.isColumnMovableTo(oColumn, iNewIndex)) { return false; } var oTable = oColumn.getParent(), iCurrentIndex = oTable.indexOfColumn(oColumn); if (iNewIndex === iCurrentIndex) { return false; } iNewIndex = TableColumnUtils.normalizeColumnMoveTargetIndex(oColumn, iNewIndex); var bExecuteDefault = oTable.fireColumnMove({ column: oColumn, newPos: iNewIndex }); if (!bExecuteDefault) { // No execution of the movement when event default is prevented return false; } oTable._bReorderInProcess = true; /* The AnalyticalBinding does not support calls like: * oBinding.updateAnalyticalInfo(...); * oBinding.getContexts(...); * oBinding.updateAnalyticalInfo(...); * oBinding.getContexts(...); * A call chain like above can lead to some problems: * - A request according to the analytical info passed in line 1 would be sent, but not for the info in line 3. * - After the change event (updateRows) the binding returns an incorrect length of 0. * The solution is to only trigger a request at the end of a process. */ oTable.removeColumn(oColumn, true); oTable.insertColumn(oColumn, iNewIndex); oTable._bReorderInProcess = false; return true; }
[ "function", "(", "oColumn", ",", "iNewIndex", ")", "{", "if", "(", "!", "TableColumnUtils", ".", "isColumnMovableTo", "(", "oColumn", ",", "iNewIndex", ")", ")", "{", "return", "false", ";", "}", "var", "oTable", "=", "oColumn", ".", "getParent", "(", ")", ",", "iCurrentIndex", "=", "oTable", ".", "indexOfColumn", "(", "oColumn", ")", ";", "if", "(", "iNewIndex", "===", "iCurrentIndex", ")", "{", "return", "false", ";", "}", "iNewIndex", "=", "TableColumnUtils", ".", "normalizeColumnMoveTargetIndex", "(", "oColumn", ",", "iNewIndex", ")", ";", "var", "bExecuteDefault", "=", "oTable", ".", "fireColumnMove", "(", "{", "column", ":", "oColumn", ",", "newPos", ":", "iNewIndex", "}", ")", ";", "if", "(", "!", "bExecuteDefault", ")", "{", "// No execution of the movement when event default is prevented", "return", "false", ";", "}", "oTable", ".", "_bReorderInProcess", "=", "true", ";", "/* The AnalyticalBinding does not support calls like:\n\t\t\t * oBinding.updateAnalyticalInfo(...);\n\t\t\t * oBinding.getContexts(...);\n\t\t\t * oBinding.updateAnalyticalInfo(...);\n\t\t\t * oBinding.getContexts(...);\n\t\t\t * A call chain like above can lead to some problems:\n\t\t\t * - A request according to the analytical info passed in line 1 would be sent, but not for the info in line 3.\n\t\t\t * - After the change event (updateRows) the binding returns an incorrect length of 0.\n\t\t\t * The solution is to only trigger a request at the end of a process.\n\t\t\t */", "oTable", ".", "removeColumn", "(", "oColumn", ",", "true", ")", ";", "oTable", ".", "insertColumn", "(", "oColumn", ",", "iNewIndex", ")", ";", "oTable", ".", "_bReorderInProcess", "=", "false", ";", "return", "true", ";", "}" ]
Moves the column to the desired position. Note: The index must be given for the current table setup (which includes the column itself). @param {sap.ui.table.Column} oColumn Column of the table. @param {sap.ui.table.Column} iNewIndex the desired new index of the column in the current table setup. @returns {boolean} Whether the column was moved to the desired position.
[ "Moves", "the", "column", "to", "the", "desired", "position", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/TableColumnUtils.js#L490-L532
4,278
SAP/openui5
src/sap.ui.table/src/sap/ui/table/TableColumnUtils.js
function(oTable, iColumnIndex, iWidth, bFireEvent, iColumnSpan) { if (!oTable || iColumnIndex == null || iColumnIndex < 0 || iWidth == null || iWidth <= 0) { return false; } if (iColumnSpan == null || iColumnSpan <= 0) { iColumnSpan = 1; } if (bFireEvent == null) { bFireEvent = true; } var aColumns = oTable.getColumns(); if (iColumnIndex >= aColumns.length || !aColumns[iColumnIndex].getVisible()) { return false; } var aVisibleColumns = []; for (var i = iColumnIndex; i < aColumns.length; i++) { var oColumn = aColumns[i]; if (oColumn.getVisible()) { aVisibleColumns.push(oColumn); // Consider only the required amount of visible columns. if (aVisibleColumns.length === iColumnSpan) { break; } } } var aResizableColumns = []; for (var i = 0; i < aVisibleColumns.length; i++) { var oVisibleColumn = aVisibleColumns[i]; if (oVisibleColumn.getResizable()) { aResizableColumns.push(oVisibleColumn); } } if (aResizableColumns.length === 0) { return false; } var iSpanWidth = 0; for (var i = 0; i < aVisibleColumns.length; i++) { var oVisibleColumn = aVisibleColumns[i]; iSpanWidth += TableColumnUtils.getColumnWidth(oTable, oVisibleColumn.getIndex()); } var iPixelDelta = iWidth - iSpanWidth; var iSharedPixelDelta = Math.round(iPixelDelta / aResizableColumns.length); var bResizeWasPerformed = false; var oTableElement = oTable.getDomRef(); // Fix Auto Columns if a column in the scrollable area was resized: // Set minimum widths of all columns with variable width except those in aResizableColumns. // As a result, flexible columns cannot shrink smaller as their current width after the resize // (see setMinColWidths in Table.js). if (!TableColumnUtils.TableUtils.isFixedColumn(oTable, iColumnIndex)) { oTable._getVisibleColumns().forEach(function(col) { var width = col.getWidth(), colElement; if (oTableElement && aResizableColumns.indexOf(col) < 0 && TableColumnUtils.TableUtils.isVariableWidth(width)) { colElement = oTableElement.querySelector("th[data-sap-ui-colid=\"" + col.getId() + "\"]"); if (colElement) { col._minWidth = Math.max(colElement.offsetWidth, TableColumnUtils.getMinColumnWidth()); } } }); } // Resize all resizable columns. Share the width change (pixel delta) between them. for (var i = 0; i < aResizableColumns.length; i++) { var oResizableColumn = aResizableColumns[i]; var iColumnWidth = TableColumnUtils.getColumnWidth(oTable, oResizableColumn.getIndex()); var iNewWidth = iColumnWidth + iSharedPixelDelta; var iColMinWidth = TableColumnUtils.getMinColumnWidth(); if (iNewWidth < iColMinWidth) { iNewWidth = iColMinWidth; } var iWidthChange = iNewWidth - iColumnWidth; // Distribute any remaining delta to the remaining columns. if (Math.abs(iWidthChange) < Math.abs(iSharedPixelDelta)) { var iRemainingColumnCount = aResizableColumns.length - (i + 1); iPixelDelta -= iWidthChange; iSharedPixelDelta = Math.round(iPixelDelta / iRemainingColumnCount); } if (iWidthChange !== 0) { var bExecuteDefault = true; var sWidth = iNewWidth + "px"; if (bFireEvent) { bExecuteDefault = oTable.fireColumnResize({ column: oResizableColumn, width: sWidth }); } if (bExecuteDefault) { oResizableColumn.setWidth(sWidth); bResizeWasPerformed = true; } } } return bResizeWasPerformed; }
javascript
function(oTable, iColumnIndex, iWidth, bFireEvent, iColumnSpan) { if (!oTable || iColumnIndex == null || iColumnIndex < 0 || iWidth == null || iWidth <= 0) { return false; } if (iColumnSpan == null || iColumnSpan <= 0) { iColumnSpan = 1; } if (bFireEvent == null) { bFireEvent = true; } var aColumns = oTable.getColumns(); if (iColumnIndex >= aColumns.length || !aColumns[iColumnIndex].getVisible()) { return false; } var aVisibleColumns = []; for (var i = iColumnIndex; i < aColumns.length; i++) { var oColumn = aColumns[i]; if (oColumn.getVisible()) { aVisibleColumns.push(oColumn); // Consider only the required amount of visible columns. if (aVisibleColumns.length === iColumnSpan) { break; } } } var aResizableColumns = []; for (var i = 0; i < aVisibleColumns.length; i++) { var oVisibleColumn = aVisibleColumns[i]; if (oVisibleColumn.getResizable()) { aResizableColumns.push(oVisibleColumn); } } if (aResizableColumns.length === 0) { return false; } var iSpanWidth = 0; for (var i = 0; i < aVisibleColumns.length; i++) { var oVisibleColumn = aVisibleColumns[i]; iSpanWidth += TableColumnUtils.getColumnWidth(oTable, oVisibleColumn.getIndex()); } var iPixelDelta = iWidth - iSpanWidth; var iSharedPixelDelta = Math.round(iPixelDelta / aResizableColumns.length); var bResizeWasPerformed = false; var oTableElement = oTable.getDomRef(); // Fix Auto Columns if a column in the scrollable area was resized: // Set minimum widths of all columns with variable width except those in aResizableColumns. // As a result, flexible columns cannot shrink smaller as their current width after the resize // (see setMinColWidths in Table.js). if (!TableColumnUtils.TableUtils.isFixedColumn(oTable, iColumnIndex)) { oTable._getVisibleColumns().forEach(function(col) { var width = col.getWidth(), colElement; if (oTableElement && aResizableColumns.indexOf(col) < 0 && TableColumnUtils.TableUtils.isVariableWidth(width)) { colElement = oTableElement.querySelector("th[data-sap-ui-colid=\"" + col.getId() + "\"]"); if (colElement) { col._minWidth = Math.max(colElement.offsetWidth, TableColumnUtils.getMinColumnWidth()); } } }); } // Resize all resizable columns. Share the width change (pixel delta) between them. for (var i = 0; i < aResizableColumns.length; i++) { var oResizableColumn = aResizableColumns[i]; var iColumnWidth = TableColumnUtils.getColumnWidth(oTable, oResizableColumn.getIndex()); var iNewWidth = iColumnWidth + iSharedPixelDelta; var iColMinWidth = TableColumnUtils.getMinColumnWidth(); if (iNewWidth < iColMinWidth) { iNewWidth = iColMinWidth; } var iWidthChange = iNewWidth - iColumnWidth; // Distribute any remaining delta to the remaining columns. if (Math.abs(iWidthChange) < Math.abs(iSharedPixelDelta)) { var iRemainingColumnCount = aResizableColumns.length - (i + 1); iPixelDelta -= iWidthChange; iSharedPixelDelta = Math.round(iPixelDelta / iRemainingColumnCount); } if (iWidthChange !== 0) { var bExecuteDefault = true; var sWidth = iNewWidth + "px"; if (bFireEvent) { bExecuteDefault = oTable.fireColumnResize({ column: oResizableColumn, width: sWidth }); } if (bExecuteDefault) { oResizableColumn.setWidth(sWidth); bResizeWasPerformed = true; } } } return bResizeWasPerformed; }
[ "function", "(", "oTable", ",", "iColumnIndex", ",", "iWidth", ",", "bFireEvent", ",", "iColumnSpan", ")", "{", "if", "(", "!", "oTable", "||", "iColumnIndex", "==", "null", "||", "iColumnIndex", "<", "0", "||", "iWidth", "==", "null", "||", "iWidth", "<=", "0", ")", "{", "return", "false", ";", "}", "if", "(", "iColumnSpan", "==", "null", "||", "iColumnSpan", "<=", "0", ")", "{", "iColumnSpan", "=", "1", ";", "}", "if", "(", "bFireEvent", "==", "null", ")", "{", "bFireEvent", "=", "true", ";", "}", "var", "aColumns", "=", "oTable", ".", "getColumns", "(", ")", ";", "if", "(", "iColumnIndex", ">=", "aColumns", ".", "length", "||", "!", "aColumns", "[", "iColumnIndex", "]", ".", "getVisible", "(", ")", ")", "{", "return", "false", ";", "}", "var", "aVisibleColumns", "=", "[", "]", ";", "for", "(", "var", "i", "=", "iColumnIndex", ";", "i", "<", "aColumns", ".", "length", ";", "i", "++", ")", "{", "var", "oColumn", "=", "aColumns", "[", "i", "]", ";", "if", "(", "oColumn", ".", "getVisible", "(", ")", ")", "{", "aVisibleColumns", ".", "push", "(", "oColumn", ")", ";", "// Consider only the required amount of visible columns.", "if", "(", "aVisibleColumns", ".", "length", "===", "iColumnSpan", ")", "{", "break", ";", "}", "}", "}", "var", "aResizableColumns", "=", "[", "]", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "aVisibleColumns", ".", "length", ";", "i", "++", ")", "{", "var", "oVisibleColumn", "=", "aVisibleColumns", "[", "i", "]", ";", "if", "(", "oVisibleColumn", ".", "getResizable", "(", ")", ")", "{", "aResizableColumns", ".", "push", "(", "oVisibleColumn", ")", ";", "}", "}", "if", "(", "aResizableColumns", ".", "length", "===", "0", ")", "{", "return", "false", ";", "}", "var", "iSpanWidth", "=", "0", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "aVisibleColumns", ".", "length", ";", "i", "++", ")", "{", "var", "oVisibleColumn", "=", "aVisibleColumns", "[", "i", "]", ";", "iSpanWidth", "+=", "TableColumnUtils", ".", "getColumnWidth", "(", "oTable", ",", "oVisibleColumn", ".", "getIndex", "(", ")", ")", ";", "}", "var", "iPixelDelta", "=", "iWidth", "-", "iSpanWidth", ";", "var", "iSharedPixelDelta", "=", "Math", ".", "round", "(", "iPixelDelta", "/", "aResizableColumns", ".", "length", ")", ";", "var", "bResizeWasPerformed", "=", "false", ";", "var", "oTableElement", "=", "oTable", ".", "getDomRef", "(", ")", ";", "// Fix Auto Columns if a column in the scrollable area was resized:", "// Set minimum widths of all columns with variable width except those in aResizableColumns.", "// As a result, flexible columns cannot shrink smaller as their current width after the resize", "// (see setMinColWidths in Table.js).", "if", "(", "!", "TableColumnUtils", ".", "TableUtils", ".", "isFixedColumn", "(", "oTable", ",", "iColumnIndex", ")", ")", "{", "oTable", ".", "_getVisibleColumns", "(", ")", ".", "forEach", "(", "function", "(", "col", ")", "{", "var", "width", "=", "col", ".", "getWidth", "(", ")", ",", "colElement", ";", "if", "(", "oTableElement", "&&", "aResizableColumns", ".", "indexOf", "(", "col", ")", "<", "0", "&&", "TableColumnUtils", ".", "TableUtils", ".", "isVariableWidth", "(", "width", ")", ")", "{", "colElement", "=", "oTableElement", ".", "querySelector", "(", "\"th[data-sap-ui-colid=\\\"\"", "+", "col", ".", "getId", "(", ")", "+", "\"\\\"]\"", ")", ";", "if", "(", "colElement", ")", "{", "col", ".", "_minWidth", "=", "Math", ".", "max", "(", "colElement", ".", "offsetWidth", ",", "TableColumnUtils", ".", "getMinColumnWidth", "(", ")", ")", ";", "}", "}", "}", ")", ";", "}", "// Resize all resizable columns. Share the width change (pixel delta) between them.", "for", "(", "var", "i", "=", "0", ";", "i", "<", "aResizableColumns", ".", "length", ";", "i", "++", ")", "{", "var", "oResizableColumn", "=", "aResizableColumns", "[", "i", "]", ";", "var", "iColumnWidth", "=", "TableColumnUtils", ".", "getColumnWidth", "(", "oTable", ",", "oResizableColumn", ".", "getIndex", "(", ")", ")", ";", "var", "iNewWidth", "=", "iColumnWidth", "+", "iSharedPixelDelta", ";", "var", "iColMinWidth", "=", "TableColumnUtils", ".", "getMinColumnWidth", "(", ")", ";", "if", "(", "iNewWidth", "<", "iColMinWidth", ")", "{", "iNewWidth", "=", "iColMinWidth", ";", "}", "var", "iWidthChange", "=", "iNewWidth", "-", "iColumnWidth", ";", "// Distribute any remaining delta to the remaining columns.", "if", "(", "Math", ".", "abs", "(", "iWidthChange", ")", "<", "Math", ".", "abs", "(", "iSharedPixelDelta", ")", ")", "{", "var", "iRemainingColumnCount", "=", "aResizableColumns", ".", "length", "-", "(", "i", "+", "1", ")", ";", "iPixelDelta", "-=", "iWidthChange", ";", "iSharedPixelDelta", "=", "Math", ".", "round", "(", "iPixelDelta", "/", "iRemainingColumnCount", ")", ";", "}", "if", "(", "iWidthChange", "!==", "0", ")", "{", "var", "bExecuteDefault", "=", "true", ";", "var", "sWidth", "=", "iNewWidth", "+", "\"px\"", ";", "if", "(", "bFireEvent", ")", "{", "bExecuteDefault", "=", "oTable", ".", "fireColumnResize", "(", "{", "column", ":", "oResizableColumn", ",", "width", ":", "sWidth", "}", ")", ";", "}", "if", "(", "bExecuteDefault", ")", "{", "oResizableColumn", ".", "setWidth", "(", "sWidth", ")", ";", "bResizeWasPerformed", "=", "true", ";", "}", "}", "}", "return", "bResizeWasPerformed", ";", "}" ]
Resizes one or more visible columns to the specified amount of pixels. In case a column span is specified: The span covers only visible columns. If columns directly after the column with index <code>iColumnIndex</code> are invisible they will be skipped and not be considered for resizing. The new width <code>iWidth</code> will be equally applied among all resizable columns in the span of visible columns, considering the minimum column width. The actual resulting width might differ due to rounding errors and the minimum column width. Resizing of a column won't be performed if the ColumnResize event is fired and execution of the default action is prevented in the event handler. @param {sap.ui.table.Table} oTable Instance of the table. @param {int} iColumnIndex The index of a column. Must the index of a visible column. @param {int} iWidth The width in pixel to set the column or column span to. Must be greater than 0. @param {boolean} [bFireEvent=true] Whether the ColumnResize event should be fired. The event will be fired for every resized column. @param {int} [iColumnSpan=1] The span of columns to resize beginning from <code>iColumnIndex</code>. @returns {boolean} Returns <code>true</code>, if at least one column has been resized.
[ "Resizes", "one", "or", "more", "visible", "columns", "to", "the", "specified", "amount", "of", "pixels", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/TableColumnUtils.js#L569-L680
4,279
SAP/openui5
src/sap.ui.core/src/sap/ui/thirdparty/RequestRecorder.js
function(sLocationUrl) { // Try to request the har file from the given location url var mHarFileContent = null; var oRequest = new XMLHttpRequest(); oRequest.open("GET", sLocationUrl, false); oRequest.addEventListener("load", function() { if (this.status === 200) { mHarFileContent = JSON.parse(this.responseText); } }); oRequest.send(); try { mHarFileContent = JSON.parse(oRequest.responseText); } catch (e) { throw new Error("Har file could not be loaded."); } // Validate version of the har file if (mHarFileContent && (!mHarFileContent.log || !mHarFileContent.log.version || parseInt(mHarFileContent.log.version, 10) != this.sDefaultMajorHarVersion)) { this.oLog.error(sModuleName + " - Incompatible version. Please provide .har file with version " + this.sDefaultMajorHarVersion + ".x"); } return mHarFileContent; }
javascript
function(sLocationUrl) { // Try to request the har file from the given location url var mHarFileContent = null; var oRequest = new XMLHttpRequest(); oRequest.open("GET", sLocationUrl, false); oRequest.addEventListener("load", function() { if (this.status === 200) { mHarFileContent = JSON.parse(this.responseText); } }); oRequest.send(); try { mHarFileContent = JSON.parse(oRequest.responseText); } catch (e) { throw new Error("Har file could not be loaded."); } // Validate version of the har file if (mHarFileContent && (!mHarFileContent.log || !mHarFileContent.log.version || parseInt(mHarFileContent.log.version, 10) != this.sDefaultMajorHarVersion)) { this.oLog.error(sModuleName + " - Incompatible version. Please provide .har file with version " + this.sDefaultMajorHarVersion + ".x"); } return mHarFileContent; }
[ "function", "(", "sLocationUrl", ")", "{", "// Try to request the har file from the given location url", "var", "mHarFileContent", "=", "null", ";", "var", "oRequest", "=", "new", "XMLHttpRequest", "(", ")", ";", "oRequest", ".", "open", "(", "\"GET\"", ",", "sLocationUrl", ",", "false", ")", ";", "oRequest", ".", "addEventListener", "(", "\"load\"", ",", "function", "(", ")", "{", "if", "(", "this", ".", "status", "===", "200", ")", "{", "mHarFileContent", "=", "JSON", ".", "parse", "(", "this", ".", "responseText", ")", ";", "}", "}", ")", ";", "oRequest", ".", "send", "(", ")", ";", "try", "{", "mHarFileContent", "=", "JSON", ".", "parse", "(", "oRequest", ".", "responseText", ")", ";", "}", "catch", "(", "e", ")", "{", "throw", "new", "Error", "(", "\"Har file could not be loaded.\"", ")", ";", "}", "// Validate version of the har file", "if", "(", "mHarFileContent", "&&", "(", "!", "mHarFileContent", ".", "log", "||", "!", "mHarFileContent", ".", "log", ".", "version", "||", "parseInt", "(", "mHarFileContent", ".", "log", ".", "version", ",", "10", ")", "!=", "this", ".", "sDefaultMajorHarVersion", ")", ")", "{", "this", ".", "oLog", ".", "error", "(", "sModuleName", "+", "\" - Incompatible version. Please provide .har file with version \"", "+", "this", ".", "sDefaultMajorHarVersion", "+", "\".x\"", ")", ";", "}", "return", "mHarFileContent", ";", "}" ]
Tries to load an har file from the given location URL. If no the file could not be loaded, the function returns null. This is used to determine if the RequestRecorder tries to record instead. If a har file is loaded, the major version is validated to match the specifications. @param {string} sLocationUrl The full URL with filename und extension. @returns {object|null} Har file content as JSON or null if no file is found.
[ "Tries", "to", "load", "an", "har", "file", "from", "the", "given", "location", "URL", ".", "If", "no", "the", "file", "could", "not", "be", "loaded", "the", "function", "returns", "null", ".", "This", "is", "used", "to", "determine", "if", "the", "RequestRecorder", "tries", "to", "record", "instead", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/thirdparty/RequestRecorder.js#L86-L109
4,280
SAP/openui5
src/sap.ui.core/src/sap/ui/thirdparty/RequestRecorder.js
function(mHarFileContent) { var aEntries; if (!mHarFileContent.log.entries || !mHarFileContent.log.entries.length) { this.oLog.info(sModuleName + " - Empty entries array or the provided har file is empty."); aEntries = []; } else { // Add start and end timestamps to determine the request and response order. aEntries = mHarFileContent.log.entries; for (var i = 0; i < aEntries.length; i++) { aEntries[i]._timestampStarted = new Date(aEntries[i].startedDateTime).getTime(); aEntries[i]._timestampFinished = aEntries[i]._timestampStarted + aEntries[i].time; aEntries[i]._initialOrder = i; } // Sort by response first, then by request to ensure the correct order. this.prepareEntriesOrder(aEntries, "_timestampFinished"); this.prepareEntriesOrder(aEntries, "_timestampStarted"); // Build a map with the sorted entries in the correct custom groups and by URL groups. mHarFileContent._groupedEntries = {}; for (var j = 0; j < aEntries.length; j++) { this.addEntryToMapping(mHarFileContent, aEntries, j); } } mHarFileContent.log.entries = aEntries; return mHarFileContent; }
javascript
function(mHarFileContent) { var aEntries; if (!mHarFileContent.log.entries || !mHarFileContent.log.entries.length) { this.oLog.info(sModuleName + " - Empty entries array or the provided har file is empty."); aEntries = []; } else { // Add start and end timestamps to determine the request and response order. aEntries = mHarFileContent.log.entries; for (var i = 0; i < aEntries.length; i++) { aEntries[i]._timestampStarted = new Date(aEntries[i].startedDateTime).getTime(); aEntries[i]._timestampFinished = aEntries[i]._timestampStarted + aEntries[i].time; aEntries[i]._initialOrder = i; } // Sort by response first, then by request to ensure the correct order. this.prepareEntriesOrder(aEntries, "_timestampFinished"); this.prepareEntriesOrder(aEntries, "_timestampStarted"); // Build a map with the sorted entries in the correct custom groups and by URL groups. mHarFileContent._groupedEntries = {}; for (var j = 0; j < aEntries.length; j++) { this.addEntryToMapping(mHarFileContent, aEntries, j); } } mHarFileContent.log.entries = aEntries; return mHarFileContent; }
[ "function", "(", "mHarFileContent", ")", "{", "var", "aEntries", ";", "if", "(", "!", "mHarFileContent", ".", "log", ".", "entries", "||", "!", "mHarFileContent", ".", "log", ".", "entries", ".", "length", ")", "{", "this", ".", "oLog", ".", "info", "(", "sModuleName", "+", "\" - Empty entries array or the provided har file is empty.\"", ")", ";", "aEntries", "=", "[", "]", ";", "}", "else", "{", "// Add start and end timestamps to determine the request and response order.", "aEntries", "=", "mHarFileContent", ".", "log", ".", "entries", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "aEntries", ".", "length", ";", "i", "++", ")", "{", "aEntries", "[", "i", "]", ".", "_timestampStarted", "=", "new", "Date", "(", "aEntries", "[", "i", "]", ".", "startedDateTime", ")", ".", "getTime", "(", ")", ";", "aEntries", "[", "i", "]", ".", "_timestampFinished", "=", "aEntries", "[", "i", "]", ".", "_timestampStarted", "+", "aEntries", "[", "i", "]", ".", "time", ";", "aEntries", "[", "i", "]", ".", "_initialOrder", "=", "i", ";", "}", "// Sort by response first, then by request to ensure the correct order.", "this", ".", "prepareEntriesOrder", "(", "aEntries", ",", "\"_timestampFinished\"", ")", ";", "this", ".", "prepareEntriesOrder", "(", "aEntries", ",", "\"_timestampStarted\"", ")", ";", "// Build a map with the sorted entries in the correct custom groups and by URL groups.", "mHarFileContent", ".", "_groupedEntries", "=", "{", "}", ";", "for", "(", "var", "j", "=", "0", ";", "j", "<", "aEntries", ".", "length", ";", "j", "++", ")", "{", "this", ".", "addEntryToMapping", "(", "mHarFileContent", ",", "aEntries", ",", "j", ")", ";", "}", "}", "mHarFileContent", ".", "log", ".", "entries", "=", "aEntries", ";", "return", "mHarFileContent", ";", "}" ]
Sorts the entries of a har file by response and request order. After the entries are sorted, the function builds a map of the entries with the assigned custom groups and url groups. @param {object} mHarFileContent The loaded map from the har file. @returns {object} Prepared Har content with sorted entries and all the mappings (URL, Groups).
[ "Sorts", "the", "entries", "of", "a", "har", "file", "by", "response", "and", "request", "order", ".", "After", "the", "entries", "are", "sorted", "the", "function", "builds", "a", "map", "of", "the", "entries", "with", "the", "assigned", "custom", "groups", "and", "url", "groups", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/thirdparty/RequestRecorder.js#L118-L145
4,281
SAP/openui5
src/sap.ui.core/src/sap/ui/thirdparty/RequestRecorder.js
function(sMethod, sUrl) { var sUrlResourcePart = new URI(sUrl).resource(); sUrlResourcePart = this.replaceEntriesUrlByRegex(sUrlResourcePart); return sMethod + sUrlResourcePart; }
javascript
function(sMethod, sUrl) { var sUrlResourcePart = new URI(sUrl).resource(); sUrlResourcePart = this.replaceEntriesUrlByRegex(sUrlResourcePart); return sMethod + sUrlResourcePart; }
[ "function", "(", "sMethod", ",", "sUrl", ")", "{", "var", "sUrlResourcePart", "=", "new", "URI", "(", "sUrl", ")", ".", "resource", "(", ")", ";", "sUrlResourcePart", "=", "this", ".", "replaceEntriesUrlByRegex", "(", "sUrlResourcePart", ")", ";", "return", "sMethod", "+", "sUrlResourcePart", ";", "}" ]
Creates the URL group for to map the requested XMLHttpRequests to it's response. @param {string} sMethod The http method (e.g. GET, POST...) @param {string} sUrl The full requested URL. @returns {string} The created URL group for the mapping.
[ "Creates", "the", "URL", "group", "for", "to", "map", "the", "requested", "XMLHttpRequests", "to", "it", "s", "response", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/thirdparty/RequestRecorder.js#L197-L201
4,282
SAP/openui5
src/sap.ui.core/src/sap/ui/thirdparty/RequestRecorder.js
function(sUrl) { for (var i = 0; i < this.aEntriesUrlReplace.length; i++) { var oEntry = this.aEntriesUrlReplace[i]; if (oEntry.regex instanceof RegExp && oEntry.value !== undefined) { sUrl = sUrl.replace(oEntry.regex, oEntry.value); } else { this.oLog.warning(sModuleName + " - Invalid regular expression for url replace."); } } return sUrl; }
javascript
function(sUrl) { for (var i = 0; i < this.aEntriesUrlReplace.length; i++) { var oEntry = this.aEntriesUrlReplace[i]; if (oEntry.regex instanceof RegExp && oEntry.value !== undefined) { sUrl = sUrl.replace(oEntry.regex, oEntry.value); } else { this.oLog.warning(sModuleName + " - Invalid regular expression for url replace."); } } return sUrl; }
[ "function", "(", "sUrl", ")", "{", "for", "(", "var", "i", "=", "0", ";", "i", "<", "this", ".", "aEntriesUrlReplace", ".", "length", ";", "i", "++", ")", "{", "var", "oEntry", "=", "this", ".", "aEntriesUrlReplace", "[", "i", "]", ";", "if", "(", "oEntry", ".", "regex", "instanceof", "RegExp", "&&", "oEntry", ".", "value", "!==", "undefined", ")", "{", "sUrl", "=", "sUrl", ".", "replace", "(", "oEntry", ".", "regex", ",", "oEntry", ".", "value", ")", ";", "}", "else", "{", "this", ".", "oLog", ".", "warning", "(", "sModuleName", "+", "\" - Invalid regular expression for url replace.\"", ")", ";", "}", "}", "return", "sUrl", ";", "}" ]
Applies the provided Regex on the URL and replaces the needed parts. @param {string} sUrl The URL on which the replaces are applied. @returns {string} The new URL with the replaced parts.
[ "Applies", "the", "provided", "Regex", "on", "the", "URL", "and", "replaces", "the", "needed", "parts", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/thirdparty/RequestRecorder.js#L209-L219
4,283
SAP/openui5
src/sap.ui.core/src/sap/ui/thirdparty/RequestRecorder.js
function(bDeleteRecordings) { // Check for the filename or ask for it (if configured) var sFilename = (this.sFilename || this.sDefaultFilename); if (this.bPromptForDownloadFilename) { sFilename = window.prompt("Enter file name", sFilename + ".har"); } else { sFilename = sFilename + ".har"; } // The content skeleton var mHarContent = { log: { version: "1.2", creator: { name: "RequestRecorder", version: "1.0" }, entries: this.aRequests } }; // Check if recorded entries should be cleared. if (bDeleteRecordings) { this.deleteRecordedEntries(); } // Inject the data into the dom and download it (if configured). if (!this.bIsDownloadDisabled) { var sString = JSON.stringify(mHarContent, null, 4); var a = document.createElement("a"); document.body.appendChild(a); var oBlob = new window.Blob([sString], { type: "octet/stream" }); var sUrl = window.URL.createObjectURL(oBlob); a.href = sUrl; a.download = sFilename; a.click(); window.URL.revokeObjectURL(sUrl); } return mHarContent; }
javascript
function(bDeleteRecordings) { // Check for the filename or ask for it (if configured) var sFilename = (this.sFilename || this.sDefaultFilename); if (this.bPromptForDownloadFilename) { sFilename = window.prompt("Enter file name", sFilename + ".har"); } else { sFilename = sFilename + ".har"; } // The content skeleton var mHarContent = { log: { version: "1.2", creator: { name: "RequestRecorder", version: "1.0" }, entries: this.aRequests } }; // Check if recorded entries should be cleared. if (bDeleteRecordings) { this.deleteRecordedEntries(); } // Inject the data into the dom and download it (if configured). if (!this.bIsDownloadDisabled) { var sString = JSON.stringify(mHarContent, null, 4); var a = document.createElement("a"); document.body.appendChild(a); var oBlob = new window.Blob([sString], { type: "octet/stream" }); var sUrl = window.URL.createObjectURL(oBlob); a.href = sUrl; a.download = sFilename; a.click(); window.URL.revokeObjectURL(sUrl); } return mHarContent; }
[ "function", "(", "bDeleteRecordings", ")", "{", "// Check for the filename or ask for it (if configured)", "var", "sFilename", "=", "(", "this", ".", "sFilename", "||", "this", ".", "sDefaultFilename", ")", ";", "if", "(", "this", ".", "bPromptForDownloadFilename", ")", "{", "sFilename", "=", "window", ".", "prompt", "(", "\"Enter file name\"", ",", "sFilename", "+", "\".har\"", ")", ";", "}", "else", "{", "sFilename", "=", "sFilename", "+", "\".har\"", ";", "}", "// The content skeleton", "var", "mHarContent", "=", "{", "log", ":", "{", "version", ":", "\"1.2\"", ",", "creator", ":", "{", "name", ":", "\"RequestRecorder\"", ",", "version", ":", "\"1.0\"", "}", ",", "entries", ":", "this", ".", "aRequests", "}", "}", ";", "// Check if recorded entries should be cleared.", "if", "(", "bDeleteRecordings", ")", "{", "this", ".", "deleteRecordedEntries", "(", ")", ";", "}", "// Inject the data into the dom and download it (if configured).", "if", "(", "!", "this", ".", "bIsDownloadDisabled", ")", "{", "var", "sString", "=", "JSON", ".", "stringify", "(", "mHarContent", ",", "null", ",", "4", ")", ";", "var", "a", "=", "document", ".", "createElement", "(", "\"a\"", ")", ";", "document", ".", "body", ".", "appendChild", "(", "a", ")", ";", "var", "oBlob", "=", "new", "window", ".", "Blob", "(", "[", "sString", "]", ",", "{", "type", ":", "\"octet/stream\"", "}", ")", ";", "var", "sUrl", "=", "window", ".", "URL", ".", "createObjectURL", "(", "oBlob", ")", ";", "a", ".", "href", "=", "sUrl", ";", "a", ".", "download", "=", "sFilename", ";", "a", ".", "click", "(", ")", ";", "window", ".", "URL", ".", "revokeObjectURL", "(", "sUrl", ")", ";", "}", "return", "mHarContent", ";", "}" ]
Transforms and delivers the recorded data for the har file. If the downloading is not disabled the file will be downloaded automatically or with an optional prompt for a filename. @param {boolean} bDeleteRecordings True if the existing entries should be deleted. @returns {Object} The recorded har file content
[ "Transforms", "and", "delivers", "the", "recorded", "data", "for", "the", "har", "file", ".", "If", "the", "downloading", "is", "not", "disabled", "the", "file", "will", "be", "downloaded", "automatically", "or", "with", "an", "optional", "prompt", "for", "a", "filename", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/thirdparty/RequestRecorder.js#L289-L328
4,284
SAP/openui5
src/sap.ui.core/src/sap/ui/thirdparty/RequestRecorder.js
function(mDelaySettings, iTime) { if (mDelaySettings) { if (mDelaySettings.factor !== undefined && typeof mDelaySettings.factor === 'number') { iTime *= mDelaySettings.factor; } if (mDelaySettings.offset !== undefined && typeof mDelaySettings.offset === 'number') { iTime += mDelaySettings.offset; } if (mDelaySettings.max !== undefined && typeof mDelaySettings.max === 'number') { iTime = Math.min(mDelaySettings.max, iTime); } if (mDelaySettings.min !== undefined && typeof mDelaySettings.min === 'number') { iTime = Math.max(mDelaySettings.min, iTime); } } return iTime; }
javascript
function(mDelaySettings, iTime) { if (mDelaySettings) { if (mDelaySettings.factor !== undefined && typeof mDelaySettings.factor === 'number') { iTime *= mDelaySettings.factor; } if (mDelaySettings.offset !== undefined && typeof mDelaySettings.offset === 'number') { iTime += mDelaySettings.offset; } if (mDelaySettings.max !== undefined && typeof mDelaySettings.max === 'number') { iTime = Math.min(mDelaySettings.max, iTime); } if (mDelaySettings.min !== undefined && typeof mDelaySettings.min === 'number') { iTime = Math.max(mDelaySettings.min, iTime); } } return iTime; }
[ "function", "(", "mDelaySettings", ",", "iTime", ")", "{", "if", "(", "mDelaySettings", ")", "{", "if", "(", "mDelaySettings", ".", "factor", "!==", "undefined", "&&", "typeof", "mDelaySettings", ".", "factor", "===", "'number'", ")", "{", "iTime", "*=", "mDelaySettings", ".", "factor", ";", "}", "if", "(", "mDelaySettings", ".", "offset", "!==", "undefined", "&&", "typeof", "mDelaySettings", ".", "offset", "===", "'number'", ")", "{", "iTime", "+=", "mDelaySettings", ".", "offset", ";", "}", "if", "(", "mDelaySettings", ".", "max", "!==", "undefined", "&&", "typeof", "mDelaySettings", ".", "max", "===", "'number'", ")", "{", "iTime", "=", "Math", ".", "min", "(", "mDelaySettings", ".", "max", ",", "iTime", ")", ";", "}", "if", "(", "mDelaySettings", ".", "min", "!==", "undefined", "&&", "typeof", "mDelaySettings", ".", "min", "===", "'number'", ")", "{", "iTime", "=", "Math", ".", "max", "(", "mDelaySettings", ".", "min", ",", "iTime", ")", ";", "}", "}", "return", "iTime", ";", "}" ]
Calculates the delay on base of the provided settings. It is possible to configure an offset, a minimum and a maximum delay. @param {object} mDelaySettings The settings map. @param {int} iTime The curreent duration of the request as milliseconds. @returns {int} The new duration as milliseconds.
[ "Calculates", "the", "delay", "on", "base", "of", "the", "provided", "settings", ".", "It", "is", "possible", "to", "configure", "an", "offset", "a", "minimum", "and", "a", "maximum", "delay", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/thirdparty/RequestRecorder.js#L338-L354
4,285
SAP/openui5
src/sap.ui.core/src/sap/ui/thirdparty/RequestRecorder.js
function(oXhr, oEntry) { var fnRespond = function() { if (oXhr.readyState !== 0) { var sResponseText = oEntry.response.content.text; // Transform headers to the required format for XMLHttpRequests. var oHeaders = {}; oEntry.response.headers.forEach(function(mHeader) { oHeaders[mHeader.name] = mHeader.value; }); // Support for injected callbacks if (typeof sResponseText === "function") { sResponseText = sResponseText(); } oXhr.respond( oEntry.response.status, oHeaders, sResponseText ); } }; // If the request is async, a possible delay will be applied. if (oXhr.async) { // Create new browser task with the setTimeout function to make sure that responses of async requests are not delievered too fast. setTimeout(function() { fnRespond(); }, this.calculateDelay(this.mDelaySettings, oEntry.time)); } else { fnRespond(); } }
javascript
function(oXhr, oEntry) { var fnRespond = function() { if (oXhr.readyState !== 0) { var sResponseText = oEntry.response.content.text; // Transform headers to the required format for XMLHttpRequests. var oHeaders = {}; oEntry.response.headers.forEach(function(mHeader) { oHeaders[mHeader.name] = mHeader.value; }); // Support for injected callbacks if (typeof sResponseText === "function") { sResponseText = sResponseText(); } oXhr.respond( oEntry.response.status, oHeaders, sResponseText ); } }; // If the request is async, a possible delay will be applied. if (oXhr.async) { // Create new browser task with the setTimeout function to make sure that responses of async requests are not delievered too fast. setTimeout(function() { fnRespond(); }, this.calculateDelay(this.mDelaySettings, oEntry.time)); } else { fnRespond(); } }
[ "function", "(", "oXhr", ",", "oEntry", ")", "{", "var", "fnRespond", "=", "function", "(", ")", "{", "if", "(", "oXhr", ".", "readyState", "!==", "0", ")", "{", "var", "sResponseText", "=", "oEntry", ".", "response", ".", "content", ".", "text", ";", "// Transform headers to the required format for XMLHttpRequests.", "var", "oHeaders", "=", "{", "}", ";", "oEntry", ".", "response", ".", "headers", ".", "forEach", "(", "function", "(", "mHeader", ")", "{", "oHeaders", "[", "mHeader", ".", "name", "]", "=", "mHeader", ".", "value", ";", "}", ")", ";", "// Support for injected callbacks", "if", "(", "typeof", "sResponseText", "===", "\"function\"", ")", "{", "sResponseText", "=", "sResponseText", "(", ")", ";", "}", "oXhr", ".", "respond", "(", "oEntry", ".", "response", ".", "status", ",", "oHeaders", ",", "sResponseText", ")", ";", "}", "}", ";", "// If the request is async, a possible delay will be applied.", "if", "(", "oXhr", ".", "async", ")", "{", "// Create new browser task with the setTimeout function to make sure that responses of async requests are not delievered too fast.", "setTimeout", "(", "function", "(", ")", "{", "fnRespond", "(", ")", ";", "}", ",", "this", ".", "calculateDelay", "(", "this", ".", "mDelaySettings", ",", "oEntry", ".", "time", ")", ")", ";", "}", "else", "{", "fnRespond", "(", ")", ";", "}", "}" ]
Responds to a given FakeXMLHttpRequest object with an entry from a har file. If a delay is provided, the time is calculated and the response of async requests will be delayed. Sync requests can not be deleayed. @param {Object} oXhr FakeXMLHttpRequest to respond. @param {Object} oEntry Entry from the har file.
[ "Responds", "to", "a", "given", "FakeXMLHttpRequest", "object", "with", "an", "entry", "from", "a", "har", "file", ".", "If", "a", "delay", "is", "provided", "the", "time", "is", "calculated", "and", "the", "response", "of", "async", "requests", "will", "be", "delayed", ".", "Sync", "requests", "can", "not", "be", "deleayed", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/thirdparty/RequestRecorder.js#L364-L396
4,286
SAP/openui5
src/sap.ui.core/src/sap/ui/thirdparty/RequestRecorder.js
function(sUrl, aEntriesUrlFilter) { if (this.bIsPaused) { return true; } var that = this; return aEntriesUrlFilter.every(function(regex) { if (regex instanceof RegExp) { return !regex.test(sUrl); } else { that.oLog.error(sModuleName + " - Invalid regular expression for filter."); return true; } }); }
javascript
function(sUrl, aEntriesUrlFilter) { if (this.bIsPaused) { return true; } var that = this; return aEntriesUrlFilter.every(function(regex) { if (regex instanceof RegExp) { return !regex.test(sUrl); } else { that.oLog.error(sModuleName + " - Invalid regular expression for filter."); return true; } }); }
[ "function", "(", "sUrl", ",", "aEntriesUrlFilter", ")", "{", "if", "(", "this", ".", "bIsPaused", ")", "{", "return", "true", ";", "}", "var", "that", "=", "this", ";", "return", "aEntriesUrlFilter", ".", "every", "(", "function", "(", "regex", ")", "{", "if", "(", "regex", "instanceof", "RegExp", ")", "{", "return", "!", "regex", ".", "test", "(", "sUrl", ")", ";", "}", "else", "{", "that", ".", "oLog", ".", "error", "(", "sModuleName", "+", "\" - Invalid regular expression for filter.\"", ")", ";", "return", "true", ";", "}", "}", ")", ";", "}" ]
Checks a URL against an array of regex if its filtered. If the RequestRecorder is paused, the URL is filtered, too. @param {string} sUrl URL to check. @param {RegExp[]} aEntriesUrlFilter Array of regex filters. @returns {boolean} If the URL is filterd true is returned.
[ "Checks", "a", "URL", "against", "an", "array", "of", "regex", "if", "its", "filtered", ".", "If", "the", "RequestRecorder", "is", "paused", "the", "URL", "is", "filtered", "too", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/thirdparty/RequestRecorder.js#L406-L419
4,287
SAP/openui5
src/sap.ui.core/src/sap/ui/thirdparty/RequestRecorder.js
function(mOptions) { mOptions = mOptions || {}; if (typeof mOptions !== "object") { throw new Error("Parameter object isn't a valid object"); } // Reset all parameters to default this.mHarFileContent = null; this.aRequests = []; this.sFilename = ""; this.bIsRecording = false; this.bIsPaused = false; this.bIsDownloadDisabled = false; if (this.oSinonXhr) { this.oSinonXhr.filters = this.aSinonFilters; this.aSinonFilters = []; this.oSinonXhr.restore(); this.oSinonXhr = null; } // Restore native XHR functions if they were overwritten. for (var sFunctionName in this.mXhrNativeFunctions) { if (this.mXhrNativeFunctions.hasOwnProperty(sFunctionName)) { window.XMLHttpRequest.prototype[sFunctionName] = this.mXhrNativeFunctions[sFunctionName]; } } this.mXhrNativeFunctions = {}; // Set options to provided values or to default this.bIsDownloadDisabled = mOptions.disableDownload === true; this.bPromptForDownloadFilename = mOptions.promptForDownloadFilename === true; if (mOptions.delay) { if (mOptions.delay === true) { this.mDelaySettings = {}; // Use delay of recording } else { this.mDelaySettings = mOptions.delay; } } else { this.mDelaySettings = { max: 0 }; // default: no delay } if (mOptions.entriesUrlFilter) { if (Array.isArray(mOptions.entriesUrlFilter)) { this.aEntriesUrlFilter = mOptions.entriesUrlFilter; } else { this.aEntriesUrlFilter = [mOptions.entriesUrlFilter]; } } else { this.aEntriesUrlFilter = [new RegExp(".*")]; // default: no filtering } if (mOptions.entriesUrlReplace) { if (Array.isArray(mOptions.entriesUrlReplace)) { this.aEntriesUrlReplace = mOptions.entriesUrlReplace; } else { this.aEntriesUrlReplace = [mOptions.entriesUrlReplace]; } } else { this.aEntriesUrlReplace = []; } if (mOptions.customGroupNameCallback && typeof mOptions.customGroupNameCallback === "function") { this.fnCustomGroupNameCallback = mOptions.customGroupNameCallback; } else { this.fnCustomGroupNameCallback = function() { return false; }; // default: Empty Callback function used } }
javascript
function(mOptions) { mOptions = mOptions || {}; if (typeof mOptions !== "object") { throw new Error("Parameter object isn't a valid object"); } // Reset all parameters to default this.mHarFileContent = null; this.aRequests = []; this.sFilename = ""; this.bIsRecording = false; this.bIsPaused = false; this.bIsDownloadDisabled = false; if (this.oSinonXhr) { this.oSinonXhr.filters = this.aSinonFilters; this.aSinonFilters = []; this.oSinonXhr.restore(); this.oSinonXhr = null; } // Restore native XHR functions if they were overwritten. for (var sFunctionName in this.mXhrNativeFunctions) { if (this.mXhrNativeFunctions.hasOwnProperty(sFunctionName)) { window.XMLHttpRequest.prototype[sFunctionName] = this.mXhrNativeFunctions[sFunctionName]; } } this.mXhrNativeFunctions = {}; // Set options to provided values or to default this.bIsDownloadDisabled = mOptions.disableDownload === true; this.bPromptForDownloadFilename = mOptions.promptForDownloadFilename === true; if (mOptions.delay) { if (mOptions.delay === true) { this.mDelaySettings = {}; // Use delay of recording } else { this.mDelaySettings = mOptions.delay; } } else { this.mDelaySettings = { max: 0 }; // default: no delay } if (mOptions.entriesUrlFilter) { if (Array.isArray(mOptions.entriesUrlFilter)) { this.aEntriesUrlFilter = mOptions.entriesUrlFilter; } else { this.aEntriesUrlFilter = [mOptions.entriesUrlFilter]; } } else { this.aEntriesUrlFilter = [new RegExp(".*")]; // default: no filtering } if (mOptions.entriesUrlReplace) { if (Array.isArray(mOptions.entriesUrlReplace)) { this.aEntriesUrlReplace = mOptions.entriesUrlReplace; } else { this.aEntriesUrlReplace = [mOptions.entriesUrlReplace]; } } else { this.aEntriesUrlReplace = []; } if (mOptions.customGroupNameCallback && typeof mOptions.customGroupNameCallback === "function") { this.fnCustomGroupNameCallback = mOptions.customGroupNameCallback; } else { this.fnCustomGroupNameCallback = function() { return false; }; // default: Empty Callback function used } }
[ "function", "(", "mOptions", ")", "{", "mOptions", "=", "mOptions", "||", "{", "}", ";", "if", "(", "typeof", "mOptions", "!==", "\"object\"", ")", "{", "throw", "new", "Error", "(", "\"Parameter object isn't a valid object\"", ")", ";", "}", "// Reset all parameters to default", "this", ".", "mHarFileContent", "=", "null", ";", "this", ".", "aRequests", "=", "[", "]", ";", "this", ".", "sFilename", "=", "\"\"", ";", "this", ".", "bIsRecording", "=", "false", ";", "this", ".", "bIsPaused", "=", "false", ";", "this", ".", "bIsDownloadDisabled", "=", "false", ";", "if", "(", "this", ".", "oSinonXhr", ")", "{", "this", ".", "oSinonXhr", ".", "filters", "=", "this", ".", "aSinonFilters", ";", "this", ".", "aSinonFilters", "=", "[", "]", ";", "this", ".", "oSinonXhr", ".", "restore", "(", ")", ";", "this", ".", "oSinonXhr", "=", "null", ";", "}", "// Restore native XHR functions if they were overwritten.", "for", "(", "var", "sFunctionName", "in", "this", ".", "mXhrNativeFunctions", ")", "{", "if", "(", "this", ".", "mXhrNativeFunctions", ".", "hasOwnProperty", "(", "sFunctionName", ")", ")", "{", "window", ".", "XMLHttpRequest", ".", "prototype", "[", "sFunctionName", "]", "=", "this", ".", "mXhrNativeFunctions", "[", "sFunctionName", "]", ";", "}", "}", "this", ".", "mXhrNativeFunctions", "=", "{", "}", ";", "// Set options to provided values or to default", "this", ".", "bIsDownloadDisabled", "=", "mOptions", ".", "disableDownload", "===", "true", ";", "this", ".", "bPromptForDownloadFilename", "=", "mOptions", ".", "promptForDownloadFilename", "===", "true", ";", "if", "(", "mOptions", ".", "delay", ")", "{", "if", "(", "mOptions", ".", "delay", "===", "true", ")", "{", "this", ".", "mDelaySettings", "=", "{", "}", ";", "// Use delay of recording", "}", "else", "{", "this", ".", "mDelaySettings", "=", "mOptions", ".", "delay", ";", "}", "}", "else", "{", "this", ".", "mDelaySettings", "=", "{", "max", ":", "0", "}", ";", "// default: no delay", "}", "if", "(", "mOptions", ".", "entriesUrlFilter", ")", "{", "if", "(", "Array", ".", "isArray", "(", "mOptions", ".", "entriesUrlFilter", ")", ")", "{", "this", ".", "aEntriesUrlFilter", "=", "mOptions", ".", "entriesUrlFilter", ";", "}", "else", "{", "this", ".", "aEntriesUrlFilter", "=", "[", "mOptions", ".", "entriesUrlFilter", "]", ";", "}", "}", "else", "{", "this", ".", "aEntriesUrlFilter", "=", "[", "new", "RegExp", "(", "\".*\"", ")", "]", ";", "// default: no filtering", "}", "if", "(", "mOptions", ".", "entriesUrlReplace", ")", "{", "if", "(", "Array", ".", "isArray", "(", "mOptions", ".", "entriesUrlReplace", ")", ")", "{", "this", ".", "aEntriesUrlReplace", "=", "mOptions", ".", "entriesUrlReplace", ";", "}", "else", "{", "this", ".", "aEntriesUrlReplace", "=", "[", "mOptions", ".", "entriesUrlReplace", "]", ";", "}", "}", "else", "{", "this", ".", "aEntriesUrlReplace", "=", "[", "]", ";", "}", "if", "(", "mOptions", ".", "customGroupNameCallback", "&&", "typeof", "mOptions", ".", "customGroupNameCallback", "===", "\"function\"", ")", "{", "this", ".", "fnCustomGroupNameCallback", "=", "mOptions", ".", "customGroupNameCallback", ";", "}", "else", "{", "this", ".", "fnCustomGroupNameCallback", "=", "function", "(", ")", "{", "return", "false", ";", "}", ";", "// default: Empty Callback function used", "}", "}" ]
Initilizes the RequestRecorder with the provided options, otherwise all default options will be set. This method is used to init and also to RESET the needed paramters before replay and recording. It restores sinon and the native XHR functions which are overwritten during the recording. @param {object} mOptions The options parameter from the public API (start, play, record).
[ "Initilizes", "the", "RequestRecorder", "with", "the", "provided", "options", "otherwise", "all", "default", "options", "will", "be", "set", ".", "This", "method", "is", "used", "to", "init", "and", "also", "to", "RESET", "the", "needed", "paramters", "before", "replay", "and", "recording", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/thirdparty/RequestRecorder.js#L429-L494
4,288
SAP/openui5
src/sap.ui.core/src/sap/ui/thirdparty/RequestRecorder.js
function(locationUrl, options) { try { // Try to start play-mode this.play(locationUrl, options); } catch (e) { // If play-mode could not be started, try to record instead. var oUri = new URI(locationUrl); var sExtension = oUri.suffix(); // Check if the provided URL is a har file, maybe the wrong url is provided if (sExtension != "har") { _private.oLog.warning(sModuleName + " - Invalid file extension: " + sExtension + ", please use '.har' files."); } this.record(oUri.filename().replace("." + sExtension, ""), options); } }
javascript
function(locationUrl, options) { try { // Try to start play-mode this.play(locationUrl, options); } catch (e) { // If play-mode could not be started, try to record instead. var oUri = new URI(locationUrl); var sExtension = oUri.suffix(); // Check if the provided URL is a har file, maybe the wrong url is provided if (sExtension != "har") { _private.oLog.warning(sModuleName + " - Invalid file extension: " + sExtension + ", please use '.har' files."); } this.record(oUri.filename().replace("." + sExtension, ""), options); } }
[ "function", "(", "locationUrl", ",", "options", ")", "{", "try", "{", "// Try to start play-mode", "this", ".", "play", "(", "locationUrl", ",", "options", ")", ";", "}", "catch", "(", "e", ")", "{", "// If play-mode could not be started, try to record instead.", "var", "oUri", "=", "new", "URI", "(", "locationUrl", ")", ";", "var", "sExtension", "=", "oUri", ".", "suffix", "(", ")", ";", "// Check if the provided URL is a har file, maybe the wrong url is provided", "if", "(", "sExtension", "!=", "\"har\"", ")", "{", "_private", ".", "oLog", ".", "warning", "(", "sModuleName", "+", "\" - Invalid file extension: \"", "+", "sExtension", "+", "\", please use '.har' files.\"", ")", ";", "}", "this", ".", "record", "(", "oUri", ".", "filename", "(", ")", ".", "replace", "(", "\".\"", "+", "sExtension", ",", "\"\"", ")", ",", "options", ")", ";", "}", "}" ]
Start with existing locationUrl or inline entries results in a playback. If the file does not exist, XMLHttpRequests are not faked and the recording starts. @param {string|Array} locationUrl Specifies from which location the file is loaded. If it is not found, the recording is started. The provided filename is the name of the output har file. This parameter can be the entries array for overloading the function. @param {object} [options] Contains optional parameters to config the RequestRecorder: {boolean|object} [options.delay] If a the parameter is equals true, the recorded delay timings are used, instead of the default delay equals zero. If a map as parameter is used, the delay is calculated with the delaysettings in the object. Possible settings are max, min, offset, factor. {function} [options.customGroupNameCallback] A callback is used to determine the custom groupname of the current XMLHttpRequest. If the callback returns a falsy value, the default groupname is used. {boolean} [options.disableDownload] Set this flag to true if you don´t want to download the recording after the recording is finished. This parameter is only used for testing purposes. {boolean} [options.promptForDownloadFilename] Activates a prompt popup after stop is called to enter a desired filename. {array|RegExp} [options.entriesUrlFilter] A list of regular expressions, if it matches the URL the request-entry is filtered. array|object} [options.entriesUrlReplace] A list of objects with regex and value to replace. E.g.: "{ regex: new RegExp("RegexToSearchForInUrl"), "value": "newValueString" }"
[ "Start", "with", "existing", "locationUrl", "or", "inline", "entries", "results", "in", "a", "playback", ".", "If", "the", "file", "does", "not", "exist", "XMLHttpRequests", "are", "not", "faked", "and", "the", "recording", "starts", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/thirdparty/RequestRecorder.js#L543-L557
4,289
SAP/openui5
src/sap.ui.core/src/sap/ui/thirdparty/RequestRecorder.js
function(filename, options) { _private.oLog.info(sModuleName + " - Record"); if (window.XMLHttpRequest.name === 'FakeXMLHttpRequest') { _private.oLog.warning(sModuleName + " - Sinon FakeXMLHttpRequest is enabled by another application, recording could be defective"); } if (_private.isRecordStarted()) { _private.oLog.error(sModuleName + " - RequestRecorder is already recording, please stop first..."); return; } _private.init(options); _private.sFilename = filename; _private.bIsRecording = true; // Overwrite the open method to get the required request parameters (method, URL, headers) and assign // a group name if provided. _private.mXhrNativeFunctions.open = window.XMLHttpRequest.prototype.open; window.XMLHttpRequest.prototype.open = function() { this._requestParams = this._requestParams || {}; this._requestParams.method = arguments[0]; this._requestParams.url = arguments[1]; this._requestParams.customGroupName = _private.fnCustomGroupNameCallback(); this._requestParams.headers = this._requestParams.headers || []; _private.mXhrNativeFunctions.open.apply(this, arguments); }; // Overwrite the setRequestHeader method to record the request headers. _private.mXhrNativeFunctions.setRequestHeader = window.XMLHttpRequest.prototype.setRequestHeader; window.XMLHttpRequest.prototype.setRequestHeader = function(sHeaderName, sHeaderValue) { this._requestParams = this._requestParams || { headers: [] }; this._requestParams.headers.push({ name: sHeaderName, value: sHeaderValue }); _private.mXhrNativeFunctions.setRequestHeader.apply(this, arguments); }; // Overwrite the send method to get the response and the collected data from the XMLHttpRequest _private.mXhrNativeFunctions.send = window.XMLHttpRequest.prototype.send; window.XMLHttpRequest.prototype.send = function() { if (!_private.isUrlFiltered(this._requestParams.url, _private.aEntriesUrlFilter)) { var fTimestamp = _private.preciseDateNow(); // If the onreadystatechange is already specified by another application, it is called, too. var fnOldStateChanged = this.onreadystatechange; this.onreadystatechange = function() { if (this.readyState === 4) { _private.aRequests.push(_private.prepareRequestForHar(this, fTimestamp)); _private.oLog.info( sModuleName + " - Record XMLHttpRequest. Method: " + this._requestParams.method + ", URL: " + this._requestParams.url ); } if (fnOldStateChanged) { fnOldStateChanged.apply(this, arguments); } }; } _private.mXhrNativeFunctions.send.apply(this, arguments); }; }
javascript
function(filename, options) { _private.oLog.info(sModuleName + " - Record"); if (window.XMLHttpRequest.name === 'FakeXMLHttpRequest') { _private.oLog.warning(sModuleName + " - Sinon FakeXMLHttpRequest is enabled by another application, recording could be defective"); } if (_private.isRecordStarted()) { _private.oLog.error(sModuleName + " - RequestRecorder is already recording, please stop first..."); return; } _private.init(options); _private.sFilename = filename; _private.bIsRecording = true; // Overwrite the open method to get the required request parameters (method, URL, headers) and assign // a group name if provided. _private.mXhrNativeFunctions.open = window.XMLHttpRequest.prototype.open; window.XMLHttpRequest.prototype.open = function() { this._requestParams = this._requestParams || {}; this._requestParams.method = arguments[0]; this._requestParams.url = arguments[1]; this._requestParams.customGroupName = _private.fnCustomGroupNameCallback(); this._requestParams.headers = this._requestParams.headers || []; _private.mXhrNativeFunctions.open.apply(this, arguments); }; // Overwrite the setRequestHeader method to record the request headers. _private.mXhrNativeFunctions.setRequestHeader = window.XMLHttpRequest.prototype.setRequestHeader; window.XMLHttpRequest.prototype.setRequestHeader = function(sHeaderName, sHeaderValue) { this._requestParams = this._requestParams || { headers: [] }; this._requestParams.headers.push({ name: sHeaderName, value: sHeaderValue }); _private.mXhrNativeFunctions.setRequestHeader.apply(this, arguments); }; // Overwrite the send method to get the response and the collected data from the XMLHttpRequest _private.mXhrNativeFunctions.send = window.XMLHttpRequest.prototype.send; window.XMLHttpRequest.prototype.send = function() { if (!_private.isUrlFiltered(this._requestParams.url, _private.aEntriesUrlFilter)) { var fTimestamp = _private.preciseDateNow(); // If the onreadystatechange is already specified by another application, it is called, too. var fnOldStateChanged = this.onreadystatechange; this.onreadystatechange = function() { if (this.readyState === 4) { _private.aRequests.push(_private.prepareRequestForHar(this, fTimestamp)); _private.oLog.info( sModuleName + " - Record XMLHttpRequest. Method: " + this._requestParams.method + ", URL: " + this._requestParams.url ); } if (fnOldStateChanged) { fnOldStateChanged.apply(this, arguments); } }; } _private.mXhrNativeFunctions.send.apply(this, arguments); }; }
[ "function", "(", "filename", ",", "options", ")", "{", "_private", ".", "oLog", ".", "info", "(", "sModuleName", "+", "\" - Record\"", ")", ";", "if", "(", "window", ".", "XMLHttpRequest", ".", "name", "===", "'FakeXMLHttpRequest'", ")", "{", "_private", ".", "oLog", ".", "warning", "(", "sModuleName", "+", "\" - Sinon FakeXMLHttpRequest is enabled by another application, recording could be defective\"", ")", ";", "}", "if", "(", "_private", ".", "isRecordStarted", "(", ")", ")", "{", "_private", ".", "oLog", ".", "error", "(", "sModuleName", "+", "\" - RequestRecorder is already recording, please stop first...\"", ")", ";", "return", ";", "}", "_private", ".", "init", "(", "options", ")", ";", "_private", ".", "sFilename", "=", "filename", ";", "_private", ".", "bIsRecording", "=", "true", ";", "// Overwrite the open method to get the required request parameters (method, URL, headers) and assign", "// a group name if provided.", "_private", ".", "mXhrNativeFunctions", ".", "open", "=", "window", ".", "XMLHttpRequest", ".", "prototype", ".", "open", ";", "window", ".", "XMLHttpRequest", ".", "prototype", ".", "open", "=", "function", "(", ")", "{", "this", ".", "_requestParams", "=", "this", ".", "_requestParams", "||", "{", "}", ";", "this", ".", "_requestParams", ".", "method", "=", "arguments", "[", "0", "]", ";", "this", ".", "_requestParams", ".", "url", "=", "arguments", "[", "1", "]", ";", "this", ".", "_requestParams", ".", "customGroupName", "=", "_private", ".", "fnCustomGroupNameCallback", "(", ")", ";", "this", ".", "_requestParams", ".", "headers", "=", "this", ".", "_requestParams", ".", "headers", "||", "[", "]", ";", "_private", ".", "mXhrNativeFunctions", ".", "open", ".", "apply", "(", "this", ",", "arguments", ")", ";", "}", ";", "// Overwrite the setRequestHeader method to record the request headers.", "_private", ".", "mXhrNativeFunctions", ".", "setRequestHeader", "=", "window", ".", "XMLHttpRequest", ".", "prototype", ".", "setRequestHeader", ";", "window", ".", "XMLHttpRequest", ".", "prototype", ".", "setRequestHeader", "=", "function", "(", "sHeaderName", ",", "sHeaderValue", ")", "{", "this", ".", "_requestParams", "=", "this", ".", "_requestParams", "||", "{", "headers", ":", "[", "]", "}", ";", "this", ".", "_requestParams", ".", "headers", ".", "push", "(", "{", "name", ":", "sHeaderName", ",", "value", ":", "sHeaderValue", "}", ")", ";", "_private", ".", "mXhrNativeFunctions", ".", "setRequestHeader", ".", "apply", "(", "this", ",", "arguments", ")", ";", "}", ";", "// Overwrite the send method to get the response and the collected data from the XMLHttpRequest", "_private", ".", "mXhrNativeFunctions", ".", "send", "=", "window", ".", "XMLHttpRequest", ".", "prototype", ".", "send", ";", "window", ".", "XMLHttpRequest", ".", "prototype", ".", "send", "=", "function", "(", ")", "{", "if", "(", "!", "_private", ".", "isUrlFiltered", "(", "this", ".", "_requestParams", ".", "url", ",", "_private", ".", "aEntriesUrlFilter", ")", ")", "{", "var", "fTimestamp", "=", "_private", ".", "preciseDateNow", "(", ")", ";", "// If the onreadystatechange is already specified by another application, it is called, too.", "var", "fnOldStateChanged", "=", "this", ".", "onreadystatechange", ";", "this", ".", "onreadystatechange", "=", "function", "(", ")", "{", "if", "(", "this", ".", "readyState", "===", "4", ")", "{", "_private", ".", "aRequests", ".", "push", "(", "_private", ".", "prepareRequestForHar", "(", "this", ",", "fTimestamp", ")", ")", ";", "_private", ".", "oLog", ".", "info", "(", "sModuleName", "+", "\" - Record XMLHttpRequest. Method: \"", "+", "this", ".", "_requestParams", ".", "method", "+", "\", URL: \"", "+", "this", ".", "_requestParams", ".", "url", ")", ";", "}", "if", "(", "fnOldStateChanged", ")", "{", "fnOldStateChanged", ".", "apply", "(", "this", ",", "arguments", ")", ";", "}", "}", ";", "}", "_private", ".", "mXhrNativeFunctions", ".", "send", ".", "apply", "(", "this", ",", "arguments", ")", ";", "}", ";", "}" ]
Start recording with a desired filename and the required options. @param {string|object} filename The name of the har file to be recorded. @param {object} [options] Contains optional parameters to config the RequestRecorder: {function} [options.customGroupNameCallback] A callback is used to determine the custom groupname of the current XMLHttpRequest. If the callback returns a falsy value, the default groupname is used. boolean} [options.disableDownload] Set this flag to true if you don´t want to download the recording after the recording is finished. This parameter is only used for testing purposes. {boolean} [options.promptForDownloadFilename] Activates a prompt popup after stop is called to enter a desired filename. {array|RegExp} [options.entriesUrlFilter] A list of regular expressions, if it matches the URL the request-entry is filtered.
[ "Start", "recording", "with", "a", "desired", "filename", "and", "the", "required", "options", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/thirdparty/RequestRecorder.js#L569-L628
4,290
SAP/openui5
src/sap.ui.core/src/sap/ui/thirdparty/RequestRecorder.js
function() { _private.oLog.info(sModuleName + " - Stop"); var mHarContent = null; if (_private.isRecordStarted()) { mHarContent = _private.getHarContent(true); } // do this for a full cleanup _private.init(); return mHarContent; }
javascript
function() { _private.oLog.info(sModuleName + " - Stop"); var mHarContent = null; if (_private.isRecordStarted()) { mHarContent = _private.getHarContent(true); } // do this for a full cleanup _private.init(); return mHarContent; }
[ "function", "(", ")", "{", "_private", ".", "oLog", ".", "info", "(", "sModuleName", "+", "\" - Stop\"", ")", ";", "var", "mHarContent", "=", "null", ";", "if", "(", "_private", ".", "isRecordStarted", "(", ")", ")", "{", "mHarContent", "=", "_private", ".", "getHarContent", "(", "true", ")", ";", "}", "// do this for a full cleanup", "_private", ".", "init", "(", ")", ";", "return", "mHarContent", ";", "}" ]
Stops the recording or the player. If downloading is not disabled, the har file is downloaded automatically. @returns {Object|null} In record mode the har file is returned as json, otherwise null is returned.
[ "Stops", "the", "recording", "or", "the", "player", ".", "If", "downloading", "is", "not", "disabled", "the", "har", "file", "is", "downloaded", "automatically", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/thirdparty/RequestRecorder.js#L736-L747
4,291
SAP/openui5
src/sap.ui.core/src/sap/ui/thirdparty/RequestRecorder.js
function(deleteRecordings) { var bDeleteRecordings = deleteRecordings || false; _private.oLog.info(sModuleName + " - Get Recordings"); return _private.getHarContent(bDeleteRecordings); }
javascript
function(deleteRecordings) { var bDeleteRecordings = deleteRecordings || false; _private.oLog.info(sModuleName + " - Get Recordings"); return _private.getHarContent(bDeleteRecordings); }
[ "function", "(", "deleteRecordings", ")", "{", "var", "bDeleteRecordings", "=", "deleteRecordings", "||", "false", ";", "_private", ".", "oLog", ".", "info", "(", "sModuleName", "+", "\" - Get Recordings\"", ")", ";", "return", "_private", ".", "getHarContent", "(", "bDeleteRecordings", ")", ";", "}" ]
Delivers the current recordings in HAR format during record mode and the recording is not aborted. Requests which are not completed with readyState 4 are not included. @param {boolean} [deleteRecordings] True if the recordings should be deleted. @returns {Object} The har file as json.
[ "Delivers", "the", "current", "recordings", "in", "HAR", "format", "during", "record", "mode", "and", "the", "recording", "is", "not", "aborted", ".", "Requests", "which", "are", "not", "completed", "with", "readyState", "4", "are", "not", "included", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/thirdparty/RequestRecorder.js#L773-L777
4,292
SAP/openui5
src/sap.ui.core/src/sap/ui/thirdparty/RequestRecorder.js
function(url, response, method, status, headers) { var aHeaders = headers || []; aHeaders.push({ "name": "Content-Type", "value": "application/json;charset=utf-8" }); this.addResponse(url, response, method, status, aHeaders); }
javascript
function(url, response, method, status, headers) { var aHeaders = headers || []; aHeaders.push({ "name": "Content-Type", "value": "application/json;charset=utf-8" }); this.addResponse(url, response, method, status, aHeaders); }
[ "function", "(", "url", ",", "response", ",", "method", ",", "status", ",", "headers", ")", "{", "var", "aHeaders", "=", "headers", "||", "[", "]", ";", "aHeaders", ".", "push", "(", "{", "\"name\"", ":", "\"Content-Type\"", ",", "\"value\"", ":", "\"application/json;charset=utf-8\"", "}", ")", ";", "this", ".", "addResponse", "(", "url", ",", "response", ",", "method", ",", "status", ",", "aHeaders", ")", ";", "}" ]
Adds a JSON encoded response for a request with the provided URL. @param {string} url The requested URL. @param {string|function} response The returned response as string or callback. @param {string} [method] The HTTP method (e.g. GET, POST), default is GET. @param {int} [status] The desired status, default is 200. @param {array} [headers] The response Headers, the Content-Type for JSON is already set for this method.
[ "Adds", "a", "JSON", "encoded", "response", "for", "a", "request", "with", "the", "provided", "URL", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/thirdparty/RequestRecorder.js#L788-L795
4,293
SAP/openui5
src/sap.ui.core/src/sap/ui/thirdparty/RequestRecorder.js
function(url, response, method, status, headers) { if (!_private.isPlayStarted()) { throw new Error("Start the player first before you add a response."); } var sMethod = method || "GET"; var aHeaders = headers || [{ "name": "Content-Type", "value": "text/plain;charset=utf-8" }]; var iStatus = status || 200; var oEntry = { "startedDateTime": new Date().toISOString(), "time": 0, "request": { "headers": [], "url": url, "method": sMethod }, "response": { "status": iStatus, "content": { "text": response }, "headers": aHeaders } }; var iIndex = _private.mHarFileContent.log.entries.push(oEntry) - 1; _private.addEntryToMapping(_private.mHarFileContent, _private.mHarFileContent.log.entries, iIndex); }
javascript
function(url, response, method, status, headers) { if (!_private.isPlayStarted()) { throw new Error("Start the player first before you add a response."); } var sMethod = method || "GET"; var aHeaders = headers || [{ "name": "Content-Type", "value": "text/plain;charset=utf-8" }]; var iStatus = status || 200; var oEntry = { "startedDateTime": new Date().toISOString(), "time": 0, "request": { "headers": [], "url": url, "method": sMethod }, "response": { "status": iStatus, "content": { "text": response }, "headers": aHeaders } }; var iIndex = _private.mHarFileContent.log.entries.push(oEntry) - 1; _private.addEntryToMapping(_private.mHarFileContent, _private.mHarFileContent.log.entries, iIndex); }
[ "function", "(", "url", ",", "response", ",", "method", ",", "status", ",", "headers", ")", "{", "if", "(", "!", "_private", ".", "isPlayStarted", "(", ")", ")", "{", "throw", "new", "Error", "(", "\"Start the player first before you add a response.\"", ")", ";", "}", "var", "sMethod", "=", "method", "||", "\"GET\"", ";", "var", "aHeaders", "=", "headers", "||", "[", "{", "\"name\"", ":", "\"Content-Type\"", ",", "\"value\"", ":", "\"text/plain;charset=utf-8\"", "}", "]", ";", "var", "iStatus", "=", "status", "||", "200", ";", "var", "oEntry", "=", "{", "\"startedDateTime\"", ":", "new", "Date", "(", ")", ".", "toISOString", "(", ")", ",", "\"time\"", ":", "0", ",", "\"request\"", ":", "{", "\"headers\"", ":", "[", "]", ",", "\"url\"", ":", "url", ",", "\"method\"", ":", "sMethod", "}", ",", "\"response\"", ":", "{", "\"status\"", ":", "iStatus", ",", "\"content\"", ":", "{", "\"text\"", ":", "response", "}", ",", "\"headers\"", ":", "aHeaders", "}", "}", ";", "var", "iIndex", "=", "_private", ".", "mHarFileContent", ".", "log", ".", "entries", ".", "push", "(", "oEntry", ")", "-", "1", ";", "_private", ".", "addEntryToMapping", "(", "_private", ".", "mHarFileContent", ",", "_private", ".", "mHarFileContent", ".", "log", ".", "entries", ",", "iIndex", ")", ";", "}" ]
Adds a response for a request with the provided URL. @param {string} url The requested URL. @param {string|function} response The returned response as string or callback. @param {string} [method] The HTTP method (e.g. GET, POST), default is GET. @param {int} [status] The desired status, default is 200. @param {array} [headers] The response Headers, default is text/plain.
[ "Adds", "a", "response", "for", "a", "request", "with", "the", "provided", "URL", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/thirdparty/RequestRecorder.js#L806-L834
4,294
SAP/openui5
src/sap.ui.commons/src/sap/ui/commons/DropdownBox.js
remove
function remove(id) { var oItem = sap.ui.getCore().byId(id); if (oItem) { oItem.destroy(); } }
javascript
function remove(id) { var oItem = sap.ui.getCore().byId(id); if (oItem) { oItem.destroy(); } }
[ "function", "remove", "(", "id", ")", "{", "var", "oItem", "=", "sap", ".", "ui", ".", "getCore", "(", ")", ".", "byId", "(", "id", ")", ";", "if", "(", "oItem", ")", "{", "oItem", ".", "destroy", "(", ")", ";", "}", "}" ]
check for and remaining history items and destroy them
[ "check", "for", "and", "remaining", "history", "items", "and", "destroy", "them" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.commons/src/sap/ui/commons/DropdownBox.js#L131-L136
4,295
SAP/openui5
src/sap.ui.core/src/sap/ui/model/Sorter.js
function(oContext) { var oGroup = this.fnGroup(oContext); if (typeof oGroup === "string" || typeof oGroup === "number" || typeof oGroup === "boolean" || oGroup == null) { oGroup = { key: oGroup }; } return oGroup; }
javascript
function(oContext) { var oGroup = this.fnGroup(oContext); if (typeof oGroup === "string" || typeof oGroup === "number" || typeof oGroup === "boolean" || oGroup == null) { oGroup = { key: oGroup }; } return oGroup; }
[ "function", "(", "oContext", ")", "{", "var", "oGroup", "=", "this", ".", "fnGroup", "(", "oContext", ")", ";", "if", "(", "typeof", "oGroup", "===", "\"string\"", "||", "typeof", "oGroup", "===", "\"number\"", "||", "typeof", "oGroup", "===", "\"boolean\"", "||", "oGroup", "==", "null", ")", "{", "oGroup", "=", "{", "key", ":", "oGroup", "}", ";", "}", "return", "oGroup", ";", "}" ]
Returns a group object, at least containing a key property for group detection. May contain additional properties as provided by a custom group function. @param {sap.ui.model.Context} oContext the binding context @return {object} An object containing a key property and optional custom properties @public
[ "Returns", "a", "group", "object", "at", "least", "containing", "a", "key", "property", "for", "group", "detection", ".", "May", "contain", "additional", "properties", "as", "provided", "by", "a", "custom", "group", "function", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/Sorter.js#L82-L90
4,296
SAP/openui5
lib/jsdoc/ui5/plugin.js
location
function location(doclet) { var filename = (doclet.meta && doclet.meta.filename) || "unknown"; return " #" + ui5data(doclet).id + "@" + filename + (doclet.meta.lineno != null ? ":" + doclet.meta.lineno : "") + (doclet.synthetic ? "(synthetic)" : ""); }
javascript
function location(doclet) { var filename = (doclet.meta && doclet.meta.filename) || "unknown"; return " #" + ui5data(doclet).id + "@" + filename + (doclet.meta.lineno != null ? ":" + doclet.meta.lineno : "") + (doclet.synthetic ? "(synthetic)" : ""); }
[ "function", "location", "(", "doclet", ")", "{", "var", "filename", "=", "(", "doclet", ".", "meta", "&&", "doclet", ".", "meta", ".", "filename", ")", "||", "\"unknown\"", ";", "return", "\" #\"", "+", "ui5data", "(", "doclet", ")", ".", "id", "+", "\"@\"", "+", "filename", "+", "(", "doclet", ".", "meta", ".", "lineno", "!=", "null", "?", "\":\"", "+", "doclet", ".", "meta", ".", "lineno", ":", "\"\"", ")", "+", "(", "doclet", ".", "synthetic", "?", "\"(synthetic)\"", ":", "\"\"", ")", ";", "}" ]
Creates a human readable location info for a given doclet. @param {Doclet} doclet Doclet to get a location info for @returns {string} A human readable location info
[ "Creates", "a", "human", "readable", "location", "info", "for", "a", "given", "doclet", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/lib/jsdoc/ui5/plugin.js#L1759-L1762
4,297
SAP/openui5
lib/jsdoc/ui5/plugin.js
unwrap
function unwrap(docletSrc) { if (!docletSrc) { return ''; } // note: keep trailing whitespace for @examples // extra opening/closing stars are ignored // left margin is considered a star and a space // use the /m flag on regex to avoid having to guess what this platform's newline is docletSrc = docletSrc.replace(/^\/\*\*+/, '') // remove opening slash+stars .replace(/\**\*\/$/, "\\Z") // replace closing star slash with end-marker .replace(/^\s*(\* ?|\\Z)/gm, '') // remove left margin like: spaces+star or spaces+end-marker .replace(/\s*\\Z$/g, ''); // remove end-marker return docletSrc; }
javascript
function unwrap(docletSrc) { if (!docletSrc) { return ''; } // note: keep trailing whitespace for @examples // extra opening/closing stars are ignored // left margin is considered a star and a space // use the /m flag on regex to avoid having to guess what this platform's newline is docletSrc = docletSrc.replace(/^\/\*\*+/, '') // remove opening slash+stars .replace(/\**\*\/$/, "\\Z") // replace closing star slash with end-marker .replace(/^\s*(\* ?|\\Z)/gm, '') // remove left margin like: spaces+star or spaces+end-marker .replace(/\s*\\Z$/g, ''); // remove end-marker return docletSrc; }
[ "function", "unwrap", "(", "docletSrc", ")", "{", "if", "(", "!", "docletSrc", ")", "{", "return", "''", ";", "}", "// note: keep trailing whitespace for @examples", "// extra opening/closing stars are ignored", "// left margin is considered a star and a space", "// use the /m flag on regex to avoid having to guess what this platform's newline is", "docletSrc", "=", "docletSrc", ".", "replace", "(", "/", "^\\/\\*\\*+", "/", ",", "''", ")", "// remove opening slash+stars", ".", "replace", "(", "/", "\\**\\*\\/$", "/", ",", "\"\\\\Z\"", ")", "// replace closing star slash with end-marker", ".", "replace", "(", "/", "^\\s*(\\* ?|\\\\Z)", "/", "gm", ",", "''", ")", "// remove left margin like: spaces+star or spaces+end-marker", ".", "replace", "(", "/", "\\s*\\\\Z$", "/", "g", ",", "''", ")", ";", "// remove end-marker", "return", "docletSrc", ";", "}" ]
Removes the mandatory comment markers and the optional but common asterisks at the beginning of each JSDoc comment line. The result is easier to parse/analyze. Implementation is a 1:1 copy from JSDoc's lib/jsdoc/doclet.js (closure function, not directly reusable) @param {string} docletSrc the source comment with or without block comment markers @returns {string} the unwrapped content of the JSDoc comment
[ "Removes", "the", "mandatory", "comment", "markers", "and", "the", "optional", "but", "common", "asterisks", "at", "the", "beginning", "of", "each", "JSDoc", "comment", "line", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/lib/jsdoc/ui5/plugin.js#L1874-L1888
4,298
SAP/openui5
lib/jsdoc/ui5/plugin.js
preprocessComment
function preprocessComment(e) { var src = e.comment; // add a default visibility if ( !/@private|@public|@protected|@sap-restricted|@ui5-restricted/.test(src) ) { src = unwrap(src); src = src + "\n@private"; src = wrap(src); // console.log("added default visibility to '" + src + "'"); } if ( /@class/.test(src) && /@static/.test(src) ) { warning("combination of @class and @static is no longer supported with jsdoc3, converting it to @namespace and @classdesc: (line " + e.lineno + ")"); src = unwrap(src); src = src.replace(/@class/, "@classdesc").replace(/@static/, "@namespace"); src = wrap(src); //console.log(src); } return src; }
javascript
function preprocessComment(e) { var src = e.comment; // add a default visibility if ( !/@private|@public|@protected|@sap-restricted|@ui5-restricted/.test(src) ) { src = unwrap(src); src = src + "\n@private"; src = wrap(src); // console.log("added default visibility to '" + src + "'"); } if ( /@class/.test(src) && /@static/.test(src) ) { warning("combination of @class and @static is no longer supported with jsdoc3, converting it to @namespace and @classdesc: (line " + e.lineno + ")"); src = unwrap(src); src = src.replace(/@class/, "@classdesc").replace(/@static/, "@namespace"); src = wrap(src); //console.log(src); } return src; }
[ "function", "preprocessComment", "(", "e", ")", "{", "var", "src", "=", "e", ".", "comment", ";", "// add a default visibility", "if", "(", "!", "/", "@private|@public|@protected|@sap-restricted|@ui5-restricted", "/", ".", "test", "(", "src", ")", ")", "{", "src", "=", "unwrap", "(", "src", ")", ";", "src", "=", "src", "+", "\"\\n@private\"", ";", "src", "=", "wrap", "(", "src", ")", ";", "// console.log(\"added default visibility to '\" + src + \"'\");", "}", "if", "(", "/", "@class", "/", ".", "test", "(", "src", ")", "&&", "/", "@static", "/", ".", "test", "(", "src", ")", ")", "{", "warning", "(", "\"combination of @class and @static is no longer supported with jsdoc3, converting it to @namespace and @classdesc: (line \"", "+", "e", ".", "lineno", "+", "\")\"", ")", ";", "src", "=", "unwrap", "(", "src", ")", ";", "src", "=", "src", ".", "replace", "(", "/", "@class", "/", ",", "\"@classdesc\"", ")", ".", "replace", "(", "/", "@static", "/", ",", "\"@namespace\"", ")", ";", "src", "=", "wrap", "(", "src", ")", ";", "//console.log(src);", "}", "return", "src", ";", "}" ]
Pre-processes a JSDoc comment string to ensure some UI5 standards. @param {event} e Event for the new comment @returns {event} Returns the modified event
[ "Pre", "-", "processes", "a", "JSDoc", "comment", "string", "to", "ensure", "some", "UI5", "standards", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/lib/jsdoc/ui5/plugin.js#L1910-L1932
4,299
SAP/openui5
lib/jsdoc/ui5/plugin.js
function(e) { pathPrefixes = env.opts._.reduce(function(result, fileOrDir) { fileOrDir = path.resolve( path.normalize(fileOrDir) ); if ( fs.statSync(fileOrDir).isDirectory() ) { // ensure a trailing path separator if ( fileOrDir.indexOf(path.sep, fileOrDir.length - path.sep.length) < 0 ) { fileOrDir += path.sep; } result.push(fileOrDir); } return result; }, []); resourceNamePrefixes = pluginConfig.resourceNamePrefixes || []; if ( !Array.isArray(resourceNamePrefixes) ) { resourceNamePrefixes = [resourceNamePrefixes]; } resourceNamePrefixes.forEach(ensureEndingSlash); while ( resourceNamePrefixes.length < pathPrefixes.length ) { resourceNamePrefixes.push(''); } debug("path prefixes " + JSON.stringify(pathPrefixes)); debug("resource name prefixes " + JSON.stringify(resourceNamePrefixes)); }
javascript
function(e) { pathPrefixes = env.opts._.reduce(function(result, fileOrDir) { fileOrDir = path.resolve( path.normalize(fileOrDir) ); if ( fs.statSync(fileOrDir).isDirectory() ) { // ensure a trailing path separator if ( fileOrDir.indexOf(path.sep, fileOrDir.length - path.sep.length) < 0 ) { fileOrDir += path.sep; } result.push(fileOrDir); } return result; }, []); resourceNamePrefixes = pluginConfig.resourceNamePrefixes || []; if ( !Array.isArray(resourceNamePrefixes) ) { resourceNamePrefixes = [resourceNamePrefixes]; } resourceNamePrefixes.forEach(ensureEndingSlash); while ( resourceNamePrefixes.length < pathPrefixes.length ) { resourceNamePrefixes.push(''); } debug("path prefixes " + JSON.stringify(pathPrefixes)); debug("resource name prefixes " + JSON.stringify(resourceNamePrefixes)); }
[ "function", "(", "e", ")", "{", "pathPrefixes", "=", "env", ".", "opts", ".", "_", ".", "reduce", "(", "function", "(", "result", ",", "fileOrDir", ")", "{", "fileOrDir", "=", "path", ".", "resolve", "(", "path", ".", "normalize", "(", "fileOrDir", ")", ")", ";", "if", "(", "fs", ".", "statSync", "(", "fileOrDir", ")", ".", "isDirectory", "(", ")", ")", "{", "// ensure a trailing path separator", "if", "(", "fileOrDir", ".", "indexOf", "(", "path", ".", "sep", ",", "fileOrDir", ".", "length", "-", "path", ".", "sep", ".", "length", ")", "<", "0", ")", "{", "fileOrDir", "+=", "path", ".", "sep", ";", "}", "result", ".", "push", "(", "fileOrDir", ")", ";", "}", "return", "result", ";", "}", ",", "[", "]", ")", ";", "resourceNamePrefixes", "=", "pluginConfig", ".", "resourceNamePrefixes", "||", "[", "]", ";", "if", "(", "!", "Array", ".", "isArray", "(", "resourceNamePrefixes", ")", ")", "{", "resourceNamePrefixes", "=", "[", "resourceNamePrefixes", "]", ";", "}", "resourceNamePrefixes", ".", "forEach", "(", "ensureEndingSlash", ")", ";", "while", "(", "resourceNamePrefixes", ".", "length", "<", "pathPrefixes", ".", "length", ")", "{", "resourceNamePrefixes", ".", "push", "(", "''", ")", ";", "}", "debug", "(", "\"path prefixes \"", "+", "JSON", ".", "stringify", "(", "pathPrefixes", ")", ")", ";", "debug", "(", "\"resource name prefixes \"", "+", "JSON", ".", "stringify", "(", "resourceNamePrefixes", ")", ")", ";", "}" ]
Before all files are parsed, determine the common path prefix of all filenames @param {object} e Event info object
[ "Before", "all", "files", "are", "parsed", "determine", "the", "common", "path", "prefix", "of", "all", "filenames" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/lib/jsdoc/ui5/plugin.js#L2076-L2100