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,000
SAP/openui5
src/sap.ui.commons/src/sap/ui/commons/Tree.js
rememberSelectedChildren
function rememberSelectedChildren(oNode, oRootNode) { var aNodes = oNode._getNodes(), oCurrentNode; for (var i = 0; i < aNodes.length; i++) { oCurrentNode = aNodes[i]; if (oCurrentNode.getIsSelected()) { oRootNode.addAssociation("selectedForNodes", oCurrentNode, true); } rememberSelectedChildren(oCurrentNode, oRootNode); } }
javascript
function rememberSelectedChildren(oNode, oRootNode) { var aNodes = oNode._getNodes(), oCurrentNode; for (var i = 0; i < aNodes.length; i++) { oCurrentNode = aNodes[i]; if (oCurrentNode.getIsSelected()) { oRootNode.addAssociation("selectedForNodes", oCurrentNode, true); } rememberSelectedChildren(oCurrentNode, oRootNode); } }
[ "function", "rememberSelectedChildren", "(", "oNode", ",", "oRootNode", ")", "{", "var", "aNodes", "=", "oNode", ".", "_getNodes", "(", ")", ",", "oCurrentNode", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "aNodes", ".", "length", ";", "i", "++", ")", "{", "oCurrentNode", "=", "aNodes", "[", "i", "]", ";", "if", "(", "oCurrentNode", ".", "getIsSelected", "(", ")", ")", "{", "oRootNode", ".", "addAssociation", "(", "\"selectedForNodes\"", ",", "oCurrentNode", ",", "true", ")", ";", "}", "rememberSelectedChildren", "(", "oCurrentNode", ",", "oRootNode", ")", ";", "}", "}" ]
Adds references inside the collapsed node of all its selected children recursively. @param {sap.ui.commons.TreeNode} oNode The current node to look at @param {sap.ui.commons.TreeNode} oRootNode The root node that was collapsed
[ "Adds", "references", "inside", "the", "collapsed", "node", "of", "all", "its", "selected", "children", "recursively", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.commons/src/sap/ui/commons/Tree.js#L564-L577
4,001
SAP/openui5
src/sap.ui.commons/src/sap/ui/commons/MenuBar.js
function(oThis){ var iVisibleItems = 0; var jAreaRef = oThis.$("area"); var jItems = jAreaRef.children(); var bRtl = sap.ui.getCore().getConfiguration().getRTL(); var lastOffsetLeft = (bRtl ? 100000 : 0); jItems.each(function(iIdx) { if (iIdx == 0) { return true; } var currentOffsetLeft = this.offsetLeft; var bLineBreak = (bRtl ? (currentOffsetLeft >= lastOffsetLeft) : (currentOffsetLeft <= lastOffsetLeft)); if (bLineBreak) { iVisibleItems = iIdx; return false; } else if (jQuery(this).attr("id") == oThis.getId() + "-ovrflw") { // This is the overflow button, there was no line break iVisibleItems = iIdx; return false; } else { // Regular item, to the right of the last one, so just proceed lastOffsetLeft = currentOffsetLeft; return true; } }); return iVisibleItems; }
javascript
function(oThis){ var iVisibleItems = 0; var jAreaRef = oThis.$("area"); var jItems = jAreaRef.children(); var bRtl = sap.ui.getCore().getConfiguration().getRTL(); var lastOffsetLeft = (bRtl ? 100000 : 0); jItems.each(function(iIdx) { if (iIdx == 0) { return true; } var currentOffsetLeft = this.offsetLeft; var bLineBreak = (bRtl ? (currentOffsetLeft >= lastOffsetLeft) : (currentOffsetLeft <= lastOffsetLeft)); if (bLineBreak) { iVisibleItems = iIdx; return false; } else if (jQuery(this).attr("id") == oThis.getId() + "-ovrflw") { // This is the overflow button, there was no line break iVisibleItems = iIdx; return false; } else { // Regular item, to the right of the last one, so just proceed lastOffsetLeft = currentOffsetLeft; return true; } }); return iVisibleItems; }
[ "function", "(", "oThis", ")", "{", "var", "iVisibleItems", "=", "0", ";", "var", "jAreaRef", "=", "oThis", ".", "$", "(", "\"area\"", ")", ";", "var", "jItems", "=", "jAreaRef", ".", "children", "(", ")", ";", "var", "bRtl", "=", "sap", ".", "ui", ".", "getCore", "(", ")", ".", "getConfiguration", "(", ")", ".", "getRTL", "(", ")", ";", "var", "lastOffsetLeft", "=", "(", "bRtl", "?", "100000", ":", "0", ")", ";", "jItems", ".", "each", "(", "function", "(", "iIdx", ")", "{", "if", "(", "iIdx", "==", "0", ")", "{", "return", "true", ";", "}", "var", "currentOffsetLeft", "=", "this", ".", "offsetLeft", ";", "var", "bLineBreak", "=", "(", "bRtl", "?", "(", "currentOffsetLeft", ">=", "lastOffsetLeft", ")", ":", "(", "currentOffsetLeft", "<=", "lastOffsetLeft", ")", ")", ";", "if", "(", "bLineBreak", ")", "{", "iVisibleItems", "=", "iIdx", ";", "return", "false", ";", "}", "else", "if", "(", "jQuery", "(", "this", ")", ".", "attr", "(", "\"id\"", ")", "==", "oThis", ".", "getId", "(", ")", "+", "\"-ovrflw\"", ")", "{", "// This is the overflow button, there was no line break", "iVisibleItems", "=", "iIdx", ";", "return", "false", ";", "}", "else", "{", "// Regular item, to the right of the last one, so just proceed", "lastOffsetLeft", "=", "currentOffsetLeft", ";", "return", "true", ";", "}", "}", ")", ";", "return", "iVisibleItems", ";", "}" ]
Compute actual number of items currently hidden due to overflow
[ "Compute", "actual", "number", "of", "items", "currently", "hidden", "due", "to", "overflow" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.commons/src/sap/ui/commons/MenuBar.js#L446-L478
4,002
SAP/openui5
src/sap.ui.commons/src/sap/ui/commons/MenuBar.js
function(oThis){ var iVisibleItems = getVisibleItemCount(oThis); var _iVisibleItems = iVisibleItems; var jAreaRef = oThis.$("area"); var jItems = jAreaRef.children(); var jOvrFlwRef = oThis.$("ovrflw"); var bUpdateFocus = false; if (iVisibleItems < jItems.length - 1) { jOvrFlwRef.attr("style", "display:block;"); if (!oThis.oOvrFlwMnu) { oThis.oOvrFlwMnu = new Menu(oThis.getId() + "-ovrflwmnu"); oThis.oOvrFlwMnu.bUseTopStyle = oThis.getDesign() == MenuBarDesign.Header; oThis.oOvrFlwMnu.attachItemSelect(function(oEvent){ var oItem = oEvent.getParameter("item"); if (!(oItem instanceof _DelegatorMenuItem)) { var oItemRootMenu = Menu.prototype.getRootMenu.apply(oItem.getParent()); oItemRootMenu.fireItemSelect({item: oItem}); } else if (oItem.bNoSubMenu && oItem instanceof _DelegatorMenuItem) { oItem.oAlterEgoItm.fireSelect({item: oItem.oAlterEgoItm}); } }); } oThis.oOvrFlwMnu.destroyItems(); var aItems = oThis.getItems(); for (var i = 0; i < aItems.length; i++) { var oItem = aItems[i]; if (iVisibleItems != 0) { if (oItem.getVisible()) { iVisibleItems--; } if (iVisibleItems == 0) { oThis.sLastVisibleItemId = oItem.getId(); } } else { oThis.oOvrFlwMnu.addItem(new _DelegatorMenuItem(oItem)); if (oItem.getId() == oThis.sCurrentFocusedItemRefId) { bUpdateFocus = true; } } } if (sap.ui.getCore().getConfiguration().getAccessibility()) { jItems.attr("aria-setsize", _iVisibleItems + 1); jOvrFlwRef.attr("aria-posinset", _iVisibleItems + 1); } } else { jOvrFlwRef.attr("style", "display:none;"); if (oThis.oOvrFlwMnu) { oThis.oOvrFlwMnu.destroyItems(); } oThis.sLastVisibleItemId = null; if (sap.ui.getCore().getConfiguration().getAccessibility()) { jItems.attr("aria-setsize", _iVisibleItems); jOvrFlwRef.attr("aria-posinset", 0); } } jAreaRef.scrollTop(0); if (bUpdateFocus) { oThis.sCurrentFocusedItemRefId = oThis.sLastVisibleItemId; document.getElementById(oThis.sLastVisibleItemId).focus(); } }
javascript
function(oThis){ var iVisibleItems = getVisibleItemCount(oThis); var _iVisibleItems = iVisibleItems; var jAreaRef = oThis.$("area"); var jItems = jAreaRef.children(); var jOvrFlwRef = oThis.$("ovrflw"); var bUpdateFocus = false; if (iVisibleItems < jItems.length - 1) { jOvrFlwRef.attr("style", "display:block;"); if (!oThis.oOvrFlwMnu) { oThis.oOvrFlwMnu = new Menu(oThis.getId() + "-ovrflwmnu"); oThis.oOvrFlwMnu.bUseTopStyle = oThis.getDesign() == MenuBarDesign.Header; oThis.oOvrFlwMnu.attachItemSelect(function(oEvent){ var oItem = oEvent.getParameter("item"); if (!(oItem instanceof _DelegatorMenuItem)) { var oItemRootMenu = Menu.prototype.getRootMenu.apply(oItem.getParent()); oItemRootMenu.fireItemSelect({item: oItem}); } else if (oItem.bNoSubMenu && oItem instanceof _DelegatorMenuItem) { oItem.oAlterEgoItm.fireSelect({item: oItem.oAlterEgoItm}); } }); } oThis.oOvrFlwMnu.destroyItems(); var aItems = oThis.getItems(); for (var i = 0; i < aItems.length; i++) { var oItem = aItems[i]; if (iVisibleItems != 0) { if (oItem.getVisible()) { iVisibleItems--; } if (iVisibleItems == 0) { oThis.sLastVisibleItemId = oItem.getId(); } } else { oThis.oOvrFlwMnu.addItem(new _DelegatorMenuItem(oItem)); if (oItem.getId() == oThis.sCurrentFocusedItemRefId) { bUpdateFocus = true; } } } if (sap.ui.getCore().getConfiguration().getAccessibility()) { jItems.attr("aria-setsize", _iVisibleItems + 1); jOvrFlwRef.attr("aria-posinset", _iVisibleItems + 1); } } else { jOvrFlwRef.attr("style", "display:none;"); if (oThis.oOvrFlwMnu) { oThis.oOvrFlwMnu.destroyItems(); } oThis.sLastVisibleItemId = null; if (sap.ui.getCore().getConfiguration().getAccessibility()) { jItems.attr("aria-setsize", _iVisibleItems); jOvrFlwRef.attr("aria-posinset", 0); } } jAreaRef.scrollTop(0); if (bUpdateFocus) { oThis.sCurrentFocusedItemRefId = oThis.sLastVisibleItemId; document.getElementById(oThis.sLastVisibleItemId).focus(); } }
[ "function", "(", "oThis", ")", "{", "var", "iVisibleItems", "=", "getVisibleItemCount", "(", "oThis", ")", ";", "var", "_iVisibleItems", "=", "iVisibleItems", ";", "var", "jAreaRef", "=", "oThis", ".", "$", "(", "\"area\"", ")", ";", "var", "jItems", "=", "jAreaRef", ".", "children", "(", ")", ";", "var", "jOvrFlwRef", "=", "oThis", ".", "$", "(", "\"ovrflw\"", ")", ";", "var", "bUpdateFocus", "=", "false", ";", "if", "(", "iVisibleItems", "<", "jItems", ".", "length", "-", "1", ")", "{", "jOvrFlwRef", ".", "attr", "(", "\"style\"", ",", "\"display:block;\"", ")", ";", "if", "(", "!", "oThis", ".", "oOvrFlwMnu", ")", "{", "oThis", ".", "oOvrFlwMnu", "=", "new", "Menu", "(", "oThis", ".", "getId", "(", ")", "+", "\"-ovrflwmnu\"", ")", ";", "oThis", ".", "oOvrFlwMnu", ".", "bUseTopStyle", "=", "oThis", ".", "getDesign", "(", ")", "==", "MenuBarDesign", ".", "Header", ";", "oThis", ".", "oOvrFlwMnu", ".", "attachItemSelect", "(", "function", "(", "oEvent", ")", "{", "var", "oItem", "=", "oEvent", ".", "getParameter", "(", "\"item\"", ")", ";", "if", "(", "!", "(", "oItem", "instanceof", "_DelegatorMenuItem", ")", ")", "{", "var", "oItemRootMenu", "=", "Menu", ".", "prototype", ".", "getRootMenu", ".", "apply", "(", "oItem", ".", "getParent", "(", ")", ")", ";", "oItemRootMenu", ".", "fireItemSelect", "(", "{", "item", ":", "oItem", "}", ")", ";", "}", "else", "if", "(", "oItem", ".", "bNoSubMenu", "&&", "oItem", "instanceof", "_DelegatorMenuItem", ")", "{", "oItem", ".", "oAlterEgoItm", ".", "fireSelect", "(", "{", "item", ":", "oItem", ".", "oAlterEgoItm", "}", ")", ";", "}", "}", ")", ";", "}", "oThis", ".", "oOvrFlwMnu", ".", "destroyItems", "(", ")", ";", "var", "aItems", "=", "oThis", ".", "getItems", "(", ")", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "aItems", ".", "length", ";", "i", "++", ")", "{", "var", "oItem", "=", "aItems", "[", "i", "]", ";", "if", "(", "iVisibleItems", "!=", "0", ")", "{", "if", "(", "oItem", ".", "getVisible", "(", ")", ")", "{", "iVisibleItems", "--", ";", "}", "if", "(", "iVisibleItems", "==", "0", ")", "{", "oThis", ".", "sLastVisibleItemId", "=", "oItem", ".", "getId", "(", ")", ";", "}", "}", "else", "{", "oThis", ".", "oOvrFlwMnu", ".", "addItem", "(", "new", "_DelegatorMenuItem", "(", "oItem", ")", ")", ";", "if", "(", "oItem", ".", "getId", "(", ")", "==", "oThis", ".", "sCurrentFocusedItemRefId", ")", "{", "bUpdateFocus", "=", "true", ";", "}", "}", "}", "if", "(", "sap", ".", "ui", ".", "getCore", "(", ")", ".", "getConfiguration", "(", ")", ".", "getAccessibility", "(", ")", ")", "{", "jItems", ".", "attr", "(", "\"aria-setsize\"", ",", "_iVisibleItems", "+", "1", ")", ";", "jOvrFlwRef", ".", "attr", "(", "\"aria-posinset\"", ",", "_iVisibleItems", "+", "1", ")", ";", "}", "}", "else", "{", "jOvrFlwRef", ".", "attr", "(", "\"style\"", ",", "\"display:none;\"", ")", ";", "if", "(", "oThis", ".", "oOvrFlwMnu", ")", "{", "oThis", ".", "oOvrFlwMnu", ".", "destroyItems", "(", ")", ";", "}", "oThis", ".", "sLastVisibleItemId", "=", "null", ";", "if", "(", "sap", ".", "ui", ".", "getCore", "(", ")", ".", "getConfiguration", "(", ")", ".", "getAccessibility", "(", ")", ")", "{", "jItems", ".", "attr", "(", "\"aria-setsize\"", ",", "_iVisibleItems", ")", ";", "jOvrFlwRef", ".", "attr", "(", "\"aria-posinset\"", ",", "0", ")", ";", "}", "}", "jAreaRef", ".", "scrollTop", "(", "0", ")", ";", "if", "(", "bUpdateFocus", ")", "{", "oThis", ".", "sCurrentFocusedItemRefId", "=", "oThis", ".", "sLastVisibleItemId", ";", "document", ".", "getElementById", "(", "oThis", ".", "sLastVisibleItemId", ")", ".", "focus", "(", ")", ";", "}", "}" ]
Handle the resize of the menubar
[ "Handle", "the", "resize", "of", "the", "menubar" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.commons/src/sap/ui/commons/MenuBar.js#L482-L547
4,003
SAP/openui5
src/sap.ui.core/src/sap/ui/model/odata/v4/ODataModel.js
parseAndValidateSystemQueryOption
function parseAndValidateSystemQueryOption (mOptions, sOptionName, aAllowed) { var sExpandOptionName, mExpandOptions, sExpandPath, vValue = mOptions[sOptionName]; if (!bSystemQueryOptionsAllowed || aAllowed.indexOf(sOptionName) < 0) { throw new Error("System query option " + sOptionName + " is not supported"); } if ((sOptionName === "$expand" || sOptionName === "$select") && typeof vValue === "string") { vValue = _Parser.parseSystemQueryOption(sOptionName + "=" + vValue)[sOptionName]; mOptions[sOptionName] = vValue; } if (sOptionName === "$expand") { for (sExpandPath in vValue) { mExpandOptions = vValue[sExpandPath]; if (mExpandOptions === null || typeof mExpandOptions !== "object") { // normalize empty expand options to {} mExpandOptions = vValue[sExpandPath] = {}; } for (sExpandOptionName in mExpandOptions) { parseAndValidateSystemQueryOption(mExpandOptions, sExpandOptionName, aExpandQueryOptions); } } } else if (sOptionName === "$count") { if (typeof vValue === "boolean") { if (!vValue) { delete mOptions.$count; } } else { switch (typeof vValue === "string" && vValue.toLowerCase()) { case "false": delete mOptions.$count; break; case "true": mOptions.$count = true; break; default: throw new Error("Invalid value for $count: " + vValue); } } } }
javascript
function parseAndValidateSystemQueryOption (mOptions, sOptionName, aAllowed) { var sExpandOptionName, mExpandOptions, sExpandPath, vValue = mOptions[sOptionName]; if (!bSystemQueryOptionsAllowed || aAllowed.indexOf(sOptionName) < 0) { throw new Error("System query option " + sOptionName + " is not supported"); } if ((sOptionName === "$expand" || sOptionName === "$select") && typeof vValue === "string") { vValue = _Parser.parseSystemQueryOption(sOptionName + "=" + vValue)[sOptionName]; mOptions[sOptionName] = vValue; } if (sOptionName === "$expand") { for (sExpandPath in vValue) { mExpandOptions = vValue[sExpandPath]; if (mExpandOptions === null || typeof mExpandOptions !== "object") { // normalize empty expand options to {} mExpandOptions = vValue[sExpandPath] = {}; } for (sExpandOptionName in mExpandOptions) { parseAndValidateSystemQueryOption(mExpandOptions, sExpandOptionName, aExpandQueryOptions); } } } else if (sOptionName === "$count") { if (typeof vValue === "boolean") { if (!vValue) { delete mOptions.$count; } } else { switch (typeof vValue === "string" && vValue.toLowerCase()) { case "false": delete mOptions.$count; break; case "true": mOptions.$count = true; break; default: throw new Error("Invalid value for $count: " + vValue); } } } }
[ "function", "parseAndValidateSystemQueryOption", "(", "mOptions", ",", "sOptionName", ",", "aAllowed", ")", "{", "var", "sExpandOptionName", ",", "mExpandOptions", ",", "sExpandPath", ",", "vValue", "=", "mOptions", "[", "sOptionName", "]", ";", "if", "(", "!", "bSystemQueryOptionsAllowed", "||", "aAllowed", ".", "indexOf", "(", "sOptionName", ")", "<", "0", ")", "{", "throw", "new", "Error", "(", "\"System query option \"", "+", "sOptionName", "+", "\" is not supported\"", ")", ";", "}", "if", "(", "(", "sOptionName", "===", "\"$expand\"", "||", "sOptionName", "===", "\"$select\"", ")", "&&", "typeof", "vValue", "===", "\"string\"", ")", "{", "vValue", "=", "_Parser", ".", "parseSystemQueryOption", "(", "sOptionName", "+", "\"=\"", "+", "vValue", ")", "[", "sOptionName", "]", ";", "mOptions", "[", "sOptionName", "]", "=", "vValue", ";", "}", "if", "(", "sOptionName", "===", "\"$expand\"", ")", "{", "for", "(", "sExpandPath", "in", "vValue", ")", "{", "mExpandOptions", "=", "vValue", "[", "sExpandPath", "]", ";", "if", "(", "mExpandOptions", "===", "null", "||", "typeof", "mExpandOptions", "!==", "\"object\"", ")", "{", "// normalize empty expand options to {}", "mExpandOptions", "=", "vValue", "[", "sExpandPath", "]", "=", "{", "}", ";", "}", "for", "(", "sExpandOptionName", "in", "mExpandOptions", ")", "{", "parseAndValidateSystemQueryOption", "(", "mExpandOptions", ",", "sExpandOptionName", ",", "aExpandQueryOptions", ")", ";", "}", "}", "}", "else", "if", "(", "sOptionName", "===", "\"$count\"", ")", "{", "if", "(", "typeof", "vValue", "===", "\"boolean\"", ")", "{", "if", "(", "!", "vValue", ")", "{", "delete", "mOptions", ".", "$count", ";", "}", "}", "else", "{", "switch", "(", "typeof", "vValue", "===", "\"string\"", "&&", "vValue", ".", "toLowerCase", "(", ")", ")", "{", "case", "\"false\"", ":", "delete", "mOptions", ".", "$count", ";", "break", ";", "case", "\"true\"", ":", "mOptions", ".", "$count", "=", "true", ";", "break", ";", "default", ":", "throw", "new", "Error", "(", "\"Invalid value for $count: \"", "+", "vValue", ")", ";", "}", "}", "}", "}" ]
Parses the query options for the given option name "sOptionName" in the given map of query options "mOptions" to an object if necessary. Validates if the given query option name is allowed. @param {object} mOptions Map of query options by name @param {string} sOptionName Name of the query option @param {string[]} aAllowed The allowed system query options @throws {error} If the given query option name is not allowed
[ "Parses", "the", "query", "options", "for", "the", "given", "option", "name", "sOptionName", "in", "the", "given", "map", "of", "query", "options", "mOptions", "to", "an", "object", "if", "necessary", ".", "Validates", "if", "the", "given", "query", "option", "name", "is", "allowed", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/v4/ODataModel.js#L724-L768
4,004
SAP/openui5
src/sap.ui.core/src/sap/ui/model/odata/v4/ODataModel.js
startsWithQualifiedName
function startsWithQualifiedName(sMetaPath) { var iDotPos = sMetaPath.indexOf("."), iSlashPos = sMetaPath.indexOf("/"); return iDotPos > 0 && (iSlashPos < 0 || iDotPos < iSlashPos); }
javascript
function startsWithQualifiedName(sMetaPath) { var iDotPos = sMetaPath.indexOf("."), iSlashPos = sMetaPath.indexOf("/"); return iDotPos > 0 && (iSlashPos < 0 || iDotPos < iSlashPos); }
[ "function", "startsWithQualifiedName", "(", "sMetaPath", ")", "{", "var", "iDotPos", "=", "sMetaPath", ".", "indexOf", "(", "\".\"", ")", ",", "iSlashPos", "=", "sMetaPath", ".", "indexOf", "(", "\"/\"", ")", ";", "return", "iDotPos", ">", "0", "&&", "(", "iSlashPos", "<", "0", "||", "iDotPos", "<", "iSlashPos", ")", ";", "}" ]
Checks if the given meta path contains a dot in its first segment. @param {string} sMetaPath The meta path @returns {boolean} Whether the given meta path contains a dot in its first segment
[ "Checks", "if", "the", "given", "meta", "path", "contains", "a", "dot", "in", "its", "first", "segment", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/v4/ODataModel.js#L896-L901
4,005
SAP/openui5
src/sap.ui.rta/src/sap/ui/rta/plugin/Plugin.js
_checkAggregationBindingTemplateID
function _checkAggregationBindingTemplateID(oOverlay, vStableElement){ var mAggregationInfo = OverlayUtil.getAggregationInformation(oOverlay, oOverlay.getElement().sParentAggregationName); if (!mAggregationInfo.templateId) { return true; } else { return !FlexUtils.checkControlId(mAggregationInfo.templateId, vStableElement.appComponent); } }
javascript
function _checkAggregationBindingTemplateID(oOverlay, vStableElement){ var mAggregationInfo = OverlayUtil.getAggregationInformation(oOverlay, oOverlay.getElement().sParentAggregationName); if (!mAggregationInfo.templateId) { return true; } else { return !FlexUtils.checkControlId(mAggregationInfo.templateId, vStableElement.appComponent); } }
[ "function", "_checkAggregationBindingTemplateID", "(", "oOverlay", ",", "vStableElement", ")", "{", "var", "mAggregationInfo", "=", "OverlayUtil", ".", "getAggregationInformation", "(", "oOverlay", ",", "oOverlay", ".", "getElement", "(", ")", ".", "sParentAggregationName", ")", ";", "if", "(", "!", "mAggregationInfo", ".", "templateId", ")", "{", "return", "true", ";", "}", "else", "{", "return", "!", "FlexUtils", ".", "checkControlId", "(", "mAggregationInfo", ".", "templateId", ",", "vStableElement", ".", "appComponent", ")", ";", "}", "}" ]
Check if related binding template has stable id
[ "Check", "if", "related", "binding", "template", "has", "stable", "id" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.rta/src/sap/ui/rta/plugin/Plugin.js#L271-L278
4,006
SAP/openui5
src/sap.f/src/sap/f/FlexibleColumnLayoutSemanticHelper.js
function (oFlexibleColumnLayout, oSettings) { var oModeToMaxColumnsCountMapping = { Normal: 3, MasterDetail: 2, SingleColumn: 1 }, iInitial, iMax; oSettings || (oSettings = {}); this._oFCL = oFlexibleColumnLayout; // Layout types this._defaultLayoutType = LT.OneColumn; this._defaultTwoColumnLayoutType = [LT.TwoColumnsBeginExpanded, LT.TwoColumnsMidExpanded].indexOf(oSettings.defaultTwoColumnLayoutType) !== -1 ? oSettings.defaultTwoColumnLayoutType : LT.TwoColumnsBeginExpanded; this._defaultThreeColumnLayoutType = [LT.ThreeColumnsMidExpanded, LT.ThreeColumnsEndExpanded].indexOf(oSettings.defaultThreeColumnLayoutType) !== -1 ? oSettings.defaultThreeColumnLayoutType : LT.ThreeColumnsMidExpanded; // Maximum number of columns and mode (deprecated) if (["Normal", "MasterDetail", "SingleColumn"].indexOf(oSettings.mode) !== -1 && !oSettings.maxColumnsCount) { iMax = oModeToMaxColumnsCountMapping[oSettings.mode]; } else { iMax = oSettings.maxColumnsCount ? parseInt(oSettings.maxColumnsCount) : 3; if (iMax < 1 || iMax > 3) { iMax = 3; } } this._maxColumnsCount = iMax; // Initial number of columns (1 by default, can be set to 2 for MasterDetail or Normal modes only) iInitial = oSettings.initialColumnsCount ? parseInt(oSettings.initialColumnsCount) : 1; if (iInitial < 1 || iInitial > 2 || this._maxColumnsCount === 1) { iInitial = 1; } this._initialColumnsCount = iInitial; }
javascript
function (oFlexibleColumnLayout, oSettings) { var oModeToMaxColumnsCountMapping = { Normal: 3, MasterDetail: 2, SingleColumn: 1 }, iInitial, iMax; oSettings || (oSettings = {}); this._oFCL = oFlexibleColumnLayout; // Layout types this._defaultLayoutType = LT.OneColumn; this._defaultTwoColumnLayoutType = [LT.TwoColumnsBeginExpanded, LT.TwoColumnsMidExpanded].indexOf(oSettings.defaultTwoColumnLayoutType) !== -1 ? oSettings.defaultTwoColumnLayoutType : LT.TwoColumnsBeginExpanded; this._defaultThreeColumnLayoutType = [LT.ThreeColumnsMidExpanded, LT.ThreeColumnsEndExpanded].indexOf(oSettings.defaultThreeColumnLayoutType) !== -1 ? oSettings.defaultThreeColumnLayoutType : LT.ThreeColumnsMidExpanded; // Maximum number of columns and mode (deprecated) if (["Normal", "MasterDetail", "SingleColumn"].indexOf(oSettings.mode) !== -1 && !oSettings.maxColumnsCount) { iMax = oModeToMaxColumnsCountMapping[oSettings.mode]; } else { iMax = oSettings.maxColumnsCount ? parseInt(oSettings.maxColumnsCount) : 3; if (iMax < 1 || iMax > 3) { iMax = 3; } } this._maxColumnsCount = iMax; // Initial number of columns (1 by default, can be set to 2 for MasterDetail or Normal modes only) iInitial = oSettings.initialColumnsCount ? parseInt(oSettings.initialColumnsCount) : 1; if (iInitial < 1 || iInitial > 2 || this._maxColumnsCount === 1) { iInitial = 1; } this._initialColumnsCount = iInitial; }
[ "function", "(", "oFlexibleColumnLayout", ",", "oSettings", ")", "{", "var", "oModeToMaxColumnsCountMapping", "=", "{", "Normal", ":", "3", ",", "MasterDetail", ":", "2", ",", "SingleColumn", ":", "1", "}", ",", "iInitial", ",", "iMax", ";", "oSettings", "||", "(", "oSettings", "=", "{", "}", ")", ";", "this", ".", "_oFCL", "=", "oFlexibleColumnLayout", ";", "// Layout types", "this", ".", "_defaultLayoutType", "=", "LT", ".", "OneColumn", ";", "this", ".", "_defaultTwoColumnLayoutType", "=", "[", "LT", ".", "TwoColumnsBeginExpanded", ",", "LT", ".", "TwoColumnsMidExpanded", "]", ".", "indexOf", "(", "oSettings", ".", "defaultTwoColumnLayoutType", ")", "!==", "-", "1", "?", "oSettings", ".", "defaultTwoColumnLayoutType", ":", "LT", ".", "TwoColumnsBeginExpanded", ";", "this", ".", "_defaultThreeColumnLayoutType", "=", "[", "LT", ".", "ThreeColumnsMidExpanded", ",", "LT", ".", "ThreeColumnsEndExpanded", "]", ".", "indexOf", "(", "oSettings", ".", "defaultThreeColumnLayoutType", ")", "!==", "-", "1", "?", "oSettings", ".", "defaultThreeColumnLayoutType", ":", "LT", ".", "ThreeColumnsMidExpanded", ";", "// Maximum number of columns and mode (deprecated)", "if", "(", "[", "\"Normal\"", ",", "\"MasterDetail\"", ",", "\"SingleColumn\"", "]", ".", "indexOf", "(", "oSettings", ".", "mode", ")", "!==", "-", "1", "&&", "!", "oSettings", ".", "maxColumnsCount", ")", "{", "iMax", "=", "oModeToMaxColumnsCountMapping", "[", "oSettings", ".", "mode", "]", ";", "}", "else", "{", "iMax", "=", "oSettings", ".", "maxColumnsCount", "?", "parseInt", "(", "oSettings", ".", "maxColumnsCount", ")", ":", "3", ";", "if", "(", "iMax", "<", "1", "||", "iMax", ">", "3", ")", "{", "iMax", "=", "3", ";", "}", "}", "this", ".", "_maxColumnsCount", "=", "iMax", ";", "// Initial number of columns (1 by default, can be set to 2 for MasterDetail or Normal modes only)", "iInitial", "=", "oSettings", ".", "initialColumnsCount", "?", "parseInt", "(", "oSettings", ".", "initialColumnsCount", ")", ":", "1", ";", "if", "(", "iInitial", "<", "1", "||", "iInitial", ">", "2", "||", "this", ".", "_maxColumnsCount", "===", "1", ")", "{", "iInitial", "=", "1", ";", "}", "this", ".", "_initialColumnsCount", "=", "iInitial", ";", "}" ]
Constructor for an sap.f.FlexibleColumnLayoutSemanticHelper. @class Helper class, facilitating the implementation of the recommended UX design of a <code>sap.f.FlexibleColumnLayout</code>-based app. <b>Note:</b> Using this class is not mandatory in order to build an app with <code>sap.f.FlexibleColumnLayout</code>, but exists for convenience only. <ul>The usage of <code>sap.f.FlexibleColumnLayoutSemanticHelper</code> revolves around two main methods: <li><code>getCurrentUIState</code>Suggests which action buttons to show in each <code>sap.f.FlexibleColumnLayout</code> column, based on the current control state (number and visibility of columns, layout, etc..)</li> <li><code>getNextUIState</code>Suggests which <code>layout</code> to use when navigating to another view level (e.g. from one view to two views).</li></ul> Sample usage of the class: <pre> <code> var helper = sap.f.FlexibleColumnLayoutSemanticHelper.getInstanceFor(myFlexibleColumnLayout); helper.getCurrentUIState(); helper.getNextUIState(2); helper.getNextUIState(0); </code> </pre> Calling <code>getCurrentUIState()</code> will return information which action buttons (Close, FullScreen, ExitFullScreen) must be currently shown in which column, according to UX guidelines, as well as to what layout clicking them should lead. Calling <code>getNextUIState(2)</code> will return information about the expected layout and action buttons if the application should display three views (master-detail-detail), based on the current state. Similarly, calling <code>getNextUIState(0)</code> will return information about the expected layout and action buttons if the application should display the initial view only (master), based on the current state. For more information, see {@link sap.f.FlexibleColumnLayoutSemanticHelper#getCurrentUIState} and {@link sap.f.FlexibleColumnLayoutSemanticHelper#getNextUIState} @version ${version} @param {sap.f.FlexibleColumnLayout} oFlexibleColumnLayout The <code>sap.f.FlexibleColumnLayout</code> object whose state will be manipulated. @param {object} oSettings Determines the rules that will be used by the helper. @param {sap.f.LayoutType} oSettings.defaultTwoColumnLayoutType Determines what two-column layout type will be suggested by default: <code>sap.f.LayoutType.TwoColumnsBeginExpanded</code> (default) or <code>sap.f.LayoutType.TwoColumnsMidExpanded</code>. @param {sap.f.LayoutType} oSettings.defaultThreeColumnLayoutType Determines what three-column layout type will be suggested by default: <code>sap.f.LayoutType.ThreeColumnsMidExpanded</code> (default) or <code>sap.f.LayoutType.ThreeColumnsEndExpanded</code>. @param {int} oSettings.maxColumnsCount Determines the maximum number of columns that will be displayed side by side. <ul>Possible values: <li>Value of <code>1</code> only single-column layouts will be suggested.</li> <li>Value of <code>2</code> Up to 2-column layouts will be suggested.</li> <li>Value of <code>3</code> (default) - Up to 3-column layouts will be suggested.</li></ul> @param {int} oSettings.initialColumnsCount Determines whether a single-column or a 2-column layout will be suggested for logical level 0. <ul>Possible values: <li>Value of <code>1</code> (default) - A single-column layout will be suggested for logical level 0.</li> <li>Value of <code>2</code> - A 2-column layout will be suggested for logical level 0.</li></ul> @param {string} oSettings.mode <b>Deprecated as of version 1.50</b>, use <code>maxColumnsCount</code> param instead. Determines the suggested layout types: <code>Normal</code> (3-column layouts), <code>MasterDetail</code> (2-column layouts for the first two pages, all other pages will open in fullscreen), and <code>SingleColumn</code> (one page at a time only). @public @since 1.46.0 @alias sap.f.FlexibleColumnLayoutSemanticHelper
[ "Constructor", "for", "an", "sap", ".", "f", ".", "FlexibleColumnLayoutSemanticHelper", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.f/src/sap/f/FlexibleColumnLayoutSemanticHelper.js#L99-L134
4,007
SAP/openui5
src/sap.ui.core/src/sap/ui/debug/Highlighter.js
function(sId, bFilled, sColor, iBorderWidth) { this.sId = sId || uid(); this.bFilled = (bFilled == true); this.sColor = sColor || 'blue'; if ( isNaN(iBorderWidth ) ) { this.iBorderWidth = 2; } else if ( iBorderWidth <= 0 ) { this.iBorderWidth = 0; } else { this.iBorderWidth = iBorderWidth; } }
javascript
function(sId, bFilled, sColor, iBorderWidth) { this.sId = sId || uid(); this.bFilled = (bFilled == true); this.sColor = sColor || 'blue'; if ( isNaN(iBorderWidth ) ) { this.iBorderWidth = 2; } else if ( iBorderWidth <= 0 ) { this.iBorderWidth = 0; } else { this.iBorderWidth = iBorderWidth; } }
[ "function", "(", "sId", ",", "bFilled", ",", "sColor", ",", "iBorderWidth", ")", "{", "this", ".", "sId", "=", "sId", "||", "uid", "(", ")", ";", "this", ".", "bFilled", "=", "(", "bFilled", "==", "true", ")", ";", "this", ".", "sColor", "=", "sColor", "||", "'blue'", ";", "if", "(", "isNaN", "(", "iBorderWidth", ")", ")", "{", "this", ".", "iBorderWidth", "=", "2", ";", "}", "else", "if", "(", "iBorderWidth", "<=", "0", ")", "{", "this", ".", "iBorderWidth", "=", "0", ";", "}", "else", "{", "this", ".", "iBorderWidth", "=", "iBorderWidth", ";", "}", "}" ]
Creates a new highlighter object without displaying it. The DOM node is not created until the first call to method {@link #highlight}. @param {string} [sId] id that is used by the new highlighter @param {boolean} [bFilled] whether the box of the highlighter is partially opaque (20%), defaults to false @param {string} [sColor] the CSS color of the border and the box (defaults to blue) @param {int} [iBorderWidth] the width of the border @class Helper class to display a colored rectangle around and above a given DOM node @author Frank Weigel @since 0.8.7 @public @alias sap.ui.debug.Highlighter
[ "Creates", "a", "new", "highlighter", "object", "without", "displaying", "it", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/debug/Highlighter.js#L31-L42
4,008
SAP/openui5
src/sap.ui.table/src/sap/ui/table/CreationRow.js
createDefaultToolbar
function createDefaultToolbar(oCreationRow) { return new OverflowToolbar({ content: [ new ToolbarSpacer(), new Button({ text: TableUtils.getResourceText("TBL_CREATIONROW_APPLY"), type: MLibrary.ButtonType.Emphasized, enabled: oCreationRow.getApplyEnabled(), press: function() { oCreationRow._fireApply(); } }) ], style: MLibrary.ToolbarStyle.Clear, ariaLabelledBy: [oCreationRow.getId() + "-label"] }); }
javascript
function createDefaultToolbar(oCreationRow) { return new OverflowToolbar({ content: [ new ToolbarSpacer(), new Button({ text: TableUtils.getResourceText("TBL_CREATIONROW_APPLY"), type: MLibrary.ButtonType.Emphasized, enabled: oCreationRow.getApplyEnabled(), press: function() { oCreationRow._fireApply(); } }) ], style: MLibrary.ToolbarStyle.Clear, ariaLabelledBy: [oCreationRow.getId() + "-label"] }); }
[ "function", "createDefaultToolbar", "(", "oCreationRow", ")", "{", "return", "new", "OverflowToolbar", "(", "{", "content", ":", "[", "new", "ToolbarSpacer", "(", ")", ",", "new", "Button", "(", "{", "text", ":", "TableUtils", ".", "getResourceText", "(", "\"TBL_CREATIONROW_APPLY\"", ")", ",", "type", ":", "MLibrary", ".", "ButtonType", ".", "Emphasized", ",", "enabled", ":", "oCreationRow", ".", "getApplyEnabled", "(", ")", ",", "press", ":", "function", "(", ")", "{", "oCreationRow", ".", "_fireApply", "(", ")", ";", "}", "}", ")", "]", ",", "style", ":", "MLibrary", ".", "ToolbarStyle", ".", "Clear", ",", "ariaLabelledBy", ":", "[", "oCreationRow", ".", "getId", "(", ")", "+", "\"-label\"", "]", "}", ")", ";", "}" ]
Creates a default toolbar providing basic buttons and functionality. @param {sap.ui.table.CreationRow} oCreationRow The creation row to get the settings for the toolbar creation from. @returns {sap.m.OverflowToolbar} The default toolbar.
[ "Creates", "a", "default", "toolbar", "providing", "basic", "buttons", "and", "functionality", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/CreationRow.js#L165-L181
4,009
SAP/openui5
src/sap.ui.commons/src/sap/ui/commons/FormattedTextView.js
function (aControls) { if (this.hasControls()) { this.removeAllAggregation("controls"); } var bIsArray = Array.isArray(aControls); if (bIsArray && aControls.length > 0) { // iterate through the given array but suppress invalidate for (var i = 0; i < aControls.length; i++) { this.addAggregation("controls", aControls[i], true); } this.invalidate(); } }
javascript
function (aControls) { if (this.hasControls()) { this.removeAllAggregation("controls"); } var bIsArray = Array.isArray(aControls); if (bIsArray && aControls.length > 0) { // iterate through the given array but suppress invalidate for (var i = 0; i < aControls.length; i++) { this.addAggregation("controls", aControls[i], true); } this.invalidate(); } }
[ "function", "(", "aControls", ")", "{", "if", "(", "this", ".", "hasControls", "(", ")", ")", "{", "this", ".", "removeAllAggregation", "(", "\"controls\"", ")", ";", "}", "var", "bIsArray", "=", "Array", ".", "isArray", "(", "aControls", ")", ";", "if", "(", "bIsArray", "&&", "aControls", ".", "length", ">", "0", ")", "{", "// iterate through the given array but suppress invalidate", "for", "(", "var", "i", "=", "0", ";", "i", "<", "aControls", ".", "length", ";", "i", "++", ")", "{", "this", ".", "addAggregation", "(", "\"controls\"", ",", "aControls", "[", "i", "]", ",", "true", ")", ";", "}", "this", ".", "invalidate", "(", ")", ";", "}", "}" ]
Sets the controls to be rendered. @param {array} aControls Controls should be rendered @private
[ "Sets", "the", "controls", "to", "be", "rendered", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.commons/src/sap/ui/commons/FormattedTextView.js#L227-L240
4,010
SAP/openui5
src/sap.ui.core/src/sap/ui/core/Element.js
function(element, key) { var aData = element.getAggregation("customData"); if (aData) { for (var i = 0; i < aData.length; i++) { if (aData[i].getKey() == key) { return aData[i]; } } } return null; }
javascript
function(element, key) { var aData = element.getAggregation("customData"); if (aData) { for (var i = 0; i < aData.length; i++) { if (aData[i].getKey() == key) { return aData[i]; } } } return null; }
[ "function", "(", "element", ",", "key", ")", "{", "var", "aData", "=", "element", ".", "getAggregation", "(", "\"customData\"", ")", ";", "if", "(", "aData", ")", "{", "for", "(", "var", "i", "=", "0", ";", "i", "<", "aData", ".", "length", ";", "i", "++", ")", "{", "if", "(", "aData", "[", "i", "]", ".", "getKey", "(", ")", "==", "key", ")", "{", "return", "aData", "[", "i", "]", ";", "}", "}", "}", "return", "null", ";", "}" ]
Returns the data object with the given key
[ "Returns", "the", "data", "object", "with", "the", "given", "key" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/Element.js#L908-L918
4,011
SAP/openui5
src/sap.ui.core/src/sap/ui/core/Element.js
function(element, key, value, writeToDom) { // DELETE if (value === null) { // delete this property var dataObject = getDataObject(element, key); if (!dataObject) { return; } var dataCount = element.getAggregation("customData").length; if (dataCount == 1) { element.destroyAggregation("customData", true); // destroy if there is no other data } else { element.removeAggregation("customData", dataObject, true); dataObject.destroy(); } // ADD or CHANGE } else { var CustomData = sap.ui.requireSync('sap/ui/core/CustomData'); var dataObject = getDataObject(element, key); if (dataObject) { dataObject.setValue(value); dataObject.setWriteToDom(writeToDom); } else { var dataObject = new CustomData({key:key,value:value, writeToDom:writeToDom}); element.addAggregation("customData", dataObject, true); } } }
javascript
function(element, key, value, writeToDom) { // DELETE if (value === null) { // delete this property var dataObject = getDataObject(element, key); if (!dataObject) { return; } var dataCount = element.getAggregation("customData").length; if (dataCount == 1) { element.destroyAggregation("customData", true); // destroy if there is no other data } else { element.removeAggregation("customData", dataObject, true); dataObject.destroy(); } // ADD or CHANGE } else { var CustomData = sap.ui.requireSync('sap/ui/core/CustomData'); var dataObject = getDataObject(element, key); if (dataObject) { dataObject.setValue(value); dataObject.setWriteToDom(writeToDom); } else { var dataObject = new CustomData({key:key,value:value, writeToDom:writeToDom}); element.addAggregation("customData", dataObject, true); } } }
[ "function", "(", "element", ",", "key", ",", "value", ",", "writeToDom", ")", "{", "// DELETE", "if", "(", "value", "===", "null", ")", "{", "// delete this property", "var", "dataObject", "=", "getDataObject", "(", "element", ",", "key", ")", ";", "if", "(", "!", "dataObject", ")", "{", "return", ";", "}", "var", "dataCount", "=", "element", ".", "getAggregation", "(", "\"customData\"", ")", ".", "length", ";", "if", "(", "dataCount", "==", "1", ")", "{", "element", ".", "destroyAggregation", "(", "\"customData\"", ",", "true", ")", ";", "// destroy if there is no other data", "}", "else", "{", "element", ".", "removeAggregation", "(", "\"customData\"", ",", "dataObject", ",", "true", ")", ";", "dataObject", ".", "destroy", "(", ")", ";", "}", "// ADD or CHANGE", "}", "else", "{", "var", "CustomData", "=", "sap", ".", "ui", ".", "requireSync", "(", "'sap/ui/core/CustomData'", ")", ";", "var", "dataObject", "=", "getDataObject", "(", "element", ",", "key", ")", ";", "if", "(", "dataObject", ")", "{", "dataObject", ".", "setValue", "(", "value", ")", ";", "dataObject", ".", "setWriteToDom", "(", "writeToDom", ")", ";", "}", "else", "{", "var", "dataObject", "=", "new", "CustomData", "(", "{", "key", ":", "key", ",", "value", ":", "value", ",", "writeToDom", ":", "writeToDom", "}", ")", ";", "element", ".", "addAggregation", "(", "\"customData\"", ",", "dataObject", ",", "true", ")", ";", "}", "}", "}" ]
Contains the data modification logic
[ "Contains", "the", "data", "modification", "logic" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/Element.js#L923-L952
4,012
SAP/openui5
src/sap.ui.support/src/sap/ui/support/supportRules/ui/models/PresetsUtils.js
function (aSelectedRulesPlain) { // if we persist settings - load any selection presets, else use the default ones if (this.model.getProperty("/persistingSettings")) { var aPersistedPresets = Storage.getSelectionPresets(); if (aPersistedPresets) { this.model.setProperty("/selectionPresets", aPersistedPresets); } } var aPresets = this.model.getProperty("/selectionPresets"), iLastSystemPresetPosition = 0; // add System Presets to Rule Presets Popover this.getSystemPresets().forEach(function (oSystemPreset) { var isFound = aPresets.some(function (oPreset) { if (oSystemPreset.id === oPreset.id) { if (!oPreset.isModified) { var bIsSelected = oPreset.selected; oPreset = jQuery.extend({}, oSystemPreset); oPreset.selected = bIsSelected; if (bIsSelected) { SelectionUtils.setSelectedRules(oPreset.selections); } } return true; } }); if (!isFound) { var mSystemPresetConfig = { disableDelete: true, isSystemPreset: true }; aPresets.splice(iLastSystemPresetPosition + 1, 0, jQuery.extend(mSystemPresetConfig, oSystemPreset)); } iLastSystemPresetPosition++; }); // find the selected preset var oSelectedPreset = null; aPresets.some(function (oCurrent) { if (oCurrent.selected) { oSelectedPreset = oCurrent; return true; } }); // sync 'My Selections' with current selections if (oSelectedPreset.isMySelection) { oSelectedPreset.selections = aSelectedRulesPlain; } // need to init the current preset this.model.setProperty("/selectionPresetsCurrent", oSelectedPreset); }
javascript
function (aSelectedRulesPlain) { // if we persist settings - load any selection presets, else use the default ones if (this.model.getProperty("/persistingSettings")) { var aPersistedPresets = Storage.getSelectionPresets(); if (aPersistedPresets) { this.model.setProperty("/selectionPresets", aPersistedPresets); } } var aPresets = this.model.getProperty("/selectionPresets"), iLastSystemPresetPosition = 0; // add System Presets to Rule Presets Popover this.getSystemPresets().forEach(function (oSystemPreset) { var isFound = aPresets.some(function (oPreset) { if (oSystemPreset.id === oPreset.id) { if (!oPreset.isModified) { var bIsSelected = oPreset.selected; oPreset = jQuery.extend({}, oSystemPreset); oPreset.selected = bIsSelected; if (bIsSelected) { SelectionUtils.setSelectedRules(oPreset.selections); } } return true; } }); if (!isFound) { var mSystemPresetConfig = { disableDelete: true, isSystemPreset: true }; aPresets.splice(iLastSystemPresetPosition + 1, 0, jQuery.extend(mSystemPresetConfig, oSystemPreset)); } iLastSystemPresetPosition++; }); // find the selected preset var oSelectedPreset = null; aPresets.some(function (oCurrent) { if (oCurrent.selected) { oSelectedPreset = oCurrent; return true; } }); // sync 'My Selections' with current selections if (oSelectedPreset.isMySelection) { oSelectedPreset.selections = aSelectedRulesPlain; } // need to init the current preset this.model.setProperty("/selectionPresetsCurrent", oSelectedPreset); }
[ "function", "(", "aSelectedRulesPlain", ")", "{", "// if we persist settings - load any selection presets, else use the default ones", "if", "(", "this", ".", "model", ".", "getProperty", "(", "\"/persistingSettings\"", ")", ")", "{", "var", "aPersistedPresets", "=", "Storage", ".", "getSelectionPresets", "(", ")", ";", "if", "(", "aPersistedPresets", ")", "{", "this", ".", "model", ".", "setProperty", "(", "\"/selectionPresets\"", ",", "aPersistedPresets", ")", ";", "}", "}", "var", "aPresets", "=", "this", ".", "model", ".", "getProperty", "(", "\"/selectionPresets\"", ")", ",", "iLastSystemPresetPosition", "=", "0", ";", "// add System Presets to Rule Presets Popover", "this", ".", "getSystemPresets", "(", ")", ".", "forEach", "(", "function", "(", "oSystemPreset", ")", "{", "var", "isFound", "=", "aPresets", ".", "some", "(", "function", "(", "oPreset", ")", "{", "if", "(", "oSystemPreset", ".", "id", "===", "oPreset", ".", "id", ")", "{", "if", "(", "!", "oPreset", ".", "isModified", ")", "{", "var", "bIsSelected", "=", "oPreset", ".", "selected", ";", "oPreset", "=", "jQuery", ".", "extend", "(", "{", "}", ",", "oSystemPreset", ")", ";", "oPreset", ".", "selected", "=", "bIsSelected", ";", "if", "(", "bIsSelected", ")", "{", "SelectionUtils", ".", "setSelectedRules", "(", "oPreset", ".", "selections", ")", ";", "}", "}", "return", "true", ";", "}", "}", ")", ";", "if", "(", "!", "isFound", ")", "{", "var", "mSystemPresetConfig", "=", "{", "disableDelete", ":", "true", ",", "isSystemPreset", ":", "true", "}", ";", "aPresets", ".", "splice", "(", "iLastSystemPresetPosition", "+", "1", ",", "0", ",", "jQuery", ".", "extend", "(", "mSystemPresetConfig", ",", "oSystemPreset", ")", ")", ";", "}", "iLastSystemPresetPosition", "++", ";", "}", ")", ";", "// find the selected preset", "var", "oSelectedPreset", "=", "null", ";", "aPresets", ".", "some", "(", "function", "(", "oCurrent", ")", "{", "if", "(", "oCurrent", ".", "selected", ")", "{", "oSelectedPreset", "=", "oCurrent", ";", "return", "true", ";", "}", "}", ")", ";", "// sync 'My Selections' with current selections", "if", "(", "oSelectedPreset", ".", "isMySelection", ")", "{", "oSelectedPreset", ".", "selections", "=", "aSelectedRulesPlain", ";", "}", "// need to init the current preset", "this", ".", "model", ".", "setProperty", "(", "\"/selectionPresetsCurrent\"", ",", "oSelectedPreset", ")", ";", "}" ]
Initializes the current selection preset @param {Array} aSelectedRulesPlain The plain list of selected rules (same format as in the presets json file)
[ "Initializes", "the", "current", "selection", "preset" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.support/src/sap/ui/support/supportRules/ui/models/PresetsUtils.js#L34-L89
4,013
SAP/openui5
src/sap.ui.support/src/sap/ui/support/supportRules/ui/models/PresetsUtils.js
function (aSelectedRulesPlain) { var oPreset = this.model.getProperty("/selectionPresetsCurrent"); oPreset.selections = aSelectedRulesPlain; if (!(oPreset.isModified || oPreset.isMySelection)) { oPreset.isModified = true; oPreset.title = oPreset.title + " *"; } this.model.setProperty("/selectionPresetsCurrent", oPreset); if (PresetsUtils.isPersistingAllowed()) { PresetsUtils.persistSelectionPresets(); } }
javascript
function (aSelectedRulesPlain) { var oPreset = this.model.getProperty("/selectionPresetsCurrent"); oPreset.selections = aSelectedRulesPlain; if (!(oPreset.isModified || oPreset.isMySelection)) { oPreset.isModified = true; oPreset.title = oPreset.title + " *"; } this.model.setProperty("/selectionPresetsCurrent", oPreset); if (PresetsUtils.isPersistingAllowed()) { PresetsUtils.persistSelectionPresets(); } }
[ "function", "(", "aSelectedRulesPlain", ")", "{", "var", "oPreset", "=", "this", ".", "model", ".", "getProperty", "(", "\"/selectionPresetsCurrent\"", ")", ";", "oPreset", ".", "selections", "=", "aSelectedRulesPlain", ";", "if", "(", "!", "(", "oPreset", ".", "isModified", "||", "oPreset", ".", "isMySelection", ")", ")", "{", "oPreset", ".", "isModified", "=", "true", ";", "oPreset", ".", "title", "=", "oPreset", ".", "title", "+", "\" *\"", ";", "}", "this", ".", "model", ".", "setProperty", "(", "\"/selectionPresetsCurrent\"", ",", "oPreset", ")", ";", "if", "(", "PresetsUtils", ".", "isPersistingAllowed", "(", ")", ")", "{", "PresetsUtils", ".", "persistSelectionPresets", "(", ")", ";", "}", "}" ]
Synchronizes the current rules selection with the current selection preset @param {Array} aSelectedRulesPlain The plain list of selected rules (same format as in the presets json file)
[ "Synchronizes", "the", "current", "rules", "selection", "with", "the", "current", "selection", "preset" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.support/src/sap/ui/support/supportRules/ui/models/PresetsUtils.js#L95-L110
4,014
SAP/openui5
src/sap.ui.support/src/sap/ui/support/supportRules/ui/models/PresetsUtils.js
function (sId, sTitle, sDescription, aSelections) { var oRulesToExport = { id: sId, title: sTitle, description: sDescription, dateExported: (new Date()).toISOString(), version: "1.0", selections: aSelections }; var oExportObject = JSON.stringify(oRulesToExport); File.save(oExportObject, constants.RULE_SELECTION_EXPORT_FILE_NAME, 'json', 'text/plain'); }
javascript
function (sId, sTitle, sDescription, aSelections) { var oRulesToExport = { id: sId, title: sTitle, description: sDescription, dateExported: (new Date()).toISOString(), version: "1.0", selections: aSelections }; var oExportObject = JSON.stringify(oRulesToExport); File.save(oExportObject, constants.RULE_SELECTION_EXPORT_FILE_NAME, 'json', 'text/plain'); }
[ "function", "(", "sId", ",", "sTitle", ",", "sDescription", ",", "aSelections", ")", "{", "var", "oRulesToExport", "=", "{", "id", ":", "sId", ",", "title", ":", "sTitle", ",", "description", ":", "sDescription", ",", "dateExported", ":", "(", "new", "Date", "(", ")", ")", ".", "toISOString", "(", ")", ",", "version", ":", "\"1.0\"", ",", "selections", ":", "aSelections", "}", ";", "var", "oExportObject", "=", "JSON", ".", "stringify", "(", "oRulesToExport", ")", ";", "File", ".", "save", "(", "oExportObject", ",", "constants", ".", "RULE_SELECTION_EXPORT_FILE_NAME", ",", "'json'", ",", "'text/plain'", ")", ";", "}" ]
Exports the given selections to a file @param {string} sId The id of the export @param {string} sTitle The title of the export @param {string} sDescription Some description of what is exported @param {array} aSelections An array of rules IDs which are selected
[ "Exports", "the", "given", "selections", "to", "a", "file" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.support/src/sap/ui/support/supportRules/ui/models/PresetsUtils.js#L119-L132
4,015
SAP/openui5
src/sap.ui.support/src/sap/ui/support/supportRules/ui/models/PresetsUtils.js
function (oImport) { var bIsFileValid = true; if (!oImport.hasOwnProperty("title")) { bIsFileValid = false; } if (!oImport.hasOwnProperty("selections")) { bIsFileValid = false; } else if (!Array.isArray(oImport.selections)) { bIsFileValid = false; } else { for (var i = 0; i < oImport.selections.length; i++) { var oRuleSelection = oImport.selections[i]; if (!oRuleSelection.hasOwnProperty("ruleId") || !oRuleSelection.hasOwnProperty("libName")) { bIsFileValid = false; break; } } } return bIsFileValid; }
javascript
function (oImport) { var bIsFileValid = true; if (!oImport.hasOwnProperty("title")) { bIsFileValid = false; } if (!oImport.hasOwnProperty("selections")) { bIsFileValid = false; } else if (!Array.isArray(oImport.selections)) { bIsFileValid = false; } else { for (var i = 0; i < oImport.selections.length; i++) { var oRuleSelection = oImport.selections[i]; if (!oRuleSelection.hasOwnProperty("ruleId") || !oRuleSelection.hasOwnProperty("libName")) { bIsFileValid = false; break; } } } return bIsFileValid; }
[ "function", "(", "oImport", ")", "{", "var", "bIsFileValid", "=", "true", ";", "if", "(", "!", "oImport", ".", "hasOwnProperty", "(", "\"title\"", ")", ")", "{", "bIsFileValid", "=", "false", ";", "}", "if", "(", "!", "oImport", ".", "hasOwnProperty", "(", "\"selections\"", ")", ")", "{", "bIsFileValid", "=", "false", ";", "}", "else", "if", "(", "!", "Array", ".", "isArray", "(", "oImport", ".", "selections", ")", ")", "{", "bIsFileValid", "=", "false", ";", "}", "else", "{", "for", "(", "var", "i", "=", "0", ";", "i", "<", "oImport", ".", "selections", ".", "length", ";", "i", "++", ")", "{", "var", "oRuleSelection", "=", "oImport", ".", "selections", "[", "i", "]", ";", "if", "(", "!", "oRuleSelection", ".", "hasOwnProperty", "(", "\"ruleId\"", ")", "||", "!", "oRuleSelection", ".", "hasOwnProperty", "(", "\"libName\"", ")", ")", "{", "bIsFileValid", "=", "false", ";", "break", ";", "}", "}", "}", "return", "bIsFileValid", ";", "}" ]
Validates if the given import is in the correct format. @param {Object} oImport The preset object to import @return {boolean} Is the import data a valid rule preset file
[ "Validates", "if", "the", "given", "import", "is", "in", "the", "correct", "format", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.support/src/sap/ui/support/supportRules/ui/models/PresetsUtils.js#L139-L161
4,016
SAP/openui5
src/sap.ui.core/src/sap/ui/core/Core.js
preloadLibraryAsync
function preloadLibraryAsync(libConfig) { var that = this; libConfig = evalLibConfig(libConfig); var lib = libConfig.name, fileType = libConfig.fileType, libPackage = lib.replace(/\./g, '/'), http2 = this.oConfiguration.getDepCache(); if ( fileType === 'none' || !!sap.ui.loader._.getModuleState(libPackage + '/library.js') ) { return Promise.resolve(true); } var libInfo = mLibraryPreloadBundles[lib] || (mLibraryPreloadBundles[lib] = { }); // return any existing promise (either lib is currently loading or has been loaded) if ( libInfo.promise ) { return libInfo.promise; } // otherwise mark as pending libInfo.pending = true; libInfo.async = true; // first preload code, resolves with list of dependencies (or undefined) var p; if ( fileType !== 'json' /* 'js' or 'both', not forced to JSON */ ) { var sPreloadModule = libPackage + (http2 ? '/library-h2-preload.js' : '/library-preload.js'); p = sap.ui.loader._.loadJSResourceAsync(sPreloadModule).then( function() { return dependenciesFromManifest(lib); }, function(e) { // loading library-preload.js failed, might be an old style lib with a library-preload.json only. // with json === false, this fallback can be suppressed if ( fileType !== 'js' /* 'both' */ ) { Log.error("failed to load '" + sPreloadModule + "' (" + (e && e.message || e) + "), falling back to library-preload.json"); return loadJSONAsync(lib); } // ignore other errors } ); } else { p = loadJSONAsync(lib); } // load dependencies, if there are any libInfo.promise = p.then(function(dependencies) { var aPromises = [], oManifest = getManifest(lib); if ( dependencies && dependencies.length ) { dependencies = VersionInfo._getTransitiveDependencyForLibraries(dependencies); aPromises = dependencies.map(preloadLibraryAsync.bind(that)); } if (oManifest && Version(oManifest._version).compareTo("1.9.0") >= 0) { aPromises.push(that.getLibraryResourceBundle(lib, true)); } return Promise.all(aPromises).then(function() { libInfo.pending = false; }); }); // return resulting promise return libInfo.promise; }
javascript
function preloadLibraryAsync(libConfig) { var that = this; libConfig = evalLibConfig(libConfig); var lib = libConfig.name, fileType = libConfig.fileType, libPackage = lib.replace(/\./g, '/'), http2 = this.oConfiguration.getDepCache(); if ( fileType === 'none' || !!sap.ui.loader._.getModuleState(libPackage + '/library.js') ) { return Promise.resolve(true); } var libInfo = mLibraryPreloadBundles[lib] || (mLibraryPreloadBundles[lib] = { }); // return any existing promise (either lib is currently loading or has been loaded) if ( libInfo.promise ) { return libInfo.promise; } // otherwise mark as pending libInfo.pending = true; libInfo.async = true; // first preload code, resolves with list of dependencies (or undefined) var p; if ( fileType !== 'json' /* 'js' or 'both', not forced to JSON */ ) { var sPreloadModule = libPackage + (http2 ? '/library-h2-preload.js' : '/library-preload.js'); p = sap.ui.loader._.loadJSResourceAsync(sPreloadModule).then( function() { return dependenciesFromManifest(lib); }, function(e) { // loading library-preload.js failed, might be an old style lib with a library-preload.json only. // with json === false, this fallback can be suppressed if ( fileType !== 'js' /* 'both' */ ) { Log.error("failed to load '" + sPreloadModule + "' (" + (e && e.message || e) + "), falling back to library-preload.json"); return loadJSONAsync(lib); } // ignore other errors } ); } else { p = loadJSONAsync(lib); } // load dependencies, if there are any libInfo.promise = p.then(function(dependencies) { var aPromises = [], oManifest = getManifest(lib); if ( dependencies && dependencies.length ) { dependencies = VersionInfo._getTransitiveDependencyForLibraries(dependencies); aPromises = dependencies.map(preloadLibraryAsync.bind(that)); } if (oManifest && Version(oManifest._version).compareTo("1.9.0") >= 0) { aPromises.push(that.getLibraryResourceBundle(lib, true)); } return Promise.all(aPromises).then(function() { libInfo.pending = false; }); }); // return resulting promise return libInfo.promise; }
[ "function", "preloadLibraryAsync", "(", "libConfig", ")", "{", "var", "that", "=", "this", ";", "libConfig", "=", "evalLibConfig", "(", "libConfig", ")", ";", "var", "lib", "=", "libConfig", ".", "name", ",", "fileType", "=", "libConfig", ".", "fileType", ",", "libPackage", "=", "lib", ".", "replace", "(", "/", "\\.", "/", "g", ",", "'/'", ")", ",", "http2", "=", "this", ".", "oConfiguration", ".", "getDepCache", "(", ")", ";", "if", "(", "fileType", "===", "'none'", "||", "!", "!", "sap", ".", "ui", ".", "loader", ".", "_", ".", "getModuleState", "(", "libPackage", "+", "'/library.js'", ")", ")", "{", "return", "Promise", ".", "resolve", "(", "true", ")", ";", "}", "var", "libInfo", "=", "mLibraryPreloadBundles", "[", "lib", "]", "||", "(", "mLibraryPreloadBundles", "[", "lib", "]", "=", "{", "}", ")", ";", "// return any existing promise (either lib is currently loading or has been loaded)", "if", "(", "libInfo", ".", "promise", ")", "{", "return", "libInfo", ".", "promise", ";", "}", "// otherwise mark as pending", "libInfo", ".", "pending", "=", "true", ";", "libInfo", ".", "async", "=", "true", ";", "// first preload code, resolves with list of dependencies (or undefined)", "var", "p", ";", "if", "(", "fileType", "!==", "'json'", "/* 'js' or 'both', not forced to JSON */", ")", "{", "var", "sPreloadModule", "=", "libPackage", "+", "(", "http2", "?", "'/library-h2-preload.js'", ":", "'/library-preload.js'", ")", ";", "p", "=", "sap", ".", "ui", ".", "loader", ".", "_", ".", "loadJSResourceAsync", "(", "sPreloadModule", ")", ".", "then", "(", "function", "(", ")", "{", "return", "dependenciesFromManifest", "(", "lib", ")", ";", "}", ",", "function", "(", "e", ")", "{", "// loading library-preload.js failed, might be an old style lib with a library-preload.json only.", "// with json === false, this fallback can be suppressed", "if", "(", "fileType", "!==", "'js'", "/* 'both' */", ")", "{", "Log", ".", "error", "(", "\"failed to load '\"", "+", "sPreloadModule", "+", "\"' (\"", "+", "(", "e", "&&", "e", ".", "message", "||", "e", ")", "+", "\"), falling back to library-preload.json\"", ")", ";", "return", "loadJSONAsync", "(", "lib", ")", ";", "}", "// ignore other errors", "}", ")", ";", "}", "else", "{", "p", "=", "loadJSONAsync", "(", "lib", ")", ";", "}", "// load dependencies, if there are any", "libInfo", ".", "promise", "=", "p", ".", "then", "(", "function", "(", "dependencies", ")", "{", "var", "aPromises", "=", "[", "]", ",", "oManifest", "=", "getManifest", "(", "lib", ")", ";", "if", "(", "dependencies", "&&", "dependencies", ".", "length", ")", "{", "dependencies", "=", "VersionInfo", ".", "_getTransitiveDependencyForLibraries", "(", "dependencies", ")", ";", "aPromises", "=", "dependencies", ".", "map", "(", "preloadLibraryAsync", ".", "bind", "(", "that", ")", ")", ";", "}", "if", "(", "oManifest", "&&", "Version", "(", "oManifest", ".", "_version", ")", ".", "compareTo", "(", "\"1.9.0\"", ")", ">=", "0", ")", "{", "aPromises", ".", "push", "(", "that", ".", "getLibraryResourceBundle", "(", "lib", ",", "true", ")", ")", ";", "}", "return", "Promise", ".", "all", "(", "aPromises", ")", ".", "then", "(", "function", "(", ")", "{", "libInfo", ".", "pending", "=", "false", ";", "}", ")", ";", "}", ")", ";", "// return resulting promise", "return", "libInfo", ".", "promise", ";", "}" ]
Preloads a library asynchronously. @param {string|object} libConfig Name of the library to preload or settings object describing library @param {string} [libConfig.name] Name of the library to preload @param {boolean|undefined} [libConfig.json] Whether library supports only JSON (<code>true</code>) or only JS (<code>false</code>) or whether both should be tried (undefined) @returns {Promise} A promise to be fulfilled when the library has been preloaded @private
[ "Preloads", "a", "library", "asynchronously", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/Core.js#L1599-L1669
4,017
SAP/openui5
src/sap.ui.core/src/sap/ui/core/Core.js
registerPreloadedModules
function registerPreloadedModules(oData, sURL) { var modules = oData.modules, fnUI5ToRJS = function(sName) { return /^jquery\.sap\./.test(sName) ? sName : sName.replace(/\./g, "/"); }; if ( Version(oData.version || "1.0").compareTo("2.0") < 0 ) { modules = {}; for ( var sName in oData.modules ) { modules[fnUI5ToRJS(sName) + ".js"] = oData.modules[sName]; } } sap.ui.require.preload(modules, oData.name, sURL); }
javascript
function registerPreloadedModules(oData, sURL) { var modules = oData.modules, fnUI5ToRJS = function(sName) { return /^jquery\.sap\./.test(sName) ? sName : sName.replace(/\./g, "/"); }; if ( Version(oData.version || "1.0").compareTo("2.0") < 0 ) { modules = {}; for ( var sName in oData.modules ) { modules[fnUI5ToRJS(sName) + ".js"] = oData.modules[sName]; } } sap.ui.require.preload(modules, oData.name, sURL); }
[ "function", "registerPreloadedModules", "(", "oData", ",", "sURL", ")", "{", "var", "modules", "=", "oData", ".", "modules", ",", "fnUI5ToRJS", "=", "function", "(", "sName", ")", "{", "return", "/", "^jquery\\.sap\\.", "/", ".", "test", "(", "sName", ")", "?", "sName", ":", "sName", ".", "replace", "(", "/", "\\.", "/", "g", ",", "\"/\"", ")", ";", "}", ";", "if", "(", "Version", "(", "oData", ".", "version", "||", "\"1.0\"", ")", ".", "compareTo", "(", "\"2.0\"", ")", "<", "0", ")", "{", "modules", "=", "{", "}", ";", "for", "(", "var", "sName", "in", "oData", ".", "modules", ")", "{", "modules", "[", "fnUI5ToRJS", "(", "sName", ")", "+", "\".js\"", "]", "=", "oData", ".", "modules", "[", "sName", "]", ";", "}", "}", "sap", ".", "ui", ".", "require", ".", "preload", "(", "modules", ",", "oData", ".", "name", ",", "sURL", ")", ";", "}" ]
Adds all resources from a preload bundle to the preload cache. When a resource exists already in the cache, the new content is ignored. @param {object} oData Preload bundle @param {string} [oData.url] URL from which the bundle has been loaded @param {string} [oData.name] Unique name of the bundle @param {string} [oData.version='1.0'] Format version of the preload bundle @param {object} oData.modules Map of resources keyed by their resource name; each resource must be a string or a function @private
[ "Adds", "all", "resources", "from", "a", "preload", "bundle", "to", "the", "preload", "cache", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/Core.js#L1716-L1728
4,018
SAP/openui5
src/sap.ui.core/src/sap/ui/core/Core.js
preprocessDependencies
function preprocessDependencies(dependencies) { if (Array.isArray(dependencies)) { // remove .library-preload suffix from dependencies return dependencies.map(function (dep) { return dep.replace(/\.library-preload$/, ''); }); } return dependencies; }
javascript
function preprocessDependencies(dependencies) { if (Array.isArray(dependencies)) { // remove .library-preload suffix from dependencies return dependencies.map(function (dep) { return dep.replace(/\.library-preload$/, ''); }); } return dependencies; }
[ "function", "preprocessDependencies", "(", "dependencies", ")", "{", "if", "(", "Array", ".", "isArray", "(", "dependencies", ")", ")", "{", "// remove .library-preload suffix from dependencies", "return", "dependencies", ".", "map", "(", "function", "(", "dep", ")", "{", "return", "dep", ".", "replace", "(", "/", "\\.library-preload$", "/", ",", "''", ")", ";", "}", ")", ";", "}", "return", "dependencies", ";", "}" ]
Preprocessed given dependencies @param {object} oDependencies - Dependencies to preprocess @returns {object} oDependencies - Proprocessed dependencies
[ "Preprocessed", "given", "dependencies" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/Core.js#L1736-L1744
4,019
SAP/openui5
src/sap.ui.core/src/sap/ui/core/Core.js
preloadLibrarySync
function preloadLibrarySync(libConfig) { libConfig = evalLibConfig(libConfig); var lib = libConfig.name, fileType = libConfig.fileType, libPackage = lib.replace(/\./g, '/'), libLoaded = !!sap.ui.loader._.getModuleState(libPackage + '/library.js'); if ( fileType === 'none' || libLoaded ) { return; } var libInfo = mLibraryPreloadBundles[lib] || (mLibraryPreloadBundles[lib] = { }); // already preloaded? if ( libInfo.pending === false ) { return; } // currently loading if ( libInfo.pending ) { if ( libInfo.async ) { Log.warning("request to load " + lib + " synchronously while async loading is pending; this causes a duplicate request and should be avoided by caller"); // fall through and preload synchronously } else { // sync cycle -> ignore nested call (would nevertheless be a dependency cycle) Log.warning("request to load " + lib + " synchronously while sync loading is pending (cycle, ignored)"); return; } } libInfo.pending = true; libInfo.async = false; var resolve; libInfo.promise = new Promise(function(_resolve, _reject) { resolve = _resolve; }); var dependencies; if ( fileType !== 'json' /* 'js' or 'both', not forced to JSON */ ) { var sPreloadModule = libPackage + '/library-preload'; try { sap.ui.requireSync(sPreloadModule); dependencies = dependenciesFromManifest(lib); } catch (e) { Log.error("failed to load '" + sPreloadModule + "' (" + (e && e.message || e) + ")"); if ( e && e.loadError && fileType !== 'js' ) { dependencies = loadJSONSync(lib); } // ignore other errors (preload shouldn't fail) } } else { dependencies = loadJSONSync(lib); } if ( dependencies && dependencies.length ) { dependencies.forEach(preloadLibrarySync); } libInfo.pending = false; resolve(); }
javascript
function preloadLibrarySync(libConfig) { libConfig = evalLibConfig(libConfig); var lib = libConfig.name, fileType = libConfig.fileType, libPackage = lib.replace(/\./g, '/'), libLoaded = !!sap.ui.loader._.getModuleState(libPackage + '/library.js'); if ( fileType === 'none' || libLoaded ) { return; } var libInfo = mLibraryPreloadBundles[lib] || (mLibraryPreloadBundles[lib] = { }); // already preloaded? if ( libInfo.pending === false ) { return; } // currently loading if ( libInfo.pending ) { if ( libInfo.async ) { Log.warning("request to load " + lib + " synchronously while async loading is pending; this causes a duplicate request and should be avoided by caller"); // fall through and preload synchronously } else { // sync cycle -> ignore nested call (would nevertheless be a dependency cycle) Log.warning("request to load " + lib + " synchronously while sync loading is pending (cycle, ignored)"); return; } } libInfo.pending = true; libInfo.async = false; var resolve; libInfo.promise = new Promise(function(_resolve, _reject) { resolve = _resolve; }); var dependencies; if ( fileType !== 'json' /* 'js' or 'both', not forced to JSON */ ) { var sPreloadModule = libPackage + '/library-preload'; try { sap.ui.requireSync(sPreloadModule); dependencies = dependenciesFromManifest(lib); } catch (e) { Log.error("failed to load '" + sPreloadModule + "' (" + (e && e.message || e) + ")"); if ( e && e.loadError && fileType !== 'js' ) { dependencies = loadJSONSync(lib); } // ignore other errors (preload shouldn't fail) } } else { dependencies = loadJSONSync(lib); } if ( dependencies && dependencies.length ) { dependencies.forEach(preloadLibrarySync); } libInfo.pending = false; resolve(); }
[ "function", "preloadLibrarySync", "(", "libConfig", ")", "{", "libConfig", "=", "evalLibConfig", "(", "libConfig", ")", ";", "var", "lib", "=", "libConfig", ".", "name", ",", "fileType", "=", "libConfig", ".", "fileType", ",", "libPackage", "=", "lib", ".", "replace", "(", "/", "\\.", "/", "g", ",", "'/'", ")", ",", "libLoaded", "=", "!", "!", "sap", ".", "ui", ".", "loader", ".", "_", ".", "getModuleState", "(", "libPackage", "+", "'/library.js'", ")", ";", "if", "(", "fileType", "===", "'none'", "||", "libLoaded", ")", "{", "return", ";", "}", "var", "libInfo", "=", "mLibraryPreloadBundles", "[", "lib", "]", "||", "(", "mLibraryPreloadBundles", "[", "lib", "]", "=", "{", "}", ")", ";", "// already preloaded?", "if", "(", "libInfo", ".", "pending", "===", "false", ")", "{", "return", ";", "}", "// currently loading", "if", "(", "libInfo", ".", "pending", ")", "{", "if", "(", "libInfo", ".", "async", ")", "{", "Log", ".", "warning", "(", "\"request to load \"", "+", "lib", "+", "\" synchronously while async loading is pending; this causes a duplicate request and should be avoided by caller\"", ")", ";", "// fall through and preload synchronously", "}", "else", "{", "// sync cycle -> ignore nested call (would nevertheless be a dependency cycle)", "Log", ".", "warning", "(", "\"request to load \"", "+", "lib", "+", "\" synchronously while sync loading is pending (cycle, ignored)\"", ")", ";", "return", ";", "}", "}", "libInfo", ".", "pending", "=", "true", ";", "libInfo", ".", "async", "=", "false", ";", "var", "resolve", ";", "libInfo", ".", "promise", "=", "new", "Promise", "(", "function", "(", "_resolve", ",", "_reject", ")", "{", "resolve", "=", "_resolve", ";", "}", ")", ";", "var", "dependencies", ";", "if", "(", "fileType", "!==", "'json'", "/* 'js' or 'both', not forced to JSON */", ")", "{", "var", "sPreloadModule", "=", "libPackage", "+", "'/library-preload'", ";", "try", "{", "sap", ".", "ui", ".", "requireSync", "(", "sPreloadModule", ")", ";", "dependencies", "=", "dependenciesFromManifest", "(", "lib", ")", ";", "}", "catch", "(", "e", ")", "{", "Log", ".", "error", "(", "\"failed to load '\"", "+", "sPreloadModule", "+", "\"' (\"", "+", "(", "e", "&&", "e", ".", "message", "||", "e", ")", "+", "\")\"", ")", ";", "if", "(", "e", "&&", "e", ".", "loadError", "&&", "fileType", "!==", "'js'", ")", "{", "dependencies", "=", "loadJSONSync", "(", "lib", ")", ";", "}", "// ignore other errors (preload shouldn't fail)", "}", "}", "else", "{", "dependencies", "=", "loadJSONSync", "(", "lib", ")", ";", "}", "if", "(", "dependencies", "&&", "dependencies", ".", "length", ")", "{", "dependencies", ".", "forEach", "(", "preloadLibrarySync", ")", ";", "}", "libInfo", ".", "pending", "=", "false", ";", "resolve", "(", ")", ";", "}" ]
Preloads a library synchronously. @param {string|object} libConfig Name of the library to preload or settings object describing library. @param {string} [libConfig.name] Name of the library to preload @param {boolean|undefined} [libConfig.json] Whether library supports only JSON (<code>true</code>) or only JS (<code>false</code>) or whether both should be tried (undefined) @private
[ "Preloads", "a", "library", "synchronously", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/Core.js#L1777-L1840
4,020
SAP/openui5
src/sap.ui.core/src/sap/ui/core/Core.js
getModulePath
function getModulePath(sModuleName, sSuffix){ return sap.ui.require.toUrl(sModuleName.replace(/\./g, "/") + sSuffix); }
javascript
function getModulePath(sModuleName, sSuffix){ return sap.ui.require.toUrl(sModuleName.replace(/\./g, "/") + sSuffix); }
[ "function", "getModulePath", "(", "sModuleName", ",", "sSuffix", ")", "{", "return", "sap", ".", "ui", ".", "require", ".", "toUrl", "(", "sModuleName", ".", "replace", "(", "/", "\\.", "/", "g", ",", "\"/\"", ")", "+", "sSuffix", ")", ";", "}" ]
Retrieves the module path. @param {string} sModuleName module name. @param {string} sSuffix is used untouched (dots are not replaced with slashes). @returns {string} module path.
[ "Retrieves", "the", "module", "path", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/Core.js#L1870-L1872
4,021
SAP/openui5
src/sap.ui.rta/src/sap/ui/rta/appVariant/Feature.js
function(bAsKeyUser) { var oDescriptor = fnGetDescriptor(); return new Promise(function(resolve) { var fnCancel = function() { AppVariantUtils.closeOverviewDialog(); }; sap.ui.require(["sap/ui/rta/appVariant/AppVariantOverviewDialog"], function(AppVariantOverviewDialog) { if (!oAppVariantOverviewDialog) { oAppVariantOverviewDialog = new AppVariantOverviewDialog({ idRunningApp: oDescriptor["sap.app"].id, isOverviewForKeyUser: bAsKeyUser }); } oAppVariantOverviewDialog.attachCancel(fnCancel); oAppVariantOverviewDialog.oPopup.attachOpened(function() { resolve(oAppVariantOverviewDialog); }); oAppVariantOverviewDialog.open(); }); }); }
javascript
function(bAsKeyUser) { var oDescriptor = fnGetDescriptor(); return new Promise(function(resolve) { var fnCancel = function() { AppVariantUtils.closeOverviewDialog(); }; sap.ui.require(["sap/ui/rta/appVariant/AppVariantOverviewDialog"], function(AppVariantOverviewDialog) { if (!oAppVariantOverviewDialog) { oAppVariantOverviewDialog = new AppVariantOverviewDialog({ idRunningApp: oDescriptor["sap.app"].id, isOverviewForKeyUser: bAsKeyUser }); } oAppVariantOverviewDialog.attachCancel(fnCancel); oAppVariantOverviewDialog.oPopup.attachOpened(function() { resolve(oAppVariantOverviewDialog); }); oAppVariantOverviewDialog.open(); }); }); }
[ "function", "(", "bAsKeyUser", ")", "{", "var", "oDescriptor", "=", "fnGetDescriptor", "(", ")", ";", "return", "new", "Promise", "(", "function", "(", "resolve", ")", "{", "var", "fnCancel", "=", "function", "(", ")", "{", "AppVariantUtils", ".", "closeOverviewDialog", "(", ")", ";", "}", ";", "sap", ".", "ui", ".", "require", "(", "[", "\"sap/ui/rta/appVariant/AppVariantOverviewDialog\"", "]", ",", "function", "(", "AppVariantOverviewDialog", ")", "{", "if", "(", "!", "oAppVariantOverviewDialog", ")", "{", "oAppVariantOverviewDialog", "=", "new", "AppVariantOverviewDialog", "(", "{", "idRunningApp", ":", "oDescriptor", "[", "\"sap.app\"", "]", ".", "id", ",", "isOverviewForKeyUser", ":", "bAsKeyUser", "}", ")", ";", "}", "oAppVariantOverviewDialog", ".", "attachCancel", "(", "fnCancel", ")", ";", "oAppVariantOverviewDialog", ".", "oPopup", ".", "attachOpened", "(", "function", "(", ")", "{", "resolve", "(", "oAppVariantOverviewDialog", ")", ";", "}", ")", ";", "oAppVariantOverviewDialog", ".", "open", "(", ")", ";", "}", ")", ";", "}", ")", ";", "}" ]
To see the overview of app variants, a key user has created from an app
[ "To", "see", "the", "overview", "of", "app", "variants", "a", "key", "user", "has", "created", "from", "an", "app" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.rta/src/sap/ui/rta/appVariant/Feature.js#L98-L122
4,022
SAP/openui5
src/sap.ui.rta/src/sap/ui/rta/appVariant/Feature.js
processArray
function processArray(aPromises) { return aPromises.reduce(function(pacc, fn) { return pacc.then(fn); }, Promise.resolve()) .catch(function() { return Promise.resolve(false); }); }
javascript
function processArray(aPromises) { return aPromises.reduce(function(pacc, fn) { return pacc.then(fn); }, Promise.resolve()) .catch(function() { return Promise.resolve(false); }); }
[ "function", "processArray", "(", "aPromises", ")", "{", "return", "aPromises", ".", "reduce", "(", "function", "(", "pacc", ",", "fn", ")", "{", "return", "pacc", ".", "then", "(", "fn", ")", ";", "}", ",", "Promise", ".", "resolve", "(", ")", ")", ".", "catch", "(", "function", "(", ")", "{", "return", "Promise", ".", "resolve", "(", "false", ")", ";", "}", ")", ";", "}" ]
Execute a list of Promises
[ "Execute", "a", "list", "of", "Promises" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.rta/src/sap/ui/rta/appVariant/Feature.js#L263-L270
4,023
SAP/openui5
src/sap.ui.core/src/sap/ui/model/base/ManagedObjectModel.js
_stringify
function _stringify(vObject) { var sData = "", sProp; var type = typeof vObject; if (vObject == null || (type != "object" && type != "function")) { sData = vObject; } else if (isPlainObject(vObject)) { sData = JSON.stringify(vObject); } else if (vObject instanceof ManagedObject) { sData = vObject.getId();//add the id for (sProp in vObject.mProperties) { sData = sData + "$" + _stringify(vObject.mProperties[sProp]); } } else if (Array.isArray(vObject)) { for (var i = 0; vObject.length; i++) { sData = sData + "$" + _stringify(vObject); } } else { Log.warning("Could not stringify object " + vObject); sData = "$"; } return sData; }
javascript
function _stringify(vObject) { var sData = "", sProp; var type = typeof vObject; if (vObject == null || (type != "object" && type != "function")) { sData = vObject; } else if (isPlainObject(vObject)) { sData = JSON.stringify(vObject); } else if (vObject instanceof ManagedObject) { sData = vObject.getId();//add the id for (sProp in vObject.mProperties) { sData = sData + "$" + _stringify(vObject.mProperties[sProp]); } } else if (Array.isArray(vObject)) { for (var i = 0; vObject.length; i++) { sData = sData + "$" + _stringify(vObject); } } else { Log.warning("Could not stringify object " + vObject); sData = "$"; } return sData; }
[ "function", "_stringify", "(", "vObject", ")", "{", "var", "sData", "=", "\"\"", ",", "sProp", ";", "var", "type", "=", "typeof", "vObject", ";", "if", "(", "vObject", "==", "null", "||", "(", "type", "!=", "\"object\"", "&&", "type", "!=", "\"function\"", ")", ")", "{", "sData", "=", "vObject", ";", "}", "else", "if", "(", "isPlainObject", "(", "vObject", ")", ")", "{", "sData", "=", "JSON", ".", "stringify", "(", "vObject", ")", ";", "}", "else", "if", "(", "vObject", "instanceof", "ManagedObject", ")", "{", "sData", "=", "vObject", ".", "getId", "(", ")", ";", "//add the id", "for", "(", "sProp", "in", "vObject", ".", "mProperties", ")", "{", "sData", "=", "sData", "+", "\"$\"", "+", "_stringify", "(", "vObject", ".", "mProperties", "[", "sProp", "]", ")", ";", "}", "}", "else", "if", "(", "Array", ".", "isArray", "(", "vObject", ")", ")", "{", "for", "(", "var", "i", "=", "0", ";", "vObject", ".", "length", ";", "i", "++", ")", "{", "sData", "=", "sData", "+", "\"$\"", "+", "_stringify", "(", "vObject", ")", ";", "}", "}", "else", "{", "Log", ".", "warning", "(", "\"Could not stringify object \"", "+", "vObject", ")", ";", "sData", "=", "\"$\"", ";", "}", "return", "sData", ";", "}" ]
Serialize the object to a string to support change detection @param vObject @returns {string} a serialization of the object to a string @private
[ "Serialize", "the", "object", "to", "a", "string", "to", "support", "change", "detection" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/base/ManagedObjectModel.js#L98-L121
4,024
SAP/openui5
src/sap.ui.core/src/sap/ui/model/base/ManagedObjectModel.js
function(oContext) { // use the id of the ManagedObject instance as the identifier // for the extended change detection var oObject = oContext.getObject(); if (oObject instanceof ManagedObject) { return oObject.getId(); } return JSONListBinding.prototype.getEntryKey.apply(this, arguments); }
javascript
function(oContext) { // use the id of the ManagedObject instance as the identifier // for the extended change detection var oObject = oContext.getObject(); if (oObject instanceof ManagedObject) { return oObject.getId(); } return JSONListBinding.prototype.getEntryKey.apply(this, arguments); }
[ "function", "(", "oContext", ")", "{", "// use the id of the ManagedObject instance as the identifier", "// for the extended change detection", "var", "oObject", "=", "oContext", ".", "getObject", "(", ")", ";", "if", "(", "oObject", "instanceof", "ManagedObject", ")", "{", "return", "oObject", ".", "getId", "(", ")", ";", "}", "return", "JSONListBinding", ".", "prototype", ".", "getEntryKey", ".", "apply", "(", "this", ",", "arguments", ")", ";", "}" ]
Use the id of the ManagedObject instance as the unique key to identify the entry in the extended change detection. The default implementation in the parent class which uses JSON.stringify to serialize the instance doesn't fit here because none of the ManagedObject instance can be Serialized. @param {sap.ui.model.Context} oContext the binding context object @return {string} The identifier used for diff comparison @see sap.ui.model.ListBinding.prototype.getEntryData
[ "Use", "the", "id", "of", "the", "ManagedObject", "instance", "as", "the", "unique", "key", "to", "identify", "the", "entry", "in", "the", "extended", "change", "detection", ".", "The", "default", "implementation", "in", "the", "parent", "class", "which", "uses", "JSON", ".", "stringify", "to", "serialize", "the", "instance", "doesn", "t", "fit", "here", "because", "none", "of", "the", "ManagedObject", "instance", "can", "be", "Serialized", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/base/ManagedObjectModel.js#L140-L149
4,025
SAP/openui5
src/sap.ui.core/src/sap/ui/model/base/ManagedObjectModel.js
function(iStartIndex, iLength) { var iSizeLimit; if (this._oAggregation) { var oInnerListBinding = this._oOriginMO.getBinding(this._sMember); //check if the binding is a list binding if (oInnerListBinding) { var oModel = oInnerListBinding.getModel(); iSizeLimit = oModel.iSizeLimit; } var oBindingInfo = this._oOriginMO.getBindingInfo(this._sMember); //sanity check for paging exceeds model size limit if (oBindingInfo && iStartIndex >= 0 && iLength && iSizeLimit && iLength > iSizeLimit) { var bUpdate = false; if (iStartIndex != oBindingInfo.startIndex) { oBindingInfo.startIndex = iStartIndex; bUpdate = true; } if (iLength != oBindingInfo.length) { oBindingInfo.length = iLength; bUpdate = true; } if (bUpdate) { this._oAggregation.update(this._oOriginMO, "change"); } } } return JSONListBinding.prototype._getContexts.apply(this, arguments); }
javascript
function(iStartIndex, iLength) { var iSizeLimit; if (this._oAggregation) { var oInnerListBinding = this._oOriginMO.getBinding(this._sMember); //check if the binding is a list binding if (oInnerListBinding) { var oModel = oInnerListBinding.getModel(); iSizeLimit = oModel.iSizeLimit; } var oBindingInfo = this._oOriginMO.getBindingInfo(this._sMember); //sanity check for paging exceeds model size limit if (oBindingInfo && iStartIndex >= 0 && iLength && iSizeLimit && iLength > iSizeLimit) { var bUpdate = false; if (iStartIndex != oBindingInfo.startIndex) { oBindingInfo.startIndex = iStartIndex; bUpdate = true; } if (iLength != oBindingInfo.length) { oBindingInfo.length = iLength; bUpdate = true; } if (bUpdate) { this._oAggregation.update(this._oOriginMO, "change"); } } } return JSONListBinding.prototype._getContexts.apply(this, arguments); }
[ "function", "(", "iStartIndex", ",", "iLength", ")", "{", "var", "iSizeLimit", ";", "if", "(", "this", ".", "_oAggregation", ")", "{", "var", "oInnerListBinding", "=", "this", ".", "_oOriginMO", ".", "getBinding", "(", "this", ".", "_sMember", ")", ";", "//check if the binding is a list binding", "if", "(", "oInnerListBinding", ")", "{", "var", "oModel", "=", "oInnerListBinding", ".", "getModel", "(", ")", ";", "iSizeLimit", "=", "oModel", ".", "iSizeLimit", ";", "}", "var", "oBindingInfo", "=", "this", ".", "_oOriginMO", ".", "getBindingInfo", "(", "this", ".", "_sMember", ")", ";", "//sanity check for paging exceeds model size limit", "if", "(", "oBindingInfo", "&&", "iStartIndex", ">=", "0", "&&", "iLength", "&&", "iSizeLimit", "&&", "iLength", ">", "iSizeLimit", ")", "{", "var", "bUpdate", "=", "false", ";", "if", "(", "iStartIndex", "!=", "oBindingInfo", ".", "startIndex", ")", "{", "oBindingInfo", ".", "startIndex", "=", "iStartIndex", ";", "bUpdate", "=", "true", ";", "}", "if", "(", "iLength", "!=", "oBindingInfo", ".", "length", ")", "{", "oBindingInfo", ".", "length", "=", "iLength", ";", "bUpdate", "=", "true", ";", "}", "if", "(", "bUpdate", ")", "{", "this", ".", "_oAggregation", ".", "update", "(", "this", ".", "_oOriginMO", ",", "\"change\"", ")", ";", "}", "}", "}", "return", "JSONListBinding", ".", "prototype", ".", "_getContexts", ".", "apply", "(", "this", ",", "arguments", ")", ";", "}" ]
In order to be able to page from an outer control an inner aggregation binding must be forced to page also @override
[ "In", "order", "to", "be", "able", "to", "page", "from", "an", "outer", "control", "an", "inner", "aggregation", "binding", "must", "be", "forced", "to", "page", "also" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/base/ManagedObjectModel.js#L166-L201
4,026
SAP/openui5
src/sap.f/src/sap/f/shellBar/Accessibility.js
function (oContext) { if (oContext) { oControl = oContext; oControl.addDelegate(this._controlDelegate, false, this); } this.oRb = Core.getLibraryResourceBundle("sap.f"); }
javascript
function (oContext) { if (oContext) { oControl = oContext; oControl.addDelegate(this._controlDelegate, false, this); } this.oRb = Core.getLibraryResourceBundle("sap.f"); }
[ "function", "(", "oContext", ")", "{", "if", "(", "oContext", ")", "{", "oControl", "=", "oContext", ";", "oControl", ".", "addDelegate", "(", "this", ".", "_controlDelegate", ",", "false", ",", "this", ")", ";", "}", "this", ".", "oRb", "=", "Core", ".", "getLibraryResourceBundle", "(", "\"sap.f\"", ")", ";", "}" ]
This class is used to maintain all the accessibility roles, tooltips, etc., needed for the ShellBar control life cycle. @alias sap/f/shellBar/Accessibility @since 1.64 @private
[ "This", "class", "is", "used", "to", "maintain", "all", "the", "accessibility", "roles", "tooltips", "etc", ".", "needed", "for", "the", "ShellBar", "control", "life", "cycle", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.f/src/sap/f/shellBar/Accessibility.js#L19-L26
4,027
SAP/openui5
src/sap.ui.core/src/sap/ui/model/odata/v4/lib/_Batch.js
function (aRequests) { var oBatchRequest = _serializeBatchRequest(aRequests); return { body : oBatchRequest.body.join(""), headers : { "Content-Type" : "multipart/mixed; boundary=" + oBatchRequest.batchBoundary, "MIME-Version" : "1.0" } }; }
javascript
function (aRequests) { var oBatchRequest = _serializeBatchRequest(aRequests); return { body : oBatchRequest.body.join(""), headers : { "Content-Type" : "multipart/mixed; boundary=" + oBatchRequest.batchBoundary, "MIME-Version" : "1.0" } }; }
[ "function", "(", "aRequests", ")", "{", "var", "oBatchRequest", "=", "_serializeBatchRequest", "(", "aRequests", ")", ";", "return", "{", "body", ":", "oBatchRequest", ".", "body", ".", "join", "(", "\"\"", ")", ",", "headers", ":", "{", "\"Content-Type\"", ":", "\"multipart/mixed; boundary=\"", "+", "oBatchRequest", ".", "batchBoundary", ",", "\"MIME-Version\"", ":", "\"1.0\"", "}", "}", ";", "}" ]
Serializes an array of requests to an object containing the batch request body and mandatory headers for the batch request. @param {object[]} aRequests An array consisting of request objects <code>oRequest</code> or out of array(s) of request objects <code>oRequest</code>, in case requests need to be sent in scope of a change set. See example below. @param {string} oRequest.method HTTP method, e.g. "GET" @param {string} oRequest.url Absolute or relative URL. If the URL contains Content-ID reference then the reference has to be specified as zero-based index of the referred request inside the change set. See example below. @param {object} oRequest.headers Map of request headers. RFC-2047 encoding rules are not supported. Nevertheless non US-ASCII values can be used. If the value of an "If-Match" header is an object, that object's ETag is used instead. @param {object} oRequest.body Request body. If specified, oRequest.headers map must contain "Content-Type" header either without "charset" parameter or with "charset" parameter having value "UTF-8". @returns {object} Object containing the following properties: <ul> <li><code>body</code>: Batch request body <li><code>headers</code>: Batch-specific request headers <ul> <li><code>Content-Type</code>: Value for the 'Content-Type' header <li><code>MIME-Version</code>: Value for the 'MIME-Version' header </ul> </ul> @example var oBatchRequest = Batch.serializeBatchRequest([ { method : "GET", url : "/sap/opu/odata4/IWBEP/TEA/default/IWBEP/TEA_BUSI/0001/Employees('1')", headers : { Accept : "application/json" } }, [{ method : "POST", url : "TEAMS", headers : { "Content-Type" : "application/json" }, body : {"TEAM_ID" : "TEAM_03"} }, { method : "POST", url : "$0/TEAM_2_Employees", headers : { "Content-Type" : "application/json", "If-Match" : "etag0" }, body : {"Name" : "John Smith"} }], { method : "PATCH", url : "/sap/opu/odata4/IWBEP/TEA/default/IWBEP/TEA_BUSI/0001/Employees('3')", headers : { "Content-Type" : "application/json", "If-Match" : { "@odata.etag" : "etag1" } }, body : {"TEAM_ID" : "TEAM_01"} } ]);
[ "Serializes", "an", "array", "of", "requests", "to", "an", "object", "containing", "the", "batch", "request", "body", "and", "mandatory", "headers", "for", "the", "batch", "request", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/v4/lib/_Batch.js#L395-L405
4,028
SAP/openui5
src/sap.ui.support/src/sap/ui/support/supportRules/util/RuleValidator.js
function(aEnum, oEnumComparison) { if (aEnum && Array.isArray(aEnum) && aEnum.length) { for (var i = 0; i < aEnum.length; i++) { if (oEnumComparison.hasOwnProperty(aEnum[i])) { continue; } else { return false; } } return true; } return false; }
javascript
function(aEnum, oEnumComparison) { if (aEnum && Array.isArray(aEnum) && aEnum.length) { for (var i = 0; i < aEnum.length; i++) { if (oEnumComparison.hasOwnProperty(aEnum[i])) { continue; } else { return false; } } return true; } return false; }
[ "function", "(", "aEnum", ",", "oEnumComparison", ")", "{", "if", "(", "aEnum", "&&", "Array", ".", "isArray", "(", "aEnum", ")", "&&", "aEnum", ".", "length", ")", "{", "for", "(", "var", "i", "=", "0", ";", "i", "<", "aEnum", ".", "length", ";", "i", "++", ")", "{", "if", "(", "oEnumComparison", ".", "hasOwnProperty", "(", "aEnum", "[", "i", "]", ")", ")", "{", "continue", ";", "}", "else", "{", "return", "false", ";", "}", "}", "return", "true", ";", "}", "return", "false", ";", "}" ]
Validates any given collection. Basically you can validate Audiences, Categories, Severity etc - everything that meets the criteria Positive cases : - "Capitalcase" @private @param {array} aEnum Enum to be validated. @param {array} oEnumComparison Enum comparison. @returns {boolean} Boolean response if the provided collection is valid.
[ "Validates", "any", "given", "collection", ".", "Basically", "you", "can", "validate", "Audiences", "Categories", "Severity", "etc", "-", "everything", "that", "meets", "the", "criteria" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.support/src/sap/ui/support/supportRules/util/RuleValidator.js#L64-L82
4,029
SAP/openui5
src/sap.ui.support/src/sap/ui/support/supportRules/util/RuleValidator.js
function(sId) { //Match camelCase - case sensitive var idRegEx = /^[a-z][a-zA-Z]+$/; if ( !sId || typeof sId !== 'string') { return false; } if (sId.match(idRegEx) && this.validateStringLength(sId, 6, 50)) { return true; } return false; }
javascript
function(sId) { //Match camelCase - case sensitive var idRegEx = /^[a-z][a-zA-Z]+$/; if ( !sId || typeof sId !== 'string') { return false; } if (sId.match(idRegEx) && this.validateStringLength(sId, 6, 50)) { return true; } return false; }
[ "function", "(", "sId", ")", "{", "//Match camelCase - case sensitive", "var", "idRegEx", "=", "/", "^[a-z][a-zA-Z]+$", "/", ";", "if", "(", "!", "sId", "||", "typeof", "sId", "!==", "'string'", ")", "{", "return", "false", ";", "}", "if", "(", "sId", ".", "match", "(", "idRegEx", ")", "&&", "this", ".", "validateStringLength", "(", "sId", ",", "6", ",", "50", ")", ")", "{", "return", "true", ";", "}", "return", "false", ";", "}" ]
Validates the id of a rule each id. The Id has to be of type string, and needs to be camelCase. Positive cases : - "validId" @private @param {string} sId Id in string format. @returns {boolean} Boolean response if the provided id is valid.
[ "Validates", "the", "id", "of", "a", "rule", "each", "id", ".", "The", "Id", "has", "to", "be", "of", "type", "string", "and", "needs", "to", "be", "camelCase", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.support/src/sap/ui/support/supportRules/util/RuleValidator.js#L94-L109
4,030
SAP/openui5
src/sap.ui.commons/src/sap/ui/commons/MessageBox.js
cell
function cell(oContent) { return new MatrixLayoutCell({ padding: Padding.None, vAlign: VAlign.Top, content: oContent }); }
javascript
function cell(oContent) { return new MatrixLayoutCell({ padding: Padding.None, vAlign: VAlign.Top, content: oContent }); }
[ "function", "cell", "(", "oContent", ")", "{", "return", "new", "MatrixLayoutCell", "(", "{", "padding", ":", "Padding", ".", "None", ",", "vAlign", ":", "VAlign", ".", "Top", ",", "content", ":", "oContent", "}", ")", ";", "}" ]
wraps the given control in a top aligned MatrixLayoutCell with no padding
[ "wraps", "the", "given", "control", "in", "a", "top", "aligned", "MatrixLayoutCell", "with", "no", "padding" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.commons/src/sap/ui/commons/MessageBox.js#L234-L240
4,031
SAP/openui5
src/sap.ui.commons/src/sap/ui/commons/MessageBox.js
image
function image(oIcon) { var oImage = new Image({ id: sDialogId + "--icon", tooltip: rb && rb.getText("MSGBOX_ICON_" + oIcon), decorative: true }); oImage.addStyleClass("sapUiMboxIcon"); oImage.addStyleClass(mIconClass[oIcon]); return oImage; }
javascript
function image(oIcon) { var oImage = new Image({ id: sDialogId + "--icon", tooltip: rb && rb.getText("MSGBOX_ICON_" + oIcon), decorative: true }); oImage.addStyleClass("sapUiMboxIcon"); oImage.addStyleClass(mIconClass[oIcon]); return oImage; }
[ "function", "image", "(", "oIcon", ")", "{", "var", "oImage", "=", "new", "Image", "(", "{", "id", ":", "sDialogId", "+", "\"--icon\"", ",", "tooltip", ":", "rb", "&&", "rb", ".", "getText", "(", "\"MSGBOX_ICON_\"", "+", "oIcon", ")", ",", "decorative", ":", "true", "}", ")", ";", "oImage", ".", "addStyleClass", "(", "\"sapUiMboxIcon\"", ")", ";", "oImage", ".", "addStyleClass", "(", "mIconClass", "[", "oIcon", "]", ")", ";", "return", "oImage", ";", "}" ]
creates an Image for the given icon type
[ "creates", "an", "Image", "for", "the", "given", "icon", "type" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.commons/src/sap/ui/commons/MessageBox.js#L243-L252
4,032
SAP/openui5
src/sap.m/src/sap/m/library.js
function(sEmail, sSubject, sBody, sCC, sBCC) { var aParams = [], sURL = "mailto:", encode = encodeURIComponent; // Within mailto URLs, the characters "?", "=", "&" are reserved isValidString(sEmail) && (sURL += encode(jQuery.trim(sEmail))); isValidString(sSubject) && aParams.push("subject=" + encode(sSubject)); isValidString(sBody) && aParams.push("body=" + formatMessage(sBody)); isValidString(sBCC) && aParams.push("bcc=" + encode(jQuery.trim(sBCC))); isValidString(sCC) && aParams.push("cc=" + encode(jQuery.trim(sCC))); if (aParams.length) { sURL += "?" + aParams.join("&"); } return sURL; }
javascript
function(sEmail, sSubject, sBody, sCC, sBCC) { var aParams = [], sURL = "mailto:", encode = encodeURIComponent; // Within mailto URLs, the characters "?", "=", "&" are reserved isValidString(sEmail) && (sURL += encode(jQuery.trim(sEmail))); isValidString(sSubject) && aParams.push("subject=" + encode(sSubject)); isValidString(sBody) && aParams.push("body=" + formatMessage(sBody)); isValidString(sBCC) && aParams.push("bcc=" + encode(jQuery.trim(sBCC))); isValidString(sCC) && aParams.push("cc=" + encode(jQuery.trim(sCC))); if (aParams.length) { sURL += "?" + aParams.join("&"); } return sURL; }
[ "function", "(", "sEmail", ",", "sSubject", ",", "sBody", ",", "sCC", ",", "sBCC", ")", "{", "var", "aParams", "=", "[", "]", ",", "sURL", "=", "\"mailto:\"", ",", "encode", "=", "encodeURIComponent", ";", "// Within mailto URLs, the characters \"?\", \"=\", \"&\" are reserved", "isValidString", "(", "sEmail", ")", "&&", "(", "sURL", "+=", "encode", "(", "jQuery", ".", "trim", "(", "sEmail", ")", ")", ")", ";", "isValidString", "(", "sSubject", ")", "&&", "aParams", ".", "push", "(", "\"subject=\"", "+", "encode", "(", "sSubject", ")", ")", ";", "isValidString", "(", "sBody", ")", "&&", "aParams", ".", "push", "(", "\"body=\"", "+", "formatMessage", "(", "sBody", ")", ")", ";", "isValidString", "(", "sBCC", ")", "&&", "aParams", ".", "push", "(", "\"bcc=\"", "+", "encode", "(", "jQuery", ".", "trim", "(", "sBCC", ")", ")", ")", ";", "isValidString", "(", "sCC", ")", "&&", "aParams", ".", "push", "(", "\"cc=\"", "+", "encode", "(", "jQuery", ".", "trim", "(", "sCC", ")", ")", ")", ";", "if", "(", "aParams", ".", "length", ")", "{", "sURL", "+=", "\"?\"", "+", "aParams", ".", "join", "(", "\"&\"", ")", ";", "}", "return", "sURL", ";", "}" ]
Builds Email URI from given parameter. Trims spaces from email addresses. @param {string} [sEmail] Destination email address @param {string} [sSubject] Subject of the email address @param {string} [sBody] Default message text @param {string} [sCC] Carbon Copy email address @param {string} [sBCC] Blind carbon copy email address @returns {string} Email URI using the <code>mailto:</code> scheme @public
[ "Builds", "Email", "URI", "from", "given", "parameter", ".", "Trims", "spaces", "from", "email", "addresses", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.m/src/sap/m/library.js#L4050-L4066
4,033
SAP/openui5
src/sap.m/src/sap/m/library.js
function (sURL, bNewWindow) { assert(isValidString(sURL), this + "#redirect: URL must be a string" ); this.fireEvent("redirect", sURL); if (!bNewWindow) { window.location.href = sURL; } else { var oWindow = window.open(sURL, "_blank"); if (!oWindow) { Log.error(this + "#redirect: Could not open " + sURL); if (Device.os.windows_phone || (Device.browser.edge && Device.browser.mobile)) { Log.warning("URL will be enforced to open in the same window as a fallback from a known Windows Phone system restriction. Check the documentation for more information."); window.location.href = sURL; } } } }
javascript
function (sURL, bNewWindow) { assert(isValidString(sURL), this + "#redirect: URL must be a string" ); this.fireEvent("redirect", sURL); if (!bNewWindow) { window.location.href = sURL; } else { var oWindow = window.open(sURL, "_blank"); if (!oWindow) { Log.error(this + "#redirect: Could not open " + sURL); if (Device.os.windows_phone || (Device.browser.edge && Device.browser.mobile)) { Log.warning("URL will be enforced to open in the same window as a fallback from a known Windows Phone system restriction. Check the documentation for more information."); window.location.href = sURL; } } } }
[ "function", "(", "sURL", ",", "bNewWindow", ")", "{", "assert", "(", "isValidString", "(", "sURL", ")", ",", "this", "+", "\"#redirect: URL must be a string\"", ")", ";", "this", ".", "fireEvent", "(", "\"redirect\"", ",", "sURL", ")", ";", "if", "(", "!", "bNewWindow", ")", "{", "window", ".", "location", ".", "href", "=", "sURL", ";", "}", "else", "{", "var", "oWindow", "=", "window", ".", "open", "(", "sURL", ",", "\"_blank\"", ")", ";", "if", "(", "!", "oWindow", ")", "{", "Log", ".", "error", "(", "this", "+", "\"#redirect: Could not open \"", "+", "sURL", ")", ";", "if", "(", "Device", ".", "os", ".", "windows_phone", "||", "(", "Device", ".", "browser", ".", "edge", "&&", "Device", ".", "browser", ".", "mobile", ")", ")", "{", "Log", ".", "warning", "(", "\"URL will be enforced to open in the same window as a fallback from a known Windows Phone system restriction. Check the documentation for more information.\"", ")", ";", "window", ".", "location", ".", "href", "=", "sURL", ";", "}", "}", "}", "}" ]
Redirects to the given URL. This method fires "redirect" event before opening the URL. @param {string} sURL Uniform resource locator @param {boolean} [bNewWindow] Opens URL in a new browser window or tab. Please note that, opening a new window/tab can be ignored by browsers (e.g. on Windows Phone) or by popup blockers. NOTE: On Windows Phone the URL will be enforced to open in the same window if opening in a new window/tab fails (because of a known system restriction on cross-window communications). Use sap.m.Link instead (with blank target) if you necessarily need to open URL in a new window. @public
[ "Redirects", "to", "the", "given", "URL", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.m/src/sap/m/library.js#L4079-L4094
4,034
SAP/openui5
src/sap.m/src/sap/m/library.js
checkAndSetProperty
function checkAndSetProperty(oControl, property, value) { if (value !== undefined) { var fSetter = oControl['set' + capitalize(property)]; if (typeof (fSetter) === "function") { fSetter.call(oControl, value); return true; } } return false; }
javascript
function checkAndSetProperty(oControl, property, value) { if (value !== undefined) { var fSetter = oControl['set' + capitalize(property)]; if (typeof (fSetter) === "function") { fSetter.call(oControl, value); return true; } } return false; }
[ "function", "checkAndSetProperty", "(", "oControl", ",", "property", ",", "value", ")", "{", "if", "(", "value", "!==", "undefined", ")", "{", "var", "fSetter", "=", "oControl", "[", "'set'", "+", "capitalize", "(", "property", ")", "]", ";", "if", "(", "typeof", "(", "fSetter", ")", "===", "\"function\"", ")", "{", "fSetter", ".", "call", "(", "oControl", ",", "value", ")", ";", "return", "true", ";", "}", "}", "return", "false", ";", "}" ]
Checks if value is not undefined, in which case the setter function for a given property is called. Returns true if value is set, false otherwise. @private
[ "Checks", "if", "value", "is", "not", "undefined", "in", "which", "case", "the", "setter", "function", "for", "a", "given", "property", "is", "called", ".", "Returns", "true", "if", "value", "is", "set", "false", "otherwise", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.m/src/sap/m/library.js#L4289-L4298
4,035
SAP/openui5
src/sap.m/src/sap/m/library.js
function(sPercentage, fBaseSize){ if (typeof sPercentage !== "string") { Log.warning("sap.m.PopupHelper: calcPercentageSize, the first parameter" + sPercentage + "isn't with type string"); return null; } if (sPercentage.indexOf("%") <= 0) { Log.warning("sap.m.PopupHelper: calcPercentageSize, the first parameter" + sPercentage + "is not a percentage string (for example '25%')"); return null; } var fPercent = parseFloat(sPercentage) / 100, fParsedBaseSize = parseFloat(fBaseSize); return Math.floor(fPercent * fParsedBaseSize) + "px"; }
javascript
function(sPercentage, fBaseSize){ if (typeof sPercentage !== "string") { Log.warning("sap.m.PopupHelper: calcPercentageSize, the first parameter" + sPercentage + "isn't with type string"); return null; } if (sPercentage.indexOf("%") <= 0) { Log.warning("sap.m.PopupHelper: calcPercentageSize, the first parameter" + sPercentage + "is not a percentage string (for example '25%')"); return null; } var fPercent = parseFloat(sPercentage) / 100, fParsedBaseSize = parseFloat(fBaseSize); return Math.floor(fPercent * fParsedBaseSize) + "px"; }
[ "function", "(", "sPercentage", ",", "fBaseSize", ")", "{", "if", "(", "typeof", "sPercentage", "!==", "\"string\"", ")", "{", "Log", ".", "warning", "(", "\"sap.m.PopupHelper: calcPercentageSize, the first parameter\"", "+", "sPercentage", "+", "\"isn't with type string\"", ")", ";", "return", "null", ";", "}", "if", "(", "sPercentage", ".", "indexOf", "(", "\"%\"", ")", "<=", "0", ")", "{", "Log", ".", "warning", "(", "\"sap.m.PopupHelper: calcPercentageSize, the first parameter\"", "+", "sPercentage", "+", "\"is not a percentage string (for example '25%')\"", ")", ";", "return", "null", ";", "}", "var", "fPercent", "=", "parseFloat", "(", "sPercentage", ")", "/", "100", ",", "fParsedBaseSize", "=", "parseFloat", "(", "fBaseSize", ")", ";", "return", "Math", ".", "floor", "(", "fPercent", "*", "fParsedBaseSize", ")", "+", "\"px\"", ";", "}" ]
Converts the given percentage value to an absolute number based on the given base size. @param {string} sPercentage A percentage value in string format, for example "25%" @param {float} fBaseSize A float number which the calculation is based on. @returns {int} The calculated size string with "px" as unit or null when the format of given parameter is wrong. @protected
[ "Converts", "the", "given", "percentage", "value", "to", "an", "absolute", "number", "based", "on", "the", "given", "base", "size", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.m/src/sap/m/library.js#L4377-L4392
4,036
SAP/openui5
src/sap.f/src/sap/f/GridContainer.js
isGridSupportedByBrowser
function isGridSupportedByBrowser() { return !Device.browser.msie && !(Device.browser.edge && Device.browser.version < EDGE_VERSION_WITH_GRID_SUPPORT); }
javascript
function isGridSupportedByBrowser() { return !Device.browser.msie && !(Device.browser.edge && Device.browser.version < EDGE_VERSION_WITH_GRID_SUPPORT); }
[ "function", "isGridSupportedByBrowser", "(", ")", "{", "return", "!", "Device", ".", "browser", ".", "msie", "&&", "!", "(", "Device", ".", "browser", ".", "edge", "&&", "Device", ".", "browser", ".", "version", "<", "EDGE_VERSION_WITH_GRID_SUPPORT", ")", ";", "}" ]
Indicates whether the grid is supported by the browser. @private @returns {boolean} If native grid is supported by the browser
[ "Indicates", "whether", "the", "grid", "is", "supported", "by", "the", "browser", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.f/src/sap/f/GridContainer.js#L35-L37
4,037
SAP/openui5
src/sap.ui.documentation/src/sap/ui/documentation/sdk/controller/ApiDetail.controller.js
function (oEvent) { if (this._oView) { this._oView.destroy(); // If we had a view that means this is a navigation so we need to init the busy state this._oContainerPage.setBusy(true); } var oComponent = this.getOwnerComponent(); this._sTopicid = decodeURIComponent(oEvent.getParameter("arguments").id); this._sEntityType = oEvent.getParameter("arguments").entityType; this._sEntityId = decodeURIComponent(oEvent.getParameter("arguments").entityId); // API Reference lifecycle oComponent.loadVersionInfo() .then(function () { // Cache allowed members this._aAllowedMembers = this.getModel("versionData").getProperty("/allowedMembers"); }.bind(this)) .then(APIInfo.getIndexJsonPromise) .then(this._processApiIndexAndLoadApiJson.bind(this)) .then(this._findEntityInApiJsonData.bind(this)) .then(this._buildBorrowedModel.bind(this)) .then(this._createModelAndSubView.bind(this)) .then(this._initSubView.bind(this)) .catch(function (vReason) { // If the symbol does not exist in the available libs we redirect to the not found page if (vReason === this.NOT_FOUND) { this._oContainerPage.setBusy(false); this.getRouter().myNavToWithoutHash("sap.ui.documentation.sdk.view.NotFound", "XML", false); } else if (typeof vReason === "string") { Log.error(vReason); } else if (vReason.name) { Log.error(vReason.name, vReason.message); } else if (vReason.message) { Log.error(vReason.message); } }.bind(this)); }
javascript
function (oEvent) { if (this._oView) { this._oView.destroy(); // If we had a view that means this is a navigation so we need to init the busy state this._oContainerPage.setBusy(true); } var oComponent = this.getOwnerComponent(); this._sTopicid = decodeURIComponent(oEvent.getParameter("arguments").id); this._sEntityType = oEvent.getParameter("arguments").entityType; this._sEntityId = decodeURIComponent(oEvent.getParameter("arguments").entityId); // API Reference lifecycle oComponent.loadVersionInfo() .then(function () { // Cache allowed members this._aAllowedMembers = this.getModel("versionData").getProperty("/allowedMembers"); }.bind(this)) .then(APIInfo.getIndexJsonPromise) .then(this._processApiIndexAndLoadApiJson.bind(this)) .then(this._findEntityInApiJsonData.bind(this)) .then(this._buildBorrowedModel.bind(this)) .then(this._createModelAndSubView.bind(this)) .then(this._initSubView.bind(this)) .catch(function (vReason) { // If the symbol does not exist in the available libs we redirect to the not found page if (vReason === this.NOT_FOUND) { this._oContainerPage.setBusy(false); this.getRouter().myNavToWithoutHash("sap.ui.documentation.sdk.view.NotFound", "XML", false); } else if (typeof vReason === "string") { Log.error(vReason); } else if (vReason.name) { Log.error(vReason.name, vReason.message); } else if (vReason.message) { Log.error(vReason.message); } }.bind(this)); }
[ "function", "(", "oEvent", ")", "{", "if", "(", "this", ".", "_oView", ")", "{", "this", ".", "_oView", ".", "destroy", "(", ")", ";", "// If we had a view that means this is a navigation so we need to init the busy state", "this", ".", "_oContainerPage", ".", "setBusy", "(", "true", ")", ";", "}", "var", "oComponent", "=", "this", ".", "getOwnerComponent", "(", ")", ";", "this", ".", "_sTopicid", "=", "decodeURIComponent", "(", "oEvent", ".", "getParameter", "(", "\"arguments\"", ")", ".", "id", ")", ";", "this", ".", "_sEntityType", "=", "oEvent", ".", "getParameter", "(", "\"arguments\"", ")", ".", "entityType", ";", "this", ".", "_sEntityId", "=", "decodeURIComponent", "(", "oEvent", ".", "getParameter", "(", "\"arguments\"", ")", ".", "entityId", ")", ";", "// API Reference lifecycle", "oComponent", ".", "loadVersionInfo", "(", ")", ".", "then", "(", "function", "(", ")", "{", "// Cache allowed members", "this", ".", "_aAllowedMembers", "=", "this", ".", "getModel", "(", "\"versionData\"", ")", ".", "getProperty", "(", "\"/allowedMembers\"", ")", ";", "}", ".", "bind", "(", "this", ")", ")", ".", "then", "(", "APIInfo", ".", "getIndexJsonPromise", ")", ".", "then", "(", "this", ".", "_processApiIndexAndLoadApiJson", ".", "bind", "(", "this", ")", ")", ".", "then", "(", "this", ".", "_findEntityInApiJsonData", ".", "bind", "(", "this", ")", ")", ".", "then", "(", "this", ".", "_buildBorrowedModel", ".", "bind", "(", "this", ")", ")", ".", "then", "(", "this", ".", "_createModelAndSubView", ".", "bind", "(", "this", ")", ")", ".", "then", "(", "this", ".", "_initSubView", ".", "bind", "(", "this", ")", ")", ".", "catch", "(", "function", "(", "vReason", ")", "{", "// If the symbol does not exist in the available libs we redirect to the not found page", "if", "(", "vReason", "===", "this", ".", "NOT_FOUND", ")", "{", "this", ".", "_oContainerPage", ".", "setBusy", "(", "false", ")", ";", "this", ".", "getRouter", "(", ")", ".", "myNavToWithoutHash", "(", "\"sap.ui.documentation.sdk.view.NotFound\"", ",", "\"XML\"", ",", "false", ")", ";", "}", "else", "if", "(", "typeof", "vReason", "===", "\"string\"", ")", "{", "Log", ".", "error", "(", "vReason", ")", ";", "}", "else", "if", "(", "vReason", ".", "name", ")", "{", "Log", ".", "error", "(", "vReason", ".", "name", ",", "vReason", ".", "message", ")", ";", "}", "else", "if", "(", "vReason", ".", "message", ")", "{", "Log", ".", "error", "(", "vReason", ".", "message", ")", ";", "}", "}", ".", "bind", "(", "this", ")", ")", ";", "}" ]
Binds the view to the object path and expands the aggregated line items. @function @param {sap.ui.base.Event} oEvent pattern match event in route 'api' @private
[ "Binds", "the", "view", "to", "the", "object", "path", "and", "expands", "the", "aggregated", "line", "items", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.documentation/src/sap/ui/documentation/sdk/controller/ApiDetail.controller.js#L55-L93
4,038
SAP/openui5
src/sap.ui.documentation/src/sap/ui/documentation/sdk/controller/ApiDetail.controller.js
function (oView) { var oController = oView.getController(); // Add the sub view to the current one this._oContainerPage.addContent(oView); this._oContainerPage.setBusy(false); // Init the sub view and controller with the needed references.The view's are nested and work in a // mimic way so they need to share some references. oController.initiate({ sTopicId: this._sTopicid, oModel: this._oModel, aApiIndex: this._aApiIndex, aAllowedMembers: this._aAllowedMembers, oEntityData: this._oEntityData, sEntityType: this._sEntityType, sEntityId: this._sEntityId, oOwnerComponent: this.getOwnerComponent(), oContainerView: this.getView(), oContainerController: this }); }
javascript
function (oView) { var oController = oView.getController(); // Add the sub view to the current one this._oContainerPage.addContent(oView); this._oContainerPage.setBusy(false); // Init the sub view and controller with the needed references.The view's are nested and work in a // mimic way so they need to share some references. oController.initiate({ sTopicId: this._sTopicid, oModel: this._oModel, aApiIndex: this._aApiIndex, aAllowedMembers: this._aAllowedMembers, oEntityData: this._oEntityData, sEntityType: this._sEntityType, sEntityId: this._sEntityId, oOwnerComponent: this.getOwnerComponent(), oContainerView: this.getView(), oContainerController: this }); }
[ "function", "(", "oView", ")", "{", "var", "oController", "=", "oView", ".", "getController", "(", ")", ";", "// Add the sub view to the current one", "this", ".", "_oContainerPage", ".", "addContent", "(", "oView", ")", ";", "this", ".", "_oContainerPage", ".", "setBusy", "(", "false", ")", ";", "// Init the sub view and controller with the needed references.The view's are nested and work in a", "// mimic way so they need to share some references.", "oController", ".", "initiate", "(", "{", "sTopicId", ":", "this", ".", "_sTopicid", ",", "oModel", ":", "this", ".", "_oModel", ",", "aApiIndex", ":", "this", ".", "_aApiIndex", ",", "aAllowedMembers", ":", "this", ".", "_aAllowedMembers", ",", "oEntityData", ":", "this", ".", "_oEntityData", ",", "sEntityType", ":", "this", ".", "_sEntityType", ",", "sEntityId", ":", "this", ".", "_sEntityId", ",", "oOwnerComponent", ":", "this", ".", "getOwnerComponent", "(", ")", ",", "oContainerView", ":", "this", ".", "getView", "(", ")", ",", "oContainerController", ":", "this", "}", ")", ";", "}" ]
Init the Sub View and controller @param {sap.ui.view} oView the pre-processed sub view @private
[ "Init", "the", "Sub", "View", "and", "controller" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.documentation/src/sap/ui/documentation/sdk/controller/ApiDetail.controller.js#L100-L121
4,039
SAP/openui5
src/sap.ui.documentation/src/sap/ui/documentation/sdk/controller/ApiDetail.controller.js
function (oBorrowedData) { // Attach resolved borrowed data this._oControlData.borrowed = oBorrowedData; // Pre-process data and create model this._bindData(this._sTopicid); // Create the sub-view and controller this._oView = sap.ui.view({ height: "100%", viewName: "sap.ui.documentation.sdk.view.SubApiDetail", type: ViewType.XML, async: true, preprocessors: { xml: { models: { data: this._oModel } } } }); // Return view loaded promise return this._oView.loaded(); }
javascript
function (oBorrowedData) { // Attach resolved borrowed data this._oControlData.borrowed = oBorrowedData; // Pre-process data and create model this._bindData(this._sTopicid); // Create the sub-view and controller this._oView = sap.ui.view({ height: "100%", viewName: "sap.ui.documentation.sdk.view.SubApiDetail", type: ViewType.XML, async: true, preprocessors: { xml: { models: { data: this._oModel } } } }); // Return view loaded promise return this._oView.loaded(); }
[ "function", "(", "oBorrowedData", ")", "{", "// Attach resolved borrowed data", "this", ".", "_oControlData", ".", "borrowed", "=", "oBorrowedData", ";", "// Pre-process data and create model", "this", ".", "_bindData", "(", "this", ".", "_sTopicid", ")", ";", "// Create the sub-view and controller", "this", ".", "_oView", "=", "sap", ".", "ui", ".", "view", "(", "{", "height", ":", "\"100%\"", ",", "viewName", ":", "\"sap.ui.documentation.sdk.view.SubApiDetail\"", ",", "type", ":", "ViewType", ".", "XML", ",", "async", ":", "true", ",", "preprocessors", ":", "{", "xml", ":", "{", "models", ":", "{", "data", ":", "this", ".", "_oModel", "}", "}", "}", "}", ")", ";", "// Return view loaded promise", "return", "this", ".", "_oView", ".", "loaded", "(", ")", ";", "}" ]
Create the JSON model and the Sub View. The model will be used in both lifecycle phases of the sub view by the preprocessor and by the view initiation afterwards. @param {object} oBorrowedData the data extracted by the borrowed methods promise @return {Promise} sap.ui.view.loaded promise @private
[ "Create", "the", "JSON", "model", "and", "the", "Sub", "View", ".", "The", "model", "will", "be", "used", "in", "both", "lifecycle", "phases", "of", "the", "sub", "view", "by", "the", "preprocessor", "and", "by", "the", "view", "initiation", "afterwards", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.documentation/src/sap/ui/documentation/sdk/controller/ApiDetail.controller.js#L130-L154
4,040
SAP/openui5
src/sap.ui.documentation/src/sap/ui/documentation/sdk/controller/ApiDetail.controller.js
function (aLibsData) { var oLibItem, iLen, i; // Find entity in loaded libs data for (i = 0, iLen = aLibsData.length; i < iLen; i++) { oLibItem = aLibsData[i]; if (oLibItem.name === this._sTopicid) { // Check if we are allowed to display the requested symbol // BCP: 1870269087 item may not have visibility info at all. In this case we show the item if (oLibItem.visibility === undefined || this._aAllowedMembers.indexOf(oLibItem.visibility) >= 0) { return oLibItem; } else { // We found the requested symbol but we are not allowed to show it. return Promise.reject(this.NOT_FOUND); } } } // If we are here - the object does not exist so we reject the promise. return Promise.reject(this.NOT_FOUND); }
javascript
function (aLibsData) { var oLibItem, iLen, i; // Find entity in loaded libs data for (i = 0, iLen = aLibsData.length; i < iLen; i++) { oLibItem = aLibsData[i]; if (oLibItem.name === this._sTopicid) { // Check if we are allowed to display the requested symbol // BCP: 1870269087 item may not have visibility info at all. In this case we show the item if (oLibItem.visibility === undefined || this._aAllowedMembers.indexOf(oLibItem.visibility) >= 0) { return oLibItem; } else { // We found the requested symbol but we are not allowed to show it. return Promise.reject(this.NOT_FOUND); } } } // If we are here - the object does not exist so we reject the promise. return Promise.reject(this.NOT_FOUND); }
[ "function", "(", "aLibsData", ")", "{", "var", "oLibItem", ",", "iLen", ",", "i", ";", "// Find entity in loaded libs data", "for", "(", "i", "=", "0", ",", "iLen", "=", "aLibsData", ".", "length", ";", "i", "<", "iLen", ";", "i", "++", ")", "{", "oLibItem", "=", "aLibsData", "[", "i", "]", ";", "if", "(", "oLibItem", ".", "name", "===", "this", ".", "_sTopicid", ")", "{", "// Check if we are allowed to display the requested symbol", "// BCP: 1870269087 item may not have visibility info at all. In this case we show the item", "if", "(", "oLibItem", ".", "visibility", "===", "undefined", "||", "this", ".", "_aAllowedMembers", ".", "indexOf", "(", "oLibItem", ".", "visibility", ")", ">=", "0", ")", "{", "return", "oLibItem", ";", "}", "else", "{", "// We found the requested symbol but we are not allowed to show it.", "return", "Promise", ".", "reject", "(", "this", ".", "NOT_FOUND", ")", ";", "}", "}", "}", "// If we are here - the object does not exist so we reject the promise.", "return", "Promise", ".", "reject", "(", "this", ".", "NOT_FOUND", ")", ";", "}" ]
Extract current symbol data from api.json file for the current library @param {array} aLibsData data from api.json file for the current library @returns {object} current symbol data @private
[ "Extract", "current", "symbol", "data", "from", "api", ".", "json", "file", "for", "the", "current", "library" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.documentation/src/sap/ui/documentation/sdk/controller/ApiDetail.controller.js#L176-L198
4,041
SAP/openui5
src/sap.ui.documentation/src/sap/ui/documentation/sdk/controller/ApiDetail.controller.js
function (aData) { var oEntityData, oMasterController, sTopicId = this._sTopicid; // Cache api-index data this._aApiIndex = aData; // Find symbol function findSymbol (a) { return a.some(function (o) { var bFound = o.name === sTopicId; if (!bFound && o.nodes) { return findSymbol(o.nodes); } else if (bFound) { oEntityData = o; return true; } return false; }); } findSymbol(aData); if (oEntityData) { // Cache entity data this._oEntityData = oEntityData; // If target symbol is deprecated - all deprecated records should be shown in the tree if (oEntityData.deprecated) { oMasterController = this.getOwnerComponent().getConfigUtil().getMasterView("apiId").getController(); oMasterController.selectDeprecatedSymbol(this._sTopicid); } // Load API.json only for selected lib return APIInfo.getLibraryElementsJSONPromise(oEntityData.lib).then(function (aData) { return Promise.resolve(aData); // We have found the symbol and loaded the corresponding api.json }); } // If we are here - the object does not exist so we reject the promise. return Promise.reject(this.NOT_FOUND); }
javascript
function (aData) { var oEntityData, oMasterController, sTopicId = this._sTopicid; // Cache api-index data this._aApiIndex = aData; // Find symbol function findSymbol (a) { return a.some(function (o) { var bFound = o.name === sTopicId; if (!bFound && o.nodes) { return findSymbol(o.nodes); } else if (bFound) { oEntityData = o; return true; } return false; }); } findSymbol(aData); if (oEntityData) { // Cache entity data this._oEntityData = oEntityData; // If target symbol is deprecated - all deprecated records should be shown in the tree if (oEntityData.deprecated) { oMasterController = this.getOwnerComponent().getConfigUtil().getMasterView("apiId").getController(); oMasterController.selectDeprecatedSymbol(this._sTopicid); } // Load API.json only for selected lib return APIInfo.getLibraryElementsJSONPromise(oEntityData.lib).then(function (aData) { return Promise.resolve(aData); // We have found the symbol and loaded the corresponding api.json }); } // If we are here - the object does not exist so we reject the promise. return Promise.reject(this.NOT_FOUND); }
[ "function", "(", "aData", ")", "{", "var", "oEntityData", ",", "oMasterController", ",", "sTopicId", "=", "this", ".", "_sTopicid", ";", "// Cache api-index data", "this", ".", "_aApiIndex", "=", "aData", ";", "// Find symbol", "function", "findSymbol", "(", "a", ")", "{", "return", "a", ".", "some", "(", "function", "(", "o", ")", "{", "var", "bFound", "=", "o", ".", "name", "===", "sTopicId", ";", "if", "(", "!", "bFound", "&&", "o", ".", "nodes", ")", "{", "return", "findSymbol", "(", "o", ".", "nodes", ")", ";", "}", "else", "if", "(", "bFound", ")", "{", "oEntityData", "=", "o", ";", "return", "true", ";", "}", "return", "false", ";", "}", ")", ";", "}", "findSymbol", "(", "aData", ")", ";", "if", "(", "oEntityData", ")", "{", "// Cache entity data", "this", ".", "_oEntityData", "=", "oEntityData", ";", "// If target symbol is deprecated - all deprecated records should be shown in the tree", "if", "(", "oEntityData", ".", "deprecated", ")", "{", "oMasterController", "=", "this", ".", "getOwnerComponent", "(", ")", ".", "getConfigUtil", "(", ")", ".", "getMasterView", "(", "\"apiId\"", ")", ".", "getController", "(", ")", ";", "oMasterController", ".", "selectDeprecatedSymbol", "(", "this", ".", "_sTopicid", ")", ";", "}", "// Load API.json only for selected lib", "return", "APIInfo", ".", "getLibraryElementsJSONPromise", "(", "oEntityData", ".", "lib", ")", ".", "then", "(", "function", "(", "aData", ")", "{", "return", "Promise", ".", "resolve", "(", "aData", ")", ";", "// We have found the symbol and loaded the corresponding api.json", "}", ")", ";", "}", "// If we are here - the object does not exist so we reject the promise.", "return", "Promise", ".", "reject", "(", "this", ".", "NOT_FOUND", ")", ";", "}" ]
Process data from api-index file and if symbol is found load the corresponding api.json file for the symbol library. If the symbol is not resolved this method returns a rejected promise which triggers navigation to not found page. @param {array} aData data from api-index file @return {Promise} resolved or rejected promise @private
[ "Process", "data", "from", "api", "-", "index", "file", "and", "if", "symbol", "is", "found", "load", "the", "corresponding", "api", ".", "json", "file", "for", "the", "symbol", "library", ".", "If", "the", "symbol", "is", "not", "resolved", "this", "method", "returns", "a", "rejected", "promise", "which", "triggers", "navigation", "to", "not", "found", "page", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.documentation/src/sap/ui/documentation/sdk/controller/ApiDetail.controller.js#L208-L249
4,042
SAP/openui5
src/sap.ui.documentation/src/sap/ui/documentation/sdk/controller/ApiDetail.controller.js
function (aElements, fnFilter, fnFormat) { var i, iLength = aElements.length, aNewElements = [], oElement; for (i = 0; i < iLength; i++) { oElement = aElements[i]; if (fnFilter && !fnFilter(oElement)) { continue; } if (fnFormat) { fnFormat(oElement); } aNewElements.push(oElement); } return aNewElements; }
javascript
function (aElements, fnFilter, fnFormat) { var i, iLength = aElements.length, aNewElements = [], oElement; for (i = 0; i < iLength; i++) { oElement = aElements[i]; if (fnFilter && !fnFilter(oElement)) { continue; } if (fnFormat) { fnFormat(oElement); } aNewElements.push(oElement); } return aNewElements; }
[ "function", "(", "aElements", ",", "fnFilter", ",", "fnFormat", ")", "{", "var", "i", ",", "iLength", "=", "aElements", ".", "length", ",", "aNewElements", "=", "[", "]", ",", "oElement", ";", "for", "(", "i", "=", "0", ";", "i", "<", "iLength", ";", "i", "++", ")", "{", "oElement", "=", "aElements", "[", "i", "]", ";", "if", "(", "fnFilter", "&&", "!", "fnFilter", "(", "oElement", ")", ")", "{", "continue", ";", "}", "if", "(", "fnFormat", ")", "{", "fnFormat", "(", "oElement", ")", ";", "}", "aNewElements", ".", "push", "(", "oElement", ")", ";", "}", "return", "aNewElements", ";", "}" ]
Filter and format elements @param {array} aElements list of elements @param {function} fnFilter filtering function @param {function} fnFormat formatting function @returns {array} transformed elements list
[ "Filter", "and", "format", "elements" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.documentation/src/sap/ui/documentation/sdk/controller/ApiDetail.controller.js#L603-L621
4,043
SAP/openui5
src/sap.ui.documentation/src/sap/ui/documentation/sdk/util/LiveEditorOutput.js
preloadModules
function preloadModules (oData) { // prealod the modules from the live-edited src sap.ui.require.preload(oData.src); // require the init module sap.ui.require([oData.moduleNameToRequire]); }
javascript
function preloadModules (oData) { // prealod the modules from the live-edited src sap.ui.require.preload(oData.src); // require the init module sap.ui.require([oData.moduleNameToRequire]); }
[ "function", "preloadModules", "(", "oData", ")", "{", "// prealod the modules from the live-edited src", "sap", ".", "ui", ".", "require", ".", "preload", "(", "oData", ".", "src", ")", ";", "// require the init module", "sap", ".", "ui", ".", "require", "(", "[", "oData", ".", "moduleNameToRequire", "]", ")", ";", "}" ]
Preload the modules of the live-edited sample so that the framework obtains the module content from the editor-supplied src, insted of making a network request to obtain them @param oData the editor-supplied src
[ "Preload", "the", "modules", "of", "the", "live", "-", "edited", "sample", "so", "that", "the", "framework", "obtains", "the", "module", "content", "from", "the", "editor", "-", "supplied", "src", "insted", "of", "making", "a", "network", "request", "to", "obtain", "them" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.documentation/src/sap/ui/documentation/sdk/util/LiveEditorOutput.js#L38-L45
4,044
SAP/openui5
src/sap.ui.documentation/src/sap/ui/documentation/sdk/util/LiveEditorOutput.js
addOnErrorHook
function addOnErrorHook () { window.addEventListener("error", function(error) { error.preventDefault(); var oErrorOutput = document.createElement("span"); oErrorOutput.innerText = error.message; // use save API oErrorOutput.style.cssText = "position:absolute; top:1rem; left:1rem"; if (!document.body) { document.write("<span></span>"); // add content via document.write to ensure document.body is created; } document.body.appendChild(oErrorOutput); }); }
javascript
function addOnErrorHook () { window.addEventListener("error", function(error) { error.preventDefault(); var oErrorOutput = document.createElement("span"); oErrorOutput.innerText = error.message; // use save API oErrorOutput.style.cssText = "position:absolute; top:1rem; left:1rem"; if (!document.body) { document.write("<span></span>"); // add content via document.write to ensure document.body is created; } document.body.appendChild(oErrorOutput); }); }
[ "function", "addOnErrorHook", "(", ")", "{", "window", ".", "addEventListener", "(", "\"error\"", ",", "function", "(", "error", ")", "{", "error", ".", "preventDefault", "(", ")", ";", "var", "oErrorOutput", "=", "document", ".", "createElement", "(", "\"span\"", ")", ";", "oErrorOutput", ".", "innerText", "=", "error", ".", "message", ";", "// use save API", "oErrorOutput", ".", "style", ".", "cssText", "=", "\"position:absolute; top:1rem; left:1rem\"", ";", "if", "(", "!", "document", ".", "body", ")", "{", "document", ".", "write", "(", "\"<span></span>\"", ")", ";", "// add content via document.write to ensure document.body is created;", "}", "document", ".", "body", ".", "appendChild", "(", "oErrorOutput", ")", ";", "}", ")", ";", "}" ]
Listen for errors and display them in the DOM, so that the user does not need to open the console
[ "Listen", "for", "errors", "and", "display", "them", "in", "the", "DOM", "so", "that", "the", "user", "does", "not", "need", "to", "open", "the", "console" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.documentation/src/sap/ui/documentation/sdk/util/LiveEditorOutput.js#L51-L63
4,045
SAP/openui5
src/sap.ui.core/src/sap/base/util/Version.js
Version
function Version(vMajor, iMinor, iPatch, sSuffix) { if ( vMajor instanceof Version ) { // note: even a constructor may return a value different from 'this' return vMajor; } if ( !(this instanceof Version) ) { // act as a cast operator when called as function (not as a constructor) return new Version(vMajor, iMinor, iPatch, sSuffix); } var m; if (typeof vMajor === "string") { m = rVersion.exec(vMajor); } else if (Array.isArray(vMajor)) { m = vMajor; } else { m = arguments; } m = m || []; function norm(v) { v = parseInt(v); return isNaN(v) ? 0 : v; } vMajor = norm(m[0]); iMinor = norm(m[1]); iPatch = norm(m[2]); sSuffix = String(m[3] || ""); /** * Returns a string representation of this version. * * @return {string} a string representation of this version. * @public */ this.toString = function() { return vMajor + "." + iMinor + "." + iPatch + sSuffix; }; /** * Returns the major version part of this version. * * @return {int} the major version part of this version * @public */ this.getMajor = function() { return vMajor; }; /** * Returns the minor version part of this version. * * @return {int} the minor version part of this version * @public */ this.getMinor = function() { return iMinor; }; /** * Returns the patch (or micro) version part of this version. * * @return {int} the patch version part of this version * @public */ this.getPatch = function() { return iPatch; }; /** * Returns the version suffix of this version. * * @return {string} the version suffix of this version * @public */ this.getSuffix = function() { return sSuffix; }; /** * Compares this version with a given one. * * The version with which this version should be compared can be given as a <code>sap/base/util/Version</code> instance, * as a string (e.g. <code>v.compareto("1.4.5")</code>). Or major, minor, patch and suffix values can be given as * separate parameters (e.g. <code>v.compareTo(1, 4, 5)</code>) or in an array (e.g. <code>v.compareTo([1, 4, 5])</code>). * * @return {int} 0, if the given version is equal to this version, a negative value if the given other version is greater * and a positive value otherwise * @public */ this.compareTo = function() { var vOther = Version.apply(window, arguments); /*eslint-disable no-nested-ternary */ return vMajor - vOther.getMajor() || iMinor - vOther.getMinor() || iPatch - vOther.getPatch() || ((sSuffix < vOther.getSuffix()) ? -1 : (sSuffix === vOther.getSuffix()) ? 0 : 1); /*eslint-enable no-nested-ternary */ }; }
javascript
function Version(vMajor, iMinor, iPatch, sSuffix) { if ( vMajor instanceof Version ) { // note: even a constructor may return a value different from 'this' return vMajor; } if ( !(this instanceof Version) ) { // act as a cast operator when called as function (not as a constructor) return new Version(vMajor, iMinor, iPatch, sSuffix); } var m; if (typeof vMajor === "string") { m = rVersion.exec(vMajor); } else if (Array.isArray(vMajor)) { m = vMajor; } else { m = arguments; } m = m || []; function norm(v) { v = parseInt(v); return isNaN(v) ? 0 : v; } vMajor = norm(m[0]); iMinor = norm(m[1]); iPatch = norm(m[2]); sSuffix = String(m[3] || ""); /** * Returns a string representation of this version. * * @return {string} a string representation of this version. * @public */ this.toString = function() { return vMajor + "." + iMinor + "." + iPatch + sSuffix; }; /** * Returns the major version part of this version. * * @return {int} the major version part of this version * @public */ this.getMajor = function() { return vMajor; }; /** * Returns the minor version part of this version. * * @return {int} the minor version part of this version * @public */ this.getMinor = function() { return iMinor; }; /** * Returns the patch (or micro) version part of this version. * * @return {int} the patch version part of this version * @public */ this.getPatch = function() { return iPatch; }; /** * Returns the version suffix of this version. * * @return {string} the version suffix of this version * @public */ this.getSuffix = function() { return sSuffix; }; /** * Compares this version with a given one. * * The version with which this version should be compared can be given as a <code>sap/base/util/Version</code> instance, * as a string (e.g. <code>v.compareto("1.4.5")</code>). Or major, minor, patch and suffix values can be given as * separate parameters (e.g. <code>v.compareTo(1, 4, 5)</code>) or in an array (e.g. <code>v.compareTo([1, 4, 5])</code>). * * @return {int} 0, if the given version is equal to this version, a negative value if the given other version is greater * and a positive value otherwise * @public */ this.compareTo = function() { var vOther = Version.apply(window, arguments); /*eslint-disable no-nested-ternary */ return vMajor - vOther.getMajor() || iMinor - vOther.getMinor() || iPatch - vOther.getPatch() || ((sSuffix < vOther.getSuffix()) ? -1 : (sSuffix === vOther.getSuffix()) ? 0 : 1); /*eslint-enable no-nested-ternary */ }; }
[ "function", "Version", "(", "vMajor", ",", "iMinor", ",", "iPatch", ",", "sSuffix", ")", "{", "if", "(", "vMajor", "instanceof", "Version", ")", "{", "// note: even a constructor may return a value different from 'this'", "return", "vMajor", ";", "}", "if", "(", "!", "(", "this", "instanceof", "Version", ")", ")", "{", "// act as a cast operator when called as function (not as a constructor)", "return", "new", "Version", "(", "vMajor", ",", "iMinor", ",", "iPatch", ",", "sSuffix", ")", ";", "}", "var", "m", ";", "if", "(", "typeof", "vMajor", "===", "\"string\"", ")", "{", "m", "=", "rVersion", ".", "exec", "(", "vMajor", ")", ";", "}", "else", "if", "(", "Array", ".", "isArray", "(", "vMajor", ")", ")", "{", "m", "=", "vMajor", ";", "}", "else", "{", "m", "=", "arguments", ";", "}", "m", "=", "m", "||", "[", "]", ";", "function", "norm", "(", "v", ")", "{", "v", "=", "parseInt", "(", "v", ")", ";", "return", "isNaN", "(", "v", ")", "?", "0", ":", "v", ";", "}", "vMajor", "=", "norm", "(", "m", "[", "0", "]", ")", ";", "iMinor", "=", "norm", "(", "m", "[", "1", "]", ")", ";", "iPatch", "=", "norm", "(", "m", "[", "2", "]", ")", ";", "sSuffix", "=", "String", "(", "m", "[", "3", "]", "||", "\"\"", ")", ";", "/**\n\t\t * Returns a string representation of this version.\n\t\t *\n\t\t * @return {string} a string representation of this version.\n\t\t * @public\n\t\t */", "this", ".", "toString", "=", "function", "(", ")", "{", "return", "vMajor", "+", "\".\"", "+", "iMinor", "+", "\".\"", "+", "iPatch", "+", "sSuffix", ";", "}", ";", "/**\n\t\t * Returns the major version part of this version.\n\t\t *\n\t\t * @return {int} the major version part of this version\n\t\t * @public\n\t\t */", "this", ".", "getMajor", "=", "function", "(", ")", "{", "return", "vMajor", ";", "}", ";", "/**\n\t\t * Returns the minor version part of this version.\n\t\t *\n\t\t * @return {int} the minor version part of this version\n\t\t * @public\n\t\t */", "this", ".", "getMinor", "=", "function", "(", ")", "{", "return", "iMinor", ";", "}", ";", "/**\n\t\t * Returns the patch (or micro) version part of this version.\n\t\t *\n\t\t * @return {int} the patch version part of this version\n\t\t * @public\n\t\t */", "this", ".", "getPatch", "=", "function", "(", ")", "{", "return", "iPatch", ";", "}", ";", "/**\n\t\t * Returns the version suffix of this version.\n\t\t *\n\t\t * @return {string} the version suffix of this version\n\t\t * @public\n\t\t */", "this", ".", "getSuffix", "=", "function", "(", ")", "{", "return", "sSuffix", ";", "}", ";", "/**\n\t\t * Compares this version with a given one.\n\t\t *\n\t\t * The version with which this version should be compared can be given as a <code>sap/base/util/Version</code> instance,\n\t\t * as a string (e.g. <code>v.compareto(\"1.4.5\")</code>). Or major, minor, patch and suffix values can be given as\n\t\t * separate parameters (e.g. <code>v.compareTo(1, 4, 5)</code>) or in an array (e.g. <code>v.compareTo([1, 4, 5])</code>).\n\t\t *\n\t\t * @return {int} 0, if the given version is equal to this version, a negative value if the given other version is greater\n\t\t * and a positive value otherwise\n\t\t * @public\n\t\t */", "this", ".", "compareTo", "=", "function", "(", ")", "{", "var", "vOther", "=", "Version", ".", "apply", "(", "window", ",", "arguments", ")", ";", "/*eslint-disable no-nested-ternary */", "return", "vMajor", "-", "vOther", ".", "getMajor", "(", ")", "||", "iMinor", "-", "vOther", ".", "getMinor", "(", ")", "||", "iPatch", "-", "vOther", ".", "getPatch", "(", ")", "||", "(", "(", "sSuffix", "<", "vOther", ".", "getSuffix", "(", ")", ")", "?", "-", "1", ":", "(", "sSuffix", "===", "vOther", ".", "getSuffix", "(", ")", ")", "?", "0", ":", "1", ")", ";", "/*eslint-enable no-nested-ternary */", "}", ";", "}" ]
Returns a Version instance created from the given parameters. This function can either be called as a constructor (using <code>new</code>) or as a normal function. It always returns an immutable Version instance. The parts of the version number (major, minor, patch, suffix) can be provided in several ways: <ul> <li>Version("1.2.3-SNAPSHOT") - as a dot-separated string. Any non-numerical char or a dot followed by a non-numerical char starts the suffix portion. Any missing major, minor or patch versions will be set to 0.</li> <li>Version(1,2,3,"-SNAPSHOT") - as individual parameters. Major, minor and patch must be integer numbers or empty, suffix must be a string not starting with digits.</li> <li>Version([1,2,3,"-SNAPSHOT"]) - as an array with the individual parts. The same type restrictions apply as before.</li> <li>Version(otherVersion) - as a Version instance (cast operation). Returns the given instance instead of creating a new one.</li> </ul> To keep the code size small, this implementation mainly validates the single string variant. All other variants are only validated to some degree. It is the responsibility of the caller to provide proper parts. @param {int|string|any[]|module:sap/base/util/Version} vMajor the major part of the version (int) or any of the single parameter variants explained above. @param {int} iMinor the minor part of the version number @param {int} iPatch the patch part of the version number @param {string} sSuffix the suffix part of the version number @class Represents a version consisting of major, minor, patch version and suffix, e.g. '1.2.7-SNAPSHOT'. @since 1.58 @alias module:sap/base/util/Version @public
[ "Returns", "a", "Version", "instance", "created", "from", "the", "given", "parameters", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/base/util/Version.js#L46-L146
4,046
SAP/openui5
src/sap.ui.fl/src/sap/ui/fl/Utils.js
function(sLogType, aMessageComponents, aValuesToInsert, sCallStack) { var sLogMessage = aMessageComponents.join(' '); sLogMessage = formatMessage(sLogMessage, aValuesToInsert); this.log[sLogType](sLogMessage, sCallStack || ""); }
javascript
function(sLogType, aMessageComponents, aValuesToInsert, sCallStack) { var sLogMessage = aMessageComponents.join(' '); sLogMessage = formatMessage(sLogMessage, aValuesToInsert); this.log[sLogType](sLogMessage, sCallStack || ""); }
[ "function", "(", "sLogType", ",", "aMessageComponents", ",", "aValuesToInsert", ",", "sCallStack", ")", "{", "var", "sLogMessage", "=", "aMessageComponents", ".", "join", "(", "' '", ")", ";", "sLogMessage", "=", "formatMessage", "(", "sLogMessage", ",", "aValuesToInsert", ")", ";", "this", ".", "log", "[", "sLogType", "]", "(", "sLogMessage", ",", "sCallStack", "||", "\"\"", ")", ";", "}" ]
Formats the log message by replacing placeholders with values and logging the message. @param {string} sLogType - Logging type to be used. Possible values: info | warning | debug | error @param {array.<string>} aMessageComponents - Individual parts of the message text @param {array.<any>} aValuesToInsert - The values to be used instead of the placeholders in the message @param {string} [sCallStack] - Passes the callstack to the logging function
[ "Formats", "the", "log", "message", "by", "replacing", "placeholders", "with", "values", "and", "logging", "the", "message", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.fl/src/sap/ui/fl/Utils.js#L90-L94
4,047
SAP/openui5
src/sap.ui.fl/src/sap/ui/fl/Utils.js
function (oControl) { var oModel; if (!oControl) { return ""; } // Get Model if (oControl && typeof oControl.getModel === "function") { oModel = oControl.getModel(); return Utils._getXSRFTokenFromModel(oModel); } return ""; }
javascript
function (oControl) { var oModel; if (!oControl) { return ""; } // Get Model if (oControl && typeof oControl.getModel === "function") { oModel = oControl.getModel(); return Utils._getXSRFTokenFromModel(oModel); } return ""; }
[ "function", "(", "oControl", ")", "{", "var", "oModel", ";", "if", "(", "!", "oControl", ")", "{", "return", "\"\"", ";", "}", "// Get Model", "if", "(", "oControl", "&&", "typeof", "oControl", ".", "getModel", "===", "\"function\"", ")", "{", "oModel", "=", "oControl", ".", "getModel", "(", ")", ";", "return", "Utils", ".", "_getXSRFTokenFromModel", "(", "oModel", ")", ";", "}", "return", "\"\"", ";", "}" ]
Tries to retrieve the xsrf token from the controls OData Model. Returns empty string if retrieval failed. @param {sap.ui.core.Control} oControl - SAPUI5 control @returns {String} XSRF Token @public @function @name sap.ui.fl.Utils.getXSRFTokenFromControl
[ "Tries", "to", "retrieve", "the", "xsrf", "token", "from", "the", "controls", "OData", "Model", ".", "Returns", "empty", "string", "if", "retrieval", "failed", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.fl/src/sap/ui/fl/Utils.js#L105-L117
4,048
SAP/openui5
src/sap.ui.fl/src/sap/ui/fl/Utils.js
function (oModel) { var mHeaders; if (!oModel) { return ""; } if (typeof oModel.getHeaders === "function") { mHeaders = oModel.getHeaders(); if (mHeaders) { return mHeaders["x-csrf-token"]; } } return ""; }
javascript
function (oModel) { var mHeaders; if (!oModel) { return ""; } if (typeof oModel.getHeaders === "function") { mHeaders = oModel.getHeaders(); if (mHeaders) { return mHeaders["x-csrf-token"]; } } return ""; }
[ "function", "(", "oModel", ")", "{", "var", "mHeaders", ";", "if", "(", "!", "oModel", ")", "{", "return", "\"\"", ";", "}", "if", "(", "typeof", "oModel", ".", "getHeaders", "===", "\"function\"", ")", "{", "mHeaders", "=", "oModel", ".", "getHeaders", "(", ")", ";", "if", "(", "mHeaders", ")", "{", "return", "mHeaders", "[", "\"x-csrf-token\"", "]", ";", "}", "}", "return", "\"\"", ";", "}" ]
Returns XSRF Token from the Odata Model. Returns empty string if retrieval failed @param {sap.ui.model.odata.ODataModel} oModel - OData Model @returns {String} XSRF Token @private
[ "Returns", "XSRF", "Token", "from", "the", "Odata", "Model", ".", "Returns", "empty", "string", "if", "retrieval", "failed" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.fl/src/sap/ui/fl/Utils.js#L126-L138
4,049
SAP/openui5
src/sap.ui.fl/src/sap/ui/fl/Utils.js
function (oControl) { var oAppComponent; // determine UI5 component out of given control if (oControl) { // always return the app component oAppComponent = this.getAppComponentForControl(oControl); // check if the component is an application variant and assigned an application descriptor then use this as reference if (oAppComponent) { var sVariantId = this._getComponentStartUpParameter(oAppComponent, "sap-app-id"); if (sVariantId) { return sVariantId; } if (oAppComponent.getManifestEntry("sap.ui5") && oAppComponent.getManifestEntry("sap.ui5").appVariantId) { return oAppComponent.getManifestEntry("sap.ui5").appVariantId; } } } return Utils.getComponentName(oAppComponent); }
javascript
function (oControl) { var oAppComponent; // determine UI5 component out of given control if (oControl) { // always return the app component oAppComponent = this.getAppComponentForControl(oControl); // check if the component is an application variant and assigned an application descriptor then use this as reference if (oAppComponent) { var sVariantId = this._getComponentStartUpParameter(oAppComponent, "sap-app-id"); if (sVariantId) { return sVariantId; } if (oAppComponent.getManifestEntry("sap.ui5") && oAppComponent.getManifestEntry("sap.ui5").appVariantId) { return oAppComponent.getManifestEntry("sap.ui5").appVariantId; } } } return Utils.getComponentName(oAppComponent); }
[ "function", "(", "oControl", ")", "{", "var", "oAppComponent", ";", "// determine UI5 component out of given control", "if", "(", "oControl", ")", "{", "// always return the app component", "oAppComponent", "=", "this", ".", "getAppComponentForControl", "(", "oControl", ")", ";", "// check if the component is an application variant and assigned an application descriptor then use this as reference", "if", "(", "oAppComponent", ")", "{", "var", "sVariantId", "=", "this", ".", "_getComponentStartUpParameter", "(", "oAppComponent", ",", "\"sap-app-id\"", ")", ";", "if", "(", "sVariantId", ")", "{", "return", "sVariantId", ";", "}", "if", "(", "oAppComponent", ".", "getManifestEntry", "(", "\"sap.ui5\"", ")", "&&", "oAppComponent", ".", "getManifestEntry", "(", "\"sap.ui5\"", ")", ".", "appVariantId", ")", "{", "return", "oAppComponent", ".", "getManifestEntry", "(", "\"sap.ui5\"", ")", ".", "appVariantId", ";", "}", "}", "}", "return", "Utils", ".", "getComponentName", "(", "oAppComponent", ")", ";", "}" ]
Returns the class name of the component the given control belongs to. @param {sap.ui.core.Control} oControl - SAPUI5 control @returns {String} The component class name, ending with ".Component" @see sap.ui.core.Component.getOwnerIdFor @public @function @name sap.ui.fl.Utils.getComponentClassName
[ "Returns", "the", "class", "name", "of", "the", "component", "the", "given", "control", "belongs", "to", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.fl/src/sap/ui/fl/Utils.js#L151-L173
4,050
SAP/openui5
src/sap.ui.fl/src/sap/ui/fl/Utils.js
function (oControl) { var oManifest = null, oComponent = null, oComponentMetaData = null; // determine UI5 component out of given control if (oControl) { oComponent = this.getAppComponentForControl(oControl); // determine manifest out of found component if (oComponent && oComponent.getMetadata) { oComponentMetaData = oComponent.getMetadata(); if (oComponentMetaData && oComponentMetaData.getManifest) { oManifest = oComponentMetaData.getManifest(); } } } return oManifest; }
javascript
function (oControl) { var oManifest = null, oComponent = null, oComponentMetaData = null; // determine UI5 component out of given control if (oControl) { oComponent = this.getAppComponentForControl(oControl); // determine manifest out of found component if (oComponent && oComponent.getMetadata) { oComponentMetaData = oComponent.getMetadata(); if (oComponentMetaData && oComponentMetaData.getManifest) { oManifest = oComponentMetaData.getManifest(); } } } return oManifest; }
[ "function", "(", "oControl", ")", "{", "var", "oManifest", "=", "null", ",", "oComponent", "=", "null", ",", "oComponentMetaData", "=", "null", ";", "// determine UI5 component out of given control", "if", "(", "oControl", ")", "{", "oComponent", "=", "this", ".", "getAppComponentForControl", "(", "oControl", ")", ";", "// determine manifest out of found component", "if", "(", "oComponent", "&&", "oComponent", ".", "getMetadata", ")", "{", "oComponentMetaData", "=", "oComponent", ".", "getMetadata", "(", ")", ";", "if", "(", "oComponentMetaData", "&&", "oComponentMetaData", ".", "getManifest", ")", "{", "oManifest", "=", "oComponentMetaData", ".", "getManifest", "(", ")", ";", "}", "}", "}", "return", "oManifest", ";", "}" ]
Returns the appDescriptor of the component for the given control @param {sap.ui.core.Control} oControl - SAPUI5 control @returns {object} that represent the appDescriptor @public @function @name sap.ui.fl.Utils.getAppDescriptor
[ "Returns", "the", "appDescriptor", "of", "the", "component", "for", "the", "given", "control" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.fl/src/sap/ui/fl/Utils.js#L226-L243
4,051
SAP/openui5
src/sap.ui.fl/src/sap/ui/fl/Utils.js
function (oControl) { var sSiteId = null, oAppComponent = null; // determine UI5 component out of given control if (oControl) { oAppComponent = this.getAppComponentForControl(oControl); // determine siteId from ComponentData if (oAppComponent) { //Workaround for back-end check: isApplicationPermitted //As long as FLP does not know about appDescriptorId we have to pass siteID and applicationID. //With startUpParameter hcpApplicationId we will get a concatenation of “siteId:applicationId” //sSiteId = this._getComponentStartUpParameter(oComponent, "scopeId"); sSiteId = this._getComponentStartUpParameter(oAppComponent, "hcpApplicationId"); } } return sSiteId; }
javascript
function (oControl) { var sSiteId = null, oAppComponent = null; // determine UI5 component out of given control if (oControl) { oAppComponent = this.getAppComponentForControl(oControl); // determine siteId from ComponentData if (oAppComponent) { //Workaround for back-end check: isApplicationPermitted //As long as FLP does not know about appDescriptorId we have to pass siteID and applicationID. //With startUpParameter hcpApplicationId we will get a concatenation of “siteId:applicationId” //sSiteId = this._getComponentStartUpParameter(oComponent, "scopeId"); sSiteId = this._getComponentStartUpParameter(oAppComponent, "hcpApplicationId"); } } return sSiteId; }
[ "function", "(", "oControl", ")", "{", "var", "sSiteId", "=", "null", ",", "oAppComponent", "=", "null", ";", "// determine UI5 component out of given control", "if", "(", "oControl", ")", "{", "oAppComponent", "=", "this", ".", "getAppComponentForControl", "(", "oControl", ")", ";", "// determine siteId from ComponentData", "if", "(", "oAppComponent", ")", "{", "//Workaround for back-end check: isApplicationPermitted", "//As long as FLP does not know about appDescriptorId we have to pass siteID and applicationID.", "//With startUpParameter hcpApplicationId we will get a concatenation of “siteId:applicationId”", "//sSiteId = this._getComponentStartUpParameter(oComponent, \"scopeId\");", "sSiteId", "=", "this", ".", "_getComponentStartUpParameter", "(", "oAppComponent", ",", "\"hcpApplicationId\"", ")", ";", "}", "}", "return", "sSiteId", ";", "}" ]
Returns the siteId of a component @param {sap.ui.core.Control} oControl - SAPUI5 control @returns {string} siteId - that represent the found siteId @public @function @name sap.ui.fl.Utils.getSiteId
[ "Returns", "the", "siteId", "of", "a", "component" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.fl/src/sap/ui/fl/Utils.js#L254-L275
4,052
SAP/openui5
src/sap.ui.fl/src/sap/ui/fl/Utils.js
function (sPropertyValue) { var bIsBinding = false; if (sPropertyValue && typeof sPropertyValue === "string" && sPropertyValue.substring(0, 1) === "{" && sPropertyValue.slice(-1) === "}") { bIsBinding = true; } return bIsBinding; }
javascript
function (sPropertyValue) { var bIsBinding = false; if (sPropertyValue && typeof sPropertyValue === "string" && sPropertyValue.substring(0, 1) === "{" && sPropertyValue.slice(-1) === "}") { bIsBinding = true; } return bIsBinding; }
[ "function", "(", "sPropertyValue", ")", "{", "var", "bIsBinding", "=", "false", ";", "if", "(", "sPropertyValue", "&&", "typeof", "sPropertyValue", "===", "\"string\"", "&&", "sPropertyValue", ".", "substring", "(", "0", ",", "1", ")", "===", "\"{\"", "&&", "sPropertyValue", ".", "slice", "(", "-", "1", ")", "===", "\"}\"", ")", "{", "bIsBinding", "=", "true", ";", "}", "return", "bIsBinding", ";", "}" ]
Indicates if the property value represents a binding @param {object} sPropertyValue - Property value @returns {boolean} true if value represents a binding @public @function @name sap.ui.fl.Utils.isBinding
[ "Indicates", "if", "the", "property", "value", "represents", "a", "binding" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.fl/src/sap/ui/fl/Utils.js#L316-L322
4,053
SAP/openui5
src/sap.ui.fl/src/sap/ui/fl/Utils.js
function (oControl) { var sFlexReference = Utils.getComponentClassName(oControl); var oAppComponent = Utils.getAppComponentForControl(oControl); var sComponentName = Utils.getComponentName(oAppComponent); return sFlexReference !== sComponentName; }
javascript
function (oControl) { var sFlexReference = Utils.getComponentClassName(oControl); var oAppComponent = Utils.getAppComponentForControl(oControl); var sComponentName = Utils.getComponentName(oAppComponent); return sFlexReference !== sComponentName; }
[ "function", "(", "oControl", ")", "{", "var", "sFlexReference", "=", "Utils", ".", "getComponentClassName", "(", "oControl", ")", ";", "var", "oAppComponent", "=", "Utils", ".", "getAppComponentForControl", "(", "oControl", ")", ";", "var", "sComponentName", "=", "Utils", ".", "getComponentName", "(", "oAppComponent", ")", ";", "return", "sFlexReference", "!==", "sComponentName", ";", "}" ]
Indicates if the current application is a variant of an existing one @param {sap.ui.core.Control} oControl - SAPUI5 control @returns {boolean} true if it's an application variant @public @function @name sap.ui.fl.Utils.isApplicationVariant
[ "Indicates", "if", "the", "current", "application", "is", "a", "variant", "of", "an", "existing", "one" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.fl/src/sap/ui/fl/Utils.js#L350-L355
4,054
SAP/openui5
src/sap.ui.fl/src/sap/ui/fl/Utils.js
function (oComponent, sParameterName) { var startUpParameterContent = null; if (sParameterName) { if (oComponent && oComponent.getComponentData) { startUpParameterContent = this._getStartUpParameter(oComponent.getComponentData(), sParameterName); } } return startUpParameterContent; }
javascript
function (oComponent, sParameterName) { var startUpParameterContent = null; if (sParameterName) { if (oComponent && oComponent.getComponentData) { startUpParameterContent = this._getStartUpParameter(oComponent.getComponentData(), sParameterName); } } return startUpParameterContent; }
[ "function", "(", "oComponent", ",", "sParameterName", ")", "{", "var", "startUpParameterContent", "=", "null", ";", "if", "(", "sParameterName", ")", "{", "if", "(", "oComponent", "&&", "oComponent", ".", "getComponentData", ")", "{", "startUpParameterContent", "=", "this", ".", "_getStartUpParameter", "(", "oComponent", ".", "getComponentData", "(", ")", ",", "sParameterName", ")", ";", "}", "}", "return", "startUpParameterContent", ";", "}" ]
Determines the content for a given startUpParameter name @param {sap.ui.core.Component} oComponent - component instance @param {String} sParameterName - startUpParameterName that shall be determined @returns {String} content of found startUpParameter @private
[ "Determines", "the", "content", "for", "a", "given", "startUpParameter", "name" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.fl/src/sap/ui/fl/Utils.js#L451-L461
4,055
SAP/openui5
src/sap.ui.fl/src/sap/ui/fl/Utils.js
function (oComponent) { var sComponentName = ""; if (oComponent) { sComponentName = oComponent.getMetadata().getName(); } if (sComponentName.length > 0 && sComponentName.indexOf(".Component") < 0) { sComponentName += ".Component"; } return sComponentName; }
javascript
function (oComponent) { var sComponentName = ""; if (oComponent) { sComponentName = oComponent.getMetadata().getName(); } if (sComponentName.length > 0 && sComponentName.indexOf(".Component") < 0) { sComponentName += ".Component"; } return sComponentName; }
[ "function", "(", "oComponent", ")", "{", "var", "sComponentName", "=", "\"\"", ";", "if", "(", "oComponent", ")", "{", "sComponentName", "=", "oComponent", ".", "getMetadata", "(", ")", ".", "getName", "(", ")", ";", "}", "if", "(", "sComponentName", ".", "length", ">", "0", "&&", "sComponentName", ".", "indexOf", "(", "\".Component\"", ")", "<", "0", ")", "{", "sComponentName", "+=", "\".Component\"", ";", "}", "return", "sComponentName", ";", "}" ]
Gets the component name for a component instance. @param {sap.ui.core.Component} oComponent component instance @returns {String} component name @public
[ "Gets", "the", "component", "name", "for", "a", "component", "instance", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.fl/src/sap/ui/fl/Utils.js#L478-L487
4,056
SAP/openui5
src/sap.ui.fl/src/sap/ui/fl/Utils.js
function (oControl) { var sComponentId = Utils._getOwnerIdForControl(oControl); if (!sComponentId) { if (oControl && typeof oControl.getParent === "function") { var oParent = oControl.getParent(); if (oParent) { return Utils._getComponentIdForControl(oParent); } } } return sComponentId || ""; }
javascript
function (oControl) { var sComponentId = Utils._getOwnerIdForControl(oControl); if (!sComponentId) { if (oControl && typeof oControl.getParent === "function") { var oParent = oControl.getParent(); if (oParent) { return Utils._getComponentIdForControl(oParent); } } } return sComponentId || ""; }
[ "function", "(", "oControl", ")", "{", "var", "sComponentId", "=", "Utils", ".", "_getOwnerIdForControl", "(", "oControl", ")", ";", "if", "(", "!", "sComponentId", ")", "{", "if", "(", "oControl", "&&", "typeof", "oControl", ".", "getParent", "===", "\"function\"", ")", "{", "var", "oParent", "=", "oControl", ".", "getParent", "(", ")", ";", "if", "(", "oParent", ")", "{", "return", "Utils", ".", "_getComponentIdForControl", "(", "oParent", ")", ";", "}", "}", "}", "return", "sComponentId", "||", "\"\"", ";", "}" ]
Returns ComponentId of the control. If the control has no component, it walks up the control tree in order to find a control having one @param {sap.ui.core.Control} oControl - SAPUI5 control @returns {String} The component id or empty string if component id couldn't be found @see sap.ui.core.Component.getOwnerIdFor @private
[ "Returns", "ComponentId", "of", "the", "control", ".", "If", "the", "control", "has", "no", "component", "it", "walks", "up", "the", "control", "tree", "in", "order", "to", "find", "a", "control", "having", "one" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.fl/src/sap/ui/fl/Utils.js#L512-L523
4,057
SAP/openui5
src/sap.ui.fl/src/sap/ui/fl/Utils.js
function (oControl) { var oComponent = null; var sComponentId = null; // determine UI5 component out of given control if (oControl) { sComponentId = Utils._getComponentIdForControl(oControl); if (sComponentId) { oComponent = Utils._getComponent(sComponentId); } } return oComponent; }
javascript
function (oControl) { var oComponent = null; var sComponentId = null; // determine UI5 component out of given control if (oControl) { sComponentId = Utils._getComponentIdForControl(oControl); if (sComponentId) { oComponent = Utils._getComponent(sComponentId); } } return oComponent; }
[ "function", "(", "oControl", ")", "{", "var", "oComponent", "=", "null", ";", "var", "sComponentId", "=", "null", ";", "// determine UI5 component out of given control", "if", "(", "oControl", ")", "{", "sComponentId", "=", "Utils", ".", "_getComponentIdForControl", "(", "oControl", ")", ";", "if", "(", "sComponentId", ")", "{", "oComponent", "=", "Utils", ".", "_getComponent", "(", "sComponentId", ")", ";", "}", "}", "return", "oComponent", ";", "}" ]
Returns the Component that belongs to given control. If the control has no component, it walks up the control tree in order to find a control having one. @param {sap.ui.base.ManagedObject} oControl - Managed object instance @returns {sap.ui.core.Component|null} found component @private
[ "Returns", "the", "Component", "that", "belongs", "to", "given", "control", ".", "If", "the", "control", "has", "no", "component", "it", "walks", "up", "the", "control", "tree", "in", "order", "to", "find", "a", "control", "having", "one", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.fl/src/sap/ui/fl/Utils.js#L558-L571
4,058
SAP/openui5
src/sap.ui.fl/src/sap/ui/fl/Utils.js
function (oComponent) { var oSapApp = null; // special case for Fiori Elements to reach the real appComponent if (oComponent && oComponent.getAppComponent) { return oComponent.getAppComponent(); } // special case for OVP if (oComponent && oComponent.oComponentData && oComponent.oComponentData.appComponent) { return oComponent.oComponentData.appComponent; } if (oComponent && oComponent.getManifestEntry) { oSapApp = oComponent.getManifestEntry("sap.app"); } else { // if no manifest entry return oComponent; } if (oSapApp && oSapApp.type && oSapApp.type !== "application") { if (oComponent instanceof Component) { // we need to call this method only when the component is an instance of Component in order to walk up the tree // returns owner app component oComponent = this._getComponentForControl(oComponent); } return this.getAppComponentForControl(oComponent); } return oComponent; }
javascript
function (oComponent) { var oSapApp = null; // special case for Fiori Elements to reach the real appComponent if (oComponent && oComponent.getAppComponent) { return oComponent.getAppComponent(); } // special case for OVP if (oComponent && oComponent.oComponentData && oComponent.oComponentData.appComponent) { return oComponent.oComponentData.appComponent; } if (oComponent && oComponent.getManifestEntry) { oSapApp = oComponent.getManifestEntry("sap.app"); } else { // if no manifest entry return oComponent; } if (oSapApp && oSapApp.type && oSapApp.type !== "application") { if (oComponent instanceof Component) { // we need to call this method only when the component is an instance of Component in order to walk up the tree // returns owner app component oComponent = this._getComponentForControl(oComponent); } return this.getAppComponentForControl(oComponent); } return oComponent; }
[ "function", "(", "oComponent", ")", "{", "var", "oSapApp", "=", "null", ";", "// special case for Fiori Elements to reach the real appComponent", "if", "(", "oComponent", "&&", "oComponent", ".", "getAppComponent", ")", "{", "return", "oComponent", ".", "getAppComponent", "(", ")", ";", "}", "// special case for OVP", "if", "(", "oComponent", "&&", "oComponent", ".", "oComponentData", "&&", "oComponent", ".", "oComponentData", ".", "appComponent", ")", "{", "return", "oComponent", ".", "oComponentData", ".", "appComponent", ";", "}", "if", "(", "oComponent", "&&", "oComponent", ".", "getManifestEntry", ")", "{", "oSapApp", "=", "oComponent", ".", "getManifestEntry", "(", "\"sap.app\"", ")", ";", "}", "else", "{", "// if no manifest entry", "return", "oComponent", ";", "}", "if", "(", "oSapApp", "&&", "oSapApp", ".", "type", "&&", "oSapApp", ".", "type", "!==", "\"application\"", ")", "{", "if", "(", "oComponent", "instanceof", "Component", ")", "{", "// we need to call this method only when the component is an instance of Component in order to walk up the tree", "// returns owner app component", "oComponent", "=", "this", ".", "_getComponentForControl", "(", "oComponent", ")", ";", "}", "return", "this", ".", "getAppComponentForControl", "(", "oComponent", ")", ";", "}", "return", "oComponent", ";", "}" ]
Returns the Component that belongs to given component whose type is "application". @param {sap.ui.core.Component} oComponent - SAPUI5 component @returns {sap.ui.core.Component|null} component instance if found or null @private
[ "Returns", "the", "Component", "that", "belongs", "to", "given", "component", "whose", "type", "is", "application", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.fl/src/sap/ui/fl/Utils.js#L580-L609
4,059
SAP/openui5
src/sap.ui.fl/src/sap/ui/fl/Utils.js
function (bIsEndUser) { var oUriParams, sLayer; if (bIsEndUser) { return "USER"; } oUriParams = this._getUriParameters(); sLayer = oUriParams.get("sap-ui-layer") || ""; sLayer = sLayer.toUpperCase(); return sLayer || "CUSTOMER"; }
javascript
function (bIsEndUser) { var oUriParams, sLayer; if (bIsEndUser) { return "USER"; } oUriParams = this._getUriParameters(); sLayer = oUriParams.get("sap-ui-layer") || ""; sLayer = sLayer.toUpperCase(); return sLayer || "CUSTOMER"; }
[ "function", "(", "bIsEndUser", ")", "{", "var", "oUriParams", ",", "sLayer", ";", "if", "(", "bIsEndUser", ")", "{", "return", "\"USER\"", ";", "}", "oUriParams", "=", "this", ".", "_getUriParameters", "(", ")", ";", "sLayer", "=", "oUriParams", ".", "get", "(", "\"sap-ui-layer\"", ")", "||", "\"\"", ";", "sLayer", "=", "sLayer", ".", "toUpperCase", "(", ")", ";", "return", "sLayer", "||", "\"CUSTOMER\"", ";", "}" ]
Returns the current layer as defined by the url parameter. If the end user flag is set, it always returns "USER". @param {boolean} bIsEndUser - the end user flag @returns {string} the current layer @public @function @name sap.ui.fl.Utils.getCurrentLayer
[ "Returns", "the", "current", "layer", "as", "defined", "by", "the", "url", "parameter", ".", "If", "the", "end", "user", "flag", "is", "set", "it", "always", "returns", "USER", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.fl/src/sap/ui/fl/Utils.js#L693-L703
4,060
SAP/openui5
src/sap.ui.fl/src/sap/ui/fl/Utils.js
function (oControl) { var oMetadata; if (oControl && typeof oControl.getMetadata === "function") { oMetadata = oControl.getMetadata(); if (oMetadata && typeof oMetadata.getElementName === "function") { return oMetadata.getElementName(); } } }
javascript
function (oControl) { var oMetadata; if (oControl && typeof oControl.getMetadata === "function") { oMetadata = oControl.getMetadata(); if (oMetadata && typeof oMetadata.getElementName === "function") { return oMetadata.getElementName(); } } }
[ "function", "(", "oControl", ")", "{", "var", "oMetadata", ";", "if", "(", "oControl", "&&", "typeof", "oControl", ".", "getMetadata", "===", "\"function\"", ")", "{", "oMetadata", "=", "oControl", ".", "getMetadata", "(", ")", ";", "if", "(", "oMetadata", "&&", "typeof", "oMetadata", ".", "getElementName", "===", "\"function\"", ")", "{", "return", "oMetadata", ".", "getElementName", "(", ")", ";", "}", "}", "}" ]
Retrieves the controlType of the control @param {sap.ui.core.Control} oControl Control instance @returns {string} control type of the control - undefined if controlType cannot be determined @private
[ "Retrieves", "the", "controlType", "of", "the", "control" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.fl/src/sap/ui/fl/Utils.js#L800-L808
4,061
SAP/openui5
src/sap.ui.fl/src/sap/ui/fl/Utils.js
function (ascii) { var asciiArray = ascii.split(","); var parsedString = ""; jQuery.each(asciiArray, function (index, asciiChar) { parsedString += String.fromCharCode(asciiChar); }); return parsedString; }
javascript
function (ascii) { var asciiArray = ascii.split(","); var parsedString = ""; jQuery.each(asciiArray, function (index, asciiChar) { parsedString += String.fromCharCode(asciiChar); }); return parsedString; }
[ "function", "(", "ascii", ")", "{", "var", "asciiArray", "=", "ascii", ".", "split", "(", "\",\"", ")", ";", "var", "parsedString", "=", "\"\"", ";", "jQuery", ".", "each", "(", "asciiArray", ",", "function", "(", "index", ",", "asciiChar", ")", "{", "parsedString", "+=", "String", ".", "fromCharCode", "(", "asciiChar", ")", ";", "}", ")", ";", "return", "parsedString", ";", "}" ]
Converts ASCII coding into a string. Required for restoring stored code extensions @param {String} ascii string containing ascii code valid numbers separated by ',' @returns {String} parsedString parsed string
[ "Converts", "ASCII", "coding", "into", "a", "string", ".", "Required", "for", "restoring", "stored", "code", "extensions" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.fl/src/sap/ui/fl/Utils.js#L816-L826
4,062
SAP/openui5
src/sap.ui.fl/src/sap/ui/fl/Utils.js
function (string) { var ascii = ""; for (var i = 0; i < string.length; i++) { ascii += string.charCodeAt(i) + ","; } // remove last "," ascii = ascii.substring(0, ascii.length - 1); return ascii; }
javascript
function (string) { var ascii = ""; for (var i = 0; i < string.length; i++) { ascii += string.charCodeAt(i) + ","; } // remove last "," ascii = ascii.substring(0, ascii.length - 1); return ascii; }
[ "function", "(", "string", ")", "{", "var", "ascii", "=", "\"\"", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "string", ".", "length", ";", "i", "++", ")", "{", "ascii", "+=", "string", ".", "charCodeAt", "(", "i", ")", "+", "\",\"", ";", "}", "// remove last \",\"", "ascii", "=", "ascii", ".", "substring", "(", "0", ",", "ascii", ".", "length", "-", "1", ")", ";", "return", "ascii", ";", "}" ]
Converts a string into ASCII coding. Required for restoring stored code extensions @param {String} string string which has to be encoded @returns {String} ascii imput parsed to ascii numbers separated by ','
[ "Converts", "a", "string", "into", "ASCII", "coding", ".", "Required", "for", "restoring", "stored", "code", "extensions" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.fl/src/sap/ui/fl/Utils.js#L834-L845
4,063
SAP/openui5
src/sap.ui.fl/src/sap/ui/fl/Utils.js
function(){ var oUshellContainer = Utils.getUshellContainer(); if (oUshellContainer) { var oURLParser = oUshellContainer.getService("URLParsing"); var oParsedHash = oURLParser.parseShellHash(hasher.getHash()); return oParsedHash ? oParsedHash : { }; } return { }; }
javascript
function(){ var oUshellContainer = Utils.getUshellContainer(); if (oUshellContainer) { var oURLParser = oUshellContainer.getService("URLParsing"); var oParsedHash = oURLParser.parseShellHash(hasher.getHash()); return oParsedHash ? oParsedHash : { }; } return { }; }
[ "function", "(", ")", "{", "var", "oUshellContainer", "=", "Utils", ".", "getUshellContainer", "(", ")", ";", "if", "(", "oUshellContainer", ")", "{", "var", "oURLParser", "=", "oUshellContainer", ".", "getService", "(", "\"URLParsing\"", ")", ";", "var", "oParsedHash", "=", "oURLParser", ".", "parseShellHash", "(", "hasher", ".", "getHash", "(", ")", ")", ";", "return", "oParsedHash", "?", "oParsedHash", ":", "{", "}", ";", "}", "return", "{", "}", ";", "}" ]
Returns URL hash when ushell container is available @returns {object} Returns the parsed URL hash object or an empty object if ushell container is not available
[ "Returns", "URL", "hash", "when", "ushell", "container", "is", "available" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.fl/src/sap/ui/fl/Utils.js#L891-L899
4,064
SAP/openui5
src/sap.ui.fl/src/sap/ui/fl/Utils.js
function (oComponent, sParameterName, aValues) { var oParsedHash = Utils.getParsedURLHash(sParameterName); if (oParsedHash.params) { hasher.changed.active = false; //disable changed signal var mTechnicalParameters = Utils.getTechnicalParametersForComponent(oComponent); // if mTechnicalParameters are not available we write a warning and continue updating the hash if (!mTechnicalParameters) { this.log.warning("Component instance not provided, so technical parameters in component data and browser history remain unchanged"); } if (aValues.length === 0) { delete oParsedHash.params[sParameterName]; mTechnicalParameters && delete mTechnicalParameters[sParameterName]; // Case when ControlVariantsAPI.clearVariantParameterInURL is called with a parameter } else { oParsedHash.params[sParameterName] = aValues; mTechnicalParameters && (mTechnicalParameters[sParameterName] = aValues); // Technical parameters need to be in sync with the URL hash } hasher.replaceHash(Utils.getUshellContainer().getService("URLParsing").constructShellHash(oParsedHash)); // Set hash without dispatching changed signal nor writing history hasher.changed.active = true; // Re-enable signal } }
javascript
function (oComponent, sParameterName, aValues) { var oParsedHash = Utils.getParsedURLHash(sParameterName); if (oParsedHash.params) { hasher.changed.active = false; //disable changed signal var mTechnicalParameters = Utils.getTechnicalParametersForComponent(oComponent); // if mTechnicalParameters are not available we write a warning and continue updating the hash if (!mTechnicalParameters) { this.log.warning("Component instance not provided, so technical parameters in component data and browser history remain unchanged"); } if (aValues.length === 0) { delete oParsedHash.params[sParameterName]; mTechnicalParameters && delete mTechnicalParameters[sParameterName]; // Case when ControlVariantsAPI.clearVariantParameterInURL is called with a parameter } else { oParsedHash.params[sParameterName] = aValues; mTechnicalParameters && (mTechnicalParameters[sParameterName] = aValues); // Technical parameters need to be in sync with the URL hash } hasher.replaceHash(Utils.getUshellContainer().getService("URLParsing").constructShellHash(oParsedHash)); // Set hash without dispatching changed signal nor writing history hasher.changed.active = true; // Re-enable signal } }
[ "function", "(", "oComponent", ",", "sParameterName", ",", "aValues", ")", "{", "var", "oParsedHash", "=", "Utils", ".", "getParsedURLHash", "(", "sParameterName", ")", ";", "if", "(", "oParsedHash", ".", "params", ")", "{", "hasher", ".", "changed", ".", "active", "=", "false", ";", "//disable changed signal", "var", "mTechnicalParameters", "=", "Utils", ".", "getTechnicalParametersForComponent", "(", "oComponent", ")", ";", "// if mTechnicalParameters are not available we write a warning and continue updating the hash", "if", "(", "!", "mTechnicalParameters", ")", "{", "this", ".", "log", ".", "warning", "(", "\"Component instance not provided, so technical parameters in component data and browser history remain unchanged\"", ")", ";", "}", "if", "(", "aValues", ".", "length", "===", "0", ")", "{", "delete", "oParsedHash", ".", "params", "[", "sParameterName", "]", ";", "mTechnicalParameters", "&&", "delete", "mTechnicalParameters", "[", "sParameterName", "]", ";", "// Case when ControlVariantsAPI.clearVariantParameterInURL is called with a parameter", "}", "else", "{", "oParsedHash", ".", "params", "[", "sParameterName", "]", "=", "aValues", ";", "mTechnicalParameters", "&&", "(", "mTechnicalParameters", "[", "sParameterName", "]", "=", "aValues", ")", ";", "// Technical parameters need to be in sync with the URL hash", "}", "hasher", ".", "replaceHash", "(", "Utils", ".", "getUshellContainer", "(", ")", ".", "getService", "(", "\"URLParsing\"", ")", ".", "constructShellHash", "(", "oParsedHash", ")", ")", ";", "// Set hash without dispatching changed signal nor writing history", "hasher", ".", "changed", ".", "active", "=", "true", ";", "// Re-enable signal", "}", "}" ]
Sets the values for url hash and technical parameters for the component data. Deactivates hash based navigation while performing the operations, which is then re-activated upon completion. If the passed doesn't exist in the url hash or technical parameters, then a new object is added respectively. @param {object} oComponent Component instance used to get the technical parameters @param {string} sParameterName Name of the parameter (e.g. "sap-ui-fl-control-variant-id") @param {string[]} aValues Array of values for the technical parameter
[ "Sets", "the", "values", "for", "url", "hash", "and", "technical", "parameters", "for", "the", "component", "data", ".", "Deactivates", "hash", "based", "navigation", "while", "performing", "the", "operations", "which", "is", "then", "re", "-", "activated", "upon", "completion", ".", "If", "the", "passed", "doesn", "t", "exist", "in", "the", "url", "hash", "or", "technical", "parameters", "then", "a", "new", "object", "is", "added", "respectively", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.fl/src/sap/ui/fl/Utils.js#L910-L931
4,065
SAP/openui5
src/sap.ui.fl/src/sap/ui/fl/Utils.js
function (mPropertyBag) { var sAppVersion = mPropertyBag.appVersion; var bDeveloperMode = mPropertyBag.developerMode; var sScenario = mPropertyBag.scenario; var oValidAppVersions = { creation: sAppVersion, from: sAppVersion }; if (this._isValidAppVersionToRequired(sAppVersion, bDeveloperMode, sScenario)) { oValidAppVersions.to = sAppVersion; } return oValidAppVersions; }
javascript
function (mPropertyBag) { var sAppVersion = mPropertyBag.appVersion; var bDeveloperMode = mPropertyBag.developerMode; var sScenario = mPropertyBag.scenario; var oValidAppVersions = { creation: sAppVersion, from: sAppVersion }; if (this._isValidAppVersionToRequired(sAppVersion, bDeveloperMode, sScenario)) { oValidAppVersions.to = sAppVersion; } return oValidAppVersions; }
[ "function", "(", "mPropertyBag", ")", "{", "var", "sAppVersion", "=", "mPropertyBag", ".", "appVersion", ";", "var", "bDeveloperMode", "=", "mPropertyBag", ".", "developerMode", ";", "var", "sScenario", "=", "mPropertyBag", ".", "scenario", ";", "var", "oValidAppVersions", "=", "{", "creation", ":", "sAppVersion", ",", "from", ":", "sAppVersion", "}", ";", "if", "(", "this", ".", "_isValidAppVersionToRequired", "(", "sAppVersion", ",", "bDeveloperMode", ",", "sScenario", ")", ")", "{", "oValidAppVersions", ".", "to", "=", "sAppVersion", ";", "}", "return", "oValidAppVersions", ";", "}" ]
Generates a ValidAppVersions object for changes and variants; Depending on the parameters passed a 'to' field is included. @param {map} mPropertyBag @param {string} mPropertyBag.appVersion Version to be filled into the validAppVersions object fields @param {boolean} mPropertyBag.developerMode Flag if the creation of the object takes place in the developer mode @param {sap.ui.fl.Scenario} mPropertyBag.scenario Depending on the scenario a 'to' field must be filled @returns {{creation: {string}, from: {string} [,to: {string}]}}
[ "Generates", "a", "ValidAppVersions", "object", "for", "changes", "and", "variants", ";", "Depending", "on", "the", "parameters", "passed", "a", "to", "field", "is", "included", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.fl/src/sap/ui/fl/Utils.js#L1043-L1055
4,066
SAP/openui5
src/sap.ui.fl/src/sap/ui/fl/Utils.js
function (sAppVersion, bDeveloperMode, sScenario) { return !!sAppVersion && !!bDeveloperMode && sScenario !== sap.ui.fl.Scenario.AdaptationProject && sScenario !== sap.ui.fl.Scenario.AppVariant; }
javascript
function (sAppVersion, bDeveloperMode, sScenario) { return !!sAppVersion && !!bDeveloperMode && sScenario !== sap.ui.fl.Scenario.AdaptationProject && sScenario !== sap.ui.fl.Scenario.AppVariant; }
[ "function", "(", "sAppVersion", ",", "bDeveloperMode", ",", "sScenario", ")", "{", "return", "!", "!", "sAppVersion", "&&", "!", "!", "bDeveloperMode", "&&", "sScenario", "!==", "sap", ".", "ui", ".", "fl", ".", "Scenario", ".", "AdaptationProject", "&&", "sScenario", "!==", "sap", ".", "ui", ".", "fl", ".", "Scenario", ".", "AppVariant", ";", "}" ]
Determines if a 'to' field is required in a validAppVersions object. @param sAppVersion @param bDeveloperMode @param sScenario @returns {boolean} @private
[ "Determines", "if", "a", "to", "field", "is", "required", "in", "a", "validAppVersions", "object", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.fl/src/sap/ui/fl/Utils.js#L1065-L1070
4,067
SAP/openui5
src/sap.ui.fl/src/sap/ui/fl/Utils.js
function (oManifest) { var sUri = ""; if (oManifest){ var oSapApp = (oManifest.getEntry) ? oManifest.getEntry("sap.app") : oManifest["sap.app"]; if (oSapApp && oSapApp.dataSources && oSapApp.dataSources.mainService && oSapApp.dataSources.mainService.uri){ sUri = oSapApp.dataSources.mainService.uri; } } else { this.log.warning("No Manifest received."); } return sUri; }
javascript
function (oManifest) { var sUri = ""; if (oManifest){ var oSapApp = (oManifest.getEntry) ? oManifest.getEntry("sap.app") : oManifest["sap.app"]; if (oSapApp && oSapApp.dataSources && oSapApp.dataSources.mainService && oSapApp.dataSources.mainService.uri){ sUri = oSapApp.dataSources.mainService.uri; } } else { this.log.warning("No Manifest received."); } return sUri; }
[ "function", "(", "oManifest", ")", "{", "var", "sUri", "=", "\"\"", ";", "if", "(", "oManifest", ")", "{", "var", "oSapApp", "=", "(", "oManifest", ".", "getEntry", ")", "?", "oManifest", ".", "getEntry", "(", "\"sap.app\"", ")", ":", "oManifest", "[", "\"sap.app\"", "]", ";", "if", "(", "oSapApp", "&&", "oSapApp", ".", "dataSources", "&&", "oSapApp", ".", "dataSources", ".", "mainService", "&&", "oSapApp", ".", "dataSources", ".", "mainService", ".", "uri", ")", "{", "sUri", "=", "oSapApp", ".", "dataSources", ".", "mainService", ".", "uri", ";", "}", "}", "else", "{", "this", ".", "log", ".", "warning", "(", "\"No Manifest received.\"", ")", ";", "}", "return", "sUri", ";", "}" ]
Returns the uri of the main service specified in the app manifest @param {object} oManifest - Manifest of the component @returns {string} Returns the uri if the manifest is available, otherwise an empty string @public
[ "Returns", "the", "uri", "of", "the", "main", "service", "specified", "in", "the", "app", "manifest" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.fl/src/sap/ui/fl/Utils.js#L1172-L1183
4,068
SAP/openui5
src/sap.ui.fl/src/sap/ui/fl/Utils.js
function(aArray, oObject) { var iObjectIndex = -1; aArray.some(function(oArrayObject, iIndex) { var aKeysArray, aKeysObject; if (!oArrayObject) { aKeysArray = []; } else { aKeysArray = Object.keys(oArrayObject); } if (!oObject) { aKeysObject = []; } else { aKeysObject = Object.keys(oObject); } var bSameNumberOfAttributes = aKeysArray.length === aKeysObject.length; var bContains = bSameNumberOfAttributes && !aKeysArray.some(function(sKey) { return oArrayObject[sKey] !== oObject[sKey]; }); if (bContains) { iObjectIndex = iIndex; } return bContains; }); return iObjectIndex; }
javascript
function(aArray, oObject) { var iObjectIndex = -1; aArray.some(function(oArrayObject, iIndex) { var aKeysArray, aKeysObject; if (!oArrayObject) { aKeysArray = []; } else { aKeysArray = Object.keys(oArrayObject); } if (!oObject) { aKeysObject = []; } else { aKeysObject = Object.keys(oObject); } var bSameNumberOfAttributes = aKeysArray.length === aKeysObject.length; var bContains = bSameNumberOfAttributes && !aKeysArray.some(function(sKey) { return oArrayObject[sKey] !== oObject[sKey]; }); if (bContains) { iObjectIndex = iIndex; } return bContains; }); return iObjectIndex; }
[ "function", "(", "aArray", ",", "oObject", ")", "{", "var", "iObjectIndex", "=", "-", "1", ";", "aArray", ".", "some", "(", "function", "(", "oArrayObject", ",", "iIndex", ")", "{", "var", "aKeysArray", ",", "aKeysObject", ";", "if", "(", "!", "oArrayObject", ")", "{", "aKeysArray", "=", "[", "]", ";", "}", "else", "{", "aKeysArray", "=", "Object", ".", "keys", "(", "oArrayObject", ")", ";", "}", "if", "(", "!", "oObject", ")", "{", "aKeysObject", "=", "[", "]", ";", "}", "else", "{", "aKeysObject", "=", "Object", ".", "keys", "(", "oObject", ")", ";", "}", "var", "bSameNumberOfAttributes", "=", "aKeysArray", ".", "length", "===", "aKeysObject", ".", "length", ";", "var", "bContains", "=", "bSameNumberOfAttributes", "&&", "!", "aKeysArray", ".", "some", "(", "function", "(", "sKey", ")", "{", "return", "oArrayObject", "[", "sKey", "]", "!==", "oObject", "[", "sKey", "]", ";", "}", ")", ";", "if", "(", "bContains", ")", "{", "iObjectIndex", "=", "iIndex", ";", "}", "return", "bContains", ";", "}", ")", ";", "return", "iObjectIndex", ";", "}" ]
Checks if an object is in an array or not and returns the index or -1 @param {object[]} aArray Array of objects @param {object} oObject object that should be part of the array @returns {int} Returns the index of the object in the array, -1 if it is not in the array @public
[ "Checks", "if", "an", "object", "is", "in", "an", "array", "or", "not", "and", "returns", "the", "index", "or", "-", "1" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.fl/src/sap/ui/fl/Utils.js#L1248-L1275
4,069
SAP/openui5
src/sap.ui.fl/src/sap/ui/fl/Utils.js
function(mChanges, sChangeId) { var oResult; Object.keys(mChanges).forEach(function(sControlId) { mChanges[sControlId].some(function(oChange) { if (oChange.getId() === sChangeId) { oResult = oChange; return true; } }); }); return oResult; }
javascript
function(mChanges, sChangeId) { var oResult; Object.keys(mChanges).forEach(function(sControlId) { mChanges[sControlId].some(function(oChange) { if (oChange.getId() === sChangeId) { oResult = oChange; return true; } }); }); return oResult; }
[ "function", "(", "mChanges", ",", "sChangeId", ")", "{", "var", "oResult", ";", "Object", ".", "keys", "(", "mChanges", ")", ".", "forEach", "(", "function", "(", "sControlId", ")", "{", "mChanges", "[", "sControlId", "]", ".", "some", "(", "function", "(", "oChange", ")", "{", "if", "(", "oChange", ".", "getId", "(", ")", "===", "sChangeId", ")", "{", "oResult", "=", "oChange", ";", "return", "true", ";", "}", "}", ")", ";", "}", ")", ";", "return", "oResult", ";", "}" ]
Function that gets a specific change from a map of changes. @param {map} mChanges Map of all changes @param {string} sChangeId Id of the change that should be retrieved @returns {sap.ui.fl.Change | undefined} Returns the change if it is in the map, otherwise undefined
[ "Function", "that", "gets", "a", "specific", "change", "from", "a", "map", "of", "changes", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.fl/src/sap/ui/fl/Utils.js#L1395-L1406
4,070
SAP/openui5
src/sap.ui.fl/src/sap/ui/fl/Utils.js
function(sModuleName) { //TODO: get rid of require async as soon as sap.ui.require has learned Promises as return value return new Promise(function(fnResolve, fnReject) { sap.ui.require([sModuleName], function(oModule) { fnResolve(oModule); }, function(oError) { fnReject(oError); }); }); }
javascript
function(sModuleName) { //TODO: get rid of require async as soon as sap.ui.require has learned Promises as return value return new Promise(function(fnResolve, fnReject) { sap.ui.require([sModuleName], function(oModule) { fnResolve(oModule); }, function(oError) { fnReject(oError); }); }); }
[ "function", "(", "sModuleName", ")", "{", "//TODO: get rid of require async as soon as sap.ui.require has learned Promises as return value", "return", "new", "Promise", "(", "function", "(", "fnResolve", ",", "fnReject", ")", "{", "sap", ".", "ui", ".", "require", "(", "[", "sModuleName", "]", ",", "function", "(", "oModule", ")", "{", "fnResolve", "(", "oModule", ")", ";", "}", ",", "function", "(", "oError", ")", "{", "fnReject", "(", "oError", ")", ";", "}", ")", ";", "}", ")", ";", "}" ]
Wraps the async sap.ui.require call into a Promise. @param {string} sModuleName Name of the required module @returns {Promise} Returns a promise.
[ "Wraps", "the", "async", "sap", ".", "ui", ".", "require", "call", "into", "a", "Promise", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.fl/src/sap/ui/fl/Utils.js#L1413-L1423
4,071
SAP/openui5
src/sap.ui.core/src/sap/ui/model/odata/v4/lib/_Helper.js
function (mMap, sPath, oItem) { if (oItem) { if (!mMap[sPath]) { mMap[sPath] = [oItem]; } else if (mMap[sPath].indexOf(oItem) < 0) { mMap[sPath].push(oItem); } } }
javascript
function (mMap, sPath, oItem) { if (oItem) { if (!mMap[sPath]) { mMap[sPath] = [oItem]; } else if (mMap[sPath].indexOf(oItem) < 0) { mMap[sPath].push(oItem); } } }
[ "function", "(", "mMap", ",", "sPath", ",", "oItem", ")", "{", "if", "(", "oItem", ")", "{", "if", "(", "!", "mMap", "[", "sPath", "]", ")", "{", "mMap", "[", "sPath", "]", "=", "[", "oItem", "]", ";", "}", "else", "if", "(", "mMap", "[", "sPath", "]", ".", "indexOf", "(", "oItem", ")", "<", "0", ")", "{", "mMap", "[", "sPath", "]", ".", "push", "(", "oItem", ")", ";", "}", "}", "}" ]
Adds an item to the given map by path. @param {object} mMap A map from path to a list of items @param {string} sPath The path @param {object} [oItem] The item; if it is <code>undefined</code>, nothing happens
[ "Adds", "an", "item", "to", "the", "given", "map", "by", "path", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/v4/lib/_Helper.js#L37-L45
4,072
SAP/openui5
src/sap.ui.core/src/sap/ui/model/odata/v4/lib/_Helper.js
function (aChildren, aAncestors, mChildren) { if (aAncestors.length) { aChildren.forEach(function (sPath) { var aSegments; if (aAncestors.indexOf(sPath) >= 0) { mChildren[sPath] = true; return; } aSegments = sPath.split("/"); aSegments.pop(); while (aSegments.length) { if (aAncestors.indexOf(aSegments.join("/")) >= 0) { mChildren[sPath] = true; break; } aSegments.pop(); } }); } }
javascript
function (aChildren, aAncestors, mChildren) { if (aAncestors.length) { aChildren.forEach(function (sPath) { var aSegments; if (aAncestors.indexOf(sPath) >= 0) { mChildren[sPath] = true; return; } aSegments = sPath.split("/"); aSegments.pop(); while (aSegments.length) { if (aAncestors.indexOf(aSegments.join("/")) >= 0) { mChildren[sPath] = true; break; } aSegments.pop(); } }); } }
[ "function", "(", "aChildren", ",", "aAncestors", ",", "mChildren", ")", "{", "if", "(", "aAncestors", ".", "length", ")", "{", "aChildren", ".", "forEach", "(", "function", "(", "sPath", ")", "{", "var", "aSegments", ";", "if", "(", "aAncestors", ".", "indexOf", "(", "sPath", ")", ">=", "0", ")", "{", "mChildren", "[", "sPath", "]", "=", "true", ";", "return", ";", "}", "aSegments", "=", "sPath", ".", "split", "(", "\"/\"", ")", ";", "aSegments", ".", "pop", "(", ")", ";", "while", "(", "aSegments", ".", "length", ")", "{", "if", "(", "aAncestors", ".", "indexOf", "(", "aSegments", ".", "join", "(", "\"/\"", ")", ")", ">=", "0", ")", "{", "mChildren", "[", "sPath", "]", "=", "true", ";", "break", ";", "}", "aSegments", ".", "pop", "(", ")", ";", "}", "}", ")", ";", "}", "}" ]
Adds all given children to the given hash set which either appear in the given list or have some ancestor in it. Note: "a/b/c" is deemed a child of the ancestors "a/b" and "a", but not "b" or "a/b/c/d". @param {string[]} aChildren - List of non-empty child paths (unmodified) @param {string[]} aAncestors - List of ancestor paths (unmodified) @param {object} mChildren - Hash set of child paths, maps string to <code>true</code>; is modified
[ "Adds", "all", "given", "children", "to", "the", "given", "hash", "set", "which", "either", "appear", "in", "the", "given", "list", "or", "have", "some", "ancestor", "in", "it", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/v4/lib/_Helper.js#L58-L79
4,073
SAP/openui5
src/sap.ui.core/src/sap/ui/model/odata/v4/lib/_Helper.js
function () { var i, sPath = "", sSegment; for (i = 0; i < arguments.length; i += 1) { sSegment = arguments[i]; if (sSegment || sSegment === 0) { if (sPath && sPath !== "/" && sSegment[0] !== "(") { sPath += "/"; } sPath += sSegment; } } return sPath; }
javascript
function () { var i, sPath = "", sSegment; for (i = 0; i < arguments.length; i += 1) { sSegment = arguments[i]; if (sSegment || sSegment === 0) { if (sPath && sPath !== "/" && sSegment[0] !== "(") { sPath += "/"; } sPath += sSegment; } } return sPath; }
[ "function", "(", ")", "{", "var", "i", ",", "sPath", "=", "\"\"", ",", "sSegment", ";", "for", "(", "i", "=", "0", ";", "i", "<", "arguments", ".", "length", ";", "i", "+=", "1", ")", "{", "sSegment", "=", "arguments", "[", "i", "]", ";", "if", "(", "sSegment", "||", "sSegment", "===", "0", ")", "{", "if", "(", "sPath", "&&", "sPath", "!==", "\"/\"", "&&", "sSegment", "[", "0", "]", "!==", "\"(\"", ")", "{", "sPath", "+=", "\"/\"", ";", "}", "sPath", "+=", "sSegment", ";", "}", "}", "return", "sPath", ";", "}" ]
Builds a relative path from the given arguments. Iterates over the arguments and appends them to the path if defined and non-empty. The arguments are expected to be strings or integers, but this is not checked. Examples: buildPath() --> "" buildPath("base", "relative") --> "base/relative" buildPath("base", "") --> "base" buildPath("", "relative") --> "relative" buildPath("base", undefined, "relative") --> "base/relative" buildPath("base", 42, "relative") --> "base/42/relative" buildPath("base", 0, "relative") --> "base/0/relative" buildPath("base", "('predicate')") --> "base('predicate')" @returns {string} a composite path built from all arguments
[ "Builds", "a", "relative", "path", "from", "the", "given", "arguments", ".", "Iterates", "over", "the", "arguments", "and", "appends", "them", "to", "the", "path", "if", "defined", "and", "non", "-", "empty", ".", "The", "arguments", "are", "expected", "to", "be", "strings", "or", "integers", "but", "this", "is", "not", "checked", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/v4/lib/_Helper.js#L113-L128
4,074
SAP/openui5
src/sap.ui.core/src/sap/ui/model/odata/v4/lib/_Helper.js
function (sPart, bEncodeEquals) { var sEncoded = encodeURI(sPart) .replace(rAmpersand, "%26") .replace(rHash, "%23") .replace(rPlus, "%2B"); if (bEncodeEquals) { sEncoded = sEncoded.replace(rEquals, "%3D"); } return sEncoded; }
javascript
function (sPart, bEncodeEquals) { var sEncoded = encodeURI(sPart) .replace(rAmpersand, "%26") .replace(rHash, "%23") .replace(rPlus, "%2B"); if (bEncodeEquals) { sEncoded = sEncoded.replace(rEquals, "%3D"); } return sEncoded; }
[ "function", "(", "sPart", ",", "bEncodeEquals", ")", "{", "var", "sEncoded", "=", "encodeURI", "(", "sPart", ")", ".", "replace", "(", "rAmpersand", ",", "\"%26\"", ")", ".", "replace", "(", "rHash", ",", "\"%23\"", ")", ".", "replace", "(", "rPlus", ",", "\"%2B\"", ")", ";", "if", "(", "bEncodeEquals", ")", "{", "sEncoded", "=", "sEncoded", ".", "replace", "(", "rEquals", ",", "\"%3D\"", ")", ";", "}", "return", "sEncoded", ";", "}" ]
Encodes a query part, either a key or a value. @param {string} sPart The query part @param {boolean} bEncodeEquals If true, "=" is encoded, too @returns {string} The encoded query part
[ "Encodes", "a", "query", "part", "either", "a", "key", "or", "a", "value", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/v4/lib/_Helper.js#L363-L372
4,075
SAP/openui5
src/sap.ui.core/src/sap/ui/model/odata/v4/lib/_Helper.js
function (sKey, sValue) { return _Helper.encode(sKey, true) + "=" + _Helper.encode(sValue, false); }
javascript
function (sKey, sValue) { return _Helper.encode(sKey, true) + "=" + _Helper.encode(sValue, false); }
[ "function", "(", "sKey", ",", "sValue", ")", "{", "return", "_Helper", ".", "encode", "(", "sKey", ",", "true", ")", "+", "\"=\"", "+", "_Helper", ".", "encode", "(", "sValue", ",", "false", ")", ";", "}" ]
Encodes a key-value pair. @param {string} sKey The key @param {string} sValue The sValue @returns {string} The encoded key-value pair in the form "key=value"
[ "Encodes", "a", "key", "-", "value", "pair", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/v4/lib/_Helper.js#L384-L386
4,076
SAP/openui5
src/sap.ui.core/src/sap/ui/model/odata/v4/lib/_Helper.js
function (mChangeListeners, sPropertyPath, vValue) { var aListeners = mChangeListeners[sPropertyPath], i; if (aListeners) { for (i = 0; i < aListeners.length; i += 1) { aListeners[i].onChange(vValue); } } }
javascript
function (mChangeListeners, sPropertyPath, vValue) { var aListeners = mChangeListeners[sPropertyPath], i; if (aListeners) { for (i = 0; i < aListeners.length; i += 1) { aListeners[i].onChange(vValue); } } }
[ "function", "(", "mChangeListeners", ",", "sPropertyPath", ",", "vValue", ")", "{", "var", "aListeners", "=", "mChangeListeners", "[", "sPropertyPath", "]", ",", "i", ";", "if", "(", "aListeners", ")", "{", "for", "(", "i", "=", "0", ";", "i", "<", "aListeners", ".", "length", ";", "i", "+=", "1", ")", "{", "aListeners", "[", "i", "]", ".", "onChange", "(", "vValue", ")", ";", "}", "}", "}" ]
Fires a change event to all listeners for the given path in mChangeListeners. @param {object} mChangeListeners A map of change listeners by path @param {string} sPropertyPath The path @param {any} vValue The value to report to the listeners
[ "Fires", "a", "change", "event", "to", "all", "listeners", "for", "the", "given", "path", "in", "mChangeListeners", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/v4/lib/_Helper.js#L395-L404
4,077
SAP/openui5
src/sap.ui.core/src/sap/ui/model/odata/v4/lib/_Helper.js
function (mChangeListeners, sPath, oValue, bRemoved) { Object.keys(oValue).forEach(function (sProperty) { var sPropertyPath = _Helper.buildPath(sPath, sProperty), vValue = oValue[sProperty]; if (vValue && typeof vValue === "object") { _Helper.fireChanges(mChangeListeners, sPropertyPath, vValue, bRemoved); } else { _Helper.fireChange(mChangeListeners, sPropertyPath, bRemoved ? undefined : vValue); } }); _Helper.fireChange(mChangeListeners, sPath, bRemoved ? undefined : oValue); }
javascript
function (mChangeListeners, sPath, oValue, bRemoved) { Object.keys(oValue).forEach(function (sProperty) { var sPropertyPath = _Helper.buildPath(sPath, sProperty), vValue = oValue[sProperty]; if (vValue && typeof vValue === "object") { _Helper.fireChanges(mChangeListeners, sPropertyPath, vValue, bRemoved); } else { _Helper.fireChange(mChangeListeners, sPropertyPath, bRemoved ? undefined : vValue); } }); _Helper.fireChange(mChangeListeners, sPath, bRemoved ? undefined : oValue); }
[ "function", "(", "mChangeListeners", ",", "sPath", ",", "oValue", ",", "bRemoved", ")", "{", "Object", ".", "keys", "(", "oValue", ")", ".", "forEach", "(", "function", "(", "sProperty", ")", "{", "var", "sPropertyPath", "=", "_Helper", ".", "buildPath", "(", "sPath", ",", "sProperty", ")", ",", "vValue", "=", "oValue", "[", "sProperty", "]", ";", "if", "(", "vValue", "&&", "typeof", "vValue", "===", "\"object\"", ")", "{", "_Helper", ".", "fireChanges", "(", "mChangeListeners", ",", "sPropertyPath", ",", "vValue", ",", "bRemoved", ")", ";", "}", "else", "{", "_Helper", ".", "fireChange", "(", "mChangeListeners", ",", "sPropertyPath", ",", "bRemoved", "?", "undefined", ":", "vValue", ")", ";", "}", "}", ")", ";", "_Helper", ".", "fireChange", "(", "mChangeListeners", ",", "sPath", ",", "bRemoved", "?", "undefined", ":", "oValue", ")", ";", "}" ]
Iterates recursively over all properties of the given value and fires change events to all listeners. Also fires a change event for the object itself, for example in case of an advertised action. @param {object} mChangeListeners A map of change listeners by path @param {string} sPath The path of the current value @param {object} oValue The value @param {boolean} bRemoved If true the value is assumed to have been removed and the change event reports undefined as the new value
[ "Iterates", "recursively", "over", "all", "properties", "of", "the", "given", "value", "and", "fires", "change", "events", "to", "all", "listeners", ".", "Also", "fires", "a", "change", "event", "for", "the", "object", "itself", "for", "example", "in", "case", "of", "an", "advertised", "action", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/v4/lib/_Helper.js#L417-L431
4,078
SAP/openui5
src/sap.ui.core/src/sap/ui/model/odata/v4/lib/_Helper.js
function (vValue, sType) { if (vValue === undefined) { throw new Error("Illegal value: undefined"); } if (vValue === null) { return "null"; } switch (sType) { case "Edm.Binary": return "binary'" + vValue + "'"; case "Edm.Boolean": case "Edm.Byte": case "Edm.Double": case "Edm.Int16": case "Edm.Int32": case "Edm.SByte": case "Edm.Single": return String(vValue); case "Edm.Date": case "Edm.DateTimeOffset": case "Edm.Decimal": case "Edm.Guid": case "Edm.Int64": case "Edm.TimeOfDay": return vValue; case "Edm.Duration": return "duration'" + vValue + "'"; case "Edm.String": return "'" + vValue.replace(rSingleQuote, "''") + "'"; default: throw new Error("Unsupported type: " + sType); } }
javascript
function (vValue, sType) { if (vValue === undefined) { throw new Error("Illegal value: undefined"); } if (vValue === null) { return "null"; } switch (sType) { case "Edm.Binary": return "binary'" + vValue + "'"; case "Edm.Boolean": case "Edm.Byte": case "Edm.Double": case "Edm.Int16": case "Edm.Int32": case "Edm.SByte": case "Edm.Single": return String(vValue); case "Edm.Date": case "Edm.DateTimeOffset": case "Edm.Decimal": case "Edm.Guid": case "Edm.Int64": case "Edm.TimeOfDay": return vValue; case "Edm.Duration": return "duration'" + vValue + "'"; case "Edm.String": return "'" + vValue.replace(rSingleQuote, "''") + "'"; default: throw new Error("Unsupported type: " + sType); } }
[ "function", "(", "vValue", ",", "sType", ")", "{", "if", "(", "vValue", "===", "undefined", ")", "{", "throw", "new", "Error", "(", "\"Illegal value: undefined\"", ")", ";", "}", "if", "(", "vValue", "===", "null", ")", "{", "return", "\"null\"", ";", "}", "switch", "(", "sType", ")", "{", "case", "\"Edm.Binary\"", ":", "return", "\"binary'\"", "+", "vValue", "+", "\"'\"", ";", "case", "\"Edm.Boolean\"", ":", "case", "\"Edm.Byte\"", ":", "case", "\"Edm.Double\"", ":", "case", "\"Edm.Int16\"", ":", "case", "\"Edm.Int32\"", ":", "case", "\"Edm.SByte\"", ":", "case", "\"Edm.Single\"", ":", "return", "String", "(", "vValue", ")", ";", "case", "\"Edm.Date\"", ":", "case", "\"Edm.DateTimeOffset\"", ":", "case", "\"Edm.Decimal\"", ":", "case", "\"Edm.Guid\"", ":", "case", "\"Edm.Int64\"", ":", "case", "\"Edm.TimeOfDay\"", ":", "return", "vValue", ";", "case", "\"Edm.Duration\"", ":", "return", "\"duration'\"", "+", "vValue", "+", "\"'\"", ";", "case", "\"Edm.String\"", ":", "return", "\"'\"", "+", "vValue", ".", "replace", "(", "rSingleQuote", ",", "\"''\"", ")", "+", "\"'\"", ";", "default", ":", "throw", "new", "Error", "(", "\"Unsupported type: \"", "+", "sType", ")", ";", "}", "}" ]
Formats a given internal value into a literal suitable for usage in URLs. @param {any} vValue The value according to "OData JSON Format Version 4.0" section "7.1 Primitive Value" @param {string} sType The OData Edm type, e.g. "Edm.String" @returns {string} The literal according to "OData Version 4.0 Part 2: URL Conventions" section "5.1.1.6.1 Primitive Literals" @throws {Error} If the value is undefined or the type is not supported
[ "Formats", "a", "given", "internal", "value", "into", "a", "literal", "suitable", "for", "usage", "in", "URLs", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/v4/lib/_Helper.js#L446-L484
4,079
SAP/openui5
src/sap.ui.core/src/sap/ui/model/odata/v4/lib/_Helper.js
function (oInstance, sMetaPath, mTypeForMetaPath) { var aFilters = [], sKey, mKey2Value = _Helper.getKeyProperties(oInstance, sMetaPath, mTypeForMetaPath); if (!mKey2Value) { return undefined; } for (sKey in mKey2Value) { aFilters.push(sKey + " eq " + mKey2Value[sKey]); } return aFilters.join(" and "); }
javascript
function (oInstance, sMetaPath, mTypeForMetaPath) { var aFilters = [], sKey, mKey2Value = _Helper.getKeyProperties(oInstance, sMetaPath, mTypeForMetaPath); if (!mKey2Value) { return undefined; } for (sKey in mKey2Value) { aFilters.push(sKey + " eq " + mKey2Value[sKey]); } return aFilters.join(" and "); }
[ "function", "(", "oInstance", ",", "sMetaPath", ",", "mTypeForMetaPath", ")", "{", "var", "aFilters", "=", "[", "]", ",", "sKey", ",", "mKey2Value", "=", "_Helper", ".", "getKeyProperties", "(", "oInstance", ",", "sMetaPath", ",", "mTypeForMetaPath", ")", ";", "if", "(", "!", "mKey2Value", ")", "{", "return", "undefined", ";", "}", "for", "(", "sKey", "in", "mKey2Value", ")", "{", "aFilters", ".", "push", "(", "sKey", "+", "\" eq \"", "+", "mKey2Value", "[", "sKey", "]", ")", ";", "}", "return", "aFilters", ".", "join", "(", "\" and \"", ")", ";", "}" ]
Returns a filter identifying the given instance via its key properties. @param {object} oInstance Entity instance runtime data @param {string} sMetaPath The absolute meta path of the given instance @param {object} mTypeForMetaPath Maps meta paths to the corresponding entity or complex types @returns {string} A filter using key properties, e.g. "Sector eq 'DevOps' and ID eq 42)", or undefined, if at least one key property is undefined @throws {Error} In case the entity type has no key properties according to metadata
[ "Returns", "a", "filter", "identifying", "the", "given", "instance", "via", "its", "key", "properties", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/v4/lib/_Helper.js#L501-L514
4,080
SAP/openui5
src/sap.ui.core/src/sap/ui/model/odata/v4/lib/_Helper.js
function (oInstance, sMetaPath, mTypeForMetaPath, bReturnAlias) { var bFailed, mKey2Value = {}; bFailed = mTypeForMetaPath[sMetaPath].$Key.some(function (vKey) { var sKey, sKeyPath, aPath, sPropertyName, oType, vValue; if (typeof vKey === "string") { sKey = sKeyPath = vKey; } else { sKey = Object.keys(vKey)[0]; // alias sKeyPath = vKey[sKey]; if (!bReturnAlias) { sKey = sKeyPath; } } aPath = sKeyPath.split("/"); vValue = _Helper.drillDown(oInstance, aPath); if (vValue === undefined) { return true; } // the last path segment is the name of the simple property sPropertyName = aPath.pop(); // find the type containing the simple property oType = mTypeForMetaPath[_Helper.buildPath(sMetaPath, aPath.join("/"))]; vValue = _Helper.formatLiteral(vValue, oType[sPropertyName].$Type); mKey2Value[sKey] = vValue; }); return bFailed ? undefined : mKey2Value; }
javascript
function (oInstance, sMetaPath, mTypeForMetaPath, bReturnAlias) { var bFailed, mKey2Value = {}; bFailed = mTypeForMetaPath[sMetaPath].$Key.some(function (vKey) { var sKey, sKeyPath, aPath, sPropertyName, oType, vValue; if (typeof vKey === "string") { sKey = sKeyPath = vKey; } else { sKey = Object.keys(vKey)[0]; // alias sKeyPath = vKey[sKey]; if (!bReturnAlias) { sKey = sKeyPath; } } aPath = sKeyPath.split("/"); vValue = _Helper.drillDown(oInstance, aPath); if (vValue === undefined) { return true; } // the last path segment is the name of the simple property sPropertyName = aPath.pop(); // find the type containing the simple property oType = mTypeForMetaPath[_Helper.buildPath(sMetaPath, aPath.join("/"))]; vValue = _Helper.formatLiteral(vValue, oType[sPropertyName].$Type); mKey2Value[sKey] = vValue; }); return bFailed ? undefined : mKey2Value; }
[ "function", "(", "oInstance", ",", "sMetaPath", ",", "mTypeForMetaPath", ",", "bReturnAlias", ")", "{", "var", "bFailed", ",", "mKey2Value", "=", "{", "}", ";", "bFailed", "=", "mTypeForMetaPath", "[", "sMetaPath", "]", ".", "$Key", ".", "some", "(", "function", "(", "vKey", ")", "{", "var", "sKey", ",", "sKeyPath", ",", "aPath", ",", "sPropertyName", ",", "oType", ",", "vValue", ";", "if", "(", "typeof", "vKey", "===", "\"string\"", ")", "{", "sKey", "=", "sKeyPath", "=", "vKey", ";", "}", "else", "{", "sKey", "=", "Object", ".", "keys", "(", "vKey", ")", "[", "0", "]", ";", "// alias", "sKeyPath", "=", "vKey", "[", "sKey", "]", ";", "if", "(", "!", "bReturnAlias", ")", "{", "sKey", "=", "sKeyPath", ";", "}", "}", "aPath", "=", "sKeyPath", ".", "split", "(", "\"/\"", ")", ";", "vValue", "=", "_Helper", ".", "drillDown", "(", "oInstance", ",", "aPath", ")", ";", "if", "(", "vValue", "===", "undefined", ")", "{", "return", "true", ";", "}", "// the last path segment is the name of the simple property", "sPropertyName", "=", "aPath", ".", "pop", "(", ")", ";", "// find the type containing the simple property", "oType", "=", "mTypeForMetaPath", "[", "_Helper", ".", "buildPath", "(", "sMetaPath", ",", "aPath", ".", "join", "(", "\"/\"", ")", ")", "]", ";", "vValue", "=", "_Helper", ".", "formatLiteral", "(", "vValue", ",", "oType", "[", "sPropertyName", "]", ".", "$Type", ")", ";", "mKey2Value", "[", "sKey", "]", "=", "vValue", ";", "}", ")", ";", "return", "bFailed", "?", "undefined", ":", "mKey2Value", ";", "}" ]
Returns the key properties mapped to values from the given entity using the given meta data. @param {object} oInstance Entity instance runtime data @param {string} sMetaPath The absolute meta path of the given instance @param {object} mTypeForMetaPath Maps meta paths to the corresponding entity or complex types @param {boolean} [bReturnAlias=false] Whether to return the aliases instead of the keys @returns {object} The key properties map. For the meta data <Key> <PropertyRef Name="Info/ID" Alias="EntityInfoID"/> </Key> the following map is returned: - {EntityInfoID : 42}, if bReturnAlias = true; - {"Info/ID" : 42}, if bReturnAlias = false; - undefined, if at least one key property is undefined. @throws {Error} In case the entity type has no key properties according to metadata
[ "Returns", "the", "key", "properties", "mapped", "to", "values", "from", "the", "given", "entity", "using", "the", "given", "meta", "data", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/v4/lib/_Helper.js#L572-L604
4,081
SAP/openui5
src/sap.ui.core/src/sap/ui/model/odata/v4/lib/_Helper.js
function (mQueryOptions, sPath) { sPath = sPath[0] === "(" ? _Helper.getMetaPath(sPath).slice(1) // avoid leading "/" : _Helper.getMetaPath(sPath); if (sPath) { sPath.split("/").some(function (sSegment) { mQueryOptions = mQueryOptions && mQueryOptions.$expand && mQueryOptions.$expand[sSegment]; return !mQueryOptions; }); } return mQueryOptions && mQueryOptions.$select; }
javascript
function (mQueryOptions, sPath) { sPath = sPath[0] === "(" ? _Helper.getMetaPath(sPath).slice(1) // avoid leading "/" : _Helper.getMetaPath(sPath); if (sPath) { sPath.split("/").some(function (sSegment) { mQueryOptions = mQueryOptions && mQueryOptions.$expand && mQueryOptions.$expand[sSegment]; return !mQueryOptions; }); } return mQueryOptions && mQueryOptions.$select; }
[ "function", "(", "mQueryOptions", ",", "sPath", ")", "{", "sPath", "=", "sPath", "[", "0", "]", "===", "\"(\"", "?", "_Helper", ".", "getMetaPath", "(", "sPath", ")", ".", "slice", "(", "1", ")", "// avoid leading \"/\"", ":", "_Helper", ".", "getMetaPath", "(", "sPath", ")", ";", "if", "(", "sPath", ")", "{", "sPath", ".", "split", "(", "\"/\"", ")", ".", "some", "(", "function", "(", "sSegment", ")", "{", "mQueryOptions", "=", "mQueryOptions", "&&", "mQueryOptions", ".", "$expand", "&&", "mQueryOptions", ".", "$expand", "[", "sSegment", "]", ";", "return", "!", "mQueryOptions", ";", "}", ")", ";", "}", "return", "mQueryOptions", "&&", "mQueryOptions", ".", "$select", ";", "}" ]
Returns the properties that have been selected for the given path. @param {object} [mQueryOptions] A map of query options as returned by {@link sap.ui.model.odata.v4.ODataModel#buildQueryOptions} @param {string} sPath The path of the cache value in the cache @returns {string[]} aSelect The properties that have been selected for the given path or undefined otherwise
[ "Returns", "the", "properties", "that", "have", "been", "selected", "for", "the", "given", "path", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/v4/lib/_Helper.js#L650-L662
4,082
SAP/openui5
src/sap.ui.core/src/sap/ui/model/odata/v4/lib/_Helper.js
function (iNumber) { if (typeof iNumber !== "number" || !isFinite(iNumber)) { return false; } iNumber = Math.abs(iNumber); // The safe integers consist of all integers from -(2^53 - 1) inclusive to 2^53 - 1 // inclusive. // 2^53 - 1 = 9007199254740991 return iNumber <= 9007199254740991 && Math.floor(iNumber) === iNumber; }
javascript
function (iNumber) { if (typeof iNumber !== "number" || !isFinite(iNumber)) { return false; } iNumber = Math.abs(iNumber); // The safe integers consist of all integers from -(2^53 - 1) inclusive to 2^53 - 1 // inclusive. // 2^53 - 1 = 9007199254740991 return iNumber <= 9007199254740991 && Math.floor(iNumber) === iNumber; }
[ "function", "(", "iNumber", ")", "{", "if", "(", "typeof", "iNumber", "!==", "\"number\"", "||", "!", "isFinite", "(", "iNumber", ")", ")", "{", "return", "false", ";", "}", "iNumber", "=", "Math", ".", "abs", "(", "iNumber", ")", ";", "// The safe integers consist of all integers from -(2^53 - 1) inclusive to 2^53 - 1", "// inclusive.", "// 2^53 - 1 = 9007199254740991", "return", "iNumber", "<=", "9007199254740991", "&&", "Math", ".", "floor", "(", "iNumber", ")", "===", "iNumber", ";", "}" ]
Checks that the value is a safe integer. @param {number} iNumber The value @returns {boolean} True if the value is a safe integer
[ "Checks", "that", "the", "value", "is", "a", "safe", "integer", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/v4/lib/_Helper.js#L819-L828
4,083
SAP/openui5
src/sap.ui.core/src/sap/ui/model/odata/v4/lib/_Helper.js
function (sUrl, sBase) { return new URI(sUrl).absoluteTo(sBase).toString() .replace(rEscapedTick, "'") .replace(rEscapedOpenBracket, "(") .replace(rEscapedCloseBracket, ")"); }
javascript
function (sUrl, sBase) { return new URI(sUrl).absoluteTo(sBase).toString() .replace(rEscapedTick, "'") .replace(rEscapedOpenBracket, "(") .replace(rEscapedCloseBracket, ")"); }
[ "function", "(", "sUrl", ",", "sBase", ")", "{", "return", "new", "URI", "(", "sUrl", ")", ".", "absoluteTo", "(", "sBase", ")", ".", "toString", "(", ")", ".", "replace", "(", "rEscapedTick", ",", "\"'\"", ")", ".", "replace", "(", "rEscapedOpenBracket", ",", "\"(\"", ")", ".", "replace", "(", "rEscapedCloseBracket", ",", "\")\"", ")", ";", "}" ]
Make the given URL absolute using the given base URL. The URLs must not contain a host or protocol part. Ensures that key predicates are not %-encoded. @param {string} sUrl The URL @param {string} sBase The base URL @returns {string} The absolute URL
[ "Make", "the", "given", "URL", "absolute", "using", "the", "given", "base", "URL", ".", "The", "URLs", "must", "not", "contain", "a", "host", "or", "protocol", "part", ".", "Ensures", "that", "key", "predicates", "are", "not", "%", "-", "encoded", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/v4/lib/_Helper.js#L841-L846
4,084
SAP/openui5
src/sap.ui.core/src/sap/ui/model/odata/v4/lib/_Helper.js
function (sName) { var iIndex = sName.indexOf("/"); if (iIndex >= 0) { // consider only the first path segment sName = sName.slice(0, iIndex); } // now we have a qualified name, drop the last segment (the name) iIndex = sName.lastIndexOf("."); return iIndex < 0 ? "" : sName.slice(0, iIndex); }
javascript
function (sName) { var iIndex = sName.indexOf("/"); if (iIndex >= 0) { // consider only the first path segment sName = sName.slice(0, iIndex); } // now we have a qualified name, drop the last segment (the name) iIndex = sName.lastIndexOf("."); return iIndex < 0 ? "" : sName.slice(0, iIndex); }
[ "function", "(", "sName", ")", "{", "var", "iIndex", "=", "sName", ".", "indexOf", "(", "\"/\"", ")", ";", "if", "(", "iIndex", ">=", "0", ")", "{", "// consider only the first path segment", "sName", "=", "sName", ".", "slice", "(", "0", ",", "iIndex", ")", ";", "}", "// now we have a qualified name, drop the last segment (the name)", "iIndex", "=", "sName", ".", "lastIndexOf", "(", "\".\"", ")", ";", "return", "iIndex", "<", "0", "?", "\"\"", ":", "sName", ".", "slice", "(", "0", ",", "iIndex", ")", ";", "}" ]
Determines the namespace of the given qualified name. @param {string} sName The qualified name @returns {string} The namespace
[ "Determines", "the", "namespace", "of", "the", "given", "qualified", "name", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/v4/lib/_Helper.js#L886-L897
4,085
SAP/openui5
src/sap.ui.core/src/sap/ui/model/odata/v4/lib/_Helper.js
function (sLiteral, sType, sPath) { function checkNaN(nValue) { if (!isFinite(nValue)) { // this rejects NaN, Infinity, -Infinity throw new Error(sPath + ": Not a valid " + sType + " literal: " + sLiteral); } return nValue; } if (sLiteral === "null") { return null; } switch (sType) { case "Edm.Boolean": return sLiteral === "true"; case "Edm.Byte": case "Edm.Int16": case "Edm.Int32": case "Edm.SByte": return checkNaN(parseInt(sLiteral)); case "Edm.Date": case "Edm.DateTimeOffset": case "Edm.Decimal": case "Edm.Guid": case "Edm.Int64": case "Edm.TimeOfDay": return sLiteral; case "Edm.Double": case "Edm.Single": return sLiteral === "INF" || sLiteral === "-INF" || sLiteral === "NaN" ? sLiteral : checkNaN(parseFloat(sLiteral)); default: throw new Error(sPath + ": Unsupported type: " + sType); } }
javascript
function (sLiteral, sType, sPath) { function checkNaN(nValue) { if (!isFinite(nValue)) { // this rejects NaN, Infinity, -Infinity throw new Error(sPath + ": Not a valid " + sType + " literal: " + sLiteral); } return nValue; } if (sLiteral === "null") { return null; } switch (sType) { case "Edm.Boolean": return sLiteral === "true"; case "Edm.Byte": case "Edm.Int16": case "Edm.Int32": case "Edm.SByte": return checkNaN(parseInt(sLiteral)); case "Edm.Date": case "Edm.DateTimeOffset": case "Edm.Decimal": case "Edm.Guid": case "Edm.Int64": case "Edm.TimeOfDay": return sLiteral; case "Edm.Double": case "Edm.Single": return sLiteral === "INF" || sLiteral === "-INF" || sLiteral === "NaN" ? sLiteral : checkNaN(parseFloat(sLiteral)); default: throw new Error(sPath + ": Unsupported type: " + sType); } }
[ "function", "(", "sLiteral", ",", "sType", ",", "sPath", ")", "{", "function", "checkNaN", "(", "nValue", ")", "{", "if", "(", "!", "isFinite", "(", "nValue", ")", ")", "{", "// this rejects NaN, Infinity, -Infinity", "throw", "new", "Error", "(", "sPath", "+", "\": Not a valid \"", "+", "sType", "+", "\" literal: \"", "+", "sLiteral", ")", ";", "}", "return", "nValue", ";", "}", "if", "(", "sLiteral", "===", "\"null\"", ")", "{", "return", "null", ";", "}", "switch", "(", "sType", ")", "{", "case", "\"Edm.Boolean\"", ":", "return", "sLiteral", "===", "\"true\"", ";", "case", "\"Edm.Byte\"", ":", "case", "\"Edm.Int16\"", ":", "case", "\"Edm.Int32\"", ":", "case", "\"Edm.SByte\"", ":", "return", "checkNaN", "(", "parseInt", "(", "sLiteral", ")", ")", ";", "case", "\"Edm.Date\"", ":", "case", "\"Edm.DateTimeOffset\"", ":", "case", "\"Edm.Decimal\"", ":", "case", "\"Edm.Guid\"", ":", "case", "\"Edm.Int64\"", ":", "case", "\"Edm.TimeOfDay\"", ":", "return", "sLiteral", ";", "case", "\"Edm.Double\"", ":", "case", "\"Edm.Single\"", ":", "return", "sLiteral", "===", "\"INF\"", "||", "sLiteral", "===", "\"-INF\"", "||", "sLiteral", "===", "\"NaN\"", "?", "sLiteral", ":", "checkNaN", "(", "parseFloat", "(", "sLiteral", ")", ")", ";", "default", ":", "throw", "new", "Error", "(", "sPath", "+", "\": Unsupported type: \"", "+", "sType", ")", ";", "}", "}" ]
Parses a literal to the model value. The types "Edm.Binary" and "Edm.String" are unsupported. @param {string} sLiteral The literal value @param {string} sType The type @param {string} sPath The path for this literal (for error messages) @returns {*} The model value @throws {Error} If the type is invalid or unsupported; the function only validates when a conversion is required
[ "Parses", "a", "literal", "to", "the", "model", "value", ".", "The", "types", "Edm", ".", "Binary", "and", "Edm", ".", "String", "are", "unsupported", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/v4/lib/_Helper.js#L910-L946
4,086
SAP/openui5
src/sap.ui.core/src/sap/ui/model/odata/v4/lib/_Helper.js
function (mMap, sPath, oItem) { var aItems = mMap[sPath], iIndex; if (aItems) { iIndex = aItems.indexOf(oItem); if (iIndex >= 0) { if (aItems.length === 1) { delete mMap[sPath]; } else { aItems.splice(iIndex, 1); } } } }
javascript
function (mMap, sPath, oItem) { var aItems = mMap[sPath], iIndex; if (aItems) { iIndex = aItems.indexOf(oItem); if (iIndex >= 0) { if (aItems.length === 1) { delete mMap[sPath]; } else { aItems.splice(iIndex, 1); } } } }
[ "function", "(", "mMap", ",", "sPath", ",", "oItem", ")", "{", "var", "aItems", "=", "mMap", "[", "sPath", "]", ",", "iIndex", ";", "if", "(", "aItems", ")", "{", "iIndex", "=", "aItems", ".", "indexOf", "(", "oItem", ")", ";", "if", "(", "iIndex", ">=", "0", ")", "{", "if", "(", "aItems", ".", "length", "===", "1", ")", "{", "delete", "mMap", "[", "sPath", "]", ";", "}", "else", "{", "aItems", ".", "splice", "(", "iIndex", ",", "1", ")", ";", "}", "}", "}", "}" ]
Removes an item from the given map by path. @param {object} mMap A map from path to a list of items @param {string} sPath The path @param {object} oItem The item
[ "Removes", "an", "item", "from", "the", "given", "map", "by", "path", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/v4/lib/_Helper.js#L977-L991
4,087
SAP/openui5
src/sap.ui.core/src/sap/ui/model/odata/v4/lib/_Helper.js
function (mHeaders) { var vIfMatchValue = mHeaders && mHeaders["If-Match"]; if (vIfMatchValue && typeof vIfMatchValue === "object") { vIfMatchValue = vIfMatchValue["@odata.etag"]; mHeaders = Object.assign({}, mHeaders); if (vIfMatchValue === undefined) { delete mHeaders["If-Match"]; } else { mHeaders["If-Match"] = vIfMatchValue; } } return mHeaders; }
javascript
function (mHeaders) { var vIfMatchValue = mHeaders && mHeaders["If-Match"]; if (vIfMatchValue && typeof vIfMatchValue === "object") { vIfMatchValue = vIfMatchValue["@odata.etag"]; mHeaders = Object.assign({}, mHeaders); if (vIfMatchValue === undefined) { delete mHeaders["If-Match"]; } else { mHeaders["If-Match"] = vIfMatchValue; } } return mHeaders; }
[ "function", "(", "mHeaders", ")", "{", "var", "vIfMatchValue", "=", "mHeaders", "&&", "mHeaders", "[", "\"If-Match\"", "]", ";", "if", "(", "vIfMatchValue", "&&", "typeof", "vIfMatchValue", "===", "\"object\"", ")", "{", "vIfMatchValue", "=", "vIfMatchValue", "[", "\"@odata.etag\"", "]", ";", "mHeaders", "=", "Object", ".", "assign", "(", "{", "}", ",", "mHeaders", ")", ";", "if", "(", "vIfMatchValue", "===", "undefined", ")", "{", "delete", "mHeaders", "[", "\"If-Match\"", "]", ";", "}", "else", "{", "mHeaders", "[", "\"If-Match\"", "]", "=", "vIfMatchValue", ";", "}", "}", "return", "mHeaders", ";", "}" ]
Resolves the "If-Match" header in the given map of request-specific headers. For lazy determination of the ETag, the "If-Match" header may contain an object containing the current ETag. If needed create a copy of the given map and replace the value of the "If-Match" header by the current ETag. @param {object} [mHeaders] Map of request-specific headers. @returns {object} The map of request-specific headers with the resolved If-Match header.
[ "Resolves", "the", "If", "-", "Match", "header", "in", "the", "given", "map", "of", "request", "-", "specific", "headers", ".", "For", "lazy", "determination", "of", "the", "ETag", "the", "If", "-", "Match", "header", "may", "contain", "an", "object", "containing", "the", "current", "ETag", ".", "If", "needed", "create", "a", "copy", "of", "the", "given", "map", "and", "replace", "the", "value", "of", "the", "If", "-", "Match", "header", "by", "the", "current", "ETag", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/v4/lib/_Helper.js#L1004-L1017
4,088
SAP/openui5
src/sap.ui.core/src/sap/ui/model/odata/v4/lib/_Helper.js
function (oObject, sAnnotation, vValue) { var oPrivateNamespace = oObject["@$ui5._"]; if (!oPrivateNamespace) { oPrivateNamespace = oObject["@$ui5._"] = {}; } oPrivateNamespace[sAnnotation] = vValue; }
javascript
function (oObject, sAnnotation, vValue) { var oPrivateNamespace = oObject["@$ui5._"]; if (!oPrivateNamespace) { oPrivateNamespace = oObject["@$ui5._"] = {}; } oPrivateNamespace[sAnnotation] = vValue; }
[ "function", "(", "oObject", ",", "sAnnotation", ",", "vValue", ")", "{", "var", "oPrivateNamespace", "=", "oObject", "[", "\"@$ui5._\"", "]", ";", "if", "(", "!", "oPrivateNamespace", ")", "{", "oPrivateNamespace", "=", "oObject", "[", "\"@$ui5._\"", "]", "=", "{", "}", ";", "}", "oPrivateNamespace", "[", "sAnnotation", "]", "=", "vValue", ";", "}" ]
Sets the new value of the private client-side instance annotation with the given unqualified name at the given object. @param {object} oObject Any object @param {string} sAnnotation The unqualified name of a private client-side instance annotation (hidden inside namespace "@$ui5._") @param {any} vValue The annotation's new value; <code>undefined</code> is a valid value
[ "Sets", "the", "new", "value", "of", "the", "private", "client", "-", "side", "instance", "annotation", "with", "the", "given", "unqualified", "name", "at", "the", "given", "object", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/v4/lib/_Helper.js#L1050-L1057
4,089
SAP/openui5
src/sap.ui.core/src/sap/ui/model/odata/v4/lib/_Helper.js
function (mMap, sTransientPredicate, sPredicate) { var sPath; for (sPath in mMap) { if (sPath.includes(sTransientPredicate)) { // A path may contain multiple different transient predicates ($uid=...) but a // certain transient predicate can only be once in the path and cannot collide // with an identifier (keys must not start with $) and with a value of a key // predicate (they are encoded by encodeURIComponent which encodes $ with %24 // and = with %3D) mMap[sPath.replace(sTransientPredicate, sPredicate)] = mMap[sPath]; delete mMap[sPath]; } } }
javascript
function (mMap, sTransientPredicate, sPredicate) { var sPath; for (sPath in mMap) { if (sPath.includes(sTransientPredicate)) { // A path may contain multiple different transient predicates ($uid=...) but a // certain transient predicate can only be once in the path and cannot collide // with an identifier (keys must not start with $) and with a value of a key // predicate (they are encoded by encodeURIComponent which encodes $ with %24 // and = with %3D) mMap[sPath.replace(sTransientPredicate, sPredicate)] = mMap[sPath]; delete mMap[sPath]; } } }
[ "function", "(", "mMap", ",", "sTransientPredicate", ",", "sPredicate", ")", "{", "var", "sPath", ";", "for", "(", "sPath", "in", "mMap", ")", "{", "if", "(", "sPath", ".", "includes", "(", "sTransientPredicate", ")", ")", "{", "// A path may contain multiple different transient predicates ($uid=...) but a", "// certain transient predicate can only be once in the path and cannot collide", "// with an identifier (keys must not start with $) and with a value of a key", "// predicate (they are encoded by encodeURIComponent which encodes $ with %24", "// and = with %3D)", "mMap", "[", "sPath", ".", "replace", "(", "sTransientPredicate", ",", "sPredicate", ")", "]", "=", "mMap", "[", "sPath", "]", ";", "delete", "mMap", "[", "sPath", "]", ";", "}", "}", "}" ]
Updates certain transient paths from the given map, replacing the given transient predicate with the given key predicate. @param {object} mMap A map from path to anything @param {string} sTransientPredicate A (temporary) key predicate for the transient entity: "($uid=...)" @param {string} sPredicate The key predicate
[ "Updates", "certain", "transient", "paths", "from", "the", "given", "map", "replacing", "the", "given", "transient", "predicate", "with", "the", "given", "key", "predicate", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/v4/lib/_Helper.js#L1291-L1305
4,090
SAP/openui5
src/sap.uxap/src/sap/uxap/component/ObjectPageComponentContainer.js
function () { var oObjectPageLayoutInstance = null; if (this._oComponent && this._oComponent._oView) { oObjectPageLayoutInstance = this._oComponent._oView.byId("ObjectPageLayout"); } else { Log.error("ObjectPageComponentContainer :: cannot find children ObjectPageLayout, has it been rendered already?"); } return oObjectPageLayoutInstance; }
javascript
function () { var oObjectPageLayoutInstance = null; if (this._oComponent && this._oComponent._oView) { oObjectPageLayoutInstance = this._oComponent._oView.byId("ObjectPageLayout"); } else { Log.error("ObjectPageComponentContainer :: cannot find children ObjectPageLayout, has it been rendered already?"); } return oObjectPageLayoutInstance; }
[ "function", "(", ")", "{", "var", "oObjectPageLayoutInstance", "=", "null", ";", "if", "(", "this", ".", "_oComponent", "&&", "this", ".", "_oComponent", ".", "_oView", ")", "{", "oObjectPageLayoutInstance", "=", "this", ".", "_oComponent", ".", "_oView", ".", "byId", "(", "\"ObjectPageLayout\"", ")", ";", "}", "else", "{", "Log", ".", "error", "(", "\"ObjectPageComponentContainer :: cannot find children ObjectPageLayout, has it been rendered already?\"", ")", ";", "}", "return", "oObjectPageLayoutInstance", ";", "}" ]
Returns the instantiated objectPageLayout for further api manipulations or null if not not rendered already. @returns {sap.uxap.ObjectPageLayout} Layout instanse
[ "Returns", "the", "instantiated", "objectPageLayout", "for", "further", "api", "manipulations", "or", "null", "if", "not", "not", "rendered", "already", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.uxap/src/sap/uxap/component/ObjectPageComponentContainer.js#L59-L68
4,091
SAP/openui5
src/sap.ui.core/src/sap/ui/model/odata/v4/ODataBinding.js
ODataBinding
function ODataBinding() { // maps a canonical path of a quasi-absolute or relative binding to a cache object that may // be reused this.mCacheByResourcePath = undefined; this.oCachePromise = SyncPromise.resolve(); this.mCacheQueryOptions = undefined; // used to create cache only for the latest call to #fetchCache this.oFetchCacheCallToken = undefined; // change reason to be used when the binding is resumed this.sResumeChangeReason = ChangeReason.Change; }
javascript
function ODataBinding() { // maps a canonical path of a quasi-absolute or relative binding to a cache object that may // be reused this.mCacheByResourcePath = undefined; this.oCachePromise = SyncPromise.resolve(); this.mCacheQueryOptions = undefined; // used to create cache only for the latest call to #fetchCache this.oFetchCacheCallToken = undefined; // change reason to be used when the binding is resumed this.sResumeChangeReason = ChangeReason.Change; }
[ "function", "ODataBinding", "(", ")", "{", "// maps a canonical path of a quasi-absolute or relative binding to a cache object that may", "// be reused", "this", ".", "mCacheByResourcePath", "=", "undefined", ";", "this", ".", "oCachePromise", "=", "SyncPromise", ".", "resolve", "(", ")", ";", "this", ".", "mCacheQueryOptions", "=", "undefined", ";", "// used to create cache only for the latest call to #fetchCache", "this", ".", "oFetchCacheCallToken", "=", "undefined", ";", "// change reason to be used when the binding is resumed", "this", ".", "sResumeChangeReason", "=", "ChangeReason", ".", "Change", ";", "}" ]
A mixin for all OData V4 bindings. @alias sap.ui.model.odata.v4.ODataBinding @mixin
[ "A", "mixin", "for", "all", "OData", "V4", "bindings", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/v4/ODataBinding.js#L27-L37
4,092
SAP/openui5
src/sap.ui.table/src/sap/ui/table/TableDragAndDropExtension.js
function(oDragSession, oSessionData, sKey) { oDragSession.setComplexData(SESSION_DATA_KEY_NAMESPACE + (sKey == null ? "" : "-" + sKey), oSessionData); }
javascript
function(oDragSession, oSessionData, sKey) { oDragSession.setComplexData(SESSION_DATA_KEY_NAMESPACE + (sKey == null ? "" : "-" + sKey), oSessionData); }
[ "function", "(", "oDragSession", ",", "oSessionData", ",", "sKey", ")", "{", "oDragSession", ".", "setComplexData", "(", "SESSION_DATA_KEY_NAMESPACE", "+", "(", "sKey", "==", "null", "?", "\"\"", ":", "\"-\"", "+", "sKey", ")", ",", "oSessionData", ")", ";", "}" ]
Sets the session data to the drag session. To set the session data that is shared by all table instances, do not specify a key. @param {Object} oDragSession The drag session. @param {any} oSessionData The session data. @param {string} [sKey=undefined] The key of the session data.
[ "Sets", "the", "session", "data", "to", "the", "drag", "session", ".", "To", "set", "the", "session", "data", "that", "is", "shared", "by", "all", "table", "instances", "do", "not", "specify", "a", "key", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/TableDragAndDropExtension.js#L33-L35
4,093
SAP/openui5
src/sap.ui.layout/src/sap/ui/layout/cssgrid/VirtualGrid.js
expandVertically
function expandVertically() { var growWith = 0; for (var i = 0; i < this.virtualGridMatrix.length; i++) { if (this.virtualGridMatrix[i][0] !== 0) { growWith++; } } if (growWith > 0) { this.addEmptyRows(growWith); } }
javascript
function expandVertically() { var growWith = 0; for (var i = 0; i < this.virtualGridMatrix.length; i++) { if (this.virtualGridMatrix[i][0] !== 0) { growWith++; } } if (growWith > 0) { this.addEmptyRows(growWith); } }
[ "function", "expandVertically", "(", ")", "{", "var", "growWith", "=", "0", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "this", ".", "virtualGridMatrix", ".", "length", ";", "i", "++", ")", "{", "if", "(", "this", ".", "virtualGridMatrix", "[", "i", "]", "[", "0", "]", "!==", "0", ")", "{", "growWith", "++", ";", "}", "}", "if", "(", "growWith", ">", "0", ")", "{", "this", ".", "addEmptyRows", "(", "growWith", ")", ";", "}", "}" ]
Add empty rows at bottom of the virtual grid.
[ "Add", "empty", "rows", "at", "bottom", "of", "the", "virtual", "grid", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.layout/src/sap/ui/layout/cssgrid/VirtualGrid.js#L14-L24
4,094
SAP/openui5
src/sap.ui.table/src/sap/ui/table/TableRenderer.js
collectHeaderSpans
function collectHeaderSpans(oColumn, index, aCols) { var colSpan = TableUtils.Column.getHeaderSpan(oColumn, iRow), iColIndex; if (nSpan < 1) { if (colSpan > 1) { // In case when a user makes some of the underlying columns invisible, adjust colspan iColIndex = oColumn.getIndex(); colSpan = aCols.slice(index + 1, index + colSpan).reduce(function(span, column){ return column.getIndex() - iColIndex < colSpan ? span + 1 : span; }, 1); } oColumn._nSpan = nSpan = colSpan; iLastVisibleCol = index; } else { //Render column header but this is invisible because of the previous span oColumn._nSpan = 0; } nSpan--; }
javascript
function collectHeaderSpans(oColumn, index, aCols) { var colSpan = TableUtils.Column.getHeaderSpan(oColumn, iRow), iColIndex; if (nSpan < 1) { if (colSpan > 1) { // In case when a user makes some of the underlying columns invisible, adjust colspan iColIndex = oColumn.getIndex(); colSpan = aCols.slice(index + 1, index + colSpan).reduce(function(span, column){ return column.getIndex() - iColIndex < colSpan ? span + 1 : span; }, 1); } oColumn._nSpan = nSpan = colSpan; iLastVisibleCol = index; } else { //Render column header but this is invisible because of the previous span oColumn._nSpan = 0; } nSpan--; }
[ "function", "collectHeaderSpans", "(", "oColumn", ",", "index", ",", "aCols", ")", "{", "var", "colSpan", "=", "TableUtils", ".", "Column", ".", "getHeaderSpan", "(", "oColumn", ",", "iRow", ")", ",", "iColIndex", ";", "if", "(", "nSpan", "<", "1", ")", "{", "if", "(", "colSpan", ">", "1", ")", "{", "// In case when a user makes some of the underlying columns invisible, adjust colspan", "iColIndex", "=", "oColumn", ".", "getIndex", "(", ")", ";", "colSpan", "=", "aCols", ".", "slice", "(", "index", "+", "1", ",", "index", "+", "colSpan", ")", ".", "reduce", "(", "function", "(", "span", ",", "column", ")", "{", "return", "column", ".", "getIndex", "(", ")", "-", "iColIndex", "<", "colSpan", "?", "span", "+", "1", ":", "span", ";", "}", ",", "1", ")", ";", "}", "oColumn", ".", "_nSpan", "=", "nSpan", "=", "colSpan", ";", "iLastVisibleCol", "=", "index", ";", "}", "else", "{", "//Render column header but this is invisible because of the previous span", "oColumn", ".", "_nSpan", "=", "0", ";", "}", "nSpan", "--", ";", "}" ]
collect header spans and find the last visible column header
[ "collect", "header", "spans", "and", "find", "the", "last", "visible", "column", "header" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/TableRenderer.js#L992-L1012
4,095
SAP/openui5
src/sap.m/src/sap/m/MenuButton.js
isForbiddenType
function isForbiddenType(sType) { var aTypes = [ButtonType.Up, ButtonType.Back, ButtonType.Unstyled]; return aTypes.indexOf(sType) !== -1; }
javascript
function isForbiddenType(sType) { var aTypes = [ButtonType.Up, ButtonType.Back, ButtonType.Unstyled]; return aTypes.indexOf(sType) !== -1; }
[ "function", "isForbiddenType", "(", "sType", ")", "{", "var", "aTypes", "=", "[", "ButtonType", ".", "Up", ",", "ButtonType", ".", "Back", ",", "ButtonType", ".", "Unstyled", "]", ";", "return", "aTypes", ".", "indexOf", "(", "sType", ")", "!==", "-", "1", ";", "}" ]
Several button type property values are not allowed
[ "Several", "button", "type", "property", "values", "are", "not", "allowed" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.m/src/sap/m/MenuButton.js#L528-L531
4,096
SAP/openui5
src/sap.ui.core/src/sap/ui/events/jquery/EventTriggerHook.js
_applyTriggerHook
function _applyTriggerHook(sEventType) { if (!jQuery.event.special[sEventType]) { jQuery.event.special[sEventType] = {}; } var oSpecialEvent = jQuery.event.special[sEventType], originalTriggerHook = oSpecialEvent.trigger; oSpecialEvent.trigger = fnTriggerHook; return originalTriggerHook; }
javascript
function _applyTriggerHook(sEventType) { if (!jQuery.event.special[sEventType]) { jQuery.event.special[sEventType] = {}; } var oSpecialEvent = jQuery.event.special[sEventType], originalTriggerHook = oSpecialEvent.trigger; oSpecialEvent.trigger = fnTriggerHook; return originalTriggerHook; }
[ "function", "_applyTriggerHook", "(", "sEventType", ")", "{", "if", "(", "!", "jQuery", ".", "event", ".", "special", "[", "sEventType", "]", ")", "{", "jQuery", ".", "event", ".", "special", "[", "sEventType", "]", "=", "{", "}", ";", "}", "var", "oSpecialEvent", "=", "jQuery", ".", "event", ".", "special", "[", "sEventType", "]", ",", "originalTriggerHook", "=", "oSpecialEvent", ".", "trigger", ";", "oSpecialEvent", ".", "trigger", "=", "fnTriggerHook", ";", "return", "originalTriggerHook", ";", "}" ]
Register special jQuery.trigger event hook
[ "Register", "special", "jQuery", ".", "trigger", "event", "hook" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/events/jquery/EventTriggerHook.js#L52-L62
4,097
SAP/openui5
src/sap.ui.core/src/sap/ui/events/jquery/EventTriggerHook.js
suppressTriggeredEvent
function suppressTriggeredEvent(sEventType, oDomRef, aExcludedDomRefs) { var mEventInfo = mTriggerEventInfo[sEventType]; var sId = uid(); if (!mEventInfo) { mEventInfo = mTriggerEventInfo[sEventType] = { domRefs: {}, originalTriggerHook: _applyTriggerHook(sEventType) }; } mEventInfo.domRefs[sId] = { domRef: oDomRef, excludedDomRefs: [].concat(aExcludedDomRefs) }; return { id: sId, type: sEventType }; }
javascript
function suppressTriggeredEvent(sEventType, oDomRef, aExcludedDomRefs) { var mEventInfo = mTriggerEventInfo[sEventType]; var sId = uid(); if (!mEventInfo) { mEventInfo = mTriggerEventInfo[sEventType] = { domRefs: {}, originalTriggerHook: _applyTriggerHook(sEventType) }; } mEventInfo.domRefs[sId] = { domRef: oDomRef, excludedDomRefs: [].concat(aExcludedDomRefs) }; return { id: sId, type: sEventType }; }
[ "function", "suppressTriggeredEvent", "(", "sEventType", ",", "oDomRef", ",", "aExcludedDomRefs", ")", "{", "var", "mEventInfo", "=", "mTriggerEventInfo", "[", "sEventType", "]", ";", "var", "sId", "=", "uid", "(", ")", ";", "if", "(", "!", "mEventInfo", ")", "{", "mEventInfo", "=", "mTriggerEventInfo", "[", "sEventType", "]", "=", "{", "domRefs", ":", "{", "}", ",", "originalTriggerHook", ":", "_applyTriggerHook", "(", "sEventType", ")", "}", ";", "}", "mEventInfo", ".", "domRefs", "[", "sId", "]", "=", "{", "domRef", ":", "oDomRef", ",", "excludedDomRefs", ":", "[", "]", ".", "concat", "(", "aExcludedDomRefs", ")", "}", ";", "return", "{", "id", ":", "sId", ",", "type", ":", "sEventType", "}", ";", "}" ]
Suppress jQuery.trigger events for a given DOM element mTriggerEventInfo example: mTriggerEventInfo: { 'EventType': { domRefs: { 'DomRefId': { domRef: 'DomRef', excludedDomRefs: aDomRefs } }, hookApplied: 'boolean' originalTriggerHook: 'fnHook' } } @param {string} sEventType Event type to suppress jQuery.trigger for @param {Element} oDomRef DOM element to suppress events from jQuery.trigger @param {Element|Array} [aExcludedDomRefs] DomRefs excluded from suppress events from jQuery.trigger @returns {Object} oHandler The suppression handler. Needed for releasing the suppression @private
[ "Suppress", "jQuery", ".", "trigger", "events", "for", "a", "given", "DOM", "element" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/events/jquery/EventTriggerHook.js#L88-L108
4,098
SAP/openui5
src/sap.ui.core/src/sap/ui/events/jquery/EventTriggerHook.js
releaseTriggeredEvent
function releaseTriggeredEvent(oHandler) { if (!oHandler) { Log.error("Release trigger events must not be called without passing a valid handler!"); return; } var mEventInfo = mTriggerEventInfo[oHandler.type]; if (!mEventInfo) { return; } else if (!mEventInfo.domRefs[oHandler.id] || !mEventInfo.domRefs[oHandler.id].domRef) { Log.warning("Release trigger event for event type " + oHandler.type + "on Control " + oHandler.id + ": DomRef does not exists"); return; } delete mEventInfo.domRefs[oHandler.id]; }
javascript
function releaseTriggeredEvent(oHandler) { if (!oHandler) { Log.error("Release trigger events must not be called without passing a valid handler!"); return; } var mEventInfo = mTriggerEventInfo[oHandler.type]; if (!mEventInfo) { return; } else if (!mEventInfo.domRefs[oHandler.id] || !mEventInfo.domRefs[oHandler.id].domRef) { Log.warning("Release trigger event for event type " + oHandler.type + "on Control " + oHandler.id + ": DomRef does not exists"); return; } delete mEventInfo.domRefs[oHandler.id]; }
[ "function", "releaseTriggeredEvent", "(", "oHandler", ")", "{", "if", "(", "!", "oHandler", ")", "{", "Log", ".", "error", "(", "\"Release trigger events must not be called without passing a valid handler!\"", ")", ";", "return", ";", "}", "var", "mEventInfo", "=", "mTriggerEventInfo", "[", "oHandler", ".", "type", "]", ";", "if", "(", "!", "mEventInfo", ")", "{", "return", ";", "}", "else", "if", "(", "!", "mEventInfo", ".", "domRefs", "[", "oHandler", ".", "id", "]", "||", "!", "mEventInfo", ".", "domRefs", "[", "oHandler", ".", "id", "]", ".", "domRef", ")", "{", "Log", ".", "warning", "(", "\"Release trigger event for event type \"", "+", "oHandler", ".", "type", "+", "\"on Control \"", "+", "oHandler", ".", "id", "+", "\": DomRef does not exists\"", ")", ";", "return", ";", "}", "delete", "mEventInfo", ".", "domRefs", "[", "oHandler", ".", "id", "]", ";", "}" ]
Stop suppressing jQuery.trigger events for a given DOM element @param {Object} oHandler The suppression handler @private
[ "Stop", "suppressing", "jQuery", ".", "trigger", "events", "for", "a", "given", "DOM", "element" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/events/jquery/EventTriggerHook.js#L116-L132
4,099
SAP/openui5
src/sap.ui.documentation/src/sap/ui/documentation/sdk/controller/util/IndexWorker.js
fetchIndex
function fetchIndex() { return new Promise(function(resolve, reject) { var oIndex = oIndexCache["index"], oSerializedIndex; if (oIndex) { resolve(oIndex); return; } var req = new XMLHttpRequest(), onload = function (oEvent) { oSerializedIndex = oEvent.target.response || oEvent.target.responseText; if (typeof oSerializedIndex !== 'object') { // fallback in case the browser does not support automatic JSON parsing oSerializedIndex = JSON.parse(oSerializedIndex); } oSerializedIndex = decompressIndex(oSerializedIndex); overrideLunrTokenizer(); oIndex = lunr.Index.load(oSerializedIndex.lunr); oIndexCache["index"] = oIndex; oIndexCache["docs"] = oSerializedIndex.docs; resolve(oIndex); }; if (!bIsMsieBrowser) { // IE does not support 'json' responseType // (and will throw an error if we attempt to set it nevertheless) req.responseType = 'json'; } req.addEventListener("load", onload, false); req.open("get", URL.SEARCH_INDEX); req.send(); }); }
javascript
function fetchIndex() { return new Promise(function(resolve, reject) { var oIndex = oIndexCache["index"], oSerializedIndex; if (oIndex) { resolve(oIndex); return; } var req = new XMLHttpRequest(), onload = function (oEvent) { oSerializedIndex = oEvent.target.response || oEvent.target.responseText; if (typeof oSerializedIndex !== 'object') { // fallback in case the browser does not support automatic JSON parsing oSerializedIndex = JSON.parse(oSerializedIndex); } oSerializedIndex = decompressIndex(oSerializedIndex); overrideLunrTokenizer(); oIndex = lunr.Index.load(oSerializedIndex.lunr); oIndexCache["index"] = oIndex; oIndexCache["docs"] = oSerializedIndex.docs; resolve(oIndex); }; if (!bIsMsieBrowser) { // IE does not support 'json' responseType // (and will throw an error if we attempt to set it nevertheless) req.responseType = 'json'; } req.addEventListener("load", onload, false); req.open("get", URL.SEARCH_INDEX); req.send(); }); }
[ "function", "fetchIndex", "(", ")", "{", "return", "new", "Promise", "(", "function", "(", "resolve", ",", "reject", ")", "{", "var", "oIndex", "=", "oIndexCache", "[", "\"index\"", "]", ",", "oSerializedIndex", ";", "if", "(", "oIndex", ")", "{", "resolve", "(", "oIndex", ")", ";", "return", ";", "}", "var", "req", "=", "new", "XMLHttpRequest", "(", ")", ",", "onload", "=", "function", "(", "oEvent", ")", "{", "oSerializedIndex", "=", "oEvent", ".", "target", ".", "response", "||", "oEvent", ".", "target", ".", "responseText", ";", "if", "(", "typeof", "oSerializedIndex", "!==", "'object'", ")", "{", "// fallback in case the browser does not support automatic JSON parsing", "oSerializedIndex", "=", "JSON", ".", "parse", "(", "oSerializedIndex", ")", ";", "}", "oSerializedIndex", "=", "decompressIndex", "(", "oSerializedIndex", ")", ";", "overrideLunrTokenizer", "(", ")", ";", "oIndex", "=", "lunr", ".", "Index", ".", "load", "(", "oSerializedIndex", ".", "lunr", ")", ";", "oIndexCache", "[", "\"index\"", "]", "=", "oIndex", ";", "oIndexCache", "[", "\"docs\"", "]", "=", "oSerializedIndex", ".", "docs", ";", "resolve", "(", "oIndex", ")", ";", "}", ";", "if", "(", "!", "bIsMsieBrowser", ")", "{", "// IE does not support 'json' responseType", "// (and will throw an error if we attempt to set it nevertheless)", "req", ".", "responseType", "=", "'json'", ";", "}", "req", ".", "addEventListener", "(", "\"load\"", ",", "onload", ",", "false", ")", ";", "req", ".", "open", "(", "\"get\"", ",", "URL", ".", "SEARCH_INDEX", ")", ";", "req", ".", "send", "(", ")", ";", "}", ")", ";", "}" ]
Obtains the index via network request or from cache @returns {Promise<any>}
[ "Obtains", "the", "index", "via", "network", "request", "or", "from", "cache" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.documentation/src/sap/ui/documentation/sdk/controller/util/IndexWorker.js#L106-L149