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,400
SAP/openui5
src/sap.ui.dt/src/sap/ui/dt/ContextMenuControl.js
function (bExplicitClose) { if (this.getPopover()) { if (bExplicitClose) { this.getPopover(true).close(); this.getPopover(false).close(); } // deletes the overflow button if there is one if (this.getProperty("buttons").length > this.getProperty("maxButtonsDisplayed")) { this.setProperty("buttons", this.getProperty("buttons").splice(0, this.getProperty("buttons").length - 1)); this.getFlexbox().removeItem(this.getButtons().length - 1); } } return this; }
javascript
function (bExplicitClose) { if (this.getPopover()) { if (bExplicitClose) { this.getPopover(true).close(); this.getPopover(false).close(); } // deletes the overflow button if there is one if (this.getProperty("buttons").length > this.getProperty("maxButtonsDisplayed")) { this.setProperty("buttons", this.getProperty("buttons").splice(0, this.getProperty("buttons").length - 1)); this.getFlexbox().removeItem(this.getButtons().length - 1); } } return this; }
[ "function", "(", "bExplicitClose", ")", "{", "if", "(", "this", ".", "getPopover", "(", ")", ")", "{", "if", "(", "bExplicitClose", ")", "{", "this", ".", "getPopover", "(", "true", ")", ".", "close", "(", ")", ";", "this", ".", "getPopover", "(", "false", ")", ".", "close", "(", ")", ";", "}", "// deletes the overflow button if there is one", "if", "(", "this", ".", "getProperty", "(", "\"buttons\"", ")", ".", "length", ">", "this", ".", "getProperty", "(", "\"maxButtonsDisplayed\"", ")", ")", "{", "this", ".", "setProperty", "(", "\"buttons\"", ",", "this", ".", "getProperty", "(", "\"buttons\"", ")", ".", "splice", "(", "0", ",", "this", ".", "getProperty", "(", "\"buttons\"", ")", ".", "length", "-", "1", ")", ")", ";", "this", ".", "getFlexbox", "(", ")", ".", "removeItem", "(", "this", ".", "getButtons", "(", ")", ".", "length", "-", "1", ")", ";", "}", "}", "return", "this", ";", "}" ]
Closes the ContextMenu. @param {boolean} bExplicitClose true if the popover has to be closed explicitly from the contextMenu. Otherwhise the closing is handled by the popover itself @return {sap.m.ContextMenu} Reference to this in order to allow method chaining @public
[ "Closes", "the", "ContextMenu", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.dt/src/sap/ui/dt/ContextMenuControl.js#L619-L634
4,401
SAP/openui5
src/sap.ui.dt/src/sap/ui/dt/ContextMenuControl.js
function (iIndex) { this.setProperty("buttons", this.getProperty("buttons").splice(iIndex, 1)); this.getFlexbox(true).removeItem(iIndex); return this.getFlexbox(false).removeItem(iIndex); }
javascript
function (iIndex) { this.setProperty("buttons", this.getProperty("buttons").splice(iIndex, 1)); this.getFlexbox(true).removeItem(iIndex); return this.getFlexbox(false).removeItem(iIndex); }
[ "function", "(", "iIndex", ")", "{", "this", ".", "setProperty", "(", "\"buttons\"", ",", "this", ".", "getProperty", "(", "\"buttons\"", ")", ".", "splice", "(", "iIndex", ",", "1", ")", ")", ";", "this", ".", "getFlexbox", "(", "true", ")", ".", "removeItem", "(", "iIndex", ")", ";", "return", "this", ".", "getFlexbox", "(", "false", ")", ".", "removeItem", "(", "iIndex", ")", ";", "}" ]
Removes a button from the ContextMenu. @param {int} iIndex the button to remove or its index or id @return {sap.m.OverflowToolbarButton} The removed button or null @public
[ "Removes", "a", "button", "from", "the", "ContextMenu", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.dt/src/sap/ui/dt/ContextMenuControl.js#L642-L646
4,402
SAP/openui5
src/sap.ui.dt/src/sap/ui/dt/ContextMenuControl.js
function (_aButtons, fnContextMenuHandler, aElementOverlays) { this.removeAllButtons(); _aButtons.forEach(function (oButton) { this.addMenuButton(oButton, fnContextMenuHandler, aElementOverlays); }.bind(this)); }
javascript
function (_aButtons, fnContextMenuHandler, aElementOverlays) { this.removeAllButtons(); _aButtons.forEach(function (oButton) { this.addMenuButton(oButton, fnContextMenuHandler, aElementOverlays); }.bind(this)); }
[ "function", "(", "_aButtons", ",", "fnContextMenuHandler", ",", "aElementOverlays", ")", "{", "this", ".", "removeAllButtons", "(", ")", ";", "_aButtons", ".", "forEach", "(", "function", "(", "oButton", ")", "{", "this", ".", "addMenuButton", "(", "oButton", ",", "fnContextMenuHandler", ",", "aElementOverlays", ")", ";", "}", ".", "bind", "(", "this", ")", ")", ";", "}" ]
Sets the Buttons of the ContextMenu @param {Array} _aButtons the Buttons to insert @param {function} fnContextMenuHandler - the source @param {sap.ui.dt.ElementOverlay[]} aElementOverlays - Target overlays @public
[ "Sets", "the", "Buttons", "of", "the", "ContextMenu" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.dt/src/sap/ui/dt/ContextMenuControl.js#L687-L693
4,403
SAP/openui5
src/sap.ui.dt/src/sap/ui/dt/ContextMenuControl.js
function (oEvent) { if (document.activeElement) { var sId = document.activeElement.id; switch (oEvent.key) { case "ArrowRight": this._changeFocusOnButtons(sId); break; case "ArrowLeft": this._changeFocusOnButtons(sId, true); break; case "ArrowUp": this._changeFocusOnButtons(sId, true); break; case "ArrowDown": this._changeFocusOnButtons(sId); break; default: break; } } }
javascript
function (oEvent) { if (document.activeElement) { var sId = document.activeElement.id; switch (oEvent.key) { case "ArrowRight": this._changeFocusOnButtons(sId); break; case "ArrowLeft": this._changeFocusOnButtons(sId, true); break; case "ArrowUp": this._changeFocusOnButtons(sId, true); break; case "ArrowDown": this._changeFocusOnButtons(sId); break; default: break; } } }
[ "function", "(", "oEvent", ")", "{", "if", "(", "document", ".", "activeElement", ")", "{", "var", "sId", "=", "document", ".", "activeElement", ".", "id", ";", "switch", "(", "oEvent", ".", "key", ")", "{", "case", "\"ArrowRight\"", ":", "this", ".", "_changeFocusOnButtons", "(", "sId", ")", ";", "break", ";", "case", "\"ArrowLeft\"", ":", "this", ".", "_changeFocusOnButtons", "(", "sId", ",", "true", ")", ";", "break", ";", "case", "\"ArrowUp\"", ":", "this", ".", "_changeFocusOnButtons", "(", "sId", ",", "true", ")", ";", "break", ";", "case", "\"ArrowDown\"", ":", "this", ".", "_changeFocusOnButtons", "(", "sId", ")", ";", "break", ";", "default", ":", "break", ";", "}", "}", "}" ]
Changes the focus inside the ContextMenu if an Arrowkey is pressed Allows Safari users to navigate through the ContextMenu using tab and tab+shift @param {jQuery.Event} oEvent the keyboard event
[ "Changes", "the", "focus", "inside", "the", "ContextMenu", "if", "an", "Arrowkey", "is", "pressed", "Allows", "Safari", "users", "to", "navigate", "through", "the", "ContextMenu", "using", "tab", "and", "tab", "+", "shift" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.dt/src/sap/ui/dt/ContextMenuControl.js#L789-L809
4,404
SAP/openui5
src/sap.ui.dt/src/sap/ui/dt/ContextMenuControl.js
function (sId, bPrevious) { this.getButtons().some(function (oButton, iIndex, aArray) { if (sId === oButton.getId()) { if (bPrevious) { this._setFocusOnPreviousButton(aArray, iIndex); } else { this._setFocusOnNextButton(aArray, iIndex); } return true; } }.bind(this)); }
javascript
function (sId, bPrevious) { this.getButtons().some(function (oButton, iIndex, aArray) { if (sId === oButton.getId()) { if (bPrevious) { this._setFocusOnPreviousButton(aArray, iIndex); } else { this._setFocusOnNextButton(aArray, iIndex); } return true; } }.bind(this)); }
[ "function", "(", "sId", ",", "bPrevious", ")", "{", "this", ".", "getButtons", "(", ")", ".", "some", "(", "function", "(", "oButton", ",", "iIndex", ",", "aArray", ")", "{", "if", "(", "sId", "===", "oButton", ".", "getId", "(", ")", ")", "{", "if", "(", "bPrevious", ")", "{", "this", ".", "_setFocusOnPreviousButton", "(", "aArray", ",", "iIndex", ")", ";", "}", "else", "{", "this", ".", "_setFocusOnNextButton", "(", "aArray", ",", "iIndex", ")", ";", "}", "return", "true", ";", "}", "}", ".", "bind", "(", "this", ")", ")", ";", "}" ]
Changes the focus for the Buttons in ContextMenu @param {string} sId the ID of the currently focused buttons @param {boolean} bPrevious if true, the previous button is selected instead of the next
[ "Changes", "the", "focus", "for", "the", "Buttons", "in", "ContextMenu" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.dt/src/sap/ui/dt/ContextMenuControl.js#L816-L827
4,405
SAP/openui5
src/sap.ui.dt/src/sap/ui/dt/ContextMenuControl.js
function (aButtons, iIndex) { for (var i0 = iIndex - 1; i0 >= 0; i0--) { if (this._setFocusOnButton(aButtons[i0])) { return; } } for (var i1 = aButtons.length - 1; i1 >= iIndex; i1--) { if (this._setFocusOnButton(aButtons[i1])) { return; } } }
javascript
function (aButtons, iIndex) { for (var i0 = iIndex - 1; i0 >= 0; i0--) { if (this._setFocusOnButton(aButtons[i0])) { return; } } for (var i1 = aButtons.length - 1; i1 >= iIndex; i1--) { if (this._setFocusOnButton(aButtons[i1])) { return; } } }
[ "function", "(", "aButtons", ",", "iIndex", ")", "{", "for", "(", "var", "i0", "=", "iIndex", "-", "1", ";", "i0", ">=", "0", ";", "i0", "--", ")", "{", "if", "(", "this", ".", "_setFocusOnButton", "(", "aButtons", "[", "i0", "]", ")", ")", "{", "return", ";", "}", "}", "for", "(", "var", "i1", "=", "aButtons", ".", "length", "-", "1", ";", "i1", ">=", "iIndex", ";", "i1", "--", ")", "{", "if", "(", "this", ".", "_setFocusOnButton", "(", "aButtons", "[", "i1", "]", ")", ")", "{", "return", ";", "}", "}", "}" ]
Sets focus on previous button @param {Array} aButtons the array of Buttons @param {int} iIndex the index of the currently focused buttons
[ "Sets", "focus", "on", "previous", "button" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.dt/src/sap/ui/dt/ContextMenuControl.js#L853-L865
4,406
SAP/openui5
src/sap.ui.rta/src/sap/ui/rta/plugin/RTAElementMover.js
fnIsValidForMove
function fnIsValidForMove(oOverlay, bOnRegistration) { var bValid = false, oDesignTimeMetadata = oOverlay.getDesignTimeMetadata(), oParentElementOverlay = oOverlay.getParentElementOverlay(); if (!oDesignTimeMetadata || !oParentElementOverlay) { return false; } var oRelevantContainer = oOverlay.getRelevantContainer(); var oRelevantContainerOverlay = OverlayRegistry.getOverlay(oRelevantContainer); if (!oRelevantContainerOverlay) { return false; } bValid = this.isMoveAvailableOnRelevantContainer(oOverlay); if (bValid) { bValid = this.oBasePlugin.hasStableId(oOverlay) && this.oBasePlugin.hasStableId(oParentElementOverlay) && this.oBasePlugin.hasStableId(oRelevantContainerOverlay); } // element is only valid for move if it can be moved to somewhere else if (bValid) { var aOverlays = OverlayUtil.findAllUniqueAggregationOverlaysInContainer(oOverlay, oRelevantContainerOverlay); var aValidAggregationOverlays = aOverlays.filter(function(oAggregationOverlay) { return this.checkTargetZone(oAggregationOverlay, oOverlay, bOnRegistration); }.bind(this)); if (aValidAggregationOverlays.length < 1) { bValid = false; } else if (aValidAggregationOverlays.length === 1) { var aVisibleOverlays = aValidAggregationOverlays[0].getChildren().filter(function(oChildOverlay) { var oChildElement = oChildOverlay.getElement(); // At least one sibling has to be visible and still attached to the parent // In some edge cases, the child element is not available anymore (element already got destroyed) return (oChildElement && oChildElement.getVisible() && oChildElement.getParent()); }); bValid = aVisibleOverlays.length > 1; } } return bValid; }
javascript
function fnIsValidForMove(oOverlay, bOnRegistration) { var bValid = false, oDesignTimeMetadata = oOverlay.getDesignTimeMetadata(), oParentElementOverlay = oOverlay.getParentElementOverlay(); if (!oDesignTimeMetadata || !oParentElementOverlay) { return false; } var oRelevantContainer = oOverlay.getRelevantContainer(); var oRelevantContainerOverlay = OverlayRegistry.getOverlay(oRelevantContainer); if (!oRelevantContainerOverlay) { return false; } bValid = this.isMoveAvailableOnRelevantContainer(oOverlay); if (bValid) { bValid = this.oBasePlugin.hasStableId(oOverlay) && this.oBasePlugin.hasStableId(oParentElementOverlay) && this.oBasePlugin.hasStableId(oRelevantContainerOverlay); } // element is only valid for move if it can be moved to somewhere else if (bValid) { var aOverlays = OverlayUtil.findAllUniqueAggregationOverlaysInContainer(oOverlay, oRelevantContainerOverlay); var aValidAggregationOverlays = aOverlays.filter(function(oAggregationOverlay) { return this.checkTargetZone(oAggregationOverlay, oOverlay, bOnRegistration); }.bind(this)); if (aValidAggregationOverlays.length < 1) { bValid = false; } else if (aValidAggregationOverlays.length === 1) { var aVisibleOverlays = aValidAggregationOverlays[0].getChildren().filter(function(oChildOverlay) { var oChildElement = oChildOverlay.getElement(); // At least one sibling has to be visible and still attached to the parent // In some edge cases, the child element is not available anymore (element already got destroyed) return (oChildElement && oChildElement.getVisible() && oChildElement.getParent()); }); bValid = aVisibleOverlays.length > 1; } } return bValid; }
[ "function", "fnIsValidForMove", "(", "oOverlay", ",", "bOnRegistration", ")", "{", "var", "bValid", "=", "false", ",", "oDesignTimeMetadata", "=", "oOverlay", ".", "getDesignTimeMetadata", "(", ")", ",", "oParentElementOverlay", "=", "oOverlay", ".", "getParentElementOverlay", "(", ")", ";", "if", "(", "!", "oDesignTimeMetadata", "||", "!", "oParentElementOverlay", ")", "{", "return", "false", ";", "}", "var", "oRelevantContainer", "=", "oOverlay", ".", "getRelevantContainer", "(", ")", ";", "var", "oRelevantContainerOverlay", "=", "OverlayRegistry", ".", "getOverlay", "(", "oRelevantContainer", ")", ";", "if", "(", "!", "oRelevantContainerOverlay", ")", "{", "return", "false", ";", "}", "bValid", "=", "this", ".", "isMoveAvailableOnRelevantContainer", "(", "oOverlay", ")", ";", "if", "(", "bValid", ")", "{", "bValid", "=", "this", ".", "oBasePlugin", ".", "hasStableId", "(", "oOverlay", ")", "&&", "this", ".", "oBasePlugin", ".", "hasStableId", "(", "oParentElementOverlay", ")", "&&", "this", ".", "oBasePlugin", ".", "hasStableId", "(", "oRelevantContainerOverlay", ")", ";", "}", "// element is only valid for move if it can be moved to somewhere else", "if", "(", "bValid", ")", "{", "var", "aOverlays", "=", "OverlayUtil", ".", "findAllUniqueAggregationOverlaysInContainer", "(", "oOverlay", ",", "oRelevantContainerOverlay", ")", ";", "var", "aValidAggregationOverlays", "=", "aOverlays", ".", "filter", "(", "function", "(", "oAggregationOverlay", ")", "{", "return", "this", ".", "checkTargetZone", "(", "oAggregationOverlay", ",", "oOverlay", ",", "bOnRegistration", ")", ";", "}", ".", "bind", "(", "this", ")", ")", ";", "if", "(", "aValidAggregationOverlays", ".", "length", "<", "1", ")", "{", "bValid", "=", "false", ";", "}", "else", "if", "(", "aValidAggregationOverlays", ".", "length", "===", "1", ")", "{", "var", "aVisibleOverlays", "=", "aValidAggregationOverlays", "[", "0", "]", ".", "getChildren", "(", ")", ".", "filter", "(", "function", "(", "oChildOverlay", ")", "{", "var", "oChildElement", "=", "oChildOverlay", ".", "getElement", "(", ")", ";", "// At least one sibling has to be visible and still attached to the parent", "// In some edge cases, the child element is not available anymore (element already got destroyed)", "return", "(", "oChildElement", "&&", "oChildElement", ".", "getVisible", "(", ")", "&&", "oChildElement", ".", "getParent", "(", ")", ")", ";", "}", ")", ";", "bValid", "=", "aVisibleOverlays", ".", "length", ">", "1", ";", "}", "}", "return", "bValid", ";", "}" ]
Check if the element is editable for the move @param {sap.ui.dt.Overlay} oOverlay The overlay being moved or the aggregation overlay @param {boolean} bOnRegistration if embedded, false if not @return {boolean} true if editable
[ "Check", "if", "the", "element", "is", "editable", "for", "the", "move" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.rta/src/sap/ui/rta/plugin/RTAElementMover.js#L108-L153
4,407
SAP/openui5
src/sap.ui.core/src/sap/ui/model/odata/v2/ODataTreeBinding.js
function(iStartIndex) { // check in the sections which where loaded for (var i = 0; i < that._mLoadedSections[sNodeId].length; i++) { var oSection = that._mLoadedSections[sNodeId][i]; // try to find i in the loaded sections. If i is within one of the sections it needs not to be loaded again if (iStartIndex >= oSection.startIndex && iStartIndex < oSection.startIndex + oSection.length) { return true; } } // check requested sections where we still wait for an answer }
javascript
function(iStartIndex) { // check in the sections which where loaded for (var i = 0; i < that._mLoadedSections[sNodeId].length; i++) { var oSection = that._mLoadedSections[sNodeId][i]; // try to find i in the loaded sections. If i is within one of the sections it needs not to be loaded again if (iStartIndex >= oSection.startIndex && iStartIndex < oSection.startIndex + oSection.length) { return true; } } // check requested sections where we still wait for an answer }
[ "function", "(", "iStartIndex", ")", "{", "// check in the sections which where loaded", "for", "(", "var", "i", "=", "0", ";", "i", "<", "that", ".", "_mLoadedSections", "[", "sNodeId", "]", ".", "length", ";", "i", "++", ")", "{", "var", "oSection", "=", "that", ".", "_mLoadedSections", "[", "sNodeId", "]", "[", "i", "]", ";", "// try to find i in the loaded sections. If i is within one of the sections it needs not to be loaded again", "if", "(", "iStartIndex", ">=", "oSection", ".", "startIndex", "&&", "iStartIndex", "<", "oSection", ".", "startIndex", "+", "oSection", ".", "length", ")", "{", "return", "true", ";", "}", "}", "// check requested sections where we still wait for an answer", "}" ]
check whether a start index was already requested
[ "check", "whether", "a", "start", "index", "was", "already", "requested" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/v2/ODataTreeBinding.js#L609-L620
4,408
SAP/openui5
src/sap.ui.core/src/sap/ui/model/odata/v2/ODataTreeBinding.js
function (sKey) { var aFiltered = FilterProcessor.apply([sKey], oCombinedFilter, function(vRef, sPath) { var oContext = that.oModel.getContext('/' + vRef); return that.oModel.getProperty(sPath, oContext); }); return aFiltered.length > 0; }
javascript
function (sKey) { var aFiltered = FilterProcessor.apply([sKey], oCombinedFilter, function(vRef, sPath) { var oContext = that.oModel.getContext('/' + vRef); return that.oModel.getProperty(sPath, oContext); }); return aFiltered.length > 0; }
[ "function", "(", "sKey", ")", "{", "var", "aFiltered", "=", "FilterProcessor", ".", "apply", "(", "[", "sKey", "]", ",", "oCombinedFilter", ",", "function", "(", "vRef", ",", "sPath", ")", "{", "var", "oContext", "=", "that", ".", "oModel", ".", "getContext", "(", "'/'", "+", "vRef", ")", ";", "return", "that", ".", "oModel", ".", "getProperty", "(", "sPath", ",", "oContext", ")", ";", "}", ")", ";", "return", "aFiltered", ".", "length", ">", "0", ";", "}" ]
filter function for recursive filtering, checks if a single key matches the filters
[ "filter", "function", "for", "recursive", "filtering", "checks", "if", "a", "single", "key", "matches", "the", "filters" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/v2/ODataTreeBinding.js#L1647-L1653
4,409
SAP/openui5
src/sap.ui.core/src/sap/ui/model/odata/v2/ODataTreeBinding.js
function(sKey, sPath) { oContext = that.oModel.getContext('/' + sKey); return that.oModel.getProperty(sPath, oContext); }
javascript
function(sKey, sPath) { oContext = that.oModel.getContext('/' + sKey); return that.oModel.getProperty(sPath, oContext); }
[ "function", "(", "sKey", ",", "sPath", ")", "{", "oContext", "=", "that", ".", "oModel", ".", "getContext", "(", "'/'", "+", "sKey", ")", ";", "return", "that", ".", "oModel", ".", "getProperty", "(", "sPath", ",", "oContext", ")", ";", "}" ]
retrieves the sort value
[ "retrieves", "the", "sort", "value" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/v2/ODataTreeBinding.js#L1791-L1794
4,410
SAP/openui5
src/sap.ui.table/src/sap/ui/table/rules/TableHelper.support.js
function(oRuleDef, oRuleset) { oRuleDef = TableSupportHelper.normalizeRule(oRuleDef); var sResult = oRuleset.addRule(oRuleDef); if (sResult != "success") { Log.warning("Support Rule '" + oRuleDef.id + "' for library sap.ui.table not applied: " + sResult); } }
javascript
function(oRuleDef, oRuleset) { oRuleDef = TableSupportHelper.normalizeRule(oRuleDef); var sResult = oRuleset.addRule(oRuleDef); if (sResult != "success") { Log.warning("Support Rule '" + oRuleDef.id + "' for library sap.ui.table not applied: " + sResult); } }
[ "function", "(", "oRuleDef", ",", "oRuleset", ")", "{", "oRuleDef", "=", "TableSupportHelper", ".", "normalizeRule", "(", "oRuleDef", ")", ";", "var", "sResult", "=", "oRuleset", ".", "addRule", "(", "oRuleDef", ")", ";", "if", "(", "sResult", "!=", "\"success\"", ")", "{", "Log", ".", "warning", "(", "\"Support Rule '\"", "+", "oRuleDef", ".", "id", "+", "\"' for library sap.ui.table not applied: \"", "+", "sResult", ")", ";", "}", "}" ]
Normalizes the given rule definition and adds it to the given Ruleset. @see #normalizeRule @param {object} oRuleDef The rule definition @param {sap.ui.support.supportRules.RuleSet} oRuleset The ruleset
[ "Normalizes", "the", "given", "rule", "definition", "and", "adds", "it", "to", "the", "given", "Ruleset", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/rules/TableHelper.support.js#L65-L71
4,411
SAP/openui5
src/sap.ui.table/src/sap/ui/table/rules/TableHelper.support.js
function(oIssueManager, sText, sSeverity, sControlId) { oIssueManager.addIssue({ severity: sSeverity || Severity.Medium, details: sText, context: {id: sControlId || "WEBPAGE"} }); }
javascript
function(oIssueManager, sText, sSeverity, sControlId) { oIssueManager.addIssue({ severity: sSeverity || Severity.Medium, details: sText, context: {id: sControlId || "WEBPAGE"} }); }
[ "function", "(", "oIssueManager", ",", "sText", ",", "sSeverity", ",", "sControlId", ")", "{", "oIssueManager", ".", "addIssue", "(", "{", "severity", ":", "sSeverity", "||", "Severity", ".", "Medium", ",", "details", ":", "sText", ",", "context", ":", "{", "id", ":", "sControlId", "||", "\"WEBPAGE\"", "}", "}", ")", ";", "}" ]
Adds an issue with the given text, severity and context to the given issue manager. @param {sap.ui.support.IssueManager} oIssueManager The issue manager @param {string} sText The text of the issue. @param {sap.ui.support.Severity} [sSeverity] The severity of the issue, if nothing is given Warning is used. @param {string} [sControlId] The id of the control the issue is related to. If nothing is given the "global" context is used.
[ "Adds", "an", "issue", "with", "the", "given", "text", "severity", "and", "context", "to", "the", "given", "issue", "manager", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/rules/TableHelper.support.js#L93-L99
4,412
SAP/openui5
src/sap.ui.table/src/sap/ui/table/rules/TableHelper.support.js
function(oScope, bVisibleOnly, sType) { var mElements = oScope.getElements(); var aResult = []; for (var n in mElements) { var oElement = mElements[n]; if (oElement.isA(sType)) { if (bVisibleOnly && oElement.getDomRef() || !bVisibleOnly) { aResult.push(oElement); } } } return aResult; }
javascript
function(oScope, bVisibleOnly, sType) { var mElements = oScope.getElements(); var aResult = []; for (var n in mElements) { var oElement = mElements[n]; if (oElement.isA(sType)) { if (bVisibleOnly && oElement.getDomRef() || !bVisibleOnly) { aResult.push(oElement); } } } return aResult; }
[ "function", "(", "oScope", ",", "bVisibleOnly", ",", "sType", ")", "{", "var", "mElements", "=", "oScope", ".", "getElements", "(", ")", ";", "var", "aResult", "=", "[", "]", ";", "for", "(", "var", "n", "in", "mElements", ")", "{", "var", "oElement", "=", "mElements", "[", "n", "]", ";", "if", "(", "oElement", ".", "isA", "(", "sType", ")", ")", "{", "if", "(", "bVisibleOnly", "&&", "oElement", ".", "getDomRef", "(", ")", "||", "!", "bVisibleOnly", ")", "{", "aResult", ".", "push", "(", "oElement", ")", ";", "}", "}", "}", "return", "aResult", ";", "}" ]
Return all existing control instances of the given type. @param {object} oScope The scope as given in the rule check function. @param {boolean} bVisibleOnly Whether all existing controls or only the ones which currently have a DOM reference should be returned. @param {string} sType The type @returns {sap.ui.core.Element[]} All existing control instances
[ "Return", "all", "existing", "control", "instances", "of", "the", "given", "type", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/rules/TableHelper.support.js#L108-L120
4,413
SAP/openui5
src/sap.ui.table/src/sap/ui/table/rules/TableHelper.support.js
function(fnFilter, fnCheck) { var aLog = Log.getLogEntries(); //oScope.getLoggedObjects(); /*getLoggedObjects returns only log entries with supportinfo*/ var oLogEntry; for (var i = 0; i < aLog.length; i++) { oLogEntry = aLog[i]; if (fnFilter(oLogEntry)) { if (fnCheck(oLogEntry)) { return; } } } }
javascript
function(fnFilter, fnCheck) { var aLog = Log.getLogEntries(); //oScope.getLoggedObjects(); /*getLoggedObjects returns only log entries with supportinfo*/ var oLogEntry; for (var i = 0; i < aLog.length; i++) { oLogEntry = aLog[i]; if (fnFilter(oLogEntry)) { if (fnCheck(oLogEntry)) { return; } } } }
[ "function", "(", "fnFilter", ",", "fnCheck", ")", "{", "var", "aLog", "=", "Log", ".", "getLogEntries", "(", ")", ";", "//oScope.getLoggedObjects(); /*getLoggedObjects returns only log entries with supportinfo*/", "var", "oLogEntry", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "aLog", ".", "length", ";", "i", "++", ")", "{", "oLogEntry", "=", "aLog", "[", "i", "]", ";", "if", "(", "fnFilter", "(", "oLogEntry", ")", ")", "{", "if", "(", "fnCheck", "(", "oLogEntry", ")", ")", "{", "return", ";", "}", "}", "}", "}" ]
Iterates over the available log entries. Both parameter functions gets a log entry object passed in with the following properties: <ul> <li>{jQuery.sap.log.Level} oLogEntry.level One of the log levels FATAL, ERROR, WARNING, INFO, DEBUG, TRACE</li> <li>{string} oLogEntry.message The logged message</li> <li>{string} oLogEntry.details The optional details for the message</li> <li>{string} oLogEntry.component The optional log component under which the message was logged</li> <li>{float} oLogEntry.timestamp The timestamp when the log entry was written</li> <li>{object} oLogEntry.supportInfo The optional support info object</li> </ul> @param {function} fnFilter Filter function to filter out irrelevant log entries. If the function returns <code>true</code> the log entry is kept, otherwise it's filtered out. @param {string} fnCheck Check function to check the remaining log entries. If the function returns <code>true</code> the checking procedure is stopped, otherwise the next entry is passed for checking.
[ "Iterates", "over", "the", "available", "log", "entries", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/rules/TableHelper.support.js#L141-L152
4,414
SAP/openui5
src/sap.ui.ux3/src/sap/ui/ux3/Exact.js
function(oThis, oEvent){ oThis.fireRefineSearch({ query: oThis._sSearchQuery, changedAttribute: oEvent.getParameter("attribute"), allSelectedAttributes: oEvent.getParameter("allAttributes") }); }
javascript
function(oThis, oEvent){ oThis.fireRefineSearch({ query: oThis._sSearchQuery, changedAttribute: oEvent.getParameter("attribute"), allSelectedAttributes: oEvent.getParameter("allAttributes") }); }
[ "function", "(", "oThis", ",", "oEvent", ")", "{", "oThis", ".", "fireRefineSearch", "(", "{", "query", ":", "oThis", ".", "_sSearchQuery", ",", "changedAttribute", ":", "oEvent", ".", "getParameter", "(", "\"attribute\"", ")", ",", "allSelectedAttributes", ":", "oEvent", ".", "getParameter", "(", "\"allAttributes\"", ")", "}", ")", ";", "}" ]
Handles attribute selections
[ "Handles", "attribute", "selections" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.ux3/src/sap/ui/ux3/Exact.js#L229-L235
4,415
SAP/openui5
src/sap.ui.core/src/sap/ui/core/cache/CacheManager.js
function () { var pInstanceCreation, oMsr = startMeasurements("_getInstance"), that = this; pInstanceCreation = new Promise(function (resolve, reject) { var oInstance; Log.debug("Cache Manager: Initialization..."); if (!CacheManager._instance) { oInstance = that._findImplementation(); Measurement.start(S_MSR_INIT_IMPLEMENTATION, "CM", S_MSR_CAT_CACHE_MANAGER); oInstance.init().then(resolveCacheManager, reject); Measurement.end(S_MSR_INIT_IMPLEMENTATION, "CM"); } else { resolveCacheManager(CacheManager._instance); } function resolveCacheManager(instance) { CacheManager._instance = instance; oMsr.endAsync(); Log.debug("Cache Manager initialized with implementation [" + CacheManager._instance.name + "], resolving _getInstance promise"); resolve(instance); } }); oMsr.endSync(); return pInstanceCreation; }
javascript
function () { var pInstanceCreation, oMsr = startMeasurements("_getInstance"), that = this; pInstanceCreation = new Promise(function (resolve, reject) { var oInstance; Log.debug("Cache Manager: Initialization..."); if (!CacheManager._instance) { oInstance = that._findImplementation(); Measurement.start(S_MSR_INIT_IMPLEMENTATION, "CM", S_MSR_CAT_CACHE_MANAGER); oInstance.init().then(resolveCacheManager, reject); Measurement.end(S_MSR_INIT_IMPLEMENTATION, "CM"); } else { resolveCacheManager(CacheManager._instance); } function resolveCacheManager(instance) { CacheManager._instance = instance; oMsr.endAsync(); Log.debug("Cache Manager initialized with implementation [" + CacheManager._instance.name + "], resolving _getInstance promise"); resolve(instance); } }); oMsr.endSync(); return pInstanceCreation; }
[ "function", "(", ")", "{", "var", "pInstanceCreation", ",", "oMsr", "=", "startMeasurements", "(", "\"_getInstance\"", ")", ",", "that", "=", "this", ";", "pInstanceCreation", "=", "new", "Promise", "(", "function", "(", "resolve", ",", "reject", ")", "{", "var", "oInstance", ";", "Log", ".", "debug", "(", "\"Cache Manager: Initialization...\"", ")", ";", "if", "(", "!", "CacheManager", ".", "_instance", ")", "{", "oInstance", "=", "that", ".", "_findImplementation", "(", ")", ";", "Measurement", ".", "start", "(", "S_MSR_INIT_IMPLEMENTATION", ",", "\"CM\"", ",", "S_MSR_CAT_CACHE_MANAGER", ")", ";", "oInstance", ".", "init", "(", ")", ".", "then", "(", "resolveCacheManager", ",", "reject", ")", ";", "Measurement", ".", "end", "(", "S_MSR_INIT_IMPLEMENTATION", ",", "\"CM\"", ")", ";", "}", "else", "{", "resolveCacheManager", "(", "CacheManager", ".", "_instance", ")", ";", "}", "function", "resolveCacheManager", "(", "instance", ")", "{", "CacheManager", ".", "_instance", "=", "instance", ";", "oMsr", ".", "endAsync", "(", ")", ";", "Log", ".", "debug", "(", "\"Cache Manager initialized with implementation [\"", "+", "CacheManager", ".", "_instance", ".", "name", "+", "\"], resolving _getInstance promise\"", ")", ";", "resolve", "(", "instance", ")", ";", "}", "}", ")", ";", "oMsr", ".", "endSync", "(", ")", ";", "return", "pInstanceCreation", ";", "}" ]
Obtains a concreate implementation according to set of rules. @returns {Promise} @private
[ "Obtains", "a", "concreate", "implementation", "according", "to", "set", "of", "rules", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/cache/CacheManager.js#L72-L99
4,416
SAP/openui5
src/sap.ui.core/src/sap/ui/core/cache/CacheManager.js
function (key, value) { var pSet, oMsr = startMeasurements("set", key); Log.debug("Cache Manager: Setting value of type[" + typeof value + "] with key [" + key + "]"); pSet = this._callInstanceMethod("set", arguments).then(function callInstanceHandler() { Log.debug("Cache Manager: Setting key [" + key + "] completed successfully"); oMsr.endAsync(); //nothing to return, just logging. }, function (e) { Log.error("Cache Manager: Setting key [" + key + "] failed. Error:" + e); oMsr.endAsync(); throw e; }); oMsr.endSync(); return pSet; }
javascript
function (key, value) { var pSet, oMsr = startMeasurements("set", key); Log.debug("Cache Manager: Setting value of type[" + typeof value + "] with key [" + key + "]"); pSet = this._callInstanceMethod("set", arguments).then(function callInstanceHandler() { Log.debug("Cache Manager: Setting key [" + key + "] completed successfully"); oMsr.endAsync(); //nothing to return, just logging. }, function (e) { Log.error("Cache Manager: Setting key [" + key + "] failed. Error:" + e); oMsr.endAsync(); throw e; }); oMsr.endSync(); return pSet; }
[ "function", "(", "key", ",", "value", ")", "{", "var", "pSet", ",", "oMsr", "=", "startMeasurements", "(", "\"set\"", ",", "key", ")", ";", "Log", ".", "debug", "(", "\"Cache Manager: Setting value of type[\"", "+", "typeof", "value", "+", "\"] with key [\"", "+", "key", "+", "\"]\"", ")", ";", "pSet", "=", "this", ".", "_callInstanceMethod", "(", "\"set\"", ",", "arguments", ")", ".", "then", "(", "function", "callInstanceHandler", "(", ")", "{", "Log", ".", "debug", "(", "\"Cache Manager: Setting key [\"", "+", "key", "+", "\"] completed successfully\"", ")", ";", "oMsr", ".", "endAsync", "(", ")", ";", "//nothing to return, just logging.", "}", ",", "function", "(", "e", ")", "{", "Log", ".", "error", "(", "\"Cache Manager: Setting key [\"", "+", "key", "+", "\"] failed. Error:\"", "+", "e", ")", ";", "oMsr", ".", "endAsync", "(", ")", ";", "throw", "e", ";", "}", ")", ";", "oMsr", ".", "endSync", "(", ")", ";", "return", "pSet", ";", "}" ]
Stores or updates value for given key. @param {string|number} key the key to associate the value with. Null is not accepted @param {*} value any value that match the structured clone algorithm. Undefined is not accepted. @see https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm @returns {Promise} a promise that would be resolved in case of successful operation or rejected with value of the error message if the operation fails. @public
[ "Stores", "or", "updates", "value", "for", "given", "key", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/cache/CacheManager.js#L124-L139
4,417
SAP/openui5
src/sap.ui.core/src/sap/ui/core/cache/CacheManager.js
function (key) { var pGet, oMsr = startMeasurements("get", key); Log.debug("Cache Manager: Getting key [" + key + "]"); pGet = this._callInstanceMethod("get", arguments).then(function callInstanceHandler(v) { Log.debug("Cache Manager: Getting key [" + key + "] done"); oMsr.endAsync(); return v; }, function (e) { Log.debug("Cache Manager: Getting key [" + key + "] failed. Error: " + e); oMsr.endAsync(); throw e; }); oMsr.endSync(); return pGet; }
javascript
function (key) { var pGet, oMsr = startMeasurements("get", key); Log.debug("Cache Manager: Getting key [" + key + "]"); pGet = this._callInstanceMethod("get", arguments).then(function callInstanceHandler(v) { Log.debug("Cache Manager: Getting key [" + key + "] done"); oMsr.endAsync(); return v; }, function (e) { Log.debug("Cache Manager: Getting key [" + key + "] failed. Error: " + e); oMsr.endAsync(); throw e; }); oMsr.endSync(); return pGet; }
[ "function", "(", "key", ")", "{", "var", "pGet", ",", "oMsr", "=", "startMeasurements", "(", "\"get\"", ",", "key", ")", ";", "Log", ".", "debug", "(", "\"Cache Manager: Getting key [\"", "+", "key", "+", "\"]\"", ")", ";", "pGet", "=", "this", ".", "_callInstanceMethod", "(", "\"get\"", ",", "arguments", ")", ".", "then", "(", "function", "callInstanceHandler", "(", "v", ")", "{", "Log", ".", "debug", "(", "\"Cache Manager: Getting key [\"", "+", "key", "+", "\"] done\"", ")", ";", "oMsr", ".", "endAsync", "(", ")", ";", "return", "v", ";", "}", ",", "function", "(", "e", ")", "{", "Log", ".", "debug", "(", "\"Cache Manager: Getting key [\"", "+", "key", "+", "\"] failed. Error: \"", "+", "e", ")", ";", "oMsr", ".", "endAsync", "(", ")", ";", "throw", "e", ";", "}", ")", ";", "oMsr", ".", "endSync", "(", ")", ";", "return", "pGet", ";", "}" ]
Retrieves a value for given key. @param key the key to retrieve a value for @returns {Promise} a promise that would be resolved in case of successful operation or rejected with value of the error message if the operation fails. It resolves with a value that is either: <ul> <li>undefined - the entry does not exist</li> <li>any other - the entry exists and value contains the actually one</li> </ul> @public
[ "Retrieves", "a", "value", "for", "given", "key", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/cache/CacheManager.js#L152-L169
4,418
SAP/openui5
src/sap.ui.core/src/sap/ui/core/cache/CacheManager.js
function (key) { var pHas, oMsr = startMeasurements("has", key); Log.debug("Cache Manager: has key [" + key + "] called"); pHas = this._callInstanceMethod("has", arguments).then(function callInstanceHandler(result) { oMsr.endAsync(); Log.debug("Cache Manager: has key [" + key + "] returned " + result); return result; }); oMsr.endSync(); return pHas; }
javascript
function (key) { var pHas, oMsr = startMeasurements("has", key); Log.debug("Cache Manager: has key [" + key + "] called"); pHas = this._callInstanceMethod("has", arguments).then(function callInstanceHandler(result) { oMsr.endAsync(); Log.debug("Cache Manager: has key [" + key + "] returned " + result); return result; }); oMsr.endSync(); return pHas; }
[ "function", "(", "key", ")", "{", "var", "pHas", ",", "oMsr", "=", "startMeasurements", "(", "\"has\"", ",", "key", ")", ";", "Log", ".", "debug", "(", "\"Cache Manager: has key [\"", "+", "key", "+", "\"] called\"", ")", ";", "pHas", "=", "this", ".", "_callInstanceMethod", "(", "\"has\"", ",", "arguments", ")", ".", "then", "(", "function", "callInstanceHandler", "(", "result", ")", "{", "oMsr", ".", "endAsync", "(", ")", ";", "Log", ".", "debug", "(", "\"Cache Manager: has key [\"", "+", "key", "+", "\"] returned \"", "+", "result", ")", ";", "return", "result", ";", "}", ")", ";", "oMsr", ".", "endSync", "(", ")", ";", "return", "pHas", ";", "}" ]
Checks whether certain entry exists. @param {string|number} key the key to look for. Null is not accepted. @returns {Promise} a promise that would be resolved in case of successful operation or rejected with value of the error message if the operation fails. It resolves with a boolean value of true - if an entry with the given key is found, false - otherwise @public
[ "Checks", "whether", "certain", "entry", "exists", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/cache/CacheManager.js#L179-L190
4,419
SAP/openui5
src/sap.ui.core/src/sap/ui/core/cache/CacheManager.js
function (key) { var pDel, oMsr = startMeasurements("del", key); Log.debug("Cache Manager: del called."); pDel = this._callInstanceMethod("del", arguments).then(function callInstanceHandler() { Log.debug("Cache Manager: del completed successfully."); oMsr.endAsync(); //nothing to return, just logging. }, function (e) { Log.debug("Cache Manager: del failed. Error: " + e); oMsr.endAsync(); throw e; }); oMsr.endSync(); return pDel; }
javascript
function (key) { var pDel, oMsr = startMeasurements("del", key); Log.debug("Cache Manager: del called."); pDel = this._callInstanceMethod("del", arguments).then(function callInstanceHandler() { Log.debug("Cache Manager: del completed successfully."); oMsr.endAsync(); //nothing to return, just logging. }, function (e) { Log.debug("Cache Manager: del failed. Error: " + e); oMsr.endAsync(); throw e; }); oMsr.endSync(); return pDel; }
[ "function", "(", "key", ")", "{", "var", "pDel", ",", "oMsr", "=", "startMeasurements", "(", "\"del\"", ",", "key", ")", ";", "Log", ".", "debug", "(", "\"Cache Manager: del called.\"", ")", ";", "pDel", "=", "this", ".", "_callInstanceMethod", "(", "\"del\"", ",", "arguments", ")", ".", "then", "(", "function", "callInstanceHandler", "(", ")", "{", "Log", ".", "debug", "(", "\"Cache Manager: del completed successfully.\"", ")", ";", "oMsr", ".", "endAsync", "(", ")", ";", "//nothing to return, just logging.", "}", ",", "function", "(", "e", ")", "{", "Log", ".", "debug", "(", "\"Cache Manager: del failed. Error: \"", "+", "e", ")", ";", "oMsr", ".", "endAsync", "(", ")", ";", "throw", "e", ";", "}", ")", ";", "oMsr", ".", "endSync", "(", ")", ";", "return", "pDel", ";", "}" ]
Deletes entry with given key. @param {string|number} key the key to delete an entry for. Null is not accepted. @returns {Promise} a promise that would be resolved in case of successful operation or rejected with value of the error message if the operation fails. @public
[ "Deletes", "entry", "with", "given", "key", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/cache/CacheManager.js#L199-L214
4,420
SAP/openui5
src/sap.ui.core/src/sap/ui/core/cache/CacheManager.js
function () { var pReset, oMsr = startMeasurements("reset"); Log.debug("Cache Manager: Reset called."); pReset = this._callInstanceMethod("reset", arguments).then(function callInstanceHandler() { Log.debug("Cache Manager: Reset completed successfully."); oMsr.endAsync(); //nothing to return, just logging. }, function (e) { Log.debug("Cache Manager: Reset failed. Error: " + e); oMsr.endAsync(); throw e; }); oMsr.endSync(); return pReset; }
javascript
function () { var pReset, oMsr = startMeasurements("reset"); Log.debug("Cache Manager: Reset called."); pReset = this._callInstanceMethod("reset", arguments).then(function callInstanceHandler() { Log.debug("Cache Manager: Reset completed successfully."); oMsr.endAsync(); //nothing to return, just logging. }, function (e) { Log.debug("Cache Manager: Reset failed. Error: " + e); oMsr.endAsync(); throw e; }); oMsr.endSync(); return pReset; }
[ "function", "(", ")", "{", "var", "pReset", ",", "oMsr", "=", "startMeasurements", "(", "\"reset\"", ")", ";", "Log", ".", "debug", "(", "\"Cache Manager: Reset called.\"", ")", ";", "pReset", "=", "this", ".", "_callInstanceMethod", "(", "\"reset\"", ",", "arguments", ")", ".", "then", "(", "function", "callInstanceHandler", "(", ")", "{", "Log", ".", "debug", "(", "\"Cache Manager: Reset completed successfully.\"", ")", ";", "oMsr", ".", "endAsync", "(", ")", ";", "//nothing to return, just logging.", "}", ",", "function", "(", "e", ")", "{", "Log", ".", "debug", "(", "\"Cache Manager: Reset failed. Error: \"", "+", "e", ")", ";", "oMsr", ".", "endAsync", "(", ")", ";", "throw", "e", ";", "}", ")", ";", "oMsr", ".", "endSync", "(", ")", ";", "return", "pReset", ";", "}" ]
Clears all entries in the cache. @returns {Promise} a promise that would be resolved in case of successful operation or rejected with value of the error message if the operation fails. @public
[ "Clears", "all", "entries", "in", "the", "cache", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/cache/CacheManager.js#L222-L237
4,421
SAP/openui5
src/sap.ui.core/src/sap/ui/core/cache/CacheManager.js
function (sMethodName, aArgs) { var pCallInstance, sMsrCallInstance = "[sync ] _callInstanceMethod"; Measurement.start(sMsrCallInstance, "CM", S_MSR_CAT_CACHE_MANAGER); if (this._instance) { Log.debug("Cache Manager: calling instance..."); return this._instance[sMethodName].apply(this._instance, aArgs); } Log.debug("Cache Manager: getting instance..."); pCallInstance = this._getInstance().then(function instanceResolving(instance) { return instance[sMethodName].apply(instance, aArgs); }); Measurement.end(sMsrCallInstance); return pCallInstance; }
javascript
function (sMethodName, aArgs) { var pCallInstance, sMsrCallInstance = "[sync ] _callInstanceMethod"; Measurement.start(sMsrCallInstance, "CM", S_MSR_CAT_CACHE_MANAGER); if (this._instance) { Log.debug("Cache Manager: calling instance..."); return this._instance[sMethodName].apply(this._instance, aArgs); } Log.debug("Cache Manager: getting instance..."); pCallInstance = this._getInstance().then(function instanceResolving(instance) { return instance[sMethodName].apply(instance, aArgs); }); Measurement.end(sMsrCallInstance); return pCallInstance; }
[ "function", "(", "sMethodName", ",", "aArgs", ")", "{", "var", "pCallInstance", ",", "sMsrCallInstance", "=", "\"[sync ] _callInstanceMethod\"", ";", "Measurement", ".", "start", "(", "sMsrCallInstance", ",", "\"CM\"", ",", "S_MSR_CAT_CACHE_MANAGER", ")", ";", "if", "(", "this", ".", "_instance", ")", "{", "Log", ".", "debug", "(", "\"Cache Manager: calling instance...\"", ")", ";", "return", "this", ".", "_instance", "[", "sMethodName", "]", ".", "apply", "(", "this", ".", "_instance", ",", "aArgs", ")", ";", "}", "Log", ".", "debug", "(", "\"Cache Manager: getting instance...\"", ")", ";", "pCallInstance", "=", "this", ".", "_getInstance", "(", ")", ".", "then", "(", "function", "instanceResolving", "(", "instance", ")", "{", "return", "instance", "[", "sMethodName", "]", ".", "apply", "(", "instance", ",", "aArgs", ")", ";", "}", ")", ";", "Measurement", ".", "end", "(", "sMsrCallInstance", ")", ";", "return", "pCallInstance", ";", "}" ]
Forwards method's call to the underlying implementation @param {string} sMethodName the name of the method to forward @param {any[]} aArgs array of arguments @returns {Promise} @private
[ "Forwards", "method", "s", "call", "to", "the", "underlying", "implementation" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/cache/CacheManager.js#L278-L294
4,422
SAP/openui5
src/sap.ui.core/src/sap/ui/core/cache/CacheManager.js
function () { var aSupportedEnv = []; if (this._bSupportedEnvironment == undefined) { aSupportedEnv.push({ system: Device.system.SYSTEMTYPE.DESKTOP, browserName: Device.browser.BROWSER.CHROME, browserVersion: 49 }); aSupportedEnv.push({ system: Device.system.SYSTEMTYPE.DESKTOP, browserName: Device.browser.BROWSER.INTERNET_EXPLORER, browserVersion: 11 }); this._bSupportedEnvironment = aSupportedEnv.some(function (oSuppportedEnv) { var bSupportedSystem = Device.system[oSuppportedEnv.system], bSupportedBrowserName = oSuppportedEnv.browserName === Device.browser.name, bSupportedBrowserVersion = Device.browser.version >= oSuppportedEnv.browserVersion; return bSupportedSystem && bSupportedBrowserName && bSupportedBrowserVersion && window.indexedDB; }); } return this._bSupportedEnvironment; }
javascript
function () { var aSupportedEnv = []; if (this._bSupportedEnvironment == undefined) { aSupportedEnv.push({ system: Device.system.SYSTEMTYPE.DESKTOP, browserName: Device.browser.BROWSER.CHROME, browserVersion: 49 }); aSupportedEnv.push({ system: Device.system.SYSTEMTYPE.DESKTOP, browserName: Device.browser.BROWSER.INTERNET_EXPLORER, browserVersion: 11 }); this._bSupportedEnvironment = aSupportedEnv.some(function (oSuppportedEnv) { var bSupportedSystem = Device.system[oSuppportedEnv.system], bSupportedBrowserName = oSuppportedEnv.browserName === Device.browser.name, bSupportedBrowserVersion = Device.browser.version >= oSuppportedEnv.browserVersion; return bSupportedSystem && bSupportedBrowserName && bSupportedBrowserVersion && window.indexedDB; }); } return this._bSupportedEnvironment; }
[ "function", "(", ")", "{", "var", "aSupportedEnv", "=", "[", "]", ";", "if", "(", "this", ".", "_bSupportedEnvironment", "==", "undefined", ")", "{", "aSupportedEnv", ".", "push", "(", "{", "system", ":", "Device", ".", "system", ".", "SYSTEMTYPE", ".", "DESKTOP", ",", "browserName", ":", "Device", ".", "browser", ".", "BROWSER", ".", "CHROME", ",", "browserVersion", ":", "49", "}", ")", ";", "aSupportedEnv", ".", "push", "(", "{", "system", ":", "Device", ".", "system", ".", "SYSTEMTYPE", ".", "DESKTOP", ",", "browserName", ":", "Device", ".", "browser", ".", "BROWSER", ".", "INTERNET_EXPLORER", ",", "browserVersion", ":", "11", "}", ")", ";", "this", ".", "_bSupportedEnvironment", "=", "aSupportedEnv", ".", "some", "(", "function", "(", "oSuppportedEnv", ")", "{", "var", "bSupportedSystem", "=", "Device", ".", "system", "[", "oSuppportedEnv", ".", "system", "]", ",", "bSupportedBrowserName", "=", "oSuppportedEnv", ".", "browserName", "===", "Device", ".", "browser", ".", "name", ",", "bSupportedBrowserVersion", "=", "Device", ".", "browser", ".", "version", ">=", "oSuppportedEnv", ".", "browserVersion", ";", "return", "bSupportedSystem", "&&", "bSupportedBrowserName", "&&", "bSupportedBrowserVersion", "&&", "window", ".", "indexedDB", ";", "}", ")", ";", "}", "return", "this", ".", "_bSupportedEnvironment", ";", "}" ]
Checks whether the given environment is supported by the CacheManager. @returns {boolean|*} true if yes, false if not. @private
[ "Checks", "whether", "the", "given", "environment", "is", "supported", "by", "the", "CacheManager", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/cache/CacheManager.js#L301-L324
4,423
SAP/openui5
src/sap.m/src/sap/m/BarInPageEnabler.js
function (sContext) { var oOptions = this._getContextOptions(sContext); if (!oOptions) { return this; } if (!this.isContextSensitive) { Log.error("The bar control you are using does not implement all the members of the IBar interface", this); return this; } //If this class does not gets added by the renderer, add it here if (!this.getRenderer().shouldAddIBarContext()) { this.addStyleClass(IBAR_CSS_CLASS + "-CTX"); } if (this.isContextSensitive()) { this.addStyleClass(oOptions.contextClass); } return this; }
javascript
function (sContext) { var oOptions = this._getContextOptions(sContext); if (!oOptions) { return this; } if (!this.isContextSensitive) { Log.error("The bar control you are using does not implement all the members of the IBar interface", this); return this; } //If this class does not gets added by the renderer, add it here if (!this.getRenderer().shouldAddIBarContext()) { this.addStyleClass(IBAR_CSS_CLASS + "-CTX"); } if (this.isContextSensitive()) { this.addStyleClass(oOptions.contextClass); } return this; }
[ "function", "(", "sContext", ")", "{", "var", "oOptions", "=", "this", ".", "_getContextOptions", "(", "sContext", ")", ";", "if", "(", "!", "oOptions", ")", "{", "return", "this", ";", "}", "if", "(", "!", "this", ".", "isContextSensitive", ")", "{", "Log", ".", "error", "(", "\"The bar control you are using does not implement all the members of the IBar interface\"", ",", "this", ")", ";", "return", "this", ";", "}", "//If this class does not gets added by the renderer, add it here", "if", "(", "!", "this", ".", "getRenderer", "(", ")", ".", "shouldAddIBarContext", "(", ")", ")", "{", "this", ".", "addStyleClass", "(", "IBAR_CSS_CLASS", "+", "\"-CTX\"", ")", ";", "}", "if", "(", "this", ".", "isContextSensitive", "(", ")", ")", "{", "this", ".", "addStyleClass", "(", "oOptions", ".", "contextClass", ")", ";", "}", "return", "this", ";", "}" ]
Sets classes according to the context of the page. Possible contexts are header, footer, subheader. @param {string} sContext allowed values are header, footer, subheader. @returns {sap.m.IBar} <code>this</code> for chaining @sap-restricted @private
[ "Sets", "classes", "according", "to", "the", "context", "of", "the", "page", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.m/src/sap/m/BarInPageEnabler.js#L138-L160
4,424
SAP/openui5
src/sap.m/src/sap/m/BarInPageEnabler.js
function (sContext) { var oOptions = this._getContextOptions(sContext); if (!oOptions) { return this; } if (!this.setHTMLTag) { Log.error("The bar control you are using does not implement all the members of the IBar interface", this); return this; } this.setHTMLTag(oOptions.tag); return this; }
javascript
function (sContext) { var oOptions = this._getContextOptions(sContext); if (!oOptions) { return this; } if (!this.setHTMLTag) { Log.error("The bar control you are using does not implement all the members of the IBar interface", this); return this; } this.setHTMLTag(oOptions.tag); return this; }
[ "function", "(", "sContext", ")", "{", "var", "oOptions", "=", "this", ".", "_getContextOptions", "(", "sContext", ")", ";", "if", "(", "!", "oOptions", ")", "{", "return", "this", ";", "}", "if", "(", "!", "this", ".", "setHTMLTag", ")", "{", "Log", ".", "error", "(", "\"The bar control you are using does not implement all the members of the IBar interface\"", ",", "this", ")", ";", "return", "this", ";", "}", "this", ".", "setHTMLTag", "(", "oOptions", ".", "tag", ")", ";", "return", "this", ";", "}" ]
Sets HTML tag according to the context of the page. Possible contexts are header, footer, subheader. @param {string} sContext allowed values are header, footer, subheader. @returns {sap.m.IBar} <code>this</code> for chaining @sap-restricted @private
[ "Sets", "HTML", "tag", "according", "to", "the", "context", "of", "the", "page", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.m/src/sap/m/BarInPageEnabler.js#L171-L186
4,425
SAP/openui5
src/sap.m/src/sap/m/BarInPageEnabler.js
function (sContext) { var oContext; if (this.getContext) { oContext = this.getContext(); } else { oContext = mContexts; } var oOptions = oContext[sContext]; if (!oOptions) { Log.error("The context " + sContext + " is not known", this); return null; } return oOptions; }
javascript
function (sContext) { var oContext; if (this.getContext) { oContext = this.getContext(); } else { oContext = mContexts; } var oOptions = oContext[sContext]; if (!oOptions) { Log.error("The context " + sContext + " is not known", this); return null; } return oOptions; }
[ "function", "(", "sContext", ")", "{", "var", "oContext", ";", "if", "(", "this", ".", "getContext", ")", "{", "oContext", "=", "this", ".", "getContext", "(", ")", ";", "}", "else", "{", "oContext", "=", "mContexts", ";", "}", "var", "oOptions", "=", "oContext", "[", "sContext", "]", ";", "if", "(", "!", "oOptions", ")", "{", "Log", ".", "error", "(", "\"The context \"", "+", "sContext", "+", "\" is not known\"", ",", "this", ")", ";", "return", "null", ";", "}", "return", "oOptions", ";", "}" ]
Get context options of the Page. Possible contexts are header, footer, subheader. @param {string} sContext allowed values are header, footer, subheader. @returns {object|null} @private
[ "Get", "context", "options", "of", "the", "Page", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.m/src/sap/m/BarInPageEnabler.js#L196-L214
4,426
SAP/openui5
src/sap.ui.documentation/src/sap/ui/documentation/sdk/controller/ApiDetailIndexDeprecatedExperimental.controller.js
function(oEvent) { // in our use-case each tab contains a single subSection => only this subSection needs to be processed var oSubSection = oEvent.getParameter("subSection"), sId = oSubSection.getId(), aBlocks; //attach listeners that prettify the tab content upon its rendering if (this._aVisitedTabs.indexOf(sId) < 0) { // avoid adding listeners to the same tab twice aBlocks = oSubSection.getBlocks(); aBlocks.forEach(function(oBlock) { oBlock.addEventDelegate({"onAfterRendering": this._prettify.bind(this)}); }.bind(this)); this._aVisitedTabs.push(sId); } }
javascript
function(oEvent) { // in our use-case each tab contains a single subSection => only this subSection needs to be processed var oSubSection = oEvent.getParameter("subSection"), sId = oSubSection.getId(), aBlocks; //attach listeners that prettify the tab content upon its rendering if (this._aVisitedTabs.indexOf(sId) < 0) { // avoid adding listeners to the same tab twice aBlocks = oSubSection.getBlocks(); aBlocks.forEach(function(oBlock) { oBlock.addEventDelegate({"onAfterRendering": this._prettify.bind(this)}); }.bind(this)); this._aVisitedTabs.push(sId); } }
[ "function", "(", "oEvent", ")", "{", "// in our use-case each tab contains a single subSection => only this subSection needs to be processed", "var", "oSubSection", "=", "oEvent", ".", "getParameter", "(", "\"subSection\"", ")", ",", "sId", "=", "oSubSection", ".", "getId", "(", ")", ",", "aBlocks", ";", "//attach listeners that prettify the tab content upon its rendering", "if", "(", "this", ".", "_aVisitedTabs", ".", "indexOf", "(", "sId", ")", "<", "0", ")", "{", "// avoid adding listeners to the same tab twice", "aBlocks", "=", "oSubSection", ".", "getBlocks", "(", ")", ";", "aBlocks", ".", "forEach", "(", "function", "(", "oBlock", ")", "{", "oBlock", ".", "addEventDelegate", "(", "{", "\"onAfterRendering\"", ":", "this", ".", "_prettify", ".", "bind", "(", "this", ")", "}", ")", ";", "}", ".", "bind", "(", "this", ")", ")", ";", "this", ".", "_aVisitedTabs", ".", "push", "(", "sId", ")", ";", "}", "}" ]
Attach listeners that prettify the tab content upon its rendering @param {oEvent} tab navigate event @private
[ "Attach", "listeners", "that", "prettify", "the", "tab", "content", "upon", "its", "rendering" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.documentation/src/sap/ui/documentation/sdk/controller/ApiDetailIndexDeprecatedExperimental.controller.js#L74-L89
4,427
SAP/openui5
src/sap.ui.documentation/src/sap/ui/documentation/sdk/controller/ApiDetailIndexDeprecatedExperimental.controller.js
function (oEvent) { var aItems = oEvent.getSource().getItems(), iLen = aItems.length, oItem; while (iLen--) { oItem = aItems[iLen]; // Access control lazy loading method if available if (oItem._getLinkSender) { var oCustomData = oItem.getCustomData(), sClassName = oCustomData[0].getValue(), sEntityId = oCustomData[1].getValue(), sEntityType = oCustomData[2].getValue(), sHref; // oCustomData[3].getValue() is true if method is static, else it is false if (oCustomData[3].getValue()) { sEntityId = sClassName + "." + sEntityId; } sHref = "#/api/" + sClassName; if (sEntityType !== "class") { sHref += "/" + sEntityType + "/" + sEntityId; } // Set link href to allow open in new window functionality oItem._getLinkSender().setHref(sHref); } } }
javascript
function (oEvent) { var aItems = oEvent.getSource().getItems(), iLen = aItems.length, oItem; while (iLen--) { oItem = aItems[iLen]; // Access control lazy loading method if available if (oItem._getLinkSender) { var oCustomData = oItem.getCustomData(), sClassName = oCustomData[0].getValue(), sEntityId = oCustomData[1].getValue(), sEntityType = oCustomData[2].getValue(), sHref; // oCustomData[3].getValue() is true if method is static, else it is false if (oCustomData[3].getValue()) { sEntityId = sClassName + "." + sEntityId; } sHref = "#/api/" + sClassName; if (sEntityType !== "class") { sHref += "/" + sEntityType + "/" + sEntityId; } // Set link href to allow open in new window functionality oItem._getLinkSender().setHref(sHref); } } }
[ "function", "(", "oEvent", ")", "{", "var", "aItems", "=", "oEvent", ".", "getSource", "(", ")", ".", "getItems", "(", ")", ",", "iLen", "=", "aItems", ".", "length", ",", "oItem", ";", "while", "(", "iLen", "--", ")", "{", "oItem", "=", "aItems", "[", "iLen", "]", ";", "// Access control lazy loading method if available", "if", "(", "oItem", ".", "_getLinkSender", ")", "{", "var", "oCustomData", "=", "oItem", ".", "getCustomData", "(", ")", ",", "sClassName", "=", "oCustomData", "[", "0", "]", ".", "getValue", "(", ")", ",", "sEntityId", "=", "oCustomData", "[", "1", "]", ".", "getValue", "(", ")", ",", "sEntityType", "=", "oCustomData", "[", "2", "]", ".", "getValue", "(", ")", ",", "sHref", ";", "// oCustomData[3].getValue() is true if method is static, else it is false", "if", "(", "oCustomData", "[", "3", "]", ".", "getValue", "(", ")", ")", "{", "sEntityId", "=", "sClassName", "+", "\".\"", "+", "sEntityId", ";", "}", "sHref", "=", "\"#/api/\"", "+", "sClassName", ";", "if", "(", "sEntityType", "!==", "\"class\"", ")", "{", "sHref", "+=", "\"/\"", "+", "sEntityType", "+", "\"/\"", "+", "sEntityId", ";", "}", "// Set link href to allow open in new window functionality", "oItem", ".", "_getLinkSender", "(", ")", ".", "setHref", "(", "sHref", ")", ";", "}", "}", "}" ]
Modify all deprecated and experimental links @private
[ "Modify", "all", "deprecated", "and", "experimental", "links" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.documentation/src/sap/ui/documentation/sdk/controller/ApiDetailIndexDeprecatedExperimental.controller.js#L129-L158
4,428
SAP/openui5
src/sap.ui.documentation/src/sap/ui/documentation/sdk/controller/TopicDetailInitial.controller.js
function () { jQuery0.ajax(this.getConfig().docuPath + "disclaimer.json", {dataType: "json"}).then(function (oData) { var oView = this.getView(); if (oData.showDisclaimer && oData.message) { oView.byId("disclaimerBlock").setVisible(true); oView.byId("disclaimerMessage").setText(oData.message); } }.bind(this), function () { // This functionality should fail silently }); }
javascript
function () { jQuery0.ajax(this.getConfig().docuPath + "disclaimer.json", {dataType: "json"}).then(function (oData) { var oView = this.getView(); if (oData.showDisclaimer && oData.message) { oView.byId("disclaimerBlock").setVisible(true); oView.byId("disclaimerMessage").setText(oData.message); } }.bind(this), function () { // This functionality should fail silently }); }
[ "function", "(", ")", "{", "jQuery0", ".", "ajax", "(", "this", ".", "getConfig", "(", ")", ".", "docuPath", "+", "\"disclaimer.json\"", ",", "{", "dataType", ":", "\"json\"", "}", ")", ".", "then", "(", "function", "(", "oData", ")", "{", "var", "oView", "=", "this", ".", "getView", "(", ")", ";", "if", "(", "oData", ".", "showDisclaimer", "&&", "oData", ".", "message", ")", "{", "oView", ".", "byId", "(", "\"disclaimerBlock\"", ")", ".", "setVisible", "(", "true", ")", ";", "oView", ".", "byId", "(", "\"disclaimerMessage\"", ")", ".", "setText", "(", "oData", ".", "message", ")", ";", "}", "}", ".", "bind", "(", "this", ")", ",", "function", "(", ")", "{", "// This functionality should fail silently", "}", ")", ";", "}" ]
Documentation disclaimer handler. This method fetches the disclaimer json file and modify's the view to show disclaimer message if such is available in the loaded json file.
[ "Documentation", "disclaimer", "handler", ".", "This", "method", "fetches", "the", "disclaimer", "json", "file", "and", "modify", "s", "the", "view", "to", "show", "disclaimer", "message", "if", "such", "is", "available", "in", "the", "loaded", "json", "file", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.documentation/src/sap/ui/documentation/sdk/controller/TopicDetailInitial.controller.js#L34-L44
4,429
SAP/openui5
src/sap.ui.documentation/src/sap/ui/documentation/sdk/controller/TopicDetailInitial.controller.js
function () { var oVersionModel = this.getModel("versionData"), bIsDevVersion = oVersionModel.getProperty('/isDevVersion'), bIsOpenUI5 = oVersionModel.getProperty('/isOpenUI5'); if (bIsOpenUI5) { return 'https://help.sap.com/OpenUI5_PDF/OpenUI5.pdf'; } return bIsDevVersion ? 'https://help.sap.com/DRAFT/SAPUI5_Internal_PDF/SAPUI5_Internal.pdf' : 'https://help.sap.com/SAPUI5_PDF/SAPUI5.pdf'; }
javascript
function () { var oVersionModel = this.getModel("versionData"), bIsDevVersion = oVersionModel.getProperty('/isDevVersion'), bIsOpenUI5 = oVersionModel.getProperty('/isOpenUI5'); if (bIsOpenUI5) { return 'https://help.sap.com/OpenUI5_PDF/OpenUI5.pdf'; } return bIsDevVersion ? 'https://help.sap.com/DRAFT/SAPUI5_Internal_PDF/SAPUI5_Internal.pdf' : 'https://help.sap.com/SAPUI5_PDF/SAPUI5.pdf'; }
[ "function", "(", ")", "{", "var", "oVersionModel", "=", "this", ".", "getModel", "(", "\"versionData\"", ")", ",", "bIsDevVersion", "=", "oVersionModel", ".", "getProperty", "(", "'/isDevVersion'", ")", ",", "bIsOpenUI5", "=", "oVersionModel", ".", "getProperty", "(", "'/isOpenUI5'", ")", ";", "if", "(", "bIsOpenUI5", ")", "{", "return", "'https://help.sap.com/OpenUI5_PDF/OpenUI5.pdf'", ";", "}", "return", "bIsDevVersion", "?", "'https://help.sap.com/DRAFT/SAPUI5_Internal_PDF/SAPUI5_Internal.pdf'", ":", "'https://help.sap.com/SAPUI5_PDF/SAPUI5.pdf'", ";", "}" ]
Determines the downloaded PDF's file location. @returns {string} The location of the PDF file @private
[ "Determines", "the", "downloaded", "PDF", "s", "file", "location", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.documentation/src/sap/ui/documentation/sdk/controller/TopicDetailInitial.controller.js#L83-L93
4,430
SAP/openui5
src/sap.ui.support/src/sap/ui/support/supportRules/Storage.js
function () { var tempRules = [], rawLSData; try { rawLSData = localStorage.getItem(constants.LOCAL_STORAGE_TEMP_RULES_KEY); if (!rawLSData) { return null; } tempRules = JSON.parse(decode(rawLSData)); tempRules = tempRules.map(function (tempRule) { return RuleSerializer.deserialize(tempRule, true); }); } catch (oError) { // Swallow "Access Denied" exceptions in cross-origin scenarios. } return tempRules; }
javascript
function () { var tempRules = [], rawLSData; try { rawLSData = localStorage.getItem(constants.LOCAL_STORAGE_TEMP_RULES_KEY); if (!rawLSData) { return null; } tempRules = JSON.parse(decode(rawLSData)); tempRules = tempRules.map(function (tempRule) { return RuleSerializer.deserialize(tempRule, true); }); } catch (oError) { // Swallow "Access Denied" exceptions in cross-origin scenarios. } return tempRules; }
[ "function", "(", ")", "{", "var", "tempRules", "=", "[", "]", ",", "rawLSData", ";", "try", "{", "rawLSData", "=", "localStorage", ".", "getItem", "(", "constants", ".", "LOCAL_STORAGE_TEMP_RULES_KEY", ")", ";", "if", "(", "!", "rawLSData", ")", "{", "return", "null", ";", "}", "tempRules", "=", "JSON", ".", "parse", "(", "decode", "(", "rawLSData", ")", ")", ";", "tempRules", "=", "tempRules", ".", "map", "(", "function", "(", "tempRule", ")", "{", "return", "RuleSerializer", ".", "deserialize", "(", "tempRule", ",", "true", ")", ";", "}", ")", ";", "}", "catch", "(", "oError", ")", "{", "// Swallow \"Access Denied\" exceptions in cross-origin scenarios.", "}", "return", "tempRules", ";", "}" ]
Returns all previously created temporary rules. @private @name sap.ui.support.Storage.getRules @method @returns {object[]} An array containing all the temporary rules.
[ "Returns", "all", "previously", "created", "temporary", "rules", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.support/src/sap/ui/support/supportRules/Storage.js#L69-L90
4,431
SAP/openui5
src/sap.ui.support/src/sap/ui/support/supportRules/Storage.js
function (rules) { var stringifyRules = encode(JSON.stringify(rules)); localStorage.setItem(constants.LOCAL_STORAGE_TEMP_RULES_KEY, stringifyRules); }
javascript
function (rules) { var stringifyRules = encode(JSON.stringify(rules)); localStorage.setItem(constants.LOCAL_STORAGE_TEMP_RULES_KEY, stringifyRules); }
[ "function", "(", "rules", ")", "{", "var", "stringifyRules", "=", "encode", "(", "JSON", ".", "stringify", "(", "rules", ")", ")", ";", "localStorage", ".", "setItem", "(", "constants", ".", "LOCAL_STORAGE_TEMP_RULES_KEY", ",", "stringifyRules", ")", ";", "}" ]
Saves the temporary rules into the LocalStorage persistence layer. @private @name sap.ui.support.Storage.setRules @method @param {object[]} rules The temporary rules from the shared model.
[ "Saves", "the", "temporary", "rules", "into", "the", "LocalStorage", "persistence", "layer", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.support/src/sap/ui/support/supportRules/Storage.js#L99-L102
4,432
SAP/openui5
src/sap.ui.support/src/sap/ui/support/supportRules/Storage.js
function () { var rawLSData = localStorage.getItem(constants.LOCAL_STORAGE_SELECTED_RULES_KEY); if (!rawLSData) { return null; } return JSON.parse(rawLSData); }
javascript
function () { var rawLSData = localStorage.getItem(constants.LOCAL_STORAGE_SELECTED_RULES_KEY); if (!rawLSData) { return null; } return JSON.parse(rawLSData); }
[ "function", "(", ")", "{", "var", "rawLSData", "=", "localStorage", ".", "getItem", "(", "constants", ".", "LOCAL_STORAGE_SELECTED_RULES_KEY", ")", ";", "if", "(", "!", "rawLSData", ")", "{", "return", "null", ";", "}", "return", "JSON", ".", "parse", "(", "rawLSData", ")", ";", "}" ]
Retrieves the selected rules which are stored in the LocalStorage persistence layer. @private @method @name sap.ui.support.Storage.getSelectedRules @returns {object[]} All selected rules that are stored in the LocalStorage persistence layer.
[ "Retrieves", "the", "selected", "rules", "which", "are", "stored", "in", "the", "LocalStorage", "persistence", "layer", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.support/src/sap/ui/support/supportRules/Storage.js#L111-L119
4,433
SAP/openui5
src/sap.ui.support/src/sap/ui/support/supportRules/Storage.js
function() { localStorage.removeItem(constants.LOCAL_STORAGE_TEMP_RULES_KEY); localStorage.removeItem(constants.LOCAL_STORAGE_SELECTED_RULES_KEY); localStorage.removeItem(constants.LOCAL_STORAGE_SELECTED_CONTEXT_KEY); localStorage.removeItem(constants.LOCAL_STORAGE_SELECTED_CONTEXT_COMPONENT_KEY); localStorage.removeItem(constants.LOCAL_STORAGE_SELECTED_VISIBLE_COLUMN_KEY); localStorage.removeItem(constants.LOCAL_STORAGE_SELECTION_PRESETS_KEY); localStorage.removeItem(constants.LOCAL_STORAGE_CUSTOM_PRESETS_KEY); }
javascript
function() { localStorage.removeItem(constants.LOCAL_STORAGE_TEMP_RULES_KEY); localStorage.removeItem(constants.LOCAL_STORAGE_SELECTED_RULES_KEY); localStorage.removeItem(constants.LOCAL_STORAGE_SELECTED_CONTEXT_KEY); localStorage.removeItem(constants.LOCAL_STORAGE_SELECTED_CONTEXT_COMPONENT_KEY); localStorage.removeItem(constants.LOCAL_STORAGE_SELECTED_VISIBLE_COLUMN_KEY); localStorage.removeItem(constants.LOCAL_STORAGE_SELECTION_PRESETS_KEY); localStorage.removeItem(constants.LOCAL_STORAGE_CUSTOM_PRESETS_KEY); }
[ "function", "(", ")", "{", "localStorage", ".", "removeItem", "(", "constants", ".", "LOCAL_STORAGE_TEMP_RULES_KEY", ")", ";", "localStorage", ".", "removeItem", "(", "constants", ".", "LOCAL_STORAGE_SELECTED_RULES_KEY", ")", ";", "localStorage", ".", "removeItem", "(", "constants", ".", "LOCAL_STORAGE_SELECTED_CONTEXT_KEY", ")", ";", "localStorage", ".", "removeItem", "(", "constants", ".", "LOCAL_STORAGE_SELECTED_CONTEXT_COMPONENT_KEY", ")", ";", "localStorage", ".", "removeItem", "(", "constants", ".", "LOCAL_STORAGE_SELECTED_VISIBLE_COLUMN_KEY", ")", ";", "localStorage", ".", "removeItem", "(", "constants", ".", "LOCAL_STORAGE_SELECTION_PRESETS_KEY", ")", ";", "localStorage", ".", "removeItem", "(", "constants", ".", "LOCAL_STORAGE_CUSTOM_PRESETS_KEY", ")", ";", "}" ]
Removes all data from LocalStorage persistence layer. @private @method @name sap.ui.support.Storage.removeAllData
[ "Removes", "all", "data", "from", "LocalStorage", "persistence", "layer", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.support/src/sap/ui/support/supportRules/Storage.js#L258-L266
4,434
SAP/openui5
src/sap.ui.support/src/sap/ui/support/supportRules/Storage.js
function(sCookieName) { var name = sCookieName + "=", decodedCookie = decodeURIComponent(document.cookie), ca = decodedCookie.split(';'), sOutput = ""; for (var i = 0; i < ca.length; i++) { var c = ca[i]; while (c.charAt(0) == ' ') { c = c.substring(1); } if (c.indexOf(name) == 0) { sOutput = c.substring(name.length, c.length); return sOutput; } } return sOutput; }
javascript
function(sCookieName) { var name = sCookieName + "=", decodedCookie = decodeURIComponent(document.cookie), ca = decodedCookie.split(';'), sOutput = ""; for (var i = 0; i < ca.length; i++) { var c = ca[i]; while (c.charAt(0) == ' ') { c = c.substring(1); } if (c.indexOf(name) == 0) { sOutput = c.substring(name.length, c.length); return sOutput; } } return sOutput; }
[ "function", "(", "sCookieName", ")", "{", "var", "name", "=", "sCookieName", "+", "\"=\"", ",", "decodedCookie", "=", "decodeURIComponent", "(", "document", ".", "cookie", ")", ",", "ca", "=", "decodedCookie", ".", "split", "(", "';'", ")", ",", "sOutput", "=", "\"\"", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "ca", ".", "length", ";", "i", "++", ")", "{", "var", "c", "=", "ca", "[", "i", "]", ";", "while", "(", "c", ".", "charAt", "(", "0", ")", "==", "' '", ")", "{", "c", "=", "c", ".", "substring", "(", "1", ")", ";", "}", "if", "(", "c", ".", "indexOf", "(", "name", ")", "==", "0", ")", "{", "sOutput", "=", "c", ".", "substring", "(", "name", ".", "length", ",", "c", ".", "length", ")", ";", "return", "sOutput", ";", "}", "}", "return", "sOutput", ";", "}" ]
Retrieves the persistence options of the user in the LocalStorage layer. @private @method @name sap.ui.support.Storage.readPersistenceCookie @alias readPersistenceCookie @param {string} sCookieName Name of the cookie. @returns {string} sOutput The persistence options of the user.
[ "Retrieves", "the", "persistence", "options", "of", "the", "user", "in", "the", "LocalStorage", "layer", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.support/src/sap/ui/support/supportRules/Storage.js#L290-L309
4,435
SAP/openui5
src/sap.ui.fl/src/sap/ui/fl/variants/VariantController.js
function (sComponentName, sAppVersion, oChangeFileContent) { this._sComponentName = sComponentName || ""; this._sAppVersion = sAppVersion || Utils.DEFAULT_APP_VERSION; this._mVariantManagement = {}; this.setChangeFileContent(oChangeFileContent, {}); this.sVariantTechnicalParameterName = "sap-ui-fl-control-variant-id"; this._oResourceBundle = sap.ui.getCore().getLibraryResourceBundle("sap.ui.fl"); }
javascript
function (sComponentName, sAppVersion, oChangeFileContent) { this._sComponentName = sComponentName || ""; this._sAppVersion = sAppVersion || Utils.DEFAULT_APP_VERSION; this._mVariantManagement = {}; this.setChangeFileContent(oChangeFileContent, {}); this.sVariantTechnicalParameterName = "sap-ui-fl-control-variant-id"; this._oResourceBundle = sap.ui.getCore().getLibraryResourceBundle("sap.ui.fl"); }
[ "function", "(", "sComponentName", ",", "sAppVersion", ",", "oChangeFileContent", ")", "{", "this", ".", "_sComponentName", "=", "sComponentName", "||", "\"\"", ";", "this", ".", "_sAppVersion", "=", "sAppVersion", "||", "Utils", ".", "DEFAULT_APP_VERSION", ";", "this", ".", "_mVariantManagement", "=", "{", "}", ";", "this", ".", "setChangeFileContent", "(", "oChangeFileContent", ",", "{", "}", ")", ";", "this", ".", "sVariantTechnicalParameterName", "=", "\"sap-ui-fl-control-variant-id\"", ";", "this", ".", "_oResourceBundle", "=", "sap", ".", "ui", ".", "getCore", "(", ")", ".", "getLibraryResourceBundle", "(", "\"sap.ui.fl\"", ")", ";", "}" ]
Helper object to handle variants and their changes @param {string} sComponentName - Component name the flexibility controller is responsible for @param {string} sAppVersion - Current version of the application @param {object} oChangeFileContent - Object containing file content from Lrep response @constructor @class @alias sap.ui.fl.variants.VariantController @experimental Since 1.50.0 @author SAP SE @version ${version}
[ "Helper", "object", "to", "handle", "variants", "and", "their", "changes" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.fl/src/sap/ui/fl/variants/VariantController.js#L31-L38
4,436
SAP/openui5
src/sap.ui.core/src/sap/ui/base/ExpressionParser.js
CONDITIONAL
function CONDITIONAL(fnCondition, fnThen, fnElse, aParts) { return fnCondition(aParts) ? fnThen(aParts) : fnElse(aParts); }
javascript
function CONDITIONAL(fnCondition, fnThen, fnElse, aParts) { return fnCondition(aParts) ? fnThen(aParts) : fnElse(aParts); }
[ "function", "CONDITIONAL", "(", "fnCondition", ",", "fnThen", ",", "fnElse", ",", "aParts", ")", "{", "return", "fnCondition", "(", "aParts", ")", "?", "fnThen", "(", "aParts", ")", ":", "fnElse", "(", "aParts", ")", ";", "}" ]
Formatter function for executing the conditional operator with the given condition, "then" and "else" clause. @param {function} fnCondition - formatter function for the condition @param {function} fnThen - formatter function for the "then" clause @param {function} fnElse- formatter function for the "else" clause @param {any[]} aParts - the array of binding values @return {any} - the value of the "then" or "else" clause, depending on the value of the condition
[ "Formatter", "function", "for", "executing", "the", "conditional", "operator", "with", "the", "given", "condition", "then", "and", "else", "clause", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/base/ExpressionParser.js#L339-L341
4,437
SAP/openui5
src/sap.ui.core/src/sap/ui/base/ExpressionParser.js
DOT
function DOT(fnLeft, sIdentifier, aParts, oReference) { var oParent = fnLeft(aParts), vChild = oParent[sIdentifier]; if (oReference) { oReference.base = oParent; } return vChild; }
javascript
function DOT(fnLeft, sIdentifier, aParts, oReference) { var oParent = fnLeft(aParts), vChild = oParent[sIdentifier]; if (oReference) { oReference.base = oParent; } return vChild; }
[ "function", "DOT", "(", "fnLeft", ",", "sIdentifier", ",", "aParts", ",", "oReference", ")", "{", "var", "oParent", "=", "fnLeft", "(", "aParts", ")", ",", "vChild", "=", "oParent", "[", "sIdentifier", "]", ";", "if", "(", "oReference", ")", "{", "oReference", ".", "base", "=", "oParent", ";", "}", "return", "vChild", ";", "}" ]
Formatter function for member access via the dot operator. @param {function} fnLeft - formatter function for the left operand @param {string} sIdentifier - the identifier on the dot's right side @param {any[]} aParts - the array of binding values @param {object} [oReference] optional side channel to return the base value (left operand) of the reference @return {any} - the left operand's member with the name
[ "Formatter", "function", "for", "member", "access", "via", "the", "dot", "operator", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/base/ExpressionParser.js#L361-L369
4,438
SAP/openui5
src/sap.ui.core/src/sap/ui/base/ExpressionParser.js
FUNCTION_CALL
function FUNCTION_CALL(fnLeft, aArguments, aParts) { var oReference = {}; // evaluate function expression and call it return fnLeft(aParts, oReference).apply(oReference.base, aArguments.map(function (fnArgument) { return fnArgument(aParts); // evaluate argument })); }
javascript
function FUNCTION_CALL(fnLeft, aArguments, aParts) { var oReference = {}; // evaluate function expression and call it return fnLeft(aParts, oReference).apply(oReference.base, aArguments.map(function (fnArgument) { return fnArgument(aParts); // evaluate argument })); }
[ "function", "FUNCTION_CALL", "(", "fnLeft", ",", "aArguments", ",", "aParts", ")", "{", "var", "oReference", "=", "{", "}", ";", "// evaluate function expression and call it", "return", "fnLeft", "(", "aParts", ",", "oReference", ")", ".", "apply", "(", "oReference", ".", "base", ",", "aArguments", ".", "map", "(", "function", "(", "fnArgument", ")", "{", "return", "fnArgument", "(", "aParts", ")", ";", "// evaluate argument", "}", ")", ")", ";", "}" ]
Formatter function for a call to the function returned by fnLeft. @param {function} fnLeft - formatter function for the left operand: the function to call @param {function[]} aArguments - array of formatter functions for the arguments @param {any[]} aParts - the array of binding values @return {any} - the return value of the function applied to the arguments
[ "Formatter", "function", "for", "a", "call", "to", "the", "function", "returned", "by", "fnLeft", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/base/ExpressionParser.js#L378-L386
4,439
SAP/openui5
src/sap.ui.core/src/sap/ui/base/ExpressionParser.js
INFIX
function INFIX(fnLeft, fnRight, fnOperator, bLazy, aParts) { return fnOperator(fnLeft(aParts), bLazy ? fnRight.bind(null, aParts) : fnRight(aParts)); }
javascript
function INFIX(fnLeft, fnRight, fnOperator, bLazy, aParts) { return fnOperator(fnLeft(aParts), bLazy ? fnRight.bind(null, aParts) : fnRight(aParts)); }
[ "function", "INFIX", "(", "fnLeft", ",", "fnRight", ",", "fnOperator", ",", "bLazy", ",", "aParts", ")", "{", "return", "fnOperator", "(", "fnLeft", "(", "aParts", ")", ",", "bLazy", "?", "fnRight", ".", "bind", "(", "null", ",", "aParts", ")", ":", "fnRight", "(", "aParts", ")", ")", ";", "}" ]
Formatter function for an infix operator. @param {function} fnLeft - formatter function for the left operand @param {function} fnRight - formatter function for the right operand @param {function} fnOperator function taking two arguments which evaluates the infix operator @param {boolean} bLazy - whether the right operand is e @param {any[]} aParts - the array of binding values @return {any} - the result of the operator function applied to the two operands
[ "Formatter", "function", "for", "an", "infix", "operator", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/base/ExpressionParser.js#L399-L402
4,440
SAP/openui5
src/sap.ui.core/src/sap/ui/base/ExpressionParser.js
MAP
function MAP(mMap, aParts) { var sKey, mResult = {}; for (sKey in mMap) { mResult[sKey] = mMap[sKey](aParts); // evaluate value } return mResult; }
javascript
function MAP(mMap, aParts) { var sKey, mResult = {}; for (sKey in mMap) { mResult[sKey] = mMap[sKey](aParts); // evaluate value } return mResult; }
[ "function", "MAP", "(", "mMap", ",", "aParts", ")", "{", "var", "sKey", ",", "mResult", "=", "{", "}", ";", "for", "(", "sKey", "in", "mMap", ")", "{", "mResult", "[", "sKey", "]", "=", "mMap", "[", "sKey", "]", "(", "aParts", ")", ";", "// evaluate value", "}", "return", "mResult", ";", "}" ]
Formatter function for an object literal. @param {object} mMap - map from key to formatter functions for the values @param {any[]} aParts - the array of binding values @return {object} - the resulting map
[ "Formatter", "function", "for", "an", "object", "literal", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/base/ExpressionParser.js#L410-L417
4,441
SAP/openui5
src/sap.ui.core/src/sap/ui/base/ExpressionParser.js
PROPERTY_ACCESS
function PROPERTY_ACCESS(fnLeft, fnName, aParts, oReference) { var oParent = fnLeft(aParts), sIdentifier = fnName(aParts), // BEWARE: evaluate propertyNameValue AFTER baseValue! vChild = oParent[sIdentifier]; if (oReference) { oReference.base = oParent; } return vChild; }
javascript
function PROPERTY_ACCESS(fnLeft, fnName, aParts, oReference) { var oParent = fnLeft(aParts), sIdentifier = fnName(aParts), // BEWARE: evaluate propertyNameValue AFTER baseValue! vChild = oParent[sIdentifier]; if (oReference) { oReference.base = oParent; } return vChild; }
[ "function", "PROPERTY_ACCESS", "(", "fnLeft", ",", "fnName", ",", "aParts", ",", "oReference", ")", "{", "var", "oParent", "=", "fnLeft", "(", "aParts", ")", ",", "sIdentifier", "=", "fnName", "(", "aParts", ")", ",", "// BEWARE: evaluate propertyNameValue AFTER baseValue!", "vChild", "=", "oParent", "[", "sIdentifier", "]", ";", "if", "(", "oReference", ")", "{", "oReference", ".", "base", "=", "oParent", ";", "}", "return", "vChild", ";", "}" ]
Formatter function for a property access. @param {function} fnLeft - formatter function for the left operand: the array or object to access @param {function} fnName - formatter function for the property name @param {any[]} aParts - the array of binding values @param {object} [oReference] optional side channel to return the base value (left operand) of the reference @return {any} - the array element or object property
[ "Formatter", "function", "for", "a", "property", "access", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/base/ExpressionParser.js#L429-L438
4,442
SAP/openui5
src/sap.ui.core/src/sap/ui/base/ExpressionParser.js
addInfix
function addInfix(sId, iBindingPower, fnOperator, bLazy) { // Note: this function is executed at load time only! mSymbols[sId] = { lbp: iBindingPower, led: function (oToken, oParser, fnLeft) { //lazy evaluation is right associative: performance optimization for guard and //default operator, e.g. true || A || B || C does not execute the || for B and C var rbp = bLazy ? this.lbp - 1 : this.lbp; return INFIX.bind(null, fnLeft, oParser.expression(rbp), fnOperator, bLazy); }, nud: unexpected }; return mSymbols[sId]; }
javascript
function addInfix(sId, iBindingPower, fnOperator, bLazy) { // Note: this function is executed at load time only! mSymbols[sId] = { lbp: iBindingPower, led: function (oToken, oParser, fnLeft) { //lazy evaluation is right associative: performance optimization for guard and //default operator, e.g. true || A || B || C does not execute the || for B and C var rbp = bLazy ? this.lbp - 1 : this.lbp; return INFIX.bind(null, fnLeft, oParser.expression(rbp), fnOperator, bLazy); }, nud: unexpected }; return mSymbols[sId]; }
[ "function", "addInfix", "(", "sId", ",", "iBindingPower", ",", "fnOperator", ",", "bLazy", ")", "{", "// Note: this function is executed at load time only!", "mSymbols", "[", "sId", "]", "=", "{", "lbp", ":", "iBindingPower", ",", "led", ":", "function", "(", "oToken", ",", "oParser", ",", "fnLeft", ")", "{", "//lazy evaluation is right associative: performance optimization for guard and", "//default operator, e.g. true || A || B || C does not execute the || for B and C", "var", "rbp", "=", "bLazy", "?", "this", ".", "lbp", "-", "1", ":", "this", ".", "lbp", ";", "return", "INFIX", ".", "bind", "(", "null", ",", "fnLeft", ",", "oParser", ".", "expression", "(", "rbp", ")", ",", "fnOperator", ",", "bLazy", ")", ";", "}", ",", "nud", ":", "unexpected", "}", ";", "return", "mSymbols", "[", "sId", "]", ";", "}" ]
Adds the infix operator with the given id, binding power and formatter function to the symbol table. @param {string} sId - the id of the infix operator @param {int} iBindingPower - the binding power = precedence of the infix operator @param {function} fnOperator - the function to evaluate the operator @param {boolean} [bLazy=false] - whether the right operand is lazily evaluated @return {object} the newly created symbol for the infix operator
[ "Adds", "the", "infix", "operator", "with", "the", "given", "id", "binding", "power", "and", "formatter", "function", "to", "the", "symbol", "table", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/base/ExpressionParser.js#L462-L477
4,443
SAP/openui5
src/sap.ui.core/src/sap/ui/base/ExpressionParser.js
saveBindingAsPart
function saveBindingAsPart(oBinding, iStart, bTargetTypeAny) { var bHasNonPrimitiveValue = false, sKey, oPrimitiveValueBinding, i; /* * Sets the target type of the given binding to the default "any", if applicable. * * @param {object} oBinding * A binding */ function setTargetType(oBinding) { if (bTargetTypeAny) { if (oBinding.parts) { oBinding.parts.forEach(setTargetType); // Note: targetType not allowed here, see BindingParser.mergeParts } else { oBinding.targetType = oBinding.targetType || "any"; } } } for (sKey in oBinding) { switch (typeof oBinding[sKey]) { case "boolean": case "number": case "string": case "undefined": break; default: // binding has at least one property of non-primitive value bHasNonPrimitiveValue = true; } } setTargetType(oBinding); if (bHasNonPrimitiveValue) { // the binding must be a complex binding; property "type" (and poss. others) are // newly created objects and thus incomparable -> parse again to have the names oPrimitiveValueBinding = JSTokenizer.parseJS(sInput, iStart).result; setTargetType(oPrimitiveValueBinding); } else { // only primitive values; easily comparable oPrimitiveValueBinding = oBinding; } for (i = 0; i < aParts.length; i += 1) { // Note: order of top-level properties must not matter for equality! if (deepEqual(aPrimitiveValueBindings[i], oPrimitiveValueBinding)) { return i; } } aPrimitiveValueBindings[i] = oPrimitiveValueBinding; aParts[i] = oBinding; return i; }
javascript
function saveBindingAsPart(oBinding, iStart, bTargetTypeAny) { var bHasNonPrimitiveValue = false, sKey, oPrimitiveValueBinding, i; /* * Sets the target type of the given binding to the default "any", if applicable. * * @param {object} oBinding * A binding */ function setTargetType(oBinding) { if (bTargetTypeAny) { if (oBinding.parts) { oBinding.parts.forEach(setTargetType); // Note: targetType not allowed here, see BindingParser.mergeParts } else { oBinding.targetType = oBinding.targetType || "any"; } } } for (sKey in oBinding) { switch (typeof oBinding[sKey]) { case "boolean": case "number": case "string": case "undefined": break; default: // binding has at least one property of non-primitive value bHasNonPrimitiveValue = true; } } setTargetType(oBinding); if (bHasNonPrimitiveValue) { // the binding must be a complex binding; property "type" (and poss. others) are // newly created objects and thus incomparable -> parse again to have the names oPrimitiveValueBinding = JSTokenizer.parseJS(sInput, iStart).result; setTargetType(oPrimitiveValueBinding); } else { // only primitive values; easily comparable oPrimitiveValueBinding = oBinding; } for (i = 0; i < aParts.length; i += 1) { // Note: order of top-level properties must not matter for equality! if (deepEqual(aPrimitiveValueBindings[i], oPrimitiveValueBinding)) { return i; } } aPrimitiveValueBindings[i] = oPrimitiveValueBinding; aParts[i] = oBinding; return i; }
[ "function", "saveBindingAsPart", "(", "oBinding", ",", "iStart", ",", "bTargetTypeAny", ")", "{", "var", "bHasNonPrimitiveValue", "=", "false", ",", "sKey", ",", "oPrimitiveValueBinding", ",", "i", ";", "/*\n\t\t\t * Sets the target type of the given binding to the default \"any\", if applicable.\n\t\t\t *\n\t\t\t * @param {object} oBinding\n\t\t\t * A binding\n\t\t\t */", "function", "setTargetType", "(", "oBinding", ")", "{", "if", "(", "bTargetTypeAny", ")", "{", "if", "(", "oBinding", ".", "parts", ")", "{", "oBinding", ".", "parts", ".", "forEach", "(", "setTargetType", ")", ";", "// Note: targetType not allowed here, see BindingParser.mergeParts", "}", "else", "{", "oBinding", ".", "targetType", "=", "oBinding", ".", "targetType", "||", "\"any\"", ";", "}", "}", "}", "for", "(", "sKey", "in", "oBinding", ")", "{", "switch", "(", "typeof", "oBinding", "[", "sKey", "]", ")", "{", "case", "\"boolean\"", ":", "case", "\"number\"", ":", "case", "\"string\"", ":", "case", "\"undefined\"", ":", "break", ";", "default", ":", "// binding has at least one property of non-primitive value", "bHasNonPrimitiveValue", "=", "true", ";", "}", "}", "setTargetType", "(", "oBinding", ")", ";", "if", "(", "bHasNonPrimitiveValue", ")", "{", "// the binding must be a complex binding; property \"type\" (and poss. others) are", "// newly created objects and thus incomparable -> parse again to have the names", "oPrimitiveValueBinding", "=", "JSTokenizer", ".", "parseJS", "(", "sInput", ",", "iStart", ")", ".", "result", ";", "setTargetType", "(", "oPrimitiveValueBinding", ")", ";", "}", "else", "{", "// only primitive values; easily comparable", "oPrimitiveValueBinding", "=", "oBinding", ";", "}", "for", "(", "i", "=", "0", ";", "i", "<", "aParts", ".", "length", ";", "i", "+=", "1", ")", "{", "// Note: order of top-level properties must not matter for equality!", "if", "(", "deepEqual", "(", "aPrimitiveValueBindings", "[", "i", "]", ",", "oPrimitiveValueBinding", ")", ")", "{", "return", "i", ";", "}", "}", "aPrimitiveValueBindings", "[", "i", "]", "=", "oPrimitiveValueBinding", ";", "aParts", "[", "i", "]", "=", "oBinding", ";", "return", "i", ";", "}" ]
Saves the binding as a part. Reuses an existing part if the binding is identical. @param {object} oBinding the binding to save @param {int} iStart the binding's start index in the input string @param {boolean} [bTargetTypeAny=false] whether the binding's "targetType" should default to "any" (recursively, for all parts) @returns {int} the index at which it has been saved/found in aParts
[ "Saves", "the", "binding", "as", "a", "part", ".", "Reuses", "an", "existing", "part", "if", "the", "binding", "is", "identical", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/base/ExpressionParser.js#L541-L595
4,444
SAP/openui5
src/sap.ui.core/src/sap/ui/base/ExpressionParser.js
consumeToken
function consumeToken() { var ch, oBinding, iIndex, aMatches, oToken; oTokenizer.white(); ch = oTokenizer.getCh(); iIndex = oTokenizer.getIndex(); if ((ch === "$" || ch === "%") && sInput[iIndex + 1] === "{") { //binding oBinding = fnResolveBinding(sInput, iIndex + 1); oToken = { id: "BINDING", value: saveBindingAsPart(oBinding.result, iIndex + 1, ch === "%") }; oTokenizer.setIndex(oBinding.at); //go to first character after binding string } else if (rIdentifierStart.test(ch)) { aMatches = rIdentifier.exec(sInput.slice(iIndex)); switch (aMatches[0]) { case "false": case "null": case "true": oToken = {id: "CONSTANT", value: oTokenizer.word()}; break; case "in": case "typeof": oToken = {id: aMatches[0]}; oTokenizer.setIndex(iIndex + aMatches[0].length); break; default: oToken = {id: "IDENTIFIER", value: aMatches[0]}; oTokenizer.setIndex(iIndex + aMatches[0].length); } } else if (rDigit.test(ch) || ch === "." && rDigit.test(sInput[iIndex + 1])) { oToken = {id: "CONSTANT", value: oTokenizer.number()}; } else if (ch === "'" || ch === '"') { oToken = {id: "CONSTANT", value: oTokenizer.string()}; } else { rTokens.lastIndex = iIndex; aMatches = rTokens.exec(sInput); if (!aMatches || aMatches.index !== iIndex) { return false; // end of input or unrecognized character } oToken = {id: aMatches[0]}; oTokenizer.setIndex(iIndex + aMatches[0].length); } oToken.input = sInput; oToken.start = iIndex; oToken.end = oTokenizer.getIndex(); aTokens.push(oToken); return true; }
javascript
function consumeToken() { var ch, oBinding, iIndex, aMatches, oToken; oTokenizer.white(); ch = oTokenizer.getCh(); iIndex = oTokenizer.getIndex(); if ((ch === "$" || ch === "%") && sInput[iIndex + 1] === "{") { //binding oBinding = fnResolveBinding(sInput, iIndex + 1); oToken = { id: "BINDING", value: saveBindingAsPart(oBinding.result, iIndex + 1, ch === "%") }; oTokenizer.setIndex(oBinding.at); //go to first character after binding string } else if (rIdentifierStart.test(ch)) { aMatches = rIdentifier.exec(sInput.slice(iIndex)); switch (aMatches[0]) { case "false": case "null": case "true": oToken = {id: "CONSTANT", value: oTokenizer.word()}; break; case "in": case "typeof": oToken = {id: aMatches[0]}; oTokenizer.setIndex(iIndex + aMatches[0].length); break; default: oToken = {id: "IDENTIFIER", value: aMatches[0]}; oTokenizer.setIndex(iIndex + aMatches[0].length); } } else if (rDigit.test(ch) || ch === "." && rDigit.test(sInput[iIndex + 1])) { oToken = {id: "CONSTANT", value: oTokenizer.number()}; } else if (ch === "'" || ch === '"') { oToken = {id: "CONSTANT", value: oTokenizer.string()}; } else { rTokens.lastIndex = iIndex; aMatches = rTokens.exec(sInput); if (!aMatches || aMatches.index !== iIndex) { return false; // end of input or unrecognized character } oToken = {id: aMatches[0]}; oTokenizer.setIndex(iIndex + aMatches[0].length); } oToken.input = sInput; oToken.start = iIndex; oToken.end = oTokenizer.getIndex(); aTokens.push(oToken); return true; }
[ "function", "consumeToken", "(", ")", "{", "var", "ch", ",", "oBinding", ",", "iIndex", ",", "aMatches", ",", "oToken", ";", "oTokenizer", ".", "white", "(", ")", ";", "ch", "=", "oTokenizer", ".", "getCh", "(", ")", ";", "iIndex", "=", "oTokenizer", ".", "getIndex", "(", ")", ";", "if", "(", "(", "ch", "===", "\"$\"", "||", "ch", "===", "\"%\"", ")", "&&", "sInput", "[", "iIndex", "+", "1", "]", "===", "\"{\"", ")", "{", "//binding", "oBinding", "=", "fnResolveBinding", "(", "sInput", ",", "iIndex", "+", "1", ")", ";", "oToken", "=", "{", "id", ":", "\"BINDING\"", ",", "value", ":", "saveBindingAsPart", "(", "oBinding", ".", "result", ",", "iIndex", "+", "1", ",", "ch", "===", "\"%\"", ")", "}", ";", "oTokenizer", ".", "setIndex", "(", "oBinding", ".", "at", ")", ";", "//go to first character after binding string", "}", "else", "if", "(", "rIdentifierStart", ".", "test", "(", "ch", ")", ")", "{", "aMatches", "=", "rIdentifier", ".", "exec", "(", "sInput", ".", "slice", "(", "iIndex", ")", ")", ";", "switch", "(", "aMatches", "[", "0", "]", ")", "{", "case", "\"false\"", ":", "case", "\"null\"", ":", "case", "\"true\"", ":", "oToken", "=", "{", "id", ":", "\"CONSTANT\"", ",", "value", ":", "oTokenizer", ".", "word", "(", ")", "}", ";", "break", ";", "case", "\"in\"", ":", "case", "\"typeof\"", ":", "oToken", "=", "{", "id", ":", "aMatches", "[", "0", "]", "}", ";", "oTokenizer", ".", "setIndex", "(", "iIndex", "+", "aMatches", "[", "0", "]", ".", "length", ")", ";", "break", ";", "default", ":", "oToken", "=", "{", "id", ":", "\"IDENTIFIER\"", ",", "value", ":", "aMatches", "[", "0", "]", "}", ";", "oTokenizer", ".", "setIndex", "(", "iIndex", "+", "aMatches", "[", "0", "]", ".", "length", ")", ";", "}", "}", "else", "if", "(", "rDigit", ".", "test", "(", "ch", ")", "||", "ch", "===", "\".\"", "&&", "rDigit", ".", "test", "(", "sInput", "[", "iIndex", "+", "1", "]", ")", ")", "{", "oToken", "=", "{", "id", ":", "\"CONSTANT\"", ",", "value", ":", "oTokenizer", ".", "number", "(", ")", "}", ";", "}", "else", "if", "(", "ch", "===", "\"'\"", "||", "ch", "===", "'\"'", ")", "{", "oToken", "=", "{", "id", ":", "\"CONSTANT\"", ",", "value", ":", "oTokenizer", ".", "string", "(", ")", "}", ";", "}", "else", "{", "rTokens", ".", "lastIndex", "=", "iIndex", ";", "aMatches", "=", "rTokens", ".", "exec", "(", "sInput", ")", ";", "if", "(", "!", "aMatches", "||", "aMatches", ".", "index", "!==", "iIndex", ")", "{", "return", "false", ";", "// end of input or unrecognized character", "}", "oToken", "=", "{", "id", ":", "aMatches", "[", "0", "]", "}", ";", "oTokenizer", ".", "setIndex", "(", "iIndex", "+", "aMatches", "[", "0", "]", ".", "length", ")", ";", "}", "oToken", ".", "input", "=", "sInput", ";", "oToken", ".", "start", "=", "iIndex", ";", "oToken", ".", "end", "=", "oTokenizer", ".", "getIndex", "(", ")", ";", "aTokens", ".", "push", "(", "oToken", ")", ";", "return", "true", ";", "}" ]
Consumes the next token in the input string and pushes it to the array of tokens. @returns {boolean} whether a token is recognized @throws {Error|Object|SyntaxError} <code>fnResolveBinding</code> may throw <code>SyntaxError</code>; <code>oTokenizer.setIndex()</code> may throw <code>Error</code>; <code>oTokenizer</code> may also throw <code>{name: 'SyntaxError', ...}</code>
[ "Consumes", "the", "next", "token", "in", "the", "input", "string", "and", "pushes", "it", "to", "the", "array", "of", "tokens", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/base/ExpressionParser.js#L606-L656
4,445
SAP/openui5
src/sap.ui.core/src/sap/ui/base/ExpressionParser.js
expression
function expression(rbp) { var fnLeft; oToken = advance(); if (!oToken) { error("Expected expression but instead saw end of input", sInput); } fnLeft = mSymbols[oToken.id].nud(oToken, oParser); while (iNextToken < aTokens.length) { oToken = current(); if (rbp >= (mSymbols[oToken.id].lbp || 0)) { break; } advance(); fnLeft = mSymbols[oToken.id].led(oToken, oParser, fnLeft); } return fnLeft; }
javascript
function expression(rbp) { var fnLeft; oToken = advance(); if (!oToken) { error("Expected expression but instead saw end of input", sInput); } fnLeft = mSymbols[oToken.id].nud(oToken, oParser); while (iNextToken < aTokens.length) { oToken = current(); if (rbp >= (mSymbols[oToken.id].lbp || 0)) { break; } advance(); fnLeft = mSymbols[oToken.id].led(oToken, oParser, fnLeft); } return fnLeft; }
[ "function", "expression", "(", "rbp", ")", "{", "var", "fnLeft", ";", "oToken", "=", "advance", "(", ")", ";", "if", "(", "!", "oToken", ")", "{", "error", "(", "\"Expected expression but instead saw end of input\"", ",", "sInput", ")", ";", "}", "fnLeft", "=", "mSymbols", "[", "oToken", ".", "id", "]", ".", "nud", "(", "oToken", ",", "oParser", ")", ";", "while", "(", "iNextToken", "<", "aTokens", ".", "length", ")", "{", "oToken", "=", "current", "(", ")", ";", "if", "(", "rbp", ">=", "(", "mSymbols", "[", "oToken", ".", "id", "]", ".", "lbp", "||", "0", ")", ")", "{", "break", ";", "}", "advance", "(", ")", ";", "fnLeft", "=", "mSymbols", "[", "oToken", ".", "id", "]", ".", "led", "(", "oToken", ",", "oParser", ",", "fnLeft", ")", ";", "}", "return", "fnLeft", ";", "}" ]
Parse an expression starting at the current token. Throws an error if there are no more tokens and @param {number} rbp a "right binding power" @returns {function} The formatter function for the expression
[ "Parse", "an", "expression", "starting", "at", "the", "current", "token", ".", "Throws", "an", "error", "if", "there", "are", "no", "more", "tokens", "and" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/base/ExpressionParser.js#L768-L787
4,446
SAP/openui5
src/sap.ui.documentation/src/sap/ui/documentation/sdk/controller/Controls.controller.js
function(oEvent) { var sFilter = oEvent.oSource.getFilter(), oSearchField = this.getOwnerComponent().byId("controlsMaster").byId("searchField"); // Apply the value and fire a live change event so the list will be filtered oSearchField.setValue(sFilter).fireLiveChange({ newValue: sFilter }); // Show master page: this call will show the master page only on small screen sizes but not on phone setTimeout(function () { this.getSplitApp().showMaster(); }.bind(this), 0); }
javascript
function(oEvent) { var sFilter = oEvent.oSource.getFilter(), oSearchField = this.getOwnerComponent().byId("controlsMaster").byId("searchField"); // Apply the value and fire a live change event so the list will be filtered oSearchField.setValue(sFilter).fireLiveChange({ newValue: sFilter }); // Show master page: this call will show the master page only on small screen sizes but not on phone setTimeout(function () { this.getSplitApp().showMaster(); }.bind(this), 0); }
[ "function", "(", "oEvent", ")", "{", "var", "sFilter", "=", "oEvent", ".", "oSource", ".", "getFilter", "(", ")", ",", "oSearchField", "=", "this", ".", "getOwnerComponent", "(", ")", ".", "byId", "(", "\"controlsMaster\"", ")", ".", "byId", "(", "\"searchField\"", ")", ";", "// Apply the value and fire a live change event so the list will be filtered", "oSearchField", ".", "setValue", "(", "sFilter", ")", ".", "fireLiveChange", "(", "{", "newValue", ":", "sFilter", "}", ")", ";", "// Show master page: this call will show the master page only on small screen sizes but not on phone", "setTimeout", "(", "function", "(", ")", "{", "this", ".", "getSplitApp", "(", ")", ".", "showMaster", "(", ")", ";", "}", ".", "bind", "(", "this", ")", ",", "0", ")", ";", "}" ]
Filter for controls in the master search field when the title of a control section was pressed
[ "Filter", "for", "controls", "in", "the", "master", "search", "field", "when", "the", "title", "of", "a", "control", "section", "was", "pressed" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.documentation/src/sap/ui/documentation/sdk/controller/Controls.controller.js#L51-L63
4,447
SAP/openui5
src/sap.f/src/sap/f/cards/ActionEnablement.js
_setItemTypeFormatter
function _setItemTypeFormatter(oAction) { var that = this; var oBindingInfo = ManagedObject.bindingParser("{path:''}"); // Async formatter to set ListItem type depending if the list item context is a correct navigation target (decided by the navigation service). oBindingInfo.formatter = function (vValue) { var oBindingContext = this.getBindingContext(), oModel = this.getModel(), sPath; if (oBindingContext) { sPath = oBindingContext.getPath(); } var mParameters = BindingResolver.resolveValue(oAction.parameters, oModel, sPath); if (vValue.__resolved) { if (vValue.__enabled) { return "Navigation"; } else { return "Inactive"; } } if (!vValue.__promise) { vValue.__promise = true; that._oServiceManager.getService(_getServiceName(oAction.service)).then(function (oNavigationService) { if (oNavigationService) { oNavigationService .enabled({ parameters: mParameters }) .then(function (bEnabled) { vValue.__resolved = true; vValue.__enabled = bEnabled; that.getModel().checkUpdate(true); }) .catch(function () { vValue.__resolved = true; vValue.__enabled = false; }); } else { vValue.__resolved = true; vValue.__enabled = false; } }); } return "Inactive"; }; this._oItemTemplate.bindProperty("type", oBindingInfo); }
javascript
function _setItemTypeFormatter(oAction) { var that = this; var oBindingInfo = ManagedObject.bindingParser("{path:''}"); // Async formatter to set ListItem type depending if the list item context is a correct navigation target (decided by the navigation service). oBindingInfo.formatter = function (vValue) { var oBindingContext = this.getBindingContext(), oModel = this.getModel(), sPath; if (oBindingContext) { sPath = oBindingContext.getPath(); } var mParameters = BindingResolver.resolveValue(oAction.parameters, oModel, sPath); if (vValue.__resolved) { if (vValue.__enabled) { return "Navigation"; } else { return "Inactive"; } } if (!vValue.__promise) { vValue.__promise = true; that._oServiceManager.getService(_getServiceName(oAction.service)).then(function (oNavigationService) { if (oNavigationService) { oNavigationService .enabled({ parameters: mParameters }) .then(function (bEnabled) { vValue.__resolved = true; vValue.__enabled = bEnabled; that.getModel().checkUpdate(true); }) .catch(function () { vValue.__resolved = true; vValue.__enabled = false; }); } else { vValue.__resolved = true; vValue.__enabled = false; } }); } return "Inactive"; }; this._oItemTemplate.bindProperty("type", oBindingInfo); }
[ "function", "_setItemTypeFormatter", "(", "oAction", ")", "{", "var", "that", "=", "this", ";", "var", "oBindingInfo", "=", "ManagedObject", ".", "bindingParser", "(", "\"{path:''}\"", ")", ";", "// Async formatter to set ListItem type depending if the list item context is a correct navigation target (decided by the navigation service).", "oBindingInfo", ".", "formatter", "=", "function", "(", "vValue", ")", "{", "var", "oBindingContext", "=", "this", ".", "getBindingContext", "(", ")", ",", "oModel", "=", "this", ".", "getModel", "(", ")", ",", "sPath", ";", "if", "(", "oBindingContext", ")", "{", "sPath", "=", "oBindingContext", ".", "getPath", "(", ")", ";", "}", "var", "mParameters", "=", "BindingResolver", ".", "resolveValue", "(", "oAction", ".", "parameters", ",", "oModel", ",", "sPath", ")", ";", "if", "(", "vValue", ".", "__resolved", ")", "{", "if", "(", "vValue", ".", "__enabled", ")", "{", "return", "\"Navigation\"", ";", "}", "else", "{", "return", "\"Inactive\"", ";", "}", "}", "if", "(", "!", "vValue", ".", "__promise", ")", "{", "vValue", ".", "__promise", "=", "true", ";", "that", ".", "_oServiceManager", ".", "getService", "(", "_getServiceName", "(", "oAction", ".", "service", ")", ")", ".", "then", "(", "function", "(", "oNavigationService", ")", "{", "if", "(", "oNavigationService", ")", "{", "oNavigationService", ".", "enabled", "(", "{", "parameters", ":", "mParameters", "}", ")", ".", "then", "(", "function", "(", "bEnabled", ")", "{", "vValue", ".", "__resolved", "=", "true", ";", "vValue", ".", "__enabled", "=", "bEnabled", ";", "that", ".", "getModel", "(", ")", ".", "checkUpdate", "(", "true", ")", ";", "}", ")", ".", "catch", "(", "function", "(", ")", "{", "vValue", ".", "__resolved", "=", "true", ";", "vValue", ".", "__enabled", "=", "false", ";", "}", ")", ";", "}", "else", "{", "vValue", ".", "__resolved", "=", "true", ";", "vValue", ".", "__enabled", "=", "false", ";", "}", "}", ")", ";", "}", "return", "\"Inactive\"", ";", "}", ";", "this", ".", "_oItemTemplate", ".", "bindProperty", "(", "\"type\"", ",", "oBindingInfo", ")", ";", "}" ]
List card specific
[ "List", "card", "specific" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.f/src/sap/f/cards/ActionEnablement.js#L35-L86
4,448
SAP/openui5
src/sap.f/src/sap/f/cards/ActionEnablement.js
_setActionEnabledState
function _setActionEnabledState(oAction) { var oBindingInfo; if (typeof oAction.enabled === "string") { oBindingInfo = ManagedObject.bindingParser(oAction.enabled); oBindingInfo.formatter = function (vValue) { if (vValue && (typeof vValue === "string")) { return "Navigation"; } else { return "Inactive"; } }; } if (oBindingInfo) { this._oItemTemplate.bindProperty("type", oBindingInfo); } else { var bEnabled = oAction.enabled !== false ? true : false; var sType = bEnabled ? "Navigation" : "Inactive"; this._oItemTemplate.setProperty("type", sType); } }
javascript
function _setActionEnabledState(oAction) { var oBindingInfo; if (typeof oAction.enabled === "string") { oBindingInfo = ManagedObject.bindingParser(oAction.enabled); oBindingInfo.formatter = function (vValue) { if (vValue && (typeof vValue === "string")) { return "Navigation"; } else { return "Inactive"; } }; } if (oBindingInfo) { this._oItemTemplate.bindProperty("type", oBindingInfo); } else { var bEnabled = oAction.enabled !== false ? true : false; var sType = bEnabled ? "Navigation" : "Inactive"; this._oItemTemplate.setProperty("type", sType); } }
[ "function", "_setActionEnabledState", "(", "oAction", ")", "{", "var", "oBindingInfo", ";", "if", "(", "typeof", "oAction", ".", "enabled", "===", "\"string\"", ")", "{", "oBindingInfo", "=", "ManagedObject", ".", "bindingParser", "(", "oAction", ".", "enabled", ")", ";", "oBindingInfo", ".", "formatter", "=", "function", "(", "vValue", ")", "{", "if", "(", "vValue", "&&", "(", "typeof", "vValue", "===", "\"string\"", ")", ")", "{", "return", "\"Navigation\"", ";", "}", "else", "{", "return", "\"Inactive\"", ";", "}", "}", ";", "}", "if", "(", "oBindingInfo", ")", "{", "this", ".", "_oItemTemplate", ".", "bindProperty", "(", "\"type\"", ",", "oBindingInfo", ")", ";", "}", "else", "{", "var", "bEnabled", "=", "oAction", ".", "enabled", "!==", "false", "?", "true", ":", "false", ";", "var", "sType", "=", "bEnabled", "?", "\"Navigation\"", ":", "\"Inactive\"", ";", "this", ".", "_oItemTemplate", ".", "setProperty", "(", "\"type\"", ",", "sType", ")", ";", "}", "}" ]
List and Table card specific
[ "List", "and", "Table", "card", "specific" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.f/src/sap/f/cards/ActionEnablement.js#L127-L147
4,449
SAP/openui5
src/sap.ui.documentation/src/sap/ui/documentation/sdk/util/DocumentationRouter.js
function(oEvent) { var sEntityType, sEntityId, aSplit, sId = oEvent.getParameter("arguments").id; if (sId) { aSplit = sId.split("#"); if (aSplit.length === 2) { sId = aSplit[0]; sEntityType = aSplit[1]; aSplit = sEntityType.split(":"); if (aSplit.length === 2) { sEntityType = aSplit[0]; sEntityId = aSplit[1]; } } sId = sId.replace(/.html$/, ""); if (sEntityType === 'event') { // legacy keyword is singular sEntityType = "events"; } } this.navTo("apiId", {id: sId, entityType: sEntityType, entityId: sEntityId}); }
javascript
function(oEvent) { var sEntityType, sEntityId, aSplit, sId = oEvent.getParameter("arguments").id; if (sId) { aSplit = sId.split("#"); if (aSplit.length === 2) { sId = aSplit[0]; sEntityType = aSplit[1]; aSplit = sEntityType.split(":"); if (aSplit.length === 2) { sEntityType = aSplit[0]; sEntityId = aSplit[1]; } } sId = sId.replace(/.html$/, ""); if (sEntityType === 'event') { // legacy keyword is singular sEntityType = "events"; } } this.navTo("apiId", {id: sId, entityType: sEntityType, entityId: sEntityId}); }
[ "function", "(", "oEvent", ")", "{", "var", "sEntityType", ",", "sEntityId", ",", "aSplit", ",", "sId", "=", "oEvent", ".", "getParameter", "(", "\"arguments\"", ")", ".", "id", ";", "if", "(", "sId", ")", "{", "aSplit", "=", "sId", ".", "split", "(", "\"#\"", ")", ";", "if", "(", "aSplit", ".", "length", "===", "2", ")", "{", "sId", "=", "aSplit", "[", "0", "]", ";", "sEntityType", "=", "aSplit", "[", "1", "]", ";", "aSplit", "=", "sEntityType", ".", "split", "(", "\":\"", ")", ";", "if", "(", "aSplit", ".", "length", "===", "2", ")", "{", "sEntityType", "=", "aSplit", "[", "0", "]", ";", "sEntityId", "=", "aSplit", "[", "1", "]", ";", "}", "}", "sId", "=", "sId", ".", "replace", "(", "/", ".html$", "/", ",", "\"\"", ")", ";", "if", "(", "sEntityType", "===", "'event'", ")", "{", "// legacy keyword is singular", "sEntityType", "=", "\"events\"", ";", "}", "}", "this", ".", "navTo", "(", "\"apiId\"", ",", "{", "id", ":", "sId", ",", "entityType", ":", "sEntityType", ",", "entityId", ":", "sEntityId", "}", ")", ";", "}" ]
Handling old Demo Kit API routes which should be navigated to new routes @param {object} oEvent event object @private
[ "Handling", "old", "Demo", "Kit", "API", "routes", "which", "should", "be", "navigated", "to", "new", "routes" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.documentation/src/sap/ui/documentation/sdk/util/DocumentationRouter.js#L94-L121
4,450
SAP/openui5
src/sap.ui.core/src/sap/ui/model/odata/v4/ODataContextBinding.js
getReturnValueContextPath
function getReturnValueContextPath(sPath, sResponsePredicate) { var sBoundParameterPath = sPath.slice(0, sPath.lastIndexOf("/")), i = sBoundParameterPath.indexOf("("); return (i < 0 ? sBoundParameterPath : sPath.slice(0, i)) + sResponsePredicate; }
javascript
function getReturnValueContextPath(sPath, sResponsePredicate) { var sBoundParameterPath = sPath.slice(0, sPath.lastIndexOf("/")), i = sBoundParameterPath.indexOf("("); return (i < 0 ? sBoundParameterPath : sPath.slice(0, i)) + sResponsePredicate; }
[ "function", "getReturnValueContextPath", "(", "sPath", ",", "sResponsePredicate", ")", "{", "var", "sBoundParameterPath", "=", "sPath", ".", "slice", "(", "0", ",", "sPath", ".", "lastIndexOf", "(", "\"/\"", ")", ")", ",", "i", "=", "sBoundParameterPath", ".", "indexOf", "(", "\"(\"", ")", ";", "return", "(", "i", "<", "0", "?", "sBoundParameterPath", ":", "sPath", ".", "slice", "(", "0", ",", "i", ")", ")", "+", "sResponsePredicate", ";", "}" ]
Returns the path for the return value context. Supports bound operations on an entity or a collection. @param {string} sPath The bindings's path; either a resolved model path or a resource path; for example: "Artists(ArtistID='42',IsActiveEntity=true)/special.cases.EditAction(...)" or "/Artists(ArtistID='42',IsActiveEntity=true)/special.cases.EditAction(...)" or "Artists/special.cases.Create(...)" or "/Artists/special.cases.Create(...)" @param {string} sResponsePredicate The key predicate of the response entity @returns {string} The path for the return value context.
[ "Returns", "the", "path", "for", "the", "return", "value", "context", ".", "Supports", "bound", "operations", "on", "an", "entity", "or", "a", "collection", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/v4/ODataContextBinding.js#L44-L49
4,451
SAP/openui5
src/sap.m/src/sap/m/DateTimeInput.js
buildPickerByType
function buildPickerByType(type){ var oPicker; switch (type) { case DateTimeInputType.DateTime: oPicker = new DateTimePicker(this.getId() + "-Picker"); break; case DateTimeInputType.Time: oPicker = new TimePicker(this.getId() + "-Picker", {localeId: sap.ui.getCore().getConfiguration().getFormatSettings().getFormatLocale().toString()}); break; default: // default is date oPicker = new DatePicker(this.getId() + "-Picker"); break; } // forward properties (also set default, may be different) oPicker.setDisplayFormat(this.getDisplayFormat() || this._types[type].displayFormat); oPicker.setValueFormat(this.getValueFormat() || this._types[type].valueFormat); if (this.getDateValue()) { oPicker.setDateValue(this.getDateValue()); // don't set Value -> as by switching type information can be lost } oPicker.setEnabled(this.getEnabled()); oPicker.setEditable(this.getEditable()); oPicker.setValueState(this.getValueState()); oPicker.setValueStateText(this.getValueStateText()); oPicker.setShowValueStateMessage(this.getShowValueStateMessage()); oPicker.setName(this.getName()); oPicker.setPlaceholder(this.getPlaceholder()); oPicker.setTextAlign(this.getTextAlign()); oPicker.setTextDirection(this.getTextDirection()); oPicker.setWidth("100%"); oPicker.attachChange(_handleChange, this); var aAriaLabelledBy = this.getAriaLabelledBy(); for (var i = 0; i < aAriaLabelledBy.length; i++) { oPicker.addAriaLabelledBy(aAriaLabelledBy[i]); } return oPicker; }
javascript
function buildPickerByType(type){ var oPicker; switch (type) { case DateTimeInputType.DateTime: oPicker = new DateTimePicker(this.getId() + "-Picker"); break; case DateTimeInputType.Time: oPicker = new TimePicker(this.getId() + "-Picker", {localeId: sap.ui.getCore().getConfiguration().getFormatSettings().getFormatLocale().toString()}); break; default: // default is date oPicker = new DatePicker(this.getId() + "-Picker"); break; } // forward properties (also set default, may be different) oPicker.setDisplayFormat(this.getDisplayFormat() || this._types[type].displayFormat); oPicker.setValueFormat(this.getValueFormat() || this._types[type].valueFormat); if (this.getDateValue()) { oPicker.setDateValue(this.getDateValue()); // don't set Value -> as by switching type information can be lost } oPicker.setEnabled(this.getEnabled()); oPicker.setEditable(this.getEditable()); oPicker.setValueState(this.getValueState()); oPicker.setValueStateText(this.getValueStateText()); oPicker.setShowValueStateMessage(this.getShowValueStateMessage()); oPicker.setName(this.getName()); oPicker.setPlaceholder(this.getPlaceholder()); oPicker.setTextAlign(this.getTextAlign()); oPicker.setTextDirection(this.getTextDirection()); oPicker.setWidth("100%"); oPicker.attachChange(_handleChange, this); var aAriaLabelledBy = this.getAriaLabelledBy(); for (var i = 0; i < aAriaLabelledBy.length; i++) { oPicker.addAriaLabelledBy(aAriaLabelledBy[i]); } return oPicker; }
[ "function", "buildPickerByType", "(", "type", ")", "{", "var", "oPicker", ";", "switch", "(", "type", ")", "{", "case", "DateTimeInputType", ".", "DateTime", ":", "oPicker", "=", "new", "DateTimePicker", "(", "this", ".", "getId", "(", ")", "+", "\"-Picker\"", ")", ";", "break", ";", "case", "DateTimeInputType", ".", "Time", ":", "oPicker", "=", "new", "TimePicker", "(", "this", ".", "getId", "(", ")", "+", "\"-Picker\"", ",", "{", "localeId", ":", "sap", ".", "ui", ".", "getCore", "(", ")", ".", "getConfiguration", "(", ")", ".", "getFormatSettings", "(", ")", ".", "getFormatLocale", "(", ")", ".", "toString", "(", ")", "}", ")", ";", "break", ";", "default", ":", "// default is date", "oPicker", "=", "new", "DatePicker", "(", "this", ".", "getId", "(", ")", "+", "\"-Picker\"", ")", ";", "break", ";", "}", "// forward properties (also set default, may be different)", "oPicker", ".", "setDisplayFormat", "(", "this", ".", "getDisplayFormat", "(", ")", "||", "this", ".", "_types", "[", "type", "]", ".", "displayFormat", ")", ";", "oPicker", ".", "setValueFormat", "(", "this", ".", "getValueFormat", "(", ")", "||", "this", ".", "_types", "[", "type", "]", ".", "valueFormat", ")", ";", "if", "(", "this", ".", "getDateValue", "(", ")", ")", "{", "oPicker", ".", "setDateValue", "(", "this", ".", "getDateValue", "(", ")", ")", ";", "// don't set Value -> as by switching type information can be lost", "}", "oPicker", ".", "setEnabled", "(", "this", ".", "getEnabled", "(", ")", ")", ";", "oPicker", ".", "setEditable", "(", "this", ".", "getEditable", "(", ")", ")", ";", "oPicker", ".", "setValueState", "(", "this", ".", "getValueState", "(", ")", ")", ";", "oPicker", ".", "setValueStateText", "(", "this", ".", "getValueStateText", "(", ")", ")", ";", "oPicker", ".", "setShowValueStateMessage", "(", "this", ".", "getShowValueStateMessage", "(", ")", ")", ";", "oPicker", ".", "setName", "(", "this", ".", "getName", "(", ")", ")", ";", "oPicker", ".", "setPlaceholder", "(", "this", ".", "getPlaceholder", "(", ")", ")", ";", "oPicker", ".", "setTextAlign", "(", "this", ".", "getTextAlign", "(", ")", ")", ";", "oPicker", ".", "setTextDirection", "(", "this", ".", "getTextDirection", "(", ")", ")", ";", "oPicker", ".", "setWidth", "(", "\"100%\"", ")", ";", "oPicker", ".", "attachChange", "(", "_handleChange", ",", "this", ")", ";", "var", "aAriaLabelledBy", "=", "this", ".", "getAriaLabelledBy", "(", ")", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "aAriaLabelledBy", ".", "length", ";", "i", "++", ")", "{", "oPicker", ".", "addAriaLabelledBy", "(", "aAriaLabelledBy", "[", "i", "]", ")", ";", "}", "return", "oPicker", ";", "}" ]
Creates an instance of picker depending of the given property type @param {sap.m.DateTimeInputType} type the type @returns {sap.ui.core.Control} picker implementation, that may be one of <code>sap.m.DatePicker</code>, <code>sap.m.TimePicker</code> or <code>sap.m.DateTimePicker</code>.
[ "Creates", "an", "instance", "of", "picker", "depending", "of", "the", "given", "property", "type" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.m/src/sap/m/DateTimeInput.js#L276-L317
4,452
SAP/openui5
src/sap.ui.core/src/sap/ui/core/rules/App.support.js
function(oController, viewId, aInvalidContent, fnProcessInvalidFunction) { var _aInvalidControllerFunctions = []; Object.keys(oController).forEach(function(sProtoKey) { var sFnContent = oController[sProtoKey].toString().replace(/(\r\n|\n|\r)/gm, ""); aInvalidContent.forEach(function(sInvalidContent) { if (sFnContent.indexOf(sInvalidContent) > 0) { fnProcessInvalidFunction(oController.getMetadata().getName(), sProtoKey, sInvalidContent, viewId); } }); }); return _aInvalidControllerFunctions; }
javascript
function(oController, viewId, aInvalidContent, fnProcessInvalidFunction) { var _aInvalidControllerFunctions = []; Object.keys(oController).forEach(function(sProtoKey) { var sFnContent = oController[sProtoKey].toString().replace(/(\r\n|\n|\r)/gm, ""); aInvalidContent.forEach(function(sInvalidContent) { if (sFnContent.indexOf(sInvalidContent) > 0) { fnProcessInvalidFunction(oController.getMetadata().getName(), sProtoKey, sInvalidContent, viewId); } }); }); return _aInvalidControllerFunctions; }
[ "function", "(", "oController", ",", "viewId", ",", "aInvalidContent", ",", "fnProcessInvalidFunction", ")", "{", "var", "_aInvalidControllerFunctions", "=", "[", "]", ";", "Object", ".", "keys", "(", "oController", ")", ".", "forEach", "(", "function", "(", "sProtoKey", ")", "{", "var", "sFnContent", "=", "oController", "[", "sProtoKey", "]", ".", "toString", "(", ")", ".", "replace", "(", "/", "(\\r\\n|\\n|\\r)", "/", "gm", ",", "\"\"", ")", ";", "aInvalidContent", ".", "forEach", "(", "function", "(", "sInvalidContent", ")", "{", "if", "(", "sFnContent", ".", "indexOf", "(", "sInvalidContent", ")", ">", "0", ")", "{", "fnProcessInvalidFunction", "(", "oController", ".", "getMetadata", "(", ")", ".", "getName", "(", ")", ",", "sProtoKey", ",", "sInvalidContent", ",", "viewId", ")", ";", "}", "}", ")", ";", "}", ")", ";", "return", "_aInvalidControllerFunctions", ";", "}" ]
checks the given module's functions code for invalidContent returns an array which contains the functions with invalid content
[ "checks", "the", "given", "module", "s", "functions", "code", "for", "invalidContent", "returns", "an", "array", "which", "contains", "the", "functions", "with", "invalid", "content" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/rules/App.support.js#L65-L79
4,453
SAP/openui5
src/sap.ui.core/src/sap/ui/base/ManagedObject.js
getStashedControls
function getStashedControls(sId) { if (!StashedControlSupport) { StashedControlSupport = sap.ui.require("sap/ui/core/StashedControlSupport"); } if (StashedControlSupport) { return StashedControlSupport.getStashedControls(sId); } return []; }
javascript
function getStashedControls(sId) { if (!StashedControlSupport) { StashedControlSupport = sap.ui.require("sap/ui/core/StashedControlSupport"); } if (StashedControlSupport) { return StashedControlSupport.getStashedControls(sId); } return []; }
[ "function", "getStashedControls", "(", "sId", ")", "{", "if", "(", "!", "StashedControlSupport", ")", "{", "StashedControlSupport", "=", "sap", ".", "ui", ".", "require", "(", "\"sap/ui/core/StashedControlSupport\"", ")", ";", "}", "if", "(", "StashedControlSupport", ")", "{", "return", "StashedControlSupport", ".", "getStashedControls", "(", "sId", ")", ";", "}", "return", "[", "]", ";", "}" ]
Returns an array of stashed child elements or an empty array if there are none. @param {string} sId id of the object which should have stashed children @return {sap.ui.core._StashedControl[]} array of stashed children @private
[ "Returns", "an", "array", "of", "stashed", "child", "elements", "or", "an", "empty", "array", "if", "there", "are", "none", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/base/ManagedObject.js#L970-L978
4,454
SAP/openui5
src/sap.ui.core/src/sap/ui/base/ManagedObject.js
updateGroup
function updateGroup(oContext) { var oNewGroup = oBinding.getGroup(oContext); if (oNewGroup.key !== sGroup) { var oGroupHeader; //If factory is defined use it if (oBindingInfo.groupHeaderFactory) { oGroupHeader = oBindingInfo.groupHeaderFactory(oNewGroup); } that[sGroupFunction](oNewGroup, oGroupHeader); sGroup = oNewGroup.key; } }
javascript
function updateGroup(oContext) { var oNewGroup = oBinding.getGroup(oContext); if (oNewGroup.key !== sGroup) { var oGroupHeader; //If factory is defined use it if (oBindingInfo.groupHeaderFactory) { oGroupHeader = oBindingInfo.groupHeaderFactory(oNewGroup); } that[sGroupFunction](oNewGroup, oGroupHeader); sGroup = oNewGroup.key; } }
[ "function", "updateGroup", "(", "oContext", ")", "{", "var", "oNewGroup", "=", "oBinding", ".", "getGroup", "(", "oContext", ")", ";", "if", "(", "oNewGroup", ".", "key", "!==", "sGroup", ")", "{", "var", "oGroupHeader", ";", "//If factory is defined use it", "if", "(", "oBindingInfo", ".", "groupHeaderFactory", ")", "{", "oGroupHeader", "=", "oBindingInfo", ".", "groupHeaderFactory", "(", "oNewGroup", ")", ";", "}", "that", "[", "sGroupFunction", "]", "(", "oNewGroup", ",", "oGroupHeader", ")", ";", "sGroup", "=", "oNewGroup", ".", "key", ";", "}", "}" ]
Check the current context for its group. If the group key changes, call the group function on the control.
[ "Check", "the", "current", "context", "for", "its", "group", ".", "If", "the", "group", "key", "changes", "call", "the", "group", "function", "on", "the", "control", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/base/ManagedObject.js#L4042-L4053
4,455
SAP/openui5
src/sap.ui.core/src/sap/ui/base/ManagedObject.js
updateRecursive
function updateRecursive(oControl, oContexts) { update(oControl, oContexts, null, function(oContext, oClone) { updateRecursive(oClone, oBinding.getNodeContexts(oContext)); }); }
javascript
function updateRecursive(oControl, oContexts) { update(oControl, oContexts, null, function(oContext, oClone) { updateRecursive(oClone, oBinding.getNodeContexts(oContext)); }); }
[ "function", "updateRecursive", "(", "oControl", ",", "oContexts", ")", "{", "update", "(", "oControl", ",", "oContexts", ",", "null", ",", "function", "(", "oContext", ",", "oClone", ")", "{", "updateRecursive", "(", "oClone", ",", "oBinding", ".", "getNodeContexts", "(", "oContext", ")", ")", ";", "}", ")", ";", "}" ]
Update the tree recursively
[ "Update", "the", "tree", "recursively" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/base/ManagedObject.js#L4056-L4060
4,456
SAP/openui5
src/sap.ui.table/src/sap/ui/table/TableUtils.js
function(oTable) { return (oTable.getSelectionMode() !== SelectionMode.None && oTable.getSelectionBehavior() !== SelectionBehavior.RowOnly) || TableGrouping.isGroupMode(oTable); }
javascript
function(oTable) { return (oTable.getSelectionMode() !== SelectionMode.None && oTable.getSelectionBehavior() !== SelectionBehavior.RowOnly) || TableGrouping.isGroupMode(oTable); }
[ "function", "(", "oTable", ")", "{", "return", "(", "oTable", ".", "getSelectionMode", "(", ")", "!==", "SelectionMode", ".", "None", "&&", "oTable", ".", "getSelectionBehavior", "(", ")", "!==", "SelectionBehavior", ".", "RowOnly", ")", "||", "TableGrouping", ".", "isGroupMode", "(", "oTable", ")", ";", "}" ]
Returns whether the table has row header cells. @param {sap.ui.table.Table} oTable Instance of the table. @returns {boolean} Whether the table has row header cells.
[ "Returns", "whether", "the", "table", "has", "row", "header", "cells", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/TableUtils.js#L235-L238
4,457
SAP/openui5
src/sap.ui.table/src/sap/ui/table/TableUtils.js
function(oTable) { var sSelectionMode = oTable ? oTable.getSelectionMode() : SelectionMode.None; return sSelectionMode === SelectionMode.MultiToggle && oTable.getEnableSelectAll(); }
javascript
function(oTable) { var sSelectionMode = oTable ? oTable.getSelectionMode() : SelectionMode.None; return sSelectionMode === SelectionMode.MultiToggle && oTable.getEnableSelectAll(); }
[ "function", "(", "oTable", ")", "{", "var", "sSelectionMode", "=", "oTable", "?", "oTable", ".", "getSelectionMode", "(", ")", ":", "SelectionMode", ".", "None", ";", "return", "sSelectionMode", "===", "SelectionMode", ".", "MultiToggle", "&&", "oTable", ".", "getEnableSelectAll", "(", ")", ";", "}" ]
Returns whether the table has a SelectAll checkbox. @param {sap.ui.table.Table} oTable Instance of the table. @returns {boolean} Whether the table has a SelectAll checkbox.
[ "Returns", "whether", "the", "table", "has", "a", "SelectAll", "checkbox", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/TableUtils.js#L246-L249
4,458
SAP/openui5
src/sap.ui.table/src/sap/ui/table/TableUtils.js
function(oTable) { if (!oTable) { return false; } var oRowSettingsTemplate = oTable.getRowSettingsTemplate(); if (!oRowSettingsTemplate) { return false; } var sHighlight = oRowSettingsTemplate.getHighlight(); return oRowSettingsTemplate.isBound("highlight") || (sHighlight != null && sHighlight !== MessageType.None); }
javascript
function(oTable) { if (!oTable) { return false; } var oRowSettingsTemplate = oTable.getRowSettingsTemplate(); if (!oRowSettingsTemplate) { return false; } var sHighlight = oRowSettingsTemplate.getHighlight(); return oRowSettingsTemplate.isBound("highlight") || (sHighlight != null && sHighlight !== MessageType.None); }
[ "function", "(", "oTable", ")", "{", "if", "(", "!", "oTable", ")", "{", "return", "false", ";", "}", "var", "oRowSettingsTemplate", "=", "oTable", ".", "getRowSettingsTemplate", "(", ")", ";", "if", "(", "!", "oRowSettingsTemplate", ")", "{", "return", "false", ";", "}", "var", "sHighlight", "=", "oRowSettingsTemplate", ".", "getHighlight", "(", ")", ";", "return", "oRowSettingsTemplate", ".", "isBound", "(", "\"highlight\"", ")", "||", "(", "sHighlight", "!=", "null", "&&", "sHighlight", "!==", "MessageType", ".", "None", ")", ";", "}" ]
Returns whether the table has row highlights. @param {sap.ui.table.Table} oTable Instance of the table. @returns {boolean} Whether the table has row highlights.
[ "Returns", "whether", "the", "table", "has", "row", "highlights", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/TableUtils.js#L257-L272
4,459
SAP/openui5
src/sap.ui.table/src/sap/ui/table/TableUtils.js
function(oTable) { var oRowActionTemplate = oTable ? oTable.getRowActionTemplate() : null; return oRowActionTemplate != null && (oRowActionTemplate.isBound("visible") || oRowActionTemplate.getVisible()) && TableUtils.getRowActionCount(oTable) > 0; }
javascript
function(oTable) { var oRowActionTemplate = oTable ? oTable.getRowActionTemplate() : null; return oRowActionTemplate != null && (oRowActionTemplate.isBound("visible") || oRowActionTemplate.getVisible()) && TableUtils.getRowActionCount(oTable) > 0; }
[ "function", "(", "oTable", ")", "{", "var", "oRowActionTemplate", "=", "oTable", "?", "oTable", ".", "getRowActionTemplate", "(", ")", ":", "null", ";", "return", "oRowActionTemplate", "!=", "null", "&&", "(", "oRowActionTemplate", ".", "isBound", "(", "\"visible\"", ")", "||", "oRowActionTemplate", ".", "getVisible", "(", ")", ")", "&&", "TableUtils", ".", "getRowActionCount", "(", "oTable", ")", ">", "0", ";", "}" ]
Returns whether the table has a row action column. @param {sap.ui.table.Table} oTable Instance of the table. @returns {boolean} Whether the table has row actions.
[ "Returns", "whether", "the", "table", "has", "a", "row", "action", "column", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/TableUtils.js#L291-L297
4,460
SAP/openui5
src/sap.ui.table/src/sap/ui/table/TableUtils.js
function(oTable) { if (!oTable) { return false; } var iSelectableRowCount = oTable._getSelectableRowCount(); return iSelectableRowCount > 0 && iSelectableRowCount === oTable._getSelectedIndicesCount(); }
javascript
function(oTable) { if (!oTable) { return false; } var iSelectableRowCount = oTable._getSelectableRowCount(); return iSelectableRowCount > 0 && iSelectableRowCount === oTable._getSelectedIndicesCount(); }
[ "function", "(", "oTable", ")", "{", "if", "(", "!", "oTable", ")", "{", "return", "false", ";", "}", "var", "iSelectableRowCount", "=", "oTable", ".", "_getSelectableRowCount", "(", ")", ";", "return", "iSelectableRowCount", ">", "0", "&&", "iSelectableRowCount", "===", "oTable", ".", "_getSelectedIndicesCount", "(", ")", ";", "}" ]
Finds out if all rows are selected in a table. @param {sap.ui.table.Table} oTable Instance of the table. @returns {boolean} Returns <code>true</code> if all rows in the table are selected.
[ "Finds", "out", "if", "all", "rows", "are", "selected", "in", "a", "table", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/TableUtils.js#L327-L334
4,461
SAP/openui5
src/sap.ui.table/src/sap/ui/table/TableUtils.js
function(oTable) { var oBinding = oTable.getBinding("rows"); var iTotalRowCount = oTable._getTotalRowCount(); var bHasData = iTotalRowCount > 0; if (oBinding && oBinding.providesGrandTotal) { // Analytical Binding var bHasTotal = oBinding.providesGrandTotal() && oBinding.hasTotaledMeasures(); bHasData = (bHasTotal && iTotalRowCount > 1) || (!bHasTotal && iTotalRowCount > 0); } return bHasData; }
javascript
function(oTable) { var oBinding = oTable.getBinding("rows"); var iTotalRowCount = oTable._getTotalRowCount(); var bHasData = iTotalRowCount > 0; if (oBinding && oBinding.providesGrandTotal) { // Analytical Binding var bHasTotal = oBinding.providesGrandTotal() && oBinding.hasTotaledMeasures(); bHasData = (bHasTotal && iTotalRowCount > 1) || (!bHasTotal && iTotalRowCount > 0); } return bHasData; }
[ "function", "(", "oTable", ")", "{", "var", "oBinding", "=", "oTable", ".", "getBinding", "(", "\"rows\"", ")", ";", "var", "iTotalRowCount", "=", "oTable", ".", "_getTotalRowCount", "(", ")", ";", "var", "bHasData", "=", "iTotalRowCount", ">", "0", ";", "if", "(", "oBinding", "&&", "oBinding", ".", "providesGrandTotal", ")", "{", "// Analytical Binding", "var", "bHasTotal", "=", "oBinding", ".", "providesGrandTotal", "(", ")", "&&", "oBinding", ".", "hasTotaledMeasures", "(", ")", ";", "bHasData", "=", "(", "bHasTotal", "&&", "iTotalRowCount", ">", "1", ")", "||", "(", "!", "bHasTotal", "&&", "iTotalRowCount", ">", "0", ")", ";", "}", "return", "bHasData", ";", "}" ]
Returns whether the table currently has data. @param {sap.ui.table.Table} oTable Instance of the table. @returns {boolean} Whether the table has data.
[ "Returns", "whether", "the", "table", "currently", "has", "data", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/TableUtils.js#L357-L368
4,462
SAP/openui5
src/sap.ui.table/src/sap/ui/table/TableUtils.js
function(oTable) { if (!oTable || !oTable.getDomRef()) { return false; } return oTable.getDomRef().querySelector("#" + oTable.getId() + "-sapUiTableGridCnt > .sapUiLocalBusyIndicator") != null; }
javascript
function(oTable) { if (!oTable || !oTable.getDomRef()) { return false; } return oTable.getDomRef().querySelector("#" + oTable.getId() + "-sapUiTableGridCnt > .sapUiLocalBusyIndicator") != null; }
[ "function", "(", "oTable", ")", "{", "if", "(", "!", "oTable", "||", "!", "oTable", ".", "getDomRef", "(", ")", ")", "{", "return", "false", ";", "}", "return", "oTable", ".", "getDomRef", "(", ")", ".", "querySelector", "(", "\"#\"", "+", "oTable", ".", "getId", "(", ")", "+", "\"-sapUiTableGridCnt > .sapUiLocalBusyIndicator\"", ")", "!=", "null", ";", "}" ]
Returns whether the busy indicator is visible. It is considered as visible when the busy indicator element exists in the DOM as a child of the table element. It is not checked whether the indicator is actually visible on the screen. @param {sap.ui.table.Table} oTable Instance of the table. @returns {boolean} Whether the busy indicator is visible.
[ "Returns", "whether", "the", "busy", "indicator", "is", "visible", ".", "It", "is", "considered", "as", "visible", "when", "the", "busy", "indicator", "element", "exists", "in", "the", "DOM", "as", "a", "child", "of", "the", "table", "element", ".", "It", "is", "not", "checked", "whether", "the", "indicator", "is", "actually", "visible", "on", "the", "screen", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/TableUtils.js#L377-L383
4,463
SAP/openui5
src/sap.ui.table/src/sap/ui/table/TableUtils.js
function(oTable) { if (!oTable) { return false; } if (TableUtils.canUsePendingRequestsCounter(oTable)) { return oTable._iPendingRequests > 0; } else { return oTable._bPendingRequest; } }
javascript
function(oTable) { if (!oTable) { return false; } if (TableUtils.canUsePendingRequestsCounter(oTable)) { return oTable._iPendingRequests > 0; } else { return oTable._bPendingRequest; } }
[ "function", "(", "oTable", ")", "{", "if", "(", "!", "oTable", ")", "{", "return", "false", ";", "}", "if", "(", "TableUtils", ".", "canUsePendingRequestsCounter", "(", "oTable", ")", ")", "{", "return", "oTable", ".", "_iPendingRequests", ">", "0", ";", "}", "else", "{", "return", "oTable", ".", "_bPendingRequest", ";", "}", "}" ]
Returns whether one or more requests are currently in process by the binding. @param {sap.ui.table.Table} oTable Instance of the table. @returns {boolean} Whether the binding of the table is currently requesting data.
[ "Returns", "whether", "one", "or", "more", "requests", "are", "currently", "in", "process", "by", "the", "binding", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/TableUtils.js#L391-L401
4,464
SAP/openui5
src/sap.ui.table/src/sap/ui/table/TableUtils.js
function(oTable) { var oBinding = oTable ? oTable.getBinding("rows") : null; if (TableUtils.isA(oBinding, "sap.ui.model.analytics.AnalyticalBinding")) { return oBinding.bUseBatchRequests; } else if (TableUtils.isA(oBinding, "sap.ui.model.TreeBinding")) { return false; } return true; }
javascript
function(oTable) { var oBinding = oTable ? oTable.getBinding("rows") : null; if (TableUtils.isA(oBinding, "sap.ui.model.analytics.AnalyticalBinding")) { return oBinding.bUseBatchRequests; } else if (TableUtils.isA(oBinding, "sap.ui.model.TreeBinding")) { return false; } return true; }
[ "function", "(", "oTable", ")", "{", "var", "oBinding", "=", "oTable", "?", "oTable", ".", "getBinding", "(", "\"rows\"", ")", ":", "null", ";", "if", "(", "TableUtils", ".", "isA", "(", "oBinding", ",", "\"sap.ui.model.analytics.AnalyticalBinding\"", ")", ")", "{", "return", "oBinding", ".", "bUseBatchRequests", ";", "}", "else", "if", "(", "TableUtils", ".", "isA", "(", "oBinding", ",", "\"sap.ui.model.TreeBinding\"", ")", ")", "{", "return", "false", ";", "}", "return", "true", ";", "}" ]
A counter to determine whether there are pending requests can be used if exactly one dataReceived event is fired for every dataRequested event. If this is not the case and there can be an imbalance between dataReceived and dataRequested events, a more limited method using a boolean flag must be used. It is not always possible to correctly determine whether there is a pending request, because the table must use a flag instead of a counter. A flag is necessary under the following conditions: If the AnalyticalBinding is created with the parameter "useBatchRequest" set to false, an imbalance between dataRequested and dataReceived events can occur. There will be one dataRequested event for every request that would otherwise be part of a batch request. But still only one dataReceived event is fired after all responses are received. If the ODataTreeBindingFlat adapter is applied to the TreeBinding, the adapter fires a dataRequested event on every call of getNodes, even if no request is sent. This can happen if the adapter ignores the request, because it finds out there is a pending request which covers it. When a request is ignored no dataReceived event is fired. @param {sap.ui.table.Table} oTable Instance of the table. @returns {boolean} Returns <code>true</code>, if the table can use a counter for pending request detection.
[ "A", "counter", "to", "determine", "whether", "there", "are", "pending", "requests", "can", "be", "used", "if", "exactly", "one", "dataReceived", "event", "is", "fired", "for", "every", "dataRequested", "event", ".", "If", "this", "is", "not", "the", "case", "and", "there", "can", "be", "an", "imbalance", "between", "dataReceived", "and", "dataRequested", "events", "a", "more", "limited", "method", "using", "a", "boolean", "flag", "must", "be", "used", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/TableUtils.js#L422-L432
4,465
SAP/openui5
src/sap.ui.table/src/sap/ui/table/TableUtils.js
function(oTable, vRowIndicator, bSelect, fnDoSelect) { if (!oTable || !oTable.getBinding("rows") || oTable.getSelectionMode() === SelectionMode.None || vRowIndicator == null) { return false; } function setSelectionState(iAbsoluteRowIndex) { if (!oTable._isRowSelectable(iAbsoluteRowIndex)) { return false; } oTable._iSourceRowIndex = iAbsoluteRowIndex; // To indicate that the selection was changed by user interaction. var bSelectionChanged = false; if (fnDoSelect) { bSelectionChanged = fnDoSelect(iAbsoluteRowIndex, bSelect); } else if (oTable.isIndexSelected(iAbsoluteRowIndex)) { if (bSelect !== true) { bSelectionChanged = true; oTable.removeSelectionInterval(iAbsoluteRowIndex, iAbsoluteRowIndex); } } else if (bSelect !== false) { bSelectionChanged = true; oTable.addSelectionInterval(iAbsoluteRowIndex, iAbsoluteRowIndex); } delete oTable._iSourceRowIndex; return bSelectionChanged; } // Variable vRowIndicator is a row index value. if (typeof vRowIndicator === "number") { if (vRowIndicator < 0 || vRowIndicator >= oTable._getTotalRowCount()) { return false; } return setSelectionState(vRowIndicator); // Variable vRowIndicator is a jQuery object or DOM element. } else { var $Cell = jQuery(vRowIndicator); var oCellInfo = TableUtils.getCellInfo($Cell[0]); var bIsRowSelectionAllowed = TableUtils.isRowSelectionAllowed(oTable); if (!TableUtils.Grouping.isInGroupingRow($Cell[0]) && ((oCellInfo.isOfType(TableUtils.CELLTYPE.DATACELL | TableUtils.CELLTYPE.ROWACTION) && bIsRowSelectionAllowed) || (oCellInfo.isOfType(TableUtils.CELLTYPE.ROWHEADER) && TableUtils.isRowSelectorSelectionAllowed(oTable)))) { var iAbsoluteRowIndex; if (oCellInfo.isOfType(TableUtils.CELLTYPE.DATACELL)) { iAbsoluteRowIndex = oTable .getRows()[parseInt($Cell.closest("tr", oTable.getDomRef()).attr("data-sap-ui-rowindex"))] .getIndex(); } else { // CELLTYPES.ROWHEADER, CELLTYPES.ROWACTION iAbsoluteRowIndex = oTable.getRows()[parseInt($Cell.attr("data-sap-ui-rowindex"))].getIndex(); } return setSelectionState(iAbsoluteRowIndex); } return false; } }
javascript
function(oTable, vRowIndicator, bSelect, fnDoSelect) { if (!oTable || !oTable.getBinding("rows") || oTable.getSelectionMode() === SelectionMode.None || vRowIndicator == null) { return false; } function setSelectionState(iAbsoluteRowIndex) { if (!oTable._isRowSelectable(iAbsoluteRowIndex)) { return false; } oTable._iSourceRowIndex = iAbsoluteRowIndex; // To indicate that the selection was changed by user interaction. var bSelectionChanged = false; if (fnDoSelect) { bSelectionChanged = fnDoSelect(iAbsoluteRowIndex, bSelect); } else if (oTable.isIndexSelected(iAbsoluteRowIndex)) { if (bSelect !== true) { bSelectionChanged = true; oTable.removeSelectionInterval(iAbsoluteRowIndex, iAbsoluteRowIndex); } } else if (bSelect !== false) { bSelectionChanged = true; oTable.addSelectionInterval(iAbsoluteRowIndex, iAbsoluteRowIndex); } delete oTable._iSourceRowIndex; return bSelectionChanged; } // Variable vRowIndicator is a row index value. if (typeof vRowIndicator === "number") { if (vRowIndicator < 0 || vRowIndicator >= oTable._getTotalRowCount()) { return false; } return setSelectionState(vRowIndicator); // Variable vRowIndicator is a jQuery object or DOM element. } else { var $Cell = jQuery(vRowIndicator); var oCellInfo = TableUtils.getCellInfo($Cell[0]); var bIsRowSelectionAllowed = TableUtils.isRowSelectionAllowed(oTable); if (!TableUtils.Grouping.isInGroupingRow($Cell[0]) && ((oCellInfo.isOfType(TableUtils.CELLTYPE.DATACELL | TableUtils.CELLTYPE.ROWACTION) && bIsRowSelectionAllowed) || (oCellInfo.isOfType(TableUtils.CELLTYPE.ROWHEADER) && TableUtils.isRowSelectorSelectionAllowed(oTable)))) { var iAbsoluteRowIndex; if (oCellInfo.isOfType(TableUtils.CELLTYPE.DATACELL)) { iAbsoluteRowIndex = oTable .getRows()[parseInt($Cell.closest("tr", oTable.getDomRef()).attr("data-sap-ui-rowindex"))] .getIndex(); } else { // CELLTYPES.ROWHEADER, CELLTYPES.ROWACTION iAbsoluteRowIndex = oTable.getRows()[parseInt($Cell.attr("data-sap-ui-rowindex"))].getIndex(); } return setSelectionState(iAbsoluteRowIndex); } return false; } }
[ "function", "(", "oTable", ",", "vRowIndicator", ",", "bSelect", ",", "fnDoSelect", ")", "{", "if", "(", "!", "oTable", "||", "!", "oTable", ".", "getBinding", "(", "\"rows\"", ")", "||", "oTable", ".", "getSelectionMode", "(", ")", "===", "SelectionMode", ".", "None", "||", "vRowIndicator", "==", "null", ")", "{", "return", "false", ";", "}", "function", "setSelectionState", "(", "iAbsoluteRowIndex", ")", "{", "if", "(", "!", "oTable", ".", "_isRowSelectable", "(", "iAbsoluteRowIndex", ")", ")", "{", "return", "false", ";", "}", "oTable", ".", "_iSourceRowIndex", "=", "iAbsoluteRowIndex", ";", "// To indicate that the selection was changed by user interaction.", "var", "bSelectionChanged", "=", "false", ";", "if", "(", "fnDoSelect", ")", "{", "bSelectionChanged", "=", "fnDoSelect", "(", "iAbsoluteRowIndex", ",", "bSelect", ")", ";", "}", "else", "if", "(", "oTable", ".", "isIndexSelected", "(", "iAbsoluteRowIndex", ")", ")", "{", "if", "(", "bSelect", "!==", "true", ")", "{", "bSelectionChanged", "=", "true", ";", "oTable", ".", "removeSelectionInterval", "(", "iAbsoluteRowIndex", ",", "iAbsoluteRowIndex", ")", ";", "}", "}", "else", "if", "(", "bSelect", "!==", "false", ")", "{", "bSelectionChanged", "=", "true", ";", "oTable", ".", "addSelectionInterval", "(", "iAbsoluteRowIndex", ",", "iAbsoluteRowIndex", ")", ";", "}", "delete", "oTable", ".", "_iSourceRowIndex", ";", "return", "bSelectionChanged", ";", "}", "// Variable vRowIndicator is a row index value.", "if", "(", "typeof", "vRowIndicator", "===", "\"number\"", ")", "{", "if", "(", "vRowIndicator", "<", "0", "||", "vRowIndicator", ">=", "oTable", ".", "_getTotalRowCount", "(", ")", ")", "{", "return", "false", ";", "}", "return", "setSelectionState", "(", "vRowIndicator", ")", ";", "// Variable vRowIndicator is a jQuery object or DOM element.", "}", "else", "{", "var", "$Cell", "=", "jQuery", "(", "vRowIndicator", ")", ";", "var", "oCellInfo", "=", "TableUtils", ".", "getCellInfo", "(", "$Cell", "[", "0", "]", ")", ";", "var", "bIsRowSelectionAllowed", "=", "TableUtils", ".", "isRowSelectionAllowed", "(", "oTable", ")", ";", "if", "(", "!", "TableUtils", ".", "Grouping", ".", "isInGroupingRow", "(", "$Cell", "[", "0", "]", ")", "&&", "(", "(", "oCellInfo", ".", "isOfType", "(", "TableUtils", ".", "CELLTYPE", ".", "DATACELL", "|", "TableUtils", ".", "CELLTYPE", ".", "ROWACTION", ")", "&&", "bIsRowSelectionAllowed", ")", "||", "(", "oCellInfo", ".", "isOfType", "(", "TableUtils", ".", "CELLTYPE", ".", "ROWHEADER", ")", "&&", "TableUtils", ".", "isRowSelectorSelectionAllowed", "(", "oTable", ")", ")", ")", ")", "{", "var", "iAbsoluteRowIndex", ";", "if", "(", "oCellInfo", ".", "isOfType", "(", "TableUtils", ".", "CELLTYPE", ".", "DATACELL", ")", ")", "{", "iAbsoluteRowIndex", "=", "oTable", ".", "getRows", "(", ")", "[", "parseInt", "(", "$Cell", ".", "closest", "(", "\"tr\"", ",", "oTable", ".", "getDomRef", "(", ")", ")", ".", "attr", "(", "\"data-sap-ui-rowindex\"", ")", ")", "]", ".", "getIndex", "(", ")", ";", "}", "else", "{", "// CELLTYPES.ROWHEADER, CELLTYPES.ROWACTION", "iAbsoluteRowIndex", "=", "oTable", ".", "getRows", "(", ")", "[", "parseInt", "(", "$Cell", ".", "attr", "(", "\"data-sap-ui-rowindex\"", ")", ")", "]", ".", "getIndex", "(", ")", ";", "}", "return", "setSelectionState", "(", "iAbsoluteRowIndex", ")", ";", "}", "return", "false", ";", "}", "}" ]
Toggles the selection state of the row which contains the given cell DOM element. @param {sap.ui.table.Table} oTable Instance of the table. @param {jQuery | HTMLElement | int} vRowIndicator The data cell in the row, or the data row index of the row, where the selection state should be toggled. @param {boolean} [bSelect] If defined, then instead of toggling the desired state is set. @param {Function} [fnDoSelect] If defined, then instead of the default selection code, this custom callback is used. @returns {boolean} Returns <code>true</code> if the selection state of the row has been changed.
[ "Toggles", "the", "selection", "state", "of", "the", "row", "which", "contains", "the", "given", "cell", "DOM", "element", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/TableUtils.js#L457-L522
4,466
SAP/openui5
src/sap.ui.table/src/sap/ui/table/TableUtils.js
function(oTable) { var oNoData = oTable.getNoData(); if (oNoData instanceof Control) { return null; } else if (typeof oNoData === "string" || oTable.getNoData() instanceof String) { return oNoData; } else { return TableUtils.getResourceText("TBL_NO_DATA"); } }
javascript
function(oTable) { var oNoData = oTable.getNoData(); if (oNoData instanceof Control) { return null; } else if (typeof oNoData === "string" || oTable.getNoData() instanceof String) { return oNoData; } else { return TableUtils.getResourceText("TBL_NO_DATA"); } }
[ "function", "(", "oTable", ")", "{", "var", "oNoData", "=", "oTable", ".", "getNoData", "(", ")", ";", "if", "(", "oNoData", "instanceof", "Control", ")", "{", "return", "null", ";", "}", "else", "if", "(", "typeof", "oNoData", "===", "\"string\"", "||", "oTable", ".", "getNoData", "(", ")", "instanceof", "String", ")", "{", "return", "oNoData", ";", "}", "else", "{", "return", "TableUtils", ".", "getResourceText", "(", "\"TBL_NO_DATA\"", ")", ";", "}", "}" ]
Returns the text to be displayed as no data message. If a custom noData control is set null is returned. @param {sap.ui.table.Table} oTable Instance of the table. @returns {String | string | null} The no data text.
[ "Returns", "the", "text", "to", "be", "displayed", "as", "no", "data", "message", ".", "If", "a", "custom", "noData", "control", "is", "set", "null", "is", "returned", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/TableUtils.js#L531-L540
4,467
SAP/openui5
src/sap.ui.table/src/sap/ui/table/TableUtils.js
function(oTable) { if (oTable._iHeaderRowCount === undefined) { if (!oTable.getColumnHeaderVisible()) { oTable._iHeaderRowCount = 0; } else { var iHeaderRows = 1; var aColumns = oTable.getColumns(); for (var i = 0; i < aColumns.length; i++) { if (aColumns[i].shouldRender()) { // only visible columns need to be considered. We don't invoke getVisibleColumns due to // performance considerations. With several dozens of columns, it's quite costy to loop them twice. iHeaderRows = Math.max(iHeaderRows, aColumns[i].getMultiLabels().length); } } oTable._iHeaderRowCount = iHeaderRows; } } return oTable._iHeaderRowCount; }
javascript
function(oTable) { if (oTable._iHeaderRowCount === undefined) { if (!oTable.getColumnHeaderVisible()) { oTable._iHeaderRowCount = 0; } else { var iHeaderRows = 1; var aColumns = oTable.getColumns(); for (var i = 0; i < aColumns.length; i++) { if (aColumns[i].shouldRender()) { // only visible columns need to be considered. We don't invoke getVisibleColumns due to // performance considerations. With several dozens of columns, it's quite costy to loop them twice. iHeaderRows = Math.max(iHeaderRows, aColumns[i].getMultiLabels().length); } } oTable._iHeaderRowCount = iHeaderRows; } } return oTable._iHeaderRowCount; }
[ "function", "(", "oTable", ")", "{", "if", "(", "oTable", ".", "_iHeaderRowCount", "===", "undefined", ")", "{", "if", "(", "!", "oTable", ".", "getColumnHeaderVisible", "(", ")", ")", "{", "oTable", ".", "_iHeaderRowCount", "=", "0", ";", "}", "else", "{", "var", "iHeaderRows", "=", "1", ";", "var", "aColumns", "=", "oTable", ".", "getColumns", "(", ")", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "aColumns", ".", "length", ";", "i", "++", ")", "{", "if", "(", "aColumns", "[", "i", "]", ".", "shouldRender", "(", ")", ")", "{", "// only visible columns need to be considered. We don't invoke getVisibleColumns due to", "// performance considerations. With several dozens of columns, it's quite costy to loop them twice.", "iHeaderRows", "=", "Math", ".", "max", "(", "iHeaderRows", ",", "aColumns", "[", "i", "]", ".", "getMultiLabels", "(", ")", ".", "length", ")", ";", "}", "}", "oTable", ".", "_iHeaderRowCount", "=", "iHeaderRows", ";", "}", "}", "return", "oTable", ".", "_iHeaderRowCount", ";", "}" ]
Returns the number of header rows. @param {sap.ui.table.Table} oTable Instance of the table. @returns {int} The number of rows in the table header.
[ "Returns", "the", "number", "of", "header", "rows", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/TableUtils.js#L558-L577
4,468
SAP/openui5
src/sap.ui.table/src/sap/ui/table/TableUtils.js
function(oTable, iIndex, oEvent) { var oIN = oTable._getItemNavigation(); if (oIN) { oIN.focusItem(iIndex, oEvent); } }
javascript
function(oTable, iIndex, oEvent) { var oIN = oTable._getItemNavigation(); if (oIN) { oIN.focusItem(iIndex, oEvent); } }
[ "function", "(", "oTable", ",", "iIndex", ",", "oEvent", ")", "{", "var", "oIN", "=", "oTable", ".", "_getItemNavigation", "(", ")", ";", "if", "(", "oIN", ")", "{", "oIN", ".", "focusItem", "(", "iIndex", ",", "oEvent", ")", ";", "}", "}" ]
Focus the item with the given index in the item navigation. @param {sap.ui.table.Table} oTable Instance of the table. @param {int} iIndex Index of item in ItemNavigation which shall get the focus. @param {Object} oEvent The event object.
[ "Focus", "the", "item", "with", "the", "given", "index", "in", "the", "item", "navigation", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/TableUtils.js#L687-L692
4,469
SAP/openui5
src/sap.ui.table/src/sap/ui/table/TableUtils.js
function(oTable, oElement, bIncludePseudoCells) { bIncludePseudoCells = bIncludePseudoCells === true; if (!oTable || !oElement) { return null; } var $Element = jQuery(oElement); var oTableElement = oTable.getDomRef(); var sSelector = ".sapUiTableCell"; if (!bIncludePseudoCells) { sSelector += ":not(.sapUiTablePseudoCell)"; } var $Cell = $Element.closest(sSelector, oTableElement); if ($Cell.length > 0) { return $Cell; } return null; }
javascript
function(oTable, oElement, bIncludePseudoCells) { bIncludePseudoCells = bIncludePseudoCells === true; if (!oTable || !oElement) { return null; } var $Element = jQuery(oElement); var oTableElement = oTable.getDomRef(); var sSelector = ".sapUiTableCell"; if (!bIncludePseudoCells) { sSelector += ":not(.sapUiTablePseudoCell)"; } var $Cell = $Element.closest(sSelector, oTableElement); if ($Cell.length > 0) { return $Cell; } return null; }
[ "function", "(", "oTable", ",", "oElement", ",", "bIncludePseudoCells", ")", "{", "bIncludePseudoCells", "=", "bIncludePseudoCells", "===", "true", ";", "if", "(", "!", "oTable", "||", "!", "oElement", ")", "{", "return", "null", ";", "}", "var", "$Element", "=", "jQuery", "(", "oElement", ")", ";", "var", "oTableElement", "=", "oTable", ".", "getDomRef", "(", ")", ";", "var", "sSelector", "=", "\".sapUiTableCell\"", ";", "if", "(", "!", "bIncludePseudoCells", ")", "{", "sSelector", "+=", "\":not(.sapUiTablePseudoCell)\"", ";", "}", "var", "$Cell", "=", "$Element", ".", "closest", "(", "sSelector", ",", "oTableElement", ")", ";", "if", "(", "$Cell", ".", "length", ">", "0", ")", "{", "return", "$Cell", ";", "}", "return", "null", ";", "}" ]
Returns the table cell which is either the parent of an element, or returns the element if it is a table cell itself. @param {sap.ui.table.Table} oTable Instance of the table used as the context within which to search for the cell. @param {jQuery | HTMLElement} oElement A table cell or an element inside a table cell. @param {jQuery | HTMLElement} [bIncludePseudoCells=false] Whether to include pseudo cells. @returns {jQuery | null} Returns <code>null</code>, if the element is neither a table cell nor inside a table cell.
[ "Returns", "the", "table", "cell", "which", "is", "either", "the", "parent", "of", "an", "element", "or", "returns", "the", "element", "if", "it", "is", "a", "table", "cell", "itself", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/TableUtils.js#L861-L883
4,470
SAP/openui5
src/sap.ui.table/src/sap/ui/table/TableUtils.js
function(oTable, oElement, bIncludePseudoCells) { bIncludePseudoCells = bIncludePseudoCells === true; var $Element = jQuery(oElement); var $Cell = TableUtils.getCell(oTable, oElement, bIncludePseudoCells); if (!$Cell || $Cell[0] === $Element[0]) { return null; // The element is not inside a table cell. } else { return $Cell; } }
javascript
function(oTable, oElement, bIncludePseudoCells) { bIncludePseudoCells = bIncludePseudoCells === true; var $Element = jQuery(oElement); var $Cell = TableUtils.getCell(oTable, oElement, bIncludePseudoCells); if (!$Cell || $Cell[0] === $Element[0]) { return null; // The element is not inside a table cell. } else { return $Cell; } }
[ "function", "(", "oTable", ",", "oElement", ",", "bIncludePseudoCells", ")", "{", "bIncludePseudoCells", "=", "bIncludePseudoCells", "===", "true", ";", "var", "$Element", "=", "jQuery", "(", "oElement", ")", ";", "var", "$Cell", "=", "TableUtils", ".", "getCell", "(", "oTable", ",", "oElement", ",", "bIncludePseudoCells", ")", ";", "if", "(", "!", "$Cell", "||", "$Cell", "[", "0", "]", "===", "$Element", "[", "0", "]", ")", "{", "return", "null", ";", "// The element is not inside a table cell.", "}", "else", "{", "return", "$Cell", ";", "}", "}" ]
Returns the table cell which is the parent of an element. @param {sap.ui.table.Table} oTable Instance of the table used as the context within which to search for the parent cell. @param {jQuery | HTMLElement} oElement An element inside a table cell. @param {jQuery | HTMLElement} [bIncludePseudoCells=false] Whether to include pseudo cells. @returns {jQuery | null} Returns <code>null</code>, if the element is not inside a table cell.
[ "Returns", "the", "table", "cell", "which", "is", "the", "parent", "of", "an", "element", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/TableUtils.js#L893-L904
4,471
SAP/openui5
src/sap.ui.table/src/sap/ui/table/TableUtils.js
function(oTable, sIdSuffix, fnHandler, bRegisterParent) { var oDomRef; if (typeof sIdSuffix == "string") { oDomRef = oTable.getDomRef(sIdSuffix); } else { Log.error("sIdSuffix must be a string", oTable); return undefined; } if (typeof fnHandler !== "function") { Log.error("fnHandler must be a function", oTable); return undefined; } // make sure that each DOM element of the table can only have one resize handler in order to avoid memory leaks TableUtils.deregisterResizeHandler(oTable, sIdSuffix); if (!oTable._mResizeHandlerIds) { oTable._mResizeHandlerIds = {}; } if (bRegisterParent && oDomRef) { oDomRef = oDomRef.parentNode; } if (oDomRef) { oTable._mResizeHandlerIds[sIdSuffix] = ResizeHandler.register(oDomRef, fnHandler); } return oTable._mResizeHandlerIds[sIdSuffix]; }
javascript
function(oTable, sIdSuffix, fnHandler, bRegisterParent) { var oDomRef; if (typeof sIdSuffix == "string") { oDomRef = oTable.getDomRef(sIdSuffix); } else { Log.error("sIdSuffix must be a string", oTable); return undefined; } if (typeof fnHandler !== "function") { Log.error("fnHandler must be a function", oTable); return undefined; } // make sure that each DOM element of the table can only have one resize handler in order to avoid memory leaks TableUtils.deregisterResizeHandler(oTable, sIdSuffix); if (!oTable._mResizeHandlerIds) { oTable._mResizeHandlerIds = {}; } if (bRegisterParent && oDomRef) { oDomRef = oDomRef.parentNode; } if (oDomRef) { oTable._mResizeHandlerIds[sIdSuffix] = ResizeHandler.register(oDomRef, fnHandler); } return oTable._mResizeHandlerIds[sIdSuffix]; }
[ "function", "(", "oTable", ",", "sIdSuffix", ",", "fnHandler", ",", "bRegisterParent", ")", "{", "var", "oDomRef", ";", "if", "(", "typeof", "sIdSuffix", "==", "\"string\"", ")", "{", "oDomRef", "=", "oTable", ".", "getDomRef", "(", "sIdSuffix", ")", ";", "}", "else", "{", "Log", ".", "error", "(", "\"sIdSuffix must be a string\"", ",", "oTable", ")", ";", "return", "undefined", ";", "}", "if", "(", "typeof", "fnHandler", "!==", "\"function\"", ")", "{", "Log", ".", "error", "(", "\"fnHandler must be a function\"", ",", "oTable", ")", ";", "return", "undefined", ";", "}", "// make sure that each DOM element of the table can only have one resize handler in order to avoid memory leaks", "TableUtils", ".", "deregisterResizeHandler", "(", "oTable", ",", "sIdSuffix", ")", ";", "if", "(", "!", "oTable", ".", "_mResizeHandlerIds", ")", "{", "oTable", ".", "_mResizeHandlerIds", "=", "{", "}", ";", "}", "if", "(", "bRegisterParent", "&&", "oDomRef", ")", "{", "oDomRef", "=", "oDomRef", ".", "parentNode", ";", "}", "if", "(", "oDomRef", ")", "{", "oTable", ".", "_mResizeHandlerIds", "[", "sIdSuffix", "]", "=", "ResizeHandler", ".", "register", "(", "oDomRef", ",", "fnHandler", ")", ";", "}", "return", "oTable", ".", "_mResizeHandlerIds", "[", "sIdSuffix", "]", ";", "}" ]
Registers a ResizeHandler for a DOM reference identified by its ID suffix. The ResizeHandler ID is tracked in _mResizeHandlerIds of the table instance. The sIdSuffix is used as key. Existing ResizeHandlers will be de-registered before the new one is registered. @param {sap.ui.table.Table} oTable Instance of the table. @param {string} sIdSuffix ID suffix to identify the DOM element for which to register the ResizeHandler. @param {Function} fnHandler Function to handle the resize event. @param {boolean}[bRegisterParent] Flag to register the ResizeHandler for the parent DOM element of the one identified by sIdSuffix. @returns {int | undefined} ResizeHandler ID or undefined if the DOM element could not be found.
[ "Registers", "a", "ResizeHandler", "for", "a", "DOM", "reference", "identified", "by", "its", "ID", "suffix", ".", "The", "ResizeHandler", "ID", "is", "tracked", "in", "_mResizeHandlerIds", "of", "the", "table", "instance", ".", "The", "sIdSuffix", "is", "used", "as", "key", ".", "Existing", "ResizeHandlers", "will", "be", "de", "-", "registered", "before", "the", "new", "one", "is", "registered", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/TableUtils.js#L917-L947
4,472
SAP/openui5
src/sap.ui.table/src/sap/ui/table/TableUtils.js
function(oTable, vIdSuffix) { var aIdSuffix; if (!oTable._mResizeHandlerIds) { // no resize handler registered so far return; } if (typeof vIdSuffix == "string") { aIdSuffix = [vIdSuffix]; } else if (vIdSuffix === undefined) { aIdSuffix = []; // de-register all resize handlers if no specific is named for (var sKey in oTable._mResizeHandlerIds) { if (typeof sKey == "string" && oTable._mResizeHandlerIds.hasOwnProperty(sKey)) { aIdSuffix.push(sKey); } } } else if (Array.isArray(vIdSuffix)) { aIdSuffix = vIdSuffix; } for (var i = 0; i < aIdSuffix.length; i++) { var sIdSuffix = aIdSuffix[i]; if (oTable._mResizeHandlerIds[sIdSuffix]) { ResizeHandler.deregister(oTable._mResizeHandlerIds[sIdSuffix]); oTable._mResizeHandlerIds[sIdSuffix] = undefined; } } }
javascript
function(oTable, vIdSuffix) { var aIdSuffix; if (!oTable._mResizeHandlerIds) { // no resize handler registered so far return; } if (typeof vIdSuffix == "string") { aIdSuffix = [vIdSuffix]; } else if (vIdSuffix === undefined) { aIdSuffix = []; // de-register all resize handlers if no specific is named for (var sKey in oTable._mResizeHandlerIds) { if (typeof sKey == "string" && oTable._mResizeHandlerIds.hasOwnProperty(sKey)) { aIdSuffix.push(sKey); } } } else if (Array.isArray(vIdSuffix)) { aIdSuffix = vIdSuffix; } for (var i = 0; i < aIdSuffix.length; i++) { var sIdSuffix = aIdSuffix[i]; if (oTable._mResizeHandlerIds[sIdSuffix]) { ResizeHandler.deregister(oTable._mResizeHandlerIds[sIdSuffix]); oTable._mResizeHandlerIds[sIdSuffix] = undefined; } } }
[ "function", "(", "oTable", ",", "vIdSuffix", ")", "{", "var", "aIdSuffix", ";", "if", "(", "!", "oTable", ".", "_mResizeHandlerIds", ")", "{", "// no resize handler registered so far", "return", ";", "}", "if", "(", "typeof", "vIdSuffix", "==", "\"string\"", ")", "{", "aIdSuffix", "=", "[", "vIdSuffix", "]", ";", "}", "else", "if", "(", "vIdSuffix", "===", "undefined", ")", "{", "aIdSuffix", "=", "[", "]", ";", "// de-register all resize handlers if no specific is named", "for", "(", "var", "sKey", "in", "oTable", ".", "_mResizeHandlerIds", ")", "{", "if", "(", "typeof", "sKey", "==", "\"string\"", "&&", "oTable", ".", "_mResizeHandlerIds", ".", "hasOwnProperty", "(", "sKey", ")", ")", "{", "aIdSuffix", ".", "push", "(", "sKey", ")", ";", "}", "}", "}", "else", "if", "(", "Array", ".", "isArray", "(", "vIdSuffix", ")", ")", "{", "aIdSuffix", "=", "vIdSuffix", ";", "}", "for", "(", "var", "i", "=", "0", ";", "i", "<", "aIdSuffix", ".", "length", ";", "i", "++", ")", "{", "var", "sIdSuffix", "=", "aIdSuffix", "[", "i", "]", ";", "if", "(", "oTable", ".", "_mResizeHandlerIds", "[", "sIdSuffix", "]", ")", "{", "ResizeHandler", ".", "deregister", "(", "oTable", ".", "_mResizeHandlerIds", "[", "sIdSuffix", "]", ")", ";", "oTable", ".", "_mResizeHandlerIds", "[", "sIdSuffix", "]", "=", "undefined", ";", "}", "}", "}" ]
De-register ResizeHandler identified by sIdSuffix. If sIdSuffix is undefined, all know ResizeHandlers will be de-registered. @param {sap.ui.table.Table} oTable Instance of the table. @param {string | Array.<string>} [vIdSuffix] ID suffix to identify the ResizeHandler to de-register. If undefined, all will be de-registered.
[ "De", "-", "register", "ResizeHandler", "identified", "by", "sIdSuffix", ".", "If", "sIdSuffix", "is", "undefined", "all", "know", "ResizeHandlers", "will", "be", "de", "-", "registered", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/TableUtils.js#L956-L984
4,473
SAP/openui5
src/sap.ui.table/src/sap/ui/table/TableUtils.js
function(vObject, vCall, oThis) { var oObject = typeof vObject === "function" ? vObject() : vObject; if (!oObject || !vCall) { return undefined; } oThis = oThis || oObject; if (typeof vCall === "function") { vCall.call(oThis, oObject); return undefined; } else { var aParameters; var aReturnValues = []; for (var sFunctionName in vCall) { if (typeof oObject[sFunctionName] === "function") { aParameters = vCall[sFunctionName]; aReturnValues.push(oObject[sFunctionName].apply(oThis, aParameters)); } else { aReturnValues.push(undefined); } } if (aReturnValues.length === 1) { return aReturnValues[0]; } else { return aReturnValues; } } }
javascript
function(vObject, vCall, oThis) { var oObject = typeof vObject === "function" ? vObject() : vObject; if (!oObject || !vCall) { return undefined; } oThis = oThis || oObject; if (typeof vCall === "function") { vCall.call(oThis, oObject); return undefined; } else { var aParameters; var aReturnValues = []; for (var sFunctionName in vCall) { if (typeof oObject[sFunctionName] === "function") { aParameters = vCall[sFunctionName]; aReturnValues.push(oObject[sFunctionName].apply(oThis, aParameters)); } else { aReturnValues.push(undefined); } } if (aReturnValues.length === 1) { return aReturnValues[0]; } else { return aReturnValues; } } }
[ "function", "(", "vObject", ",", "vCall", ",", "oThis", ")", "{", "var", "oObject", "=", "typeof", "vObject", "===", "\"function\"", "?", "vObject", "(", ")", ":", "vObject", ";", "if", "(", "!", "oObject", "||", "!", "vCall", ")", "{", "return", "undefined", ";", "}", "oThis", "=", "oThis", "||", "oObject", ";", "if", "(", "typeof", "vCall", "===", "\"function\"", ")", "{", "vCall", ".", "call", "(", "oThis", ",", "oObject", ")", ";", "return", "undefined", ";", "}", "else", "{", "var", "aParameters", ";", "var", "aReturnValues", "=", "[", "]", ";", "for", "(", "var", "sFunctionName", "in", "vCall", ")", "{", "if", "(", "typeof", "oObject", "[", "sFunctionName", "]", "===", "\"function\"", ")", "{", "aParameters", "=", "vCall", "[", "sFunctionName", "]", ";", "aReturnValues", ".", "push", "(", "oObject", "[", "sFunctionName", "]", ".", "apply", "(", "oThis", ",", "aParameters", ")", ")", ";", "}", "else", "{", "aReturnValues", ".", "push", "(", "undefined", ")", ";", "}", "}", "if", "(", "aReturnValues", ".", "length", "===", "1", ")", "{", "return", "aReturnValues", "[", "0", "]", ";", "}", "else", "{", "return", "aReturnValues", ";", "}", "}", "}" ]
Facilitates dynamic calling. @param {function():T | T} vObject The object, or a function returning the object, on which methods will be called. @param {function(this:U, T) | Object<string, Array.<*>>} vCall Called if <code>vObject</code> is, or returns an object. @param {U} [oThis] Context in the function calls, or in the callback if <code>vCall</code>is a function. Default is <code>vObject</code>. @returns {undefined | Array.<*>} If <code>vCall</code> is a map, the return values of the calls are returned. In case of multiple calls, an array of return values is returned. @template T, U
[ "Facilitates", "dynamic", "calling", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/TableUtils.js#L1197-L1226
4,474
SAP/openui5
src/sap.ui.table/src/sap/ui/table/TableUtils.js
function(fn, mOptions) { // Functionality taken from lodash open source library and adapted as needed mOptions = Object.assign({ wait: 0, leading: true }, mOptions); mOptions.maxWait = mOptions.wait; mOptions.trailing = true; mOptions.requestAnimationFrame = false; return TableUtils.debounce(fn, mOptions); }
javascript
function(fn, mOptions) { // Functionality taken from lodash open source library and adapted as needed mOptions = Object.assign({ wait: 0, leading: true }, mOptions); mOptions.maxWait = mOptions.wait; mOptions.trailing = true; mOptions.requestAnimationFrame = false; return TableUtils.debounce(fn, mOptions); }
[ "function", "(", "fn", ",", "mOptions", ")", "{", "// Functionality taken from lodash open source library and adapted as needed", "mOptions", "=", "Object", ".", "assign", "(", "{", "wait", ":", "0", ",", "leading", ":", "true", "}", ",", "mOptions", ")", ";", "mOptions", ".", "maxWait", "=", "mOptions", ".", "wait", ";", "mOptions", ".", "trailing", "=", "true", ";", "mOptions", ".", "requestAnimationFrame", "=", "false", ";", "return", "TableUtils", ".", "debounce", "(", "fn", ",", "mOptions", ")", ";", "}" ]
Invokes a method in a certain interval, regardless of how many times it was called. @param {Function} fn The method to throttle. @param {Object} [mOptions] The options that influence when the throttled method will be invoked. @param {int} [mOptions.wait=0] The amount of milliseconds to wait until actually invoking the method. @param {boolean} [mOptions.leading=true] Whether the method should be invoked on the first call. @param {boolean} [mOptions.asyncLeading=false] Whether the leading invocation should be asynchronous. @returns {Function} Returns the throttled method.
[ "Invokes", "a", "method", "in", "a", "certain", "interval", "regardless", "of", "how", "many", "times", "it", "was", "called", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/TableUtils.js#L1238-L1250
4,475
SAP/openui5
src/sap.ui.table/src/sap/ui/table/TableUtils.js
invoke
function invoke(vContext, vArguments, bAsync, bFinal) { iLastInvocationTime = bFinal === true ? null : Date.now(); if (vArguments == null) { return; } if (bAsync === true) { var oPromise = Promise.resolve().then(function() { if (!oPromise.canceled) { fn.apply(vContext, vArguments); } oCancelablePromise = null; }); oPromise.cancel = function() { oPromise.canceled = true; }; oCancelablePromise = oPromise; } else { fn.apply(vContext, vArguments); } }
javascript
function invoke(vContext, vArguments, bAsync, bFinal) { iLastInvocationTime = bFinal === true ? null : Date.now(); if (vArguments == null) { return; } if (bAsync === true) { var oPromise = Promise.resolve().then(function() { if (!oPromise.canceled) { fn.apply(vContext, vArguments); } oCancelablePromise = null; }); oPromise.cancel = function() { oPromise.canceled = true; }; oCancelablePromise = oPromise; } else { fn.apply(vContext, vArguments); } }
[ "function", "invoke", "(", "vContext", ",", "vArguments", ",", "bAsync", ",", "bFinal", ")", "{", "iLastInvocationTime", "=", "bFinal", "===", "true", "?", "null", ":", "Date", ".", "now", "(", ")", ";", "if", "(", "vArguments", "==", "null", ")", "{", "return", ";", "}", "if", "(", "bAsync", "===", "true", ")", "{", "var", "oPromise", "=", "Promise", ".", "resolve", "(", ")", ".", "then", "(", "function", "(", ")", "{", "if", "(", "!", "oPromise", ".", "canceled", ")", "{", "fn", ".", "apply", "(", "vContext", ",", "vArguments", ")", ";", "}", "oCancelablePromise", "=", "null", ";", "}", ")", ";", "oPromise", ".", "cancel", "=", "function", "(", ")", "{", "oPromise", ".", "canceled", "=", "true", ";", "}", ";", "oCancelablePromise", "=", "oPromise", ";", "}", "else", "{", "fn", ".", "apply", "(", "vContext", ",", "vArguments", ")", ";", "}", "}" ]
Calls the method. Only calls the method if an arguments object is provided. @param {any} [vContext] The context of the call. @param {Object} [vArguments] The arguments object. @param {boolean} [bAsync=false] Whether the method should be called in a promise. @param {boolean} [bFinal=false] Whether this is the final invocation before cancellation.
[ "Calls", "the", "method", ".", "Only", "calls", "the", "method", "if", "an", "arguments", "object", "is", "provided", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/TableUtils.js#L1299-L1320
4,476
SAP/openui5
src/sap.ui.table/src/sap/ui/table/TableUtils.js
invokeDebounced
function invokeDebounced(vContext, vArguments) { cancelTimer(); /** * Executes a trailing invocation if it is enabled in the options. * * @param {boolean} [bFinal=true] Whether this is the final invocation. */ function _invoke(bFinal) { bFinal = bFinal !== false; if (bFinal) { cancel(); } if (mOptions.trailing) { invoke(vContext, vArguments, null, bFinal); } } if (mOptions.requestAnimationFrame) { iTimerId = window.requestAnimationFrame(function() { _invoke(); }); } else { var iNow = Date.now(); var iTimeSinceLastInvocation = iLastInvocationTime == null ? 0 : iNow - iLastInvocationTime; var iRemainingWaitTime = Math.max(0, bMaxWait ? Math.min(mOptions.maxWait - iTimeSinceLastInvocation, mOptions.wait) : mOptions.wait); var bMaxWaitInvocation = iRemainingWaitTime < mOptions.wait; iTimerId = setTimeout(function() { if (bMaxWaitInvocation) { var iTimerOvertime = Math.max(0, (Date.now() - iNow) - iRemainingWaitTime); var iCancelWaitTime = mOptions.wait - iRemainingWaitTime; if (iTimerOvertime > iCancelWaitTime) { // The timer took longer, maybe because of a long-running synchronous execution. No need to wait more. _invoke(); } else { // Because there is some time left, the timer is restarted for cleanup. This is necessary for correct scheduling if // the debounced method is called again during this time. iTimerId = setTimeout(cancel, iCancelWaitTime - iTimerOvertime); _invoke(false); } } else { _invoke(); } }, iRemainingWaitTime); } }
javascript
function invokeDebounced(vContext, vArguments) { cancelTimer(); /** * Executes a trailing invocation if it is enabled in the options. * * @param {boolean} [bFinal=true] Whether this is the final invocation. */ function _invoke(bFinal) { bFinal = bFinal !== false; if (bFinal) { cancel(); } if (mOptions.trailing) { invoke(vContext, vArguments, null, bFinal); } } if (mOptions.requestAnimationFrame) { iTimerId = window.requestAnimationFrame(function() { _invoke(); }); } else { var iNow = Date.now(); var iTimeSinceLastInvocation = iLastInvocationTime == null ? 0 : iNow - iLastInvocationTime; var iRemainingWaitTime = Math.max(0, bMaxWait ? Math.min(mOptions.maxWait - iTimeSinceLastInvocation, mOptions.wait) : mOptions.wait); var bMaxWaitInvocation = iRemainingWaitTime < mOptions.wait; iTimerId = setTimeout(function() { if (bMaxWaitInvocation) { var iTimerOvertime = Math.max(0, (Date.now() - iNow) - iRemainingWaitTime); var iCancelWaitTime = mOptions.wait - iRemainingWaitTime; if (iTimerOvertime > iCancelWaitTime) { // The timer took longer, maybe because of a long-running synchronous execution. No need to wait more. _invoke(); } else { // Because there is some time left, the timer is restarted for cleanup. This is necessary for correct scheduling if // the debounced method is called again during this time. iTimerId = setTimeout(cancel, iCancelWaitTime - iTimerOvertime); _invoke(false); } } else { _invoke(); } }, iRemainingWaitTime); } }
[ "function", "invokeDebounced", "(", "vContext", ",", "vArguments", ")", "{", "cancelTimer", "(", ")", ";", "/**\n\t\t\t\t * Executes a trailing invocation if it is enabled in the options.\n\t\t\t\t *\n\t\t\t\t * @param {boolean} [bFinal=true] Whether this is the final invocation.\n\t\t\t\t */", "function", "_invoke", "(", "bFinal", ")", "{", "bFinal", "=", "bFinal", "!==", "false", ";", "if", "(", "bFinal", ")", "{", "cancel", "(", ")", ";", "}", "if", "(", "mOptions", ".", "trailing", ")", "{", "invoke", "(", "vContext", ",", "vArguments", ",", "null", ",", "bFinal", ")", ";", "}", "}", "if", "(", "mOptions", ".", "requestAnimationFrame", ")", "{", "iTimerId", "=", "window", ".", "requestAnimationFrame", "(", "function", "(", ")", "{", "_invoke", "(", ")", ";", "}", ")", ";", "}", "else", "{", "var", "iNow", "=", "Date", ".", "now", "(", ")", ";", "var", "iTimeSinceLastInvocation", "=", "iLastInvocationTime", "==", "null", "?", "0", ":", "iNow", "-", "iLastInvocationTime", ";", "var", "iRemainingWaitTime", "=", "Math", ".", "max", "(", "0", ",", "bMaxWait", "?", "Math", ".", "min", "(", "mOptions", ".", "maxWait", "-", "iTimeSinceLastInvocation", ",", "mOptions", ".", "wait", ")", ":", "mOptions", ".", "wait", ")", ";", "var", "bMaxWaitInvocation", "=", "iRemainingWaitTime", "<", "mOptions", ".", "wait", ";", "iTimerId", "=", "setTimeout", "(", "function", "(", ")", "{", "if", "(", "bMaxWaitInvocation", ")", "{", "var", "iTimerOvertime", "=", "Math", ".", "max", "(", "0", ",", "(", "Date", ".", "now", "(", ")", "-", "iNow", ")", "-", "iRemainingWaitTime", ")", ";", "var", "iCancelWaitTime", "=", "mOptions", ".", "wait", "-", "iRemainingWaitTime", ";", "if", "(", "iTimerOvertime", ">", "iCancelWaitTime", ")", "{", "// The timer took longer, maybe because of a long-running synchronous execution. No need to wait more.", "_invoke", "(", ")", ";", "}", "else", "{", "// Because there is some time left, the timer is restarted for cleanup. This is necessary for correct scheduling if", "// the debounced method is called again during this time.", "iTimerId", "=", "setTimeout", "(", "cancel", ",", "iCancelWaitTime", "-", "iTimerOvertime", ")", ";", "_invoke", "(", "false", ")", ";", "}", "}", "else", "{", "_invoke", "(", ")", ";", "}", "}", ",", "iRemainingWaitTime", ")", ";", "}", "}" ]
Calls the method debounced. Multiple calls within a certain time will be reduced to one call. @param {any} [vContext] The context of the call. @param {Object} [vArguments] The arguments object.
[ "Calls", "the", "method", "debounced", ".", "Multiple", "calls", "within", "a", "certain", "time", "will", "be", "reduced", "to", "one", "call", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/TableUtils.js#L1328-L1376
4,477
SAP/openui5
src/sap.ui.table/src/sap/ui/table/TableUtils.js
_invoke
function _invoke(bFinal) { bFinal = bFinal !== false; if (bFinal) { cancel(); } if (mOptions.trailing) { invoke(vContext, vArguments, null, bFinal); } }
javascript
function _invoke(bFinal) { bFinal = bFinal !== false; if (bFinal) { cancel(); } if (mOptions.trailing) { invoke(vContext, vArguments, null, bFinal); } }
[ "function", "_invoke", "(", "bFinal", ")", "{", "bFinal", "=", "bFinal", "!==", "false", ";", "if", "(", "bFinal", ")", "{", "cancel", "(", ")", ";", "}", "if", "(", "mOptions", ".", "trailing", ")", "{", "invoke", "(", "vContext", ",", "vArguments", ",", "null", ",", "bFinal", ")", ";", "}", "}" ]
Executes a trailing invocation if it is enabled in the options. @param {boolean} [bFinal=true] Whether this is the final invocation.
[ "Executes", "a", "trailing", "invocation", "if", "it", "is", "enabled", "in", "the", "options", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/TableUtils.js#L1336-L1344
4,478
SAP/openui5
src/sap.ui.table/src/sap/ui/table/TableUtils.js
function(oCell) { if (!oCell) { return null; } var $Cell = jQuery(oCell); var oCellInfo = TableUtils.getCellInfo($Cell); if (oCellInfo.isOfType(CELLTYPE.ANY | CELLTYPE.PSEUDO)) { var $InteractiveElements = $Cell.find(INTERACTIVE_ELEMENT_SELECTORS); if ($InteractiveElements.length > 0) { return $InteractiveElements; } } return null; }
javascript
function(oCell) { if (!oCell) { return null; } var $Cell = jQuery(oCell); var oCellInfo = TableUtils.getCellInfo($Cell); if (oCellInfo.isOfType(CELLTYPE.ANY | CELLTYPE.PSEUDO)) { var $InteractiveElements = $Cell.find(INTERACTIVE_ELEMENT_SELECTORS); if ($InteractiveElements.length > 0) { return $InteractiveElements; } } return null; }
[ "function", "(", "oCell", ")", "{", "if", "(", "!", "oCell", ")", "{", "return", "null", ";", "}", "var", "$Cell", "=", "jQuery", "(", "oCell", ")", ";", "var", "oCellInfo", "=", "TableUtils", ".", "getCellInfo", "(", "$Cell", ")", ";", "if", "(", "oCellInfo", ".", "isOfType", "(", "CELLTYPE", ".", "ANY", "|", "CELLTYPE", ".", "PSEUDO", ")", ")", "{", "var", "$InteractiveElements", "=", "$Cell", ".", "find", "(", "INTERACTIVE_ELEMENT_SELECTORS", ")", ";", "if", "(", "$InteractiveElements", ".", "length", ">", "0", ")", "{", "return", "$InteractiveElements", ";", "}", "}", "return", "null", ";", "}" ]
Returns all interactive elements in a cell. @param {jQuery | HTMLElement} oCell The cell from which to get the interactive elements. @returns {jQuery | null} Returns <code>null</code>, if the passed cell is not a cell or does not contain any interactive elements.
[ "Returns", "all", "interactive", "elements", "in", "a", "cell", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/TableUtils.js#L1430-L1446
4,479
SAP/openui5
src/sap.ui.table/src/sap/ui/table/TableUtils.js
function(sCSSSize, bWithUnit) { var iPixelValue; if (typeof sCSSSize !== "string") { return null; } if (sCSSSize.endsWith("px")) { iPixelValue = parseInt(sCSSSize); } else if (sCSSSize.endsWith("em") || sCSSSize.endsWith("rem")) { iPixelValue = Math.ceil(parseFloat(sCSSSize) * TableUtils.getBaseFontSize()); } else { return null; } if (bWithUnit) { return iPixelValue + "px"; } else { return iPixelValue; } }
javascript
function(sCSSSize, bWithUnit) { var iPixelValue; if (typeof sCSSSize !== "string") { return null; } if (sCSSSize.endsWith("px")) { iPixelValue = parseInt(sCSSSize); } else if (sCSSSize.endsWith("em") || sCSSSize.endsWith("rem")) { iPixelValue = Math.ceil(parseFloat(sCSSSize) * TableUtils.getBaseFontSize()); } else { return null; } if (bWithUnit) { return iPixelValue + "px"; } else { return iPixelValue; } }
[ "function", "(", "sCSSSize", ",", "bWithUnit", ")", "{", "var", "iPixelValue", ";", "if", "(", "typeof", "sCSSSize", "!==", "\"string\"", ")", "{", "return", "null", ";", "}", "if", "(", "sCSSSize", ".", "endsWith", "(", "\"px\"", ")", ")", "{", "iPixelValue", "=", "parseInt", "(", "sCSSSize", ")", ";", "}", "else", "if", "(", "sCSSSize", ".", "endsWith", "(", "\"em\"", ")", "||", "sCSSSize", ".", "endsWith", "(", "\"rem\"", ")", ")", "{", "iPixelValue", "=", "Math", ".", "ceil", "(", "parseFloat", "(", "sCSSSize", ")", "*", "TableUtils", ".", "getBaseFontSize", "(", ")", ")", ";", "}", "else", "{", "return", "null", ";", "}", "if", "(", "bWithUnit", ")", "{", "return", "iPixelValue", "+", "\"px\"", ";", "}", "else", "{", "return", "iPixelValue", ";", "}", "}" ]
Converts the CSS size to pixels and returns it with or without unit. Can also be used to parse a pixel value string to an integer. @param {string} sCSSSize The CSSSize to convert. @param {boolean} [bWithUnit=false] Whether the value should be returned as a string with the unit. @returns {string | int | null} The pixel value as an integer, or string if <code>bWithUnit</code> is <code>true</code>. Returns <code>null</code> if the CSS size could not be converted.
[ "Converts", "the", "CSS", "size", "to", "pixels", "and", "returns", "it", "with", "or", "without", "unit", ".", "Can", "also", "be", "used", "to", "parse", "a", "pixel", "value", "string", "to", "an", "integer", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/TableUtils.js#L1456-L1476
4,480
SAP/openui5
src/sap.ui.core/src/sap/ui/performance/trace/Interaction.js
isValidRoundtrip
function isValidRoundtrip(oRequestTiming) { var bComplete, bEmpty, bCached; // if the request has been completed it has complete timing figures) bComplete = oRequestTiming.startTime > 0 && oRequestTiming.startTime <= oRequestTiming.requestStart && oRequestTiming.requestStart <= oRequestTiming.responseEnd; // encodedBodySize and transferSize info are not available in all browsers if (oRequestTiming.encodedBodySize !== undefined && oRequestTiming.transferSize !== undefined) { // if the body is empty a script tag responded from cache is assumed bEmpty = oRequestTiming.encodedBodySize === 0; // if transfer size is smaller than body an xhr responded from cache is assumed bCached = oRequestTiming.transferSize < oRequestTiming.encodedBodySize; } return bComplete && !bEmpty && !bCached; }
javascript
function isValidRoundtrip(oRequestTiming) { var bComplete, bEmpty, bCached; // if the request has been completed it has complete timing figures) bComplete = oRequestTiming.startTime > 0 && oRequestTiming.startTime <= oRequestTiming.requestStart && oRequestTiming.requestStart <= oRequestTiming.responseEnd; // encodedBodySize and transferSize info are not available in all browsers if (oRequestTiming.encodedBodySize !== undefined && oRequestTiming.transferSize !== undefined) { // if the body is empty a script tag responded from cache is assumed bEmpty = oRequestTiming.encodedBodySize === 0; // if transfer size is smaller than body an xhr responded from cache is assumed bCached = oRequestTiming.transferSize < oRequestTiming.encodedBodySize; } return bComplete && !bEmpty && !bCached; }
[ "function", "isValidRoundtrip", "(", "oRequestTiming", ")", "{", "var", "bComplete", ",", "bEmpty", ",", "bCached", ";", "// if the request has been completed it has complete timing figures)", "bComplete", "=", "oRequestTiming", ".", "startTime", ">", "0", "&&", "oRequestTiming", ".", "startTime", "<=", "oRequestTiming", ".", "requestStart", "&&", "oRequestTiming", ".", "requestStart", "<=", "oRequestTiming", ".", "responseEnd", ";", "// encodedBodySize and transferSize info are not available in all browsers", "if", "(", "oRequestTiming", ".", "encodedBodySize", "!==", "undefined", "&&", "oRequestTiming", ".", "transferSize", "!==", "undefined", ")", "{", "// if the body is empty a script tag responded from cache is assumed", "bEmpty", "=", "oRequestTiming", ".", "encodedBodySize", "===", "0", ";", "// if transfer size is smaller than body an xhr responded from cache is assumed", "bCached", "=", "oRequestTiming", ".", "transferSize", "<", "oRequestTiming", ".", "encodedBodySize", ";", "}", "return", "bComplete", "&&", "!", "bEmpty", "&&", "!", "bCached", ";", "}" ]
Valid timings are all timings which are completed, not empty and not responded from browser cache. Note: Currently only Chrome and FF support size related properties (body size and transfer size), hence the requests of others not supporting them are counted as complete (in dubio pro reo), as before. @param {object} oRequestTiming @private
[ "Valid", "timings", "are", "all", "timings", "which", "are", "completed", "not", "empty", "and", "not", "responded", "from", "browser", "cache", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/performance/trace/Interaction.js#L70-L87
4,481
SAP/openui5
src/sap.ui.core/src/sap/ui/performance/trace/Interaction.js
createOwnerComponentInfo
function createOwnerComponentInfo(oSrcElement) { var sId, sVersion; if (oSrcElement) { var Component, oComponent; Component = sap.ui.require("sap/ui/core/Component"); while (Component && oSrcElement && oSrcElement.getParent) { oComponent = Component.getOwnerComponentFor(oSrcElement); if (oComponent || oSrcElement instanceof Component) { oComponent = oComponent || oSrcElement; var oApp = oComponent.getManifestEntry("sap.app"); // get app id or module name for FESR sId = oApp && oApp.id || oComponent.getMetadata().getName(); sVersion = oApp && oApp.applicationVersion && oApp.applicationVersion.version; } oSrcElement = oSrcElement.getParent(); } } return { id: sId ? sId : "undetermined", version: sVersion ? sVersion : "" }; }
javascript
function createOwnerComponentInfo(oSrcElement) { var sId, sVersion; if (oSrcElement) { var Component, oComponent; Component = sap.ui.require("sap/ui/core/Component"); while (Component && oSrcElement && oSrcElement.getParent) { oComponent = Component.getOwnerComponentFor(oSrcElement); if (oComponent || oSrcElement instanceof Component) { oComponent = oComponent || oSrcElement; var oApp = oComponent.getManifestEntry("sap.app"); // get app id or module name for FESR sId = oApp && oApp.id || oComponent.getMetadata().getName(); sVersion = oApp && oApp.applicationVersion && oApp.applicationVersion.version; } oSrcElement = oSrcElement.getParent(); } } return { id: sId ? sId : "undetermined", version: sVersion ? sVersion : "" }; }
[ "function", "createOwnerComponentInfo", "(", "oSrcElement", ")", "{", "var", "sId", ",", "sVersion", ";", "if", "(", "oSrcElement", ")", "{", "var", "Component", ",", "oComponent", ";", "Component", "=", "sap", ".", "ui", ".", "require", "(", "\"sap/ui/core/Component\"", ")", ";", "while", "(", "Component", "&&", "oSrcElement", "&&", "oSrcElement", ".", "getParent", ")", "{", "oComponent", "=", "Component", ".", "getOwnerComponentFor", "(", "oSrcElement", ")", ";", "if", "(", "oComponent", "||", "oSrcElement", "instanceof", "Component", ")", "{", "oComponent", "=", "oComponent", "||", "oSrcElement", ";", "var", "oApp", "=", "oComponent", ".", "getManifestEntry", "(", "\"sap.app\"", ")", ";", "// get app id or module name for FESR", "sId", "=", "oApp", "&&", "oApp", ".", "id", "||", "oComponent", ".", "getMetadata", "(", ")", ".", "getName", "(", ")", ";", "sVersion", "=", "oApp", "&&", "oApp", ".", "applicationVersion", "&&", "oApp", ".", "applicationVersion", ".", "version", ";", "}", "oSrcElement", "=", "oSrcElement", ".", "getParent", "(", ")", ";", "}", "}", "return", "{", "id", ":", "sId", "?", "sId", ":", "\"undetermined\"", ",", "version", ":", "sVersion", "?", "sVersion", ":", "\"\"", "}", ";", "}" ]
component determination - heuristic
[ "component", "determination", "-", "heuristic" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/performance/trace/Interaction.js#L173-L194
4,482
SAP/openui5
src/sap.ui.core/src/sap/ui/performance/trace/Interaction.js
handleResponse
function handleResponse() { if (this.readyState === 4 && this.pendingInteraction && !this.pendingInteraction.completed) { // enrich interaction with information var sContentLength = this.getResponseHeader("content-length"), bCompressed = this.getResponseHeader("content-encoding") === "gzip", sFesrec = this.getResponseHeader("sap-perf-fesrec"); this.pendingInteraction.bytesReceived += sContentLength ? parseInt(sContentLength) : 0; this.pendingInteraction.bytesReceived += this.getAllResponseHeaders().length; this.pendingInteraction.bytesSent += this.requestHeaderLength || 0; // this should be true only if all responses are compressed this.pendingInteraction.requestCompression = bCompressed && (this.pendingInteraction.requestCompression !== false); // sap-perf-fesrec header contains milliseconds this.pendingInteraction.networkTime += sFesrec ? Math.round(parseFloat(sFesrec, 10) / 1000) : 0; var sSapStatistics = this.getResponseHeader("sap-statistics"); if (sSapStatistics) { var aTimings = window.performance.getEntriesByType("resource"); this.pendingInteraction.sapStatistics.push({ // add response url for mapping purposes url: this.responseURL, statistics: sSapStatistics, timing: aTimings ? aTimings[aTimings.length - 1] : undefined }); } delete this.requestHeaderLength; delete this.pendingInteraction; } }
javascript
function handleResponse() { if (this.readyState === 4 && this.pendingInteraction && !this.pendingInteraction.completed) { // enrich interaction with information var sContentLength = this.getResponseHeader("content-length"), bCompressed = this.getResponseHeader("content-encoding") === "gzip", sFesrec = this.getResponseHeader("sap-perf-fesrec"); this.pendingInteraction.bytesReceived += sContentLength ? parseInt(sContentLength) : 0; this.pendingInteraction.bytesReceived += this.getAllResponseHeaders().length; this.pendingInteraction.bytesSent += this.requestHeaderLength || 0; // this should be true only if all responses are compressed this.pendingInteraction.requestCompression = bCompressed && (this.pendingInteraction.requestCompression !== false); // sap-perf-fesrec header contains milliseconds this.pendingInteraction.networkTime += sFesrec ? Math.round(parseFloat(sFesrec, 10) / 1000) : 0; var sSapStatistics = this.getResponseHeader("sap-statistics"); if (sSapStatistics) { var aTimings = window.performance.getEntriesByType("resource"); this.pendingInteraction.sapStatistics.push({ // add response url for mapping purposes url: this.responseURL, statistics: sSapStatistics, timing: aTimings ? aTimings[aTimings.length - 1] : undefined }); } delete this.requestHeaderLength; delete this.pendingInteraction; } }
[ "function", "handleResponse", "(", ")", "{", "if", "(", "this", ".", "readyState", "===", "4", "&&", "this", ".", "pendingInteraction", "&&", "!", "this", ".", "pendingInteraction", ".", "completed", ")", "{", "// enrich interaction with information", "var", "sContentLength", "=", "this", ".", "getResponseHeader", "(", "\"content-length\"", ")", ",", "bCompressed", "=", "this", ".", "getResponseHeader", "(", "\"content-encoding\"", ")", "===", "\"gzip\"", ",", "sFesrec", "=", "this", ".", "getResponseHeader", "(", "\"sap-perf-fesrec\"", ")", ";", "this", ".", "pendingInteraction", ".", "bytesReceived", "+=", "sContentLength", "?", "parseInt", "(", "sContentLength", ")", ":", "0", ";", "this", ".", "pendingInteraction", ".", "bytesReceived", "+=", "this", ".", "getAllResponseHeaders", "(", ")", ".", "length", ";", "this", ".", "pendingInteraction", ".", "bytesSent", "+=", "this", ".", "requestHeaderLength", "||", "0", ";", "// this should be true only if all responses are compressed", "this", ".", "pendingInteraction", ".", "requestCompression", "=", "bCompressed", "&&", "(", "this", ".", "pendingInteraction", ".", "requestCompression", "!==", "false", ")", ";", "// sap-perf-fesrec header contains milliseconds", "this", ".", "pendingInteraction", ".", "networkTime", "+=", "sFesrec", "?", "Math", ".", "round", "(", "parseFloat", "(", "sFesrec", ",", "10", ")", "/", "1000", ")", ":", "0", ";", "var", "sSapStatistics", "=", "this", ".", "getResponseHeader", "(", "\"sap-statistics\"", ")", ";", "if", "(", "sSapStatistics", ")", "{", "var", "aTimings", "=", "window", ".", "performance", ".", "getEntriesByType", "(", "\"resource\"", ")", ";", "this", ".", "pendingInteraction", ".", "sapStatistics", ".", "push", "(", "{", "// add response url for mapping purposes", "url", ":", "this", ".", "responseURL", ",", "statistics", ":", "sSapStatistics", ",", "timing", ":", "aTimings", "?", "aTimings", "[", "aTimings", ".", "length", "-", "1", "]", ":", "undefined", "}", ")", ";", "}", "delete", "this", ".", "requestHeaderLength", ";", "delete", "this", ".", "pendingInteraction", ";", "}", "}" ]
response handler which uses the custom properties we added to the xhr to retrieve information from the response headers
[ "response", "handler", "which", "uses", "the", "custom", "properties", "we", "added", "to", "the", "xhr", "to", "retrieve", "information", "from", "the", "response", "headers" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/performance/trace/Interaction.js#L234-L260
4,483
SAP/openui5
src/sap.ui.core/src/sap/ui/performance/trace/Interaction.js
function(fnFilter) { var aFilteredInteractions = []; if (fnFilter) { for (var i = 0, l = aInteractions.length; i < l; i++) { if (fnFilter(aInteractions[i])) { aFilteredInteractions.push(aInteractions[i]); } } } return aFilteredInteractions; }
javascript
function(fnFilter) { var aFilteredInteractions = []; if (fnFilter) { for (var i = 0, l = aInteractions.length; i < l; i++) { if (fnFilter(aInteractions[i])) { aFilteredInteractions.push(aInteractions[i]); } } } return aFilteredInteractions; }
[ "function", "(", "fnFilter", ")", "{", "var", "aFilteredInteractions", "=", "[", "]", ";", "if", "(", "fnFilter", ")", "{", "for", "(", "var", "i", "=", "0", ",", "l", "=", "aInteractions", ".", "length", ";", "i", "<", "l", ";", "i", "++", ")", "{", "if", "(", "fnFilter", "(", "aInteractions", "[", "i", "]", ")", ")", "{", "aFilteredInteractions", ".", "push", "(", "aInteractions", "[", "i", "]", ")", ";", "}", "}", "}", "return", "aFilteredInteractions", ";", "}" ]
Gets all interaction measurements for which a provided filter function returns a truthy value. To filter for certain categories of measurements a fnFilter can be implemented like this <code> function(InteractionMeasurement) { return InteractionMeasurement.duration > 0 }</code> @param {function} fnFilter a filter function that returns true if the passed measurement should be added to the result @return {object[]} all interaction measurements passing the filter function successfully @static @private
[ "Gets", "all", "interaction", "measurements", "for", "which", "a", "provided", "filter", "function", "returns", "a", "truthy", "value", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/performance/trace/Interaction.js#L313-L323
4,484
SAP/openui5
src/sap.ui.core/src/sap/ui/performance/trace/Interaction.js
function(sType, oSrcElement) { var iTime = now(); if (oPendingInteraction) { finalizeInteraction(iTime); } // clear request timings for new interaction if (window.performance.clearResourceTimings) { window.performance.clearResourceTimings(); } var oComponentInfo = createOwnerComponentInfo(oSrcElement); // setup new pending interaction oPendingInteraction = createMeasurement(iTime); oPendingInteraction.event = sType; oPendingInteraction.component = oComponentInfo.id; oPendingInteraction.appVersion = oComponentInfo.version; oPendingInteraction.start = iTime; if (oSrcElement && oSrcElement.getId) { oPendingInteraction.trigger = oSrcElement.getId(); } Log.info("Interaction step started: trigger: " + oPendingInteraction.trigger + "; type: " + oPendingInteraction.event, "Interaction.js"); }
javascript
function(sType, oSrcElement) { var iTime = now(); if (oPendingInteraction) { finalizeInteraction(iTime); } // clear request timings for new interaction if (window.performance.clearResourceTimings) { window.performance.clearResourceTimings(); } var oComponentInfo = createOwnerComponentInfo(oSrcElement); // setup new pending interaction oPendingInteraction = createMeasurement(iTime); oPendingInteraction.event = sType; oPendingInteraction.component = oComponentInfo.id; oPendingInteraction.appVersion = oComponentInfo.version; oPendingInteraction.start = iTime; if (oSrcElement && oSrcElement.getId) { oPendingInteraction.trigger = oSrcElement.getId(); } Log.info("Interaction step started: trigger: " + oPendingInteraction.trigger + "; type: " + oPendingInteraction.event, "Interaction.js"); }
[ "function", "(", "sType", ",", "oSrcElement", ")", "{", "var", "iTime", "=", "now", "(", ")", ";", "if", "(", "oPendingInteraction", ")", "{", "finalizeInteraction", "(", "iTime", ")", ";", "}", "// clear request timings for new interaction", "if", "(", "window", ".", "performance", ".", "clearResourceTimings", ")", "{", "window", ".", "performance", ".", "clearResourceTimings", "(", ")", ";", "}", "var", "oComponentInfo", "=", "createOwnerComponentInfo", "(", "oSrcElement", ")", ";", "// setup new pending interaction", "oPendingInteraction", "=", "createMeasurement", "(", "iTime", ")", ";", "oPendingInteraction", ".", "event", "=", "sType", ";", "oPendingInteraction", ".", "component", "=", "oComponentInfo", ".", "id", ";", "oPendingInteraction", ".", "appVersion", "=", "oComponentInfo", ".", "version", ";", "oPendingInteraction", ".", "start", "=", "iTime", ";", "if", "(", "oSrcElement", "&&", "oSrcElement", ".", "getId", ")", "{", "oPendingInteraction", ".", "trigger", "=", "oSrcElement", ".", "getId", "(", ")", ";", "}", "Log", ".", "info", "(", "\"Interaction step started: trigger: \"", "+", "oPendingInteraction", ".", "trigger", "+", "\"; type: \"", "+", "oPendingInteraction", ".", "event", ",", "\"Interaction.js\"", ")", ";", "}" ]
Start an interaction measurements. @param {string} sType type of the event which triggered the interaction @param {object} oSrcElement the control on which the interaction was triggered @static @private
[ "Start", "an", "interaction", "measurements", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/performance/trace/Interaction.js#L352-L376
4,485
SAP/openui5
src/sap.ui.core/src/sap/ui/performance/trace/Interaction.js
function(bForce) { if (oPendingInteraction) { // set provisionary processing time from start to end and calculate later if (!bForce) { oPendingInteraction.processing = now() - oPendingInteraction.start; } else { finalizeInteraction(now()); } } }
javascript
function(bForce) { if (oPendingInteraction) { // set provisionary processing time from start to end and calculate later if (!bForce) { oPendingInteraction.processing = now() - oPendingInteraction.start; } else { finalizeInteraction(now()); } } }
[ "function", "(", "bForce", ")", "{", "if", "(", "oPendingInteraction", ")", "{", "// set provisionary processing time from start to end and calculate later", "if", "(", "!", "bForce", ")", "{", "oPendingInteraction", ".", "processing", "=", "now", "(", ")", "-", "oPendingInteraction", ".", "start", ";", "}", "else", "{", "finalizeInteraction", "(", "now", "(", ")", ")", ";", "}", "}", "}" ]
End an interaction measurements. @param {boolean} bForce forces end of interaction now and ignores further re-renderings @static @private
[ "End", "an", "interaction", "measurements", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/performance/trace/Interaction.js#L385-L394
4,486
SAP/openui5
src/sap.ui.core/src/sap/ui/performance/trace/Interaction.js
function(oEvent) { if (bInteractionActive) { // notify for a newly started interaction, but not more often than every 250ms. if (!iScrollEventDelayId) { Interaction.notifyEventStart(oEvent); } else { clearTimeout(iScrollEventDelayId); } iScrollEventDelayId = setTimeout(function(){ Interaction.notifyStepStart(); iScrollEventDelayId = 0; }, 250); } }
javascript
function(oEvent) { if (bInteractionActive) { // notify for a newly started interaction, but not more often than every 250ms. if (!iScrollEventDelayId) { Interaction.notifyEventStart(oEvent); } else { clearTimeout(iScrollEventDelayId); } iScrollEventDelayId = setTimeout(function(){ Interaction.notifyStepStart(); iScrollEventDelayId = 0; }, 250); } }
[ "function", "(", "oEvent", ")", "{", "if", "(", "bInteractionActive", ")", "{", "// notify for a newly started interaction, but not more often than every 250ms.", "if", "(", "!", "iScrollEventDelayId", ")", "{", "Interaction", ".", "notifyEventStart", "(", "oEvent", ")", ";", "}", "else", "{", "clearTimeout", "(", "iScrollEventDelayId", ")", ";", "}", "iScrollEventDelayId", "=", "setTimeout", "(", "function", "(", ")", "{", "Interaction", ".", "notifyStepStart", "(", ")", ";", "iScrollEventDelayId", "=", "0", ";", "}", ",", "250", ")", ";", "}", "}" ]
This method notifies if a scroll event has been triggered. Some controls require this special treatment, as the generic detection process via notifyEventStart is not sufficient. @param {Event} oEvent Scroll event whose processing has started @static @private
[ "This", "method", "notifies", "if", "a", "scroll", "event", "has", "been", "triggered", ".", "Some", "controls", "require", "this", "special", "treatment", "as", "the", "generic", "detection", "process", "via", "notifyEventStart", "is", "not", "sufficient", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/performance/trace/Interaction.js#L493-L506
4,487
SAP/openui5
src/sap.ui.core/src/sap/ui/core/util/MockServer.js
function(data, select, currentPath) { var result = {}; // traversed path to get to data: currentPath = currentPath || ''; if (typeof data !== 'object') { return data; } if (typeof data.slice === 'function') { return data.map(function(el, index) { return fnMultiSelect(el, select, currentPath); // on same path }); } // If Object: // Handle "__metadata" property if (data.__metadata !== undefined && currentPath.length === 0) { result.__metadata = data.__metadata; } // Take the relevant paths only. select.filter(function(path) { return (path + '/').indexOf(currentPath) === 0; }).forEach(function(path, _, innerSelect) { // then get the next property in given path var propertyKey = path.substr(currentPath.length).split('/')[0]; // Check if we have that propertyKey on the current object if (data[propertyKey] !== undefined) { // in this case recurse again while adding this to the current path result[propertyKey] = fnMultiSelect(data[propertyKey], innerSelect, currentPath + propertyKey + '/'); } }); // Add specific results case handling if (data.results !== undefined) { // recurse with same path result.results = fnMultiSelect(data.results, select, currentPath); } return result; }
javascript
function(data, select, currentPath) { var result = {}; // traversed path to get to data: currentPath = currentPath || ''; if (typeof data !== 'object') { return data; } if (typeof data.slice === 'function') { return data.map(function(el, index) { return fnMultiSelect(el, select, currentPath); // on same path }); } // If Object: // Handle "__metadata" property if (data.__metadata !== undefined && currentPath.length === 0) { result.__metadata = data.__metadata; } // Take the relevant paths only. select.filter(function(path) { return (path + '/').indexOf(currentPath) === 0; }).forEach(function(path, _, innerSelect) { // then get the next property in given path var propertyKey = path.substr(currentPath.length).split('/')[0]; // Check if we have that propertyKey on the current object if (data[propertyKey] !== undefined) { // in this case recurse again while adding this to the current path result[propertyKey] = fnMultiSelect(data[propertyKey], innerSelect, currentPath + propertyKey + '/'); } }); // Add specific results case handling if (data.results !== undefined) { // recurse with same path result.results = fnMultiSelect(data.results, select, currentPath); } return result; }
[ "function", "(", "data", ",", "select", ",", "currentPath", ")", "{", "var", "result", "=", "{", "}", ";", "// traversed path to get to data:", "currentPath", "=", "currentPath", "||", "''", ";", "if", "(", "typeof", "data", "!==", "'object'", ")", "{", "return", "data", ";", "}", "if", "(", "typeof", "data", ".", "slice", "===", "'function'", ")", "{", "return", "data", ".", "map", "(", "function", "(", "el", ",", "index", ")", "{", "return", "fnMultiSelect", "(", "el", ",", "select", ",", "currentPath", ")", ";", "// on same path", "}", ")", ";", "}", "// If Object:", "// Handle \"__metadata\" property", "if", "(", "data", ".", "__metadata", "!==", "undefined", "&&", "currentPath", ".", "length", "===", "0", ")", "{", "result", ".", "__metadata", "=", "data", ".", "__metadata", ";", "}", "// Take the relevant paths only.", "select", ".", "filter", "(", "function", "(", "path", ")", "{", "return", "(", "path", "+", "'/'", ")", ".", "indexOf", "(", "currentPath", ")", "===", "0", ";", "}", ")", ".", "forEach", "(", "function", "(", "path", ",", "_", ",", "innerSelect", ")", "{", "// then get the next property in given path", "var", "propertyKey", "=", "path", ".", "substr", "(", "currentPath", ".", "length", ")", ".", "split", "(", "'/'", ")", "[", "0", "]", ";", "// Check if we have that propertyKey on the current object", "if", "(", "data", "[", "propertyKey", "]", "!==", "undefined", ")", "{", "// in this case recurse again while adding this to the current path", "result", "[", "propertyKey", "]", "=", "fnMultiSelect", "(", "data", "[", "propertyKey", "]", ",", "innerSelect", ",", "currentPath", "+", "propertyKey", "+", "'/'", ")", ";", "}", "}", ")", ";", "// Add specific results case handling", "if", "(", "data", ".", "results", "!==", "undefined", ")", "{", "// recurse with same path", "result", ".", "results", "=", "fnMultiSelect", "(", "data", ".", "results", ",", "select", ",", "currentPath", ")", ";", "}", "return", "result", ";", "}" ]
Add Support for multiple select return 1...n
[ "Add", "Support", "for", "multiple", "select", "return", "1", "...", "n" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/util/MockServer.js#L976-L1010
4,488
SAP/openui5
src/sap.ui.core/src/sap/ui/core/util/MockServer.js
function(sRole, aAssociation, aAssociationSet, bFrom) { var sEntitySet = jQuery(aAssociationSet).find("End[Role='" + sRole + "']").attr("EntitySet"); var sMultiplicity = jQuery(aAssociation).find("End[Role='" + sRole + "']").attr("Multiplicity"); var aPropRef = []; var aConstraint = jQuery(aAssociation).find("ReferentialConstraint > [Role='" + sRole + "']"); if (aConstraint && aConstraint.length > 0) { jQuery(aConstraint[0]).children("PropertyRef").each(function(iIndex, oPropRef) { aPropRef.push(jQuery(oPropRef).attr("Name")); }); } else { var oPrinDeps = (bFrom) ? oPrincipals : oDependents; jQuery(oPrinDeps).each(function(iIndex, oPrinDep) { if (sRole === (jQuery(oPrinDep).attr("Role"))) { jQuery(oPrinDep).children("PropertyRef").each(function(iIndex, oPropRef) { aPropRef.push(jQuery(oPropRef).attr("Name")); }); return false; } }); } return { "role": sRole, "entitySet": sEntitySet, "propRef": aPropRef, "multiplicity": sMultiplicity }; }
javascript
function(sRole, aAssociation, aAssociationSet, bFrom) { var sEntitySet = jQuery(aAssociationSet).find("End[Role='" + sRole + "']").attr("EntitySet"); var sMultiplicity = jQuery(aAssociation).find("End[Role='" + sRole + "']").attr("Multiplicity"); var aPropRef = []; var aConstraint = jQuery(aAssociation).find("ReferentialConstraint > [Role='" + sRole + "']"); if (aConstraint && aConstraint.length > 0) { jQuery(aConstraint[0]).children("PropertyRef").each(function(iIndex, oPropRef) { aPropRef.push(jQuery(oPropRef).attr("Name")); }); } else { var oPrinDeps = (bFrom) ? oPrincipals : oDependents; jQuery(oPrinDeps).each(function(iIndex, oPrinDep) { if (sRole === (jQuery(oPrinDep).attr("Role"))) { jQuery(oPrinDep).children("PropertyRef").each(function(iIndex, oPropRef) { aPropRef.push(jQuery(oPropRef).attr("Name")); }); return false; } }); } return { "role": sRole, "entitySet": sEntitySet, "propRef": aPropRef, "multiplicity": sMultiplicity }; }
[ "function", "(", "sRole", ",", "aAssociation", ",", "aAssociationSet", ",", "bFrom", ")", "{", "var", "sEntitySet", "=", "jQuery", "(", "aAssociationSet", ")", ".", "find", "(", "\"End[Role='\"", "+", "sRole", "+", "\"']\"", ")", ".", "attr", "(", "\"EntitySet\"", ")", ";", "var", "sMultiplicity", "=", "jQuery", "(", "aAssociation", ")", ".", "find", "(", "\"End[Role='\"", "+", "sRole", "+", "\"']\"", ")", ".", "attr", "(", "\"Multiplicity\"", ")", ";", "var", "aPropRef", "=", "[", "]", ";", "var", "aConstraint", "=", "jQuery", "(", "aAssociation", ")", ".", "find", "(", "\"ReferentialConstraint > [Role='\"", "+", "sRole", "+", "\"']\"", ")", ";", "if", "(", "aConstraint", "&&", "aConstraint", ".", "length", ">", "0", ")", "{", "jQuery", "(", "aConstraint", "[", "0", "]", ")", ".", "children", "(", "\"PropertyRef\"", ")", ".", "each", "(", "function", "(", "iIndex", ",", "oPropRef", ")", "{", "aPropRef", ".", "push", "(", "jQuery", "(", "oPropRef", ")", ".", "attr", "(", "\"Name\"", ")", ")", ";", "}", ")", ";", "}", "else", "{", "var", "oPrinDeps", "=", "(", "bFrom", ")", "?", "oPrincipals", ":", "oDependents", ";", "jQuery", "(", "oPrinDeps", ")", ".", "each", "(", "function", "(", "iIndex", ",", "oPrinDep", ")", "{", "if", "(", "sRole", "===", "(", "jQuery", "(", "oPrinDep", ")", ".", "attr", "(", "\"Role\"", ")", ")", ")", "{", "jQuery", "(", "oPrinDep", ")", ".", "children", "(", "\"PropertyRef\"", ")", ".", "each", "(", "function", "(", "iIndex", ",", "oPropRef", ")", "{", "aPropRef", ".", "push", "(", "jQuery", "(", "oPropRef", ")", ".", "attr", "(", "\"Name\"", ")", ")", ";", "}", ")", ";", "return", "false", ";", "}", "}", ")", ";", "}", "return", "{", "\"role\"", ":", "sRole", ",", "\"entitySet\"", ":", "sEntitySet", ",", "\"propRef\"", ":", "aPropRef", ",", "\"multiplicity\"", ":", "sMultiplicity", "}", ";", "}" ]
helper function to find the entity set and property reference for the given role name
[ "helper", "function", "to", "find", "the", "entity", "set", "and", "property", "reference", "for", "the", "given", "role", "name" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/util/MockServer.js#L1197-L1225
4,489
SAP/openui5
src/sap.ui.core/src/sap/ui/core/util/MockServer.js
function(sEntitySetName, sKeys) { sKeys = decodeURIComponent(sKeys); var oFoundEntry; var oEntitySet = that._mEntitySets[sEntitySetName]; var aKeys = oEntitySet.keys; // split keys var aRequestedKeys = sKeys.split(','); // check number of keys to be equal to the entity keys and validates keys type for quotations if (aRequestedKeys.length !== aKeys.length) { that._logAndThrowMockServerCustomError(400, that._oErrorMessages.INVALID_KEY_PREDICATE_QUANTITY); } that._isRequestedKeysValid(oEntitySet, aRequestedKeys); if (aRequestedKeys.length === 1 && !aRequestedKeys[0].split('=')[1]) { aRequestedKeys = [aKeys[0] + "=" + aRequestedKeys[0]]; } jQuery.each(that._oMockdata[sEntitySetName], function(iIndex, oEntry) { // check each key for existence and value for (var i = 0; i < aRequestedKeys.length; i++) { var aKeyVal = aRequestedKeys[i].split('='); var sKey = that._trim(aKeyVal[0]); //key doesn't match, continue to next entry if (!aKeys || aKeys.indexOf(sKey) === -1) { return true; // = continue } var sNewValue = that._trim(aKeyVal[1]); var sOrigiValue = oEntry[sKey]; switch (oEntitySet.keysType[sKey]) { case "Edm.String": sNewValue = sNewValue.replace(/^\'|\'$/g, ''); break; case "Edm.Time": case "Edm.DateTime": sOrigiValue = that._getDateTime(sOrigiValue); break; case "Edm.Int16": case "Edm.Int32": //case "Edm.Int64": In ODataModel this type is represented as a string. (https://openui5.hana.ondemand.com/docs/api/symbols/sap.ui.model.odata.type.Int64.html) case "Edm.Decimal": case "Edm.Byte": case "Edm.Double": case "Edm.Single": case "Edm.SByte": if (!that._isValidNumber(sNewValue)) { //TODO check better handling return false; // = break } sNewValue = parseFloat(sNewValue); break; case "Edm.Guid": sNewValue = sNewValue.replace(/^guid\'|\'$/g, ''); break; case "Edm.Boolean": if (["true", "false"].indexOf(sNewValue) === -1) { that._logAndThrowMockServerCustomError(400, that._oErrorMessages.INVALID_KEY_TYPE, sKey); } sNewValue = sNewValue === "true"; break; case "Edm.Binary": case "Edm.DateTimeOffset": default: sNewValue = sNewValue; } //value doesn't match, continue to next entry if (sOrigiValue !== sNewValue) { return true; // = continue } } oFoundEntry = { index: iIndex, entry: oEntry }; return false; // = break }); return oFoundEntry; }
javascript
function(sEntitySetName, sKeys) { sKeys = decodeURIComponent(sKeys); var oFoundEntry; var oEntitySet = that._mEntitySets[sEntitySetName]; var aKeys = oEntitySet.keys; // split keys var aRequestedKeys = sKeys.split(','); // check number of keys to be equal to the entity keys and validates keys type for quotations if (aRequestedKeys.length !== aKeys.length) { that._logAndThrowMockServerCustomError(400, that._oErrorMessages.INVALID_KEY_PREDICATE_QUANTITY); } that._isRequestedKeysValid(oEntitySet, aRequestedKeys); if (aRequestedKeys.length === 1 && !aRequestedKeys[0].split('=')[1]) { aRequestedKeys = [aKeys[0] + "=" + aRequestedKeys[0]]; } jQuery.each(that._oMockdata[sEntitySetName], function(iIndex, oEntry) { // check each key for existence and value for (var i = 0; i < aRequestedKeys.length; i++) { var aKeyVal = aRequestedKeys[i].split('='); var sKey = that._trim(aKeyVal[0]); //key doesn't match, continue to next entry if (!aKeys || aKeys.indexOf(sKey) === -1) { return true; // = continue } var sNewValue = that._trim(aKeyVal[1]); var sOrigiValue = oEntry[sKey]; switch (oEntitySet.keysType[sKey]) { case "Edm.String": sNewValue = sNewValue.replace(/^\'|\'$/g, ''); break; case "Edm.Time": case "Edm.DateTime": sOrigiValue = that._getDateTime(sOrigiValue); break; case "Edm.Int16": case "Edm.Int32": //case "Edm.Int64": In ODataModel this type is represented as a string. (https://openui5.hana.ondemand.com/docs/api/symbols/sap.ui.model.odata.type.Int64.html) case "Edm.Decimal": case "Edm.Byte": case "Edm.Double": case "Edm.Single": case "Edm.SByte": if (!that._isValidNumber(sNewValue)) { //TODO check better handling return false; // = break } sNewValue = parseFloat(sNewValue); break; case "Edm.Guid": sNewValue = sNewValue.replace(/^guid\'|\'$/g, ''); break; case "Edm.Boolean": if (["true", "false"].indexOf(sNewValue) === -1) { that._logAndThrowMockServerCustomError(400, that._oErrorMessages.INVALID_KEY_TYPE, sKey); } sNewValue = sNewValue === "true"; break; case "Edm.Binary": case "Edm.DateTimeOffset": default: sNewValue = sNewValue; } //value doesn't match, continue to next entry if (sOrigiValue !== sNewValue) { return true; // = continue } } oFoundEntry = { index: iIndex, entry: oEntry }; return false; // = break }); return oFoundEntry; }
[ "function", "(", "sEntitySetName", ",", "sKeys", ")", "{", "sKeys", "=", "decodeURIComponent", "(", "sKeys", ")", ";", "var", "oFoundEntry", ";", "var", "oEntitySet", "=", "that", ".", "_mEntitySets", "[", "sEntitySetName", "]", ";", "var", "aKeys", "=", "oEntitySet", ".", "keys", ";", "// split keys", "var", "aRequestedKeys", "=", "sKeys", ".", "split", "(", "','", ")", ";", "// check number of keys to be equal to the entity keys and validates keys type for quotations", "if", "(", "aRequestedKeys", ".", "length", "!==", "aKeys", ".", "length", ")", "{", "that", ".", "_logAndThrowMockServerCustomError", "(", "400", ",", "that", ".", "_oErrorMessages", ".", "INVALID_KEY_PREDICATE_QUANTITY", ")", ";", "}", "that", ".", "_isRequestedKeysValid", "(", "oEntitySet", ",", "aRequestedKeys", ")", ";", "if", "(", "aRequestedKeys", ".", "length", "===", "1", "&&", "!", "aRequestedKeys", "[", "0", "]", ".", "split", "(", "'='", ")", "[", "1", "]", ")", "{", "aRequestedKeys", "=", "[", "aKeys", "[", "0", "]", "+", "\"=\"", "+", "aRequestedKeys", "[", "0", "]", "]", ";", "}", "jQuery", ".", "each", "(", "that", ".", "_oMockdata", "[", "sEntitySetName", "]", ",", "function", "(", "iIndex", ",", "oEntry", ")", "{", "// check each key for existence and value", "for", "(", "var", "i", "=", "0", ";", "i", "<", "aRequestedKeys", ".", "length", ";", "i", "++", ")", "{", "var", "aKeyVal", "=", "aRequestedKeys", "[", "i", "]", ".", "split", "(", "'='", ")", ";", "var", "sKey", "=", "that", ".", "_trim", "(", "aKeyVal", "[", "0", "]", ")", ";", "//key doesn't match, continue to next entry", "if", "(", "!", "aKeys", "||", "aKeys", ".", "indexOf", "(", "sKey", ")", "===", "-", "1", ")", "{", "return", "true", ";", "// = continue", "}", "var", "sNewValue", "=", "that", ".", "_trim", "(", "aKeyVal", "[", "1", "]", ")", ";", "var", "sOrigiValue", "=", "oEntry", "[", "sKey", "]", ";", "switch", "(", "oEntitySet", ".", "keysType", "[", "sKey", "]", ")", "{", "case", "\"Edm.String\"", ":", "sNewValue", "=", "sNewValue", ".", "replace", "(", "/", "^\\'|\\'$", "/", "g", ",", "''", ")", ";", "break", ";", "case", "\"Edm.Time\"", ":", "case", "\"Edm.DateTime\"", ":", "sOrigiValue", "=", "that", ".", "_getDateTime", "(", "sOrigiValue", ")", ";", "break", ";", "case", "\"Edm.Int16\"", ":", "case", "\"Edm.Int32\"", ":", "//case \"Edm.Int64\": In ODataModel this type is represented as a string. (https://openui5.hana.ondemand.com/docs/api/symbols/sap.ui.model.odata.type.Int64.html)", "case", "\"Edm.Decimal\"", ":", "case", "\"Edm.Byte\"", ":", "case", "\"Edm.Double\"", ":", "case", "\"Edm.Single\"", ":", "case", "\"Edm.SByte\"", ":", "if", "(", "!", "that", ".", "_isValidNumber", "(", "sNewValue", ")", ")", "{", "//TODO check better handling", "return", "false", ";", "// = break", "}", "sNewValue", "=", "parseFloat", "(", "sNewValue", ")", ";", "break", ";", "case", "\"Edm.Guid\"", ":", "sNewValue", "=", "sNewValue", ".", "replace", "(", "/", "^guid\\'|\\'$", "/", "g", ",", "''", ")", ";", "break", ";", "case", "\"Edm.Boolean\"", ":", "if", "(", "[", "\"true\"", ",", "\"false\"", "]", ".", "indexOf", "(", "sNewValue", ")", "===", "-", "1", ")", "{", "that", ".", "_logAndThrowMockServerCustomError", "(", "400", ",", "that", ".", "_oErrorMessages", ".", "INVALID_KEY_TYPE", ",", "sKey", ")", ";", "}", "sNewValue", "=", "sNewValue", "===", "\"true\"", ";", "break", ";", "case", "\"Edm.Binary\"", ":", "case", "\"Edm.DateTimeOffset\"", ":", "default", ":", "sNewValue", "=", "sNewValue", ";", "}", "//value doesn't match, continue to next entry", "if", "(", "sOrigiValue", "!==", "sNewValue", ")", "{", "return", "true", ";", "// = continue", "}", "}", "oFoundEntry", "=", "{", "index", ":", "iIndex", ",", "entry", ":", "oEntry", "}", ";", "return", "false", ";", "// = break", "}", ")", ";", "return", "oFoundEntry", ";", "}" ]
helper to find the entity set entry for a given entity set name and the keys of the entry
[ "helper", "to", "find", "the", "entity", "set", "entry", "for", "a", "given", "entity", "set", "name", "and", "the", "keys", "of", "the", "entry" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/util/MockServer.js#L1985-L2063
4,490
SAP/openui5
src/sap.ui.core/src/sap/ui/core/util/MockServer.js
function(aUrlParams) { var aUrlParamsNormalized = []; var fnStartsWith = function(sValue) { var apostLocation = sValue.indexOf("'"); var doubleQuotesLocation = sValue.indexOf("\""); if (apostLocation === -1 && doubleQuotesLocation === -1) { return null; } else { if (apostLocation > -1 && doubleQuotesLocation === -1) { return "appost"; } if (doubleQuotesLocation > -1 && apostLocation === -1) { return "doublequotes"; } if (apostLocation > -1 && doubleQuotesLocation > -1 && apostLocation < doubleQuotesLocation) { return "appost"; } if (apostLocation > -1 && doubleQuotesLocation > -1 && doubleQuotesLocation < apostLocation) { return "doublequotes"; } } }; var fnAmpersandHandler = function(aParams, aParamsNorm, index, apostType) { var stringAmpersand = aParams[index]; var j = index + 1; while (j < aParams.length && aParams[j].indexOf(apostType) === -1) { stringAmpersand = stringAmpersand + "&" + aParams[j]; j++; } stringAmpersand = stringAmpersand + "&" + aParams[j]; aParamsNorm.push(stringAmpersand); index = j; return index; }; for (var i = 0; i < aUrlParams.length; i++) { // there is no ' and no " in param values if (!fnStartsWith(aUrlParams[i])) { aUrlParamsNormalized.push(aUrlParams[i]); } // there is ' in param value if (fnStartsWith(aUrlParams[i]) === "appost") { var firstLocation = aUrlParams[i].indexOf("'"); if (aUrlParams[i].indexOf("'", firstLocation + 1) === -1) { i = fnAmpersandHandler(aUrlParams, aUrlParamsNormalized, i, "'"); } else { aUrlParamsNormalized.push(aUrlParams[i]); } } // there is " in param value if (fnStartsWith(aUrlParams[i]) === "doublequotes") { var firstQuotesLocation = aUrlParams[i].indexOf("\""); if (aUrlParams[i].indexOf("\"", firstQuotesLocation + 1) === -1) { i = fnAmpersandHandler(aUrlParams, aUrlParamsNormalized, i, "\""); } else { aUrlParamsNormalized.push(aUrlParams[i]); } } } return aUrlParamsNormalized; }
javascript
function(aUrlParams) { var aUrlParamsNormalized = []; var fnStartsWith = function(sValue) { var apostLocation = sValue.indexOf("'"); var doubleQuotesLocation = sValue.indexOf("\""); if (apostLocation === -1 && doubleQuotesLocation === -1) { return null; } else { if (apostLocation > -1 && doubleQuotesLocation === -1) { return "appost"; } if (doubleQuotesLocation > -1 && apostLocation === -1) { return "doublequotes"; } if (apostLocation > -1 && doubleQuotesLocation > -1 && apostLocation < doubleQuotesLocation) { return "appost"; } if (apostLocation > -1 && doubleQuotesLocation > -1 && doubleQuotesLocation < apostLocation) { return "doublequotes"; } } }; var fnAmpersandHandler = function(aParams, aParamsNorm, index, apostType) { var stringAmpersand = aParams[index]; var j = index + 1; while (j < aParams.length && aParams[j].indexOf(apostType) === -1) { stringAmpersand = stringAmpersand + "&" + aParams[j]; j++; } stringAmpersand = stringAmpersand + "&" + aParams[j]; aParamsNorm.push(stringAmpersand); index = j; return index; }; for (var i = 0; i < aUrlParams.length; i++) { // there is no ' and no " in param values if (!fnStartsWith(aUrlParams[i])) { aUrlParamsNormalized.push(aUrlParams[i]); } // there is ' in param value if (fnStartsWith(aUrlParams[i]) === "appost") { var firstLocation = aUrlParams[i].indexOf("'"); if (aUrlParams[i].indexOf("'", firstLocation + 1) === -1) { i = fnAmpersandHandler(aUrlParams, aUrlParamsNormalized, i, "'"); } else { aUrlParamsNormalized.push(aUrlParams[i]); } } // there is " in param value if (fnStartsWith(aUrlParams[i]) === "doublequotes") { var firstQuotesLocation = aUrlParams[i].indexOf("\""); if (aUrlParams[i].indexOf("\"", firstQuotesLocation + 1) === -1) { i = fnAmpersandHandler(aUrlParams, aUrlParamsNormalized, i, "\""); } else { aUrlParamsNormalized.push(aUrlParams[i]); } } } return aUrlParamsNormalized; }
[ "function", "(", "aUrlParams", ")", "{", "var", "aUrlParamsNormalized", "=", "[", "]", ";", "var", "fnStartsWith", "=", "function", "(", "sValue", ")", "{", "var", "apostLocation", "=", "sValue", ".", "indexOf", "(", "\"'\"", ")", ";", "var", "doubleQuotesLocation", "=", "sValue", ".", "indexOf", "(", "\"\\\"\"", ")", ";", "if", "(", "apostLocation", "===", "-", "1", "&&", "doubleQuotesLocation", "===", "-", "1", ")", "{", "return", "null", ";", "}", "else", "{", "if", "(", "apostLocation", ">", "-", "1", "&&", "doubleQuotesLocation", "===", "-", "1", ")", "{", "return", "\"appost\"", ";", "}", "if", "(", "doubleQuotesLocation", ">", "-", "1", "&&", "apostLocation", "===", "-", "1", ")", "{", "return", "\"doublequotes\"", ";", "}", "if", "(", "apostLocation", ">", "-", "1", "&&", "doubleQuotesLocation", ">", "-", "1", "&&", "apostLocation", "<", "doubleQuotesLocation", ")", "{", "return", "\"appost\"", ";", "}", "if", "(", "apostLocation", ">", "-", "1", "&&", "doubleQuotesLocation", ">", "-", "1", "&&", "doubleQuotesLocation", "<", "apostLocation", ")", "{", "return", "\"doublequotes\"", ";", "}", "}", "}", ";", "var", "fnAmpersandHandler", "=", "function", "(", "aParams", ",", "aParamsNorm", ",", "index", ",", "apostType", ")", "{", "var", "stringAmpersand", "=", "aParams", "[", "index", "]", ";", "var", "j", "=", "index", "+", "1", ";", "while", "(", "j", "<", "aParams", ".", "length", "&&", "aParams", "[", "j", "]", ".", "indexOf", "(", "apostType", ")", "===", "-", "1", ")", "{", "stringAmpersand", "=", "stringAmpersand", "+", "\"&\"", "+", "aParams", "[", "j", "]", ";", "j", "++", ";", "}", "stringAmpersand", "=", "stringAmpersand", "+", "\"&\"", "+", "aParams", "[", "j", "]", ";", "aParamsNorm", ".", "push", "(", "stringAmpersand", ")", ";", "index", "=", "j", ";", "return", "index", ";", "}", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "aUrlParams", ".", "length", ";", "i", "++", ")", "{", "// there is no ' and no \" in param values", "if", "(", "!", "fnStartsWith", "(", "aUrlParams", "[", "i", "]", ")", ")", "{", "aUrlParamsNormalized", ".", "push", "(", "aUrlParams", "[", "i", "]", ")", ";", "}", "// there is ' in param value", "if", "(", "fnStartsWith", "(", "aUrlParams", "[", "i", "]", ")", "===", "\"appost\"", ")", "{", "var", "firstLocation", "=", "aUrlParams", "[", "i", "]", ".", "indexOf", "(", "\"'\"", ")", ";", "if", "(", "aUrlParams", "[", "i", "]", ".", "indexOf", "(", "\"'\"", ",", "firstLocation", "+", "1", ")", "===", "-", "1", ")", "{", "i", "=", "fnAmpersandHandler", "(", "aUrlParams", ",", "aUrlParamsNormalized", ",", "i", ",", "\"'\"", ")", ";", "}", "else", "{", "aUrlParamsNormalized", ".", "push", "(", "aUrlParams", "[", "i", "]", ")", ";", "}", "}", "// there is \" in param value", "if", "(", "fnStartsWith", "(", "aUrlParams", "[", "i", "]", ")", "===", "\"doublequotes\"", ")", "{", "var", "firstQuotesLocation", "=", "aUrlParams", "[", "i", "]", ".", "indexOf", "(", "\"\\\"\"", ")", ";", "if", "(", "aUrlParams", "[", "i", "]", ".", "indexOf", "(", "\"\\\"\"", ",", "firstQuotesLocation", "+", "1", ")", "===", "-", "1", ")", "{", "i", "=", "fnAmpersandHandler", "(", "aUrlParams", ",", "aUrlParamsNormalized", ",", "i", ",", "\"\\\"\"", ")", ";", "}", "else", "{", "aUrlParamsNormalized", ".", "push", "(", "aUrlParams", "[", "i", "]", ")", ";", "}", "}", "}", "return", "aUrlParamsNormalized", ";", "}" ]
helper to handle url param value with '&'
[ "helper", "to", "handle", "url", "param", "value", "with", "&" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/util/MockServer.js#L2083-L2150
4,491
SAP/openui5
src/sap.ui.unified/src/sap/ui/unified/CalendarTimeInterval.js
_showDayPicker
function _showDayPicker(){ if (this._iMode == 3) { _hideYearPicker.call(this, true); }else if (this._iMode == 2) { _hideMonthPicker.call(this, true); } var oDate = this._getFocusedDate(); var iItems = this._getItems(); var oDatesRow = this.getAggregation("datesRow"); var oDateRange = oDatesRow.getSelectedDates()[0]; oDateRange.setStartDate(CalendarUtils._createLocalDate(oDate, true)); // set number of days - but max number of days of this month var oLastDayOfMonth = new UniversalDate(oDate.getTime()); oLastDayOfMonth.setUTCDate(1); oLastDayOfMonth.setUTCMonth(oLastDayOfMonth.getUTCMonth() + 1); oLastDayOfMonth.setUTCDate(0); var iLastDay = oLastDayOfMonth.getUTCDate(); var iDays = Math.floor(iItems * 1.5); if (iDays > iLastDay) { // to be limited on real month length by opening iDays = iLastDay; } oDatesRow.setDays(iDays); if (oDatesRow.getDomRef()) { // already rendered oDatesRow.$().css("display", ""); } else { var oRm = sap.ui.getCore().createRenderManager(); var $Container = this.$("content"); oRm.renderControl(oDatesRow); oRm.flush($Container[0], false, true); // insert it oRm.destroy(); } this._showOverlay(); // set start date and focus date _setDateInDatesRow.call(this, oDate); if (this._iMode == 0) { // remove tabindex from item var oTimesRow = this.getAggregation("timesRow"); jQuery(oTimesRow._oItemNavigation.getItemDomRefs()[oTimesRow._oItemNavigation.getFocusedIndex()]).attr("tabindex", "-1"); } this._iMode = 1; }
javascript
function _showDayPicker(){ if (this._iMode == 3) { _hideYearPicker.call(this, true); }else if (this._iMode == 2) { _hideMonthPicker.call(this, true); } var oDate = this._getFocusedDate(); var iItems = this._getItems(); var oDatesRow = this.getAggregation("datesRow"); var oDateRange = oDatesRow.getSelectedDates()[0]; oDateRange.setStartDate(CalendarUtils._createLocalDate(oDate, true)); // set number of days - but max number of days of this month var oLastDayOfMonth = new UniversalDate(oDate.getTime()); oLastDayOfMonth.setUTCDate(1); oLastDayOfMonth.setUTCMonth(oLastDayOfMonth.getUTCMonth() + 1); oLastDayOfMonth.setUTCDate(0); var iLastDay = oLastDayOfMonth.getUTCDate(); var iDays = Math.floor(iItems * 1.5); if (iDays > iLastDay) { // to be limited on real month length by opening iDays = iLastDay; } oDatesRow.setDays(iDays); if (oDatesRow.getDomRef()) { // already rendered oDatesRow.$().css("display", ""); } else { var oRm = sap.ui.getCore().createRenderManager(); var $Container = this.$("content"); oRm.renderControl(oDatesRow); oRm.flush($Container[0], false, true); // insert it oRm.destroy(); } this._showOverlay(); // set start date and focus date _setDateInDatesRow.call(this, oDate); if (this._iMode == 0) { // remove tabindex from item var oTimesRow = this.getAggregation("timesRow"); jQuery(oTimesRow._oItemNavigation.getItemDomRefs()[oTimesRow._oItemNavigation.getFocusedIndex()]).attr("tabindex", "-1"); } this._iMode = 1; }
[ "function", "_showDayPicker", "(", ")", "{", "if", "(", "this", ".", "_iMode", "==", "3", ")", "{", "_hideYearPicker", ".", "call", "(", "this", ",", "true", ")", ";", "}", "else", "if", "(", "this", ".", "_iMode", "==", "2", ")", "{", "_hideMonthPicker", ".", "call", "(", "this", ",", "true", ")", ";", "}", "var", "oDate", "=", "this", ".", "_getFocusedDate", "(", ")", ";", "var", "iItems", "=", "this", ".", "_getItems", "(", ")", ";", "var", "oDatesRow", "=", "this", ".", "getAggregation", "(", "\"datesRow\"", ")", ";", "var", "oDateRange", "=", "oDatesRow", ".", "getSelectedDates", "(", ")", "[", "0", "]", ";", "oDateRange", ".", "setStartDate", "(", "CalendarUtils", ".", "_createLocalDate", "(", "oDate", ",", "true", ")", ")", ";", "// set number of days - but max number of days of this month", "var", "oLastDayOfMonth", "=", "new", "UniversalDate", "(", "oDate", ".", "getTime", "(", ")", ")", ";", "oLastDayOfMonth", ".", "setUTCDate", "(", "1", ")", ";", "oLastDayOfMonth", ".", "setUTCMonth", "(", "oLastDayOfMonth", ".", "getUTCMonth", "(", ")", "+", "1", ")", ";", "oLastDayOfMonth", ".", "setUTCDate", "(", "0", ")", ";", "var", "iLastDay", "=", "oLastDayOfMonth", ".", "getUTCDate", "(", ")", ";", "var", "iDays", "=", "Math", ".", "floor", "(", "iItems", "*", "1.5", ")", ";", "if", "(", "iDays", ">", "iLastDay", ")", "{", "// to be limited on real month length by opening", "iDays", "=", "iLastDay", ";", "}", "oDatesRow", ".", "setDays", "(", "iDays", ")", ";", "if", "(", "oDatesRow", ".", "getDomRef", "(", ")", ")", "{", "// already rendered", "oDatesRow", ".", "$", "(", ")", ".", "css", "(", "\"display\"", ",", "\"\"", ")", ";", "}", "else", "{", "var", "oRm", "=", "sap", ".", "ui", ".", "getCore", "(", ")", ".", "createRenderManager", "(", ")", ";", "var", "$Container", "=", "this", ".", "$", "(", "\"content\"", ")", ";", "oRm", ".", "renderControl", "(", "oDatesRow", ")", ";", "oRm", ".", "flush", "(", "$Container", "[", "0", "]", ",", "false", ",", "true", ")", ";", "// insert it", "oRm", ".", "destroy", "(", ")", ";", "}", "this", ".", "_showOverlay", "(", ")", ";", "// set start date and focus date", "_setDateInDatesRow", ".", "call", "(", "this", ",", "oDate", ")", ";", "if", "(", "this", ".", "_iMode", "==", "0", ")", "{", "// remove tabindex from item", "var", "oTimesRow", "=", "this", ".", "getAggregation", "(", "\"timesRow\"", ")", ";", "jQuery", "(", "oTimesRow", ".", "_oItemNavigation", ".", "getItemDomRefs", "(", ")", "[", "oTimesRow", ".", "_oItemNavigation", ".", "getFocusedIndex", "(", ")", "]", ")", ".", "attr", "(", "\"tabindex\"", ",", "\"-1\"", ")", ";", "}", "this", ".", "_iMode", "=", "1", ";", "}" ]
Shows an embedded day Picker. This function assumes there is a "datesRow" aggregation. So callers must take care. @return {void} @private
[ "Shows", "an", "embedded", "day", "Picker", ".", "This", "function", "assumes", "there", "is", "a", "datesRow", "aggregation", ".", "So", "callers", "must", "take", "care", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.unified/src/sap/ui/unified/CalendarTimeInterval.js#L1367-L1419
4,492
SAP/openui5
src/sap.ui.unified/src/sap/ui/unified/CalendarTimeInterval.js
_hideDayPicker
function _hideDayPicker(bSkipFocus){ this._iMode = 0; var oDatesRow = this.getAggregation("datesRow"); oDatesRow.$().css("display", "none"); this._hideOverlay(); if (!bSkipFocus) { _renderTimesRow.call(this); // to focus date // restore tabindex because if date not changed in _renderTimesRow only the focused date is updated var oTimesRow = this.getAggregation("timesRow"); jQuery(oTimesRow._oItemNavigation.getItemDomRefs()[oTimesRow._oItemNavigation.getFocusedIndex()]).attr("tabindex", "0"); } }
javascript
function _hideDayPicker(bSkipFocus){ this._iMode = 0; var oDatesRow = this.getAggregation("datesRow"); oDatesRow.$().css("display", "none"); this._hideOverlay(); if (!bSkipFocus) { _renderTimesRow.call(this); // to focus date // restore tabindex because if date not changed in _renderTimesRow only the focused date is updated var oTimesRow = this.getAggregation("timesRow"); jQuery(oTimesRow._oItemNavigation.getItemDomRefs()[oTimesRow._oItemNavigation.getFocusedIndex()]).attr("tabindex", "0"); } }
[ "function", "_hideDayPicker", "(", "bSkipFocus", ")", "{", "this", ".", "_iMode", "=", "0", ";", "var", "oDatesRow", "=", "this", ".", "getAggregation", "(", "\"datesRow\"", ")", ";", "oDatesRow", ".", "$", "(", ")", ".", "css", "(", "\"display\"", ",", "\"none\"", ")", ";", "this", ".", "_hideOverlay", "(", ")", ";", "if", "(", "!", "bSkipFocus", ")", "{", "_renderTimesRow", ".", "call", "(", "this", ")", ";", "// to focus date", "// restore tabindex because if date not changed in _renderTimesRow only the focused date is updated", "var", "oTimesRow", "=", "this", ".", "getAggregation", "(", "\"timesRow\"", ")", ";", "jQuery", "(", "oTimesRow", ".", "_oItemNavigation", ".", "getItemDomRefs", "(", ")", "[", "oTimesRow", ".", "_oItemNavigation", ".", "getFocusedIndex", "(", ")", "]", ")", ".", "attr", "(", "\"tabindex\"", ",", "\"0\"", ")", ";", "}", "}" ]
Hides an embedded day Picker. This function assumes there is a "datesRow" aggregation. So callers must take care. @return {void} @private
[ "Hides", "an", "embedded", "day", "Picker", ".", "This", "function", "assumes", "there", "is", "a", "datesRow", "aggregation", ".", "So", "callers", "must", "take", "care", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.unified/src/sap/ui/unified/CalendarTimeInterval.js#L1428-L1445
4,493
SAP/openui5
src/sap.ui.unified/src/sap/ui/unified/CalendarTimeInterval.js
_showMonthPicker
function _showMonthPicker(){ if (this._iMode == 1) { _hideDayPicker.call(this, true); }else if (this._iMode == 3) { _hideYearPicker.call(this, true); } var oDate = this._getFocusedDate(); var oMonthPicker = this.getAggregation("monthPicker"); if (oMonthPicker.getDomRef()) { // already rendered oMonthPicker.$().css("display", ""); } else { var oRm = sap.ui.getCore().createRenderManager(); var $Container = this.$("content"); oRm.renderControl(oMonthPicker); oRm.flush($Container[0], false, true); // insert it oRm.destroy(); } this._showOverlay(); oMonthPicker.setMonth(oDate.getUTCMonth()); _setDisabledMonths.call(this, oDate.getUTCFullYear(), oMonthPicker); if (this._iMode == 0) { // remove tabindex from item var oTimesRow = this.getAggregation("timesRow"); jQuery(oTimesRow._oItemNavigation.getItemDomRefs()[oTimesRow._oItemNavigation.getFocusedIndex()]).attr("tabindex", "-1"); } this._iMode = 2; _togglePrevNext.call(this); }
javascript
function _showMonthPicker(){ if (this._iMode == 1) { _hideDayPicker.call(this, true); }else if (this._iMode == 3) { _hideYearPicker.call(this, true); } var oDate = this._getFocusedDate(); var oMonthPicker = this.getAggregation("monthPicker"); if (oMonthPicker.getDomRef()) { // already rendered oMonthPicker.$().css("display", ""); } else { var oRm = sap.ui.getCore().createRenderManager(); var $Container = this.$("content"); oRm.renderControl(oMonthPicker); oRm.flush($Container[0], false, true); // insert it oRm.destroy(); } this._showOverlay(); oMonthPicker.setMonth(oDate.getUTCMonth()); _setDisabledMonths.call(this, oDate.getUTCFullYear(), oMonthPicker); if (this._iMode == 0) { // remove tabindex from item var oTimesRow = this.getAggregation("timesRow"); jQuery(oTimesRow._oItemNavigation.getItemDomRefs()[oTimesRow._oItemNavigation.getFocusedIndex()]).attr("tabindex", "-1"); } this._iMode = 2; _togglePrevNext.call(this); }
[ "function", "_showMonthPicker", "(", ")", "{", "if", "(", "this", ".", "_iMode", "==", "1", ")", "{", "_hideDayPicker", ".", "call", "(", "this", ",", "true", ")", ";", "}", "else", "if", "(", "this", ".", "_iMode", "==", "3", ")", "{", "_hideYearPicker", ".", "call", "(", "this", ",", "true", ")", ";", "}", "var", "oDate", "=", "this", ".", "_getFocusedDate", "(", ")", ";", "var", "oMonthPicker", "=", "this", ".", "getAggregation", "(", "\"monthPicker\"", ")", ";", "if", "(", "oMonthPicker", ".", "getDomRef", "(", ")", ")", "{", "// already rendered", "oMonthPicker", ".", "$", "(", ")", ".", "css", "(", "\"display\"", ",", "\"\"", ")", ";", "}", "else", "{", "var", "oRm", "=", "sap", ".", "ui", ".", "getCore", "(", ")", ".", "createRenderManager", "(", ")", ";", "var", "$Container", "=", "this", ".", "$", "(", "\"content\"", ")", ";", "oRm", ".", "renderControl", "(", "oMonthPicker", ")", ";", "oRm", ".", "flush", "(", "$Container", "[", "0", "]", ",", "false", ",", "true", ")", ";", "// insert it", "oRm", ".", "destroy", "(", ")", ";", "}", "this", ".", "_showOverlay", "(", ")", ";", "oMonthPicker", ".", "setMonth", "(", "oDate", ".", "getUTCMonth", "(", ")", ")", ";", "_setDisabledMonths", ".", "call", "(", "this", ",", "oDate", ".", "getUTCFullYear", "(", ")", ",", "oMonthPicker", ")", ";", "if", "(", "this", ".", "_iMode", "==", "0", ")", "{", "// remove tabindex from item", "var", "oTimesRow", "=", "this", ".", "getAggregation", "(", "\"timesRow\"", ")", ";", "jQuery", "(", "oTimesRow", ".", "_oItemNavigation", ".", "getItemDomRefs", "(", ")", "[", "oTimesRow", ".", "_oItemNavigation", ".", "getFocusedIndex", "(", ")", "]", ")", ".", "attr", "(", "\"tabindex\"", ",", "\"-1\"", ")", ";", "}", "this", ".", "_iMode", "=", "2", ";", "_togglePrevNext", ".", "call", "(", "this", ")", ";", "}" ]
Shows an embedded month Picker. This function assumes there is a "monthPicker" aggregation. So callers must take care. @return {void} @private
[ "Shows", "an", "embedded", "month", "Picker", ".", "This", "function", "assumes", "there", "is", "a", "monthPicker", "aggregation", ".", "So", "callers", "must", "take", "care", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.unified/src/sap/ui/unified/CalendarTimeInterval.js#L1454-L1492
4,494
SAP/openui5
src/sap.ui.unified/src/sap/ui/unified/CalendarTimeInterval.js
_hideMonthPicker
function _hideMonthPicker(bSkipFocus){ this._iMode = 0; var oMonthPicker = this.getAggregation("monthPicker"); oMonthPicker.$().css("display", "none"); this._hideOverlay(); if (!bSkipFocus) { _renderTimesRow.call(this); // to focus date // restore tabindex because if date not changed in _renderTimesRow only the focused date is updated var oTimesRow = this.getAggregation("timesRow"); jQuery(oTimesRow._oItemNavigation.getItemDomRefs()[oTimesRow._oItemNavigation.getFocusedIndex()]).attr("tabindex", "0"); } }
javascript
function _hideMonthPicker(bSkipFocus){ this._iMode = 0; var oMonthPicker = this.getAggregation("monthPicker"); oMonthPicker.$().css("display", "none"); this._hideOverlay(); if (!bSkipFocus) { _renderTimesRow.call(this); // to focus date // restore tabindex because if date not changed in _renderTimesRow only the focused date is updated var oTimesRow = this.getAggregation("timesRow"); jQuery(oTimesRow._oItemNavigation.getItemDomRefs()[oTimesRow._oItemNavigation.getFocusedIndex()]).attr("tabindex", "0"); } }
[ "function", "_hideMonthPicker", "(", "bSkipFocus", ")", "{", "this", ".", "_iMode", "=", "0", ";", "var", "oMonthPicker", "=", "this", ".", "getAggregation", "(", "\"monthPicker\"", ")", ";", "oMonthPicker", ".", "$", "(", ")", ".", "css", "(", "\"display\"", ",", "\"none\"", ")", ";", "this", ".", "_hideOverlay", "(", ")", ";", "if", "(", "!", "bSkipFocus", ")", "{", "_renderTimesRow", ".", "call", "(", "this", ")", ";", "// to focus date", "// restore tabindex because if date not changed in _renderTimesRow only the focused date is updated", "var", "oTimesRow", "=", "this", ".", "getAggregation", "(", "\"timesRow\"", ")", ";", "jQuery", "(", "oTimesRow", ".", "_oItemNavigation", ".", "getItemDomRefs", "(", ")", "[", "oTimesRow", ".", "_oItemNavigation", ".", "getFocusedIndex", "(", ")", "]", ")", ".", "attr", "(", "\"tabindex\"", ",", "\"0\"", ")", ";", "}", "}" ]
Hides an embedded month Picker. This function assumes there is a "monthPicker" aggregation. So callers must take care. @return {void} @private
[ "Hides", "an", "embedded", "month", "Picker", ".", "This", "function", "assumes", "there", "is", "a", "monthPicker", "aggregation", ".", "So", "callers", "must", "take", "care", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.unified/src/sap/ui/unified/CalendarTimeInterval.js#L1501-L1518
4,495
SAP/openui5
src/sap.ui.unified/src/sap/ui/unified/CalendarTimeInterval.js
_hideYearPicker
function _hideYearPicker(bSkipFocus){ this._iMode = 0; var oYearPicker = this.getAggregation("yearPicker"); oYearPicker.$().css("display", "none"); this._hideOverlay(); if (!bSkipFocus) { _renderTimesRow.call(this); // to focus date // restore tabindex because if date not changed in _renderTimesRow only the focused date is updated var oTimesRow = this.getAggregation("timesRow"); jQuery(oTimesRow._oItemNavigation.getItemDomRefs()[oTimesRow._oItemNavigation.getFocusedIndex()]).attr("tabindex", "0"); } }
javascript
function _hideYearPicker(bSkipFocus){ this._iMode = 0; var oYearPicker = this.getAggregation("yearPicker"); oYearPicker.$().css("display", "none"); this._hideOverlay(); if (!bSkipFocus) { _renderTimesRow.call(this); // to focus date // restore tabindex because if date not changed in _renderTimesRow only the focused date is updated var oTimesRow = this.getAggregation("timesRow"); jQuery(oTimesRow._oItemNavigation.getItemDomRefs()[oTimesRow._oItemNavigation.getFocusedIndex()]).attr("tabindex", "0"); } }
[ "function", "_hideYearPicker", "(", "bSkipFocus", ")", "{", "this", ".", "_iMode", "=", "0", ";", "var", "oYearPicker", "=", "this", ".", "getAggregation", "(", "\"yearPicker\"", ")", ";", "oYearPicker", ".", "$", "(", ")", ".", "css", "(", "\"display\"", ",", "\"none\"", ")", ";", "this", ".", "_hideOverlay", "(", ")", ";", "if", "(", "!", "bSkipFocus", ")", "{", "_renderTimesRow", ".", "call", "(", "this", ")", ";", "// to focus date", "// restore tabindex because if date not changed in _renderTimesRow only the focused date is updated", "var", "oTimesRow", "=", "this", ".", "getAggregation", "(", "\"timesRow\"", ")", ";", "jQuery", "(", "oTimesRow", ".", "_oItemNavigation", ".", "getItemDomRefs", "(", ")", "[", "oTimesRow", ".", "_oItemNavigation", ".", "getFocusedIndex", "(", ")", "]", ")", ".", "attr", "(", "\"tabindex\"", ",", "\"0\"", ")", ";", "}", "}" ]
Hides an embedded year Picker. This function assumes there is a "yearPicker" aggregation. So callers must take care. @return {void} @private
[ "Hides", "an", "embedded", "year", "Picker", ".", "This", "function", "assumes", "there", "is", "a", "yearPicker", "aggregation", ".", "So", "callers", "must", "take", "care", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.unified/src/sap/ui/unified/CalendarTimeInterval.js#L1573-L1590
4,496
SAP/openui5
src/sap.ui.unified/src/sap/ui/unified/CalendarTimeInterval.js
_handleDateFocus
function _handleDateFocus(oEvent){ var oFocusedDate = new UniversalDate(this._getFocusedDate().getTime()); var oDate = CalendarUtils._createUniversalUTCDate(oEvent.getParameter("date"), undefined, true); var bNotVisible = oEvent.getParameter("otherMonth"); if (bNotVisible && oDate.getUTCMonth() == oFocusedDate.getUTCMonth() && oDate.getUTCFullYear() == oFocusedDate.getUTCFullYear()) { // only show days in the same month // set start date and focus date _setDateInDatesRow.call(this, oDate); } }
javascript
function _handleDateFocus(oEvent){ var oFocusedDate = new UniversalDate(this._getFocusedDate().getTime()); var oDate = CalendarUtils._createUniversalUTCDate(oEvent.getParameter("date"), undefined, true); var bNotVisible = oEvent.getParameter("otherMonth"); if (bNotVisible && oDate.getUTCMonth() == oFocusedDate.getUTCMonth() && oDate.getUTCFullYear() == oFocusedDate.getUTCFullYear()) { // only show days in the same month // set start date and focus date _setDateInDatesRow.call(this, oDate); } }
[ "function", "_handleDateFocus", "(", "oEvent", ")", "{", "var", "oFocusedDate", "=", "new", "UniversalDate", "(", "this", ".", "_getFocusedDate", "(", ")", ".", "getTime", "(", ")", ")", ";", "var", "oDate", "=", "CalendarUtils", ".", "_createUniversalUTCDate", "(", "oEvent", ".", "getParameter", "(", "\"date\"", ")", ",", "undefined", ",", "true", ")", ";", "var", "bNotVisible", "=", "oEvent", ".", "getParameter", "(", "\"otherMonth\"", ")", ";", "if", "(", "bNotVisible", "&&", "oDate", ".", "getUTCMonth", "(", ")", "==", "oFocusedDate", ".", "getUTCMonth", "(", ")", "&&", "oDate", ".", "getUTCFullYear", "(", ")", "==", "oFocusedDate", ".", "getUTCFullYear", "(", ")", ")", "{", "// only show days in the same month", "// set start date and focus date", "_setDateInDatesRow", ".", "call", "(", "this", ",", "oDate", ")", ";", "}", "}" ]
Handles day focus from the embedded day Picker. This function assumes there is a "datesRow" aggregation. So callers must take care. @return {void} @private
[ "Handles", "day", "focus", "from", "the", "embedded", "day", "Picker", ".", "This", "function", "assumes", "there", "is", "a", "datesRow", "aggregation", ".", "So", "callers", "must", "take", "care", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.unified/src/sap/ui/unified/CalendarTimeInterval.js#L1904-L1918
4,497
SAP/openui5
src/sap.ui.unified/src/sap/ui/unified/CalendarTimeInterval.js
_handleSelectMonth
function _handleSelectMonth(oEvent){ var oFocusedDate = new UniversalDate(this._getFocusedDate().getTime()); var oMonthPicker = this.getAggregation("monthPicker"); var iMonth = oMonthPicker.getMonth(); oFocusedDate.setUTCMonth(iMonth); if (iMonth != oFocusedDate.getUTCMonth() ) { // day did not exist in this month (e.g. 31) -> go to last day of month oFocusedDate.setUTCDate(0); } _focusDate.call(this, oFocusedDate, true); _hideMonthPicker.call(this); }
javascript
function _handleSelectMonth(oEvent){ var oFocusedDate = new UniversalDate(this._getFocusedDate().getTime()); var oMonthPicker = this.getAggregation("monthPicker"); var iMonth = oMonthPicker.getMonth(); oFocusedDate.setUTCMonth(iMonth); if (iMonth != oFocusedDate.getUTCMonth() ) { // day did not exist in this month (e.g. 31) -> go to last day of month oFocusedDate.setUTCDate(0); } _focusDate.call(this, oFocusedDate, true); _hideMonthPicker.call(this); }
[ "function", "_handleSelectMonth", "(", "oEvent", ")", "{", "var", "oFocusedDate", "=", "new", "UniversalDate", "(", "this", ".", "_getFocusedDate", "(", ")", ".", "getTime", "(", ")", ")", ";", "var", "oMonthPicker", "=", "this", ".", "getAggregation", "(", "\"monthPicker\"", ")", ";", "var", "iMonth", "=", "oMonthPicker", ".", "getMonth", "(", ")", ";", "oFocusedDate", ".", "setUTCMonth", "(", "iMonth", ")", ";", "if", "(", "iMonth", "!=", "oFocusedDate", ".", "getUTCMonth", "(", ")", ")", "{", "// day did not exist in this month (e.g. 31) -> go to last day of month", "oFocusedDate", ".", "setUTCDate", "(", "0", ")", ";", "}", "_focusDate", ".", "call", "(", "this", ",", "oFocusedDate", ",", "true", ")", ";", "_hideMonthPicker", ".", "call", "(", "this", ")", ";", "}" ]
Handles user selection of a month from the Month Picker. This function assumes there is a "monthPicker" aggregation. So callers must take care. @return {void} @private
[ "Handles", "user", "selection", "of", "a", "month", "from", "the", "Month", "Picker", ".", "This", "function", "assumes", "there", "is", "a", "monthPicker", "aggregation", ".", "So", "callers", "must", "take", "care", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.unified/src/sap/ui/unified/CalendarTimeInterval.js#L1927-L1944
4,498
SAP/openui5
src/sap.ui.unified/src/sap/ui/unified/CalendarTimeInterval.js
_handleSelectYear
function _handleSelectYear(oEvent){ var oFocusedDate = new UniversalDate(this._getFocusedDate().getTime()); var oYearPicker = this.getAggregation("yearPicker"); var oDate = CalendarUtils._createUniversalUTCDate(oYearPicker.getDate()); var iMonth = oFocusedDate.getUTCMonth(); oDate.setUTCMonth(oFocusedDate.getUTCMonth(), oFocusedDate.getUTCDate()); // to keep day and month stable also for islamic date oDate.setUTCHours(oFocusedDate.getUTCHours()); oDate.setUTCMinutes(oFocusedDate.getUTCMinutes()); oFocusedDate = oDate; if (iMonth != oFocusedDate.getUTCMonth() ) { // day did not exist in this year (29. Feb) -> go to last day of month oFocusedDate.setUTCDate(0); } _focusDate.call(this, oFocusedDate, true); _hideYearPicker.call(this); }
javascript
function _handleSelectYear(oEvent){ var oFocusedDate = new UniversalDate(this._getFocusedDate().getTime()); var oYearPicker = this.getAggregation("yearPicker"); var oDate = CalendarUtils._createUniversalUTCDate(oYearPicker.getDate()); var iMonth = oFocusedDate.getUTCMonth(); oDate.setUTCMonth(oFocusedDate.getUTCMonth(), oFocusedDate.getUTCDate()); // to keep day and month stable also for islamic date oDate.setUTCHours(oFocusedDate.getUTCHours()); oDate.setUTCMinutes(oFocusedDate.getUTCMinutes()); oFocusedDate = oDate; if (iMonth != oFocusedDate.getUTCMonth() ) { // day did not exist in this year (29. Feb) -> go to last day of month oFocusedDate.setUTCDate(0); } _focusDate.call(this, oFocusedDate, true); _hideYearPicker.call(this); }
[ "function", "_handleSelectYear", "(", "oEvent", ")", "{", "var", "oFocusedDate", "=", "new", "UniversalDate", "(", "this", ".", "_getFocusedDate", "(", ")", ".", "getTime", "(", ")", ")", ";", "var", "oYearPicker", "=", "this", ".", "getAggregation", "(", "\"yearPicker\"", ")", ";", "var", "oDate", "=", "CalendarUtils", ".", "_createUniversalUTCDate", "(", "oYearPicker", ".", "getDate", "(", ")", ")", ";", "var", "iMonth", "=", "oFocusedDate", ".", "getUTCMonth", "(", ")", ";", "oDate", ".", "setUTCMonth", "(", "oFocusedDate", ".", "getUTCMonth", "(", ")", ",", "oFocusedDate", ".", "getUTCDate", "(", ")", ")", ";", "// to keep day and month stable also for islamic date", "oDate", ".", "setUTCHours", "(", "oFocusedDate", ".", "getUTCHours", "(", ")", ")", ";", "oDate", ".", "setUTCMinutes", "(", "oFocusedDate", ".", "getUTCMinutes", "(", ")", ")", ";", "oFocusedDate", "=", "oDate", ";", "if", "(", "iMonth", "!=", "oFocusedDate", ".", "getUTCMonth", "(", ")", ")", "{", "// day did not exist in this year (29. Feb) -> go to last day of month", "oFocusedDate", ".", "setUTCDate", "(", "0", ")", ";", "}", "_focusDate", ".", "call", "(", "this", ",", "oFocusedDate", ",", "true", ")", ";", "_hideYearPicker", ".", "call", "(", "this", ")", ";", "}" ]
Handles the user year selection. This function assumes there is a "yearPicker" aggregation. So callers must take care. @return {void} @private
[ "Handles", "the", "user", "year", "selection", ".", "This", "function", "assumes", "there", "is", "a", "yearPicker", "aggregation", ".", "So", "callers", "must", "take", "care", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.unified/src/sap/ui/unified/CalendarTimeInterval.js#L1953-L1974
4,499
SAP/openui5
src/sap.ui.unified/src/sap/ui/unified/CalendarTimeInterval.js
_setDateInDatesRow
function _setDateInDatesRow(oDate) { var oDatesRow = this.getAggregation("datesRow"); var oHeader = this.getAggregation("header"); if (!this.getPickerPopup()) { // set number of days - but max number of days of this month var oLastDayOfMonth = new UniversalDate(oDate.getTime()); oLastDayOfMonth.setUTCDate(1); oLastDayOfMonth.setUTCMonth(oLastDayOfMonth.getUTCMonth() + 1); oLastDayOfMonth.setUTCDate(0); var iDays = oDatesRow.getDays(); // set start day and selected day var oStartDate = new UniversalDate(oDate.getTime()); oStartDate.setUTCDate( 1 + (Math.ceil(oDate.getUTCDate() / iDays) - 1) * iDays ); if (oLastDayOfMonth.getUTCDate() - oStartDate.getUTCDate() < iDays) { oStartDate.setUTCDate(oLastDayOfMonth.getUTCDate() - iDays + 1); } oDatesRow.setStartDate(CalendarUtils._createLocalDate(oStartDate, true)); var iYear = oStartDate.getJSDate().getUTCFullYear(); var iYearMax = this._oMaxDate.getJSDate().getUTCFullYear(); var iYearMin = this._oMinDate.getJSDate().getUTCFullYear(); var iMonth = oStartDate.getJSDate().getUTCMonth(); var iMonthMax = this._oMaxDate.getJSDate().getUTCMonth(); var iMonthMin = this._oMinDate.getJSDate().getUTCMonth(); var iDate = oStartDate.getJSDate().getUTCDate(); var iDateMax = this._oMaxDate.getJSDate().getUTCDate(); var iDateMin = this._oMinDate.getJSDate().getUTCDate(); if (iDate <= 1 || (iYear == iYearMin && iMonth == iMonthMin && iDate <= iDateMin)) { oHeader.setEnabledPrevious(false); } else { oHeader.setEnabledPrevious(true); } if ((iDate + iDays) >= oLastDayOfMonth.getUTCDate() || (iYear == iYearMax && iMonth == iMonthMax && iDate >= iDateMax)) { oHeader.setEnabledNext(false); } else { oHeader.setEnabledNext(true); } } else { oHeader.setEnabledPrevious(false); oHeader.setEnabledNext(false); } oDatesRow.setDate(CalendarUtils._createLocalDate(oDate, true)); }
javascript
function _setDateInDatesRow(oDate) { var oDatesRow = this.getAggregation("datesRow"); var oHeader = this.getAggregation("header"); if (!this.getPickerPopup()) { // set number of days - but max number of days of this month var oLastDayOfMonth = new UniversalDate(oDate.getTime()); oLastDayOfMonth.setUTCDate(1); oLastDayOfMonth.setUTCMonth(oLastDayOfMonth.getUTCMonth() + 1); oLastDayOfMonth.setUTCDate(0); var iDays = oDatesRow.getDays(); // set start day and selected day var oStartDate = new UniversalDate(oDate.getTime()); oStartDate.setUTCDate( 1 + (Math.ceil(oDate.getUTCDate() / iDays) - 1) * iDays ); if (oLastDayOfMonth.getUTCDate() - oStartDate.getUTCDate() < iDays) { oStartDate.setUTCDate(oLastDayOfMonth.getUTCDate() - iDays + 1); } oDatesRow.setStartDate(CalendarUtils._createLocalDate(oStartDate, true)); var iYear = oStartDate.getJSDate().getUTCFullYear(); var iYearMax = this._oMaxDate.getJSDate().getUTCFullYear(); var iYearMin = this._oMinDate.getJSDate().getUTCFullYear(); var iMonth = oStartDate.getJSDate().getUTCMonth(); var iMonthMax = this._oMaxDate.getJSDate().getUTCMonth(); var iMonthMin = this._oMinDate.getJSDate().getUTCMonth(); var iDate = oStartDate.getJSDate().getUTCDate(); var iDateMax = this._oMaxDate.getJSDate().getUTCDate(); var iDateMin = this._oMinDate.getJSDate().getUTCDate(); if (iDate <= 1 || (iYear == iYearMin && iMonth == iMonthMin && iDate <= iDateMin)) { oHeader.setEnabledPrevious(false); } else { oHeader.setEnabledPrevious(true); } if ((iDate + iDays) >= oLastDayOfMonth.getUTCDate() || (iYear == iYearMax && iMonth == iMonthMax && iDate >= iDateMax)) { oHeader.setEnabledNext(false); } else { oHeader.setEnabledNext(true); } } else { oHeader.setEnabledPrevious(false); oHeader.setEnabledNext(false); } oDatesRow.setDate(CalendarUtils._createLocalDate(oDate, true)); }
[ "function", "_setDateInDatesRow", "(", "oDate", ")", "{", "var", "oDatesRow", "=", "this", ".", "getAggregation", "(", "\"datesRow\"", ")", ";", "var", "oHeader", "=", "this", ".", "getAggregation", "(", "\"header\"", ")", ";", "if", "(", "!", "this", ".", "getPickerPopup", "(", ")", ")", "{", "// set number of days - but max number of days of this month", "var", "oLastDayOfMonth", "=", "new", "UniversalDate", "(", "oDate", ".", "getTime", "(", ")", ")", ";", "oLastDayOfMonth", ".", "setUTCDate", "(", "1", ")", ";", "oLastDayOfMonth", ".", "setUTCMonth", "(", "oLastDayOfMonth", ".", "getUTCMonth", "(", ")", "+", "1", ")", ";", "oLastDayOfMonth", ".", "setUTCDate", "(", "0", ")", ";", "var", "iDays", "=", "oDatesRow", ".", "getDays", "(", ")", ";", "// set start day and selected day", "var", "oStartDate", "=", "new", "UniversalDate", "(", "oDate", ".", "getTime", "(", ")", ")", ";", "oStartDate", ".", "setUTCDate", "(", "1", "+", "(", "Math", ".", "ceil", "(", "oDate", ".", "getUTCDate", "(", ")", "/", "iDays", ")", "-", "1", ")", "*", "iDays", ")", ";", "if", "(", "oLastDayOfMonth", ".", "getUTCDate", "(", ")", "-", "oStartDate", ".", "getUTCDate", "(", ")", "<", "iDays", ")", "{", "oStartDate", ".", "setUTCDate", "(", "oLastDayOfMonth", ".", "getUTCDate", "(", ")", "-", "iDays", "+", "1", ")", ";", "}", "oDatesRow", ".", "setStartDate", "(", "CalendarUtils", ".", "_createLocalDate", "(", "oStartDate", ",", "true", ")", ")", ";", "var", "iYear", "=", "oStartDate", ".", "getJSDate", "(", ")", ".", "getUTCFullYear", "(", ")", ";", "var", "iYearMax", "=", "this", ".", "_oMaxDate", ".", "getJSDate", "(", ")", ".", "getUTCFullYear", "(", ")", ";", "var", "iYearMin", "=", "this", ".", "_oMinDate", ".", "getJSDate", "(", ")", ".", "getUTCFullYear", "(", ")", ";", "var", "iMonth", "=", "oStartDate", ".", "getJSDate", "(", ")", ".", "getUTCMonth", "(", ")", ";", "var", "iMonthMax", "=", "this", ".", "_oMaxDate", ".", "getJSDate", "(", ")", ".", "getUTCMonth", "(", ")", ";", "var", "iMonthMin", "=", "this", ".", "_oMinDate", ".", "getJSDate", "(", ")", ".", "getUTCMonth", "(", ")", ";", "var", "iDate", "=", "oStartDate", ".", "getJSDate", "(", ")", ".", "getUTCDate", "(", ")", ";", "var", "iDateMax", "=", "this", ".", "_oMaxDate", ".", "getJSDate", "(", ")", ".", "getUTCDate", "(", ")", ";", "var", "iDateMin", "=", "this", ".", "_oMinDate", ".", "getJSDate", "(", ")", ".", "getUTCDate", "(", ")", ";", "if", "(", "iDate", "<=", "1", "||", "(", "iYear", "==", "iYearMin", "&&", "iMonth", "==", "iMonthMin", "&&", "iDate", "<=", "iDateMin", ")", ")", "{", "oHeader", ".", "setEnabledPrevious", "(", "false", ")", ";", "}", "else", "{", "oHeader", ".", "setEnabledPrevious", "(", "true", ")", ";", "}", "if", "(", "(", "iDate", "+", "iDays", ")", ">=", "oLastDayOfMonth", ".", "getUTCDate", "(", ")", "||", "(", "iYear", "==", "iYearMax", "&&", "iMonth", "==", "iMonthMax", "&&", "iDate", ">=", "iDateMax", ")", ")", "{", "oHeader", ".", "setEnabledNext", "(", "false", ")", ";", "}", "else", "{", "oHeader", ".", "setEnabledNext", "(", "true", ")", ";", "}", "}", "else", "{", "oHeader", ".", "setEnabledPrevious", "(", "false", ")", ";", "oHeader", ".", "setEnabledNext", "(", "false", ")", ";", "}", "oDatesRow", ".", "setDate", "(", "CalendarUtils", ".", "_createLocalDate", "(", "oDate", ",", "true", ")", ")", ";", "}" ]
Sets date in the embedded day Picker. This function assumes there is a "datesRow" aggregation. So callers must take care. @param oDate @return {void} @private
[ "Sets", "date", "in", "the", "embedded", "day", "Picker", ".", "This", "function", "assumes", "there", "is", "a", "datesRow", "aggregation", ".", "So", "callers", "must", "take", "care", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.unified/src/sap/ui/unified/CalendarTimeInterval.js#L2012-L2061