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
3,800
SAP/openui5
src/sap.m/src/sap/m/IconTabBarDragAndDropUtil.js
function (iBeginDragIndex, iControlCount) { if (iBeginDragIndex === iControlCount - 1) { sInsertAfterBeforePosition = INSERT_BEFORE; return iBeginDragIndex; } sInsertAfterBeforePosition = INSERT_AFTER; return iBeginDragIndex + 1; }
javascript
function (iBeginDragIndex, iControlCount) { if (iBeginDragIndex === iControlCount - 1) { sInsertAfterBeforePosition = INSERT_BEFORE; return iBeginDragIndex; } sInsertAfterBeforePosition = INSERT_AFTER; return iBeginDragIndex + 1; }
[ "function", "(", "iBeginDragIndex", ",", "iControlCount", ")", "{", "if", "(", "iBeginDragIndex", "===", "iControlCount", "-", "1", ")", "{", "sInsertAfterBeforePosition", "=", "INSERT_BEFORE", ";", "return", "iBeginDragIndex", ";", "}", "sInsertAfterBeforePosition", "=", "INSERT_AFTER", ";", "return", "iBeginDragIndex", "+", "1", ";", "}" ]
Increases the drop index. @param {number} iBeginDragIndex Index of dragged control @param {number} iControlCount Number of controls @private
[ "Increases", "the", "drop", "index", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.m/src/sap/m/IconTabBarDragAndDropUtil.js#L127-L134
3,801
SAP/openui5
src/sap.m/src/sap/m/IconTabBarDragAndDropUtil.js
function (oDraggedControl, iKeyCode) { var $DraggedControl = oDraggedControl.$(), aItems = this.getItems(), iBeginDragIndex = this.indexOfItem(oDraggedControl), bRtl = sap.ui.getCore().getConfiguration().getRTL(), iNewDropIndex, $DroppedControl, oKeyCodes = KeyCodes; switch (iKeyCode) { //Handles Ctrl + Home case oKeyCodes.HOME: iNewDropIndex = 0; sInsertAfterBeforePosition = INSERT_BEFORE; break; //Handles Ctrl + End case oKeyCodes.END: iNewDropIndex = aItems.length - 1; sInsertAfterBeforePosition = INSERT_AFTER; break; // Handles Ctrl + Left Arrow case oKeyCodes.ARROW_LEFT: if (bRtl) { iNewDropIndex = IconTabBarDragAndDropUtil._increaseDropIndex(iBeginDragIndex, aItems.length); } else { iNewDropIndex = IconTabBarDragAndDropUtil._decreaseDropIndex(iBeginDragIndex); } break; // Handles Ctrl + Right Arrow case oKeyCodes.ARROW_RIGHT: if (bRtl) { iNewDropIndex = IconTabBarDragAndDropUtil._decreaseDropIndex(iBeginDragIndex); } else { iNewDropIndex = IconTabBarDragAndDropUtil._increaseDropIndex(iBeginDragIndex, aItems.length); } break; // Handles Ctrl + Arrow Down case oKeyCodes.ARROW_DOWN: iNewDropIndex = IconTabBarDragAndDropUtil._increaseDropIndex(iBeginDragIndex, aItems.length); break; // Handles Ctrl + Arrow Up case oKeyCodes.ARROW_UP: iNewDropIndex = IconTabBarDragAndDropUtil._decreaseDropIndex(iBeginDragIndex); break; default: return; } $DroppedControl = aItems[iNewDropIndex].$(); IconTabBarDragAndDropUtil._insertControl(sInsertAfterBeforePosition, $DraggedControl, $DroppedControl); IconTabBarDragAndDropUtil._handleConfigurationAfterDragAndDrop.call(this, oDraggedControl, iNewDropIndex); return true; }
javascript
function (oDraggedControl, iKeyCode) { var $DraggedControl = oDraggedControl.$(), aItems = this.getItems(), iBeginDragIndex = this.indexOfItem(oDraggedControl), bRtl = sap.ui.getCore().getConfiguration().getRTL(), iNewDropIndex, $DroppedControl, oKeyCodes = KeyCodes; switch (iKeyCode) { //Handles Ctrl + Home case oKeyCodes.HOME: iNewDropIndex = 0; sInsertAfterBeforePosition = INSERT_BEFORE; break; //Handles Ctrl + End case oKeyCodes.END: iNewDropIndex = aItems.length - 1; sInsertAfterBeforePosition = INSERT_AFTER; break; // Handles Ctrl + Left Arrow case oKeyCodes.ARROW_LEFT: if (bRtl) { iNewDropIndex = IconTabBarDragAndDropUtil._increaseDropIndex(iBeginDragIndex, aItems.length); } else { iNewDropIndex = IconTabBarDragAndDropUtil._decreaseDropIndex(iBeginDragIndex); } break; // Handles Ctrl + Right Arrow case oKeyCodes.ARROW_RIGHT: if (bRtl) { iNewDropIndex = IconTabBarDragAndDropUtil._decreaseDropIndex(iBeginDragIndex); } else { iNewDropIndex = IconTabBarDragAndDropUtil._increaseDropIndex(iBeginDragIndex, aItems.length); } break; // Handles Ctrl + Arrow Down case oKeyCodes.ARROW_DOWN: iNewDropIndex = IconTabBarDragAndDropUtil._increaseDropIndex(iBeginDragIndex, aItems.length); break; // Handles Ctrl + Arrow Up case oKeyCodes.ARROW_UP: iNewDropIndex = IconTabBarDragAndDropUtil._decreaseDropIndex(iBeginDragIndex); break; default: return; } $DroppedControl = aItems[iNewDropIndex].$(); IconTabBarDragAndDropUtil._insertControl(sInsertAfterBeforePosition, $DraggedControl, $DroppedControl); IconTabBarDragAndDropUtil._handleConfigurationAfterDragAndDrop.call(this, oDraggedControl, iNewDropIndex); return true; }
[ "function", "(", "oDraggedControl", ",", "iKeyCode", ")", "{", "var", "$DraggedControl", "=", "oDraggedControl", ".", "$", "(", ")", ",", "aItems", "=", "this", ".", "getItems", "(", ")", ",", "iBeginDragIndex", "=", "this", ".", "indexOfItem", "(", "oDraggedControl", ")", ",", "bRtl", "=", "sap", ".", "ui", ".", "getCore", "(", ")", ".", "getConfiguration", "(", ")", ".", "getRTL", "(", ")", ",", "iNewDropIndex", ",", "$DroppedControl", ",", "oKeyCodes", "=", "KeyCodes", ";", "switch", "(", "iKeyCode", ")", "{", "//Handles Ctrl + Home", "case", "oKeyCodes", ".", "HOME", ":", "iNewDropIndex", "=", "0", ";", "sInsertAfterBeforePosition", "=", "INSERT_BEFORE", ";", "break", ";", "//Handles Ctrl + End", "case", "oKeyCodes", ".", "END", ":", "iNewDropIndex", "=", "aItems", ".", "length", "-", "1", ";", "sInsertAfterBeforePosition", "=", "INSERT_AFTER", ";", "break", ";", "// Handles Ctrl + Left Arrow", "case", "oKeyCodes", ".", "ARROW_LEFT", ":", "if", "(", "bRtl", ")", "{", "iNewDropIndex", "=", "IconTabBarDragAndDropUtil", ".", "_increaseDropIndex", "(", "iBeginDragIndex", ",", "aItems", ".", "length", ")", ";", "}", "else", "{", "iNewDropIndex", "=", "IconTabBarDragAndDropUtil", ".", "_decreaseDropIndex", "(", "iBeginDragIndex", ")", ";", "}", "break", ";", "// Handles Ctrl + Right Arrow", "case", "oKeyCodes", ".", "ARROW_RIGHT", ":", "if", "(", "bRtl", ")", "{", "iNewDropIndex", "=", "IconTabBarDragAndDropUtil", ".", "_decreaseDropIndex", "(", "iBeginDragIndex", ")", ";", "}", "else", "{", "iNewDropIndex", "=", "IconTabBarDragAndDropUtil", ".", "_increaseDropIndex", "(", "iBeginDragIndex", ",", "aItems", ".", "length", ")", ";", "}", "break", ";", "// Handles\tCtrl + Arrow Down", "case", "oKeyCodes", ".", "ARROW_DOWN", ":", "iNewDropIndex", "=", "IconTabBarDragAndDropUtil", ".", "_increaseDropIndex", "(", "iBeginDragIndex", ",", "aItems", ".", "length", ")", ";", "break", ";", "// Handles Ctrl + Arrow Up", "case", "oKeyCodes", ".", "ARROW_UP", ":", "iNewDropIndex", "=", "IconTabBarDragAndDropUtil", ".", "_decreaseDropIndex", "(", "iBeginDragIndex", ")", ";", "break", ";", "default", ":", "return", ";", "}", "$DroppedControl", "=", "aItems", "[", "iNewDropIndex", "]", ".", "$", "(", ")", ";", "IconTabBarDragAndDropUtil", ".", "_insertControl", "(", "sInsertAfterBeforePosition", ",", "$DraggedControl", ",", "$DroppedControl", ")", ";", "IconTabBarDragAndDropUtil", ".", "_handleConfigurationAfterDragAndDrop", ".", "call", "(", "this", ",", "oDraggedControl", ",", "iNewDropIndex", ")", ";", "return", "true", ";", "}" ]
Moves focused control depending on the combinations of pressed keys. @param {object} oDraggedControl Control that is going to be moved @param {number} iKeyCode Key code @returns {boolean} returns true is scrolling will be needed
[ "Moves", "focused", "control", "depending", "on", "the", "combinations", "of", "pressed", "keys", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.m/src/sap/m/IconTabBarDragAndDropUtil.js#L143-L196
3,802
SAP/openui5
src/sap.m/src/sap/m/IconTabBarDragAndDropUtil.js
function (aItems, oDraggedControl, oDroppedControl) { var oDroppedListControl, oDraggedListControl, sItemId, sDroppedControlId, sDraggedControlId; sDraggedControlId = oDraggedControl._tabFilter ? oDraggedControl._tabFilter.getId() : oDraggedControl.getId(); sDroppedControlId = oDroppedControl._tabFilter ? oDroppedControl._tabFilter.getId() : oDroppedControl.getId(); if (!aItems && !oDraggedControl && !oDroppedControl) { return; } aItems.forEach(function (oItem) { sItemId = oItem._tabFilter.getId(); if (!sItemId) { return; } if (sItemId === sDroppedControlId) { oDroppedListControl = oItem; } if (sItemId === sDraggedControlId) { oDraggedListControl = oItem; } }); return {oDraggedControlFromList: oDraggedListControl, oDroppedControlFromList: oDroppedListControl}; }
javascript
function (aItems, oDraggedControl, oDroppedControl) { var oDroppedListControl, oDraggedListControl, sItemId, sDroppedControlId, sDraggedControlId; sDraggedControlId = oDraggedControl._tabFilter ? oDraggedControl._tabFilter.getId() : oDraggedControl.getId(); sDroppedControlId = oDroppedControl._tabFilter ? oDroppedControl._tabFilter.getId() : oDroppedControl.getId(); if (!aItems && !oDraggedControl && !oDroppedControl) { return; } aItems.forEach(function (oItem) { sItemId = oItem._tabFilter.getId(); if (!sItemId) { return; } if (sItemId === sDroppedControlId) { oDroppedListControl = oItem; } if (sItemId === sDraggedControlId) { oDraggedListControl = oItem; } }); return {oDraggedControlFromList: oDraggedListControl, oDroppedControlFromList: oDroppedListControl}; }
[ "function", "(", "aItems", ",", "oDraggedControl", ",", "oDroppedControl", ")", "{", "var", "oDroppedListControl", ",", "oDraggedListControl", ",", "sItemId", ",", "sDroppedControlId", ",", "sDraggedControlId", ";", "sDraggedControlId", "=", "oDraggedControl", ".", "_tabFilter", "?", "oDraggedControl", ".", "_tabFilter", ".", "getId", "(", ")", ":", "oDraggedControl", ".", "getId", "(", ")", ";", "sDroppedControlId", "=", "oDroppedControl", ".", "_tabFilter", "?", "oDroppedControl", ".", "_tabFilter", ".", "getId", "(", ")", ":", "oDroppedControl", ".", "getId", "(", ")", ";", "if", "(", "!", "aItems", "&&", "!", "oDraggedControl", "&&", "!", "oDroppedControl", ")", "{", "return", ";", "}", "aItems", ".", "forEach", "(", "function", "(", "oItem", ")", "{", "sItemId", "=", "oItem", ".", "_tabFilter", ".", "getId", "(", ")", ";", "if", "(", "!", "sItemId", ")", "{", "return", ";", "}", "if", "(", "sItemId", "===", "sDroppedControlId", ")", "{", "oDroppedListControl", "=", "oItem", ";", "}", "if", "(", "sItemId", "===", "sDraggedControlId", ")", "{", "oDraggedListControl", "=", "oItem", ";", "}", "}", ")", ";", "return", "{", "oDraggedControlFromList", ":", "oDraggedListControl", ",", "oDroppedControlFromList", ":", "oDroppedListControl", "}", ";", "}" ]
Retrieves drag and drop controls from sap.m.IconTabBarSelectList context. @param {array} aItems items of sap.m.IconTabBarSelectList @param {object} oDraggedControl item that is dragged @param {object} oDroppedControl item that the dragged control will be dropped on
[ "Retrieves", "drag", "and", "drop", "controls", "from", "sap", ".", "m", ".", "IconTabBarSelectList", "context", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.m/src/sap/m/IconTabBarDragAndDropUtil.js#L204-L232
3,803
SAP/openui5
src/sap.m/src/sap/m/IconTabBarDragAndDropUtil.js
function (context, sDropLayout) { var oIconTabHeader = context._iconTabHeader ? context._iconTabHeader : context; var sIconTabHeaderId = oIconTabHeader.getId(); //Adding Drag&Drop configuration to the dragDropConfig aggregation if needed context.addDragDropConfig(new DragInfo({ sourceAggregation: "items", groupName: DRAG_DROP_GROUP_NAME + sIconTabHeaderId })); context.addDragDropConfig(new DropInfo({ targetAggregation: "items", dropPosition: "Between", dropLayout: sDropLayout, drop: context._handleDragAndDrop.bind(context), groupName: DRAG_DROP_GROUP_NAME + sIconTabHeaderId })); }
javascript
function (context, sDropLayout) { var oIconTabHeader = context._iconTabHeader ? context._iconTabHeader : context; var sIconTabHeaderId = oIconTabHeader.getId(); //Adding Drag&Drop configuration to the dragDropConfig aggregation if needed context.addDragDropConfig(new DragInfo({ sourceAggregation: "items", groupName: DRAG_DROP_GROUP_NAME + sIconTabHeaderId })); context.addDragDropConfig(new DropInfo({ targetAggregation: "items", dropPosition: "Between", dropLayout: sDropLayout, drop: context._handleDragAndDrop.bind(context), groupName: DRAG_DROP_GROUP_NAME + sIconTabHeaderId })); }
[ "function", "(", "context", ",", "sDropLayout", ")", "{", "var", "oIconTabHeader", "=", "context", ".", "_iconTabHeader", "?", "context", ".", "_iconTabHeader", ":", "context", ";", "var", "sIconTabHeaderId", "=", "oIconTabHeader", ".", "getId", "(", ")", ";", "//Adding Drag&Drop configuration to the dragDropConfig aggregation if needed", "context", ".", "addDragDropConfig", "(", "new", "DragInfo", "(", "{", "sourceAggregation", ":", "\"items\"", ",", "groupName", ":", "DRAG_DROP_GROUP_NAME", "+", "sIconTabHeaderId", "}", ")", ")", ";", "context", ".", "addDragDropConfig", "(", "new", "DropInfo", "(", "{", "targetAggregation", ":", "\"items\"", ",", "dropPosition", ":", "\"Between\"", ",", "dropLayout", ":", "sDropLayout", ",", "drop", ":", "context", ".", "_handleDragAndDrop", ".", "bind", "(", "context", ")", ",", "groupName", ":", "DRAG_DROP_GROUP_NAME", "+", "sIconTabHeaderId", "}", ")", ")", ";", "}" ]
Adding aggregations for drag and drop. @param {object} context from which context function is called (sap.m.IconTabHeader or sap.m.IconTabSelectList) @param {string} sDropLayout Depending on the control we are dragging in, it could be Vertical or Horizontal
[ "Adding", "aggregations", "for", "drag", "and", "drop", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.m/src/sap/m/IconTabBarDragAndDropUtil.js#L239-L254
3,804
SAP/openui5
src/sap.ui.core/src/sap/ui/core/util/serializer/XMLViewSerializer.js
function (oControl) { return oControl instanceof this._oWindow.sap.ui.core.mvc.View && oControl !== that._oView; }
javascript
function (oControl) { return oControl instanceof this._oWindow.sap.ui.core.mvc.View && oControl !== that._oView; }
[ "function", "(", "oControl", ")", "{", "return", "oControl", "instanceof", "this", ".", "_oWindow", ".", "sap", ".", "ui", ".", "core", ".", "mvc", ".", "View", "&&", "oControl", "!==", "that", ".", "_oView", ";", "}" ]
a function to understand if to skip aggregations
[ "a", "function", "to", "understand", "if", "to", "skip", "aggregations" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/util/serializer/XMLViewSerializer.js#L60-L62
3,805
SAP/openui5
src/sap.ui.core/src/sap/ui/model/odata/_AnnotationHelperExpression.js
function (oInterface, oPathValue, iIndex, sEdmType) { var oParameter = Basics.descend(oPathValue, iIndex), oResult; oParameter.asExpression = true; oResult = Expression.expression(oInterface, oParameter); if (sEdmType && sEdmType !== oResult.type) { Basics.error(oParameter, "Expected " + sEdmType + " but instead saw " + oResult.type); } return oResult; }
javascript
function (oInterface, oPathValue, iIndex, sEdmType) { var oParameter = Basics.descend(oPathValue, iIndex), oResult; oParameter.asExpression = true; oResult = Expression.expression(oInterface, oParameter); if (sEdmType && sEdmType !== oResult.type) { Basics.error(oParameter, "Expected " + sEdmType + " but instead saw " + oResult.type); } return oResult; }
[ "function", "(", "oInterface", ",", "oPathValue", ",", "iIndex", ",", "sEdmType", ")", "{", "var", "oParameter", "=", "Basics", ".", "descend", "(", "oPathValue", ",", "iIndex", ")", ",", "oResult", ";", "oParameter", ".", "asExpression", "=", "true", ";", "oResult", "=", "Expression", ".", "expression", "(", "oInterface", ",", "oParameter", ")", ";", "if", "(", "sEdmType", "&&", "sEdmType", "!==", "oResult", ".", "type", ")", "{", "Basics", ".", "error", "(", "oParameter", ",", "\"Expected \"", "+", "sEdmType", "+", "\" but instead saw \"", "+", "oResult", ".", "type", ")", ";", "}", "return", "oResult", ";", "}" ]
Evaluates a parameter and ensures that the result is of the given EDM type. The function calls <code>expression</code> with <code>bExpression=true</code>. This will cause any embedded <code>odata.concat</code> to generate an expression binding. This should be correct in any case because only a standalone <code>concat</code> may generate a composite binding. @param {sap.ui.core.util.XMLPreprocessor.IContext|sap.ui.model.Context} oInterface the callback interface related to the current formatter call @param {object} oPathValue path and value information pointing to the parameter array (see Expression object) @param {number} iIndex the parameter index @param {string} [sEdmType] the expected EDM type or <code>undefined</code> if any type is allowed @returns {object} the result object
[ "Evaluates", "a", "parameter", "and", "ensures", "that", "the", "result", "is", "of", "the", "given", "EDM", "type", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/_AnnotationHelperExpression.js#L625-L637
3,806
SAP/openui5
src/sap.ui.core/src/sap/ui/model/odata/_AnnotationHelperExpression.js
function (sValue) { return DateFormat.getDateInstance({ pattern : "yyyy-MM-dd", strictParsing : true, UTC : true }).parse(sValue); }
javascript
function (sValue) { return DateFormat.getDateInstance({ pattern : "yyyy-MM-dd", strictParsing : true, UTC : true }).parse(sValue); }
[ "function", "(", "sValue", ")", "{", "return", "DateFormat", ".", "getDateInstance", "(", "{", "pattern", ":", "\"yyyy-MM-dd\"", ",", "strictParsing", ":", "true", ",", "UTC", ":", "true", "}", ")", ".", "parse", "(", "sValue", ")", ";", "}" ]
Parses an Edm.Date value and returns the corresponding JavaScript Date value. @param {string} sValue the Edm.Date value to parse @returns {Date} the JavaScript Date value or <code>null</code> in case the input could not be parsed
[ "Parses", "an", "Edm", ".", "Date", "value", "and", "returns", "the", "corresponding", "JavaScript", "Date", "value", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/_AnnotationHelperExpression.js#L647-L653
3,807
SAP/openui5
src/sap.ui.core/src/sap/ui/model/odata/_AnnotationHelperExpression.js
function (sValue) { var aMatches = mEdmType2RegExp.DateTimeOffset.exec(sValue); if (aMatches && aMatches[1] && aMatches[1].length > 4) { // "round" to millis, BEWARE of the dot! sValue = sValue.replace(aMatches[1], aMatches[1].slice(0, 4)); } return DateFormat.getDateTimeInstance({ pattern : "yyyy-MM-dd'T'HH:mm:ss.SSSX", strictParsing : true }).parse(sValue.toUpperCase()); }
javascript
function (sValue) { var aMatches = mEdmType2RegExp.DateTimeOffset.exec(sValue); if (aMatches && aMatches[1] && aMatches[1].length > 4) { // "round" to millis, BEWARE of the dot! sValue = sValue.replace(aMatches[1], aMatches[1].slice(0, 4)); } return DateFormat.getDateTimeInstance({ pattern : "yyyy-MM-dd'T'HH:mm:ss.SSSX", strictParsing : true }).parse(sValue.toUpperCase()); }
[ "function", "(", "sValue", ")", "{", "var", "aMatches", "=", "mEdmType2RegExp", ".", "DateTimeOffset", ".", "exec", "(", "sValue", ")", ";", "if", "(", "aMatches", "&&", "aMatches", "[", "1", "]", "&&", "aMatches", "[", "1", "]", ".", "length", ">", "4", ")", "{", "// \"round\" to millis, BEWARE of the dot!", "sValue", "=", "sValue", ".", "replace", "(", "aMatches", "[", "1", "]", ",", "aMatches", "[", "1", "]", ".", "slice", "(", "0", ",", "4", ")", ")", ";", "}", "return", "DateFormat", ".", "getDateTimeInstance", "(", "{", "pattern", ":", "\"yyyy-MM-dd'T'HH:mm:ss.SSSX\"", ",", "strictParsing", ":", "true", "}", ")", ".", "parse", "(", "sValue", ".", "toUpperCase", "(", ")", ")", ";", "}" ]
Parses an Edm.DateTimeOffset value and returns the corresponding JavaScript Date value. @param {string} sValue the Edm.DateTimeOffset value to parse @returns {Date} the JavaScript Date value or <code>null</code> in case the input could not be parsed
[ "Parses", "an", "Edm", ".", "DateTimeOffset", "value", "and", "returns", "the", "corresponding", "JavaScript", "Date", "value", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/_AnnotationHelperExpression.js#L663-L674
3,808
SAP/openui5
src/sap.ui.core/src/sap/ui/model/odata/_AnnotationHelperExpression.js
function (sValue) { if (sValue.length > 12) { // "round" to millis: "HH:mm:ss.SSS" sValue = sValue.slice(0, 12); } return DateFormat.getTimeInstance({ pattern : "HH:mm:ss.SSS", strictParsing : true, UTC : true }).parse(sValue); }
javascript
function (sValue) { if (sValue.length > 12) { // "round" to millis: "HH:mm:ss.SSS" sValue = sValue.slice(0, 12); } return DateFormat.getTimeInstance({ pattern : "HH:mm:ss.SSS", strictParsing : true, UTC : true }).parse(sValue); }
[ "function", "(", "sValue", ")", "{", "if", "(", "sValue", ".", "length", ">", "12", ")", "{", "// \"round\" to millis: \"HH:mm:ss.SSS\"", "sValue", "=", "sValue", ".", "slice", "(", "0", ",", "12", ")", ";", "}", "return", "DateFormat", ".", "getTimeInstance", "(", "{", "pattern", ":", "\"HH:mm:ss.SSS\"", ",", "strictParsing", ":", "true", ",", "UTC", ":", "true", "}", ")", ".", "parse", "(", "sValue", ")", ";", "}" ]
Parses an Edm.TimeOfDay value and returns the corresponding JavaScript Date value. @param {string} sValue the Edm.TimeOfDay value to parse @returns {Date} the JavaScript Date value or <code>null</code> in case the input could not be parsed
[ "Parses", "an", "Edm", ".", "TimeOfDay", "value", "and", "returns", "the", "corresponding", "JavaScript", "Date", "value", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/_AnnotationHelperExpression.js#L684-L695
3,809
SAP/openui5
src/sap.ui.core/src/sap/ui/base/Metadata.js
function(sClassName, oClassInfo) { assert(typeof sClassName === "string" && sClassName, "Metadata: sClassName must be a non-empty string"); assert(typeof oClassInfo === "object", "Metadata: oClassInfo must be empty or an object"); // support for old usage of Metadata if ( !oClassInfo || typeof oClassInfo.metadata !== "object" ) { oClassInfo = { metadata : oClassInfo || {}, // retrieve class by its name. Using a lookup costs time but avoids the need for redundant arguments to this function constructor : ObjectPath.get(sClassName) }; oClassInfo.metadata.__version = 1.0; } oClassInfo.metadata.__version = oClassInfo.metadata.__version || 2.0; if ( typeof oClassInfo.constructor !== "function" ) { throw Error("constructor for class " + sClassName + " must have been declared before creating metadata for it"); } // invariant: oClassInfo exists, oClassInfo.metadata exists, oClassInfo.constructor exists this._sClassName = sClassName; this._oClass = oClassInfo.constructor; this.extend(oClassInfo); }
javascript
function(sClassName, oClassInfo) { assert(typeof sClassName === "string" && sClassName, "Metadata: sClassName must be a non-empty string"); assert(typeof oClassInfo === "object", "Metadata: oClassInfo must be empty or an object"); // support for old usage of Metadata if ( !oClassInfo || typeof oClassInfo.metadata !== "object" ) { oClassInfo = { metadata : oClassInfo || {}, // retrieve class by its name. Using a lookup costs time but avoids the need for redundant arguments to this function constructor : ObjectPath.get(sClassName) }; oClassInfo.metadata.__version = 1.0; } oClassInfo.metadata.__version = oClassInfo.metadata.__version || 2.0; if ( typeof oClassInfo.constructor !== "function" ) { throw Error("constructor for class " + sClassName + " must have been declared before creating metadata for it"); } // invariant: oClassInfo exists, oClassInfo.metadata exists, oClassInfo.constructor exists this._sClassName = sClassName; this._oClass = oClassInfo.constructor; this.extend(oClassInfo); }
[ "function", "(", "sClassName", ",", "oClassInfo", ")", "{", "assert", "(", "typeof", "sClassName", "===", "\"string\"", "&&", "sClassName", ",", "\"Metadata: sClassName must be a non-empty string\"", ")", ";", "assert", "(", "typeof", "oClassInfo", "===", "\"object\"", ",", "\"Metadata: oClassInfo must be empty or an object\"", ")", ";", "// support for old usage of Metadata", "if", "(", "!", "oClassInfo", "||", "typeof", "oClassInfo", ".", "metadata", "!==", "\"object\"", ")", "{", "oClassInfo", "=", "{", "metadata", ":", "oClassInfo", "||", "{", "}", ",", "// retrieve class by its name. Using a lookup costs time but avoids the need for redundant arguments to this function", "constructor", ":", "ObjectPath", ".", "get", "(", "sClassName", ")", "}", ";", "oClassInfo", ".", "metadata", ".", "__version", "=", "1.0", ";", "}", "oClassInfo", ".", "metadata", ".", "__version", "=", "oClassInfo", ".", "metadata", ".", "__version", "||", "2.0", ";", "if", "(", "typeof", "oClassInfo", ".", "constructor", "!==", "\"function\"", ")", "{", "throw", "Error", "(", "\"constructor for class \"", "+", "sClassName", "+", "\" must have been declared before creating metadata for it\"", ")", ";", "}", "// invariant: oClassInfo exists, oClassInfo.metadata exists, oClassInfo.constructor exists", "this", ".", "_sClassName", "=", "sClassName", ";", "this", ".", "_oClass", "=", "oClassInfo", ".", "constructor", ";", "this", ".", "extend", "(", "oClassInfo", ")", ";", "}" ]
Creates a new metadata object from the given static infos. Note: throughout this class documentation, the described subclass of Object is referenced as <i>the described class</i>. @param {string} sClassName fully qualified name of the described class @param {object} oClassInfo info to construct the class and its metadata from @class Metadata for a class. @author Frank Weigel @version ${version} @since 0.8.6 @public @alias sap.ui.base.Metadata
[ "Creates", "a", "new", "metadata", "object", "from", "the", "given", "static", "infos", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/base/Metadata.js#L33-L56
3,810
SAP/openui5
src/sap.ui.demokit/src/sap/ui/demokit/demoapps/controller/App.controller.js
function (oEvent) { oEvent.getParameters().itemsBinding.filter([ new Filter("name", FilterOperator.Contains, oEvent.getParameters().value) ]); }
javascript
function (oEvent) { oEvent.getParameters().itemsBinding.filter([ new Filter("name", FilterOperator.Contains, oEvent.getParameters().value) ]); }
[ "function", "(", "oEvent", ")", "{", "oEvent", ".", "getParameters", "(", ")", ".", "itemsBinding", ".", "filter", "(", "[", "new", "Filter", "(", "\"name\"", ",", "FilterOperator", ".", "Contains", ",", "oEvent", ".", "getParameters", "(", ")", ".", "value", ")", "]", ")", ";", "}" ]
Filters the download dialog @param {sap.ui.base.Event} oEvent the SearchField liveChange event @public
[ "Filters", "the", "download", "dialog" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.demokit/src/sap/ui/demokit/demoapps/controller/App.controller.js#L47-L51
3,811
SAP/openui5
src/sap.ui.fl/src/sap/ui/fl/support/apps/contentbrowser/utils/DataUtils.js
function (oData, sFileType) { // code extension and properties files do not need formation if ((sFileType === "js") || (sFileType === "properties")) { return oData; } // other files should be formatted to JSON try { oData = JSON.parse(oData); return JSON.stringify(oData, null, '\t'); } catch (oError){ var ErrorUtils = sap.ui.require("sap/ui/fl/support/apps/contentbrowser/utils/ErrorUtils"); ErrorUtils.displayError("Error", oError.name, oError.message); return oData; } }
javascript
function (oData, sFileType) { // code extension and properties files do not need formation if ((sFileType === "js") || (sFileType === "properties")) { return oData; } // other files should be formatted to JSON try { oData = JSON.parse(oData); return JSON.stringify(oData, null, '\t'); } catch (oError){ var ErrorUtils = sap.ui.require("sap/ui/fl/support/apps/contentbrowser/utils/ErrorUtils"); ErrorUtils.displayError("Error", oError.name, oError.message); return oData; } }
[ "function", "(", "oData", ",", "sFileType", ")", "{", "// code extension and properties files do not need formation", "if", "(", "(", "sFileType", "===", "\"js\"", ")", "||", "(", "sFileType", "===", "\"properties\"", ")", ")", "{", "return", "oData", ";", "}", "// other files should be formatted to JSON", "try", "{", "oData", "=", "JSON", ".", "parse", "(", "oData", ")", ";", "return", "JSON", ".", "stringify", "(", "oData", ",", "null", ",", "'\\t'", ")", ";", "}", "catch", "(", "oError", ")", "{", "var", "ErrorUtils", "=", "sap", ".", "ui", ".", "require", "(", "\"sap/ui/fl/support/apps/contentbrowser/utils/ErrorUtils\"", ")", ";", "ErrorUtils", ".", "displayError", "(", "\"Error\"", ",", "oError", ".", "name", ",", "oError", ".", "message", ")", ";", "return", "oData", ";", "}", "}" ]
Pretty printer for specific file types. @param {Object} oData - data to be formatted @param {String} sFileType - file type of data @returns {Object} oData - data after formatting @public
[ "Pretty", "printer", "for", "specific", "file", "types", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.fl/src/sap/ui/fl/support/apps/contentbrowser/utils/DataUtils.js#L38-L52
3,812
SAP/openui5
src/sap.ui.fl/src/sap/ui/fl/support/apps/contentbrowser/utils/DataUtils.js
function (oGroup) { var sTitle = "{i18n>systemData}"; if (oGroup.key === "custom") { sTitle = "{i18n>externalReferences}"; } return new GroupHeaderListItem({ title: sTitle, upperCase: false }); }
javascript
function (oGroup) { var sTitle = "{i18n>systemData}"; if (oGroup.key === "custom") { sTitle = "{i18n>externalReferences}"; } return new GroupHeaderListItem({ title: sTitle, upperCase: false }); }
[ "function", "(", "oGroup", ")", "{", "var", "sTitle", "=", "\"{i18n>systemData}\"", ";", "if", "(", "oGroup", ".", "key", "===", "\"custom\"", ")", "{", "sTitle", "=", "\"{i18n>externalReferences}\"", ";", "}", "return", "new", "GroupHeaderListItem", "(", "{", "title", ":", "sTitle", ",", "upperCase", ":", "false", "}", ")", ";", "}" ]
Factory for creating list group header objects for the metadata list. @param {Object} oGroup - group data passed from the lists model binding @returns {sap.m.GroupHeaderListItem} @public
[ "Factory", "for", "creating", "list", "group", "header", "objects", "for", "the", "metadata", "list", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.fl/src/sap/ui/fl/support/apps/contentbrowser/utils/DataUtils.js#L60-L71
3,813
SAP/openui5
src/sap.ui.fl/src/sap/ui/fl/support/apps/contentbrowser/utils/DataUtils.js
function (oContentItem) { var bNotBlacklisted = true; jQuery.each(this.aBlacklist, function (index, mBlacklistedElement) { var bAllPropertiesMatched = true; jQuery.each(mBlacklistedElement, function (sProperty, sValue) { bAllPropertiesMatched = bAllPropertiesMatched && oContentItem[sProperty] === sValue; }); if (bAllPropertiesMatched) { bNotBlacklisted = false; return false; // break each } }); return bNotBlacklisted; }
javascript
function (oContentItem) { var bNotBlacklisted = true; jQuery.each(this.aBlacklist, function (index, mBlacklistedElement) { var bAllPropertiesMatched = true; jQuery.each(mBlacklistedElement, function (sProperty, sValue) { bAllPropertiesMatched = bAllPropertiesMatched && oContentItem[sProperty] === sValue; }); if (bAllPropertiesMatched) { bNotBlacklisted = false; return false; // break each } }); return bNotBlacklisted; }
[ "function", "(", "oContentItem", ")", "{", "var", "bNotBlacklisted", "=", "true", ";", "jQuery", ".", "each", "(", "this", ".", "aBlacklist", ",", "function", "(", "index", ",", "mBlacklistedElement", ")", "{", "var", "bAllPropertiesMatched", "=", "true", ";", "jQuery", ".", "each", "(", "mBlacklistedElement", ",", "function", "(", "sProperty", ",", "sValue", ")", "{", "bAllPropertiesMatched", "=", "bAllPropertiesMatched", "&&", "oContentItem", "[", "sProperty", "]", "===", "sValue", ";", "}", ")", ";", "if", "(", "bAllPropertiesMatched", ")", "{", "bNotBlacklisted", "=", "false", ";", "return", "false", ";", "// break each", "}", "}", ")", ";", "return", "bNotBlacklisted", ";", "}" ]
Verifies if item content is not in the black list. @param {Object} oContentItem - content item needs to be verified @returns {Boolean} - <code>true</code> if not in the black list @public
[ "Verifies", "if", "item", "content", "is", "not", "in", "the", "black", "list", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.fl/src/sap/ui/fl/support/apps/contentbrowser/utils/DataUtils.js#L79-L94
3,814
SAP/openui5
src/sap.ui.fl/src/sap/ui/fl/support/apps/contentbrowser/utils/DataUtils.js
function (sNamespace) { if (!sNamespace) { return ""; } if (sNamespace[0] === "/") { var sNamespaceWithoutLeadingSlash = sNamespace.substring(1, sNamespace.length); return this.cleanLeadingAndTrailingSlashes(sNamespaceWithoutLeadingSlash); } if (sNamespace[sNamespace.length - 1] === "/") { var sNamespaceWithoutTrailingSlash = sNamespace.substring(0, sNamespace.length - 1); return this.cleanLeadingAndTrailingSlashes(sNamespaceWithoutTrailingSlash); } return sNamespace; }
javascript
function (sNamespace) { if (!sNamespace) { return ""; } if (sNamespace[0] === "/") { var sNamespaceWithoutLeadingSlash = sNamespace.substring(1, sNamespace.length); return this.cleanLeadingAndTrailingSlashes(sNamespaceWithoutLeadingSlash); } if (sNamespace[sNamespace.length - 1] === "/") { var sNamespaceWithoutTrailingSlash = sNamespace.substring(0, sNamespace.length - 1); return this.cleanLeadingAndTrailingSlashes(sNamespaceWithoutTrailingSlash); } return sNamespace; }
[ "function", "(", "sNamespace", ")", "{", "if", "(", "!", "sNamespace", ")", "{", "return", "\"\"", ";", "}", "if", "(", "sNamespace", "[", "0", "]", "===", "\"/\"", ")", "{", "var", "sNamespaceWithoutLeadingSlash", "=", "sNamespace", ".", "substring", "(", "1", ",", "sNamespace", ".", "length", ")", ";", "return", "this", ".", "cleanLeadingAndTrailingSlashes", "(", "sNamespaceWithoutLeadingSlash", ")", ";", "}", "if", "(", "sNamespace", "[", "sNamespace", ".", "length", "-", "1", "]", "===", "\"/\"", ")", "{", "var", "sNamespaceWithoutTrailingSlash", "=", "sNamespace", ".", "substring", "(", "0", ",", "sNamespace", ".", "length", "-", "1", ")", ";", "return", "this", ".", "cleanLeadingAndTrailingSlashes", "(", "sNamespaceWithoutTrailingSlash", ")", ";", "}", "return", "sNamespace", ";", "}" ]
Removes leading and trailing slashes from a string. @param {String} sNamespace - input string @returns {String} - string after removing leading and trailing slashes @public
[ "Removes", "leading", "and", "trailing", "slashes", "from", "a", "string", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.fl/src/sap/ui/fl/support/apps/contentbrowser/utils/DataUtils.js#L102-L115
3,815
SAP/openui5
src/sap.ui.core/src/jquery.sap.global.js
function(key, type, callback) { return function(value) { try { if ( value != null || type === 'string' ) { if (value) { localStorage.setItem(key, type === 'boolean' ? 'X' : value); } else { localStorage.removeItem(key); } callback(value); } value = localStorage.getItem(key); return type === 'boolean' ? value === 'X' : value; } catch (e) { Log.warning("Could not access localStorage while accessing '" + key + "' (value: '" + value + "', are cookies disabled?): " + e.message); } }; }
javascript
function(key, type, callback) { return function(value) { try { if ( value != null || type === 'string' ) { if (value) { localStorage.setItem(key, type === 'boolean' ? 'X' : value); } else { localStorage.removeItem(key); } callback(value); } value = localStorage.getItem(key); return type === 'boolean' ? value === 'X' : value; } catch (e) { Log.warning("Could not access localStorage while accessing '" + key + "' (value: '" + value + "', are cookies disabled?): " + e.message); } }; }
[ "function", "(", "key", ",", "type", ",", "callback", ")", "{", "return", "function", "(", "value", ")", "{", "try", "{", "if", "(", "value", "!=", "null", "||", "type", "===", "'string'", ")", "{", "if", "(", "value", ")", "{", "localStorage", ".", "setItem", "(", "key", ",", "type", "===", "'boolean'", "?", "'X'", ":", "value", ")", ";", "}", "else", "{", "localStorage", ".", "removeItem", "(", "key", ")", ";", "}", "callback", "(", "value", ")", ";", "}", "value", "=", "localStorage", ".", "getItem", "(", "key", ")", ";", "return", "type", "===", "'boolean'", "?", "value", "===", "'X'", ":", "value", ";", "}", "catch", "(", "e", ")", "{", "Log", ".", "warning", "(", "\"Could not access localStorage while accessing '\"", "+", "key", "+", "\"' (value: '\"", "+", "value", "+", "\"', are cookies disabled?): \"", "+", "e", ".", "message", ")", ";", "}", "}", ";", "}" ]
Reads the value for the given key from the localStorage or writes a new value to it.
[ "Reads", "the", "value", "for", "the", "given", "key", "from", "the", "localStorage", "or", "writes", "a", "new", "value", "to", "it", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/jquery.sap.global.js#L563-L580
3,816
SAP/openui5
src/sap.ui.rta/src/sap/ui/rta/service/ControllerExtension.js
function(sCodeRef, sViewId) { var oFlexSettings = oRta.getFlexSettings(); if (!oFlexSettings.developerMode) { throw DtUtil.createError("service.ControllerExtension#add", "code extensions can only be created in developer mode", "sap.ui.rta"); } if (!sCodeRef) { throw DtUtil.createError("service.ControllerExtension#add", "can't create controller extension without codeRef", "sap.ui.rta"); } if (!sCodeRef.endsWith(".js")) { throw DtUtil.createError("service.ControllerExtension#add", "codeRef has to end with 'js'"); } var oFlexController = oRta._getFlexController(); var oView = sap.ui.getCore().byId(sViewId); var oAppComponent = FlexUtils.getAppComponentForControl(oView); var sControllerName = oView.getControllerName && oView.getControllerName() || oView.getController() && oView.getController().getMetadata().getName(); var oChangeSpecificData = { content: { codeRef: sCodeRef }, selector: { controllerName: sControllerName }, changeType: "codeExt", namespace: oFlexSettings.namespace, developerMode: oFlexSettings.developerMode, scenario: oFlexSettings.scenario }; var oPreparedChange = oFlexController.createBaseChange(oChangeSpecificData, oAppComponent); oFlexController.addPreparedChange(oPreparedChange, oAppComponent); return oPreparedChange.getDefinition(); }
javascript
function(sCodeRef, sViewId) { var oFlexSettings = oRta.getFlexSettings(); if (!oFlexSettings.developerMode) { throw DtUtil.createError("service.ControllerExtension#add", "code extensions can only be created in developer mode", "sap.ui.rta"); } if (!sCodeRef) { throw DtUtil.createError("service.ControllerExtension#add", "can't create controller extension without codeRef", "sap.ui.rta"); } if (!sCodeRef.endsWith(".js")) { throw DtUtil.createError("service.ControllerExtension#add", "codeRef has to end with 'js'"); } var oFlexController = oRta._getFlexController(); var oView = sap.ui.getCore().byId(sViewId); var oAppComponent = FlexUtils.getAppComponentForControl(oView); var sControllerName = oView.getControllerName && oView.getControllerName() || oView.getController() && oView.getController().getMetadata().getName(); var oChangeSpecificData = { content: { codeRef: sCodeRef }, selector: { controllerName: sControllerName }, changeType: "codeExt", namespace: oFlexSettings.namespace, developerMode: oFlexSettings.developerMode, scenario: oFlexSettings.scenario }; var oPreparedChange = oFlexController.createBaseChange(oChangeSpecificData, oAppComponent); oFlexController.addPreparedChange(oPreparedChange, oAppComponent); return oPreparedChange.getDefinition(); }
[ "function", "(", "sCodeRef", ",", "sViewId", ")", "{", "var", "oFlexSettings", "=", "oRta", ".", "getFlexSettings", "(", ")", ";", "if", "(", "!", "oFlexSettings", ".", "developerMode", ")", "{", "throw", "DtUtil", ".", "createError", "(", "\"service.ControllerExtension#add\"", ",", "\"code extensions can only be created in developer mode\"", ",", "\"sap.ui.rta\"", ")", ";", "}", "if", "(", "!", "sCodeRef", ")", "{", "throw", "DtUtil", ".", "createError", "(", "\"service.ControllerExtension#add\"", ",", "\"can't create controller extension without codeRef\"", ",", "\"sap.ui.rta\"", ")", ";", "}", "if", "(", "!", "sCodeRef", ".", "endsWith", "(", "\".js\"", ")", ")", "{", "throw", "DtUtil", ".", "createError", "(", "\"service.ControllerExtension#add\"", ",", "\"codeRef has to end with 'js'\"", ")", ";", "}", "var", "oFlexController", "=", "oRta", ".", "_getFlexController", "(", ")", ";", "var", "oView", "=", "sap", ".", "ui", ".", "getCore", "(", ")", ".", "byId", "(", "sViewId", ")", ";", "var", "oAppComponent", "=", "FlexUtils", ".", "getAppComponentForControl", "(", "oView", ")", ";", "var", "sControllerName", "=", "oView", ".", "getControllerName", "&&", "oView", ".", "getControllerName", "(", ")", "||", "oView", ".", "getController", "(", ")", "&&", "oView", ".", "getController", "(", ")", ".", "getMetadata", "(", ")", ".", "getName", "(", ")", ";", "var", "oChangeSpecificData", "=", "{", "content", ":", "{", "codeRef", ":", "sCodeRef", "}", ",", "selector", ":", "{", "controllerName", ":", "sControllerName", "}", ",", "changeType", ":", "\"codeExt\"", ",", "namespace", ":", "oFlexSettings", ".", "namespace", ",", "developerMode", ":", "oFlexSettings", ".", "developerMode", ",", "scenario", ":", "oFlexSettings", ".", "scenario", "}", ";", "var", "oPreparedChange", "=", "oFlexController", ".", "createBaseChange", "(", "oChangeSpecificData", ",", "oAppComponent", ")", ";", "oFlexController", ".", "addPreparedChange", "(", "oPreparedChange", ",", "oAppComponent", ")", ";", "return", "oPreparedChange", ".", "getDefinition", "(", ")", ";", "}" ]
Creates a change that adds an extension to the controller associated with the given view. Throws an error if the information is not complete. As of now, this only creates the change with a reference to a file. The consumer has to take care of creating that file and adding it to the backend. @method sap.ui.rta.service.ControllerExtension.add @param {object} sCodeRef Name of the file, without path, with the extension '.js'. Must comply to UI5 module naming convention. Has to be unique and must not conflict with other already defined modules. @param {string} sViewId ID of the view whose controller should be extended @return {object} Returns the definition of the newly created change @public
[ "Creates", "a", "change", "that", "adds", "an", "extension", "to", "the", "controller", "associated", "with", "the", "given", "view", ".", "Throws", "an", "error", "if", "the", "information", "is", "not", "complete", ".", "As", "of", "now", "this", "only", "creates", "the", "change", "with", "a", "reference", "to", "a", "file", ".", "The", "consumer", "has", "to", "take", "care", "of", "creating", "that", "file", "and", "adding", "it", "to", "the", "backend", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.rta/src/sap/ui/rta/service/ControllerExtension.js#L69-L104
3,817
SAP/openui5
src/sap.ui.rta/src/sap/ui/rta/service/ControllerExtension.js
function(sViewId) { var oViewOverlay = OverlayRegistry.getOverlay(sViewId); if (!oViewOverlay) { throw DtUtil.createError("service.ControllerExtension#getTemplate", "no overlay found for the given view ID", "sap.ui.rta"); } var sControllerExtensionTemplatePath = oViewOverlay.getDesignTimeMetadata().getControllerExtensionTemplate(); return makeAjaxCall(sControllerExtensionTemplatePath + "-dbg") .catch(function() { return makeAjaxCall(sControllerExtensionTemplatePath); }); }
javascript
function(sViewId) { var oViewOverlay = OverlayRegistry.getOverlay(sViewId); if (!oViewOverlay) { throw DtUtil.createError("service.ControllerExtension#getTemplate", "no overlay found for the given view ID", "sap.ui.rta"); } var sControllerExtensionTemplatePath = oViewOverlay.getDesignTimeMetadata().getControllerExtensionTemplate(); return makeAjaxCall(sControllerExtensionTemplatePath + "-dbg") .catch(function() { return makeAjaxCall(sControllerExtensionTemplatePath); }); }
[ "function", "(", "sViewId", ")", "{", "var", "oViewOverlay", "=", "OverlayRegistry", ".", "getOverlay", "(", "sViewId", ")", ";", "if", "(", "!", "oViewOverlay", ")", "{", "throw", "DtUtil", ".", "createError", "(", "\"service.ControllerExtension#getTemplate\"", ",", "\"no overlay found for the given view ID\"", ",", "\"sap.ui.rta\"", ")", ";", "}", "var", "sControllerExtensionTemplatePath", "=", "oViewOverlay", ".", "getDesignTimeMetadata", "(", ")", ".", "getControllerExtensionTemplate", "(", ")", ";", "return", "makeAjaxCall", "(", "sControllerExtensionTemplatePath", "+", "\"-dbg\"", ")", ".", "catch", "(", "function", "(", ")", "{", "return", "makeAjaxCall", "(", "sControllerExtensionTemplatePath", ")", ";", "}", ")", ";", "}" ]
Gets the Controller Extension template from the DesignTimeMetadata of the given view and returns it as a string wrapped in a promise. If there is no template specified, a default template will be returned. @method sap.ui.rta.service.ControllerExtension.getTemplate @param {string} sViewId ID of the view whose template should be retrieved @return {Promise} Returns a promise that resolves with the template as string or rejects when the file was not found @public
[ "Gets", "the", "Controller", "Extension", "template", "from", "the", "DesignTimeMetadata", "of", "the", "given", "view", "and", "returns", "it", "as", "a", "string", "wrapped", "in", "a", "promise", ".", "If", "there", "is", "no", "template", "specified", "a", "default", "template", "will", "be", "returned", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.rta/src/sap/ui/rta/service/ControllerExtension.js#L115-L126
3,818
SAP/openui5
src/sap.ui.core/src/sap/ui/dom/jquery/Focusable.js
findFocusableDomRef
function findFocusableDomRef(oContainer, bForward) { var oChild = bForward ? oContainer.firstChild : oContainer.lastChild, oFocusableDescendant; while (oChild) { if ( oChild.nodeType == 1 && !isHidden(oChild) ) { if ( jQuery(oChild).hasTabIndex() ) { return oChild; } oFocusableDescendant = findFocusableDomRef(oChild, bForward); if (oFocusableDescendant) { return oFocusableDescendant; } } oChild = bForward ? oChild.nextSibling : oChild.previousSibling; } return null; }
javascript
function findFocusableDomRef(oContainer, bForward) { var oChild = bForward ? oContainer.firstChild : oContainer.lastChild, oFocusableDescendant; while (oChild) { if ( oChild.nodeType == 1 && !isHidden(oChild) ) { if ( jQuery(oChild).hasTabIndex() ) { return oChild; } oFocusableDescendant = findFocusableDomRef(oChild, bForward); if (oFocusableDescendant) { return oFocusableDescendant; } } oChild = bForward ? oChild.nextSibling : oChild.previousSibling; } return null; }
[ "function", "findFocusableDomRef", "(", "oContainer", ",", "bForward", ")", "{", "var", "oChild", "=", "bForward", "?", "oContainer", ".", "firstChild", ":", "oContainer", ".", "lastChild", ",", "oFocusableDescendant", ";", "while", "(", "oChild", ")", "{", "if", "(", "oChild", ".", "nodeType", "==", "1", "&&", "!", "isHidden", "(", "oChild", ")", ")", "{", "if", "(", "jQuery", "(", "oChild", ")", ".", "hasTabIndex", "(", ")", ")", "{", "return", "oChild", ";", "}", "oFocusableDescendant", "=", "findFocusableDomRef", "(", "oChild", ",", "bForward", ")", ";", "if", "(", "oFocusableDescendant", ")", "{", "return", "oFocusableDescendant", ";", "}", "}", "oChild", "=", "bForward", "?", "oChild", ".", "nextSibling", ":", "oChild", ".", "previousSibling", ";", "}", "return", "null", ";", "}" ]
Searches for a descendant of the given node that is an Element and focusable and visible. The search is executed 'depth first'. @param {Node} oContainer Node to search for a focusable descendant @param {boolean} bForward Whether to search forward (true) or backwards (false) @returns {Element} Element node that is focusable and visible or null @private
[ "Searches", "for", "a", "descendant", "of", "the", "given", "node", "that", "is", "an", "Element", "and", "focusable", "and", "visible", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/dom/jquery/Focusable.js#L49-L74
3,819
SAP/openui5
src/sap.ui.fl/src/sap/ui/fl/FakeLrepConnector.js
handleGetTransports
function handleGetTransports(sUri, sMethod, oData, mOptions, resolve, reject){ if (sUri.match(/^\/sap\/bc\/lrep\/actions\/gettransports\//)){ resolve({ response: { "transports": [ { "transportId": "U31K008488", "description": "The Ultimate Transport", "owner": "Fantasy Owner", "locked": true } ], "localonly": false, "errorCode": "" } }); } }
javascript
function handleGetTransports(sUri, sMethod, oData, mOptions, resolve, reject){ if (sUri.match(/^\/sap\/bc\/lrep\/actions\/gettransports\//)){ resolve({ response: { "transports": [ { "transportId": "U31K008488", "description": "The Ultimate Transport", "owner": "Fantasy Owner", "locked": true } ], "localonly": false, "errorCode": "" } }); } }
[ "function", "handleGetTransports", "(", "sUri", ",", "sMethod", ",", "oData", ",", "mOptions", ",", "resolve", ",", "reject", ")", "{", "if", "(", "sUri", ".", "match", "(", "/", "^\\/sap\\/bc\\/lrep\\/actions\\/gettransports\\/", "/", ")", ")", "{", "resolve", "(", "{", "response", ":", "{", "\"transports\"", ":", "[", "{", "\"transportId\"", ":", "\"U31K008488\"", ",", "\"description\"", ":", "\"The Ultimate Transport\"", ",", "\"owner\"", ":", "\"Fantasy Owner\"", ",", "\"locked\"", ":", "true", "}", "]", ",", "\"localonly\"", ":", "false", ",", "\"errorCode\"", ":", "\"\"", "}", "}", ")", ";", "}", "}" ]
REVISE Make response configurable
[ "REVISE", "Make", "response", "configurable" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.fl/src/sap/ui/fl/FakeLrepConnector.js#L216-L233
3,820
SAP/openui5
src/sap.ui.fl/src/sap/ui/fl/context/ContextManager.js
function (oChange, aActiveContexts) { var sChangeContext = oChange.context || ""; if (!sChangeContext) { // change is free of context (always applied) return true; } return aActiveContexts && aActiveContexts.indexOf(sChangeContext) !== -1; }
javascript
function (oChange, aActiveContexts) { var sChangeContext = oChange.context || ""; if (!sChangeContext) { // change is free of context (always applied) return true; } return aActiveContexts && aActiveContexts.indexOf(sChangeContext) !== -1; }
[ "function", "(", "oChange", ",", "aActiveContexts", ")", "{", "var", "sChangeContext", "=", "oChange", ".", "context", "||", "\"\"", ";", "if", "(", "!", "sChangeContext", ")", "{", "// change is free of context (always applied)", "return", "true", ";", "}", "return", "aActiveContexts", "&&", "aActiveContexts", ".", "indexOf", "(", "sChangeContext", ")", "!==", "-", "1", ";", "}" ]
Helper to check if a passed change is free of contexts or in a matching context. @param {sap.ui.fl.Change} oChange - change object which has to be filtered @param {sap.ui.fl.Context[]} aActiveContexts - active runtime or designtime context @returns {boolean} is change context free or has a valid context
[ "Helper", "to", "check", "if", "a", "passed", "change", "is", "free", "of", "contexts", "or", "in", "a", "matching", "context", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.fl/src/sap/ui/fl/context/ContextManager.js#L41-L50
3,821
SAP/openui5
src/sap.ui.fl/src/sap/ui/fl/context/ContextManager.js
function (aContextObjects) { var aDesignTimeContextIdsByUrl = this._getContextIdsFromUrl(); if (aDesignTimeContextIdsByUrl.length === 0) { // [default: runtime] use runtime contexts return this._getContextParametersFromAPI(aContextObjects) .then(this._getActiveContextsByAPIParameters.bind(this, aContextObjects)); } else { // [designtime] use url parameters to determine the current active context(s) return Promise.resolve(this._getActiveContextsByUrlParameters(aContextObjects, aDesignTimeContextIdsByUrl)); } }
javascript
function (aContextObjects) { var aDesignTimeContextIdsByUrl = this._getContextIdsFromUrl(); if (aDesignTimeContextIdsByUrl.length === 0) { // [default: runtime] use runtime contexts return this._getContextParametersFromAPI(aContextObjects) .then(this._getActiveContextsByAPIParameters.bind(this, aContextObjects)); } else { // [designtime] use url parameters to determine the current active context(s) return Promise.resolve(this._getActiveContextsByUrlParameters(aContextObjects, aDesignTimeContextIdsByUrl)); } }
[ "function", "(", "aContextObjects", ")", "{", "var", "aDesignTimeContextIdsByUrl", "=", "this", ".", "_getContextIdsFromUrl", "(", ")", ";", "if", "(", "aDesignTimeContextIdsByUrl", ".", "length", "===", "0", ")", "{", "// [default: runtime] use runtime contexts", "return", "this", ".", "_getContextParametersFromAPI", "(", "aContextObjects", ")", ".", "then", "(", "this", ".", "_getActiveContextsByAPIParameters", ".", "bind", "(", "this", ",", "aContextObjects", ")", ")", ";", "}", "else", "{", "// [designtime] use url parameters to determine the current active context(s)", "return", "Promise", ".", "resolve", "(", "this", ".", "_getActiveContextsByUrlParameters", "(", "aContextObjects", ",", "aDesignTimeContextIdsByUrl", ")", ")", ";", "}", "}" ]
Helper to filter passed context objects. This method loops over each context object and check for its current validity @param {sap.ui.fl.Context[]} aContextObjects - context objects within the application @returns {Promise|string[]} aActiveContexts - Promise returning or direct build array containing ids of context objects
[ "Helper", "to", "filter", "passed", "context", "objects", ".", "This", "method", "loops", "over", "each", "context", "object", "and", "check", "for", "its", "current", "validity" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.fl/src/sap/ui/fl/context/ContextManager.js#L59-L70
3,822
SAP/openui5
src/sap.ui.fl/src/sap/ui/fl/context/ContextManager.js
function (aContextObjects) { var aRequiredContextParameters = []; aContextObjects.forEach(function (oContext) { oContext.parameters.forEach(function (oContextParameter) { var sSelector = oContextParameter.selector; if (aRequiredContextParameters.indexOf(sSelector) === -1) { aRequiredContextParameters.push(sSelector); } }); }); return this._oContext.getValue(aRequiredContextParameters); }
javascript
function (aContextObjects) { var aRequiredContextParameters = []; aContextObjects.forEach(function (oContext) { oContext.parameters.forEach(function (oContextParameter) { var sSelector = oContextParameter.selector; if (aRequiredContextParameters.indexOf(sSelector) === -1) { aRequiredContextParameters.push(sSelector); } }); }); return this._oContext.getValue(aRequiredContextParameters); }
[ "function", "(", "aContextObjects", ")", "{", "var", "aRequiredContextParameters", "=", "[", "]", ";", "aContextObjects", ".", "forEach", "(", "function", "(", "oContext", ")", "{", "oContext", ".", "parameters", ".", "forEach", "(", "function", "(", "oContextParameter", ")", "{", "var", "sSelector", "=", "oContextParameter", ".", "selector", ";", "if", "(", "aRequiredContextParameters", ".", "indexOf", "(", "sSelector", ")", "===", "-", "1", ")", "{", "aRequiredContextParameters", ".", "push", "(", "sSelector", ")", ";", "}", "}", ")", ";", "}", ")", ";", "return", "this", ".", "_oContext", ".", "getValue", "(", "aRequiredContextParameters", ")", ";", "}" ]
Helper to retreive the context parameters from the instanciated context api @param {sap.ui.fl.Context[]} aContextObjects - context objects within the application @returns {Promise} aRuntimeContextParameters - Promise resolving with a map of context keys and their current values
[ "Helper", "to", "retreive", "the", "context", "parameters", "from", "the", "instanciated", "context", "api" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.fl/src/sap/ui/fl/context/ContextManager.js#L78-L91
3,823
SAP/openui5
src/sap.ui.fl/src/sap/ui/fl/context/ContextManager.js
function (aContextObjects, aRuntimeContextParameters) { var that = this; var aActiveContexts = []; aContextObjects.forEach(function (oContext) { if (that._isContextObjectActive(oContext, aRuntimeContextParameters)) { aActiveContexts.push(oContext.id); } }); return aActiveContexts; }
javascript
function (aContextObjects, aRuntimeContextParameters) { var that = this; var aActiveContexts = []; aContextObjects.forEach(function (oContext) { if (that._isContextObjectActive(oContext, aRuntimeContextParameters)) { aActiveContexts.push(oContext.id); } }); return aActiveContexts; }
[ "function", "(", "aContextObjects", ",", "aRuntimeContextParameters", ")", "{", "var", "that", "=", "this", ";", "var", "aActiveContexts", "=", "[", "]", ";", "aContextObjects", ".", "forEach", "(", "function", "(", "oContext", ")", "{", "if", "(", "that", ".", "_isContextObjectActive", "(", "oContext", ",", "aRuntimeContextParameters", ")", ")", "{", "aActiveContexts", ".", "push", "(", "oContext", ".", "id", ")", ";", "}", "}", ")", ";", "return", "aActiveContexts", ";", "}" ]
Function to filter all contexts by the passed runtime context parameters. @param {object[]} aContextObjects - context objects within the application @param {object} aRuntimeContextParameters - map of context keys and their current values @returns {string[]} aActiveContexts - id list of all active contexts
[ "Function", "to", "filter", "all", "contexts", "by", "the", "passed", "runtime", "context", "parameters", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.fl/src/sap/ui/fl/context/ContextManager.js#L100-L111
3,824
SAP/openui5
src/sap.ui.fl/src/sap/ui/fl/context/ContextManager.js
function(aContextObjects, aDesignTimeContextIdsByUrl) { var aActiveContexts = []; aContextObjects.forEach(function (oContext) { var bContextActive = ((aDesignTimeContextIdsByUrl ? Array.prototype.indexOf.call(aDesignTimeContextIdsByUrl, oContext.id) : -1)) !== -1; if (bContextActive) { aActiveContexts.push(oContext.id); } }); return aActiveContexts; }
javascript
function(aContextObjects, aDesignTimeContextIdsByUrl) { var aActiveContexts = []; aContextObjects.forEach(function (oContext) { var bContextActive = ((aDesignTimeContextIdsByUrl ? Array.prototype.indexOf.call(aDesignTimeContextIdsByUrl, oContext.id) : -1)) !== -1; if (bContextActive) { aActiveContexts.push(oContext.id); } }); return aActiveContexts; }
[ "function", "(", "aContextObjects", ",", "aDesignTimeContextIdsByUrl", ")", "{", "var", "aActiveContexts", "=", "[", "]", ";", "aContextObjects", ".", "forEach", "(", "function", "(", "oContext", ")", "{", "var", "bContextActive", "=", "(", "(", "aDesignTimeContextIdsByUrl", "?", "Array", ".", "prototype", ".", "indexOf", ".", "call", "(", "aDesignTimeContextIdsByUrl", ",", "oContext", ".", "id", ")", ":", "-", "1", ")", ")", "!==", "-", "1", ";", "if", "(", "bContextActive", ")", "{", "aActiveContexts", ".", "push", "(", "oContext", ".", "id", ")", ";", "}", "}", ")", ";", "return", "aActiveContexts", ";", "}" ]
Function to filter all contexts by the context URL parameters. @param {string[]} aDesignTimeContextIdsByUrl - list of ids passed via URL @param {object[]} aContextObjects - context objects within the application @returns {string[]} aActiveContexts - id list of all active contexts
[ "Function", "to", "filter", "all", "contexts", "by", "the", "context", "URL", "parameters", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.fl/src/sap/ui/fl/context/ContextManager.js#L120-L132
3,825
SAP/openui5
src/sap.ui.fl/src/sap/ui/fl/context/ContextManager.js
function(oContext, aRuntimeContextParameters) { var that = this; var bContextActive = true; var aParameterOfContext = oContext.parameters; aParameterOfContext.every(function (oParameter) { bContextActive = bContextActive && that._checkContextParameter(oParameter, aRuntimeContextParameters); return bContextActive; // breaks loop on false }); return bContextActive; }
javascript
function(oContext, aRuntimeContextParameters) { var that = this; var bContextActive = true; var aParameterOfContext = oContext.parameters; aParameterOfContext.every(function (oParameter) { bContextActive = bContextActive && that._checkContextParameter(oParameter, aRuntimeContextParameters); return bContextActive; // breaks loop on false }); return bContextActive; }
[ "function", "(", "oContext", ",", "aRuntimeContextParameters", ")", "{", "var", "that", "=", "this", ";", "var", "bContextActive", "=", "true", ";", "var", "aParameterOfContext", "=", "oContext", ".", "parameters", ";", "aParameterOfContext", ".", "every", "(", "function", "(", "oParameter", ")", "{", "bContextActive", "=", "bContextActive", "&&", "that", ".", "_checkContextParameter", "(", "oParameter", ",", "aRuntimeContextParameters", ")", ";", "return", "bContextActive", ";", "// breaks loop on false", "}", ")", ";", "return", "bContextActive", ";", "}" ]
Helper to filter passed context object. If a passed context is not within the context objects of the given application the context is filtered. The filtering is done [At runtime] by comparing the parameters of the context objects with the actual runtime context. [At designtime] by comparing the id of the context objects with the set url parameter "sap-ui-designTimeContexts" @param {object} oContext - context object to be validated @param {object[]} aRuntimeContextParameters - context parameter returned form the context providers @returns {boolean} bContextActive - determines if the passed context matches the context of the current environment @private
[ "Helper", "to", "filter", "passed", "context", "object", ".", "If", "a", "passed", "context", "is", "not", "within", "the", "context", "objects", "of", "the", "given", "application", "the", "context", "is", "filtered", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.fl/src/sap/ui/fl/context/ContextManager.js#L147-L158
3,826
SAP/openui5
src/sap.ui.fl/src/sap/ui/fl/context/ContextManager.js
function (oParameter, aRuntimeContext) { var sSelector = oParameter.selector; var sOperator = oParameter.operator; var oValue = oParameter.value; switch (sOperator) { case "EQ": return this._checkEquals(sSelector, oValue, aRuntimeContext); case "NE": return !this._checkEquals(sSelector, oValue, aRuntimeContext); default: Log.info("A context within a flexibility change with the operator '" + sOperator + "' could not be verified"); return false; } }
javascript
function (oParameter, aRuntimeContext) { var sSelector = oParameter.selector; var sOperator = oParameter.operator; var oValue = oParameter.value; switch (sOperator) { case "EQ": return this._checkEquals(sSelector, oValue, aRuntimeContext); case "NE": return !this._checkEquals(sSelector, oValue, aRuntimeContext); default: Log.info("A context within a flexibility change with the operator '" + sOperator + "' could not be verified"); return false; } }
[ "function", "(", "oParameter", ",", "aRuntimeContext", ")", "{", "var", "sSelector", "=", "oParameter", ".", "selector", ";", "var", "sOperator", "=", "oParameter", ".", "operator", ";", "var", "oValue", "=", "oParameter", ".", "value", ";", "switch", "(", "sOperator", ")", "{", "case", "\"EQ\"", ":", "return", "this", ".", "_checkEquals", "(", "sSelector", ",", "oValue", ",", "aRuntimeContext", ")", ";", "case", "\"NE\"", ":", "return", "!", "this", ".", "_checkEquals", "(", "sSelector", ",", "oValue", ",", "aRuntimeContext", ")", ";", "default", ":", "Log", ".", "info", "(", "\"A context within a flexibility change with the operator '\"", "+", "sOperator", "+", "\"' could not be verified\"", ")", ";", "return", "false", ";", "}", "}" ]
Checks a single condition of a context object. Returns true if the condition matches the current runtime context. @param {Object} oParameter - context within an sap.ui.fl.Change @param {string} oParameter.selector - key of a runtime context @param {string} oParameter.operator - determine which comparison has to be executed @param {string} oParameter.value - value which has to be matched within the key @param {Object} aRuntimeContext - key value pairs of the current runtime context @returns {boolean} bContextValid - context of the changes matches @private
[ "Checks", "a", "single", "condition", "of", "a", "context", "object", ".", "Returns", "true", "if", "the", "condition", "matches", "the", "current", "runtime", "context", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.fl/src/sap/ui/fl/context/ContextManager.js#L187-L201
3,827
SAP/openui5
src/sap.ui.support/src/sap/ui/support/supportRules/ExecutionScope.js
function () { var aPublicElements = []; var mComponents = core.mObjects.component; var mUIAreas = core.mUIAreas; for (var i in mComponents) { aPublicElements = aPublicElements.concat( getPublicElementsInside(mComponents[i]) ); } for (var key in mUIAreas) { aPublicElements = aPublicElements.concat( getPublicElementsInside(mUIAreas[key]) ); } return aPublicElements; }
javascript
function () { var aPublicElements = []; var mComponents = core.mObjects.component; var mUIAreas = core.mUIAreas; for (var i in mComponents) { aPublicElements = aPublicElements.concat( getPublicElementsInside(mComponents[i]) ); } for (var key in mUIAreas) { aPublicElements = aPublicElements.concat( getPublicElementsInside(mUIAreas[key]) ); } return aPublicElements; }
[ "function", "(", ")", "{", "var", "aPublicElements", "=", "[", "]", ";", "var", "mComponents", "=", "core", ".", "mObjects", ".", "component", ";", "var", "mUIAreas", "=", "core", ".", "mUIAreas", ";", "for", "(", "var", "i", "in", "mComponents", ")", "{", "aPublicElements", "=", "aPublicElements", ".", "concat", "(", "getPublicElementsInside", "(", "mComponents", "[", "i", "]", ")", ")", ";", "}", "for", "(", "var", "key", "in", "mUIAreas", ")", "{", "aPublicElements", "=", "aPublicElements", ".", "concat", "(", "getPublicElementsInside", "(", "mUIAreas", "[", "key", "]", ")", ")", ";", "}", "return", "aPublicElements", ";", "}" ]
Returns all public elements, i.e. elements that are part of public API aggregations @public @function @returns {Array} Array of matched elements @alias sap.ui.support.ExecutionScope.getPublicElements
[ "Returns", "all", "public", "elements", "i", ".", "e", ".", "elements", "that", "are", "part", "of", "public", "API", "aggregations" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.support/src/sap/ui/support/supportRules/ExecutionScope.js#L249-L267
3,828
SAP/openui5
src/sap.ui.support/src/sap/ui/support/supportRules/ExecutionScope.js
function (classNameSelector) { if (typeof classNameSelector === "string") { return elements.filter(function (element) { return element.getMetadata().getName() === classNameSelector; }); } if (typeof classNameSelector === "function") { return elements.filter(function (element) { return element instanceof classNameSelector; }); } }
javascript
function (classNameSelector) { if (typeof classNameSelector === "string") { return elements.filter(function (element) { return element.getMetadata().getName() === classNameSelector; }); } if (typeof classNameSelector === "function") { return elements.filter(function (element) { return element instanceof classNameSelector; }); } }
[ "function", "(", "classNameSelector", ")", "{", "if", "(", "typeof", "classNameSelector", "===", "\"string\"", ")", "{", "return", "elements", ".", "filter", "(", "function", "(", "element", ")", "{", "return", "element", ".", "getMetadata", "(", ")", ".", "getName", "(", ")", "===", "classNameSelector", ";", "}", ")", ";", "}", "if", "(", "typeof", "classNameSelector", "===", "\"function\"", ")", "{", "return", "elements", ".", "filter", "(", "function", "(", "element", ")", "{", "return", "element", "instanceof", "classNameSelector", ";", "}", ")", ";", "}", "}" ]
Gets elements by their type @public @function @param {string|function} classNameSelector Either string or function to be used when selecting a subset of elements @returns {Array} Array of matched elements @alias sap.ui.support.ExecutionScope.getElementsByClassName
[ "Gets", "elements", "by", "their", "type" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.support/src/sap/ui/support/supportRules/ExecutionScope.js#L277-L289
3,829
SAP/openui5
src/sap.ui.support/src/sap/ui/support/supportRules/ExecutionScope.js
function (type) { var log = jQuery.sap.log.getLogEntries(), loggedObjects = [], elemIds; // Add logEntries that have support info object, // and that have the same type as the type provided log.forEach(function (logEntry) { if (!logEntry.supportInfo) { return; } if (!elemIds){ elemIds = elements.map(function (element) { return element.getId(); }); } var hasElemId = !!logEntry.supportInfo.elementId, typeMatch = logEntry.supportInfo.type === type || type === undefined, scopeMatch = !hasElemId || jQuery.inArray(logEntry.supportInfo.elementId, elemIds) > -1; /** * Give the developer the ability to pass filtering function */ if (typeof type === "function" && type(logEntry) && scopeMatch) { loggedObjects.push(logEntry); return; } if (typeMatch && scopeMatch) { loggedObjects.push(logEntry); } }); return loggedObjects; }
javascript
function (type) { var log = jQuery.sap.log.getLogEntries(), loggedObjects = [], elemIds; // Add logEntries that have support info object, // and that have the same type as the type provided log.forEach(function (logEntry) { if (!logEntry.supportInfo) { return; } if (!elemIds){ elemIds = elements.map(function (element) { return element.getId(); }); } var hasElemId = !!logEntry.supportInfo.elementId, typeMatch = logEntry.supportInfo.type === type || type === undefined, scopeMatch = !hasElemId || jQuery.inArray(logEntry.supportInfo.elementId, elemIds) > -1; /** * Give the developer the ability to pass filtering function */ if (typeof type === "function" && type(logEntry) && scopeMatch) { loggedObjects.push(logEntry); return; } if (typeMatch && scopeMatch) { loggedObjects.push(logEntry); } }); return loggedObjects; }
[ "function", "(", "type", ")", "{", "var", "log", "=", "jQuery", ".", "sap", ".", "log", ".", "getLogEntries", "(", ")", ",", "loggedObjects", "=", "[", "]", ",", "elemIds", ";", "// Add logEntries that have support info object,", "// and that have the same type as the type provided", "log", ".", "forEach", "(", "function", "(", "logEntry", ")", "{", "if", "(", "!", "logEntry", ".", "supportInfo", ")", "{", "return", ";", "}", "if", "(", "!", "elemIds", ")", "{", "elemIds", "=", "elements", ".", "map", "(", "function", "(", "element", ")", "{", "return", "element", ".", "getId", "(", ")", ";", "}", ")", ";", "}", "var", "hasElemId", "=", "!", "!", "logEntry", ".", "supportInfo", ".", "elementId", ",", "typeMatch", "=", "logEntry", ".", "supportInfo", ".", "type", "===", "type", "||", "type", "===", "undefined", ",", "scopeMatch", "=", "!", "hasElemId", "||", "jQuery", ".", "inArray", "(", "logEntry", ".", "supportInfo", ".", "elementId", ",", "elemIds", ")", ">", "-", "1", ";", "/**\n\t\t\t\t\t\t * Give the developer the ability to pass filtering function\n\t\t\t\t\t\t */", "if", "(", "typeof", "type", "===", "\"function\"", "&&", "type", "(", "logEntry", ")", "&&", "scopeMatch", ")", "{", "loggedObjects", ".", "push", "(", "logEntry", ")", ";", "return", ";", "}", "if", "(", "typeMatch", "&&", "scopeMatch", ")", "{", "loggedObjects", ".", "push", "(", "logEntry", ")", ";", "}", "}", ")", ";", "return", "loggedObjects", ";", "}" ]
Gets the logged objects by object type @public @function @param {any} type Type of logged objects @returns {Array} Array of logged objects @alias sap.ui.support.ExecutionScope.getLoggedObjects
[ "Gets", "the", "logged", "objects", "by", "object", "type" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.support/src/sap/ui/support/supportRules/ExecutionScope.js#L298-L336
3,830
SAP/openui5
src/sap.ui.unified/src/sap/ui/unified/calendar/CalendarDate.js
createUniversalUTCDate
function createUniversalUTCDate(oDate, sCalendarType) { if (sCalendarType) { return UniversalDate.getInstance(createUTCDate(oDate), sCalendarType); } else { return new UniversalDate(createUTCDate(oDate).getTime()); } }
javascript
function createUniversalUTCDate(oDate, sCalendarType) { if (sCalendarType) { return UniversalDate.getInstance(createUTCDate(oDate), sCalendarType); } else { return new UniversalDate(createUTCDate(oDate).getTime()); } }
[ "function", "createUniversalUTCDate", "(", "oDate", ",", "sCalendarType", ")", "{", "if", "(", "sCalendarType", ")", "{", "return", "UniversalDate", ".", "getInstance", "(", "createUTCDate", "(", "oDate", ")", ",", "sCalendarType", ")", ";", "}", "else", "{", "return", "new", "UniversalDate", "(", "createUTCDate", "(", "oDate", ")", ".", "getTime", "(", ")", ")", ";", "}", "}" ]
Creates an UniversalDate corresponding to the given date and calendar type. @param {Date} oDate JavaScript date object to create the UniversalDate from. Local date information is used. @param {sap.ui.core.CalendarType} sCalendarType The type to be used. If not specified, the calendar type from configuration will be used. For more details on the Configuration, please check sap.ui.core.Configuration#getCalendarType @returns {sap.ui.core.date.UniversalDate} The created date
[ "Creates", "an", "UniversalDate", "corresponding", "to", "the", "given", "date", "and", "calendar", "type", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.unified/src/sap/ui/unified/calendar/CalendarDate.js#L328-L334
3,831
SAP/openui5
src/sap.ui.unified/src/sap/ui/unified/calendar/CalendarDate.js
createUTCDate
function createUTCDate(oDate) { var oUTCDate = new Date(Date.UTC(0, 0, 1)); oUTCDate.setUTCFullYear(oDate.getFullYear(), oDate.getMonth(), oDate.getDate()); return oUTCDate; }
javascript
function createUTCDate(oDate) { var oUTCDate = new Date(Date.UTC(0, 0, 1)); oUTCDate.setUTCFullYear(oDate.getFullYear(), oDate.getMonth(), oDate.getDate()); return oUTCDate; }
[ "function", "createUTCDate", "(", "oDate", ")", "{", "var", "oUTCDate", "=", "new", "Date", "(", "Date", ".", "UTC", "(", "0", ",", "0", ",", "1", ")", ")", ";", "oUTCDate", ".", "setUTCFullYear", "(", "oDate", ".", "getFullYear", "(", ")", ",", "oDate", ".", "getMonth", "(", ")", ",", "oDate", ".", "getDate", "(", ")", ")", ";", "return", "oUTCDate", ";", "}" ]
Creates a JavaScript UTC Date corresponding to the given JavaScript Date. @param {Date} oDate JavaScript date object. Time related information is cut. @returns {Date} JavaScript date created from the date object, but this time considered as UTC date information.
[ "Creates", "a", "JavaScript", "UTC", "Date", "corresponding", "to", "the", "given", "JavaScript", "Date", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.unified/src/sap/ui/unified/calendar/CalendarDate.js#L341-L347
3,832
SAP/openui5
src/sap.ui.unified/src/sap/ui/unified/calendar/CalendarDate.js
checkNumericLike
function checkNumericLike(value, message) { if (value == undefined || value === Infinity || isNaN(value)) {//checks also for null. throw message; } }
javascript
function checkNumericLike(value, message) { if (value == undefined || value === Infinity || isNaN(value)) {//checks also for null. throw message; } }
[ "function", "checkNumericLike", "(", "value", ",", "message", ")", "{", "if", "(", "value", "==", "undefined", "||", "value", "===", "Infinity", "||", "isNaN", "(", "value", ")", ")", "{", "//checks also for null.", "throw", "message", ";", "}", "}" ]
Verifies the given value is numeric like, i.e. 3, "3" and throws an error if it is not. @param {any} value The value of any type to check. If null or undefined, this method throws an error. @param {string} message The message to be used if an error is to be thrown @throws will throw an error if the value is null or undefined or is not like a number
[ "Verifies", "the", "given", "value", "is", "numeric", "like", "i", ".", "e", ".", "3", "3", "and", "throws", "an", "error", "if", "it", "is", "not", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.unified/src/sap/ui/unified/calendar/CalendarDate.js#L361-L365
3,833
SAP/openui5
src/sap.ui.documentation/src/sap/ui/documentation/sdk/controller/util/XML2JSONUtils.js
function(element) { var links = element.querySelectorAll("a.xref, a.link, area"), i, link, href, startsWithHash, startsWithHTTP; for (i = 0; i < links.length; i++) { link = links[i]; href = link.getAttribute("href"); startsWithHash = href.indexOf("#") == 0; startsWithHTTP = href.indexOf("http") == 0; // absolute links should open in a new window if (startsWithHTTP) { link.setAttribute('target', '_blank'); } // absolute links and links starting with # are ok and should not be modified if (startsWithHTTP || startsWithHash) { continue; } // API reference are recognized by "/docs/api/" string if (href.indexOf("/docs/api/") > -1) { href = href.substr(0, href.lastIndexOf(".html")); href = href.substr(href.lastIndexOf('/') + 1); href = "#/api/" + href; } else if (href.indexOf("explored.html") > -1) { // explored app links have explored.html in them href = href.split("../").join(""); href = oConfig.exploredURI + href; } else { // we assume all other links are links to other documentation pages href = href.substr(0, href.lastIndexOf(".html")); href = "#/topic/" + href; } link.setAttribute("href", href); } }
javascript
function(element) { var links = element.querySelectorAll("a.xref, a.link, area"), i, link, href, startsWithHash, startsWithHTTP; for (i = 0; i < links.length; i++) { link = links[i]; href = link.getAttribute("href"); startsWithHash = href.indexOf("#") == 0; startsWithHTTP = href.indexOf("http") == 0; // absolute links should open in a new window if (startsWithHTTP) { link.setAttribute('target', '_blank'); } // absolute links and links starting with # are ok and should not be modified if (startsWithHTTP || startsWithHash) { continue; } // API reference are recognized by "/docs/api/" string if (href.indexOf("/docs/api/") > -1) { href = href.substr(0, href.lastIndexOf(".html")); href = href.substr(href.lastIndexOf('/') + 1); href = "#/api/" + href; } else if (href.indexOf("explored.html") > -1) { // explored app links have explored.html in them href = href.split("../").join(""); href = oConfig.exploredURI + href; } else { // we assume all other links are links to other documentation pages href = href.substr(0, href.lastIndexOf(".html")); href = "#/topic/" + href; } link.setAttribute("href", href); } }
[ "function", "(", "element", ")", "{", "var", "links", "=", "element", ".", "querySelectorAll", "(", "\"a.xref, a.link, area\"", ")", ",", "i", ",", "link", ",", "href", ",", "startsWithHash", ",", "startsWithHTTP", ";", "for", "(", "i", "=", "0", ";", "i", "<", "links", ".", "length", ";", "i", "++", ")", "{", "link", "=", "links", "[", "i", "]", ";", "href", "=", "link", ".", "getAttribute", "(", "\"href\"", ")", ";", "startsWithHash", "=", "href", ".", "indexOf", "(", "\"#\"", ")", "==", "0", ";", "startsWithHTTP", "=", "href", ".", "indexOf", "(", "\"http\"", ")", "==", "0", ";", "// absolute links should open in a new window", "if", "(", "startsWithHTTP", ")", "{", "link", ".", "setAttribute", "(", "'target'", ",", "'_blank'", ")", ";", "}", "// absolute links and links starting with # are ok and should not be modified", "if", "(", "startsWithHTTP", "||", "startsWithHash", ")", "{", "continue", ";", "}", "// API reference are recognized by \"/docs/api/\" string", "if", "(", "href", ".", "indexOf", "(", "\"/docs/api/\"", ")", ">", "-", "1", ")", "{", "href", "=", "href", ".", "substr", "(", "0", ",", "href", ".", "lastIndexOf", "(", "\".html\"", ")", ")", ";", "href", "=", "href", ".", "substr", "(", "href", ".", "lastIndexOf", "(", "'/'", ")", "+", "1", ")", ";", "href", "=", "\"#/api/\"", "+", "href", ";", "}", "else", "if", "(", "href", ".", "indexOf", "(", "\"explored.html\"", ")", ">", "-", "1", ")", "{", "// explored app links have explored.html in them", "href", "=", "href", ".", "split", "(", "\"../\"", ")", ".", "join", "(", "\"\"", ")", ";", "href", "=", "oConfig", ".", "exploredURI", "+", "href", ";", "}", "else", "{", "// we assume all other links are links to other documentation pages", "href", "=", "href", ".", "substr", "(", "0", ",", "href", ".", "lastIndexOf", "(", "\".html\"", ")", ")", ";", "href", "=", "\"#/topic/\"", "+", "href", ";", "}", "link", ".", "setAttribute", "(", "\"href\"", ",", "href", ")", ";", "}", "}" ]
Adjusts link href values @param element The DOM element which may contain cross reference links
[ "Adjusts", "link", "href", "values" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.documentation/src/sap/ui/documentation/sdk/controller/util/XML2JSONUtils.js#L32-L70
3,834
SAP/openui5
src/sap.ui.documentation/src/sap/ui/documentation/sdk/controller/Welcome.controller.js
function (event) { var href = event.oSource.getHref() || event.oSource.getTarget(); href = href.replace("#/", "").split('/'); /** @type string */ var page = href[0]; /** @type string */ var parameter = href[1]; event.preventDefault(); this.getRouter().navTo(page, {id: parameter}, true); }
javascript
function (event) { var href = event.oSource.getHref() || event.oSource.getTarget(); href = href.replace("#/", "").split('/'); /** @type string */ var page = href[0]; /** @type string */ var parameter = href[1]; event.preventDefault(); this.getRouter().navTo(page, {id: parameter}, true); }
[ "function", "(", "event", ")", "{", "var", "href", "=", "event", ".", "oSource", ".", "getHref", "(", ")", "||", "event", ".", "oSource", ".", "getTarget", "(", ")", ";", "href", "=", "href", ".", "replace", "(", "\"#/\"", ",", "\"\"", ")", ".", "split", "(", "'/'", ")", ";", "/** @type string */", "var", "page", "=", "href", "[", "0", "]", ";", "/** @type string */", "var", "parameter", "=", "href", "[", "1", "]", ";", "event", ".", "preventDefault", "(", ")", ";", "this", ".", "getRouter", "(", ")", ".", "navTo", "(", "page", ",", "{", "id", ":", "parameter", "}", ",", "true", ")", ";", "}" ]
Opens the control's details page @param event
[ "Opens", "the", "control", "s", "details", "page" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.documentation/src/sap/ui/documentation/sdk/controller/Welcome.controller.js#L73-L83
3,835
SAP/openui5
src/sap.ui.documentation/src/sap/ui/documentation/sdk/controller/Welcome.controller.js
function (oEvent) { var isOpenUI5 = this.getView().getModel("welcomeView").getProperty("/isOpenUI5"), sUrl = isOpenUI5 ? "http://openui5.org/download.html" : "https://tools.hana.ondemand.com/#sapui5"; window.open(sUrl, "_blank"); }
javascript
function (oEvent) { var isOpenUI5 = this.getView().getModel("welcomeView").getProperty("/isOpenUI5"), sUrl = isOpenUI5 ? "http://openui5.org/download.html" : "https://tools.hana.ondemand.com/#sapui5"; window.open(sUrl, "_blank"); }
[ "function", "(", "oEvent", ")", "{", "var", "isOpenUI5", "=", "this", ".", "getView", "(", ")", ".", "getModel", "(", "\"welcomeView\"", ")", ".", "getProperty", "(", "\"/isOpenUI5\"", ")", ",", "sUrl", "=", "isOpenUI5", "?", "\"http://openui5.org/download.html\"", ":", "\"https://tools.hana.ondemand.com/#sapui5\"", ";", "window", ".", "open", "(", "sUrl", ",", "\"_blank\"", ")", ";", "}" ]
Redirects to the UI5 download page @param {sap.ui.base.Event} oEvent the Button press event @public
[ "Redirects", "to", "the", "UI5", "download", "page" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.documentation/src/sap/ui/documentation/sdk/controller/Welcome.controller.js#L97-L101
3,836
SAP/openui5
src/sap.ui.core/src/sap/ui/thirdparty/jszip.js
function(size) { var result = 0, i; this.checkOffset(size); for (i = this.index + size - 1; i >= this.index; i--) { result = (result << 8) + this.byteAt(i); } this.index += size; return result; }
javascript
function(size) { var result = 0, i; this.checkOffset(size); for (i = this.index + size - 1; i >= this.index; i--) { result = (result << 8) + this.byteAt(i); } this.index += size; return result; }
[ "function", "(", "size", ")", "{", "var", "result", "=", "0", ",", "i", ";", "this", ".", "checkOffset", "(", "size", ")", ";", "for", "(", "i", "=", "this", ".", "index", "+", "size", "-", "1", ";", "i", ">=", "this", ".", "index", ";", "i", "--", ")", "{", "result", "=", "(", "result", "<<", "8", ")", "+", "this", ".", "byteAt", "(", "i", ")", ";", "}", "this", ".", "index", "+=", "size", ";", "return", "result", ";", "}" ]
Get the next number with a given byte size. @param {number} size the number of bytes to read. @return {number} the corresponding number.
[ "Get", "the", "next", "number", "with", "a", "given", "byte", "size", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/thirdparty/jszip.js#L188-L197
3,837
SAP/openui5
src/sap.ui.core/src/sap/ui/thirdparty/jszip.js
function(asUTF8) { var result = getRawData(this); if (result === null || typeof result === "undefined") { return ""; } // if the data is a base64 string, we decode it before checking the encoding ! if (this.options.base64) { result = base64.decode(result); } if (asUTF8 && this.options.binary) { // JSZip.prototype.utf8decode supports arrays as input // skip to array => string step, utf8decode will do it. result = out.utf8decode(result); } else { // no utf8 transformation, do the array => string step. result = utils.transformTo("string", result); } if (!asUTF8 && !this.options.binary) { result = out.utf8encode(result); } return result; }
javascript
function(asUTF8) { var result = getRawData(this); if (result === null || typeof result === "undefined") { return ""; } // if the data is a base64 string, we decode it before checking the encoding ! if (this.options.base64) { result = base64.decode(result); } if (asUTF8 && this.options.binary) { // JSZip.prototype.utf8decode supports arrays as input // skip to array => string step, utf8decode will do it. result = out.utf8decode(result); } else { // no utf8 transformation, do the array => string step. result = utils.transformTo("string", result); } if (!asUTF8 && !this.options.binary) { result = out.utf8encode(result); } return result; }
[ "function", "(", "asUTF8", ")", "{", "var", "result", "=", "getRawData", "(", "this", ")", ";", "if", "(", "result", "===", "null", "||", "typeof", "result", "===", "\"undefined\"", ")", "{", "return", "\"\"", ";", "}", "// if the data is a base64 string, we decode it before checking the encoding !", "if", "(", "this", ".", "options", ".", "base64", ")", "{", "result", "=", "base64", ".", "decode", "(", "result", ")", ";", "}", "if", "(", "asUTF8", "&&", "this", ".", "options", ".", "binary", ")", "{", "// JSZip.prototype.utf8decode supports arrays as input", "// skip to array => string step, utf8decode will do it.", "result", "=", "out", ".", "utf8decode", "(", "result", ")", ";", "}", "else", "{", "// no utf8 transformation, do the array => string step.", "result", "=", "utils", ".", "transformTo", "(", "\"string\"", ",", "result", ")", ";", "}", "if", "(", "!", "asUTF8", "&&", "!", "this", ".", "options", ".", "binary", ")", "{", "result", "=", "out", ".", "utf8encode", "(", "result", ")", ";", "}", "return", "result", ";", "}" ]
Transform this._data into a string. @param {function} filter a function String -> String, applied if not null on the result. @return {String} the string representing this._data.
[ "Transform", "this", ".", "_data", "into", "a", "string", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/thirdparty/jszip.js#L422-L445
3,838
SAP/openui5
src/sap.ui.core/src/sap/ui/thirdparty/jszip.js
function(dec, bytes) { var hex = "", i; for (i = 0; i < bytes; i++) { hex += String.fromCharCode(dec & 0xff); dec = dec >>> 8; } return hex; }
javascript
function(dec, bytes) { var hex = "", i; for (i = 0; i < bytes; i++) { hex += String.fromCharCode(dec & 0xff); dec = dec >>> 8; } return hex; }
[ "function", "(", "dec", ",", "bytes", ")", "{", "var", "hex", "=", "\"\"", ",", "i", ";", "for", "(", "i", "=", "0", ";", "i", "<", "bytes", ";", "i", "++", ")", "{", "hex", "+=", "String", ".", "fromCharCode", "(", "dec", "&", "0xff", ")", ";", "dec", "=", "dec", ">>>", "8", ";", "}", "return", "hex", ";", "}" ]
Transform an integer into a string in hexadecimal. @private @param {number} dec the number to convert. @param {number} bytes the number of bytes to generate. @returns {string} the result.
[ "Transform", "an", "integer", "into", "a", "string", "in", "hexadecimal", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/thirdparty/jszip.js#L506-L514
3,839
SAP/openui5
src/sap.ui.core/src/sap/ui/thirdparty/jszip.js
function() { var result = {}, i, attr; for (i = 0; i < arguments.length; i++) { // arguments is not enumerable in some browsers for (attr in arguments[i]) { if (arguments[i].hasOwnProperty(attr) && typeof result[attr] === "undefined") { result[attr] = arguments[i][attr]; } } } return result; }
javascript
function() { var result = {}, i, attr; for (i = 0; i < arguments.length; i++) { // arguments is not enumerable in some browsers for (attr in arguments[i]) { if (arguments[i].hasOwnProperty(attr) && typeof result[attr] === "undefined") { result[attr] = arguments[i][attr]; } } } return result; }
[ "function", "(", ")", "{", "var", "result", "=", "{", "}", ",", "i", ",", "attr", ";", "for", "(", "i", "=", "0", ";", "i", "<", "arguments", ".", "length", ";", "i", "++", ")", "{", "// arguments is not enumerable in some browsers", "for", "(", "attr", "in", "arguments", "[", "i", "]", ")", "{", "if", "(", "arguments", "[", "i", "]", ".", "hasOwnProperty", "(", "attr", ")", "&&", "typeof", "result", "[", "attr", "]", "===", "\"undefined\"", ")", "{", "result", "[", "attr", "]", "=", "arguments", "[", "i", "]", "[", "attr", "]", ";", "}", "}", "}", "return", "result", ";", "}" ]
Merge the objects passed as parameters into a new one. @private @param {...Object} var_args All objects to merge. @return {Object} a new object with the data of the others.
[ "Merge", "the", "objects", "passed", "as", "parameters", "into", "a", "new", "one", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/thirdparty/jszip.js#L522-L532
3,840
SAP/openui5
src/sap.ui.core/src/sap/ui/thirdparty/jszip.js
function(path) { if (path.slice(-1) == '/') { path = path.substring(0, path.length - 1); } var lastSlash = path.lastIndexOf('/'); return (lastSlash > 0) ? path.substring(0, lastSlash) : ""; }
javascript
function(path) { if (path.slice(-1) == '/') { path = path.substring(0, path.length - 1); } var lastSlash = path.lastIndexOf('/'); return (lastSlash > 0) ? path.substring(0, lastSlash) : ""; }
[ "function", "(", "path", ")", "{", "if", "(", "path", ".", "slice", "(", "-", "1", ")", "==", "'/'", ")", "{", "path", "=", "path", ".", "substring", "(", "0", ",", "path", ".", "length", "-", "1", ")", ";", "}", "var", "lastSlash", "=", "path", ".", "lastIndexOf", "(", "'/'", ")", ";", "return", "(", "lastSlash", ">", "0", ")", "?", "path", ".", "substring", "(", "0", ",", "lastSlash", ")", ":", "\"\"", ";", "}" ]
Find the parent folder of the path. @private @param {string} path the path to use @return {string} the parent folder, or ""
[ "Find", "the", "parent", "folder", "of", "the", "path", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/thirdparty/jszip.js#L612-L618
3,841
SAP/openui5
src/sap.ui.core/src/sap/ui/thirdparty/jszip.js
function(input) { if (input.length !== 0) { // with an empty Uint8Array, Opera fails with a "Offset larger than array size" input = utils.transformTo("uint8array", input); this.data.set(input, this.index); this.index += input.length; } }
javascript
function(input) { if (input.length !== 0) { // with an empty Uint8Array, Opera fails with a "Offset larger than array size" input = utils.transformTo("uint8array", input); this.data.set(input, this.index); this.index += input.length; } }
[ "function", "(", "input", ")", "{", "if", "(", "input", ".", "length", "!==", "0", ")", "{", "// with an empty Uint8Array, Opera fails with a \"Offset larger than array size\"", "input", "=", "utils", ".", "transformTo", "(", "\"uint8array\"", ",", "input", ")", ";", "this", ".", "data", ".", "set", "(", "input", ",", "this", ".", "index", ")", ";", "this", ".", "index", "+=", "input", ".", "length", ";", "}", "}" ]
Append any content to the current array. @param {Object} input the content to add.
[ "Append", "any", "content", "to", "the", "current", "array", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/thirdparty/jszip.js#L843-L850
3,842
SAP/openui5
src/sap.ui.core/src/sap/ui/thirdparty/jszip.js
function(name, data, o) { if (arguments.length === 1) { if (utils.isRegExp(name)) { var regexp = name; return this.filter(function(relativePath, file) { return !file.options.dir && regexp.test(relativePath); }); } else { // text return this.filter(function(relativePath, file) { return !file.options.dir && relativePath === name; })[0] || null; } } else { // more than one argument : we have data ! name = this.root + name; fileAdd.call(this, name, data, o); } return this; }
javascript
function(name, data, o) { if (arguments.length === 1) { if (utils.isRegExp(name)) { var regexp = name; return this.filter(function(relativePath, file) { return !file.options.dir && regexp.test(relativePath); }); } else { // text return this.filter(function(relativePath, file) { return !file.options.dir && relativePath === name; })[0] || null; } } else { // more than one argument : we have data ! name = this.root + name; fileAdd.call(this, name, data, o); } return this; }
[ "function", "(", "name", ",", "data", ",", "o", ")", "{", "if", "(", "arguments", ".", "length", "===", "1", ")", "{", "if", "(", "utils", ".", "isRegExp", "(", "name", ")", ")", "{", "var", "regexp", "=", "name", ";", "return", "this", ".", "filter", "(", "function", "(", "relativePath", ",", "file", ")", "{", "return", "!", "file", ".", "options", ".", "dir", "&&", "regexp", ".", "test", "(", "relativePath", ")", ";", "}", ")", ";", "}", "else", "{", "// text", "return", "this", ".", "filter", "(", "function", "(", "relativePath", ",", "file", ")", "{", "return", "!", "file", ".", "options", ".", "dir", "&&", "relativePath", "===", "name", ";", "}", ")", "[", "0", "]", "||", "null", ";", "}", "}", "else", "{", "// more than one argument : we have data !", "name", "=", "this", ".", "root", "+", "name", ";", "fileAdd", ".", "call", "(", "this", ",", "name", ",", "data", ",", "o", ")", ";", "}", "return", "this", ";", "}" ]
Add a file to the zip file, or search a file. @param {string|RegExp} name The name of the file to add (if data is defined), the name of the file to find (if no data) or a regex to match files. @param {String|ArrayBuffer|Uint8Array|Buffer} data The file data, either raw or base64 encoded @param {Object} o File options @return {JSZip|Object|Array} this JSZip object (when adding a file), a file (when searching by string) or an array of files (when searching by regex).
[ "Add", "a", "file", "to", "the", "zip", "file", "or", "search", "a", "file", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/thirdparty/jszip.js#L932-L951
3,843
SAP/openui5
src/sap.ui.core/src/sap/ui/thirdparty/jszip.js
function(options) { options = extend(options || {}, { base64: true, compression: "STORE", type: "base64" }); utils.checkSupport(options.type); var zipData = [], localDirLength = 0, centralDirLength = 0, writer, i; // first, generate all the zip parts. for (var name in this.files) { if (!this.files.hasOwnProperty(name)) { continue; } var file = this.files[name]; var compressionName = file.options.compression || options.compression.toUpperCase(); var compression = compressions[compressionName]; if (!compression) { throw new Error(compressionName + " is not a valid compression method !"); } var compressedObject = generateCompressedObjectFrom.call(this, file, compression); var zipPart = generateZipParts.call(this, name, file, compressedObject, localDirLength); localDirLength += zipPart.fileRecord.length + compressedObject.compressedSize; centralDirLength += zipPart.dirRecord.length; zipData.push(zipPart); } var dirEnd = ""; // end of central dir signature dirEnd = signature.CENTRAL_DIRECTORY_END + // number of this disk "\x00\x00" + // number of the disk with the start of the central directory "\x00\x00" + // total number of entries in the central directory on this disk decToHex(zipData.length, 2) + // total number of entries in the central directory decToHex(zipData.length, 2) + // size of the central directory 4 bytes decToHex(centralDirLength, 4) + // offset of start of central directory with respect to the starting disk number decToHex(localDirLength, 4) + // .ZIP file comment length "\x00\x00"; // we have all the parts (and the total length) // time to create a writer ! var typeName = options.type.toLowerCase(); if(typeName==="uint8array"||typeName==="arraybuffer"||typeName==="blob"||typeName==="nodebuffer") { writer = new Uint8ArrayWriter(localDirLength + centralDirLength + dirEnd.length); }else{ writer = new StringWriter(localDirLength + centralDirLength + dirEnd.length); } for (i = 0; i < zipData.length; i++) { writer.append(zipData[i].fileRecord); writer.append(zipData[i].compressedObject.compressedContent); } for (i = 0; i < zipData.length; i++) { writer.append(zipData[i].dirRecord); } writer.append(dirEnd); var zip = writer.finalize(); switch(options.type.toLowerCase()) { // case "zip is an Uint8Array" case "uint8array" : case "arraybuffer" : case "nodebuffer" : return utils.transformTo(options.type.toLowerCase(), zip); case "blob" : return utils.arrayBuffer2Blob(utils.transformTo("arraybuffer", zip)); // case "zip is a string" case "base64" : return (options.base64) ? base64.encode(zip) : zip; default : // case "string" : return zip; } }
javascript
function(options) { options = extend(options || {}, { base64: true, compression: "STORE", type: "base64" }); utils.checkSupport(options.type); var zipData = [], localDirLength = 0, centralDirLength = 0, writer, i; // first, generate all the zip parts. for (var name in this.files) { if (!this.files.hasOwnProperty(name)) { continue; } var file = this.files[name]; var compressionName = file.options.compression || options.compression.toUpperCase(); var compression = compressions[compressionName]; if (!compression) { throw new Error(compressionName + " is not a valid compression method !"); } var compressedObject = generateCompressedObjectFrom.call(this, file, compression); var zipPart = generateZipParts.call(this, name, file, compressedObject, localDirLength); localDirLength += zipPart.fileRecord.length + compressedObject.compressedSize; centralDirLength += zipPart.dirRecord.length; zipData.push(zipPart); } var dirEnd = ""; // end of central dir signature dirEnd = signature.CENTRAL_DIRECTORY_END + // number of this disk "\x00\x00" + // number of the disk with the start of the central directory "\x00\x00" + // total number of entries in the central directory on this disk decToHex(zipData.length, 2) + // total number of entries in the central directory decToHex(zipData.length, 2) + // size of the central directory 4 bytes decToHex(centralDirLength, 4) + // offset of start of central directory with respect to the starting disk number decToHex(localDirLength, 4) + // .ZIP file comment length "\x00\x00"; // we have all the parts (and the total length) // time to create a writer ! var typeName = options.type.toLowerCase(); if(typeName==="uint8array"||typeName==="arraybuffer"||typeName==="blob"||typeName==="nodebuffer") { writer = new Uint8ArrayWriter(localDirLength + centralDirLength + dirEnd.length); }else{ writer = new StringWriter(localDirLength + centralDirLength + dirEnd.length); } for (i = 0; i < zipData.length; i++) { writer.append(zipData[i].fileRecord); writer.append(zipData[i].compressedObject.compressedContent); } for (i = 0; i < zipData.length; i++) { writer.append(zipData[i].dirRecord); } writer.append(dirEnd); var zip = writer.finalize(); switch(options.type.toLowerCase()) { // case "zip is an Uint8Array" case "uint8array" : case "arraybuffer" : case "nodebuffer" : return utils.transformTo(options.type.toLowerCase(), zip); case "blob" : return utils.arrayBuffer2Blob(utils.transformTo("arraybuffer", zip)); // case "zip is a string" case "base64" : return (options.base64) ? base64.encode(zip) : zip; default : // case "string" : return zip; } }
[ "function", "(", "options", ")", "{", "options", "=", "extend", "(", "options", "||", "{", "}", ",", "{", "base64", ":", "true", ",", "compression", ":", "\"STORE\"", ",", "type", ":", "\"base64\"", "}", ")", ";", "utils", ".", "checkSupport", "(", "options", ".", "type", ")", ";", "var", "zipData", "=", "[", "]", ",", "localDirLength", "=", "0", ",", "centralDirLength", "=", "0", ",", "writer", ",", "i", ";", "// first, generate all the zip parts.", "for", "(", "var", "name", "in", "this", ".", "files", ")", "{", "if", "(", "!", "this", ".", "files", ".", "hasOwnProperty", "(", "name", ")", ")", "{", "continue", ";", "}", "var", "file", "=", "this", ".", "files", "[", "name", "]", ";", "var", "compressionName", "=", "file", ".", "options", ".", "compression", "||", "options", ".", "compression", ".", "toUpperCase", "(", ")", ";", "var", "compression", "=", "compressions", "[", "compressionName", "]", ";", "if", "(", "!", "compression", ")", "{", "throw", "new", "Error", "(", "compressionName", "+", "\" is not a valid compression method !\"", ")", ";", "}", "var", "compressedObject", "=", "generateCompressedObjectFrom", ".", "call", "(", "this", ",", "file", ",", "compression", ")", ";", "var", "zipPart", "=", "generateZipParts", ".", "call", "(", "this", ",", "name", ",", "file", ",", "compressedObject", ",", "localDirLength", ")", ";", "localDirLength", "+=", "zipPart", ".", "fileRecord", ".", "length", "+", "compressedObject", ".", "compressedSize", ";", "centralDirLength", "+=", "zipPart", ".", "dirRecord", ".", "length", ";", "zipData", ".", "push", "(", "zipPart", ")", ";", "}", "var", "dirEnd", "=", "\"\"", ";", "// end of central dir signature", "dirEnd", "=", "signature", ".", "CENTRAL_DIRECTORY_END", "+", "// number of this disk", "\"\\x00\\x00\"", "+", "// number of the disk with the start of the central directory", "\"\\x00\\x00\"", "+", "// total number of entries in the central directory on this disk", "decToHex", "(", "zipData", ".", "length", ",", "2", ")", "+", "// total number of entries in the central directory", "decToHex", "(", "zipData", ".", "length", ",", "2", ")", "+", "// size of the central directory 4 bytes", "decToHex", "(", "centralDirLength", ",", "4", ")", "+", "// offset of start of central directory with respect to the starting disk number", "decToHex", "(", "localDirLength", ",", "4", ")", "+", "// .ZIP file comment length", "\"\\x00\\x00\"", ";", "// we have all the parts (and the total length)", "// time to create a writer !", "var", "typeName", "=", "options", ".", "type", ".", "toLowerCase", "(", ")", ";", "if", "(", "typeName", "===", "\"uint8array\"", "||", "typeName", "===", "\"arraybuffer\"", "||", "typeName", "===", "\"blob\"", "||", "typeName", "===", "\"nodebuffer\"", ")", "{", "writer", "=", "new", "Uint8ArrayWriter", "(", "localDirLength", "+", "centralDirLength", "+", "dirEnd", ".", "length", ")", ";", "}", "else", "{", "writer", "=", "new", "StringWriter", "(", "localDirLength", "+", "centralDirLength", "+", "dirEnd", ".", "length", ")", ";", "}", "for", "(", "i", "=", "0", ";", "i", "<", "zipData", ".", "length", ";", "i", "++", ")", "{", "writer", ".", "append", "(", "zipData", "[", "i", "]", ".", "fileRecord", ")", ";", "writer", ".", "append", "(", "zipData", "[", "i", "]", ".", "compressedObject", ".", "compressedContent", ")", ";", "}", "for", "(", "i", "=", "0", ";", "i", "<", "zipData", ".", "length", ";", "i", "++", ")", "{", "writer", ".", "append", "(", "zipData", "[", "i", "]", ".", "dirRecord", ")", ";", "}", "writer", ".", "append", "(", "dirEnd", ")", ";", "var", "zip", "=", "writer", ".", "finalize", "(", ")", ";", "switch", "(", "options", ".", "type", ".", "toLowerCase", "(", ")", ")", "{", "// case \"zip is an Uint8Array\"", "case", "\"uint8array\"", ":", "case", "\"arraybuffer\"", ":", "case", "\"nodebuffer\"", ":", "return", "utils", ".", "transformTo", "(", "options", ".", "type", ".", "toLowerCase", "(", ")", ",", "zip", ")", ";", "case", "\"blob\"", ":", "return", "utils", ".", "arrayBuffer2Blob", "(", "utils", ".", "transformTo", "(", "\"arraybuffer\"", ",", "zip", ")", ")", ";", "// case \"zip is a string\"", "case", "\"base64\"", ":", "return", "(", "options", ".", "base64", ")", "?", "base64", ".", "encode", "(", "zip", ")", ":", "zip", ";", "default", ":", "// case \"string\" :", "return", "zip", ";", "}", "}" ]
Generate the complete zip file @param {Object} options the options to generate the zip file : - base64, (deprecated, use type instead) true to generate base64. - compression, "STORE" by default. - type, "base64" by default. Values are : string, base64, uint8array, arraybuffer, blob. @return {String|Uint8Array|ArrayBuffer|Buffer|Blob} the zip file
[ "Generate", "the", "complete", "zip", "file" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/thirdparty/jszip.js#L1022-L1116
3,844
SAP/openui5
src/sap.ui.core/src/sap/ui/thirdparty/jszip.js
stringToArrayLike
function stringToArrayLike(str, array) { for (var i = 0; i < str.length; ++i) { array[i] = str.charCodeAt(i) & 0xFF; } return array; }
javascript
function stringToArrayLike(str, array) { for (var i = 0; i < str.length; ++i) { array[i] = str.charCodeAt(i) & 0xFF; } return array; }
[ "function", "stringToArrayLike", "(", "str", ",", "array", ")", "{", "for", "(", "var", "i", "=", "0", ";", "i", "<", "str", ".", "length", ";", "++", "i", ")", "{", "array", "[", "i", "]", "=", "str", ".", "charCodeAt", "(", "i", ")", "&", "0xFF", ";", "}", "return", "array", ";", "}" ]
Fill in an array with a string. @param {String} str the string to use. @param {Array|ArrayBuffer|Uint8Array|Buffer} array the array to fill in (will be mutated). @return {Array|ArrayBuffer|Uint8Array|Buffer} the updated array.
[ "Fill", "in", "an", "array", "with", "a", "string", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/thirdparty/jszip.js#L1419-L1424
3,845
SAP/openui5
src/sap.ui.core/src/sap/ui/thirdparty/jszip.js
arrayLikeToArrayLike
function arrayLikeToArrayLike(arrayFrom, arrayTo) { for (var i = 0; i < arrayFrom.length; i++) { arrayTo[i] = arrayFrom[i]; } return arrayTo; }
javascript
function arrayLikeToArrayLike(arrayFrom, arrayTo) { for (var i = 0; i < arrayFrom.length; i++) { arrayTo[i] = arrayFrom[i]; } return arrayTo; }
[ "function", "arrayLikeToArrayLike", "(", "arrayFrom", ",", "arrayTo", ")", "{", "for", "(", "var", "i", "=", "0", ";", "i", "<", "arrayFrom", ".", "length", ";", "i", "++", ")", "{", "arrayTo", "[", "i", "]", "=", "arrayFrom", "[", "i", "]", ";", "}", "return", "arrayTo", ";", "}" ]
Copy the data from an array-like to an other array-like. @param {Array|ArrayBuffer|Uint8Array|Buffer} arrayFrom the origin array. @param {Array|ArrayBuffer|Uint8Array|Buffer} arrayTo the destination array which will be mutated. @return {Array|ArrayBuffer|Uint8Array|Buffer} the updated destination array.
[ "Copy", "the", "data", "from", "an", "array", "-", "like", "to", "an", "other", "array", "-", "like", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/thirdparty/jszip.js#L1492-L1497
3,846
SAP/openui5
src/sap.ui.core/src/sap/ui/thirdparty/jszip.js
function(expectedSignature) { var signature = this.reader.readString(4); if (signature !== expectedSignature) { throw new Error("Corrupted zip or bug : unexpected signature " + "(" + utils.pretty(signature) + ", expected " + utils.pretty(expectedSignature) + ")"); } }
javascript
function(expectedSignature) { var signature = this.reader.readString(4); if (signature !== expectedSignature) { throw new Error("Corrupted zip or bug : unexpected signature " + "(" + utils.pretty(signature) + ", expected " + utils.pretty(expectedSignature) + ")"); } }
[ "function", "(", "expectedSignature", ")", "{", "var", "signature", "=", "this", ".", "reader", ".", "readString", "(", "4", ")", ";", "if", "(", "signature", "!==", "expectedSignature", ")", "{", "throw", "new", "Error", "(", "\"Corrupted zip or bug : unexpected signature \"", "+", "\"(\"", "+", "utils", ".", "pretty", "(", "signature", ")", "+", "\", expected \"", "+", "utils", ".", "pretty", "(", "expectedSignature", ")", "+", "\")\"", ")", ";", "}", "}" ]
Check that the reader is on the speficied signature. @param {string} expectedSignature the expected signature. @throws {Error} if it is an other signature.
[ "Check", "that", "the", "reader", "is", "on", "the", "speficied", "signature", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/thirdparty/jszip.js#L1713-L1718
3,847
SAP/openui5
src/sap.ui.core/src/sap/ui/thirdparty/jszip.js
function() { var i, file; for (i = 0; i < this.files.length; i++) { file = this.files[i]; this.reader.setIndex(file.localHeaderOffset); this.checkSignature(sig.LOCAL_FILE_HEADER); file.readLocalPart(this.reader); file.handleUTF8(); } }
javascript
function() { var i, file; for (i = 0; i < this.files.length; i++) { file = this.files[i]; this.reader.setIndex(file.localHeaderOffset); this.checkSignature(sig.LOCAL_FILE_HEADER); file.readLocalPart(this.reader); file.handleUTF8(); } }
[ "function", "(", ")", "{", "var", "i", ",", "file", ";", "for", "(", "i", "=", "0", ";", "i", "<", "this", ".", "files", ".", "length", ";", "i", "++", ")", "{", "file", "=", "this", ".", "files", "[", "i", "]", ";", "this", ".", "reader", ".", "setIndex", "(", "file", ".", "localHeaderOffset", ")", ";", "this", ".", "checkSignature", "(", "sig", ".", "LOCAL_FILE_HEADER", ")", ";", "file", ".", "readLocalPart", "(", "this", ".", "reader", ")", ";", "file", ".", "handleUTF8", "(", ")", ";", "}", "}" ]
Read the local files, based on the offset read in the central part.
[ "Read", "the", "local", "files", "based", "on", "the", "offset", "read", "in", "the", "central", "part", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/thirdparty/jszip.js#L1781-L1790
3,848
SAP/openui5
src/sap.ui.core/src/sap/ui/thirdparty/jszip.js
function() { var offset = this.reader.lastIndexOfSignature(sig.CENTRAL_DIRECTORY_END); if (offset === -1) { throw new Error("Corrupted zip : can't find end of central directory"); } this.reader.setIndex(offset); this.checkSignature(sig.CENTRAL_DIRECTORY_END); this.readBlockEndOfCentral(); /* extract from the zip spec : 4) If one of the fields in the end of central directory record is too small to hold required data, the field should be set to -1 (0xFFFF or 0xFFFFFFFF) and the ZIP64 format record should be created. 5) The end of central directory record and the Zip64 end of central directory locator record must reside on the same disk when splitting or spanning an archive. */ if (this.diskNumber === utils.MAX_VALUE_16BITS || this.diskWithCentralDirStart === utils.MAX_VALUE_16BITS || this.centralDirRecordsOnThisDisk === utils.MAX_VALUE_16BITS || this.centralDirRecords === utils.MAX_VALUE_16BITS || this.centralDirSize === utils.MAX_VALUE_32BITS || this.centralDirOffset === utils.MAX_VALUE_32BITS) { this.zip64 = true; /* Warning : the zip64 extension is supported, but ONLY if the 64bits integer read from the zip file can fit into a 32bits integer. This cannot be solved : Javascript represents all numbers as 64-bit double precision IEEE 754 floating point numbers. So, we have 53bits for integers and bitwise operations treat everything as 32bits. see https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Operators/Bitwise_Operators and http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-262.pdf section 8.5 */ // should look for a zip64 EOCD locator offset = this.reader.lastIndexOfSignature(sig.ZIP64_CENTRAL_DIRECTORY_LOCATOR); if (offset === -1) { throw new Error("Corrupted zip : can't find the ZIP64 end of central directory locator"); } this.reader.setIndex(offset); this.checkSignature(sig.ZIP64_CENTRAL_DIRECTORY_LOCATOR); this.readBlockZip64EndOfCentralLocator(); // now the zip64 EOCD record this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir); this.checkSignature(sig.ZIP64_CENTRAL_DIRECTORY_END); this.readBlockZip64EndOfCentral(); } }
javascript
function() { var offset = this.reader.lastIndexOfSignature(sig.CENTRAL_DIRECTORY_END); if (offset === -1) { throw new Error("Corrupted zip : can't find end of central directory"); } this.reader.setIndex(offset); this.checkSignature(sig.CENTRAL_DIRECTORY_END); this.readBlockEndOfCentral(); /* extract from the zip spec : 4) If one of the fields in the end of central directory record is too small to hold required data, the field should be set to -1 (0xFFFF or 0xFFFFFFFF) and the ZIP64 format record should be created. 5) The end of central directory record and the Zip64 end of central directory locator record must reside on the same disk when splitting or spanning an archive. */ if (this.diskNumber === utils.MAX_VALUE_16BITS || this.diskWithCentralDirStart === utils.MAX_VALUE_16BITS || this.centralDirRecordsOnThisDisk === utils.MAX_VALUE_16BITS || this.centralDirRecords === utils.MAX_VALUE_16BITS || this.centralDirSize === utils.MAX_VALUE_32BITS || this.centralDirOffset === utils.MAX_VALUE_32BITS) { this.zip64 = true; /* Warning : the zip64 extension is supported, but ONLY if the 64bits integer read from the zip file can fit into a 32bits integer. This cannot be solved : Javascript represents all numbers as 64-bit double precision IEEE 754 floating point numbers. So, we have 53bits for integers and bitwise operations treat everything as 32bits. see https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Operators/Bitwise_Operators and http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-262.pdf section 8.5 */ // should look for a zip64 EOCD locator offset = this.reader.lastIndexOfSignature(sig.ZIP64_CENTRAL_DIRECTORY_LOCATOR); if (offset === -1) { throw new Error("Corrupted zip : can't find the ZIP64 end of central directory locator"); } this.reader.setIndex(offset); this.checkSignature(sig.ZIP64_CENTRAL_DIRECTORY_LOCATOR); this.readBlockZip64EndOfCentralLocator(); // now the zip64 EOCD record this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir); this.checkSignature(sig.ZIP64_CENTRAL_DIRECTORY_END); this.readBlockZip64EndOfCentral(); } }
[ "function", "(", ")", "{", "var", "offset", "=", "this", ".", "reader", ".", "lastIndexOfSignature", "(", "sig", ".", "CENTRAL_DIRECTORY_END", ")", ";", "if", "(", "offset", "===", "-", "1", ")", "{", "throw", "new", "Error", "(", "\"Corrupted zip : can't find end of central directory\"", ")", ";", "}", "this", ".", "reader", ".", "setIndex", "(", "offset", ")", ";", "this", ".", "checkSignature", "(", "sig", ".", "CENTRAL_DIRECTORY_END", ")", ";", "this", ".", "readBlockEndOfCentral", "(", ")", ";", "/* extract from the zip spec :\n 4) If one of the fields in the end of central directory\n record is too small to hold required data, the field\n should be set to -1 (0xFFFF or 0xFFFFFFFF) and the\n ZIP64 format record should be created.\n 5) The end of central directory record and the\n Zip64 end of central directory locator record must\n reside on the same disk when splitting or spanning\n an archive.\n */", "if", "(", "this", ".", "diskNumber", "===", "utils", ".", "MAX_VALUE_16BITS", "||", "this", ".", "diskWithCentralDirStart", "===", "utils", ".", "MAX_VALUE_16BITS", "||", "this", ".", "centralDirRecordsOnThisDisk", "===", "utils", ".", "MAX_VALUE_16BITS", "||", "this", ".", "centralDirRecords", "===", "utils", ".", "MAX_VALUE_16BITS", "||", "this", ".", "centralDirSize", "===", "utils", ".", "MAX_VALUE_32BITS", "||", "this", ".", "centralDirOffset", "===", "utils", ".", "MAX_VALUE_32BITS", ")", "{", "this", ".", "zip64", "=", "true", ";", "/*\n Warning : the zip64 extension is supported, but ONLY if the 64bits integer read from\n the zip file can fit into a 32bits integer. This cannot be solved : Javascript represents\n all numbers as 64-bit double precision IEEE 754 floating point numbers.\n So, we have 53bits for integers and bitwise operations treat everything as 32bits.\n see https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Operators/Bitwise_Operators\n and http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-262.pdf section 8.5\n */", "// should look for a zip64 EOCD locator", "offset", "=", "this", ".", "reader", ".", "lastIndexOfSignature", "(", "sig", ".", "ZIP64_CENTRAL_DIRECTORY_LOCATOR", ")", ";", "if", "(", "offset", "===", "-", "1", ")", "{", "throw", "new", "Error", "(", "\"Corrupted zip : can't find the ZIP64 end of central directory locator\"", ")", ";", "}", "this", ".", "reader", ".", "setIndex", "(", "offset", ")", ";", "this", ".", "checkSignature", "(", "sig", ".", "ZIP64_CENTRAL_DIRECTORY_LOCATOR", ")", ";", "this", ".", "readBlockZip64EndOfCentralLocator", "(", ")", ";", "// now the zip64 EOCD record", "this", ".", "reader", ".", "setIndex", "(", "this", ".", "relativeOffsetEndOfZip64CentralDir", ")", ";", "this", ".", "checkSignature", "(", "sig", ".", "ZIP64_CENTRAL_DIRECTORY_END", ")", ";", "this", ".", "readBlockZip64EndOfCentral", "(", ")", ";", "}", "}" ]
Read the end of central directory.
[ "Read", "the", "end", "of", "central", "directory", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/thirdparty/jszip.js#L1809-L1855
3,849
SAP/openui5
src/sap.ui.core/src/sap/ui/thirdparty/jszip.js
function(reader, from, length, compression, uncompressedSize) { return function() { var compressedFileData = utils.transformTo(compression.uncompressInputType, this.getCompressedContent()); var uncompressedFileData = compression.uncompress(compressedFileData); if (uncompressedFileData.length !== uncompressedSize) { throw new Error("Bug : uncompressed data size mismatch"); } return uncompressedFileData; }; }
javascript
function(reader, from, length, compression, uncompressedSize) { return function() { var compressedFileData = utils.transformTo(compression.uncompressInputType, this.getCompressedContent()); var uncompressedFileData = compression.uncompress(compressedFileData); if (uncompressedFileData.length !== uncompressedSize) { throw new Error("Bug : uncompressed data size mismatch"); } return uncompressedFileData; }; }
[ "function", "(", "reader", ",", "from", ",", "length", ",", "compression", ",", "uncompressedSize", ")", "{", "return", "function", "(", ")", "{", "var", "compressedFileData", "=", "utils", ".", "transformTo", "(", "compression", ".", "uncompressInputType", ",", "this", ".", "getCompressedContent", "(", ")", ")", ";", "var", "uncompressedFileData", "=", "compression", ".", "uncompress", "(", "compressedFileData", ")", ";", "if", "(", "uncompressedFileData", ".", "length", "!==", "uncompressedSize", ")", "{", "throw", "new", "Error", "(", "\"Bug : uncompressed data size mismatch\"", ")", ";", "}", "return", "uncompressedFileData", ";", "}", ";", "}" ]
Prepare the function used to generate the uncompressed content from this ZipFile. @param {DataReader} reader the reader to use. @param {number} from the offset from where we should read the data. @param {number} length the length of the data to read. @param {JSZip.compression} compression the compression used on this file. @param {number} uncompressedSize the uncompressed size to expect. @return {Function} the callback to get the uncompressed content (the type depends of the DataReader class).
[ "Prepare", "the", "function", "used", "to", "generate", "the", "uncompressed", "content", "from", "this", "ZipFile", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/thirdparty/jszip.js#L1942-L1954
3,850
SAP/openui5
src/sap.ui.support/src/sap/ui/support/supportRules/ui/models/SelectionUtils.js
function (oTreeViewModelRules) { var aSelectedRules = storage.getSelectedRules(); if (!aSelectedRules) { return null; } if (!oTreeViewModelRules) { return null; } aSelectedRules.forEach(function (oRuleDescriptor) { Object.keys(oTreeViewModelRules).forEach(function(iKey) { oTreeViewModelRules[iKey].nodes.forEach(function(oRule) { if (oRule.id === oRuleDescriptor.ruleId) { oRule.selected = oRuleDescriptor.selected; if (!oRule.selected) { oTreeViewModelRules[iKey].selected = false; } } }); }); }); return oTreeViewModelRules; }
javascript
function (oTreeViewModelRules) { var aSelectedRules = storage.getSelectedRules(); if (!aSelectedRules) { return null; } if (!oTreeViewModelRules) { return null; } aSelectedRules.forEach(function (oRuleDescriptor) { Object.keys(oTreeViewModelRules).forEach(function(iKey) { oTreeViewModelRules[iKey].nodes.forEach(function(oRule) { if (oRule.id === oRuleDescriptor.ruleId) { oRule.selected = oRuleDescriptor.selected; if (!oRule.selected) { oTreeViewModelRules[iKey].selected = false; } } }); }); }); return oTreeViewModelRules; }
[ "function", "(", "oTreeViewModelRules", ")", "{", "var", "aSelectedRules", "=", "storage", ".", "getSelectedRules", "(", ")", ";", "if", "(", "!", "aSelectedRules", ")", "{", "return", "null", ";", "}", "if", "(", "!", "oTreeViewModelRules", ")", "{", "return", "null", ";", "}", "aSelectedRules", ".", "forEach", "(", "function", "(", "oRuleDescriptor", ")", "{", "Object", ".", "keys", "(", "oTreeViewModelRules", ")", ".", "forEach", "(", "function", "(", "iKey", ")", "{", "oTreeViewModelRules", "[", "iKey", "]", ".", "nodes", ".", "forEach", "(", "function", "(", "oRule", ")", "{", "if", "(", "oRule", ".", "id", "===", "oRuleDescriptor", ".", "ruleId", ")", "{", "oRule", ".", "selected", "=", "oRuleDescriptor", ".", "selected", ";", "if", "(", "!", "oRule", ".", "selected", ")", "{", "oTreeViewModelRules", "[", "iKey", "]", ".", "selected", "=", "false", ";", "}", "}", "}", ")", ";", "}", ")", ";", "}", ")", ";", "return", "oTreeViewModelRules", ";", "}" ]
Traverses the model and updates the selection flag for the selected rules @returns {Array} Rule selections array
[ "Traverses", "the", "model", "and", "updates", "the", "selection", "flag", "for", "the", "selected", "rules" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.support/src/sap/ui/support/supportRules/ui/models/SelectionUtils.js#L72-L98
3,851
SAP/openui5
src/sap.ui.support/src/sap/ui/support/supportRules/ui/models/SelectionUtils.js
function (aSelectedRules) { var oTreeViewModelRules = this.model.getProperty("/treeModel"); // deselect all Object.keys(oTreeViewModelRules).forEach(function(iKey) { oTreeViewModelRules[iKey].nodes.forEach(function(oRule) { oRule.selected = false; }); }); // select those from aSelectedRules aSelectedRules.forEach(function (oRuleDescriptor) { Object.keys(oTreeViewModelRules).forEach(function(iKey) { oTreeViewModelRules[iKey].nodes.forEach(function(oRule) { if (oRule.id === oRuleDescriptor.ruleId) { oRule.selected = true; } }); }); }); // syncs the parent and child selected/deselected state this.treeTable.syncParentNoteWithChildrenNotes(oTreeViewModelRules); // apply selection to ui this.treeTable.updateSelectionFromModel(); // update the count in ui this.getSelectedRules(); if (storage.readPersistenceCookie(constants.COOKIE_NAME)) { this.persistSelection(); } }
javascript
function (aSelectedRules) { var oTreeViewModelRules = this.model.getProperty("/treeModel"); // deselect all Object.keys(oTreeViewModelRules).forEach(function(iKey) { oTreeViewModelRules[iKey].nodes.forEach(function(oRule) { oRule.selected = false; }); }); // select those from aSelectedRules aSelectedRules.forEach(function (oRuleDescriptor) { Object.keys(oTreeViewModelRules).forEach(function(iKey) { oTreeViewModelRules[iKey].nodes.forEach(function(oRule) { if (oRule.id === oRuleDescriptor.ruleId) { oRule.selected = true; } }); }); }); // syncs the parent and child selected/deselected state this.treeTable.syncParentNoteWithChildrenNotes(oTreeViewModelRules); // apply selection to ui this.treeTable.updateSelectionFromModel(); // update the count in ui this.getSelectedRules(); if (storage.readPersistenceCookie(constants.COOKIE_NAME)) { this.persistSelection(); } }
[ "function", "(", "aSelectedRules", ")", "{", "var", "oTreeViewModelRules", "=", "this", ".", "model", ".", "getProperty", "(", "\"/treeModel\"", ")", ";", "// deselect all", "Object", ".", "keys", "(", "oTreeViewModelRules", ")", ".", "forEach", "(", "function", "(", "iKey", ")", "{", "oTreeViewModelRules", "[", "iKey", "]", ".", "nodes", ".", "forEach", "(", "function", "(", "oRule", ")", "{", "oRule", ".", "selected", "=", "false", ";", "}", ")", ";", "}", ")", ";", "// select those from aSelectedRules", "aSelectedRules", ".", "forEach", "(", "function", "(", "oRuleDescriptor", ")", "{", "Object", ".", "keys", "(", "oTreeViewModelRules", ")", ".", "forEach", "(", "function", "(", "iKey", ")", "{", "oTreeViewModelRules", "[", "iKey", "]", ".", "nodes", ".", "forEach", "(", "function", "(", "oRule", ")", "{", "if", "(", "oRule", ".", "id", "===", "oRuleDescriptor", ".", "ruleId", ")", "{", "oRule", ".", "selected", "=", "true", ";", "}", "}", ")", ";", "}", ")", ";", "}", ")", ";", "// syncs the parent and child selected/deselected state", "this", ".", "treeTable", ".", "syncParentNoteWithChildrenNotes", "(", "oTreeViewModelRules", ")", ";", "// apply selection to ui", "this", ".", "treeTable", ".", "updateSelectionFromModel", "(", ")", ";", "// update the count in ui", "this", ".", "getSelectedRules", "(", ")", ";", "if", "(", "storage", ".", "readPersistenceCookie", "(", "constants", ".", "COOKIE_NAME", ")", ")", "{", "this", ".", "persistSelection", "(", ")", ";", "}", "}" ]
Sets the selected rules in the same format in which they are imported @param {Array} aSelectedRules The selected rules - same as the result of getSelectedRulesPlain
[ "Sets", "the", "selected", "rules", "in", "the", "same", "format", "in", "which", "they", "are", "imported" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.support/src/sap/ui/support/supportRules/ui/models/SelectionUtils.js#L114-L147
3,852
SAP/openui5
src/sap.ui.support/src/sap/ui/support/supportRules/ui/models/SelectionUtils.js
function (tempTreeModelWithAdditionalRuleSets, oTreeModelWithSelection) { Object.keys(tempTreeModelWithAdditionalRuleSets).forEach(function(iKey) { Object.keys(oTreeModelWithSelection).forEach(function(iKey) { if (tempTreeModelWithAdditionalRuleSets[iKey].id === oTreeModelWithSelection[iKey].id) { tempTreeModelWithAdditionalRuleSets[iKey] = oTreeModelWithSelection[iKey]; } }); }); return tempTreeModelWithAdditionalRuleSets; }
javascript
function (tempTreeModelWithAdditionalRuleSets, oTreeModelWithSelection) { Object.keys(tempTreeModelWithAdditionalRuleSets).forEach(function(iKey) { Object.keys(oTreeModelWithSelection).forEach(function(iKey) { if (tempTreeModelWithAdditionalRuleSets[iKey].id === oTreeModelWithSelection[iKey].id) { tempTreeModelWithAdditionalRuleSets[iKey] = oTreeModelWithSelection[iKey]; } }); }); return tempTreeModelWithAdditionalRuleSets; }
[ "function", "(", "tempTreeModelWithAdditionalRuleSets", ",", "oTreeModelWithSelection", ")", "{", "Object", ".", "keys", "(", "tempTreeModelWithAdditionalRuleSets", ")", ".", "forEach", "(", "function", "(", "iKey", ")", "{", "Object", ".", "keys", "(", "oTreeModelWithSelection", ")", ".", "forEach", "(", "function", "(", "iKey", ")", "{", "if", "(", "tempTreeModelWithAdditionalRuleSets", "[", "iKey", "]", ".", "id", "===", "oTreeModelWithSelection", "[", "iKey", "]", ".", "id", ")", "{", "tempTreeModelWithAdditionalRuleSets", "[", "iKey", "]", "=", "oTreeModelWithSelection", "[", "iKey", "]", ";", "}", "}", ")", ";", "}", ")", ";", "return", "tempTreeModelWithAdditionalRuleSets", ";", "}" ]
Applies selection to the tree model after reinitializing model with additional rulesets. @param {Object} tempTreeModelWithAdditionalRuleSets tree model with no selection @param {Object} oTreeModelWithSelection tree model with selection before loading additional rulesets @returns {Object} oTreeModelWhitAdditionalRuleSets updated selection model
[ "Applies", "selection", "to", "the", "tree", "model", "after", "reinitializing", "model", "with", "additional", "rulesets", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.support/src/sap/ui/support/supportRules/ui/models/SelectionUtils.js#L156-L167
3,853
SAP/openui5
src/sap.ui.support/src/sap/ui/support/supportRules/ui/models/SelectionUtils.js
function (oTreeModel, aAdditionalRuleSetsNames) { if (!aAdditionalRuleSetsNames) { return; } aAdditionalRuleSetsNames.forEach(function (sRuleName) { Object.keys(oTreeModel).forEach(function(iKey) { if (oTreeModel[iKey].name === sRuleName) { oTreeModel[iKey].selected = false; oTreeModel[iKey].nodes.forEach(function(oRule){ oRule.selected = false; }); } }); }); return oTreeModel; }
javascript
function (oTreeModel, aAdditionalRuleSetsNames) { if (!aAdditionalRuleSetsNames) { return; } aAdditionalRuleSetsNames.forEach(function (sRuleName) { Object.keys(oTreeModel).forEach(function(iKey) { if (oTreeModel[iKey].name === sRuleName) { oTreeModel[iKey].selected = false; oTreeModel[iKey].nodes.forEach(function(oRule){ oRule.selected = false; }); } }); }); return oTreeModel; }
[ "function", "(", "oTreeModel", ",", "aAdditionalRuleSetsNames", ")", "{", "if", "(", "!", "aAdditionalRuleSetsNames", ")", "{", "return", ";", "}", "aAdditionalRuleSetsNames", ".", "forEach", "(", "function", "(", "sRuleName", ")", "{", "Object", ".", "keys", "(", "oTreeModel", ")", ".", "forEach", "(", "function", "(", "iKey", ")", "{", "if", "(", "oTreeModel", "[", "iKey", "]", ".", "name", "===", "sRuleName", ")", "{", "oTreeModel", "[", "iKey", "]", ".", "selected", "=", "false", ";", "oTreeModel", "[", "iKey", "]", ".", "nodes", ".", "forEach", "(", "function", "(", "oRule", ")", "{", "oRule", ".", "selected", "=", "false", ";", "}", ")", ";", "}", "}", ")", ";", "}", ")", ";", "return", "oTreeModel", ";", "}" ]
Deselect additional rulesets in model @param {Object} oTreeModel tree model with loaded additional ruleset(s) @param {Array} aAdditionalRuleSetsNames additional ruleset(s) name @returns {Object} oTreeModel updated selection model
[ "Deselect", "additional", "rulesets", "in", "model" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.support/src/sap/ui/support/supportRules/ui/models/SelectionUtils.js#L175-L193
3,854
SAP/openui5
src/sap.m/src/sap/m/TimePicker.js
genValidHourValues
function genValidHourValues(b24H, sLeadingChar) { var iStart = b24H ? 0 : 1, b2400 = this._oTimePicker.getSupport2400() ? 24 : 23,//if getSupport2400, the user could type 24 in the input iEnd = b24H ? b2400 : 12; return genValues(iStart, iEnd, sLeadingChar); }
javascript
function genValidHourValues(b24H, sLeadingChar) { var iStart = b24H ? 0 : 1, b2400 = this._oTimePicker.getSupport2400() ? 24 : 23,//if getSupport2400, the user could type 24 in the input iEnd = b24H ? b2400 : 12; return genValues(iStart, iEnd, sLeadingChar); }
[ "function", "genValidHourValues", "(", "b24H", ",", "sLeadingChar", ")", "{", "var", "iStart", "=", "b24H", "?", "0", ":", "1", ",", "b2400", "=", "this", ".", "_oTimePicker", ".", "getSupport2400", "(", ")", "?", "24", ":", "23", ",", "//if getSupport2400, the user could type 24 in the input", "iEnd", "=", "b24H", "?", "b2400", ":", "12", ";", "return", "genValues", "(", "iStart", ",", "iEnd", ",", "sLeadingChar", ")", ";", "}" ]
not too expensive to generate all values that are valid hour values
[ "not", "too", "expensive", "to", "generate", "all", "values", "that", "are", "valid", "hour", "values" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.m/src/sap/m/TimePicker.js#L1462-L1468
3,855
SAP/openui5
src/sap.ui.core/src/sap/ui/core/routing/TargetCache.js
function (oOptions, sType) { var oObject; try { if (sType === "Component" && !this.async) { Log.error("sap.ui.core.routing.Target doesn't support loading component in synchronous mode, please switch routing to async"); throw new Error("sap.ui.core.routing.Target doesn't support loading component in synchronous mode, please switch routing to async"); } if (!oOptions) { Log.error("the oOptions parameter of getObject is mandatory", this); throw new Error("the oOptions parameter of getObject is mandatory"); } oObject = this._get(oOptions, sType); } catch (e) { return Promise.reject(e); } if (oObject instanceof Promise) { return oObject; } else if (oObject.isA("sap.ui.core.mvc.View")) { return oObject.loaded(); } else { return Promise.resolve(oObject); } }
javascript
function (oOptions, sType) { var oObject; try { if (sType === "Component" && !this.async) { Log.error("sap.ui.core.routing.Target doesn't support loading component in synchronous mode, please switch routing to async"); throw new Error("sap.ui.core.routing.Target doesn't support loading component in synchronous mode, please switch routing to async"); } if (!oOptions) { Log.error("the oOptions parameter of getObject is mandatory", this); throw new Error("the oOptions parameter of getObject is mandatory"); } oObject = this._get(oOptions, sType); } catch (e) { return Promise.reject(e); } if (oObject instanceof Promise) { return oObject; } else if (oObject.isA("sap.ui.core.mvc.View")) { return oObject.loaded(); } else { return Promise.resolve(oObject); } }
[ "function", "(", "oOptions", ",", "sType", ")", "{", "var", "oObject", ";", "try", "{", "if", "(", "sType", "===", "\"Component\"", "&&", "!", "this", ".", "async", ")", "{", "Log", ".", "error", "(", "\"sap.ui.core.routing.Target doesn't support loading component in synchronous mode, please switch routing to async\"", ")", ";", "throw", "new", "Error", "(", "\"sap.ui.core.routing.Target doesn't support loading component in synchronous mode, please switch routing to async\"", ")", ";", "}", "if", "(", "!", "oOptions", ")", "{", "Log", ".", "error", "(", "\"the oOptions parameter of getObject is mandatory\"", ",", "this", ")", ";", "throw", "new", "Error", "(", "\"the oOptions parameter of getObject is mandatory\"", ")", ";", "}", "oObject", "=", "this", ".", "_get", "(", "oOptions", ",", "sType", ")", ";", "}", "catch", "(", "e", ")", "{", "return", "Promise", ".", "reject", "(", "e", ")", ";", "}", "if", "(", "oObject", "instanceof", "Promise", ")", "{", "return", "oObject", ";", "}", "else", "if", "(", "oObject", ".", "isA", "(", "\"sap.ui.core.mvc.View\"", ")", ")", "{", "return", "oObject", ".", "loaded", "(", ")", ";", "}", "else", "{", "return", "Promise", ".", "resolve", "(", "oObject", ")", ";", "}", "}" ]
Returns a cached view or component, for a given name. If it does not exist yet, it will create the view or component with the provided options. If you provide a "id" in the "oOptions", it will be prefixed with the id of the component. @param {object} oOptions see {@link sap.ui.core.mvc.View.create} or {@link sap.ui.core.Component.create} for the documentation. @param {string} oOptions.name If you do not use setView please see {@link sap.ui.core.mvc.View.create} or {@link sap.ui.core.Component.create} for the documentation. This is used as a key in the cache of the view or component instance. If you want to retrieve a view or a component that has been given an alternative name in {@link #set}, you need to provide the same name here and you can skip all the other options. @param {string} [oOptions.id] The id you pass into the options will be prefixed with the id of the component you pass into the constructor. So you can retrieve the view later by calling the {@link sap.ui.core.UIComponent#byId} function of the UIComponent. @param {string} sType whether the object is a "View" or "Component". Views and components are stored separately in the cache. This means that a view and a component instance could be stored under the same name. @return {Promise} A promise that is resolved when the view or component is loaded. The view or component instance will be passed to the resolve function. @private
[ "Returns", "a", "cached", "view", "or", "component", "for", "a", "given", "name", ".", "If", "it", "does", "not", "exist", "yet", "it", "will", "create", "the", "view", "or", "component", "with", "the", "provided", "options", ".", "If", "you", "provide", "a", "id", "in", "the", "oOptions", "it", "will", "be", "prefixed", "with", "the", "id", "of", "the", "component", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/routing/TargetCache.js#L91-L117
3,856
SAP/openui5
src/sap.ui.core/src/sap/ui/core/routing/TargetCache.js
function (sName, sType, oObject) { var oInstanceCache; this._checkName(sName, sType); assert(sType === "View" || sType === "Component", "sType must be either 'View' or 'Component'"); oInstanceCache = this._oCache[sType.toLowerCase()][sName]; if (!oInstanceCache) { oInstanceCache = this._oCache[sType.toLowerCase()][sName] = {}; } oInstanceCache[undefined] = oObject; return this; }
javascript
function (sName, sType, oObject) { var oInstanceCache; this._checkName(sName, sType); assert(sType === "View" || sType === "Component", "sType must be either 'View' or 'Component'"); oInstanceCache = this._oCache[sType.toLowerCase()][sName]; if (!oInstanceCache) { oInstanceCache = this._oCache[sType.toLowerCase()][sName] = {}; } oInstanceCache[undefined] = oObject; return this; }
[ "function", "(", "sName", ",", "sType", ",", "oObject", ")", "{", "var", "oInstanceCache", ";", "this", ".", "_checkName", "(", "sName", ",", "sType", ")", ";", "assert", "(", "sType", "===", "\"View\"", "||", "sType", "===", "\"Component\"", ",", "\"sType must be either 'View' or 'Component'\"", ")", ";", "oInstanceCache", "=", "this", ".", "_oCache", "[", "sType", ".", "toLowerCase", "(", ")", "]", "[", "sName", "]", ";", "if", "(", "!", "oInstanceCache", ")", "{", "oInstanceCache", "=", "this", ".", "_oCache", "[", "sType", ".", "toLowerCase", "(", ")", "]", "[", "sName", "]", "=", "{", "}", ";", "}", "oInstanceCache", "[", "undefined", "]", "=", "oObject", ";", "return", "this", ";", "}" ]
Adds or overwrites a view or a component in the TargetCache. The given object is cached under its name and the 'undefined' key. If the third parameter is set to null or undefined, the previous cache view or component under the same name isn't managed by the TargetCache instance. The lifecycle (for example the destroy) of the view or component instance should be maintained by additional code. @param {string} sName Name of the view or component, may differ from the actual name of the oObject parameter provided, since you can retrieve this view or component per {@link #.getObject}. @param {string} sType whether the object is a "View" or "Component". Views and components are stored separately in the cache. This means that a view and a component instance could be stored under the same name. @param {sap.ui.core.mvc.View|sap.ui.core.UIComponent|null|undefined} oObject the view or component instance @return {sap.ui.core.routing.TargetCache} this for chaining. @private
[ "Adds", "or", "overwrites", "a", "view", "or", "a", "component", "in", "the", "TargetCache", ".", "The", "given", "object", "is", "cached", "under", "its", "name", "and", "the", "undefined", "key", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/routing/TargetCache.js#L133-L148
3,857
SAP/openui5
src/sap.ui.core/src/sap/ui/core/routing/TargetCache.js
function () { EventProvider.prototype.destroy.apply(this); if (this.bIsDestroyed) { return this; } function destroyObject(oObject) { if (oObject && oObject.destroy) { oObject.destroy(); } } Object.keys(this._oCache).forEach(function (sType) { var oTypeCache = this._oCache[sType]; Object.keys(oTypeCache).forEach(function (sKey) { var oInstanceCache = oTypeCache[sKey]; Object.keys(oInstanceCache).forEach(function(sId) { var vObject = oInstanceCache[sId]; if (vObject instanceof Promise) { // if the promise isn't replaced by the real object yet // wait until the promise resolves to destroy the object vObject.then(destroyObject); } else { destroyObject(vObject); } }); }); }.bind(this)); this._oCache = undefined; this.bIsDestroyed = true; return this; }
javascript
function () { EventProvider.prototype.destroy.apply(this); if (this.bIsDestroyed) { return this; } function destroyObject(oObject) { if (oObject && oObject.destroy) { oObject.destroy(); } } Object.keys(this._oCache).forEach(function (sType) { var oTypeCache = this._oCache[sType]; Object.keys(oTypeCache).forEach(function (sKey) { var oInstanceCache = oTypeCache[sKey]; Object.keys(oInstanceCache).forEach(function(sId) { var vObject = oInstanceCache[sId]; if (vObject instanceof Promise) { // if the promise isn't replaced by the real object yet // wait until the promise resolves to destroy the object vObject.then(destroyObject); } else { destroyObject(vObject); } }); }); }.bind(this)); this._oCache = undefined; this.bIsDestroyed = true; return this; }
[ "function", "(", ")", "{", "EventProvider", ".", "prototype", ".", "destroy", ".", "apply", "(", "this", ")", ";", "if", "(", "this", ".", "bIsDestroyed", ")", "{", "return", "this", ";", "}", "function", "destroyObject", "(", "oObject", ")", "{", "if", "(", "oObject", "&&", "oObject", ".", "destroy", ")", "{", "oObject", ".", "destroy", "(", ")", ";", "}", "}", "Object", ".", "keys", "(", "this", ".", "_oCache", ")", ".", "forEach", "(", "function", "(", "sType", ")", "{", "var", "oTypeCache", "=", "this", ".", "_oCache", "[", "sType", "]", ";", "Object", ".", "keys", "(", "oTypeCache", ")", ".", "forEach", "(", "function", "(", "sKey", ")", "{", "var", "oInstanceCache", "=", "oTypeCache", "[", "sKey", "]", ";", "Object", ".", "keys", "(", "oInstanceCache", ")", ".", "forEach", "(", "function", "(", "sId", ")", "{", "var", "vObject", "=", "oInstanceCache", "[", "sId", "]", ";", "if", "(", "vObject", "instanceof", "Promise", ")", "{", "// if the promise isn't replaced by the real object yet", "// wait until the promise resolves to destroy the object", "vObject", ".", "then", "(", "destroyObject", ")", ";", "}", "else", "{", "destroyObject", "(", "vObject", ")", ";", "}", "}", ")", ";", "}", ")", ";", "}", ".", "bind", "(", "this", ")", ")", ";", "this", ".", "_oCache", "=", "undefined", ";", "this", ".", "bIsDestroyed", "=", "true", ";", "return", "this", ";", "}" ]
Destroys all the views and components created by this instance. @returns {sap.ui.core.routing.TargetCache} this for chaining.
[ "Destroys", "all", "the", "views", "and", "components", "created", "by", "this", "instance", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/routing/TargetCache.js#L155-L188
3,858
SAP/openui5
src/sap.ui.core/src/sap/ui/core/routing/TargetCache.js
function (sName, sType) { if (!sName) { var sMessage = "A name for the " + sType.toLowerCase() + " has to be defined"; Log.error(sMessage, this); throw Error(sMessage); } }
javascript
function (sName, sType) { if (!sName) { var sMessage = "A name for the " + sType.toLowerCase() + " has to be defined"; Log.error(sMessage, this); throw Error(sMessage); } }
[ "function", "(", "sName", ",", "sType", ")", "{", "if", "(", "!", "sName", ")", "{", "var", "sMessage", "=", "\"A name for the \"", "+", "sType", ".", "toLowerCase", "(", ")", "+", "\" has to be defined\"", ";", "Log", ".", "error", "(", "sMessage", ",", "this", ")", ";", "throw", "Error", "(", "sMessage", ")", ";", "}", "}" ]
hook for the deprecated property viewId on the route, will not prefix the id with the component @name sap.ui.core.routing.TargetCache#_getViewWithGlobalId @returns {*} @private @param {string} sName logs an error if it is empty or undefined @param {string} sType whether it's a 'View' or 'Component' @private
[ "hook", "for", "the", "deprecated", "property", "viewId", "on", "the", "route", "will", "not", "prefix", "the", "id", "with", "the", "component" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/routing/TargetCache.js#L305-L313
3,859
SAP/openui5
src/sap.ui.core/src/sap/ui/core/HTMLRenderer.js
function(oRM, oControl) { // render an invisible, but easily identifiable placeholder for the content oRM.write("<div id=\"" + RenderPrefixes.Dummy + oControl.getId() + "\" style=\"display:none\">"); // Note: we do not render the content string here, but only in onAfterRendering // This has the advantage that syntax errors don't affect the whole control tree // but only this control... oRM.write("</div>"); }
javascript
function(oRM, oControl) { // render an invisible, but easily identifiable placeholder for the content oRM.write("<div id=\"" + RenderPrefixes.Dummy + oControl.getId() + "\" style=\"display:none\">"); // Note: we do not render the content string here, but only in onAfterRendering // This has the advantage that syntax errors don't affect the whole control tree // but only this control... oRM.write("</div>"); }
[ "function", "(", "oRM", ",", "oControl", ")", "{", "// render an invisible, but easily identifiable placeholder for the content", "oRM", ".", "write", "(", "\"<div id=\\\"\"", "+", "RenderPrefixes", ".", "Dummy", "+", "oControl", ".", "getId", "(", ")", "+", "\"\\\" style=\\\"display:none\\\">\"", ")", ";", "// Note: we do not render the content string here, but only in onAfterRendering", "// This has the advantage that syntax errors don't affect the whole control tree", "// but only this control...", "oRM", ".", "write", "(", "\"</div>\"", ")", ";", "}" ]
Renders either the configured content or a dummy div that will be replaced after rendering @param {sap.ui.core.RenderManager} [oRM] The RenderManager instance @param {sap.ui.core.Control} [oControl] The instance of the invisible control
[ "Renders", "either", "the", "configured", "content", "or", "a", "dummy", "div", "that", "will", "be", "replaced", "after", "rendering" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/HTMLRenderer.js#L21-L30
3,860
SAP/openui5
lib/jsdoc/create-api-index.js
cleanTree
function cleanTree (oSymbol) { delete oSymbol.treeName; delete oSymbol.parent; if (oSymbol.children) { oSymbol.children.forEach(o => cleanTree(o)); } }
javascript
function cleanTree (oSymbol) { delete oSymbol.treeName; delete oSymbol.parent; if (oSymbol.children) { oSymbol.children.forEach(o => cleanTree(o)); } }
[ "function", "cleanTree", "(", "oSymbol", ")", "{", "delete", "oSymbol", ".", "treeName", ";", "delete", "oSymbol", ".", "parent", ";", "if", "(", "oSymbol", ".", "children", ")", "{", "oSymbol", ".", "children", ".", "forEach", "(", "o", "=>", "cleanTree", "(", "o", ")", ")", ";", "}", "}" ]
Clean tree - keep file size down
[ "Clean", "tree", "-", "keep", "file", "size", "down" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/lib/jsdoc/create-api-index.js#L329-L335
3,861
SAP/openui5
src/sap.ui.core/src/sap/ui/model/odata/v4/lib/_Parser.js
addInfixOperator
function addInfixOperator(sId, iLbp) { // Note: this function is executed at load time only! mFilterParserSymbols[sId] = { lbp : iLbp, led : function (oToken, oLeft) { oToken.type = "Edm.Boolean"; // Note: currently we only support logical operators oToken.precedence = iLbp; oToken.left = oLeft; oToken.right = this.expression(iLbp); return oToken; } }; }
javascript
function addInfixOperator(sId, iLbp) { // Note: this function is executed at load time only! mFilterParserSymbols[sId] = { lbp : iLbp, led : function (oToken, oLeft) { oToken.type = "Edm.Boolean"; // Note: currently we only support logical operators oToken.precedence = iLbp; oToken.left = oLeft; oToken.right = this.expression(iLbp); return oToken; } }; }
[ "function", "addInfixOperator", "(", "sId", ",", "iLbp", ")", "{", "// Note: this function is executed at load time only!", "mFilterParserSymbols", "[", "sId", "]", "=", "{", "lbp", ":", "iLbp", ",", "led", ":", "function", "(", "oToken", ",", "oLeft", ")", "{", "oToken", ".", "type", "=", "\"Edm.Boolean\"", ";", "// Note: currently we only support logical operators", "oToken", ".", "precedence", "=", "iLbp", ";", "oToken", ".", "left", "=", "oLeft", ";", "oToken", ".", "right", "=", "this", ".", "expression", "(", "iLbp", ")", ";", "return", "oToken", ";", "}", "}", ";", "}" ]
Adds an infix operator to mFilterParserSymbols. @param {string} sId The token ID @param {number} iLbp The "left binding power"
[ "Adds", "an", "infix", "operator", "to", "mFilterParserSymbols", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/v4/lib/_Parser.js#L170-L182
3,862
SAP/openui5
src/sap.ui.core/src/sap/ui/model/odata/v4/lib/_Parser.js
addLeafSymbol
function addLeafSymbol(sId) { // Note: this function is executed at load time only! mFilterParserSymbols[sId] = { lbp : 0, nud : function (oToken) { oToken.precedence = 99; // prevent it from being enclosed in brackets return oToken; } }; }
javascript
function addLeafSymbol(sId) { // Note: this function is executed at load time only! mFilterParserSymbols[sId] = { lbp : 0, nud : function (oToken) { oToken.precedence = 99; // prevent it from being enclosed in brackets return oToken; } }; }
[ "function", "addLeafSymbol", "(", "sId", ")", "{", "// Note: this function is executed at load time only!", "mFilterParserSymbols", "[", "sId", "]", "=", "{", "lbp", ":", "0", ",", "nud", ":", "function", "(", "oToken", ")", "{", "oToken", ".", "precedence", "=", "99", ";", "// prevent it from being enclosed in brackets", "return", "oToken", ";", "}", "}", ";", "}" ]
Adds a leaf symbol to mFilterParserSymbols. @param {string} sId The token ID
[ "Adds", "a", "leaf", "symbol", "to", "mFilterParserSymbols", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/v4/lib/_Parser.js#L189-L198
3,863
SAP/openui5
src/sap.ui.core/src/sap/ui/model/odata/v4/lib/_Parser.js
brackets
function brackets() { for (;;) { oToken = that.advance(); if (!oToken || oToken.id === ';') { that.expected("')'", oToken); } sValue += oToken.value; if (oToken.id === ")") { return; } if (oToken.id === "(") { brackets(); } } }
javascript
function brackets() { for (;;) { oToken = that.advance(); if (!oToken || oToken.id === ';') { that.expected("')'", oToken); } sValue += oToken.value; if (oToken.id === ")") { return; } if (oToken.id === "(") { brackets(); } } }
[ "function", "brackets", "(", ")", "{", "for", "(", ";", ";", ")", "{", "oToken", "=", "that", ".", "advance", "(", ")", ";", "if", "(", "!", "oToken", "||", "oToken", ".", "id", "===", "';'", ")", "{", "that", ".", "expected", "(", "\"')'\"", ",", "oToken", ")", ";", "}", "sValue", "+=", "oToken", ".", "value", ";", "if", "(", "oToken", ".", "id", "===", "\")\"", ")", "{", "return", ";", "}", "if", "(", "oToken", ".", "id", "===", "\"(\"", ")", "{", "brackets", "(", ")", ";", "}", "}", "}" ]
recursive function that advances and adds to sValue until the matching closing bracket has been consumed
[ "recursive", "function", "that", "advances", "and", "adds", "to", "sValue", "until", "the", "matching", "closing", "bracket", "has", "been", "consumed" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/v4/lib/_Parser.js#L482-L496
3,864
SAP/openui5
src/sap.ui.core/src/sap/ui/model/odata/v4/lib/_Parser.js
tokenizeDoubleQuotedString
function tokenizeDoubleQuotedString(sNext, sOption, iAt) { var c, sEscape, bEscaping = false, i; for (i = 1; i < sNext.length; i += 1) { if (bEscaping) { bEscaping = false; } else { c = sNext[i]; if (c === "%") { sEscape = sNext.slice(i + 1, i + 3); if (rEscapeDigits.test(sEscape)) { c = unescape(sEscape); i += 2; } } if (c === '"') { return sNext.slice(0, i + 1); } bEscaping = c === '\\'; } } throw new SyntaxError("Unterminated string at " + iAt + ": " + sOption); }
javascript
function tokenizeDoubleQuotedString(sNext, sOption, iAt) { var c, sEscape, bEscaping = false, i; for (i = 1; i < sNext.length; i += 1) { if (bEscaping) { bEscaping = false; } else { c = sNext[i]; if (c === "%") { sEscape = sNext.slice(i + 1, i + 3); if (rEscapeDigits.test(sEscape)) { c = unescape(sEscape); i += 2; } } if (c === '"') { return sNext.slice(0, i + 1); } bEscaping = c === '\\'; } } throw new SyntaxError("Unterminated string at " + iAt + ": " + sOption); }
[ "function", "tokenizeDoubleQuotedString", "(", "sNext", ",", "sOption", ",", "iAt", ")", "{", "var", "c", ",", "sEscape", ",", "bEscaping", "=", "false", ",", "i", ";", "for", "(", "i", "=", "1", ";", "i", "<", "sNext", ".", "length", ";", "i", "+=", "1", ")", "{", "if", "(", "bEscaping", ")", "{", "bEscaping", "=", "false", ";", "}", "else", "{", "c", "=", "sNext", "[", "i", "]", ";", "if", "(", "c", "===", "\"%\"", ")", "{", "sEscape", "=", "sNext", ".", "slice", "(", "i", "+", "1", ",", "i", "+", "3", ")", ";", "if", "(", "rEscapeDigits", ".", "test", "(", "sEscape", ")", ")", "{", "c", "=", "unescape", "(", "sEscape", ")", ";", "i", "+=", "2", ";", "}", "}", "if", "(", "c", "===", "'\"'", ")", "{", "return", "sNext", ".", "slice", "(", "0", ",", "i", "+", "1", ")", ";", "}", "bEscaping", "=", "c", "===", "'\\\\'", ";", "}", "}", "throw", "new", "SyntaxError", "(", "\"Unterminated string at \"", "+", "iAt", "+", "\": \"", "+", "sOption", ")", ";", "}" ]
Tokenizes a c-like string. It starts and ends with a double quote, backslash is the escape character. Both characters may be %-encoded. @param {string} sNext The untokenized input starting with the opening quote @param {string} sOption The option string (for an error message) @param {number} iAt The position in the option string (for an error message) @returns {string} The unconverted string including the quotes.
[ "Tokenizes", "a", "c", "-", "like", "string", ".", "It", "starts", "and", "ends", "with", "a", "double", "quote", "backslash", "is", "the", "escape", "character", ".", "Both", "characters", "may", "be", "%", "-", "encoded", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/v4/lib/_Parser.js#L655-L680
3,865
SAP/openui5
src/sap.ui.core/src/sap/ui/model/odata/v4/lib/_Parser.js
tokenize
function tokenize(sOption) { var iAt = 1, // The token's position for error messages; we count starting with 1 sId, aMatches, sNext = sOption, iOffset, oToken, aTokens = [], sValue; while (sNext.length) { aMatches = rToken.exec(sNext); iOffset = 0; if (aMatches) { sValue = aMatches[0]; if (aMatches[7]) { sId = "OPTION"; } else if (aMatches[6] || aMatches[4]) { sId = "VALUE"; } else if (aMatches[5]) { sId = "PATH"; if (sValue === "false" || sValue === "true" || sValue === "null") { sId = "VALUE"; } else if (sValue === "not") { sId = "not"; aMatches = rNot.exec(sNext); if (aMatches) { sValue = aMatches[0]; } } } else if (aMatches[3]) { // a %-escaped delimiter sId = unescape(aMatches[3]); } else if (aMatches[2]) { // an operator sId = aMatches[2]; iOffset = aMatches[1].length; } else { // a delimiter sId = aMatches[0]; } if (sId === '"') { sId = "VALUE"; sValue = tokenizeDoubleQuotedString(sNext, sOption, iAt); } else if (sId === "'") { sId = "VALUE"; sValue = tokenizeSingleQuotedString(sNext, sOption, iAt); } oToken = { at : iAt + iOffset, id : sId, value : sValue }; } else { throw new SyntaxError("Unknown character '" + sNext[0] + "' at " + iAt + ": " + sOption); } sNext = sNext.slice(sValue.length); iAt += sValue.length; aTokens.push(oToken); } return aTokens; }
javascript
function tokenize(sOption) { var iAt = 1, // The token's position for error messages; we count starting with 1 sId, aMatches, sNext = sOption, iOffset, oToken, aTokens = [], sValue; while (sNext.length) { aMatches = rToken.exec(sNext); iOffset = 0; if (aMatches) { sValue = aMatches[0]; if (aMatches[7]) { sId = "OPTION"; } else if (aMatches[6] || aMatches[4]) { sId = "VALUE"; } else if (aMatches[5]) { sId = "PATH"; if (sValue === "false" || sValue === "true" || sValue === "null") { sId = "VALUE"; } else if (sValue === "not") { sId = "not"; aMatches = rNot.exec(sNext); if (aMatches) { sValue = aMatches[0]; } } } else if (aMatches[3]) { // a %-escaped delimiter sId = unescape(aMatches[3]); } else if (aMatches[2]) { // an operator sId = aMatches[2]; iOffset = aMatches[1].length; } else { // a delimiter sId = aMatches[0]; } if (sId === '"') { sId = "VALUE"; sValue = tokenizeDoubleQuotedString(sNext, sOption, iAt); } else if (sId === "'") { sId = "VALUE"; sValue = tokenizeSingleQuotedString(sNext, sOption, iAt); } oToken = { at : iAt + iOffset, id : sId, value : sValue }; } else { throw new SyntaxError("Unknown character '" + sNext[0] + "' at " + iAt + ": " + sOption); } sNext = sNext.slice(sValue.length); iAt += sValue.length; aTokens.push(oToken); } return aTokens; }
[ "function", "tokenize", "(", "sOption", ")", "{", "var", "iAt", "=", "1", ",", "// The token's position for error messages; we count starting with 1", "sId", ",", "aMatches", ",", "sNext", "=", "sOption", ",", "iOffset", ",", "oToken", ",", "aTokens", "=", "[", "]", ",", "sValue", ";", "while", "(", "sNext", ".", "length", ")", "{", "aMatches", "=", "rToken", ".", "exec", "(", "sNext", ")", ";", "iOffset", "=", "0", ";", "if", "(", "aMatches", ")", "{", "sValue", "=", "aMatches", "[", "0", "]", ";", "if", "(", "aMatches", "[", "7", "]", ")", "{", "sId", "=", "\"OPTION\"", ";", "}", "else", "if", "(", "aMatches", "[", "6", "]", "||", "aMatches", "[", "4", "]", ")", "{", "sId", "=", "\"VALUE\"", ";", "}", "else", "if", "(", "aMatches", "[", "5", "]", ")", "{", "sId", "=", "\"PATH\"", ";", "if", "(", "sValue", "===", "\"false\"", "||", "sValue", "===", "\"true\"", "||", "sValue", "===", "\"null\"", ")", "{", "sId", "=", "\"VALUE\"", ";", "}", "else", "if", "(", "sValue", "===", "\"not\"", ")", "{", "sId", "=", "\"not\"", ";", "aMatches", "=", "rNot", ".", "exec", "(", "sNext", ")", ";", "if", "(", "aMatches", ")", "{", "sValue", "=", "aMatches", "[", "0", "]", ";", "}", "}", "}", "else", "if", "(", "aMatches", "[", "3", "]", ")", "{", "// a %-escaped delimiter", "sId", "=", "unescape", "(", "aMatches", "[", "3", "]", ")", ";", "}", "else", "if", "(", "aMatches", "[", "2", "]", ")", "{", "// an operator", "sId", "=", "aMatches", "[", "2", "]", ";", "iOffset", "=", "aMatches", "[", "1", "]", ".", "length", ";", "}", "else", "{", "// a delimiter", "sId", "=", "aMatches", "[", "0", "]", ";", "}", "if", "(", "sId", "===", "'\"'", ")", "{", "sId", "=", "\"VALUE\"", ";", "sValue", "=", "tokenizeDoubleQuotedString", "(", "sNext", ",", "sOption", ",", "iAt", ")", ";", "}", "else", "if", "(", "sId", "===", "\"'\"", ")", "{", "sId", "=", "\"VALUE\"", ";", "sValue", "=", "tokenizeSingleQuotedString", "(", "sNext", ",", "sOption", ",", "iAt", ")", ";", "}", "oToken", "=", "{", "at", ":", "iAt", "+", "iOffset", ",", "id", ":", "sId", ",", "value", ":", "sValue", "}", ";", "}", "else", "{", "throw", "new", "SyntaxError", "(", "\"Unknown character '\"", "+", "sNext", "[", "0", "]", "+", "\"' at \"", "+", "iAt", "+", "\": \"", "+", "sOption", ")", ";", "}", "sNext", "=", "sNext", ".", "slice", "(", "sValue", ".", "length", ")", ";", "iAt", "+=", "sValue", ".", "length", ";", "aTokens", ".", "push", "(", "oToken", ")", ";", "}", "return", "aTokens", ";", "}" ]
Splits the option string into an array of tokens. @param {string} sOption The option string @returns {object[]} The array of tokens.
[ "Splits", "the", "option", "string", "into", "an", "array", "of", "tokens", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/v4/lib/_Parser.js#L688-L748
3,866
SAP/openui5
src/sap.ui.documentation/src/sap/ui/documentation/sdk/controller/Sample.controller.js
function (sSampleId, sIframePath) { var aIFramePathParts = sIframePath.split("/"), i; for (i = 0; i < aIFramePathParts.length - 1; i++) { if (aIFramePathParts[i] == "..") { // iframe path has parts pointing one folder up so remove last part of the sSampleId sSampleId = sSampleId.substring(0, sSampleId.lastIndexOf(".")); } else { // append the part of the iframe path to the sample's id sSampleId += "." + aIFramePathParts[i]; } } return sSampleId; }
javascript
function (sSampleId, sIframePath) { var aIFramePathParts = sIframePath.split("/"), i; for (i = 0; i < aIFramePathParts.length - 1; i++) { if (aIFramePathParts[i] == "..") { // iframe path has parts pointing one folder up so remove last part of the sSampleId sSampleId = sSampleId.substring(0, sSampleId.lastIndexOf(".")); } else { // append the part of the iframe path to the sample's id sSampleId += "." + aIFramePathParts[i]; } } return sSampleId; }
[ "function", "(", "sSampleId", ",", "sIframePath", ")", "{", "var", "aIFramePathParts", "=", "sIframePath", ".", "split", "(", "\"/\"", ")", ",", "i", ";", "for", "(", "i", "=", "0", ";", "i", "<", "aIFramePathParts", ".", "length", "-", "1", ";", "i", "++", ")", "{", "if", "(", "aIFramePathParts", "[", "i", "]", "==", "\"..\"", ")", "{", "// iframe path has parts pointing one folder up so remove last part of the sSampleId", "sSampleId", "=", "sSampleId", ".", "substring", "(", "0", ",", "sSampleId", ".", "lastIndexOf", "(", "\".\"", ")", ")", ";", "}", "else", "{", "// append the part of the iframe path to the sample's id", "sSampleId", "+=", "\".\"", "+", "aIFramePathParts", "[", "i", "]", ";", "}", "}", "return", "sSampleId", ";", "}" ]
Extends the sSampleId with the relative path defined in sIframePath and returns the resulting path. @param {string} sSampleId @param {string} sIframe @returns {string} @private
[ "Extends", "the", "sSampleId", "with", "the", "relative", "path", "defined", "in", "sIframePath", "and", "returns", "the", "resulting", "path", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.documentation/src/sap/ui/documentation/sdk/controller/Sample.controller.js#L208-L223
3,867
SAP/openui5
src/sap.ui.core/src/sap/ui/core/AppCacheBuster.js
function(oSyncPoint) { // application cachebuster mechanism (copy of array for later modification) var oConfig = oConfiguration.getAppCacheBuster(); if (oConfig && oConfig.length > 0) { oConfig = oConfig.slice(); // flag to activate the cachebuster var bActive = true; // fallback for old boolean configuration (only 1 string entry) // restriction: the values true, false and x are reserved as fallback values // and cannot be used as base url locations var sValue = String(oConfig[0]).toLowerCase(); if (oConfig.length === 1) { if (sValue === "true" || sValue === "x") { // register the current base URL (if it is a relative URL) // hint: if UI5 is referenced relative on a server it might be possible // with the mechanism to register another base URL. var oUri = URI(sOrgBaseUrl); oConfig = oUri.is("relative") ? [oUri.toString()] : []; } else if (sValue === "false") { bActive = false; } } // activate the cachebuster if (bActive) { // initialize the AppCacheBuster AppCacheBuster.init(); // register the components fnRegister(oConfig, oSyncPoint); } } }
javascript
function(oSyncPoint) { // application cachebuster mechanism (copy of array for later modification) var oConfig = oConfiguration.getAppCacheBuster(); if (oConfig && oConfig.length > 0) { oConfig = oConfig.slice(); // flag to activate the cachebuster var bActive = true; // fallback for old boolean configuration (only 1 string entry) // restriction: the values true, false and x are reserved as fallback values // and cannot be used as base url locations var sValue = String(oConfig[0]).toLowerCase(); if (oConfig.length === 1) { if (sValue === "true" || sValue === "x") { // register the current base URL (if it is a relative URL) // hint: if UI5 is referenced relative on a server it might be possible // with the mechanism to register another base URL. var oUri = URI(sOrgBaseUrl); oConfig = oUri.is("relative") ? [oUri.toString()] : []; } else if (sValue === "false") { bActive = false; } } // activate the cachebuster if (bActive) { // initialize the AppCacheBuster AppCacheBuster.init(); // register the components fnRegister(oConfig, oSyncPoint); } } }
[ "function", "(", "oSyncPoint", ")", "{", "// application cachebuster mechanism (copy of array for later modification)", "var", "oConfig", "=", "oConfiguration", ".", "getAppCacheBuster", "(", ")", ";", "if", "(", "oConfig", "&&", "oConfig", ".", "length", ">", "0", ")", "{", "oConfig", "=", "oConfig", ".", "slice", "(", ")", ";", "// flag to activate the cachebuster", "var", "bActive", "=", "true", ";", "// fallback for old boolean configuration (only 1 string entry)", "// restriction: the values true, false and x are reserved as fallback values", "// and cannot be used as base url locations", "var", "sValue", "=", "String", "(", "oConfig", "[", "0", "]", ")", ".", "toLowerCase", "(", ")", ";", "if", "(", "oConfig", ".", "length", "===", "1", ")", "{", "if", "(", "sValue", "===", "\"true\"", "||", "sValue", "===", "\"x\"", ")", "{", "// register the current base URL (if it is a relative URL)", "// hint: if UI5 is referenced relative on a server it might be possible", "// with the mechanism to register another base URL.", "var", "oUri", "=", "URI", "(", "sOrgBaseUrl", ")", ";", "oConfig", "=", "oUri", ".", "is", "(", "\"relative\"", ")", "?", "[", "oUri", ".", "toString", "(", ")", "]", ":", "[", "]", ";", "}", "else", "if", "(", "sValue", "===", "\"false\"", ")", "{", "bActive", "=", "false", ";", "}", "}", "// activate the cachebuster", "if", "(", "bActive", ")", "{", "// initialize the AppCacheBuster", "AppCacheBuster", ".", "init", "(", ")", ";", "// register the components", "fnRegister", "(", "oConfig", ",", "oSyncPoint", ")", ";", "}", "}", "}" ]
Boots the AppCacheBuster by initializing and registering the base URLs configured in the UI5 bootstrap. @param {Object} [oSyncPoint] the sync point which is used to chain the execution of the AppCacheBuster @private
[ "Boots", "the", "AppCacheBuster", "by", "initializing", "and", "registering", "the", "base", "URLs", "configured", "in", "the", "UI5", "bootstrap", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/AppCacheBuster.js#L274-L315
3,868
SAP/openui5
src/sap.ui.core/src/sap/ui/core/AppCacheBuster.js
function() { // activate the session (do not create the session for compatibility reasons with mIndex previously) oSession.active = true; // store the original function / property description to intercept fnValidateProperty = ManagedObject.prototype.validateProperty; descScriptSrc = Object.getOwnPropertyDescriptor(HTMLScriptElement.prototype, "src"); descLinkHref = Object.getOwnPropertyDescriptor(HTMLLinkElement.prototype, "href"); // function shortcuts (better performance when used frequently!) var fnConvertUrl = AppCacheBuster.convertURL; var fnNormalizeUrl = AppCacheBuster.normalizeURL; // resources URL's will be handled via standard // UI5 cachebuster mechanism (so we simply ignore them) var fnIsACBUrl = function(sUrl) { if (this.active === true && sUrl && typeof (sUrl) === "string") { sUrl = fnNormalizeUrl(sUrl); return !sUrl.match(oFilter); } return false; }.bind(oSession); // enhance xhr with appCacheBuster functionality fnXhrOpenOrig = XMLHttpRequest.prototype.open; XMLHttpRequest.prototype.open = function(sMethod, sUrl) { if (sUrl && fnIsACBUrl(sUrl)) { arguments[1] = fnConvertUrl(sUrl); } fnXhrOpenOrig.apply(this, arguments); }; fnEnhancedXhrOpen = XMLHttpRequest.prototype.open; // enhance the validateProperty function to intercept URI types // test via: new sap.ui.commons.Image({src: "acctest/img/Employee.png"}).getSrc() // new sap.ui.commons.Image({src: "./acctest/../acctest/img/Employee.png"}).getSrc() ManagedObject.prototype.validateProperty = function(sPropertyName, oValue) { var oMetadata = this.getMetadata(), oProperty = oMetadata.getProperty(sPropertyName), oArgs; if (oProperty && oProperty.type === "sap.ui.core.URI") { oArgs = Array.prototype.slice.apply(arguments); try { if (fnIsACBUrl(oArgs[1] /* oValue */)) { oArgs[1] = fnConvertUrl(oArgs[1] /* oValue */); } } catch (e) { // URI normalization or conversion failed, fall back to normal processing } } // either forward the modified or the original arguments return fnValidateProperty.apply(this, oArgs || arguments); }; // create an interceptor description which validates the value // of the setter whether to rewrite the URL or not var fnCreateInterceptorDescriptor = function(descriptor) { var newDescriptor = { get: descriptor.get, set: function(val) { if (fnIsACBUrl(val)) { val = fnConvertUrl(val); } descriptor.set.call(this, val); }, enumerable: descriptor.enumerable, configurable: descriptor.configurable }; newDescriptor.set._sapUiCoreACB = true; return newDescriptor; }; // try to setup the property descriptor interceptors (not supported on all browsers, e.g. iOS9) var bError = false; try { Object.defineProperty(HTMLScriptElement.prototype, "src", fnCreateInterceptorDescriptor(descScriptSrc)); } catch (ex) { Log.error("Your browser doesn't support redefining the src property of the script tag. Disabling AppCacheBuster as it is not supported on your browser!\nError: " + ex); bError = true; } try { Object.defineProperty(HTMLLinkElement.prototype, "href", fnCreateInterceptorDescriptor(descLinkHref)); } catch (ex) { Log.error("Your browser doesn't support redefining the href property of the link tag. Disabling AppCacheBuster as it is not supported on your browser!\nError: " + ex); bError = true; } // in case of setup issues we stop the AppCacheBuster support if (bError) { this.exit(); } }
javascript
function() { // activate the session (do not create the session for compatibility reasons with mIndex previously) oSession.active = true; // store the original function / property description to intercept fnValidateProperty = ManagedObject.prototype.validateProperty; descScriptSrc = Object.getOwnPropertyDescriptor(HTMLScriptElement.prototype, "src"); descLinkHref = Object.getOwnPropertyDescriptor(HTMLLinkElement.prototype, "href"); // function shortcuts (better performance when used frequently!) var fnConvertUrl = AppCacheBuster.convertURL; var fnNormalizeUrl = AppCacheBuster.normalizeURL; // resources URL's will be handled via standard // UI5 cachebuster mechanism (so we simply ignore them) var fnIsACBUrl = function(sUrl) { if (this.active === true && sUrl && typeof (sUrl) === "string") { sUrl = fnNormalizeUrl(sUrl); return !sUrl.match(oFilter); } return false; }.bind(oSession); // enhance xhr with appCacheBuster functionality fnXhrOpenOrig = XMLHttpRequest.prototype.open; XMLHttpRequest.prototype.open = function(sMethod, sUrl) { if (sUrl && fnIsACBUrl(sUrl)) { arguments[1] = fnConvertUrl(sUrl); } fnXhrOpenOrig.apply(this, arguments); }; fnEnhancedXhrOpen = XMLHttpRequest.prototype.open; // enhance the validateProperty function to intercept URI types // test via: new sap.ui.commons.Image({src: "acctest/img/Employee.png"}).getSrc() // new sap.ui.commons.Image({src: "./acctest/../acctest/img/Employee.png"}).getSrc() ManagedObject.prototype.validateProperty = function(sPropertyName, oValue) { var oMetadata = this.getMetadata(), oProperty = oMetadata.getProperty(sPropertyName), oArgs; if (oProperty && oProperty.type === "sap.ui.core.URI") { oArgs = Array.prototype.slice.apply(arguments); try { if (fnIsACBUrl(oArgs[1] /* oValue */)) { oArgs[1] = fnConvertUrl(oArgs[1] /* oValue */); } } catch (e) { // URI normalization or conversion failed, fall back to normal processing } } // either forward the modified or the original arguments return fnValidateProperty.apply(this, oArgs || arguments); }; // create an interceptor description which validates the value // of the setter whether to rewrite the URL or not var fnCreateInterceptorDescriptor = function(descriptor) { var newDescriptor = { get: descriptor.get, set: function(val) { if (fnIsACBUrl(val)) { val = fnConvertUrl(val); } descriptor.set.call(this, val); }, enumerable: descriptor.enumerable, configurable: descriptor.configurable }; newDescriptor.set._sapUiCoreACB = true; return newDescriptor; }; // try to setup the property descriptor interceptors (not supported on all browsers, e.g. iOS9) var bError = false; try { Object.defineProperty(HTMLScriptElement.prototype, "src", fnCreateInterceptorDescriptor(descScriptSrc)); } catch (ex) { Log.error("Your browser doesn't support redefining the src property of the script tag. Disabling AppCacheBuster as it is not supported on your browser!\nError: " + ex); bError = true; } try { Object.defineProperty(HTMLLinkElement.prototype, "href", fnCreateInterceptorDescriptor(descLinkHref)); } catch (ex) { Log.error("Your browser doesn't support redefining the href property of the link tag. Disabling AppCacheBuster as it is not supported on your browser!\nError: " + ex); bError = true; } // in case of setup issues we stop the AppCacheBuster support if (bError) { this.exit(); } }
[ "function", "(", ")", "{", "// activate the session (do not create the session for compatibility reasons with mIndex previously)", "oSession", ".", "active", "=", "true", ";", "// store the original function / property description to intercept", "fnValidateProperty", "=", "ManagedObject", ".", "prototype", ".", "validateProperty", ";", "descScriptSrc", "=", "Object", ".", "getOwnPropertyDescriptor", "(", "HTMLScriptElement", ".", "prototype", ",", "\"src\"", ")", ";", "descLinkHref", "=", "Object", ".", "getOwnPropertyDescriptor", "(", "HTMLLinkElement", ".", "prototype", ",", "\"href\"", ")", ";", "// function shortcuts (better performance when used frequently!)", "var", "fnConvertUrl", "=", "AppCacheBuster", ".", "convertURL", ";", "var", "fnNormalizeUrl", "=", "AppCacheBuster", ".", "normalizeURL", ";", "// resources URL's will be handled via standard", "// UI5 cachebuster mechanism (so we simply ignore them)", "var", "fnIsACBUrl", "=", "function", "(", "sUrl", ")", "{", "if", "(", "this", ".", "active", "===", "true", "&&", "sUrl", "&&", "typeof", "(", "sUrl", ")", "===", "\"string\"", ")", "{", "sUrl", "=", "fnNormalizeUrl", "(", "sUrl", ")", ";", "return", "!", "sUrl", ".", "match", "(", "oFilter", ")", ";", "}", "return", "false", ";", "}", ".", "bind", "(", "oSession", ")", ";", "// enhance xhr with appCacheBuster functionality", "fnXhrOpenOrig", "=", "XMLHttpRequest", ".", "prototype", ".", "open", ";", "XMLHttpRequest", ".", "prototype", ".", "open", "=", "function", "(", "sMethod", ",", "sUrl", ")", "{", "if", "(", "sUrl", "&&", "fnIsACBUrl", "(", "sUrl", ")", ")", "{", "arguments", "[", "1", "]", "=", "fnConvertUrl", "(", "sUrl", ")", ";", "}", "fnXhrOpenOrig", ".", "apply", "(", "this", ",", "arguments", ")", ";", "}", ";", "fnEnhancedXhrOpen", "=", "XMLHttpRequest", ".", "prototype", ".", "open", ";", "// enhance the validateProperty function to intercept URI types", "// test via: new sap.ui.commons.Image({src: \"acctest/img/Employee.png\"}).getSrc()", "// new sap.ui.commons.Image({src: \"./acctest/../acctest/img/Employee.png\"}).getSrc()", "ManagedObject", ".", "prototype", ".", "validateProperty", "=", "function", "(", "sPropertyName", ",", "oValue", ")", "{", "var", "oMetadata", "=", "this", ".", "getMetadata", "(", ")", ",", "oProperty", "=", "oMetadata", ".", "getProperty", "(", "sPropertyName", ")", ",", "oArgs", ";", "if", "(", "oProperty", "&&", "oProperty", ".", "type", "===", "\"sap.ui.core.URI\"", ")", "{", "oArgs", "=", "Array", ".", "prototype", ".", "slice", ".", "apply", "(", "arguments", ")", ";", "try", "{", "if", "(", "fnIsACBUrl", "(", "oArgs", "[", "1", "]", "/* oValue */", ")", ")", "{", "oArgs", "[", "1", "]", "=", "fnConvertUrl", "(", "oArgs", "[", "1", "]", "/* oValue */", ")", ";", "}", "}", "catch", "(", "e", ")", "{", "// URI normalization or conversion failed, fall back to normal processing", "}", "}", "// either forward the modified or the original arguments", "return", "fnValidateProperty", ".", "apply", "(", "this", ",", "oArgs", "||", "arguments", ")", ";", "}", ";", "// create an interceptor description which validates the value", "// of the setter whether to rewrite the URL or not", "var", "fnCreateInterceptorDescriptor", "=", "function", "(", "descriptor", ")", "{", "var", "newDescriptor", "=", "{", "get", ":", "descriptor", ".", "get", ",", "set", ":", "function", "(", "val", ")", "{", "if", "(", "fnIsACBUrl", "(", "val", ")", ")", "{", "val", "=", "fnConvertUrl", "(", "val", ")", ";", "}", "descriptor", ".", "set", ".", "call", "(", "this", ",", "val", ")", ";", "}", ",", "enumerable", ":", "descriptor", ".", "enumerable", ",", "configurable", ":", "descriptor", ".", "configurable", "}", ";", "newDescriptor", ".", "set", ".", "_sapUiCoreACB", "=", "true", ";", "return", "newDescriptor", ";", "}", ";", "// try to setup the property descriptor interceptors (not supported on all browsers, e.g. iOS9)", "var", "bError", "=", "false", ";", "try", "{", "Object", ".", "defineProperty", "(", "HTMLScriptElement", ".", "prototype", ",", "\"src\"", ",", "fnCreateInterceptorDescriptor", "(", "descScriptSrc", ")", ")", ";", "}", "catch", "(", "ex", ")", "{", "Log", ".", "error", "(", "\"Your browser doesn't support redefining the src property of the script tag. Disabling AppCacheBuster as it is not supported on your browser!\\nError: \"", "+", "ex", ")", ";", "bError", "=", "true", ";", "}", "try", "{", "Object", ".", "defineProperty", "(", "HTMLLinkElement", ".", "prototype", ",", "\"href\"", ",", "fnCreateInterceptorDescriptor", "(", "descLinkHref", ")", ")", ";", "}", "catch", "(", "ex", ")", "{", "Log", ".", "error", "(", "\"Your browser doesn't support redefining the href property of the link tag. Disabling AppCacheBuster as it is not supported on your browser!\\nError: \"", "+", "ex", ")", ";", "bError", "=", "true", ";", "}", "// in case of setup issues we stop the AppCacheBuster support", "if", "(", "bError", ")", "{", "this", ".", "exit", "(", ")", ";", "}", "}" ]
Initializes the AppCacheBuster. Hooks into the relevant functions in the Core to intercept the code which are dealing with URLs and converts those URLs into cachebuster URLs. The intercepted functions are: <ul> <li><code>XMLHttpRequest.prototype.open</code></li> <li><code>HTMLScriptElement.prototype.src</code></li> <li><code>HTMLLinkElement.prototype.href</code></li> <li><code>sap.ui.base.ManagedObject.prototype.validateProperty</code></li> </ul> @private
[ "Initializes", "the", "AppCacheBuster", ".", "Hooks", "into", "the", "relevant", "functions", "in", "the", "Core", "to", "intercept", "the", "code", "which", "are", "dealing", "with", "URLs", "and", "converts", "those", "URLs", "into", "cachebuster", "URLs", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/AppCacheBuster.js#L332-L425
3,869
SAP/openui5
src/sap.ui.core/src/sap/ui/core/AppCacheBuster.js
function(descriptor) { var newDescriptor = { get: descriptor.get, set: function(val) { if (fnIsACBUrl(val)) { val = fnConvertUrl(val); } descriptor.set.call(this, val); }, enumerable: descriptor.enumerable, configurable: descriptor.configurable }; newDescriptor.set._sapUiCoreACB = true; return newDescriptor; }
javascript
function(descriptor) { var newDescriptor = { get: descriptor.get, set: function(val) { if (fnIsACBUrl(val)) { val = fnConvertUrl(val); } descriptor.set.call(this, val); }, enumerable: descriptor.enumerable, configurable: descriptor.configurable }; newDescriptor.set._sapUiCoreACB = true; return newDescriptor; }
[ "function", "(", "descriptor", ")", "{", "var", "newDescriptor", "=", "{", "get", ":", "descriptor", ".", "get", ",", "set", ":", "function", "(", "val", ")", "{", "if", "(", "fnIsACBUrl", "(", "val", ")", ")", "{", "val", "=", "fnConvertUrl", "(", "val", ")", ";", "}", "descriptor", ".", "set", ".", "call", "(", "this", ",", "val", ")", ";", "}", ",", "enumerable", ":", "descriptor", ".", "enumerable", ",", "configurable", ":", "descriptor", ".", "configurable", "}", ";", "newDescriptor", ".", "set", ".", "_sapUiCoreACB", "=", "true", ";", "return", "newDescriptor", ";", "}" ]
create an interceptor description which validates the value of the setter whether to rewrite the URL or not
[ "create", "an", "interceptor", "description", "which", "validates", "the", "value", "of", "the", "setter", "whether", "to", "rewrite", "the", "URL", "or", "not" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/AppCacheBuster.js#L389-L403
3,870
SAP/openui5
src/sap.ui.core/src/sap/ui/core/AppCacheBuster.js
function() { // remove the function interceptions ManagedObject.prototype.validateProperty = fnValidateProperty; // only remove xhr interception if xhr#open was not modified meanwhile if (XMLHttpRequest.prototype.open === fnEnhancedXhrOpen) { XMLHttpRequest.prototype.open = fnXhrOpenOrig; } // remove the property descriptor interceptions (but only if not overridden again) var descriptor; if ((descriptor = Object.getOwnPropertyDescriptor(HTMLScriptElement.prototype, "src")) && descriptor.set && descriptor.set._sapUiCoreACB === true) { Object.defineProperty(HTMLScriptElement.prototype, "src", descScriptSrc); } if ((descriptor = Object.getOwnPropertyDescriptor(HTMLLinkElement.prototype, "href")) && descriptor.set && descriptor.set._sapUiCoreACB === true) { Object.defineProperty(HTMLLinkElement.prototype, "href", descLinkHref); } // clear the session (disables URL rewrite for session) oSession.index = {}; oSession.active = false; // create a new session for the next initialization oSession = { index: {}, active: false }; }
javascript
function() { // remove the function interceptions ManagedObject.prototype.validateProperty = fnValidateProperty; // only remove xhr interception if xhr#open was not modified meanwhile if (XMLHttpRequest.prototype.open === fnEnhancedXhrOpen) { XMLHttpRequest.prototype.open = fnXhrOpenOrig; } // remove the property descriptor interceptions (but only if not overridden again) var descriptor; if ((descriptor = Object.getOwnPropertyDescriptor(HTMLScriptElement.prototype, "src")) && descriptor.set && descriptor.set._sapUiCoreACB === true) { Object.defineProperty(HTMLScriptElement.prototype, "src", descScriptSrc); } if ((descriptor = Object.getOwnPropertyDescriptor(HTMLLinkElement.prototype, "href")) && descriptor.set && descriptor.set._sapUiCoreACB === true) { Object.defineProperty(HTMLLinkElement.prototype, "href", descLinkHref); } // clear the session (disables URL rewrite for session) oSession.index = {}; oSession.active = false; // create a new session for the next initialization oSession = { index: {}, active: false }; }
[ "function", "(", ")", "{", "// remove the function interceptions", "ManagedObject", ".", "prototype", ".", "validateProperty", "=", "fnValidateProperty", ";", "// only remove xhr interception if xhr#open was not modified meanwhile", "if", "(", "XMLHttpRequest", ".", "prototype", ".", "open", "===", "fnEnhancedXhrOpen", ")", "{", "XMLHttpRequest", ".", "prototype", ".", "open", "=", "fnXhrOpenOrig", ";", "}", "// remove the property descriptor interceptions (but only if not overridden again)", "var", "descriptor", ";", "if", "(", "(", "descriptor", "=", "Object", ".", "getOwnPropertyDescriptor", "(", "HTMLScriptElement", ".", "prototype", ",", "\"src\"", ")", ")", "&&", "descriptor", ".", "set", "&&", "descriptor", ".", "set", ".", "_sapUiCoreACB", "===", "true", ")", "{", "Object", ".", "defineProperty", "(", "HTMLScriptElement", ".", "prototype", ",", "\"src\"", ",", "descScriptSrc", ")", ";", "}", "if", "(", "(", "descriptor", "=", "Object", ".", "getOwnPropertyDescriptor", "(", "HTMLLinkElement", ".", "prototype", ",", "\"href\"", ")", ")", "&&", "descriptor", ".", "set", "&&", "descriptor", ".", "set", ".", "_sapUiCoreACB", "===", "true", ")", "{", "Object", ".", "defineProperty", "(", "HTMLLinkElement", ".", "prototype", ",", "\"href\"", ",", "descLinkHref", ")", ";", "}", "// clear the session (disables URL rewrite for session)", "oSession", ".", "index", "=", "{", "}", ";", "oSession", ".", "active", "=", "false", ";", "// create a new session for the next initialization", "oSession", "=", "{", "index", ":", "{", "}", ",", "active", ":", "false", "}", ";", "}" ]
Terminates the AppCacheBuster and removes the hooks from the URL specific functions. This will also clear the index which is used to prefix matching URLs. @private
[ "Terminates", "the", "AppCacheBuster", "and", "removes", "the", "hooks", "from", "the", "URL", "specific", "functions", ".", "This", "will", "also", "clear", "the", "index", "which", "is", "used", "to", "prefix", "matching", "URLs", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/AppCacheBuster.js#L434-L463
3,871
SAP/openui5
src/sap.ui.core/src/sap/ui/core/AppCacheBuster.js
function(sUrl) { // local resources are registered with "./" => we remove the leading "./"! // (code location for this: sap/ui/Global.js:sap.ui.localResources) // we by default normalize all relative URLs for a common base var oUri = URI(sUrl || "./"); if (oUri.is("relative")) { //(sUrl.match(/^\.\/|\..\//g)) { oUri = oUri.absoluteTo(sLocation); } //return oUri.normalize().toString(); // prevent to normalize the search and hash to avoid "+" in the search string // because for search strings the space will be normalized as "+" return oUri.normalizeProtocol().normalizeHostname().normalizePort().normalizePath().toString(); }
javascript
function(sUrl) { // local resources are registered with "./" => we remove the leading "./"! // (code location for this: sap/ui/Global.js:sap.ui.localResources) // we by default normalize all relative URLs for a common base var oUri = URI(sUrl || "./"); if (oUri.is("relative")) { //(sUrl.match(/^\.\/|\..\//g)) { oUri = oUri.absoluteTo(sLocation); } //return oUri.normalize().toString(); // prevent to normalize the search and hash to avoid "+" in the search string // because for search strings the space will be normalized as "+" return oUri.normalizeProtocol().normalizeHostname().normalizePort().normalizePath().toString(); }
[ "function", "(", "sUrl", ")", "{", "// local resources are registered with \"./\" => we remove the leading \"./\"!", "// (code location for this: sap/ui/Global.js:sap.ui.localResources)", "// we by default normalize all relative URLs for a common base", "var", "oUri", "=", "URI", "(", "sUrl", "||", "\"./\"", ")", ";", "if", "(", "oUri", ".", "is", "(", "\"relative\"", ")", ")", "{", "//(sUrl.match(/^\\.\\/|\\..\\//g)) {", "oUri", "=", "oUri", ".", "absoluteTo", "(", "sLocation", ")", ";", "}", "//return oUri.normalize().toString();", "// prevent to normalize the search and hash to avoid \"+\" in the search string", "// because for search strings the space will be normalized as \"+\"", "return", "oUri", ".", "normalizeProtocol", "(", ")", ".", "normalizeHostname", "(", ")", ".", "normalizePort", "(", ")", ".", "normalizePath", "(", ")", ".", "toString", "(", ")", ";", "}" ]
Normalizes the given URL and make it absolute. @param {string} sUrl any URL @return {string} normalized URL @public
[ "Normalizes", "the", "given", "URL", "and", "make", "it", "absolute", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/AppCacheBuster.js#L540-L554
3,872
SAP/openui5
src/sap.ui.core/src/sap/ui/model/Model.js
_traverseFilter
function _traverseFilter (vFilters, fnCheck) { vFilters = vFilters || []; if (vFilters instanceof Filter) { vFilters = [vFilters]; } // filter has more sub-filter instances (we ignore the subfilters below the any/all operators) for (var i = 0; i < vFilters.length; i++) { // check single Filter var oFilter = vFilters[i]; fnCheck(oFilter); // check subfilter for lambda expressions (e.g. Any, All, ...) _traverseFilter(oFilter.oCondition, fnCheck); // check multi filter if necessary _traverseFilter(oFilter.aFilters, fnCheck); } }
javascript
function _traverseFilter (vFilters, fnCheck) { vFilters = vFilters || []; if (vFilters instanceof Filter) { vFilters = [vFilters]; } // filter has more sub-filter instances (we ignore the subfilters below the any/all operators) for (var i = 0; i < vFilters.length; i++) { // check single Filter var oFilter = vFilters[i]; fnCheck(oFilter); // check subfilter for lambda expressions (e.g. Any, All, ...) _traverseFilter(oFilter.oCondition, fnCheck); // check multi filter if necessary _traverseFilter(oFilter.aFilters, fnCheck); } }
[ "function", "_traverseFilter", "(", "vFilters", ",", "fnCheck", ")", "{", "vFilters", "=", "vFilters", "||", "[", "]", ";", "if", "(", "vFilters", "instanceof", "Filter", ")", "{", "vFilters", "=", "[", "vFilters", "]", ";", "}", "// filter has more sub-filter instances (we ignore the subfilters below the any/all operators)", "for", "(", "var", "i", "=", "0", ";", "i", "<", "vFilters", ".", "length", ";", "i", "++", ")", "{", "// check single Filter", "var", "oFilter", "=", "vFilters", "[", "i", "]", ";", "fnCheck", "(", "oFilter", ")", ";", "// check subfilter for lambda expressions (e.g. Any, All, ...)", "_traverseFilter", "(", "oFilter", ".", "oCondition", ",", "fnCheck", ")", ";", "// check multi filter if necessary", "_traverseFilter", "(", "oFilter", ".", "aFilters", ",", "fnCheck", ")", ";", "}", "}" ]
Traverses the given filter tree. @param {sap.ui.model.Filter[]|sap.ui.model.Filter} vFilters Array of filters or a single filter instance, which will be checked for unsupported filter operators @param {function} fnCheck Check function which is called for each filter instance in the tree @private
[ "Traverses", "the", "given", "filter", "tree", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/Model.js#L1030-L1049
3,873
SAP/openui5
src/sap.ui.dt/src/sap/ui/dt/util/ZIndexManager.js
function () { //get all open popups from InstanceManager var aAllOpenPopups = fnGetPopups(); var aValidatedPopups = []; var aInvalidatedPopups = []; aAllOpenPopups.forEach(function(oOpenPopup) { // check if non-adaptable popup var bValid = _aPopupFilters.every(function (fnFilter) { return fnFilter(oOpenPopup); }); bValid && _aPopupFilters.length > 0 ? aValidatedPopups.push(oOpenPopup) : aInvalidatedPopups.push(oOpenPopup); }); // get max Z-Index from validated popups var iMaxValidatedZIndex = aValidatedPopups.length > 0 ? Math.max.apply(null, fnGetZIndexFromPopups(aValidatedPopups)) : -1; // get minimum Z-Index from invalidated popups var iMinInvalidatedZIndex = aInvalidatedPopups.length > 0 ? Math.min.apply(null, fnGetZIndexFromPopups(aInvalidatedPopups)) : -1; // compare Z-Index of adaptable and non-adaptable popups - the higher one wins if (iMaxValidatedZIndex < iMinInvalidatedZIndex) { return this._getNextMinZIndex(iMinInvalidatedZIndex); } else { return Popup.getNextZIndex(); } }
javascript
function () { //get all open popups from InstanceManager var aAllOpenPopups = fnGetPopups(); var aValidatedPopups = []; var aInvalidatedPopups = []; aAllOpenPopups.forEach(function(oOpenPopup) { // check if non-adaptable popup var bValid = _aPopupFilters.every(function (fnFilter) { return fnFilter(oOpenPopup); }); bValid && _aPopupFilters.length > 0 ? aValidatedPopups.push(oOpenPopup) : aInvalidatedPopups.push(oOpenPopup); }); // get max Z-Index from validated popups var iMaxValidatedZIndex = aValidatedPopups.length > 0 ? Math.max.apply(null, fnGetZIndexFromPopups(aValidatedPopups)) : -1; // get minimum Z-Index from invalidated popups var iMinInvalidatedZIndex = aInvalidatedPopups.length > 0 ? Math.min.apply(null, fnGetZIndexFromPopups(aInvalidatedPopups)) : -1; // compare Z-Index of adaptable and non-adaptable popups - the higher one wins if (iMaxValidatedZIndex < iMinInvalidatedZIndex) { return this._getNextMinZIndex(iMinInvalidatedZIndex); } else { return Popup.getNextZIndex(); } }
[ "function", "(", ")", "{", "//get all open popups from InstanceManager", "var", "aAllOpenPopups", "=", "fnGetPopups", "(", ")", ";", "var", "aValidatedPopups", "=", "[", "]", ";", "var", "aInvalidatedPopups", "=", "[", "]", ";", "aAllOpenPopups", ".", "forEach", "(", "function", "(", "oOpenPopup", ")", "{", "// check if non-adaptable popup", "var", "bValid", "=", "_aPopupFilters", ".", "every", "(", "function", "(", "fnFilter", ")", "{", "return", "fnFilter", "(", "oOpenPopup", ")", ";", "}", ")", ";", "bValid", "&&", "_aPopupFilters", ".", "length", ">", "0", "?", "aValidatedPopups", ".", "push", "(", "oOpenPopup", ")", ":", "aInvalidatedPopups", ".", "push", "(", "oOpenPopup", ")", ";", "}", ")", ";", "// get max Z-Index from validated popups", "var", "iMaxValidatedZIndex", "=", "aValidatedPopups", ".", "length", ">", "0", "?", "Math", ".", "max", ".", "apply", "(", "null", ",", "fnGetZIndexFromPopups", "(", "aValidatedPopups", ")", ")", ":", "-", "1", ";", "// get minimum Z-Index from invalidated popups", "var", "iMinInvalidatedZIndex", "=", "aInvalidatedPopups", ".", "length", ">", "0", "?", "Math", ".", "min", ".", "apply", "(", "null", ",", "fnGetZIndexFromPopups", "(", "aInvalidatedPopups", ")", ")", ":", "-", "1", ";", "// compare Z-Index of adaptable and non-adaptable popups - the higher one wins", "if", "(", "iMaxValidatedZIndex", "<", "iMinInvalidatedZIndex", ")", "{", "return", "this", ".", "_getNextMinZIndex", "(", "iMinInvalidatedZIndex", ")", ";", "}", "else", "{", "return", "Popup", ".", "getNextZIndex", "(", ")", ";", "}", "}" ]
Calculates the reliable z-index in the current window considering the global BusyIndicator dialog. Algorithm: 1) When popups are already open on the screen: the highest z-index of validated popups is compared with the lowest z-index of invalidated popups. The invalidated popups also include any BusyIndicator that might be open. 2) If the invalidated popups have the higher value then the next z-index is first decremented by 10, which gives the last popup z-index and then 1 is added to it. 3) After incrementing 1 in Step 2), the resultant z-index value is compared against an array of assigned z-index values by the ZIndexManager. Step 3) is repeated as long as it stays under a max value and a unique value is calculated. The max value is the next possible popup z-index - 3 (hardcoded by variable Z_INDICES_RESERVED). Example: when BusyIndicator has a z-index 100, then available indexes are: 91, 92, 93, 94, 95, 96, 97. Indexes 98 & 99 are used by BusyIndicator internally, therefore we can't rely on them. The reason we start from the index 91 is that in sap.ui.core.Popup.getNextZIndex() there is a hardcoded step with a value 10 which means there are only 10 reliable indexes between the opened BusyIndicator and the previous absolutely positioned element on the screen; 4) If no popups are open or if validated popups have a higher z-index, then simply the next possible z-index is returned by calling sap.ui.core.Popup.getNextZIndex(). @returns {int} the next available z-index value @public
[ "Calculates", "the", "reliable", "z", "-", "index", "in", "the", "current", "window", "considering", "the", "global", "BusyIndicator", "dialog", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.dt/src/sap/ui/dt/util/ZIndexManager.js#L97-L129
3,874
SAP/openui5
src/sap.ui.dt/src/sap/ui/dt/util/ZIndexManager.js
function (iCurrent) { // deduct indices reserved from current z-index var iMaxZIndex = iCurrent - Z_INDICES_RESERVED; // initial minimum z-index var iMinZIndex = iCurrent - Z_INDEX_STEP; var iNextZIndex = fnGetLastZIndex(iMinZIndex, iMaxZIndex, aAssignedZIndices); aAssignedZIndices.push(iNextZIndex); return iNextZIndex; }
javascript
function (iCurrent) { // deduct indices reserved from current z-index var iMaxZIndex = iCurrent - Z_INDICES_RESERVED; // initial minimum z-index var iMinZIndex = iCurrent - Z_INDEX_STEP; var iNextZIndex = fnGetLastZIndex(iMinZIndex, iMaxZIndex, aAssignedZIndices); aAssignedZIndices.push(iNextZIndex); return iNextZIndex; }
[ "function", "(", "iCurrent", ")", "{", "// deduct indices reserved from current z-index", "var", "iMaxZIndex", "=", "iCurrent", "-", "Z_INDICES_RESERVED", ";", "// initial minimum z-index", "var", "iMinZIndex", "=", "iCurrent", "-", "Z_INDEX_STEP", ";", "var", "iNextZIndex", "=", "fnGetLastZIndex", "(", "iMinZIndex", ",", "iMaxZIndex", ",", "aAssignedZIndices", ")", ";", "aAssignedZIndices", ".", "push", "(", "iNextZIndex", ")", ";", "return", "iNextZIndex", ";", "}" ]
Returns the next minimum possible z-index based on the passed z-index value. @param {int} iCurrent Current z-index value @returns {int} The next minimum z-index value @private
[ "Returns", "the", "next", "minimum", "possible", "z", "-", "index", "based", "on", "the", "passed", "z", "-", "index", "value", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.dt/src/sap/ui/dt/util/ZIndexManager.js#L185-L193
3,875
SAP/openui5
src/sap.ui.core/src/sap/ui/performance/trace/FESR.js
setClientDevice
function setClientDevice() { var iClientId = 0; if (Device.system.combi) { iClientId = 1; } else if (Device.system.desktop) { iClientId = 2; } else if (Device.system.tablet) { iClientId = 4; } else if (Device.system.phone) { iClientId = 3; } return iClientId; }
javascript
function setClientDevice() { var iClientId = 0; if (Device.system.combi) { iClientId = 1; } else if (Device.system.desktop) { iClientId = 2; } else if (Device.system.tablet) { iClientId = 4; } else if (Device.system.phone) { iClientId = 3; } return iClientId; }
[ "function", "setClientDevice", "(", ")", "{", "var", "iClientId", "=", "0", ";", "if", "(", "Device", ".", "system", ".", "combi", ")", "{", "iClientId", "=", "1", ";", "}", "else", "if", "(", "Device", ".", "system", ".", "desktop", ")", "{", "iClientId", "=", "2", ";", "}", "else", "if", "(", "Device", ".", "system", ".", "tablet", ")", "{", "iClientId", "=", "4", ";", "}", "else", "if", "(", "Device", ".", "system", ".", "phone", ")", "{", "iClientId", "=", "3", ";", "}", "return", "iClientId", ";", "}" ]
current header string
[ "current", "header", "string" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/performance/trace/FESR.js#L33-L45
3,876
SAP/openui5
src/sap.ui.core/src/sap/ui/performance/trace/FESR.js
createFESR
function createFESR(oInteraction, oFESRHandle) { return [ format(ROOT_ID, 32), // root_context_id format(sFESRTransactionId, 32), // transaction_id format(oInteraction.navigation, 16), // client_navigation_time format(oInteraction.roundtrip, 16), // client_round_trip_time format(oFESRHandle.timeToInteractive, 16), // end_to_end_time format(oInteraction.completeRoundtrips, 8), // completed network_round_trips format(sPassportAction, 40), // passport_action format(oInteraction.networkTime, 16), // network_time format(oInteraction.requestTime, 16), // request_time format(CLIENT_OS, 20), // client_os "SAP_UI5" // client_type ].join(","); }
javascript
function createFESR(oInteraction, oFESRHandle) { return [ format(ROOT_ID, 32), // root_context_id format(sFESRTransactionId, 32), // transaction_id format(oInteraction.navigation, 16), // client_navigation_time format(oInteraction.roundtrip, 16), // client_round_trip_time format(oFESRHandle.timeToInteractive, 16), // end_to_end_time format(oInteraction.completeRoundtrips, 8), // completed network_round_trips format(sPassportAction, 40), // passport_action format(oInteraction.networkTime, 16), // network_time format(oInteraction.requestTime, 16), // request_time format(CLIENT_OS, 20), // client_os "SAP_UI5" // client_type ].join(","); }
[ "function", "createFESR", "(", "oInteraction", ",", "oFESRHandle", ")", "{", "return", "[", "format", "(", "ROOT_ID", ",", "32", ")", ",", "// root_context_id", "format", "(", "sFESRTransactionId", ",", "32", ")", ",", "// transaction_id", "format", "(", "oInteraction", ".", "navigation", ",", "16", ")", ",", "// client_navigation_time", "format", "(", "oInteraction", ".", "roundtrip", ",", "16", ")", ",", "// client_round_trip_time", "format", "(", "oFESRHandle", ".", "timeToInteractive", ",", "16", ")", ",", "// end_to_end_time", "format", "(", "oInteraction", ".", "completeRoundtrips", ",", "8", ")", ",", "// completed network_round_trips", "format", "(", "sPassportAction", ",", "40", ")", ",", "// passport_action", "format", "(", "oInteraction", ".", "networkTime", ",", "16", ")", ",", "// network_time", "format", "(", "oInteraction", ".", "requestTime", ",", "16", ")", ",", "// request_time", "format", "(", "CLIENT_OS", ",", "20", ")", ",", "// client_os", "\"SAP_UI5\"", "// client_type", "]", ".", "join", "(", "\",\"", ")", ";", "}" ]
creates mandatory FESR header string
[ "creates", "mandatory", "FESR", "header", "string" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/performance/trace/FESR.js#L109-L123
3,877
SAP/openui5
src/sap.ui.core/src/sap/ui/performance/trace/FESR.js
createFESRopt
function createFESRopt(oInteraction, oFESRHandle) { return [ format(oFESRHandle.appNameShort, 20, true), // application_name format(oFESRHandle.stepName, 20, true), // step_name "", // not assigned format(CLIENT_MODEL, 20), // client_model format(oInteraction.bytesSent, 16), // client_data_sent format(oInteraction.bytesReceived, 16), // client_data_received "", // network_protocol "", // network_provider format(oInteraction.processing, 16), // client_processing_time oInteraction.requestCompression ? "X" : "", // compressed - empty if not compressed "", // not assigned "", // persistency_accesses "", // persistency_time "", // persistency_data_transferred format(oInteraction.busyDuration, 16), // extension_1 - busy duration "", // extension_2 format(CLIENT_DEVICE, 1), // extension_3 - client device "", // extension_4 format(formatInteractionStartTimestamp(oInteraction.start), 20), // extension_5 - interaction start time format(oFESRHandle.appNameLong, 70, true) // application_name with 70 characters, trimmed from left ].join(","); }
javascript
function createFESRopt(oInteraction, oFESRHandle) { return [ format(oFESRHandle.appNameShort, 20, true), // application_name format(oFESRHandle.stepName, 20, true), // step_name "", // not assigned format(CLIENT_MODEL, 20), // client_model format(oInteraction.bytesSent, 16), // client_data_sent format(oInteraction.bytesReceived, 16), // client_data_received "", // network_protocol "", // network_provider format(oInteraction.processing, 16), // client_processing_time oInteraction.requestCompression ? "X" : "", // compressed - empty if not compressed "", // not assigned "", // persistency_accesses "", // persistency_time "", // persistency_data_transferred format(oInteraction.busyDuration, 16), // extension_1 - busy duration "", // extension_2 format(CLIENT_DEVICE, 1), // extension_3 - client device "", // extension_4 format(formatInteractionStartTimestamp(oInteraction.start), 20), // extension_5 - interaction start time format(oFESRHandle.appNameLong, 70, true) // application_name with 70 characters, trimmed from left ].join(","); }
[ "function", "createFESRopt", "(", "oInteraction", ",", "oFESRHandle", ")", "{", "return", "[", "format", "(", "oFESRHandle", ".", "appNameShort", ",", "20", ",", "true", ")", ",", "// application_name", "format", "(", "oFESRHandle", ".", "stepName", ",", "20", ",", "true", ")", ",", "// step_name", "\"\"", ",", "// not assigned", "format", "(", "CLIENT_MODEL", ",", "20", ")", ",", "// client_model", "format", "(", "oInteraction", ".", "bytesSent", ",", "16", ")", ",", "// client_data_sent", "format", "(", "oInteraction", ".", "bytesReceived", ",", "16", ")", ",", "// client_data_received", "\"\"", ",", "// network_protocol", "\"\"", ",", "// network_provider", "format", "(", "oInteraction", ".", "processing", ",", "16", ")", ",", "// client_processing_time", "oInteraction", ".", "requestCompression", "?", "\"X\"", ":", "\"\"", ",", "// compressed - empty if not compressed", "\"\"", ",", "// not assigned", "\"\"", ",", "// persistency_accesses", "\"\"", ",", "// persistency_time", "\"\"", ",", "// persistency_data_transferred", "format", "(", "oInteraction", ".", "busyDuration", ",", "16", ")", ",", "// extension_1 - busy duration", "\"\"", ",", "// extension_2", "format", "(", "CLIENT_DEVICE", ",", "1", ")", ",", "// extension_3 - client device", "\"\"", ",", "// extension_4", "format", "(", "formatInteractionStartTimestamp", "(", "oInteraction", ".", "start", ")", ",", "20", ")", ",", "// extension_5 - interaction start time", "format", "(", "oFESRHandle", ".", "appNameLong", ",", "70", ",", "true", ")", "// application_name with 70 characters, trimmed from left", "]", ".", "join", "(", "\",\"", ")", ";", "}" ]
creates optional FESR header string
[ "creates", "optional", "FESR", "header", "string" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/performance/trace/FESR.js#L126-L149
3,878
SAP/openui5
src/sap.ui.core/src/sap/ui/performance/trace/FESR.js
format
function format(vField, iLength, bCutFromFront) { if (!vField) { vField = vField === 0 ? "0" : ""; } else if (typeof vField === "number") { var iField = vField; vField = Math.round(vField).toString(); // Calculation of figures may be erroneous because incomplete performance entries lead to negative // numbers. In that case we set a -1, so the "dirty" record can be identified as such. if (vField.length > iLength || iField < 0) { vField = "-1"; } } else { vField = bCutFromFront ? vField.substr(-iLength, iLength) : vField.substr(0, iLength); } return vField; }
javascript
function format(vField, iLength, bCutFromFront) { if (!vField) { vField = vField === 0 ? "0" : ""; } else if (typeof vField === "number") { var iField = vField; vField = Math.round(vField).toString(); // Calculation of figures may be erroneous because incomplete performance entries lead to negative // numbers. In that case we set a -1, so the "dirty" record can be identified as such. if (vField.length > iLength || iField < 0) { vField = "-1"; } } else { vField = bCutFromFront ? vField.substr(-iLength, iLength) : vField.substr(0, iLength); } return vField; }
[ "function", "format", "(", "vField", ",", "iLength", ",", "bCutFromFront", ")", "{", "if", "(", "!", "vField", ")", "{", "vField", "=", "vField", "===", "0", "?", "\"0\"", ":", "\"\"", ";", "}", "else", "if", "(", "typeof", "vField", "===", "\"number\"", ")", "{", "var", "iField", "=", "vField", ";", "vField", "=", "Math", ".", "round", "(", "vField", ")", ".", "toString", "(", ")", ";", "// Calculation of figures may be erroneous because incomplete performance entries lead to negative", "// numbers. In that case we set a -1, so the \"dirty\" record can be identified as such.", "if", "(", "vField", ".", "length", ">", "iLength", "||", "iField", "<", "0", ")", "{", "vField", "=", "\"-1\"", ";", "}", "}", "else", "{", "vField", "=", "bCutFromFront", "?", "vField", ".", "substr", "(", "-", "iLength", ",", "iLength", ")", ":", "vField", ".", "substr", "(", "0", ",", "iLength", ")", ";", "}", "return", "vField", ";", "}" ]
format string to fesr compliant string
[ "format", "string", "to", "fesr", "compliant", "string" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/performance/trace/FESR.js#L152-L167
3,879
SAP/openui5
src/sap.ui.fl/src/sap/ui/fl/variants/util/VariantUtil.js
function(oComponent) { var aTechnicalParameters = flUtils.getTechnicalParametersForComponent(oComponent); return aTechnicalParameters && aTechnicalParameters[VariantUtil.variantTechnicalParameterName] && Array.isArray(aTechnicalParameters[VariantUtil.variantTechnicalParameterName]) && aTechnicalParameters[VariantUtil.variantTechnicalParameterName][0]; }
javascript
function(oComponent) { var aTechnicalParameters = flUtils.getTechnicalParametersForComponent(oComponent); return aTechnicalParameters && aTechnicalParameters[VariantUtil.variantTechnicalParameterName] && Array.isArray(aTechnicalParameters[VariantUtil.variantTechnicalParameterName]) && aTechnicalParameters[VariantUtil.variantTechnicalParameterName][0]; }
[ "function", "(", "oComponent", ")", "{", "var", "aTechnicalParameters", "=", "flUtils", ".", "getTechnicalParametersForComponent", "(", "oComponent", ")", ";", "return", "aTechnicalParameters", "&&", "aTechnicalParameters", "[", "VariantUtil", ".", "variantTechnicalParameterName", "]", "&&", "Array", ".", "isArray", "(", "aTechnicalParameters", "[", "VariantUtil", ".", "variantTechnicalParameterName", "]", ")", "&&", "aTechnicalParameters", "[", "VariantUtil", ".", "variantTechnicalParameterName", "]", "[", "0", "]", ";", "}" ]
Returns control variant technical parameter for the passed component. @param {object} oComponent - Component instance used to get the technical parameters @returns {string|undefined} Returns the control variant technical parameter
[ "Returns", "control", "variant", "technical", "parameter", "for", "the", "passed", "component", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.fl/src/sap/ui/fl/variants/util/VariantUtil.js#L118-L124
3,880
SAP/openui5
src/sap.ui.table/src/sap/ui/table/TablePointerExtension.js
function() { this._ExtensionHelper = ExtensionHelper; this._ColumnResizeHelper = ColumnResizeHelper; this._InteractiveResizeHelper = InteractiveResizeHelper; this._ReorderHelper = ReorderHelper; this._ExtensionDelegate = ExtensionDelegate; this._RowHoverHandler = RowHoverHandler; this._KNOWNCLICKABLECONTROLS = KNOWNCLICKABLECONTROLS; }
javascript
function() { this._ExtensionHelper = ExtensionHelper; this._ColumnResizeHelper = ColumnResizeHelper; this._InteractiveResizeHelper = InteractiveResizeHelper; this._ReorderHelper = ReorderHelper; this._ExtensionDelegate = ExtensionDelegate; this._RowHoverHandler = RowHoverHandler; this._KNOWNCLICKABLECONTROLS = KNOWNCLICKABLECONTROLS; }
[ "function", "(", ")", "{", "this", ".", "_ExtensionHelper", "=", "ExtensionHelper", ";", "this", ".", "_ColumnResizeHelper", "=", "ColumnResizeHelper", ";", "this", ".", "_InteractiveResizeHelper", "=", "InteractiveResizeHelper", ";", "this", ".", "_ReorderHelper", "=", "ReorderHelper", ";", "this", ".", "_ExtensionDelegate", "=", "ExtensionDelegate", ";", "this", ".", "_RowHoverHandler", "=", "RowHoverHandler", ";", "this", ".", "_KNOWNCLICKABLECONTROLS", "=", "KNOWNCLICKABLECONTROLS", ";", "}" ]
Enables debugging for the extension. Internal helper classes become accessible. @private
[ "Enables", "debugging", "for", "the", "extension", ".", "Internal", "helper", "classes", "become", "accessible", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/TablePointerExtension.js#L979-L987
3,881
SAP/openui5
src/sap.ui.table/src/sap/ui/table/TablePointerExtension.js
function(iColIndex, oEvent) { var oTable = this.getTable(); if (oTable && TableUtils.Column.isColumnMovable(oTable.getColumns()[iColIndex])) { // Starting column drag & drop. We wait 200ms to make sure it is no click on the column to open the menu. oTable._mTimeouts.delayedColumnReorderTimerId = setTimeout(function() { ReorderHelper.initReordering(this, iColIndex, oEvent); }.bind(oTable), 200); } }
javascript
function(iColIndex, oEvent) { var oTable = this.getTable(); if (oTable && TableUtils.Column.isColumnMovable(oTable.getColumns()[iColIndex])) { // Starting column drag & drop. We wait 200ms to make sure it is no click on the column to open the menu. oTable._mTimeouts.delayedColumnReorderTimerId = setTimeout(function() { ReorderHelper.initReordering(this, iColIndex, oEvent); }.bind(oTable), 200); } }
[ "function", "(", "iColIndex", ",", "oEvent", ")", "{", "var", "oTable", "=", "this", ".", "getTable", "(", ")", ";", "if", "(", "oTable", "&&", "TableUtils", ".", "Column", ".", "isColumnMovable", "(", "oTable", ".", "getColumns", "(", ")", "[", "iColIndex", "]", ")", ")", "{", "// Starting column drag & drop. We wait 200ms to make sure it is no click on the column to open the menu.", "oTable", ".", "_mTimeouts", ".", "delayedColumnReorderTimerId", "=", "setTimeout", "(", "function", "(", ")", "{", "ReorderHelper", ".", "initReordering", "(", "this", ",", "iColIndex", ",", "oEvent", ")", ";", "}", ".", "bind", "(", "oTable", ")", ",", "200", ")", ";", "}", "}" ]
Initialize the basic event handling for column reordering and starts the reordering. @param {int} iColIndex The index of the column to resize. @param {jQuery.Event} oEvent The event object.
[ "Initialize", "the", "basic", "event", "handling", "for", "column", "reordering", "and", "starts", "the", "reordering", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/TablePointerExtension.js#L1007-L1015
3,882
SAP/openui5
src/sap.m/src/sap/m/GrowingEnablement.js
function(oRm) { oRm.write("<div"); oRm.addClass("sapMListUl"); oRm.addClass("sapMGrowingList"); oRm.writeAttribute("id", this._oControl.getId() + "-triggerList"); oRm.addStyle("display", "none"); oRm.writeClasses(); oRm.writeStyles(); oRm.write(">"); oRm.renderControl(this._getTrigger()); oRm.write("</div>"); }
javascript
function(oRm) { oRm.write("<div"); oRm.addClass("sapMListUl"); oRm.addClass("sapMGrowingList"); oRm.writeAttribute("id", this._oControl.getId() + "-triggerList"); oRm.addStyle("display", "none"); oRm.writeClasses(); oRm.writeStyles(); oRm.write(">"); oRm.renderControl(this._getTrigger()); oRm.write("</div>"); }
[ "function", "(", "oRm", ")", "{", "oRm", ".", "write", "(", "\"<div\"", ")", ";", "oRm", ".", "addClass", "(", "\"sapMListUl\"", ")", ";", "oRm", ".", "addClass", "(", "\"sapMGrowingList\"", ")", ";", "oRm", ".", "writeAttribute", "(", "\"id\"", ",", "this", ".", "_oControl", ".", "getId", "(", ")", "+", "\"-triggerList\"", ")", ";", "oRm", ".", "addStyle", "(", "\"display\"", ",", "\"none\"", ")", ";", "oRm", ".", "writeClasses", "(", ")", ";", "oRm", ".", "writeStyles", "(", ")", ";", "oRm", ".", "write", "(", "\">\"", ")", ";", "oRm", ".", "renderControl", "(", "this", ".", "_getTrigger", "(", ")", ")", ";", "oRm", ".", "write", "(", "\"</div>\"", ")", ";", "}" ]
renders load more trigger
[ "renders", "load", "more", "trigger" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.m/src/sap/m/GrowingEnablement.js#L96-L107
3,883
SAP/openui5
src/sap.m/src/sap/m/GrowingEnablement.js
function() { if (!this._oControl || this._bLoading) { return; } // if max item count not reached or if we do not know the count var oBinding = this._oControl.getBinding("items"); if (oBinding && !oBinding.isLengthFinal() || this._iLimit < this._oControl.getMaxItemsCount()) { // The GrowingEnablement has its own busy indicator. Do not show the busy indicator, if existing, of the parent control. if (this._oControl.getMetadata().hasProperty("enableBusyIndicator")) { this._bParentEnableBusyIndicator = this._oControl.getEnableBusyIndicator(); this._oControl.setEnableBusyIndicator(false); } this._iLimit += this._oControl.getGrowingThreshold(); this._updateTriggerDelayed(true); this.updateItems("Growing"); } }
javascript
function() { if (!this._oControl || this._bLoading) { return; } // if max item count not reached or if we do not know the count var oBinding = this._oControl.getBinding("items"); if (oBinding && !oBinding.isLengthFinal() || this._iLimit < this._oControl.getMaxItemsCount()) { // The GrowingEnablement has its own busy indicator. Do not show the busy indicator, if existing, of the parent control. if (this._oControl.getMetadata().hasProperty("enableBusyIndicator")) { this._bParentEnableBusyIndicator = this._oControl.getEnableBusyIndicator(); this._oControl.setEnableBusyIndicator(false); } this._iLimit += this._oControl.getGrowingThreshold(); this._updateTriggerDelayed(true); this.updateItems("Growing"); } }
[ "function", "(", ")", "{", "if", "(", "!", "this", ".", "_oControl", "||", "this", ".", "_bLoading", ")", "{", "return", ";", "}", "// if max item count not reached or if we do not know the count", "var", "oBinding", "=", "this", ".", "_oControl", ".", "getBinding", "(", "\"items\"", ")", ";", "if", "(", "oBinding", "&&", "!", "oBinding", ".", "isLengthFinal", "(", ")", "||", "this", ".", "_iLimit", "<", "this", ".", "_oControl", ".", "getMaxItemsCount", "(", ")", ")", "{", "// The GrowingEnablement has its own busy indicator. Do not show the busy indicator, if existing, of the parent control.", "if", "(", "this", ".", "_oControl", ".", "getMetadata", "(", ")", ".", "hasProperty", "(", "\"enableBusyIndicator\"", ")", ")", "{", "this", ".", "_bParentEnableBusyIndicator", "=", "this", ".", "_oControl", ".", "getEnableBusyIndicator", "(", ")", ";", "this", ".", "_oControl", ".", "setEnableBusyIndicator", "(", "false", ")", ";", "}", "this", ".", "_iLimit", "+=", "this", ".", "_oControl", ".", "getGrowingThreshold", "(", ")", ";", "this", ".", "_updateTriggerDelayed", "(", "true", ")", ";", "this", ".", "updateItems", "(", "\"Growing\"", ")", ";", "}", "}" ]
call to request new page
[ "call", "to", "request", "new", "page" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.m/src/sap/m/GrowingEnablement.js#L173-L191
3,884
SAP/openui5
src/sap.m/src/sap/m/GrowingEnablement.js
function(sChangeReason) { this._bLoading = false; this._updateTriggerDelayed(false); this._oControl.onAfterPageLoaded(this.getInfo(), sChangeReason); // After the data has been loaded, restore the busy indicator handling of the parent control. if (this._oControl.setEnableBusyIndicator) { this._oControl.setEnableBusyIndicator(this._bParentEnableBusyIndicator); } }
javascript
function(sChangeReason) { this._bLoading = false; this._updateTriggerDelayed(false); this._oControl.onAfterPageLoaded(this.getInfo(), sChangeReason); // After the data has been loaded, restore the busy indicator handling of the parent control. if (this._oControl.setEnableBusyIndicator) { this._oControl.setEnableBusyIndicator(this._bParentEnableBusyIndicator); } }
[ "function", "(", "sChangeReason", ")", "{", "this", ".", "_bLoading", "=", "false", ";", "this", ".", "_updateTriggerDelayed", "(", "false", ")", ";", "this", ".", "_oControl", ".", "onAfterPageLoaded", "(", "this", ".", "getInfo", "(", ")", ",", "sChangeReason", ")", ";", "// After the data has been loaded, restore the busy indicator handling of the parent control.", "if", "(", "this", ".", "_oControl", ".", "setEnableBusyIndicator", ")", "{", "this", ".", "_oControl", ".", "setEnableBusyIndicator", "(", "this", ".", "_bParentEnableBusyIndicator", ")", ";", "}", "}" ]
called after new page loaded
[ "called", "after", "new", "page", "loaded" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.m/src/sap/m/GrowingEnablement.js#L200-L209
3,885
SAP/openui5
src/sap.m/src/sap/m/GrowingEnablement.js
function() { var sTriggerID = this._oControl.getId() + "-trigger", sTriggerText = this._oControl.getGrowingTriggerText(); sTriggerText = sTriggerText || sap.ui.getCore().getLibraryResourceBundle("sap.m").getText("LOAD_MORE_DATA"); this._oControl.addNavSection(sTriggerID); if (this._oTrigger) { this.setTriggerText(sTriggerText); return this._oTrigger; } // The growing button is changed to span tag as h1 tag was semantically incorrect. this._oTrigger = new CustomListItem({ id: sTriggerID, busyIndicatorDelay: 0, type: ListType.Active, content: new HTML({ content: '<div class="sapMGrowingListTrigger">' + '<div class="sapMSLITitleDiv sapMGrowingListTriggerText">' + '<span class="sapMSLITitle" id="' + sTriggerID + 'Text">' + encodeXML(sTriggerText) + '</span>' + '</div>' + '<div class="sapMGrowingListDescription sapMSLIDescription" id="' + sTriggerID + 'Info"></div>' + '</div>' }) }).setParent(this._oControl, null, true).attachPress(this.requestNewPage, this).addEventDelegate({ onsapenter : function(oEvent) { this.requestNewPage(); oEvent.preventDefault(); }, onsapspace : function(oEvent) { this.requestNewPage(); oEvent.preventDefault(); }, onAfterRendering : function(oEvent) { this._oTrigger.$().attr({ "tabindex": 0, "role": "button", "aria-labelledby": sTriggerID + "Text" + " " + sTriggerID + "Info" }); } }, this); // stop the eventing between item and the list this._oTrigger.getList = function() {}; // defines the tag name this._oTrigger.TagName = "div"; return this._oTrigger; }
javascript
function() { var sTriggerID = this._oControl.getId() + "-trigger", sTriggerText = this._oControl.getGrowingTriggerText(); sTriggerText = sTriggerText || sap.ui.getCore().getLibraryResourceBundle("sap.m").getText("LOAD_MORE_DATA"); this._oControl.addNavSection(sTriggerID); if (this._oTrigger) { this.setTriggerText(sTriggerText); return this._oTrigger; } // The growing button is changed to span tag as h1 tag was semantically incorrect. this._oTrigger = new CustomListItem({ id: sTriggerID, busyIndicatorDelay: 0, type: ListType.Active, content: new HTML({ content: '<div class="sapMGrowingListTrigger">' + '<div class="sapMSLITitleDiv sapMGrowingListTriggerText">' + '<span class="sapMSLITitle" id="' + sTriggerID + 'Text">' + encodeXML(sTriggerText) + '</span>' + '</div>' + '<div class="sapMGrowingListDescription sapMSLIDescription" id="' + sTriggerID + 'Info"></div>' + '</div>' }) }).setParent(this._oControl, null, true).attachPress(this.requestNewPage, this).addEventDelegate({ onsapenter : function(oEvent) { this.requestNewPage(); oEvent.preventDefault(); }, onsapspace : function(oEvent) { this.requestNewPage(); oEvent.preventDefault(); }, onAfterRendering : function(oEvent) { this._oTrigger.$().attr({ "tabindex": 0, "role": "button", "aria-labelledby": sTriggerID + "Text" + " " + sTriggerID + "Info" }); } }, this); // stop the eventing between item and the list this._oTrigger.getList = function() {}; // defines the tag name this._oTrigger.TagName = "div"; return this._oTrigger; }
[ "function", "(", ")", "{", "var", "sTriggerID", "=", "this", ".", "_oControl", ".", "getId", "(", ")", "+", "\"-trigger\"", ",", "sTriggerText", "=", "this", ".", "_oControl", ".", "getGrowingTriggerText", "(", ")", ";", "sTriggerText", "=", "sTriggerText", "||", "sap", ".", "ui", ".", "getCore", "(", ")", ".", "getLibraryResourceBundle", "(", "\"sap.m\"", ")", ".", "getText", "(", "\"LOAD_MORE_DATA\"", ")", ";", "this", ".", "_oControl", ".", "addNavSection", "(", "sTriggerID", ")", ";", "if", "(", "this", ".", "_oTrigger", ")", "{", "this", ".", "setTriggerText", "(", "sTriggerText", ")", ";", "return", "this", ".", "_oTrigger", ";", "}", "// The growing button is changed to span tag as h1 tag was semantically incorrect.", "this", ".", "_oTrigger", "=", "new", "CustomListItem", "(", "{", "id", ":", "sTriggerID", ",", "busyIndicatorDelay", ":", "0", ",", "type", ":", "ListType", ".", "Active", ",", "content", ":", "new", "HTML", "(", "{", "content", ":", "'<div class=\"sapMGrowingListTrigger\">'", "+", "'<div class=\"sapMSLITitleDiv sapMGrowingListTriggerText\">'", "+", "'<span class=\"sapMSLITitle\" id=\"'", "+", "sTriggerID", "+", "'Text\">'", "+", "encodeXML", "(", "sTriggerText", ")", "+", "'</span>'", "+", "'</div>'", "+", "'<div class=\"sapMGrowingListDescription sapMSLIDescription\" id=\"'", "+", "sTriggerID", "+", "'Info\"></div>'", "+", "'</div>'", "}", ")", "}", ")", ".", "setParent", "(", "this", ".", "_oControl", ",", "null", ",", "true", ")", ".", "attachPress", "(", "this", ".", "requestNewPage", ",", "this", ")", ".", "addEventDelegate", "(", "{", "onsapenter", ":", "function", "(", "oEvent", ")", "{", "this", ".", "requestNewPage", "(", ")", ";", "oEvent", ".", "preventDefault", "(", ")", ";", "}", ",", "onsapspace", ":", "function", "(", "oEvent", ")", "{", "this", ".", "requestNewPage", "(", ")", ";", "oEvent", ".", "preventDefault", "(", ")", ";", "}", ",", "onAfterRendering", ":", "function", "(", "oEvent", ")", "{", "this", ".", "_oTrigger", ".", "$", "(", ")", ".", "attr", "(", "{", "\"tabindex\"", ":", "0", ",", "\"role\"", ":", "\"button\"", ",", "\"aria-labelledby\"", ":", "sTriggerID", "+", "\"Text\"", "+", "\" \"", "+", "sTriggerID", "+", "\"Info\"", "}", ")", ";", "}", "}", ",", "this", ")", ";", "// stop the eventing between item and the list", "this", ".", "_oTrigger", ".", "getList", "=", "function", "(", ")", "{", "}", ";", "// defines the tag name", "this", ".", "_oTrigger", ".", "TagName", "=", "\"div\"", ";", "return", "this", ".", "_oTrigger", ";", "}" ]
created and returns load more trigger
[ "created", "and", "returns", "load", "more", "trigger" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.m/src/sap/m/GrowingEnablement.js#L212-L261
3,886
SAP/openui5
src/sap.m/src/sap/m/GrowingEnablement.js
function(oBinding) { var aSorters = oBinding.aSorters || []; var oSorter = aSorters[0] || {}; return (oSorter.fnGroup) ? oSorter.sPath || "" : ""; }
javascript
function(oBinding) { var aSorters = oBinding.aSorters || []; var oSorter = aSorters[0] || {}; return (oSorter.fnGroup) ? oSorter.sPath || "" : ""; }
[ "function", "(", "oBinding", ")", "{", "var", "aSorters", "=", "oBinding", ".", "aSorters", "||", "[", "]", ";", "var", "oSorter", "=", "aSorters", "[", "0", "]", "||", "{", "}", ";", "return", "(", "oSorter", ".", "fnGroup", ")", "?", "oSorter", ".", "sPath", "||", "\"\"", ":", "\"\"", ";", "}" ]
returns the first sorters grouping path when available
[ "returns", "the", "first", "sorters", "grouping", "path", "when", "available" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.m/src/sap/m/GrowingEnablement.js#L269-L273
3,887
SAP/openui5
src/sap.m/src/sap/m/GrowingEnablement.js
function(oContext, oBindingInfo, bSuppressInvalidate) { var oControl = this._oControl, oBinding = oBindingInfo.binding, oItem = this.createListItem(oContext, oBindingInfo); if (oBinding.isGrouped()) { // creates group header if need var aItems = oControl.getItems(true), oLastItem = aItems[aItems.length - 1], sModelName = oBindingInfo.model, oGroupInfo = oBinding.getGroup(oItem.getBindingContext(sModelName)); if (oLastItem && oLastItem.isGroupHeader()) { oControl.removeAggregation("items", oLastItem, true); this._fnAppendGroupItem = this.appendGroupItem.bind(this, oGroupInfo, oLastItem, bSuppressInvalidate); oLastItem = aItems[aItems.length - 1]; } if (!oLastItem || oGroupInfo.key !== oBinding.getGroup(oLastItem.getBindingContext(sModelName)).key) { var oGroupHeader = (oBindingInfo.groupHeaderFactory) ? oBindingInfo.groupHeaderFactory(oGroupInfo) : null; if (oControl.getGrowingDirection() == ListGrowingDirection.Upwards) { this.applyPendingGroupItem(); this._fnAppendGroupItem = this.appendGroupItem.bind(this, oGroupInfo, oGroupHeader, bSuppressInvalidate); } else { this.appendGroupItem(oGroupInfo, oGroupHeader, bSuppressInvalidate); } } } oControl.addAggregation("items", oItem, bSuppressInvalidate); if (bSuppressInvalidate) { this._aChunk.push(oItem); } }
javascript
function(oContext, oBindingInfo, bSuppressInvalidate) { var oControl = this._oControl, oBinding = oBindingInfo.binding, oItem = this.createListItem(oContext, oBindingInfo); if (oBinding.isGrouped()) { // creates group header if need var aItems = oControl.getItems(true), oLastItem = aItems[aItems.length - 1], sModelName = oBindingInfo.model, oGroupInfo = oBinding.getGroup(oItem.getBindingContext(sModelName)); if (oLastItem && oLastItem.isGroupHeader()) { oControl.removeAggregation("items", oLastItem, true); this._fnAppendGroupItem = this.appendGroupItem.bind(this, oGroupInfo, oLastItem, bSuppressInvalidate); oLastItem = aItems[aItems.length - 1]; } if (!oLastItem || oGroupInfo.key !== oBinding.getGroup(oLastItem.getBindingContext(sModelName)).key) { var oGroupHeader = (oBindingInfo.groupHeaderFactory) ? oBindingInfo.groupHeaderFactory(oGroupInfo) : null; if (oControl.getGrowingDirection() == ListGrowingDirection.Upwards) { this.applyPendingGroupItem(); this._fnAppendGroupItem = this.appendGroupItem.bind(this, oGroupInfo, oGroupHeader, bSuppressInvalidate); } else { this.appendGroupItem(oGroupInfo, oGroupHeader, bSuppressInvalidate); } } } oControl.addAggregation("items", oItem, bSuppressInvalidate); if (bSuppressInvalidate) { this._aChunk.push(oItem); } }
[ "function", "(", "oContext", ",", "oBindingInfo", ",", "bSuppressInvalidate", ")", "{", "var", "oControl", "=", "this", ".", "_oControl", ",", "oBinding", "=", "oBindingInfo", ".", "binding", ",", "oItem", "=", "this", ".", "createListItem", "(", "oContext", ",", "oBindingInfo", ")", ";", "if", "(", "oBinding", ".", "isGrouped", "(", ")", ")", "{", "// creates group header if need", "var", "aItems", "=", "oControl", ".", "getItems", "(", "true", ")", ",", "oLastItem", "=", "aItems", "[", "aItems", ".", "length", "-", "1", "]", ",", "sModelName", "=", "oBindingInfo", ".", "model", ",", "oGroupInfo", "=", "oBinding", ".", "getGroup", "(", "oItem", ".", "getBindingContext", "(", "sModelName", ")", ")", ";", "if", "(", "oLastItem", "&&", "oLastItem", ".", "isGroupHeader", "(", ")", ")", "{", "oControl", ".", "removeAggregation", "(", "\"items\"", ",", "oLastItem", ",", "true", ")", ";", "this", ".", "_fnAppendGroupItem", "=", "this", ".", "appendGroupItem", ".", "bind", "(", "this", ",", "oGroupInfo", ",", "oLastItem", ",", "bSuppressInvalidate", ")", ";", "oLastItem", "=", "aItems", "[", "aItems", ".", "length", "-", "1", "]", ";", "}", "if", "(", "!", "oLastItem", "||", "oGroupInfo", ".", "key", "!==", "oBinding", ".", "getGroup", "(", "oLastItem", ".", "getBindingContext", "(", "sModelName", ")", ")", ".", "key", ")", "{", "var", "oGroupHeader", "=", "(", "oBindingInfo", ".", "groupHeaderFactory", ")", "?", "oBindingInfo", ".", "groupHeaderFactory", "(", "oGroupInfo", ")", ":", "null", ";", "if", "(", "oControl", ".", "getGrowingDirection", "(", ")", "==", "ListGrowingDirection", ".", "Upwards", ")", "{", "this", ".", "applyPendingGroupItem", "(", ")", ";", "this", ".", "_fnAppendGroupItem", "=", "this", ".", "appendGroupItem", ".", "bind", "(", "this", ",", "oGroupInfo", ",", "oGroupHeader", ",", "bSuppressInvalidate", ")", ";", "}", "else", "{", "this", ".", "appendGroupItem", "(", "oGroupInfo", ",", "oGroupHeader", ",", "bSuppressInvalidate", ")", ";", "}", "}", "}", "oControl", ".", "addAggregation", "(", "\"items\"", ",", "oItem", ",", "bSuppressInvalidate", ")", ";", "if", "(", "bSuppressInvalidate", ")", "{", "this", ".", "_aChunk", ".", "push", "(", "oItem", ")", ";", "}", "}" ]
appends single list item to the list
[ "appends", "single", "list", "item", "to", "the", "list" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.m/src/sap/m/GrowingEnablement.js#L310-L344
3,888
SAP/openui5
src/sap.m/src/sap/m/GrowingEnablement.js
function(oContext, oBindingInfo) { this._iRenderedDataItems++; var oItem = oBindingInfo.factory(ManagedObjectMetadata.uid("clone"), oContext); return oItem.setBindingContext(oContext, oBindingInfo.model); }
javascript
function(oContext, oBindingInfo) { this._iRenderedDataItems++; var oItem = oBindingInfo.factory(ManagedObjectMetadata.uid("clone"), oContext); return oItem.setBindingContext(oContext, oBindingInfo.model); }
[ "function", "(", "oContext", ",", "oBindingInfo", ")", "{", "this", ".", "_iRenderedDataItems", "++", ";", "var", "oItem", "=", "oBindingInfo", ".", "factory", "(", "ManagedObjectMetadata", ".", "uid", "(", "\"clone\"", ")", ",", "oContext", ")", ";", "return", "oItem", ".", "setBindingContext", "(", "oContext", ",", "oBindingInfo", ".", "model", ")", ";", "}" ]
creates list item from the factory
[ "creates", "list", "item", "from", "the", "factory" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.m/src/sap/m/GrowingEnablement.js#L361-L365
3,889
SAP/openui5
src/sap.m/src/sap/m/GrowingEnablement.js
function(aContexts, oModel) { if (!aContexts.length) { return; } var aItems = this._oControl.getItems(true); for (var i = 0, c = 0, oItem; i < aItems.length; i++) { oItem = aItems[i]; // group headers are not in binding context if (!oItem.isGroupHeader()) { oItem.setBindingContext(aContexts[c++], oModel); } } }
javascript
function(aContexts, oModel) { if (!aContexts.length) { return; } var aItems = this._oControl.getItems(true); for (var i = 0, c = 0, oItem; i < aItems.length; i++) { oItem = aItems[i]; // group headers are not in binding context if (!oItem.isGroupHeader()) { oItem.setBindingContext(aContexts[c++], oModel); } } }
[ "function", "(", "aContexts", ",", "oModel", ")", "{", "if", "(", "!", "aContexts", ".", "length", ")", "{", "return", ";", "}", "var", "aItems", "=", "this", ".", "_oControl", ".", "getItems", "(", "true", ")", ";", "for", "(", "var", "i", "=", "0", ",", "c", "=", "0", ",", "oItem", ";", "i", "<", "aItems", ".", "length", ";", "i", "++", ")", "{", "oItem", "=", "aItems", "[", "i", "]", ";", "// group headers are not in binding context", "if", "(", "!", "oItem", ".", "isGroupHeader", "(", ")", ")", "{", "oItem", ".", "setBindingContext", "(", "aContexts", "[", "c", "++", "]", ",", "oModel", ")", ";", "}", "}", "}" ]
update context on all items except group headers
[ "update", "context", "on", "all", "items", "except", "group", "headers" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.m/src/sap/m/GrowingEnablement.js#L368-L382
3,890
SAP/openui5
src/sap.m/src/sap/m/GrowingEnablement.js
function(aContexts, oBindingInfo, bSuppressInvalidate) { for (var i = 0; i < aContexts.length; i++) { this.addListItem(aContexts[i], oBindingInfo, bSuppressInvalidate); } }
javascript
function(aContexts, oBindingInfo, bSuppressInvalidate) { for (var i = 0; i < aContexts.length; i++) { this.addListItem(aContexts[i], oBindingInfo, bSuppressInvalidate); } }
[ "function", "(", "aContexts", ",", "oBindingInfo", ",", "bSuppressInvalidate", ")", "{", "for", "(", "var", "i", "=", "0", ";", "i", "<", "aContexts", ".", "length", ";", "i", "++", ")", "{", "this", ".", "addListItem", "(", "aContexts", "[", "i", "]", ",", "oBindingInfo", ",", "bSuppressInvalidate", ")", ";", "}", "}" ]
add multiple items to the list via BindingContext
[ "add", "multiple", "items", "to", "the", "list", "via", "BindingContext" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.m/src/sap/m/GrowingEnablement.js#L415-L419
3,891
SAP/openui5
src/sap.m/src/sap/m/GrowingEnablement.js
function(aContexts, oBindingInfo, bSuppressInvalidate) { this.destroyListItems(bSuppressInvalidate); this.addListItems(aContexts, oBindingInfo, bSuppressInvalidate); if (bSuppressInvalidate) { var bHasFocus = this._oContainerDomRef.contains(document.activeElement); this.applyChunk(false); bHasFocus && this._oControl.focus(); } else { this.applyPendingGroupItem(); } }
javascript
function(aContexts, oBindingInfo, bSuppressInvalidate) { this.destroyListItems(bSuppressInvalidate); this.addListItems(aContexts, oBindingInfo, bSuppressInvalidate); if (bSuppressInvalidate) { var bHasFocus = this._oContainerDomRef.contains(document.activeElement); this.applyChunk(false); bHasFocus && this._oControl.focus(); } else { this.applyPendingGroupItem(); } }
[ "function", "(", "aContexts", ",", "oBindingInfo", ",", "bSuppressInvalidate", ")", "{", "this", ".", "destroyListItems", "(", "bSuppressInvalidate", ")", ";", "this", ".", "addListItems", "(", "aContexts", ",", "oBindingInfo", ",", "bSuppressInvalidate", ")", ";", "if", "(", "bSuppressInvalidate", ")", "{", "var", "bHasFocus", "=", "this", ".", "_oContainerDomRef", ".", "contains", "(", "document", ".", "activeElement", ")", ";", "this", ".", "applyChunk", "(", "false", ")", ";", "bHasFocus", "&&", "this", ".", "_oControl", ".", "focus", "(", ")", ";", "}", "else", "{", "this", ".", "applyPendingGroupItem", "(", ")", ";", "}", "}" ]
destroy all the items and create from scratch
[ "destroy", "all", "the", "items", "and", "create", "from", "scratch" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.m/src/sap/m/GrowingEnablement.js#L422-L432
3,892
SAP/openui5
src/sap.m/src/sap/m/GrowingEnablement.js
function(oContext, oBindingInfo, iIndex) { var oItem = this.createListItem(oContext, oBindingInfo); this._oControl.insertAggregation("items", oItem, iIndex, true); this._aChunk.push(oItem); }
javascript
function(oContext, oBindingInfo, iIndex) { var oItem = this.createListItem(oContext, oBindingInfo); this._oControl.insertAggregation("items", oItem, iIndex, true); this._aChunk.push(oItem); }
[ "function", "(", "oContext", ",", "oBindingInfo", ",", "iIndex", ")", "{", "var", "oItem", "=", "this", ".", "createListItem", "(", "oContext", ",", "oBindingInfo", ")", ";", "this", ".", "_oControl", ".", "insertAggregation", "(", "\"items\"", ",", "oItem", ",", "iIndex", ",", "true", ")", ";", "this", ".", "_aChunk", ".", "push", "(", "oItem", ")", ";", "}" ]
inserts a single list item
[ "inserts", "a", "single", "list", "item" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.m/src/sap/m/GrowingEnablement.js#L435-L439
3,893
SAP/openui5
src/sap.m/src/sap/m/GrowingEnablement.js
function(sChangeReason) { if (!this._bDataRequested) { this._bDataRequested = true; this._onBeforePageLoaded(sChangeReason); } // set iItemCount to initial value if not set or no items at the control yet if (!this._iLimit || this.shouldReset(sChangeReason) || !this._oControl.getItems(true).length) { this._iLimit = this._oControl.getGrowingThreshold(); } // send the request to get the context this._oControl.getBinding("items").getContexts(0, this._iLimit); }
javascript
function(sChangeReason) { if (!this._bDataRequested) { this._bDataRequested = true; this._onBeforePageLoaded(sChangeReason); } // set iItemCount to initial value if not set or no items at the control yet if (!this._iLimit || this.shouldReset(sChangeReason) || !this._oControl.getItems(true).length) { this._iLimit = this._oControl.getGrowingThreshold(); } // send the request to get the context this._oControl.getBinding("items").getContexts(0, this._iLimit); }
[ "function", "(", "sChangeReason", ")", "{", "if", "(", "!", "this", ".", "_bDataRequested", ")", "{", "this", ".", "_bDataRequested", "=", "true", ";", "this", ".", "_onBeforePageLoaded", "(", "sChangeReason", ")", ";", "}", "// set iItemCount to initial value if not set or no items at the control yet", "if", "(", "!", "this", ".", "_iLimit", "||", "this", ".", "shouldReset", "(", "sChangeReason", ")", "||", "!", "this", ".", "_oControl", ".", "getItems", "(", "true", ")", ".", "length", ")", "{", "this", ".", "_iLimit", "=", "this", ".", "_oControl", ".", "getGrowingThreshold", "(", ")", ";", "}", "// send the request to get the context", "this", ".", "_oControl", ".", "getBinding", "(", "\"items\"", ")", ".", "getContexts", "(", "0", ",", "this", ".", "_iLimit", ")", ";", "}" ]
refresh items only for OData model.
[ "refresh", "items", "only", "for", "OData", "model", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.m/src/sap/m/GrowingEnablement.js#L450-L463
3,894
SAP/openui5
src/sap.m/src/sap/m/GrowingEnablement.js
function(bLoading) { var oTrigger = this._oTrigger, oControl = this._oControl; // If there are no visible columns then also hide the trigger. if (!oTrigger || !oControl || !oControl.shouldRenderItems() || !oControl.getDomRef()) { return; } var oBinding = oControl.getBinding("items"); if (!oBinding) { return; } // update busy state oTrigger.setBusy(bLoading); oTrigger.$().toggleClass("sapMGrowingListBusyIndicatorVisible", bLoading); if (bLoading) { oTrigger.setActive(false); oControl.$("triggerList").css("display", ""); } else { var aItems = oControl.getItems(true), iItemsLength = aItems.length, iBindingLength = oBinding.getLength() || 0, bLengthFinal = oBinding.isLengthFinal(), bHasScrollToLoad = oControl.getGrowingScrollToLoad(), oTriggerDomRef = oTrigger.getDomRef(); // put the focus to the newly added item if growing button is pressed if (oTriggerDomRef && oTriggerDomRef.contains(document.activeElement)) { (aItems[this._iLastItemsCount] || oControl).focus(); } // show, update or hide the growing button if (!iItemsLength || !this._iLimit || (bLengthFinal && this._iLimit >= iBindingLength) || (bHasScrollToLoad && this._getHasScrollbars())) { oControl.$("triggerList").css("display", "none"); } else { if (bLengthFinal) { oControl.$("triggerInfo").css("display", "block").text(this._getListItemInfo()); } oTrigger.$().removeClass("sapMGrowingListBusyIndicatorVisible"); oControl.$("triggerList").css("display", ""); } // store the last item count to be able to focus to the newly added item when the growing button is pressed this._iLastItemsCount = this._oControl.getItems(true).length; // at the beginning we should scroll to last item if (bHasScrollToLoad && this._oScrollPosition === undefined && oControl.getGrowingDirection() == ListGrowingDirection.Upwards) { this._oScrollPosition = { left : 0, top : 0 }; } // scroll to last position if (iItemsLength > 0 && this._oScrollPosition) { var oScrollDelegate = this._oScrollDelegate, oScrollPosition = this._oScrollPosition; oScrollDelegate.scrollTo(oScrollPosition.left, oScrollDelegate.getScrollHeight() - oScrollPosition.top); this._oScrollPosition = null; } } }
javascript
function(bLoading) { var oTrigger = this._oTrigger, oControl = this._oControl; // If there are no visible columns then also hide the trigger. if (!oTrigger || !oControl || !oControl.shouldRenderItems() || !oControl.getDomRef()) { return; } var oBinding = oControl.getBinding("items"); if (!oBinding) { return; } // update busy state oTrigger.setBusy(bLoading); oTrigger.$().toggleClass("sapMGrowingListBusyIndicatorVisible", bLoading); if (bLoading) { oTrigger.setActive(false); oControl.$("triggerList").css("display", ""); } else { var aItems = oControl.getItems(true), iItemsLength = aItems.length, iBindingLength = oBinding.getLength() || 0, bLengthFinal = oBinding.isLengthFinal(), bHasScrollToLoad = oControl.getGrowingScrollToLoad(), oTriggerDomRef = oTrigger.getDomRef(); // put the focus to the newly added item if growing button is pressed if (oTriggerDomRef && oTriggerDomRef.contains(document.activeElement)) { (aItems[this._iLastItemsCount] || oControl).focus(); } // show, update or hide the growing button if (!iItemsLength || !this._iLimit || (bLengthFinal && this._iLimit >= iBindingLength) || (bHasScrollToLoad && this._getHasScrollbars())) { oControl.$("triggerList").css("display", "none"); } else { if (bLengthFinal) { oControl.$("triggerInfo").css("display", "block").text(this._getListItemInfo()); } oTrigger.$().removeClass("sapMGrowingListBusyIndicatorVisible"); oControl.$("triggerList").css("display", ""); } // store the last item count to be able to focus to the newly added item when the growing button is pressed this._iLastItemsCount = this._oControl.getItems(true).length; // at the beginning we should scroll to last item if (bHasScrollToLoad && this._oScrollPosition === undefined && oControl.getGrowingDirection() == ListGrowingDirection.Upwards) { this._oScrollPosition = { left : 0, top : 0 }; } // scroll to last position if (iItemsLength > 0 && this._oScrollPosition) { var oScrollDelegate = this._oScrollDelegate, oScrollPosition = this._oScrollPosition; oScrollDelegate.scrollTo(oScrollPosition.left, oScrollDelegate.getScrollHeight() - oScrollPosition.top); this._oScrollPosition = null; } } }
[ "function", "(", "bLoading", ")", "{", "var", "oTrigger", "=", "this", ".", "_oTrigger", ",", "oControl", "=", "this", ".", "_oControl", ";", "// If there are no visible columns then also hide the trigger.", "if", "(", "!", "oTrigger", "||", "!", "oControl", "||", "!", "oControl", ".", "shouldRenderItems", "(", ")", "||", "!", "oControl", ".", "getDomRef", "(", ")", ")", "{", "return", ";", "}", "var", "oBinding", "=", "oControl", ".", "getBinding", "(", "\"items\"", ")", ";", "if", "(", "!", "oBinding", ")", "{", "return", ";", "}", "// update busy state", "oTrigger", ".", "setBusy", "(", "bLoading", ")", ";", "oTrigger", ".", "$", "(", ")", ".", "toggleClass", "(", "\"sapMGrowingListBusyIndicatorVisible\"", ",", "bLoading", ")", ";", "if", "(", "bLoading", ")", "{", "oTrigger", ".", "setActive", "(", "false", ")", ";", "oControl", ".", "$", "(", "\"triggerList\"", ")", ".", "css", "(", "\"display\"", ",", "\"\"", ")", ";", "}", "else", "{", "var", "aItems", "=", "oControl", ".", "getItems", "(", "true", ")", ",", "iItemsLength", "=", "aItems", ".", "length", ",", "iBindingLength", "=", "oBinding", ".", "getLength", "(", ")", "||", "0", ",", "bLengthFinal", "=", "oBinding", ".", "isLengthFinal", "(", ")", ",", "bHasScrollToLoad", "=", "oControl", ".", "getGrowingScrollToLoad", "(", ")", ",", "oTriggerDomRef", "=", "oTrigger", ".", "getDomRef", "(", ")", ";", "// put the focus to the newly added item if growing button is pressed", "if", "(", "oTriggerDomRef", "&&", "oTriggerDomRef", ".", "contains", "(", "document", ".", "activeElement", ")", ")", "{", "(", "aItems", "[", "this", ".", "_iLastItemsCount", "]", "||", "oControl", ")", ".", "focus", "(", ")", ";", "}", "// show, update or hide the growing button", "if", "(", "!", "iItemsLength", "||", "!", "this", ".", "_iLimit", "||", "(", "bLengthFinal", "&&", "this", ".", "_iLimit", ">=", "iBindingLength", ")", "||", "(", "bHasScrollToLoad", "&&", "this", ".", "_getHasScrollbars", "(", ")", ")", ")", "{", "oControl", ".", "$", "(", "\"triggerList\"", ")", ".", "css", "(", "\"display\"", ",", "\"none\"", ")", ";", "}", "else", "{", "if", "(", "bLengthFinal", ")", "{", "oControl", ".", "$", "(", "\"triggerInfo\"", ")", ".", "css", "(", "\"display\"", ",", "\"block\"", ")", ".", "text", "(", "this", ".", "_getListItemInfo", "(", ")", ")", ";", "}", "oTrigger", ".", "$", "(", ")", ".", "removeClass", "(", "\"sapMGrowingListBusyIndicatorVisible\"", ")", ";", "oControl", ".", "$", "(", "\"triggerList\"", ")", ".", "css", "(", "\"display\"", ",", "\"\"", ")", ";", "}", "// store the last item count to be able to focus to the newly added item when the growing button is pressed", "this", ".", "_iLastItemsCount", "=", "this", ".", "_oControl", ".", "getItems", "(", "true", ")", ".", "length", ";", "// at the beginning we should scroll to last item", "if", "(", "bHasScrollToLoad", "&&", "this", ".", "_oScrollPosition", "===", "undefined", "&&", "oControl", ".", "getGrowingDirection", "(", ")", "==", "ListGrowingDirection", ".", "Upwards", ")", "{", "this", ".", "_oScrollPosition", "=", "{", "left", ":", "0", ",", "top", ":", "0", "}", ";", "}", "// scroll to last position", "if", "(", "iItemsLength", ">", "0", "&&", "this", ".", "_oScrollPosition", ")", "{", "var", "oScrollDelegate", "=", "this", ".", "_oScrollDelegate", ",", "oScrollPosition", "=", "this", ".", "_oScrollPosition", ";", "oScrollDelegate", ".", "scrollTo", "(", "oScrollPosition", ".", "left", ",", "oScrollDelegate", ".", "getScrollHeight", "(", ")", "-", "oScrollPosition", ".", "top", ")", ";", "this", ".", "_oScrollPosition", "=", "null", ";", "}", "}", "}" ]
updates the trigger state
[ "updates", "the", "trigger", "state" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.m/src/sap/m/GrowingEnablement.js#L611-L679
3,895
SAP/openui5
src/sap.ui.core/src/sap/ui/core/routing/Targets.js
function () { var sTargetName; EventProvider.prototype.destroy.apply(this); for (sTargetName in this._mTargets) { if (this._mTargets.hasOwnProperty(sTargetName)) { this._mTargets[sTargetName].destroy(); } } this._mTargets = null; this._oCache = null; this._oConfig = null; this.bIsDestroyed = true; return this; }
javascript
function () { var sTargetName; EventProvider.prototype.destroy.apply(this); for (sTargetName in this._mTargets) { if (this._mTargets.hasOwnProperty(sTargetName)) { this._mTargets[sTargetName].destroy(); } } this._mTargets = null; this._oCache = null; this._oConfig = null; this.bIsDestroyed = true; return this; }
[ "function", "(", ")", "{", "var", "sTargetName", ";", "EventProvider", ".", "prototype", ".", "destroy", ".", "apply", "(", "this", ")", ";", "for", "(", "sTargetName", "in", "this", ".", "_mTargets", ")", "{", "if", "(", "this", ".", "_mTargets", ".", "hasOwnProperty", "(", "sTargetName", ")", ")", "{", "this", ".", "_mTargets", "[", "sTargetName", "]", ".", "destroy", "(", ")", ";", "}", "}", "this", ".", "_mTargets", "=", "null", ";", "this", ".", "_oCache", "=", "null", ";", "this", ".", "_oConfig", "=", "null", ";", "this", ".", "bIsDestroyed", "=", "true", ";", "return", "this", ";", "}" ]
Destroys the targets instance and all created targets. Does not destroy the views instance passed to the constructor. It has to be destroyed separately. @public @returns { sap.ui.core.routing.Targets } this for chaining.
[ "Destroys", "the", "targets", "instance", "and", "all", "created", "targets", ".", "Does", "not", "destroy", "the", "views", "instance", "passed", "to", "the", "constructor", ".", "It", "has", "to", "be", "destroyed", "separately", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/routing/Targets.js#L347-L363
3,896
SAP/openui5
src/sap.ui.core/src/sap/ui/core/routing/Targets.js
function (sName, oTargetOptions) { var oOldTarget = this.getTarget(sName), oTarget; if (oOldTarget) { Log.error("Target with name " + sName + " already exists", this); } else { oTarget = this._createTarget(sName, oTargetOptions); this._addParentTo(oTarget); } return this; }
javascript
function (sName, oTargetOptions) { var oOldTarget = this.getTarget(sName), oTarget; if (oOldTarget) { Log.error("Target with name " + sName + " already exists", this); } else { oTarget = this._createTarget(sName, oTargetOptions); this._addParentTo(oTarget); } return this; }
[ "function", "(", "sName", ",", "oTargetOptions", ")", "{", "var", "oOldTarget", "=", "this", ".", "getTarget", "(", "sName", ")", ",", "oTarget", ";", "if", "(", "oOldTarget", ")", "{", "Log", ".", "error", "(", "\"Target with name \"", "+", "sName", "+", "\" already exists\"", ",", "this", ")", ";", "}", "else", "{", "oTarget", "=", "this", ".", "_createTarget", "(", "sName", ",", "oTargetOptions", ")", ";", "this", ".", "_addParentTo", "(", "oTarget", ")", ";", "}", "return", "this", ";", "}" ]
Creates a target by using the given name and options. If there's already a target with the same name exists, the existing target is kept from being overwritten and an error log will be written to the development console. @param {string} sName the name of a target @param {object} oTarget the options of a target. The option names are the same as the ones in "oOptions.targets.anyName" of {@link #constructor}. @returns {sap.ui.core.routing.Targets} Targets itself for method chaining @public
[ "Creates", "a", "target", "by", "using", "the", "given", "name", "and", "options", ".", "If", "there", "s", "already", "a", "target", "with", "the", "same", "name", "exists", "the", "existing", "target", "is", "kept", "from", "being", "overwritten", "and", "an", "error", "log", "will", "be", "written", "to", "the", "development", "console", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/routing/Targets.js#L427-L439
3,897
SAP/openui5
src/sap.ui.core/src/sap/ui/core/routing/Targets.js
function (sName, oTargetOptions) { var oTarget, oOptions; oOptions = jQuery.extend(true, { _name: sName }, this._oConfig, oTargetOptions); oTarget = this._constructTarget(oOptions); oTarget.attachDisplay(function (oEvent) { var oParameters = oEvent.getParameters(); this.fireDisplay({ name : sName, view : oParameters.view, control : oParameters.control, config : oParameters.config, data: oParameters.data }); }, this); this._mTargets[sName] = oTarget; return oTarget; }
javascript
function (sName, oTargetOptions) { var oTarget, oOptions; oOptions = jQuery.extend(true, { _name: sName }, this._oConfig, oTargetOptions); oTarget = this._constructTarget(oOptions); oTarget.attachDisplay(function (oEvent) { var oParameters = oEvent.getParameters(); this.fireDisplay({ name : sName, view : oParameters.view, control : oParameters.control, config : oParameters.config, data: oParameters.data }); }, this); this._mTargets[sName] = oTarget; return oTarget; }
[ "function", "(", "sName", ",", "oTargetOptions", ")", "{", "var", "oTarget", ",", "oOptions", ";", "oOptions", "=", "jQuery", ".", "extend", "(", "true", ",", "{", "_name", ":", "sName", "}", ",", "this", ".", "_oConfig", ",", "oTargetOptions", ")", ";", "oTarget", "=", "this", ".", "_constructTarget", "(", "oOptions", ")", ";", "oTarget", ".", "attachDisplay", "(", "function", "(", "oEvent", ")", "{", "var", "oParameters", "=", "oEvent", ".", "getParameters", "(", ")", ";", "this", ".", "fireDisplay", "(", "{", "name", ":", "sName", ",", "view", ":", "oParameters", ".", "view", ",", "control", ":", "oParameters", ".", "control", ",", "config", ":", "oParameters", ".", "config", ",", "data", ":", "oParameters", ".", "data", "}", ")", ";", "}", ",", "this", ")", ";", "this", ".", "_mTargets", "[", "sName", "]", "=", "oTarget", ";", "return", "oTarget", ";", "}" ]
created all targets @param {string} sName @param {object} oTargetOptions @return {sap.ui.core.routing.Target} The created target object @private
[ "created", "all", "targets" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/routing/Targets.js#L564-L583
3,898
SAP/openui5
src/sap.ui.core/src/sap/ui/core/Component.js
addSapParams
function addSapParams(oUri) { ['sap-client', 'sap-server'].forEach(function(sName) { if (!oUri.hasSearch(sName)) { var sValue = sap.ui.getCore().getConfiguration().getSAPParam(sName); if (sValue) { oUri.addSearch(sName, sValue); } } }); }
javascript
function addSapParams(oUri) { ['sap-client', 'sap-server'].forEach(function(sName) { if (!oUri.hasSearch(sName)) { var sValue = sap.ui.getCore().getConfiguration().getSAPParam(sName); if (sValue) { oUri.addSearch(sName, sValue); } } }); }
[ "function", "addSapParams", "(", "oUri", ")", "{", "[", "'sap-client'", ",", "'sap-server'", "]", ".", "forEach", "(", "function", "(", "sName", ")", "{", "if", "(", "!", "oUri", ".", "hasSearch", "(", "sName", ")", ")", "{", "var", "sValue", "=", "sap", ".", "ui", ".", "getCore", "(", ")", ".", "getConfiguration", "(", ")", ".", "getSAPParam", "(", "sName", ")", ";", "if", "(", "sValue", ")", "{", "oUri", ".", "addSearch", "(", "sName", ",", "sValue", ")", ";", "}", "}", "}", ")", ";", "}" ]
Utility function which adds SAP-specific parameters to a URI instance @param {URI} oUri URI.js instance @private
[ "Utility", "function", "which", "adds", "SAP", "-", "specific", "parameters", "to", "a", "URI", "instance" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/Component.js#L56-L65
3,899
SAP/openui5
src/sap.ui.core/src/sap/ui/core/Component.js
mergeDefinitionSource
function mergeDefinitionSource(mDefinitions, mDefinitionSource, mSourceData, oSource) { if (mSourceData) { for (var sName in mDefinitions) { if (!mDefinitionSource[sName] && mSourceData[sName] && mSourceData[sName].uri) { mDefinitionSource[sName] = oSource; } } } }
javascript
function mergeDefinitionSource(mDefinitions, mDefinitionSource, mSourceData, oSource) { if (mSourceData) { for (var sName in mDefinitions) { if (!mDefinitionSource[sName] && mSourceData[sName] && mSourceData[sName].uri) { mDefinitionSource[sName] = oSource; } } } }
[ "function", "mergeDefinitionSource", "(", "mDefinitions", ",", "mDefinitionSource", ",", "mSourceData", ",", "oSource", ")", "{", "if", "(", "mSourceData", ")", "{", "for", "(", "var", "sName", "in", "mDefinitions", ")", "{", "if", "(", "!", "mDefinitionSource", "[", "sName", "]", "&&", "mSourceData", "[", "sName", "]", "&&", "mSourceData", "[", "sName", "]", ".", "uri", ")", "{", "mDefinitionSource", "[", "sName", "]", "=", "oSource", ";", "}", "}", "}", "}" ]
Utility function which merges a map of property definitions to track from which "source" a property was defined. This function is used to find out which Component has defined which "dataSource/model". @param {object} mDefinitions Map with definitions to check @param {object} mDefinitionSource Object to extend with definition - source mapping @param {object} mSourceData Actual map with definitions @param {object} oSource Corresponding source object which should be assigned to the definitions-source map @private
[ "Utility", "function", "which", "merges", "a", "map", "of", "property", "definitions", "to", "track", "from", "which", "source", "a", "property", "was", "defined", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/Component.js#L80-L88