id
int32
0
58k
repo
stringlengths
5
67
path
stringlengths
4
116
func_name
stringlengths
0
58
original_string
stringlengths
52
373k
language
stringclasses
1 value
code
stringlengths
52
373k
code_tokens
sequence
docstring
stringlengths
4
11.8k
docstring_tokens
sequence
sha
stringlengths
40
40
url
stringlengths
86
226
4,100
SAP/openui5
src/sap.ui.documentation/src/sap/ui/documentation/sdk/controller/util/IndexWorker.js
searchIndex
function searchIndex(sQuery) { sQuery = preprocessQuery(sQuery); return new Promise(function(resolve, reject) { fetchIndex().then(function(oIndex) { var aSearchResults, oSearchResultsCollector = new SearchResultCollector(); function searchByField(sFieldToSearch, sSubQuery, bReturnMatchedDocWord) { var aResults = oIndex.search(sSubQuery, createSearchConfig(sFieldToSearch)); oSearchResultsCollector.add(aResults, sSubQuery, sFieldToSearch, bReturnMatchedDocWord); } // search by fields in priority order searchByField("title", sQuery); METADATA_FIELDS.forEach(function(sField) { lunr.tokenizer(sQuery).forEach(function(sSubQuery) { searchByField(sField, sSubQuery, true); }); }); searchByField("paramTypes", sQuery); searchByField("contents", sQuery); // collect all results aSearchResults = oSearchResultsCollector.getAll(); resolve({ success: !!(aSearchResults.length), totalHits: aSearchResults.length, matches: aSearchResults }); }); }); }
javascript
function searchIndex(sQuery) { sQuery = preprocessQuery(sQuery); return new Promise(function(resolve, reject) { fetchIndex().then(function(oIndex) { var aSearchResults, oSearchResultsCollector = new SearchResultCollector(); function searchByField(sFieldToSearch, sSubQuery, bReturnMatchedDocWord) { var aResults = oIndex.search(sSubQuery, createSearchConfig(sFieldToSearch)); oSearchResultsCollector.add(aResults, sSubQuery, sFieldToSearch, bReturnMatchedDocWord); } // search by fields in priority order searchByField("title", sQuery); METADATA_FIELDS.forEach(function(sField) { lunr.tokenizer(sQuery).forEach(function(sSubQuery) { searchByField(sField, sSubQuery, true); }); }); searchByField("paramTypes", sQuery); searchByField("contents", sQuery); // collect all results aSearchResults = oSearchResultsCollector.getAll(); resolve({ success: !!(aSearchResults.length), totalHits: aSearchResults.length, matches: aSearchResults }); }); }); }
[ "function", "searchIndex", "(", "sQuery", ")", "{", "sQuery", "=", "preprocessQuery", "(", "sQuery", ")", ";", "return", "new", "Promise", "(", "function", "(", "resolve", ",", "reject", ")", "{", "fetchIndex", "(", ")", ".", "then", "(", "function", "(", "oIndex", ")", "{", "var", "aSearchResults", ",", "oSearchResultsCollector", "=", "new", "SearchResultCollector", "(", ")", ";", "function", "searchByField", "(", "sFieldToSearch", ",", "sSubQuery", ",", "bReturnMatchedDocWord", ")", "{", "var", "aResults", "=", "oIndex", ".", "search", "(", "sSubQuery", ",", "createSearchConfig", "(", "sFieldToSearch", ")", ")", ";", "oSearchResultsCollector", ".", "add", "(", "aResults", ",", "sSubQuery", ",", "sFieldToSearch", ",", "bReturnMatchedDocWord", ")", ";", "}", "// search by fields in priority order", "searchByField", "(", "\"title\"", ",", "sQuery", ")", ";", "METADATA_FIELDS", ".", "forEach", "(", "function", "(", "sField", ")", "{", "lunr", ".", "tokenizer", "(", "sQuery", ")", ".", "forEach", "(", "function", "(", "sSubQuery", ")", "{", "searchByField", "(", "sField", ",", "sSubQuery", ",", "true", ")", ";", "}", ")", ";", "}", ")", ";", "searchByField", "(", "\"paramTypes\"", ",", "sQuery", ")", ";", "searchByField", "(", "\"contents\"", ",", "sQuery", ")", ";", "// collect all results", "aSearchResults", "=", "oSearchResultsCollector", ".", "getAll", "(", ")", ";", "resolve", "(", "{", "success", ":", "!", "!", "(", "aSearchResults", ".", "length", ")", ",", "totalHits", ":", "aSearchResults", ".", "length", ",", "matches", ":", "aSearchResults", "}", ")", ";", "}", ")", ";", "}", ")", ";", "}" ]
Searches the index, given a search string @param sQuery, the search string @returns {Promise<any>}
[ "Searches", "the", "index", "given", "a", "search", "string" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.documentation/src/sap/ui/documentation/sdk/controller/util/IndexWorker.js#L158-L200
4,101
SAP/openui5
src/sap.ui.documentation/src/sap/ui/documentation/sdk/controller/util/IndexWorker.js
overrideLunrTokenizer
function overrideLunrTokenizer() { var origTokenizer = lunr.tokenizer; var rSeparators = /[-./#_,;\(\)=><|]/g; lunr.tokenizer = function(str) { return origTokenizer.call(lunr, str).reduce( function (result, token) { if ( rSeparators.test(token) ) { token = token.replace(rSeparators, " "); result.push.apply(result, token.toLowerCase().split(/ +/)); } else { result.push(token.toLowerCase()); } return result; }, []); }; Object.keys(origTokenizer).forEach(function (key) { lunr.tokenizer[key] = origTokenizer[key]; }); }
javascript
function overrideLunrTokenizer() { var origTokenizer = lunr.tokenizer; var rSeparators = /[-./#_,;\(\)=><|]/g; lunr.tokenizer = function(str) { return origTokenizer.call(lunr, str).reduce( function (result, token) { if ( rSeparators.test(token) ) { token = token.replace(rSeparators, " "); result.push.apply(result, token.toLowerCase().split(/ +/)); } else { result.push(token.toLowerCase()); } return result; }, []); }; Object.keys(origTokenizer).forEach(function (key) { lunr.tokenizer[key] = origTokenizer[key]; }); }
[ "function", "overrideLunrTokenizer", "(", ")", "{", "var", "origTokenizer", "=", "lunr", ".", "tokenizer", ";", "var", "rSeparators", "=", "/", "[-./#_,;\\(\\)=><|]", "/", "g", ";", "lunr", ".", "tokenizer", "=", "function", "(", "str", ")", "{", "return", "origTokenizer", ".", "call", "(", "lunr", ",", "str", ")", ".", "reduce", "(", "function", "(", "result", ",", "token", ")", "{", "if", "(", "rSeparators", ".", "test", "(", "token", ")", ")", "{", "token", "=", "token", ".", "replace", "(", "rSeparators", ",", "\" \"", ")", ";", "result", ".", "push", ".", "apply", "(", "result", ",", "token", ".", "toLowerCase", "(", ")", ".", "split", "(", "/", " +", "/", ")", ")", ";", "}", "else", "{", "result", ".", "push", "(", "token", ".", "toLowerCase", "(", ")", ")", ";", "}", "return", "result", ";", "}", ",", "[", "]", ")", ";", "}", ";", "Object", ".", "keys", "(", "origTokenizer", ")", ".", "forEach", "(", "function", "(", "key", ")", "{", "lunr", ".", "tokenizer", "[", "key", "]", "=", "origTokenizer", "[", "key", "]", ";", "}", ")", ";", "}" ]
overrides the lunr tokenizer in order to define custom token separators
[ "overrides", "the", "lunr", "tokenizer", "in", "order", "to", "define", "custom", "token", "separators" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.documentation/src/sap/ui/documentation/sdk/controller/util/IndexWorker.js#L231-L250
4,102
SAP/openui5
src/sap.ui.documentation/src/sap/ui/documentation/sdk/controller/util/IndexWorker.js
getObjectValues
function getObjectValues(oObject) { var aKeys = Object.keys(oObject), aValues = []; aKeys.forEach(function(sKey) { aValues.push(oObject[sKey]); }); return aValues; }
javascript
function getObjectValues(oObject) { var aKeys = Object.keys(oObject), aValues = []; aKeys.forEach(function(sKey) { aValues.push(oObject[sKey]); }); return aValues; }
[ "function", "getObjectValues", "(", "oObject", ")", "{", "var", "aKeys", "=", "Object", ".", "keys", "(", "oObject", ")", ",", "aValues", "=", "[", "]", ";", "aKeys", ".", "forEach", "(", "function", "(", "sKey", ")", "{", "aValues", ".", "push", "(", "oObject", "[", "sKey", "]", ")", ";", "}", ")", ";", "return", "aValues", ";", "}" ]
Polyfill for Object.values as original Object.values is N/A on IE @param oObject @returns {Array}
[ "Polyfill", "for", "Object", ".", "values" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.documentation/src/sap/ui/documentation/sdk/controller/util/IndexWorker.js#L467-L476
4,103
SAP/openui5
src/sap.f/src/sap/f/routing/Targets.js
function (oTarget) { var iViewLevel; do { iViewLevel = oTarget._oOptions.viewLevel; if (iViewLevel !== undefined) { return iViewLevel; } oTarget = oTarget._oParent; } while (oTarget); return iViewLevel; }
javascript
function (oTarget) { var iViewLevel; do { iViewLevel = oTarget._oOptions.viewLevel; if (iViewLevel !== undefined) { return iViewLevel; } oTarget = oTarget._oParent; } while (oTarget); return iViewLevel; }
[ "function", "(", "oTarget", ")", "{", "var", "iViewLevel", ";", "do", "{", "iViewLevel", "=", "oTarget", ".", "_oOptions", ".", "viewLevel", ";", "if", "(", "iViewLevel", "!==", "undefined", ")", "{", "return", "iViewLevel", ";", "}", "oTarget", "=", "oTarget", ".", "_oParent", ";", "}", "while", "(", "oTarget", ")", ";", "return", "iViewLevel", ";", "}" ]
Traverse up from the given target through the parent chain to find out the first target with a defined view level. @param {sap.f.routing.Target} oTarget The target from which the traverse starts to find the first defined view level @return {number} The view level @private
[ "Traverse", "up", "from", "the", "given", "target", "through", "the", "parent", "chain", "to", "find", "out", "the", "first", "target", "with", "a", "defined", "view", "level", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.f/src/sap/f/routing/Targets.js#L392-L403
4,104
SAP/openui5
src/sap.ui.table/src/sap/ui/table/TableGrouping.js
function(oTable, vRowIndex, bExpand) { var aIndices = []; var oBinding = oTable ? oTable.getBinding("rows") : null; if (!oTable || !oBinding || !oBinding.expand || vRowIndex == null) { return null; } if (typeof vRowIndex === "number") { aIndices = [vRowIndex]; } else if (Array.isArray(vRowIndex)) { if (bExpand == null && vRowIndex.length > 1) { // Toggling the expanded state of multiple rows seems to be an absurd task. Therefore we assume this is unintentional and // prevent the execution. return null; } aIndices = vRowIndex; } // The cached binding length cannot be used here. In the synchronous execution after re-binding the rows, the cached binding length is // invalid. The table will validate it in its next update cycle, which happens asynchronously. // As of now, this is the required behavior for some features, but leads to failure here. Therefore, the length is requested from the // binding directly. var iTotalRowCount = oTable._getTotalRowCount(true); var aValidSortedIndices = aIndices.filter(function(iIndex) { // Only indices of existing, expandable/collapsible nodes must be considered. Otherwise there might be no change event on the final // expand/collapse. var bIsExpanded = oBinding.isExpanded(iIndex); var bIsLeaf = true; // If the node state cannot be determined, we assume it is a leaf. if (oBinding.nodeHasChildren) { if (oBinding.getNodeByIndex) { bIsLeaf = !oBinding.nodeHasChildren(oBinding.getNodeByIndex(iIndex)); } else { // The sap.ui.model.TreeBindingCompatibilityAdapter has no #getNodeByIndex function and #nodeHasChildren always returns true. bIsLeaf = false; } } return iIndex >= 0 && iIndex < iTotalRowCount && !bIsLeaf && bExpand !== bIsExpanded; }).sort(); if (aValidSortedIndices.length === 0) { return null; } // Operations need to be performed from the highest index to the lowest. This ensures correct results with OData bindings. The indices // are sorted ascending, so the array is iterated backwards. // Expand/Collapse all nodes except the first, and suppress the change event. for (var i = aValidSortedIndices.length - 1; i > 0; i--) { if (bExpand) { oBinding.expand(aValidSortedIndices[i], true); } else { oBinding.collapse(aValidSortedIndices[i], true); } } // Expand/Collapse the first node without suppressing the change event. if (bExpand === true) { oBinding.expand(aValidSortedIndices[0], false); } else if (bExpand === false) { oBinding.collapse(aValidSortedIndices[0], false); } else { oBinding.toggleIndex(aValidSortedIndices[0]); } return oBinding.isExpanded(aValidSortedIndices[0]); }
javascript
function(oTable, vRowIndex, bExpand) { var aIndices = []; var oBinding = oTable ? oTable.getBinding("rows") : null; if (!oTable || !oBinding || !oBinding.expand || vRowIndex == null) { return null; } if (typeof vRowIndex === "number") { aIndices = [vRowIndex]; } else if (Array.isArray(vRowIndex)) { if (bExpand == null && vRowIndex.length > 1) { // Toggling the expanded state of multiple rows seems to be an absurd task. Therefore we assume this is unintentional and // prevent the execution. return null; } aIndices = vRowIndex; } // The cached binding length cannot be used here. In the synchronous execution after re-binding the rows, the cached binding length is // invalid. The table will validate it in its next update cycle, which happens asynchronously. // As of now, this is the required behavior for some features, but leads to failure here. Therefore, the length is requested from the // binding directly. var iTotalRowCount = oTable._getTotalRowCount(true); var aValidSortedIndices = aIndices.filter(function(iIndex) { // Only indices of existing, expandable/collapsible nodes must be considered. Otherwise there might be no change event on the final // expand/collapse. var bIsExpanded = oBinding.isExpanded(iIndex); var bIsLeaf = true; // If the node state cannot be determined, we assume it is a leaf. if (oBinding.nodeHasChildren) { if (oBinding.getNodeByIndex) { bIsLeaf = !oBinding.nodeHasChildren(oBinding.getNodeByIndex(iIndex)); } else { // The sap.ui.model.TreeBindingCompatibilityAdapter has no #getNodeByIndex function and #nodeHasChildren always returns true. bIsLeaf = false; } } return iIndex >= 0 && iIndex < iTotalRowCount && !bIsLeaf && bExpand !== bIsExpanded; }).sort(); if (aValidSortedIndices.length === 0) { return null; } // Operations need to be performed from the highest index to the lowest. This ensures correct results with OData bindings. The indices // are sorted ascending, so the array is iterated backwards. // Expand/Collapse all nodes except the first, and suppress the change event. for (var i = aValidSortedIndices.length - 1; i > 0; i--) { if (bExpand) { oBinding.expand(aValidSortedIndices[i], true); } else { oBinding.collapse(aValidSortedIndices[i], true); } } // Expand/Collapse the first node without suppressing the change event. if (bExpand === true) { oBinding.expand(aValidSortedIndices[0], false); } else if (bExpand === false) { oBinding.collapse(aValidSortedIndices[0], false); } else { oBinding.toggleIndex(aValidSortedIndices[0]); } return oBinding.isExpanded(aValidSortedIndices[0]); }
[ "function", "(", "oTable", ",", "vRowIndex", ",", "bExpand", ")", "{", "var", "aIndices", "=", "[", "]", ";", "var", "oBinding", "=", "oTable", "?", "oTable", ".", "getBinding", "(", "\"rows\"", ")", ":", "null", ";", "if", "(", "!", "oTable", "||", "!", "oBinding", "||", "!", "oBinding", ".", "expand", "||", "vRowIndex", "==", "null", ")", "{", "return", "null", ";", "}", "if", "(", "typeof", "vRowIndex", "===", "\"number\"", ")", "{", "aIndices", "=", "[", "vRowIndex", "]", ";", "}", "else", "if", "(", "Array", ".", "isArray", "(", "vRowIndex", ")", ")", "{", "if", "(", "bExpand", "==", "null", "&&", "vRowIndex", ".", "length", ">", "1", ")", "{", "// Toggling the expanded state of multiple rows seems to be an absurd task. Therefore we assume this is unintentional and", "// prevent the execution.", "return", "null", ";", "}", "aIndices", "=", "vRowIndex", ";", "}", "// The cached binding length cannot be used here. In the synchronous execution after re-binding the rows, the cached binding length is", "// invalid. The table will validate it in its next update cycle, which happens asynchronously.", "// As of now, this is the required behavior for some features, but leads to failure here. Therefore, the length is requested from the", "// binding directly.", "var", "iTotalRowCount", "=", "oTable", ".", "_getTotalRowCount", "(", "true", ")", ";", "var", "aValidSortedIndices", "=", "aIndices", ".", "filter", "(", "function", "(", "iIndex", ")", "{", "// Only indices of existing, expandable/collapsible nodes must be considered. Otherwise there might be no change event on the final", "// expand/collapse.", "var", "bIsExpanded", "=", "oBinding", ".", "isExpanded", "(", "iIndex", ")", ";", "var", "bIsLeaf", "=", "true", ";", "// If the node state cannot be determined, we assume it is a leaf.", "if", "(", "oBinding", ".", "nodeHasChildren", ")", "{", "if", "(", "oBinding", ".", "getNodeByIndex", ")", "{", "bIsLeaf", "=", "!", "oBinding", ".", "nodeHasChildren", "(", "oBinding", ".", "getNodeByIndex", "(", "iIndex", ")", ")", ";", "}", "else", "{", "// The sap.ui.model.TreeBindingCompatibilityAdapter has no #getNodeByIndex function and #nodeHasChildren always returns true.", "bIsLeaf", "=", "false", ";", "}", "}", "return", "iIndex", ">=", "0", "&&", "iIndex", "<", "iTotalRowCount", "&&", "!", "bIsLeaf", "&&", "bExpand", "!==", "bIsExpanded", ";", "}", ")", ".", "sort", "(", ")", ";", "if", "(", "aValidSortedIndices", ".", "length", "===", "0", ")", "{", "return", "null", ";", "}", "// Operations need to be performed from the highest index to the lowest. This ensures correct results with OData bindings. The indices", "// are sorted ascending, so the array is iterated backwards.", "// Expand/Collapse all nodes except the first, and suppress the change event.", "for", "(", "var", "i", "=", "aValidSortedIndices", ".", "length", "-", "1", ";", "i", ">", "0", ";", "i", "--", ")", "{", "if", "(", "bExpand", ")", "{", "oBinding", ".", "expand", "(", "aValidSortedIndices", "[", "i", "]", ",", "true", ")", ";", "}", "else", "{", "oBinding", ".", "collapse", "(", "aValidSortedIndices", "[", "i", "]", ",", "true", ")", ";", "}", "}", "// Expand/Collapse the first node without suppressing the change event.", "if", "(", "bExpand", "===", "true", ")", "{", "oBinding", ".", "expand", "(", "aValidSortedIndices", "[", "0", "]", ",", "false", ")", ";", "}", "else", "if", "(", "bExpand", "===", "false", ")", "{", "oBinding", ".", "collapse", "(", "aValidSortedIndices", "[", "0", "]", ",", "false", ")", ";", "}", "else", "{", "oBinding", ".", "toggleIndex", "(", "aValidSortedIndices", "[", "0", "]", ")", ";", "}", "return", "oBinding", ".", "isExpanded", "(", "aValidSortedIndices", "[", "0", "]", ")", ";", "}" ]
Toggles or sets the expanded state of a single or multiple rows. Toggling only works for a single row. @param {sap.ui.table.Table} oTable Instance of the table. @param {int | int[]} vRowIndex A single index, or an array of indices of the rows to expand or collapse. @param {boolean} [bExpand] If defined, instead of toggling the desired state is set. @returns {boolean | null} The new expanded state in case an action was performed, otherwise <code>null</code>.
[ "Toggles", "or", "sets", "the", "expanded", "state", "of", "a", "single", "or", "multiple", "rows", ".", "Toggling", "only", "works", "for", "a", "single", "row", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/TableGrouping.js#L113-L184
4,105
SAP/openui5
src/sap.ui.table/src/sap/ui/table/TableGrouping.js
function(oCellRef) { var oInfo = TableGrouping.TableUtils.getCellInfo(oCellRef); if (oInfo.isOfType(TableGrouping.TableUtils.CELLTYPE.DATACELL)) { return oInfo.cell.parent().hasClass("sapUiTableGroupHeader"); } else if (oInfo.isOfType(TableGrouping.TableUtils.CELLTYPE.ROWHEADER | TableGrouping.TableUtils.CELLTYPE.ROWACTION)) { return oInfo.cell.hasClass("sapUiTableGroupHeader"); } return false; }
javascript
function(oCellRef) { var oInfo = TableGrouping.TableUtils.getCellInfo(oCellRef); if (oInfo.isOfType(TableGrouping.TableUtils.CELLTYPE.DATACELL)) { return oInfo.cell.parent().hasClass("sapUiTableGroupHeader"); } else if (oInfo.isOfType(TableGrouping.TableUtils.CELLTYPE.ROWHEADER | TableGrouping.TableUtils.CELLTYPE.ROWACTION)) { return oInfo.cell.hasClass("sapUiTableGroupHeader"); } return false; }
[ "function", "(", "oCellRef", ")", "{", "var", "oInfo", "=", "TableGrouping", ".", "TableUtils", ".", "getCellInfo", "(", "oCellRef", ")", ";", "if", "(", "oInfo", ".", "isOfType", "(", "TableGrouping", ".", "TableUtils", ".", "CELLTYPE", ".", "DATACELL", ")", ")", "{", "return", "oInfo", ".", "cell", ".", "parent", "(", ")", ".", "hasClass", "(", "\"sapUiTableGroupHeader\"", ")", ";", "}", "else", "if", "(", "oInfo", ".", "isOfType", "(", "TableGrouping", ".", "TableUtils", ".", "CELLTYPE", ".", "ROWHEADER", "|", "TableGrouping", ".", "TableUtils", ".", "CELLTYPE", ".", "ROWACTION", ")", ")", "{", "return", "oInfo", ".", "cell", ".", "hasClass", "(", "\"sapUiTableGroupHeader\"", ")", ";", "}", "return", "false", ";", "}" ]
Returns whether the given cell is located in a group header. @param {jQuery | HTMLElement} oCellRef DOM reference of table cell. @returns {boolean} Whether the element is in a group header row.
[ "Returns", "whether", "the", "given", "cell", "is", "located", "in", "a", "group", "header", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/TableGrouping.js#L231-L241
4,106
SAP/openui5
src/sap.ui.table/src/sap/ui/table/TableGrouping.js
function(oTable, iLevel, bChildren, bSum) { var iIndent = 0; var i; if (oTable.isA("sap.ui.table.TreeTable")) { for (i = 0; i < iLevel; i++) { iIndent = iIndent + (i < 2 ? 12 : 8); } } else if (oTable.isA("sap.ui.table.AnalyticalTable")) { iLevel = iLevel - 1; iLevel = !bChildren && !bSum ? iLevel - 1 : iLevel; iLevel = Math.max(iLevel, 0); for (i = 0; i < iLevel; i++) { if (iIndent == 0) { iIndent = 12; } iIndent = iIndent + (i < 2 ? 12 : 8); } } else { iLevel = !bChildren ? iLevel - 1 : iLevel; iLevel = Math.max(iLevel, 0); for (i = 0; i < iLevel; i++) { iIndent = iIndent + (i < 2 ? 12 : 8); } } return iIndent; }
javascript
function(oTable, iLevel, bChildren, bSum) { var iIndent = 0; var i; if (oTable.isA("sap.ui.table.TreeTable")) { for (i = 0; i < iLevel; i++) { iIndent = iIndent + (i < 2 ? 12 : 8); } } else if (oTable.isA("sap.ui.table.AnalyticalTable")) { iLevel = iLevel - 1; iLevel = !bChildren && !bSum ? iLevel - 1 : iLevel; iLevel = Math.max(iLevel, 0); for (i = 0; i < iLevel; i++) { if (iIndent == 0) { iIndent = 12; } iIndent = iIndent + (i < 2 ? 12 : 8); } } else { iLevel = !bChildren ? iLevel - 1 : iLevel; iLevel = Math.max(iLevel, 0); for (i = 0; i < iLevel; i++) { iIndent = iIndent + (i < 2 ? 12 : 8); } } return iIndent; }
[ "function", "(", "oTable", ",", "iLevel", ",", "bChildren", ",", "bSum", ")", "{", "var", "iIndent", "=", "0", ";", "var", "i", ";", "if", "(", "oTable", ".", "isA", "(", "\"sap.ui.table.TreeTable\"", ")", ")", "{", "for", "(", "i", "=", "0", ";", "i", "<", "iLevel", ";", "i", "++", ")", "{", "iIndent", "=", "iIndent", "+", "(", "i", "<", "2", "?", "12", ":", "8", ")", ";", "}", "}", "else", "if", "(", "oTable", ".", "isA", "(", "\"sap.ui.table.AnalyticalTable\"", ")", ")", "{", "iLevel", "=", "iLevel", "-", "1", ";", "iLevel", "=", "!", "bChildren", "&&", "!", "bSum", "?", "iLevel", "-", "1", ":", "iLevel", ";", "iLevel", "=", "Math", ".", "max", "(", "iLevel", ",", "0", ")", ";", "for", "(", "i", "=", "0", ";", "i", "<", "iLevel", ";", "i", "++", ")", "{", "if", "(", "iIndent", "==", "0", ")", "{", "iIndent", "=", "12", ";", "}", "iIndent", "=", "iIndent", "+", "(", "i", "<", "2", "?", "12", ":", "8", ")", ";", "}", "}", "else", "{", "iLevel", "=", "!", "bChildren", "?", "iLevel", "-", "1", ":", "iLevel", ";", "iLevel", "=", "Math", ".", "max", "(", "iLevel", ",", "0", ")", ";", "for", "(", "i", "=", "0", ";", "i", "<", "iLevel", ";", "i", "++", ")", "{", "iIndent", "=", "iIndent", "+", "(", "i", "<", "2", "?", "12", ":", "8", ")", ";", "}", "}", "return", "iIndent", ";", "}" ]
Computes the indents of the rows. @param {sap.ui.table.Table} oTable Instance of the table. @param {number} iLevel The hierarchy level. @param {boolean} bChildren Whether the row is a group (has children). @param {boolean} bSum Whether the row is a summary row. @returns {int} The indentation level. @private
[ "Computes", "the", "indents", "of", "the", "rows", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/TableGrouping.js#L284-L311
4,107
SAP/openui5
src/sap.ui.table/src/sap/ui/table/TableGrouping.js
function(oTable, $Row, $RowHdr, iIndent) { var bRTL = oTable._bRtlMode, $FirstCellContentInRow = $Row.find("td.sapUiTableCellFirst > .sapUiTableCellInner"), $Shield = $RowHdr.find(".sapUiTableGroupShield"); if (iIndent <= 0) { // No indent -> Remove custom manipulations (see else) $RowHdr.css(bRTL ? "right" : "left", ""); $Shield.css("width", "").css(bRTL ? "margin-right" : "margin-left", ""); $FirstCellContentInRow.css(bRTL ? "padding-right" : "padding-left", ""); } else { // Apply indent on table row $RowHdr.css(bRTL ? "right" : "left", iIndent + "px"); $Shield.css("width", iIndent + "px").css(bRTL ? "margin-right" : "margin-left", ((-1) * iIndent) + "px"); $FirstCellContentInRow.css(bRTL ? "padding-right" : "padding-left", (iIndent + 8/* +8px standard padding .sapUiTableCellInner */) + "px"); } }
javascript
function(oTable, $Row, $RowHdr, iIndent) { var bRTL = oTable._bRtlMode, $FirstCellContentInRow = $Row.find("td.sapUiTableCellFirst > .sapUiTableCellInner"), $Shield = $RowHdr.find(".sapUiTableGroupShield"); if (iIndent <= 0) { // No indent -> Remove custom manipulations (see else) $RowHdr.css(bRTL ? "right" : "left", ""); $Shield.css("width", "").css(bRTL ? "margin-right" : "margin-left", ""); $FirstCellContentInRow.css(bRTL ? "padding-right" : "padding-left", ""); } else { // Apply indent on table row $RowHdr.css(bRTL ? "right" : "left", iIndent + "px"); $Shield.css("width", iIndent + "px").css(bRTL ? "margin-right" : "margin-left", ((-1) * iIndent) + "px"); $FirstCellContentInRow.css(bRTL ? "padding-right" : "padding-left", (iIndent + 8/* +8px standard padding .sapUiTableCellInner */) + "px"); } }
[ "function", "(", "oTable", ",", "$Row", ",", "$RowHdr", ",", "iIndent", ")", "{", "var", "bRTL", "=", "oTable", ".", "_bRtlMode", ",", "$FirstCellContentInRow", "=", "$Row", ".", "find", "(", "\"td.sapUiTableCellFirst > .sapUiTableCellInner\"", ")", ",", "$Shield", "=", "$RowHdr", ".", "find", "(", "\".sapUiTableGroupShield\"", ")", ";", "if", "(", "iIndent", "<=", "0", ")", "{", "// No indent -> Remove custom manipulations (see else)", "$RowHdr", ".", "css", "(", "bRTL", "?", "\"right\"", ":", "\"left\"", ",", "\"\"", ")", ";", "$Shield", ".", "css", "(", "\"width\"", ",", "\"\"", ")", ".", "css", "(", "bRTL", "?", "\"margin-right\"", ":", "\"margin-left\"", ",", "\"\"", ")", ";", "$FirstCellContentInRow", ".", "css", "(", "bRTL", "?", "\"padding-right\"", ":", "\"padding-left\"", ",", "\"\"", ")", ";", "}", "else", "{", "// Apply indent on table row", "$RowHdr", ".", "css", "(", "bRTL", "?", "\"right\"", ":", "\"left\"", ",", "iIndent", "+", "\"px\"", ")", ";", "$Shield", ".", "css", "(", "\"width\"", ",", "iIndent", "+", "\"px\"", ")", ".", "css", "(", "bRTL", "?", "\"margin-right\"", ":", "\"margin-left\"", ",", "(", "(", "-", "1", ")", "*", "iIndent", ")", "+", "\"px\"", ")", ";", "$FirstCellContentInRow", ".", "css", "(", "bRTL", "?", "\"padding-right\"", ":", "\"padding-left\"", ",", "(", "iIndent", "+", "8", "/* +8px standard padding .sapUiTableCellInner */", ")", "+", "\"px\"", ")", ";", "}", "}" ]
Applies or removes the given indents on the given row elements. @param {sap.ui.table.Table} oTable Instance of the table. @param {jQuery} $Row jQuery representation of the row elements. @param {jQuery} $RowHdr jQuery representation of the row header elements. @param {int} iIndent The indent (in px) which should be applied. If the indent is smaller than 1 existing indents are removed. @private
[ "Applies", "or", "removes", "the", "given", "indents", "on", "the", "given", "row", "elements", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/TableGrouping.js#L322-L339
4,108
SAP/openui5
src/sap.ui.table/src/sap/ui/table/TableGrouping.js
function(oTable, oRow, bChildren, bExpanded, bHidden, bSum, iLevel, sGroupHeaderText) { var oDomRefs = oRow.getDomRefs(true), $Row = oDomRefs.row, $ScrollRow = oDomRefs.rowScrollPart, $FixedRow = oDomRefs.rowFixedPart, $RowHdr = oDomRefs.rowSelector, $RowAct = oDomRefs.rowAction; $Row.attr({ "data-sap-ui-level": iLevel }); $Row.data("sap-ui-level", iLevel); if (TableGrouping.isGroupMode(oTable)) { $Row.toggleClass("sapUiAnalyticalTableSum", !bChildren && bSum) .toggleClass("sapUiAnalyticalTableDummy", false) .toggleClass("sapUiTableGroupHeader", bChildren) .toggleClass("sapUiTableRowHidden", bChildren && bHidden || oRow._bHidden); jQuery(document.getElementById(oRow.getId() + "-groupHeader")) .toggleClass("sapUiTableGroupIconOpen", bChildren && bExpanded) .toggleClass("sapUiTableGroupIconClosed", bChildren && !bExpanded) .attr("title", oTable._getShowStandardTooltips() && sGroupHeaderText ? sGroupHeaderText : null) .text(sGroupHeaderText || ""); var iIndent = TableGrouping.calcGroupIndent(oTable, iLevel, bChildren, bSum); TableGrouping.setIndent(oTable, $Row, $RowHdr, iIndent); $Row.toggleClass("sapUiTableRowIndented", iIndent > 0); } var $TreeIcon = null; if (TableGrouping.isTreeMode(oTable)) { $TreeIcon = $Row.find(".sapUiTableTreeIcon"); $TreeIcon.css(oTable._bRtlMode ? "margin-right" : "margin-left", (iLevel * 17) + "px") .toggleClass("sapUiTableTreeIconLeaf", !bChildren) .toggleClass("sapUiTableTreeIconNodeOpen", bChildren && bExpanded) .toggleClass("sapUiTableTreeIconNodeClosed", bChildren && !bExpanded); } if (TableGrouping.showGroupMenuButton(oTable)) { // Update the GroupMenuButton var iScrollbarOffset = 0; var $Table = oTable.$(); if ($Table.hasClass("sapUiTableVScr")) { iScrollbarOffset += $Table.find(".sapUiTableVSb").width(); } var $GroupHeaderMenuButton = $RowHdr.find(".sapUiTableGroupMenuButton"); if (oTable._bRtlMode) { $GroupHeaderMenuButton.css("right", ($Table.width() - $GroupHeaderMenuButton.width() + $RowHdr.position().left - iScrollbarOffset - 5) + "px"); } else { $GroupHeaderMenuButton.css("left", ($Table.width() - $GroupHeaderMenuButton.width() - $RowHdr.position().left - iScrollbarOffset - 5) + "px"); } } oTable._getAccExtension() .updateAriaExpandAndLevelState(oRow, $ScrollRow, $RowHdr, $FixedRow, $RowAct, bChildren, bExpanded, iLevel, $TreeIcon); }
javascript
function(oTable, oRow, bChildren, bExpanded, bHidden, bSum, iLevel, sGroupHeaderText) { var oDomRefs = oRow.getDomRefs(true), $Row = oDomRefs.row, $ScrollRow = oDomRefs.rowScrollPart, $FixedRow = oDomRefs.rowFixedPart, $RowHdr = oDomRefs.rowSelector, $RowAct = oDomRefs.rowAction; $Row.attr({ "data-sap-ui-level": iLevel }); $Row.data("sap-ui-level", iLevel); if (TableGrouping.isGroupMode(oTable)) { $Row.toggleClass("sapUiAnalyticalTableSum", !bChildren && bSum) .toggleClass("sapUiAnalyticalTableDummy", false) .toggleClass("sapUiTableGroupHeader", bChildren) .toggleClass("sapUiTableRowHidden", bChildren && bHidden || oRow._bHidden); jQuery(document.getElementById(oRow.getId() + "-groupHeader")) .toggleClass("sapUiTableGroupIconOpen", bChildren && bExpanded) .toggleClass("sapUiTableGroupIconClosed", bChildren && !bExpanded) .attr("title", oTable._getShowStandardTooltips() && sGroupHeaderText ? sGroupHeaderText : null) .text(sGroupHeaderText || ""); var iIndent = TableGrouping.calcGroupIndent(oTable, iLevel, bChildren, bSum); TableGrouping.setIndent(oTable, $Row, $RowHdr, iIndent); $Row.toggleClass("sapUiTableRowIndented", iIndent > 0); } var $TreeIcon = null; if (TableGrouping.isTreeMode(oTable)) { $TreeIcon = $Row.find(".sapUiTableTreeIcon"); $TreeIcon.css(oTable._bRtlMode ? "margin-right" : "margin-left", (iLevel * 17) + "px") .toggleClass("sapUiTableTreeIconLeaf", !bChildren) .toggleClass("sapUiTableTreeIconNodeOpen", bChildren && bExpanded) .toggleClass("sapUiTableTreeIconNodeClosed", bChildren && !bExpanded); } if (TableGrouping.showGroupMenuButton(oTable)) { // Update the GroupMenuButton var iScrollbarOffset = 0; var $Table = oTable.$(); if ($Table.hasClass("sapUiTableVScr")) { iScrollbarOffset += $Table.find(".sapUiTableVSb").width(); } var $GroupHeaderMenuButton = $RowHdr.find(".sapUiTableGroupMenuButton"); if (oTable._bRtlMode) { $GroupHeaderMenuButton.css("right", ($Table.width() - $GroupHeaderMenuButton.width() + $RowHdr.position().left - iScrollbarOffset - 5) + "px"); } else { $GroupHeaderMenuButton.css("left", ($Table.width() - $GroupHeaderMenuButton.width() - $RowHdr.position().left - iScrollbarOffset - 5) + "px"); } } oTable._getAccExtension() .updateAriaExpandAndLevelState(oRow, $ScrollRow, $RowHdr, $FixedRow, $RowAct, bChildren, bExpanded, iLevel, $TreeIcon); }
[ "function", "(", "oTable", ",", "oRow", ",", "bChildren", ",", "bExpanded", ",", "bHidden", ",", "bSum", ",", "iLevel", ",", "sGroupHeaderText", ")", "{", "var", "oDomRefs", "=", "oRow", ".", "getDomRefs", "(", "true", ")", ",", "$Row", "=", "oDomRefs", ".", "row", ",", "$ScrollRow", "=", "oDomRefs", ".", "rowScrollPart", ",", "$FixedRow", "=", "oDomRefs", ".", "rowFixedPart", ",", "$RowHdr", "=", "oDomRefs", ".", "rowSelector", ",", "$RowAct", "=", "oDomRefs", ".", "rowAction", ";", "$Row", ".", "attr", "(", "{", "\"data-sap-ui-level\"", ":", "iLevel", "}", ")", ";", "$Row", ".", "data", "(", "\"sap-ui-level\"", ",", "iLevel", ")", ";", "if", "(", "TableGrouping", ".", "isGroupMode", "(", "oTable", ")", ")", "{", "$Row", ".", "toggleClass", "(", "\"sapUiAnalyticalTableSum\"", ",", "!", "bChildren", "&&", "bSum", ")", ".", "toggleClass", "(", "\"sapUiAnalyticalTableDummy\"", ",", "false", ")", ".", "toggleClass", "(", "\"sapUiTableGroupHeader\"", ",", "bChildren", ")", ".", "toggleClass", "(", "\"sapUiTableRowHidden\"", ",", "bChildren", "&&", "bHidden", "||", "oRow", ".", "_bHidden", ")", ";", "jQuery", "(", "document", ".", "getElementById", "(", "oRow", ".", "getId", "(", ")", "+", "\"-groupHeader\"", ")", ")", ".", "toggleClass", "(", "\"sapUiTableGroupIconOpen\"", ",", "bChildren", "&&", "bExpanded", ")", ".", "toggleClass", "(", "\"sapUiTableGroupIconClosed\"", ",", "bChildren", "&&", "!", "bExpanded", ")", ".", "attr", "(", "\"title\"", ",", "oTable", ".", "_getShowStandardTooltips", "(", ")", "&&", "sGroupHeaderText", "?", "sGroupHeaderText", ":", "null", ")", ".", "text", "(", "sGroupHeaderText", "||", "\"\"", ")", ";", "var", "iIndent", "=", "TableGrouping", ".", "calcGroupIndent", "(", "oTable", ",", "iLevel", ",", "bChildren", ",", "bSum", ")", ";", "TableGrouping", ".", "setIndent", "(", "oTable", ",", "$Row", ",", "$RowHdr", ",", "iIndent", ")", ";", "$Row", ".", "toggleClass", "(", "\"sapUiTableRowIndented\"", ",", "iIndent", ">", "0", ")", ";", "}", "var", "$TreeIcon", "=", "null", ";", "if", "(", "TableGrouping", ".", "isTreeMode", "(", "oTable", ")", ")", "{", "$TreeIcon", "=", "$Row", ".", "find", "(", "\".sapUiTableTreeIcon\"", ")", ";", "$TreeIcon", ".", "css", "(", "oTable", ".", "_bRtlMode", "?", "\"margin-right\"", ":", "\"margin-left\"", ",", "(", "iLevel", "*", "17", ")", "+", "\"px\"", ")", ".", "toggleClass", "(", "\"sapUiTableTreeIconLeaf\"", ",", "!", "bChildren", ")", ".", "toggleClass", "(", "\"sapUiTableTreeIconNodeOpen\"", ",", "bChildren", "&&", "bExpanded", ")", ".", "toggleClass", "(", "\"sapUiTableTreeIconNodeClosed\"", ",", "bChildren", "&&", "!", "bExpanded", ")", ";", "}", "if", "(", "TableGrouping", ".", "showGroupMenuButton", "(", "oTable", ")", ")", "{", "// Update the GroupMenuButton", "var", "iScrollbarOffset", "=", "0", ";", "var", "$Table", "=", "oTable", ".", "$", "(", ")", ";", "if", "(", "$Table", ".", "hasClass", "(", "\"sapUiTableVScr\"", ")", ")", "{", "iScrollbarOffset", "+=", "$Table", ".", "find", "(", "\".sapUiTableVSb\"", ")", ".", "width", "(", ")", ";", "}", "var", "$GroupHeaderMenuButton", "=", "$RowHdr", ".", "find", "(", "\".sapUiTableGroupMenuButton\"", ")", ";", "if", "(", "oTable", ".", "_bRtlMode", ")", "{", "$GroupHeaderMenuButton", ".", "css", "(", "\"right\"", ",", "(", "$Table", ".", "width", "(", ")", "-", "$GroupHeaderMenuButton", ".", "width", "(", ")", "+", "$RowHdr", ".", "position", "(", ")", ".", "left", "-", "iScrollbarOffset", "-", "5", ")", "+", "\"px\"", ")", ";", "}", "else", "{", "$GroupHeaderMenuButton", ".", "css", "(", "\"left\"", ",", "(", "$Table", ".", "width", "(", ")", "-", "$GroupHeaderMenuButton", ".", "width", "(", ")", "-", "$RowHdr", ".", "position", "(", ")", ".", "left", "-", "iScrollbarOffset", "-", "5", ")", "+", "\"px\"", ")", ";", "}", "}", "oTable", ".", "_getAccExtension", "(", ")", ".", "updateAriaExpandAndLevelState", "(", "oRow", ",", "$ScrollRow", ",", "$RowHdr", ",", "$FixedRow", ",", "$RowAct", ",", "bChildren", ",", "bExpanded", ",", "iLevel", ",", "$TreeIcon", ")", ";", "}" ]
Updates the dom of the given row depending on the given parameters. @param {sap.ui.table.Table} oTable Instance of the table. @param {sap.ui.table.Row} oRow Instance of the row. @param {boolean} bChildren Whether the row is a group (has children). @param {boolean} bExpanded Whether the row should be expanded. @param {boolean} bHidden Whether the row content should be hidden. @param {boolean} bSum Whether the row should be a summary row. @param {number} iLevel The hierarchy level. @param {string} sGroupHeaderText The title of the group header.
[ "Updates", "the", "dom", "of", "the", "given", "row", "depending", "on", "the", "given", "parameters", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/TableGrouping.js#L353-L414
4,109
SAP/openui5
src/sap.ui.table/src/sap/ui/table/TableGrouping.js
function(oTable) { var oBinding = oTable.getBinding("rows"); if (oBinding && oBinding._modified) { TableGrouping.clearMode(oTable); var oBindingInfo = oTable.getBindingInfo("rows"); oTable.unbindRows(); oTable.bindRows(oBindingInfo); } }
javascript
function(oTable) { var oBinding = oTable.getBinding("rows"); if (oBinding && oBinding._modified) { TableGrouping.clearMode(oTable); var oBindingInfo = oTable.getBindingInfo("rows"); oTable.unbindRows(); oTable.bindRows(oBindingInfo); } }
[ "function", "(", "oTable", ")", "{", "var", "oBinding", "=", "oTable", ".", "getBinding", "(", "\"rows\"", ")", ";", "if", "(", "oBinding", "&&", "oBinding", ".", "_modified", ")", "{", "TableGrouping", ".", "clearMode", "(", "oTable", ")", ";", "var", "oBindingInfo", "=", "oTable", ".", "getBindingInfo", "(", "\"rows\"", ")", ";", "oTable", ".", "unbindRows", "(", ")", ";", "oTable", ".", "bindRows", "(", "oBindingInfo", ")", ";", "}", "}" ]
Cleans up the experimental grouping for sap.ui.table.Table. @param {sap.ui.table.Table} oTable Instance of the table.
[ "Cleans", "up", "the", "experimental", "grouping", "for", "sap", ".", "ui", ".", "table", ".", "Table", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/TableGrouping.js#L681-L689
4,110
SAP/openui5
src/sap.ui.core/src/sap/ui/core/util/serializer/ViewSerializer.js
function (oEvent) { // both xml and html view write this ui5 internal property for the serializer if (oEvent.fFunction && oEvent.fFunction._sapui_handlerName) { var sHandlerName = oEvent.fFunction._sapui_handlerName; // double check that the function is on the controller var oController = oView.getController(); if (oController[sHandlerName] || sap.ui.getCore().getConfiguration().getControllerCodeDeactivated()) { return sHandlerName; } } // TODO: ITERARTE OVER HANDLERS AND CHECK THE EVENT FUNCTION // NOTE: JQUERY GUID WON'T WORK AS THE GUID WILL BE SAVED AT THE CLOSURED FUNCTION AS WELL // WHEN THE FUNCTION IS REUSED FOR SEVERAL HANDLERS WE WILL LOSE THE INFORMATION /*for (var sHandler in oController) { if (oController[sHandler] === oEvent.fFunction) { return sHandler; } }*/ }
javascript
function (oEvent) { // both xml and html view write this ui5 internal property for the serializer if (oEvent.fFunction && oEvent.fFunction._sapui_handlerName) { var sHandlerName = oEvent.fFunction._sapui_handlerName; // double check that the function is on the controller var oController = oView.getController(); if (oController[sHandlerName] || sap.ui.getCore().getConfiguration().getControllerCodeDeactivated()) { return sHandlerName; } } // TODO: ITERARTE OVER HANDLERS AND CHECK THE EVENT FUNCTION // NOTE: JQUERY GUID WON'T WORK AS THE GUID WILL BE SAVED AT THE CLOSURED FUNCTION AS WELL // WHEN THE FUNCTION IS REUSED FOR SEVERAL HANDLERS WE WILL LOSE THE INFORMATION /*for (var sHandler in oController) { if (oController[sHandler] === oEvent.fFunction) { return sHandler; } }*/ }
[ "function", "(", "oEvent", ")", "{", "// both xml and html view write this ui5 internal property for the serializer", "if", "(", "oEvent", ".", "fFunction", "&&", "oEvent", ".", "fFunction", ".", "_sapui_handlerName", ")", "{", "var", "sHandlerName", "=", "oEvent", ".", "fFunction", ".", "_sapui_handlerName", ";", "// double check that the function is on the controller", "var", "oController", "=", "oView", ".", "getController", "(", ")", ";", "if", "(", "oController", "[", "sHandlerName", "]", "||", "sap", ".", "ui", ".", "getCore", "(", ")", ".", "getConfiguration", "(", ")", ".", "getControllerCodeDeactivated", "(", ")", ")", "{", "return", "sHandlerName", ";", "}", "}", "// TODO: ITERARTE OVER HANDLERS AND CHECK THE EVENT FUNCTION", "// NOTE: JQUERY GUID WON'T WORK AS THE GUID WILL BE SAVED AT THE CLOSURED FUNCTION AS WELL", "// WHEN THE FUNCTION IS REUSED FOR SEVERAL HANDLERS WE WILL LOSE THE INFORMATION", "/*for (var sHandler in oController) {\n\t\t\t\tif (oController[sHandler] === oEvent.fFunction) {\n\t\t\t\t\treturn sHandler;\n\t\t\t\t}\n\t\t\t}*/", "}" ]
a function to find the event handler name for an event
[ "a", "function", "to", "find", "the", "event", "handler", "name", "for", "an", "event" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/util/serializer/ViewSerializer.js#L142-L162
4,111
SAP/openui5
src/sap.ui.core/src/sap/ui/core/util/serializer/ViewSerializer.js
function (oControl) { // Allow specification of desired controlId as changing ids later on is not possible //This has to be the view relative ID if (oControl._sapui_controlId) { return oControl._sapui_controlId; } return oControl.getId().replace(oView.createId(""), ""); }
javascript
function (oControl) { // Allow specification of desired controlId as changing ids later on is not possible //This has to be the view relative ID if (oControl._sapui_controlId) { return oControl._sapui_controlId; } return oControl.getId().replace(oView.createId(""), ""); }
[ "function", "(", "oControl", ")", "{", "// Allow specification of desired controlId as changing ids later on is not possible", "//This has to be the view relative ID", "if", "(", "oControl", ".", "_sapui_controlId", ")", "{", "return", "oControl", ".", "_sapui_controlId", ";", "}", "return", "oControl", ".", "getId", "(", ")", ".", "replace", "(", "oView", ".", "createId", "(", "\"\"", ")", ",", "\"\"", ")", ";", "}" ]
a function to compute the control id
[ "a", "function", "to", "compute", "the", "control", "id" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/util/serializer/ViewSerializer.js#L165-L172
4,112
SAP/openui5
src/sap.ui.integration/src/sap-ui-integration.js
boot
function boot() { if (window.sap && window.sap.ui && window.sap.ui.getCore) { coreInstance = window.sap.ui.getCore(); return initTags(); } window.sap.ui.require(['/ui5loader-autoconfig', 'sap/ui/core/Core', 'sap/ui/integration/util/CustomElements'], function (config, Core, CE) { CustomElements = CE; Core.boot(); coreInstance = Core; Core.attachInit(function () { initTags(); }); //pass on the core instance to Customelements interface CustomElements.coreInstance = coreInstance; }); }
javascript
function boot() { if (window.sap && window.sap.ui && window.sap.ui.getCore) { coreInstance = window.sap.ui.getCore(); return initTags(); } window.sap.ui.require(['/ui5loader-autoconfig', 'sap/ui/core/Core', 'sap/ui/integration/util/CustomElements'], function (config, Core, CE) { CustomElements = CE; Core.boot(); coreInstance = Core; Core.attachInit(function () { initTags(); }); //pass on the core instance to Customelements interface CustomElements.coreInstance = coreInstance; }); }
[ "function", "boot", "(", ")", "{", "if", "(", "window", ".", "sap", "&&", "window", ".", "sap", ".", "ui", "&&", "window", ".", "sap", ".", "ui", ".", "getCore", ")", "{", "coreInstance", "=", "window", ".", "sap", ".", "ui", ".", "getCore", "(", ")", ";", "return", "initTags", "(", ")", ";", "}", "window", ".", "sap", ".", "ui", ".", "require", "(", "[", "'/ui5loader-autoconfig'", ",", "'sap/ui/core/Core'", ",", "'sap/ui/integration/util/CustomElements'", "]", ",", "function", "(", "config", ",", "Core", ",", "CE", ")", "{", "CustomElements", "=", "CE", ";", "Core", ".", "boot", "(", ")", ";", "coreInstance", "=", "Core", ";", "Core", ".", "attachInit", "(", "function", "(", ")", "{", "initTags", "(", ")", ";", "}", ")", ";", "//pass on the core instance to Customelements interface", "CustomElements", ".", "coreInstance", "=", "coreInstance", ";", "}", ")", ";", "}" ]
initialize the loader
[ "initialize", "the", "loader" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.integration/src/sap-ui-integration.js#L110-L127
4,113
SAP/openui5
src/sap.ui.demokit/src/sap/ui/demokit/explored/view/base.controller.js
function () { var sJson = this._oStorage.get(this._sStorageKey); if (!sJson) { // local storage is empty, apply defaults this._oViewSettings = this._oDefaultSettings; } else { // parse this._oViewSettings = JSON.parse(sJson); // clean filter and remove values that do not exist any longer in the data model // (the cleaned filter are not written back to local storage, this only happens on changing the view settings) //var oFilterData = this.getView().getModel("filter").getData(); var oFilterData = this.getOwnerComponent().getModel("filter").getData(); var oCleanFilter = {}; jQuery.each(this._oViewSettings.filter, function (sProperty, aValues) { var aNewValues = []; jQuery.each(aValues, function (i, aValue) { var bValueIsClean = false; jQuery.each(oFilterData[sProperty], function (i, oValue) { if (oValue.id === aValue) { bValueIsClean = true; return false; } }); if (bValueIsClean) { aNewValues.push(aValue); } }); if (aNewValues.length > 0) { oCleanFilter[sProperty] = aNewValues; } }); this._oViewSettings.filter = oCleanFilter; // handling data stored with an older explored versions if (!this._oViewSettings.hasOwnProperty("compactOn")) { // compactOn was introduced later this._oViewSettings.compactOn = false; } if (!this._oViewSettings.hasOwnProperty("themeActive")) { // themeActive was introduced later this._oViewSettings.themeActive = "sap_bluecrystal"; } else if (this._oViewSettings.version !== this._oDefaultSettings.version) { var oVersion = jQuery.sap.Version(sap.ui.version); if (oVersion.compareTo("1.40.0") >= 0) { // Belize theme is available since 1.40 this._oViewSettings.themeActive = "sap_belize"; } else { // Fallback to BlueCrystal for older versions this._oViewSettings.themeActive = "sap_bluecrystal"; } } if (!this._oViewSettings.hasOwnProperty("rtl")) { // rtl was introduced later this._oViewSettings.rtl = false; } // handle RTL-on in settings as this need a reload if (this._oViewSettings.rtl && !jQuery.sap.getUriParameters().get('sap-ui-rtl')) { this._handleRTL(true); } } }
javascript
function () { var sJson = this._oStorage.get(this._sStorageKey); if (!sJson) { // local storage is empty, apply defaults this._oViewSettings = this._oDefaultSettings; } else { // parse this._oViewSettings = JSON.parse(sJson); // clean filter and remove values that do not exist any longer in the data model // (the cleaned filter are not written back to local storage, this only happens on changing the view settings) //var oFilterData = this.getView().getModel("filter").getData(); var oFilterData = this.getOwnerComponent().getModel("filter").getData(); var oCleanFilter = {}; jQuery.each(this._oViewSettings.filter, function (sProperty, aValues) { var aNewValues = []; jQuery.each(aValues, function (i, aValue) { var bValueIsClean = false; jQuery.each(oFilterData[sProperty], function (i, oValue) { if (oValue.id === aValue) { bValueIsClean = true; return false; } }); if (bValueIsClean) { aNewValues.push(aValue); } }); if (aNewValues.length > 0) { oCleanFilter[sProperty] = aNewValues; } }); this._oViewSettings.filter = oCleanFilter; // handling data stored with an older explored versions if (!this._oViewSettings.hasOwnProperty("compactOn")) { // compactOn was introduced later this._oViewSettings.compactOn = false; } if (!this._oViewSettings.hasOwnProperty("themeActive")) { // themeActive was introduced later this._oViewSettings.themeActive = "sap_bluecrystal"; } else if (this._oViewSettings.version !== this._oDefaultSettings.version) { var oVersion = jQuery.sap.Version(sap.ui.version); if (oVersion.compareTo("1.40.0") >= 0) { // Belize theme is available since 1.40 this._oViewSettings.themeActive = "sap_belize"; } else { // Fallback to BlueCrystal for older versions this._oViewSettings.themeActive = "sap_bluecrystal"; } } if (!this._oViewSettings.hasOwnProperty("rtl")) { // rtl was introduced later this._oViewSettings.rtl = false; } // handle RTL-on in settings as this need a reload if (this._oViewSettings.rtl && !jQuery.sap.getUriParameters().get('sap-ui-rtl')) { this._handleRTL(true); } } }
[ "function", "(", ")", "{", "var", "sJson", "=", "this", ".", "_oStorage", ".", "get", "(", "this", ".", "_sStorageKey", ")", ";", "if", "(", "!", "sJson", ")", "{", "// local storage is empty, apply defaults", "this", ".", "_oViewSettings", "=", "this", ".", "_oDefaultSettings", ";", "}", "else", "{", "// parse", "this", ".", "_oViewSettings", "=", "JSON", ".", "parse", "(", "sJson", ")", ";", "// clean filter and remove values that do not exist any longer in the data model", "// (the cleaned filter are not written back to local storage, this only happens on changing the view settings)", "//var oFilterData = this.getView().getModel(\"filter\").getData();", "var", "oFilterData", "=", "this", ".", "getOwnerComponent", "(", ")", ".", "getModel", "(", "\"filter\"", ")", ".", "getData", "(", ")", ";", "var", "oCleanFilter", "=", "{", "}", ";", "jQuery", ".", "each", "(", "this", ".", "_oViewSettings", ".", "filter", ",", "function", "(", "sProperty", ",", "aValues", ")", "{", "var", "aNewValues", "=", "[", "]", ";", "jQuery", ".", "each", "(", "aValues", ",", "function", "(", "i", ",", "aValue", ")", "{", "var", "bValueIsClean", "=", "false", ";", "jQuery", ".", "each", "(", "oFilterData", "[", "sProperty", "]", ",", "function", "(", "i", ",", "oValue", ")", "{", "if", "(", "oValue", ".", "id", "===", "aValue", ")", "{", "bValueIsClean", "=", "true", ";", "return", "false", ";", "}", "}", ")", ";", "if", "(", "bValueIsClean", ")", "{", "aNewValues", ".", "push", "(", "aValue", ")", ";", "}", "}", ")", ";", "if", "(", "aNewValues", ".", "length", ">", "0", ")", "{", "oCleanFilter", "[", "sProperty", "]", "=", "aNewValues", ";", "}", "}", ")", ";", "this", ".", "_oViewSettings", ".", "filter", "=", "oCleanFilter", ";", "// handling data stored with an older explored versions", "if", "(", "!", "this", ".", "_oViewSettings", ".", "hasOwnProperty", "(", "\"compactOn\"", ")", ")", "{", "// compactOn was introduced later", "this", ".", "_oViewSettings", ".", "compactOn", "=", "false", ";", "}", "if", "(", "!", "this", ".", "_oViewSettings", ".", "hasOwnProperty", "(", "\"themeActive\"", ")", ")", "{", "// themeActive was introduced later", "this", ".", "_oViewSettings", ".", "themeActive", "=", "\"sap_bluecrystal\"", ";", "}", "else", "if", "(", "this", ".", "_oViewSettings", ".", "version", "!==", "this", ".", "_oDefaultSettings", ".", "version", ")", "{", "var", "oVersion", "=", "jQuery", ".", "sap", ".", "Version", "(", "sap", ".", "ui", ".", "version", ")", ";", "if", "(", "oVersion", ".", "compareTo", "(", "\"1.40.0\"", ")", ">=", "0", ")", "{", "// Belize theme is available since 1.40", "this", ".", "_oViewSettings", ".", "themeActive", "=", "\"sap_belize\"", ";", "}", "else", "{", "// Fallback to BlueCrystal for older versions", "this", ".", "_oViewSettings", ".", "themeActive", "=", "\"sap_bluecrystal\"", ";", "}", "}", "if", "(", "!", "this", ".", "_oViewSettings", ".", "hasOwnProperty", "(", "\"rtl\"", ")", ")", "{", "// rtl was introduced later", "this", ".", "_oViewSettings", ".", "rtl", "=", "false", ";", "}", "// handle RTL-on in settings as this need a reload", "if", "(", "this", ".", "_oViewSettings", ".", "rtl", "&&", "!", "jQuery", ".", "sap", ".", "getUriParameters", "(", ")", ".", "get", "(", "'sap-ui-rtl'", ")", ")", "{", "this", ".", "_handleRTL", "(", "true", ")", ";", "}", "}", "}" ]
Inits the view settings. At first local storage is checked. If this is empty defaults are applied.
[ "Inits", "the", "view", "settings", ".", "At", "first", "local", "storage", "is", "checked", ".", "If", "this", "is", "empty", "defaults", "are", "applied", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.demokit/src/sap/ui/demokit/explored/view/base.controller.js#L56-L118
4,114
SAP/openui5
src/sap.ui.table/src/sap/ui/table/TableScrollExtension.js
function(oTable) { var oScrollExtension = oTable._getScrollExtension(); var oHSb = oScrollExtension.getHorizontalScrollbar(); if (oHSb && internal(oTable).iHorizontalScrollPosition !== null) { var aScrollTargets = HorizontalScrollingHelper.getScrollAreas(oTable); for (var i = 0; i < aScrollTargets.length; i++) { var oScrollTarget = aScrollTargets[i]; delete oScrollTarget._scrollLeft; } if (oHSb.scrollLeft !== internal(oTable).iHorizontalScrollPosition) { oHSb.scrollLeft = internal(oTable).iHorizontalScrollPosition; } else { var oEvent = jQuery.Event("scroll"); oEvent.target = oHSb; HorizontalScrollingHelper.onScroll.call(oTable, oEvent); } } }
javascript
function(oTable) { var oScrollExtension = oTable._getScrollExtension(); var oHSb = oScrollExtension.getHorizontalScrollbar(); if (oHSb && internal(oTable).iHorizontalScrollPosition !== null) { var aScrollTargets = HorizontalScrollingHelper.getScrollAreas(oTable); for (var i = 0; i < aScrollTargets.length; i++) { var oScrollTarget = aScrollTargets[i]; delete oScrollTarget._scrollLeft; } if (oHSb.scrollLeft !== internal(oTable).iHorizontalScrollPosition) { oHSb.scrollLeft = internal(oTable).iHorizontalScrollPosition; } else { var oEvent = jQuery.Event("scroll"); oEvent.target = oHSb; HorizontalScrollingHelper.onScroll.call(oTable, oEvent); } } }
[ "function", "(", "oTable", ")", "{", "var", "oScrollExtension", "=", "oTable", ".", "_getScrollExtension", "(", ")", ";", "var", "oHSb", "=", "oScrollExtension", ".", "getHorizontalScrollbar", "(", ")", ";", "if", "(", "oHSb", "&&", "internal", "(", "oTable", ")", ".", "iHorizontalScrollPosition", "!==", "null", ")", "{", "var", "aScrollTargets", "=", "HorizontalScrollingHelper", ".", "getScrollAreas", "(", "oTable", ")", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "aScrollTargets", ".", "length", ";", "i", "++", ")", "{", "var", "oScrollTarget", "=", "aScrollTargets", "[", "i", "]", ";", "delete", "oScrollTarget", ".", "_scrollLeft", ";", "}", "if", "(", "oHSb", ".", "scrollLeft", "!==", "internal", "(", "oTable", ")", ".", "iHorizontalScrollPosition", ")", "{", "oHSb", ".", "scrollLeft", "=", "internal", "(", "oTable", ")", ".", "iHorizontalScrollPosition", ";", "}", "else", "{", "var", "oEvent", "=", "jQuery", ".", "Event", "(", "\"scroll\"", ")", ";", "oEvent", ".", "target", "=", "oHSb", ";", "HorizontalScrollingHelper", ".", "onScroll", ".", "call", "(", "oTable", ",", "oEvent", ")", ";", "}", "}", "}" ]
This function can be used to restore the last horizontal scroll position which has been stored. In case there is no stored scroll position nothing happens. @param {sap.ui.table.Table} oTable Instance of the table. @see HorizontalScrollingHelper#onScroll
[ "This", "function", "can", "be", "used", "to", "restore", "the", "last", "horizontal", "scroll", "position", "which", "has", "been", "stored", ".", "In", "case", "there", "is", "no", "stored", "scroll", "position", "nothing", "happens", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/TableScrollExtension.js#L182-L202
4,115
SAP/openui5
src/sap.ui.table/src/sap/ui/table/TableScrollExtension.js
function(oTable) { var oDomRef = oTable.getDomRef(); var aScrollableColumnAreas; if (oDomRef) { aScrollableColumnAreas = Array.prototype.slice.call(oTable.getDomRef().querySelectorAll(".sapUiTableCtrlScr")); } var aScrollAreas = [ oTable._getScrollExtension().getHorizontalScrollbar() ].concat(aScrollableColumnAreas); return aScrollAreas.filter(function(oScrollArea) { return oScrollArea != null; }); }
javascript
function(oTable) { var oDomRef = oTable.getDomRef(); var aScrollableColumnAreas; if (oDomRef) { aScrollableColumnAreas = Array.prototype.slice.call(oTable.getDomRef().querySelectorAll(".sapUiTableCtrlScr")); } var aScrollAreas = [ oTable._getScrollExtension().getHorizontalScrollbar() ].concat(aScrollableColumnAreas); return aScrollAreas.filter(function(oScrollArea) { return oScrollArea != null; }); }
[ "function", "(", "oTable", ")", "{", "var", "oDomRef", "=", "oTable", ".", "getDomRef", "(", ")", ";", "var", "aScrollableColumnAreas", ";", "if", "(", "oDomRef", ")", "{", "aScrollableColumnAreas", "=", "Array", ".", "prototype", ".", "slice", ".", "call", "(", "oTable", ".", "getDomRef", "(", ")", ".", "querySelectorAll", "(", "\".sapUiTableCtrlScr\"", ")", ")", ";", "}", "var", "aScrollAreas", "=", "[", "oTable", ".", "_getScrollExtension", "(", ")", ".", "getHorizontalScrollbar", "(", ")", "]", ".", "concat", "(", "aScrollableColumnAreas", ")", ";", "return", "aScrollAreas", ".", "filter", "(", "function", "(", "oScrollArea", ")", "{", "return", "oScrollArea", "!=", "null", ";", "}", ")", ";", "}" ]
Gets the areas of the table which can be scrolled horizontally. @param {sap.ui.table.Table} oTable Instance of the table. @returns {HTMLElement[]} Returns only elements which exist in the DOM. @private
[ "Gets", "the", "areas", "of", "the", "table", "which", "can", "be", "scrolled", "horizontally", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/TableScrollExtension.js#L270-L285
4,116
SAP/openui5
src/sap.ui.table/src/sap/ui/table/TableScrollExtension.js
function(oEvent) { // For interaction detection. Interaction.notifyScrollEvent && Interaction.notifyScrollEvent(oEvent); if (internal(this).bIsScrolledVerticallyByKeyboard) { // When scrolling with the keyboard the first visible row is already correct and does not need adjustment. log("Vertical scroll event handler: Aborted - Scrolled by keyboard", this); return; } // Do not scroll in action mode, if scrolling was not initiated by a keyboard action! // Might cause loss of user input and other undesired behavior. this._getKeyboardExtension().setActionMode(false); var nNewScrollTop = oEvent.target.scrollTop; // Can be a float if zoomed in Chrome. var nOldScrollTop = oEvent.target._scrollTop; // This will be set in VerticalScrollingHelper#updateScrollPosition. var bScrollWithScrollbar = nNewScrollTop !== nOldScrollTop; if (bScrollWithScrollbar) { log("Vertical scroll event handler: Scroll position changed by scrolling with the scrollbar:" + " From " + internal(this).nVerticalScrollPosition + " to " + nNewScrollTop, this); delete oEvent.target._scrollTop; VerticalScrollingHelper.updateScrollPosition(this, nNewScrollTop, ScrollTrigger.SCROLLBAR); } else { log("Vertical scroll event handler: Scroll position changed by scrolling with VerticalScrollingHelper#updateScrollPosition", this); } internal(this).bIsScrolledVerticallyByWheel = false; }
javascript
function(oEvent) { // For interaction detection. Interaction.notifyScrollEvent && Interaction.notifyScrollEvent(oEvent); if (internal(this).bIsScrolledVerticallyByKeyboard) { // When scrolling with the keyboard the first visible row is already correct and does not need adjustment. log("Vertical scroll event handler: Aborted - Scrolled by keyboard", this); return; } // Do not scroll in action mode, if scrolling was not initiated by a keyboard action! // Might cause loss of user input and other undesired behavior. this._getKeyboardExtension().setActionMode(false); var nNewScrollTop = oEvent.target.scrollTop; // Can be a float if zoomed in Chrome. var nOldScrollTop = oEvent.target._scrollTop; // This will be set in VerticalScrollingHelper#updateScrollPosition. var bScrollWithScrollbar = nNewScrollTop !== nOldScrollTop; if (bScrollWithScrollbar) { log("Vertical scroll event handler: Scroll position changed by scrolling with the scrollbar:" + " From " + internal(this).nVerticalScrollPosition + " to " + nNewScrollTop, this); delete oEvent.target._scrollTop; VerticalScrollingHelper.updateScrollPosition(this, nNewScrollTop, ScrollTrigger.SCROLLBAR); } else { log("Vertical scroll event handler: Scroll position changed by scrolling with VerticalScrollingHelper#updateScrollPosition", this); } internal(this).bIsScrolledVerticallyByWheel = false; }
[ "function", "(", "oEvent", ")", "{", "// For interaction detection.", "Interaction", ".", "notifyScrollEvent", "&&", "Interaction", ".", "notifyScrollEvent", "(", "oEvent", ")", ";", "if", "(", "internal", "(", "this", ")", ".", "bIsScrolledVerticallyByKeyboard", ")", "{", "// When scrolling with the keyboard the first visible row is already correct and does not need adjustment.", "log", "(", "\"Vertical scroll event handler: Aborted - Scrolled by keyboard\"", ",", "this", ")", ";", "return", ";", "}", "// Do not scroll in action mode, if scrolling was not initiated by a keyboard action!", "// Might cause loss of user input and other undesired behavior.", "this", ".", "_getKeyboardExtension", "(", ")", ".", "setActionMode", "(", "false", ")", ";", "var", "nNewScrollTop", "=", "oEvent", ".", "target", ".", "scrollTop", ";", "// Can be a float if zoomed in Chrome.", "var", "nOldScrollTop", "=", "oEvent", ".", "target", ".", "_scrollTop", ";", "// This will be set in VerticalScrollingHelper#updateScrollPosition.", "var", "bScrollWithScrollbar", "=", "nNewScrollTop", "!==", "nOldScrollTop", ";", "if", "(", "bScrollWithScrollbar", ")", "{", "log", "(", "\"Vertical scroll event handler: Scroll position changed by scrolling with the scrollbar:\"", "+", "\" From \"", "+", "internal", "(", "this", ")", ".", "nVerticalScrollPosition", "+", "\" to \"", "+", "nNewScrollTop", ",", "this", ")", ";", "delete", "oEvent", ".", "target", ".", "_scrollTop", ";", "VerticalScrollingHelper", ".", "updateScrollPosition", "(", "this", ",", "nNewScrollTop", ",", "ScrollTrigger", ".", "SCROLLBAR", ")", ";", "}", "else", "{", "log", "(", "\"Vertical scroll event handler: Scroll position changed by scrolling with VerticalScrollingHelper#updateScrollPosition\"", ",", "this", ")", ";", "}", "internal", "(", "this", ")", ".", "bIsScrolledVerticallyByWheel", "=", "false", ";", "}" ]
Will be called if scrolled vertically. Updates the visualized data by applying the first visible row from the vertical scrollbar. @param {jQuery.Event} oEvent The event object.
[ "Will", "be", "called", "if", "scrolled", "vertically", ".", "Updates", "the", "visualized", "data", "by", "applying", "the", "first", "visible", "row", "from", "the", "vertical", "scrollbar", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/TableScrollExtension.js#L430-L458
4,117
SAP/openui5
src/sap.ui.table/src/sap/ui/table/TableScrollExtension.js
function(oTable) { var oScrollExtension = oTable._getScrollExtension(); var iMaxFirstRenderedRowIndex = oTable._getMaxFirstRenderedRowIndex(); var iNewFirstVisibleRowIndex = VerticalScrollingHelper.getRowIndexAtCurrentScrollPosition(oTable); var iOldFirstVisibleRowIndex = oTable.getFirstVisibleRow(); var bNewFirstVisibleRowInBuffer = iNewFirstVisibleRowIndex < 0; var bOldFirstVisibleRowInBuffer = iOldFirstVisibleRowIndex >= iMaxFirstRenderedRowIndex; var bFirstVisibleRowChanged = iNewFirstVisibleRowIndex !== iOldFirstVisibleRowIndex; var bRowsUpdateRequired = bFirstVisibleRowChanged && !(bNewFirstVisibleRowInBuffer && bOldFirstVisibleRowInBuffer); if (bRowsUpdateRequired) { var bExpectRowsUpdatedEvent = !bOldFirstVisibleRowInBuffer || iNewFirstVisibleRowIndex !== iMaxFirstRenderedRowIndex; if (bNewFirstVisibleRowInBuffer) { // The actual new first visible row cannot be determined yet. It will be done when the inner scroll position gets updated. iNewFirstVisibleRowIndex = iMaxFirstRenderedRowIndex; } log("updateFirstVisibleRow: From " + iOldFirstVisibleRowIndex + " to " + iNewFirstVisibleRowIndex, oTable); oTable.setFirstVisibleRow(iNewFirstVisibleRowIndex, true, bNewFirstVisibleRowInBuffer); if (bExpectRowsUpdatedEvent) { VerticalScrollingHelper.setOnRowsUpdatedPreprocessor(oTable, function(oEvent) { log("updateFirstVisibleRow - onRowsUpdatedPreprocessor: Reason " + oEvent.getParameters().reason, this); oScrollExtension.updateInnerVerticalScrollPosition(); if (bNewFirstVisibleRowInBuffer) { var iCurrentFirstVisibleRow = this.getFirstVisibleRow(); var bFirstVisibleRowNotChanged = iNewFirstVisibleRowIndex === iCurrentFirstVisibleRow; // The firstVisibleRow was previously set to the maximum first visible row index while suppressing the event. If the first // visible row is not adjusted in #updateInnerVerticalScrollPosition, make sure the event is called here. if (bFirstVisibleRowNotChanged) { this.setProperty("firstVisibleRow", -1, true); this.setFirstVisibleRow(iCurrentFirstVisibleRow, true); } } return false; }); } else { log("updateFirstVisibleRow: Update inner vertical scroll position", oTable); oScrollExtension.updateInnerVerticalScrollPosition(); } } else if (TableUtils.isVariableRowHeightEnabled(oTable)) { log("updateFirstVisibleRow: Update inner vertical scroll position", oTable); oScrollExtension.updateInnerVerticalScrollPosition(); } }
javascript
function(oTable) { var oScrollExtension = oTable._getScrollExtension(); var iMaxFirstRenderedRowIndex = oTable._getMaxFirstRenderedRowIndex(); var iNewFirstVisibleRowIndex = VerticalScrollingHelper.getRowIndexAtCurrentScrollPosition(oTable); var iOldFirstVisibleRowIndex = oTable.getFirstVisibleRow(); var bNewFirstVisibleRowInBuffer = iNewFirstVisibleRowIndex < 0; var bOldFirstVisibleRowInBuffer = iOldFirstVisibleRowIndex >= iMaxFirstRenderedRowIndex; var bFirstVisibleRowChanged = iNewFirstVisibleRowIndex !== iOldFirstVisibleRowIndex; var bRowsUpdateRequired = bFirstVisibleRowChanged && !(bNewFirstVisibleRowInBuffer && bOldFirstVisibleRowInBuffer); if (bRowsUpdateRequired) { var bExpectRowsUpdatedEvent = !bOldFirstVisibleRowInBuffer || iNewFirstVisibleRowIndex !== iMaxFirstRenderedRowIndex; if (bNewFirstVisibleRowInBuffer) { // The actual new first visible row cannot be determined yet. It will be done when the inner scroll position gets updated. iNewFirstVisibleRowIndex = iMaxFirstRenderedRowIndex; } log("updateFirstVisibleRow: From " + iOldFirstVisibleRowIndex + " to " + iNewFirstVisibleRowIndex, oTable); oTable.setFirstVisibleRow(iNewFirstVisibleRowIndex, true, bNewFirstVisibleRowInBuffer); if (bExpectRowsUpdatedEvent) { VerticalScrollingHelper.setOnRowsUpdatedPreprocessor(oTable, function(oEvent) { log("updateFirstVisibleRow - onRowsUpdatedPreprocessor: Reason " + oEvent.getParameters().reason, this); oScrollExtension.updateInnerVerticalScrollPosition(); if (bNewFirstVisibleRowInBuffer) { var iCurrentFirstVisibleRow = this.getFirstVisibleRow(); var bFirstVisibleRowNotChanged = iNewFirstVisibleRowIndex === iCurrentFirstVisibleRow; // The firstVisibleRow was previously set to the maximum first visible row index while suppressing the event. If the first // visible row is not adjusted in #updateInnerVerticalScrollPosition, make sure the event is called here. if (bFirstVisibleRowNotChanged) { this.setProperty("firstVisibleRow", -1, true); this.setFirstVisibleRow(iCurrentFirstVisibleRow, true); } } return false; }); } else { log("updateFirstVisibleRow: Update inner vertical scroll position", oTable); oScrollExtension.updateInnerVerticalScrollPosition(); } } else if (TableUtils.isVariableRowHeightEnabled(oTable)) { log("updateFirstVisibleRow: Update inner vertical scroll position", oTable); oScrollExtension.updateInnerVerticalScrollPosition(); } }
[ "function", "(", "oTable", ")", "{", "var", "oScrollExtension", "=", "oTable", ".", "_getScrollExtension", "(", ")", ";", "var", "iMaxFirstRenderedRowIndex", "=", "oTable", ".", "_getMaxFirstRenderedRowIndex", "(", ")", ";", "var", "iNewFirstVisibleRowIndex", "=", "VerticalScrollingHelper", ".", "getRowIndexAtCurrentScrollPosition", "(", "oTable", ")", ";", "var", "iOldFirstVisibleRowIndex", "=", "oTable", ".", "getFirstVisibleRow", "(", ")", ";", "var", "bNewFirstVisibleRowInBuffer", "=", "iNewFirstVisibleRowIndex", "<", "0", ";", "var", "bOldFirstVisibleRowInBuffer", "=", "iOldFirstVisibleRowIndex", ">=", "iMaxFirstRenderedRowIndex", ";", "var", "bFirstVisibleRowChanged", "=", "iNewFirstVisibleRowIndex", "!==", "iOldFirstVisibleRowIndex", ";", "var", "bRowsUpdateRequired", "=", "bFirstVisibleRowChanged", "&&", "!", "(", "bNewFirstVisibleRowInBuffer", "&&", "bOldFirstVisibleRowInBuffer", ")", ";", "if", "(", "bRowsUpdateRequired", ")", "{", "var", "bExpectRowsUpdatedEvent", "=", "!", "bOldFirstVisibleRowInBuffer", "||", "iNewFirstVisibleRowIndex", "!==", "iMaxFirstRenderedRowIndex", ";", "if", "(", "bNewFirstVisibleRowInBuffer", ")", "{", "// The actual new first visible row cannot be determined yet. It will be done when the inner scroll position gets updated.", "iNewFirstVisibleRowIndex", "=", "iMaxFirstRenderedRowIndex", ";", "}", "log", "(", "\"updateFirstVisibleRow: From \"", "+", "iOldFirstVisibleRowIndex", "+", "\" to \"", "+", "iNewFirstVisibleRowIndex", ",", "oTable", ")", ";", "oTable", ".", "setFirstVisibleRow", "(", "iNewFirstVisibleRowIndex", ",", "true", ",", "bNewFirstVisibleRowInBuffer", ")", ";", "if", "(", "bExpectRowsUpdatedEvent", ")", "{", "VerticalScrollingHelper", ".", "setOnRowsUpdatedPreprocessor", "(", "oTable", ",", "function", "(", "oEvent", ")", "{", "log", "(", "\"updateFirstVisibleRow - onRowsUpdatedPreprocessor: Reason \"", "+", "oEvent", ".", "getParameters", "(", ")", ".", "reason", ",", "this", ")", ";", "oScrollExtension", ".", "updateInnerVerticalScrollPosition", "(", ")", ";", "if", "(", "bNewFirstVisibleRowInBuffer", ")", "{", "var", "iCurrentFirstVisibleRow", "=", "this", ".", "getFirstVisibleRow", "(", ")", ";", "var", "bFirstVisibleRowNotChanged", "=", "iNewFirstVisibleRowIndex", "===", "iCurrentFirstVisibleRow", ";", "// The firstVisibleRow was previously set to the maximum first visible row index while suppressing the event. If the first", "// visible row is not adjusted in #updateInnerVerticalScrollPosition, make sure the event is called here.", "if", "(", "bFirstVisibleRowNotChanged", ")", "{", "this", ".", "setProperty", "(", "\"firstVisibleRow\"", ",", "-", "1", ",", "true", ")", ";", "this", ".", "setFirstVisibleRow", "(", "iCurrentFirstVisibleRow", ",", "true", ")", ";", "}", "}", "return", "false", ";", "}", ")", ";", "}", "else", "{", "log", "(", "\"updateFirstVisibleRow: Update inner vertical scroll position\"", ",", "oTable", ")", ";", "oScrollExtension", ".", "updateInnerVerticalScrollPosition", "(", ")", ";", "}", "}", "else", "if", "(", "TableUtils", ".", "isVariableRowHeightEnabled", "(", "oTable", ")", ")", "{", "log", "(", "\"updateFirstVisibleRow: Update inner vertical scroll position\"", ",", "oTable", ")", ";", "oScrollExtension", ".", "updateInnerVerticalScrollPosition", "(", ")", ";", "}", "}" ]
Adjusts the first visible row to the current vertical scroll position. @param {sap.ui.table.Table} oTable Instance of the table.
[ "Adjusts", "the", "first", "visible", "row", "to", "the", "current", "vertical", "scroll", "position", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/TableScrollExtension.js#L465-L516
4,118
SAP/openui5
src/sap.ui.table/src/sap/ui/table/TableScrollExtension.js
function(oTable) { var oScrollExtension = oTable._getScrollExtension(); var iMaxRowIndex = oTable._getMaxFirstVisibleRowIndex(); if (iMaxRowIndex === 0) { return 0; } else { var nScrollPosition = VerticalScrollingHelper.getScrollPosition(oTable); var iScrollRange = VerticalScrollingHelper.getScrollRange(oTable); var nScrollRangeRowFraction = VerticalScrollingHelper.getScrollRangeRowFraction(oTable); if (TableUtils.isVariableRowHeightEnabled(oTable)) { if (VerticalScrollingHelper.isScrollPositionInBuffer(oTable)) { return -1; } else { return Math.min(iMaxRowIndex, Math.floor(nScrollPosition / nScrollRangeRowFraction)); } } else { var iRowIndex = Math.floor(nScrollPosition / nScrollRangeRowFraction); // Calculation of the row index can be inaccurate if scrolled to the end. This can happen due to rounding errors in case of // large data or when zoomed in Chrome. In this case it can not be scrolled to the last row. To overcome this issue we consider the // table to be scrolled to the end, if the scroll position is less than 1 pixel away from the maximum. var nDistanceToMaximumScrollPosition = iScrollRange - nScrollPosition; var bScrolledViaScrollTop = oScrollExtension.getVerticalScrollbar()._scrollTop == null || internal(oTable).bIsScrolledVerticallyByWheel; var bScrolledToBottom = nDistanceToMaximumScrollPosition < 1 && bScrolledViaScrollTop || nDistanceToMaximumScrollPosition < 0.01; if (bScrolledToBottom) { // If zoomed in Chrome, scrollTop might not be accurate enough to correctly restore the scroll position after rendering. VerticalScrollingHelper.updateScrollPosition(oTable, iScrollRange, null, true); } return bScrolledToBottom ? iMaxRowIndex : Math.min(iMaxRowIndex, iRowIndex); } } }
javascript
function(oTable) { var oScrollExtension = oTable._getScrollExtension(); var iMaxRowIndex = oTable._getMaxFirstVisibleRowIndex(); if (iMaxRowIndex === 0) { return 0; } else { var nScrollPosition = VerticalScrollingHelper.getScrollPosition(oTable); var iScrollRange = VerticalScrollingHelper.getScrollRange(oTable); var nScrollRangeRowFraction = VerticalScrollingHelper.getScrollRangeRowFraction(oTable); if (TableUtils.isVariableRowHeightEnabled(oTable)) { if (VerticalScrollingHelper.isScrollPositionInBuffer(oTable)) { return -1; } else { return Math.min(iMaxRowIndex, Math.floor(nScrollPosition / nScrollRangeRowFraction)); } } else { var iRowIndex = Math.floor(nScrollPosition / nScrollRangeRowFraction); // Calculation of the row index can be inaccurate if scrolled to the end. This can happen due to rounding errors in case of // large data or when zoomed in Chrome. In this case it can not be scrolled to the last row. To overcome this issue we consider the // table to be scrolled to the end, if the scroll position is less than 1 pixel away from the maximum. var nDistanceToMaximumScrollPosition = iScrollRange - nScrollPosition; var bScrolledViaScrollTop = oScrollExtension.getVerticalScrollbar()._scrollTop == null || internal(oTable).bIsScrolledVerticallyByWheel; var bScrolledToBottom = nDistanceToMaximumScrollPosition < 1 && bScrolledViaScrollTop || nDistanceToMaximumScrollPosition < 0.01; if (bScrolledToBottom) { // If zoomed in Chrome, scrollTop might not be accurate enough to correctly restore the scroll position after rendering. VerticalScrollingHelper.updateScrollPosition(oTable, iScrollRange, null, true); } return bScrolledToBottom ? iMaxRowIndex : Math.min(iMaxRowIndex, iRowIndex); } } }
[ "function", "(", "oTable", ")", "{", "var", "oScrollExtension", "=", "oTable", ".", "_getScrollExtension", "(", ")", ";", "var", "iMaxRowIndex", "=", "oTable", ".", "_getMaxFirstVisibleRowIndex", "(", ")", ";", "if", "(", "iMaxRowIndex", "===", "0", ")", "{", "return", "0", ";", "}", "else", "{", "var", "nScrollPosition", "=", "VerticalScrollingHelper", ".", "getScrollPosition", "(", "oTable", ")", ";", "var", "iScrollRange", "=", "VerticalScrollingHelper", ".", "getScrollRange", "(", "oTable", ")", ";", "var", "nScrollRangeRowFraction", "=", "VerticalScrollingHelper", ".", "getScrollRangeRowFraction", "(", "oTable", ")", ";", "if", "(", "TableUtils", ".", "isVariableRowHeightEnabled", "(", "oTable", ")", ")", "{", "if", "(", "VerticalScrollingHelper", ".", "isScrollPositionInBuffer", "(", "oTable", ")", ")", "{", "return", "-", "1", ";", "}", "else", "{", "return", "Math", ".", "min", "(", "iMaxRowIndex", ",", "Math", ".", "floor", "(", "nScrollPosition", "/", "nScrollRangeRowFraction", ")", ")", ";", "}", "}", "else", "{", "var", "iRowIndex", "=", "Math", ".", "floor", "(", "nScrollPosition", "/", "nScrollRangeRowFraction", ")", ";", "// Calculation of the row index can be inaccurate if scrolled to the end. This can happen due to rounding errors in case of", "// large data or when zoomed in Chrome. In this case it can not be scrolled to the last row. To overcome this issue we consider the", "// table to be scrolled to the end, if the scroll position is less than 1 pixel away from the maximum.", "var", "nDistanceToMaximumScrollPosition", "=", "iScrollRange", "-", "nScrollPosition", ";", "var", "bScrolledViaScrollTop", "=", "oScrollExtension", ".", "getVerticalScrollbar", "(", ")", ".", "_scrollTop", "==", "null", "||", "internal", "(", "oTable", ")", ".", "bIsScrolledVerticallyByWheel", ";", "var", "bScrolledToBottom", "=", "nDistanceToMaximumScrollPosition", "<", "1", "&&", "bScrolledViaScrollTop", "||", "nDistanceToMaximumScrollPosition", "<", "0.01", ";", "if", "(", "bScrolledToBottom", ")", "{", "// If zoomed in Chrome, scrollTop might not be accurate enough to correctly restore the scroll position after rendering.", "VerticalScrollingHelper", ".", "updateScrollPosition", "(", "oTable", ",", "iScrollRange", ",", "null", ",", "true", ")", ";", "}", "return", "bScrolledToBottom", "?", "iMaxRowIndex", ":", "Math", ".", "min", "(", "iMaxRowIndex", ",", "iRowIndex", ")", ";", "}", "}", "}" ]
Gets the index of the row at the current vertical scroll position. @param {sap.ui.table.Table} oTable Instance of the table. @returns {int} The index of the row, or -1 if the index could not be determined.
[ "Gets", "the", "index", "of", "the", "row", "at", "the", "current", "vertical", "scroll", "position", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/TableScrollExtension.js#L524-L561
4,119
SAP/openui5
src/sap.ui.table/src/sap/ui/table/TableScrollExtension.js
function(oTable) { var oScrollExtension = oTable._getScrollExtension(); var iVerticalScrollRange = oScrollExtension.getVerticalScrollHeight() - oScrollExtension.getVerticalScrollbarHeight(); return Math.max(0, iVerticalScrollRange); }
javascript
function(oTable) { var oScrollExtension = oTable._getScrollExtension(); var iVerticalScrollRange = oScrollExtension.getVerticalScrollHeight() - oScrollExtension.getVerticalScrollbarHeight(); return Math.max(0, iVerticalScrollRange); }
[ "function", "(", "oTable", ")", "{", "var", "oScrollExtension", "=", "oTable", ".", "_getScrollExtension", "(", ")", ";", "var", "iVerticalScrollRange", "=", "oScrollExtension", ".", "getVerticalScrollHeight", "(", ")", "-", "oScrollExtension", ".", "getVerticalScrollbarHeight", "(", ")", ";", "return", "Math", ".", "max", "(", "0", ",", "iVerticalScrollRange", ")", ";", "}" ]
Gets the vertical scroll range. @param {sap.ui.table.Table} oTable Instance of the table. @returns {int} The vertical scroll range.
[ "Gets", "the", "vertical", "scroll", "range", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/TableScrollExtension.js#L569-L573
4,120
SAP/openui5
src/sap.ui.table/src/sap/ui/table/TableScrollExtension.js
function(oTable) { var oScrollExtension = oTable._getScrollExtension(); var iVirtualRowCount = oTable._getTotalRowCount() - oTable.getVisibleRowCount(); var iScrollRangeWithoutBuffer; if (TableUtils.isVariableRowHeightEnabled(oTable)) { iScrollRangeWithoutBuffer = VerticalScrollingHelper.getScrollRange(oTable) - VerticalScrollingHelper.getScrollRangeBuffer(oTable); // The last row is part of the buffer. To correctly calculate the fraction of the scroll range allocated to a row, all rows must be // considered. This is not the case if the scroll range is at its maximum, then the buffer must be excluded from calculation // completely. var bScrollRangeMaxedOut = oScrollExtension.getVerticalScrollHeight() === MAX_VERTICAL_SCROLL_HEIGHT; if (!bScrollRangeMaxedOut) { iScrollRangeWithoutBuffer += oTable._getDefaultRowHeight(); } } else { iScrollRangeWithoutBuffer = VerticalScrollingHelper.getScrollRange(oTable); } return iScrollRangeWithoutBuffer / Math.max(1, iVirtualRowCount); }
javascript
function(oTable) { var oScrollExtension = oTable._getScrollExtension(); var iVirtualRowCount = oTable._getTotalRowCount() - oTable.getVisibleRowCount(); var iScrollRangeWithoutBuffer; if (TableUtils.isVariableRowHeightEnabled(oTable)) { iScrollRangeWithoutBuffer = VerticalScrollingHelper.getScrollRange(oTable) - VerticalScrollingHelper.getScrollRangeBuffer(oTable); // The last row is part of the buffer. To correctly calculate the fraction of the scroll range allocated to a row, all rows must be // considered. This is not the case if the scroll range is at its maximum, then the buffer must be excluded from calculation // completely. var bScrollRangeMaxedOut = oScrollExtension.getVerticalScrollHeight() === MAX_VERTICAL_SCROLL_HEIGHT; if (!bScrollRangeMaxedOut) { iScrollRangeWithoutBuffer += oTable._getDefaultRowHeight(); } } else { iScrollRangeWithoutBuffer = VerticalScrollingHelper.getScrollRange(oTable); } return iScrollRangeWithoutBuffer / Math.max(1, iVirtualRowCount); }
[ "function", "(", "oTable", ")", "{", "var", "oScrollExtension", "=", "oTable", ".", "_getScrollExtension", "(", ")", ";", "var", "iVirtualRowCount", "=", "oTable", ".", "_getTotalRowCount", "(", ")", "-", "oTable", ".", "getVisibleRowCount", "(", ")", ";", "var", "iScrollRangeWithoutBuffer", ";", "if", "(", "TableUtils", ".", "isVariableRowHeightEnabled", "(", "oTable", ")", ")", "{", "iScrollRangeWithoutBuffer", "=", "VerticalScrollingHelper", ".", "getScrollRange", "(", "oTable", ")", "-", "VerticalScrollingHelper", ".", "getScrollRangeBuffer", "(", "oTable", ")", ";", "// The last row is part of the buffer. To correctly calculate the fraction of the scroll range allocated to a row, all rows must be", "// considered. This is not the case if the scroll range is at its maximum, then the buffer must be excluded from calculation", "// completely.", "var", "bScrollRangeMaxedOut", "=", "oScrollExtension", ".", "getVerticalScrollHeight", "(", ")", "===", "MAX_VERTICAL_SCROLL_HEIGHT", ";", "if", "(", "!", "bScrollRangeMaxedOut", ")", "{", "iScrollRangeWithoutBuffer", "+=", "oTable", ".", "_getDefaultRowHeight", "(", ")", ";", "}", "}", "else", "{", "iScrollRangeWithoutBuffer", "=", "VerticalScrollingHelper", ".", "getScrollRange", "(", "oTable", ")", ";", "}", "return", "iScrollRangeWithoutBuffer", "/", "Math", ".", "max", "(", "1", ",", "iVirtualRowCount", ")", ";", "}" ]
Gets the fraction of the vertical scroll range which corresponds to a row. This value specifies how many pixels must be scrolled to scroll one row. @param {sap.ui.table.Table} oTable Instance of the table. @returns {number} The fraction of the vertical scroll range which corresponds to a row.
[ "Gets", "the", "fraction", "of", "the", "vertical", "scroll", "range", "which", "corresponds", "to", "a", "row", ".", "This", "value", "specifies", "how", "many", "pixels", "must", "be", "scrolled", "to", "scroll", "one", "row", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/TableScrollExtension.js#L614-L634
4,121
SAP/openui5
src/sap.ui.table/src/sap/ui/table/TableScrollExtension.js
function(oTable) { if (!TableUtils.isVariableRowHeightEnabled(oTable)) { return false; } var iScrollRange = VerticalScrollingHelper.getScrollRange(oTable); var nScrollPosition = VerticalScrollingHelper.getScrollPosition(oTable); var iScrollRangeBugger = VerticalScrollingHelper.getScrollRangeBuffer(oTable); return iScrollRange - nScrollPosition <= iScrollRangeBugger; }
javascript
function(oTable) { if (!TableUtils.isVariableRowHeightEnabled(oTable)) { return false; } var iScrollRange = VerticalScrollingHelper.getScrollRange(oTable); var nScrollPosition = VerticalScrollingHelper.getScrollPosition(oTable); var iScrollRangeBugger = VerticalScrollingHelper.getScrollRangeBuffer(oTable); return iScrollRange - nScrollPosition <= iScrollRangeBugger; }
[ "function", "(", "oTable", ")", "{", "if", "(", "!", "TableUtils", ".", "isVariableRowHeightEnabled", "(", "oTable", ")", ")", "{", "return", "false", ";", "}", "var", "iScrollRange", "=", "VerticalScrollingHelper", ".", "getScrollRange", "(", "oTable", ")", ";", "var", "nScrollPosition", "=", "VerticalScrollingHelper", ".", "getScrollPosition", "(", "oTable", ")", ";", "var", "iScrollRangeBugger", "=", "VerticalScrollingHelper", ".", "getScrollRangeBuffer", "(", "oTable", ")", ";", "return", "iScrollRange", "-", "nScrollPosition", "<=", "iScrollRangeBugger", ";", "}" ]
Checks whether the vertical scroll position is in the buffer reserved to scroll the final overflow. @param {sap.ui.table.Table} oTable Instance of the table. @returns {boolean} Returns <code>true</code>, if the vertical scroll position is in the buffer.
[ "Checks", "whether", "the", "vertical", "scroll", "position", "is", "in", "the", "buffer", "reserved", "to", "scroll", "the", "final", "overflow", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/TableScrollExtension.js#L642-L652
4,122
SAP/openui5
src/sap.ui.table/src/sap/ui/table/TableScrollExtension.js
function(oTable) { if (!oTable || !oTable._aRowHeights) { return 0; } var aRowHeights = oTable._aRowHeights; var iEstimatedViewportHeight = oTable._getDefaultRowHeight() * oTable.getVisibleRowCount(); // Only sum rows filled with data, ignore empty rows. if (oTable.getVisibleRowCount() >= oTable._getTotalRowCount()) { aRowHeights = aRowHeights.slice(0, oTable._getTotalRowCount()); } var iInnerVerticalScrollRange = aRowHeights.reduce(function(a, b) { return a + b; }, 0) - iEstimatedViewportHeight; if (iInnerVerticalScrollRange > 0) { iInnerVerticalScrollRange = Math.ceil(iInnerVerticalScrollRange); } return Math.max(0, iInnerVerticalScrollRange); }
javascript
function(oTable) { if (!oTable || !oTable._aRowHeights) { return 0; } var aRowHeights = oTable._aRowHeights; var iEstimatedViewportHeight = oTable._getDefaultRowHeight() * oTable.getVisibleRowCount(); // Only sum rows filled with data, ignore empty rows. if (oTable.getVisibleRowCount() >= oTable._getTotalRowCount()) { aRowHeights = aRowHeights.slice(0, oTable._getTotalRowCount()); } var iInnerVerticalScrollRange = aRowHeights.reduce(function(a, b) { return a + b; }, 0) - iEstimatedViewportHeight; if (iInnerVerticalScrollRange > 0) { iInnerVerticalScrollRange = Math.ceil(iInnerVerticalScrollRange); } return Math.max(0, iInnerVerticalScrollRange); }
[ "function", "(", "oTable", ")", "{", "if", "(", "!", "oTable", "||", "!", "oTable", ".", "_aRowHeights", ")", "{", "return", "0", ";", "}", "var", "aRowHeights", "=", "oTable", ".", "_aRowHeights", ";", "var", "iEstimatedViewportHeight", "=", "oTable", ".", "_getDefaultRowHeight", "(", ")", "*", "oTable", ".", "getVisibleRowCount", "(", ")", ";", "// Only sum rows filled with data, ignore empty rows.", "if", "(", "oTable", ".", "getVisibleRowCount", "(", ")", ">=", "oTable", ".", "_getTotalRowCount", "(", ")", ")", "{", "aRowHeights", "=", "aRowHeights", ".", "slice", "(", "0", ",", "oTable", ".", "_getTotalRowCount", "(", ")", ")", ";", "}", "var", "iInnerVerticalScrollRange", "=", "aRowHeights", ".", "reduce", "(", "function", "(", "a", ",", "b", ")", "{", "return", "a", "+", "b", ";", "}", ",", "0", ")", "-", "iEstimatedViewportHeight", ";", "if", "(", "iInnerVerticalScrollRange", ">", "0", ")", "{", "iInnerVerticalScrollRange", "=", "Math", ".", "ceil", "(", "iInnerVerticalScrollRange", ")", ";", "}", "return", "Math", ".", "max", "(", "0", ",", "iInnerVerticalScrollRange", ")", ";", "}" ]
Gets the inner vertical scroll range. This is the amount of pixels that the rows overflow their container. @param {sap.ui.table.Table} oTable Instance of the table. @returns {int} The inner vertical scroll range.
[ "Gets", "the", "inner", "vertical", "scroll", "range", ".", "This", "is", "the", "amount", "of", "pixels", "that", "the", "rows", "overflow", "their", "container", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/TableScrollExtension.js#L660-L679
4,123
SAP/openui5
src/sap.ui.table/src/sap/ui/table/TableScrollExtension.js
function(oTable, oEvent) { var bExecuteDefault = true; if (internal(oTable).fnOnRowsUpdatedPreprocessor != null) { bExecuteDefault = internal(oTable).fnOnRowsUpdatedPreprocessor.call(oTable, oEvent) !== false; } internal(oTable).fnOnRowsUpdatedPreprocessor = null; return bExecuteDefault; }
javascript
function(oTable, oEvent) { var bExecuteDefault = true; if (internal(oTable).fnOnRowsUpdatedPreprocessor != null) { bExecuteDefault = internal(oTable).fnOnRowsUpdatedPreprocessor.call(oTable, oEvent) !== false; } internal(oTable).fnOnRowsUpdatedPreprocessor = null; return bExecuteDefault; }
[ "function", "(", "oTable", ",", "oEvent", ")", "{", "var", "bExecuteDefault", "=", "true", ";", "if", "(", "internal", "(", "oTable", ")", ".", "fnOnRowsUpdatedPreprocessor", "!=", "null", ")", "{", "bExecuteDefault", "=", "internal", "(", "oTable", ")", ".", "fnOnRowsUpdatedPreprocessor", ".", "call", "(", "oTable", ",", "oEvent", ")", "!==", "false", ";", "}", "internal", "(", "oTable", ")", ".", "fnOnRowsUpdatedPreprocessor", "=", "null", ";", "return", "bExecuteDefault", ";", "}" ]
If a preprocessor was set, it is called and afterwards removed. @param {sap.ui.table.Table} oTable Instance of the table. @param {Object} oEvent The event object. @returns {boolean} Whether the default action should be executed.
[ "If", "a", "preprocessor", "was", "set", "it", "is", "called", "and", "afterwards", "removed", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/TableScrollExtension.js#L712-L719
4,124
SAP/openui5
src/sap.ui.table/src/sap/ui/table/TableScrollExtension.js
function(oTable) { var oScrollExtension = oTable._getScrollExtension(); var aScrollAreas = VerticalScrollingHelper.getScrollAreas(oTable); var oVSb = oScrollExtension.getVerticalScrollbar(); if (!oScrollExtension._onVerticalScrollEventHandler) { oScrollExtension._onVerticalScrollEventHandler = VerticalScrollingHelper.onScroll.bind(oTable); } for (var i = 0; i < aScrollAreas.length; i++) { aScrollAreas[i].addEventListener("scroll", oScrollExtension._onVerticalScrollEventHandler); } if (oVSb) { if (!oScrollExtension._onVerticalScrollbarMouseDownEventHandler) { oScrollExtension._onVerticalScrollbarMouseDownEventHandler = VerticalScrollingHelper.onScrollbarMouseDown.bind(oTable); } oVSb.addEventListener("mousedown", oScrollExtension._onVerticalScrollbarMouseDownEventHandler); } oTable.attachEvent("_rowsUpdated", VerticalScrollingHelper.onRowsUpdated); }
javascript
function(oTable) { var oScrollExtension = oTable._getScrollExtension(); var aScrollAreas = VerticalScrollingHelper.getScrollAreas(oTable); var oVSb = oScrollExtension.getVerticalScrollbar(); if (!oScrollExtension._onVerticalScrollEventHandler) { oScrollExtension._onVerticalScrollEventHandler = VerticalScrollingHelper.onScroll.bind(oTable); } for (var i = 0; i < aScrollAreas.length; i++) { aScrollAreas[i].addEventListener("scroll", oScrollExtension._onVerticalScrollEventHandler); } if (oVSb) { if (!oScrollExtension._onVerticalScrollbarMouseDownEventHandler) { oScrollExtension._onVerticalScrollbarMouseDownEventHandler = VerticalScrollingHelper.onScrollbarMouseDown.bind(oTable); } oVSb.addEventListener("mousedown", oScrollExtension._onVerticalScrollbarMouseDownEventHandler); } oTable.attachEvent("_rowsUpdated", VerticalScrollingHelper.onRowsUpdated); }
[ "function", "(", "oTable", ")", "{", "var", "oScrollExtension", "=", "oTable", ".", "_getScrollExtension", "(", ")", ";", "var", "aScrollAreas", "=", "VerticalScrollingHelper", ".", "getScrollAreas", "(", "oTable", ")", ";", "var", "oVSb", "=", "oScrollExtension", ".", "getVerticalScrollbar", "(", ")", ";", "if", "(", "!", "oScrollExtension", ".", "_onVerticalScrollEventHandler", ")", "{", "oScrollExtension", ".", "_onVerticalScrollEventHandler", "=", "VerticalScrollingHelper", ".", "onScroll", ".", "bind", "(", "oTable", ")", ";", "}", "for", "(", "var", "i", "=", "0", ";", "i", "<", "aScrollAreas", ".", "length", ";", "i", "++", ")", "{", "aScrollAreas", "[", "i", "]", ".", "addEventListener", "(", "\"scroll\"", ",", "oScrollExtension", ".", "_onVerticalScrollEventHandler", ")", ";", "}", "if", "(", "oVSb", ")", "{", "if", "(", "!", "oScrollExtension", ".", "_onVerticalScrollbarMouseDownEventHandler", ")", "{", "oScrollExtension", ".", "_onVerticalScrollbarMouseDownEventHandler", "=", "VerticalScrollingHelper", ".", "onScrollbarMouseDown", ".", "bind", "(", "oTable", ")", ";", "}", "oVSb", ".", "addEventListener", "(", "\"mousedown\"", ",", "oScrollExtension", ".", "_onVerticalScrollbarMouseDownEventHandler", ")", ";", "}", "oTable", ".", "attachEvent", "(", "\"_rowsUpdated\"", ",", "VerticalScrollingHelper", ".", "onRowsUpdated", ")", ";", "}" ]
Adds the event listeners which are required for the vertical scrolling. @param {sap.ui.table.Table} oTable Instance of the table.
[ "Adds", "the", "event", "listeners", "which", "are", "required", "for", "the", "vertical", "scrolling", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/TableScrollExtension.js#L764-L785
4,125
SAP/openui5
src/sap.ui.table/src/sap/ui/table/TableScrollExtension.js
function(oTable) { var oScrollExtension = oTable._getScrollExtension(); var aScrollAreas = VerticalScrollingHelper.getScrollAreas(oTable); var oVSb = oScrollExtension.getVerticalScrollbar(); if (oScrollExtension._onVerticalScrollEventHandler) { for (var i = 0; i < aScrollAreas.length; i++) { aScrollAreas[i].removeEventListener("scroll", oScrollExtension._onVerticalScrollEventHandler); } delete oScrollExtension._onVerticalScrollEventHandler; } if (oVSb && oScrollExtension._onVerticalScrollbarMouseDownEventHandler) { oVSb.removeEventListener("mousedown", oScrollExtension._onVerticalScrollbarMouseDownEventHandler); delete oScrollExtension._onVerticalScrollbarMouseDownEventHandler; } oTable.detachEvent("_rowsUpdated", VerticalScrollingHelper.onRowsUpdated); }
javascript
function(oTable) { var oScrollExtension = oTable._getScrollExtension(); var aScrollAreas = VerticalScrollingHelper.getScrollAreas(oTable); var oVSb = oScrollExtension.getVerticalScrollbar(); if (oScrollExtension._onVerticalScrollEventHandler) { for (var i = 0; i < aScrollAreas.length; i++) { aScrollAreas[i].removeEventListener("scroll", oScrollExtension._onVerticalScrollEventHandler); } delete oScrollExtension._onVerticalScrollEventHandler; } if (oVSb && oScrollExtension._onVerticalScrollbarMouseDownEventHandler) { oVSb.removeEventListener("mousedown", oScrollExtension._onVerticalScrollbarMouseDownEventHandler); delete oScrollExtension._onVerticalScrollbarMouseDownEventHandler; } oTable.detachEvent("_rowsUpdated", VerticalScrollingHelper.onRowsUpdated); }
[ "function", "(", "oTable", ")", "{", "var", "oScrollExtension", "=", "oTable", ".", "_getScrollExtension", "(", ")", ";", "var", "aScrollAreas", "=", "VerticalScrollingHelper", ".", "getScrollAreas", "(", "oTable", ")", ";", "var", "oVSb", "=", "oScrollExtension", ".", "getVerticalScrollbar", "(", ")", ";", "if", "(", "oScrollExtension", ".", "_onVerticalScrollEventHandler", ")", "{", "for", "(", "var", "i", "=", "0", ";", "i", "<", "aScrollAreas", ".", "length", ";", "i", "++", ")", "{", "aScrollAreas", "[", "i", "]", ".", "removeEventListener", "(", "\"scroll\"", ",", "oScrollExtension", ".", "_onVerticalScrollEventHandler", ")", ";", "}", "delete", "oScrollExtension", ".", "_onVerticalScrollEventHandler", ";", "}", "if", "(", "oVSb", "&&", "oScrollExtension", ".", "_onVerticalScrollbarMouseDownEventHandler", ")", "{", "oVSb", ".", "removeEventListener", "(", "\"mousedown\"", ",", "oScrollExtension", ".", "_onVerticalScrollbarMouseDownEventHandler", ")", ";", "delete", "oScrollExtension", ".", "_onVerticalScrollbarMouseDownEventHandler", ";", "}", "oTable", ".", "detachEvent", "(", "\"_rowsUpdated\"", ",", "VerticalScrollingHelper", ".", "onRowsUpdated", ")", ";", "}" ]
Removes event listeners which are required for the vertical scrolling. @param {sap.ui.table.Table} oTable Instance of the table.
[ "Removes", "event", "listeners", "which", "are", "required", "for", "the", "vertical", "scrolling", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/TableScrollExtension.js#L792-L810
4,126
SAP/openui5
src/sap.ui.table/src/sap/ui/table/TableScrollExtension.js
function(oTable) { var aScrollAreas = [ oTable._getScrollExtension().getVerticalScrollbar() ]; return aScrollAreas.filter(function(oScrollArea) { return oScrollArea != null; }); }
javascript
function(oTable) { var aScrollAreas = [ oTable._getScrollExtension().getVerticalScrollbar() ]; return aScrollAreas.filter(function(oScrollArea) { return oScrollArea != null; }); }
[ "function", "(", "oTable", ")", "{", "var", "aScrollAreas", "=", "[", "oTable", ".", "_getScrollExtension", "(", ")", ".", "getVerticalScrollbar", "(", ")", "]", ";", "return", "aScrollAreas", ".", "filter", "(", "function", "(", "oScrollArea", ")", "{", "return", "oScrollArea", "!=", "null", ";", "}", ")", ";", "}" ]
Gets the areas of the table which can be scrolled vertically. @param {sap.ui.table.Table} oTable Instance of the table. @returns {HTMLElement[]} Returns only elements which exist in the DOM. @private
[ "Gets", "the", "areas", "of", "the", "table", "which", "can", "be", "scrolled", "vertically", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/TableScrollExtension.js#L829-L837
4,127
SAP/openui5
src/sap.ui.table/src/sap/ui/table/TableScrollExtension.js
function(mOptions, oEvent) { if (oEvent.type === "touchstart" || oEvent.pointerType === "touch") { var oScrollExtension = this._getScrollExtension(); var oHSb = oScrollExtension.getHorizontalScrollbar(); var oVSb = oScrollExtension.getVerticalScrollbar(); var oTouchObject = oEvent.touches ? oEvent.touches[0] : oEvent; internal(this).mTouchSessionData = { initialPageX: oTouchObject.pageX, initialPageY: oTouchObject.pageY, initialScrollTop: oVSb ? oVSb.scrollTop : 0, initialScrollLeft: oHSb ? oHSb.scrollLeft : 0, initialScrolledToEnd: null, touchMoveDirection: null }; } }
javascript
function(mOptions, oEvent) { if (oEvent.type === "touchstart" || oEvent.pointerType === "touch") { var oScrollExtension = this._getScrollExtension(); var oHSb = oScrollExtension.getHorizontalScrollbar(); var oVSb = oScrollExtension.getVerticalScrollbar(); var oTouchObject = oEvent.touches ? oEvent.touches[0] : oEvent; internal(this).mTouchSessionData = { initialPageX: oTouchObject.pageX, initialPageY: oTouchObject.pageY, initialScrollTop: oVSb ? oVSb.scrollTop : 0, initialScrollLeft: oHSb ? oHSb.scrollLeft : 0, initialScrolledToEnd: null, touchMoveDirection: null }; } }
[ "function", "(", "mOptions", ",", "oEvent", ")", "{", "if", "(", "oEvent", ".", "type", "===", "\"touchstart\"", "||", "oEvent", ".", "pointerType", "===", "\"touch\"", ")", "{", "var", "oScrollExtension", "=", "this", ".", "_getScrollExtension", "(", ")", ";", "var", "oHSb", "=", "oScrollExtension", ".", "getHorizontalScrollbar", "(", ")", ";", "var", "oVSb", "=", "oScrollExtension", ".", "getVerticalScrollbar", "(", ")", ";", "var", "oTouchObject", "=", "oEvent", ".", "touches", "?", "oEvent", ".", "touches", "[", "0", "]", ":", "oEvent", ";", "internal", "(", "this", ")", ".", "mTouchSessionData", "=", "{", "initialPageX", ":", "oTouchObject", ".", "pageX", ",", "initialPageY", ":", "oTouchObject", ".", "pageY", ",", "initialScrollTop", ":", "oVSb", "?", "oVSb", ".", "scrollTop", ":", "0", ",", "initialScrollLeft", ":", "oHSb", "?", "oHSb", ".", "scrollLeft", ":", "0", ",", "initialScrolledToEnd", ":", "null", ",", "touchMoveDirection", ":", "null", "}", ";", "}", "}" ]
Handles touch start events. @param {TableScrollExtension.EventListenerOptions} mOptions The options. @param {jQuery.Event} oEvent The touch or pointer event object.
[ "Handles", "touch", "start", "events", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/TableScrollExtension.js#L953-L969
4,128
SAP/openui5
src/sap.ui.table/src/sap/ui/table/TableScrollExtension.js
function(mOptions, oEvent) { if (oEvent.type !== "touchmove" && oEvent.pointerType !== "touch") { return; } var oScrollExtension = this._getScrollExtension(); var mTouchSessionData = internal(this).mTouchSessionData; if (!mTouchSessionData) { return; } var oTouchObject = oEvent.touches ? oEvent.touches[0] : oEvent; var iTouchDistanceX = (oTouchObject.pageX - mTouchSessionData.initialPageX); var iTouchDistanceY = (oTouchObject.pageY - mTouchSessionData.initialPageY); var bScrollingPerformed = false; if (!mTouchSessionData.touchMoveDirection) { if (iTouchDistanceX === 0 && iTouchDistanceY === 0) { return; } mTouchSessionData.touchMoveDirection = Math.abs(iTouchDistanceX) > Math.abs(iTouchDistanceY) ? "horizontal" : "vertical"; } switch (mTouchSessionData.touchMoveDirection) { case "horizontal": var oHSb = oScrollExtension.getHorizontalScrollbar(); if (oHSb && (mOptions.scrollDirection === ScrollDirection.HORIZONAL || mOptions.scrollDirection === ScrollDirection.BOTH)) { this._getKeyboardExtension().setActionMode(false); if (mTouchSessionData.initialScrolledToEnd == null) { if (iTouchDistanceX < 0) { // Scrolling to the right. mTouchSessionData.initialScrolledToEnd = oHSb.scrollLeft === oHSb.scrollWidth - oHSb.offsetWidth; } else { // Scrolling to the left. mTouchSessionData.initialScrolledToEnd = oHSb.scrollLeft === 0; } } if (!mTouchSessionData.initialScrolledToEnd) { oHSb.scrollLeft = mTouchSessionData.initialScrollLeft - iTouchDistanceX; bScrollingPerformed = true; } } break; case "vertical": var oVSb = oScrollExtension.getVerticalScrollbar(); if (oVSb && (mOptions.scrollDirection === ScrollDirection.VERTICAL || mOptions.scrollDirection === ScrollDirection.BOTH)) { this._getKeyboardExtension().setActionMode(false); if (mTouchSessionData.initialScrolledToEnd == null) { if (iTouchDistanceY < 0) { // Scrolling down. mTouchSessionData.initialScrolledToEnd = oVSb.scrollTop === oVSb.scrollHeight - oVSb.offsetHeight; } else { // Scrolling up. mTouchSessionData.initialScrolledToEnd = oVSb.scrollTop === 0; } } if (!mTouchSessionData.initialScrolledToEnd) { VerticalScrollingHelper.updateScrollPosition(this, mTouchSessionData.initialScrollTop - iTouchDistanceY, ScrollTrigger.TOUCH); bScrollingPerformed = true; } } break; default: } if (bScrollingPerformed) { oEvent.preventDefault(); } }
javascript
function(mOptions, oEvent) { if (oEvent.type !== "touchmove" && oEvent.pointerType !== "touch") { return; } var oScrollExtension = this._getScrollExtension(); var mTouchSessionData = internal(this).mTouchSessionData; if (!mTouchSessionData) { return; } var oTouchObject = oEvent.touches ? oEvent.touches[0] : oEvent; var iTouchDistanceX = (oTouchObject.pageX - mTouchSessionData.initialPageX); var iTouchDistanceY = (oTouchObject.pageY - mTouchSessionData.initialPageY); var bScrollingPerformed = false; if (!mTouchSessionData.touchMoveDirection) { if (iTouchDistanceX === 0 && iTouchDistanceY === 0) { return; } mTouchSessionData.touchMoveDirection = Math.abs(iTouchDistanceX) > Math.abs(iTouchDistanceY) ? "horizontal" : "vertical"; } switch (mTouchSessionData.touchMoveDirection) { case "horizontal": var oHSb = oScrollExtension.getHorizontalScrollbar(); if (oHSb && (mOptions.scrollDirection === ScrollDirection.HORIZONAL || mOptions.scrollDirection === ScrollDirection.BOTH)) { this._getKeyboardExtension().setActionMode(false); if (mTouchSessionData.initialScrolledToEnd == null) { if (iTouchDistanceX < 0) { // Scrolling to the right. mTouchSessionData.initialScrolledToEnd = oHSb.scrollLeft === oHSb.scrollWidth - oHSb.offsetWidth; } else { // Scrolling to the left. mTouchSessionData.initialScrolledToEnd = oHSb.scrollLeft === 0; } } if (!mTouchSessionData.initialScrolledToEnd) { oHSb.scrollLeft = mTouchSessionData.initialScrollLeft - iTouchDistanceX; bScrollingPerformed = true; } } break; case "vertical": var oVSb = oScrollExtension.getVerticalScrollbar(); if (oVSb && (mOptions.scrollDirection === ScrollDirection.VERTICAL || mOptions.scrollDirection === ScrollDirection.BOTH)) { this._getKeyboardExtension().setActionMode(false); if (mTouchSessionData.initialScrolledToEnd == null) { if (iTouchDistanceY < 0) { // Scrolling down. mTouchSessionData.initialScrolledToEnd = oVSb.scrollTop === oVSb.scrollHeight - oVSb.offsetHeight; } else { // Scrolling up. mTouchSessionData.initialScrolledToEnd = oVSb.scrollTop === 0; } } if (!mTouchSessionData.initialScrolledToEnd) { VerticalScrollingHelper.updateScrollPosition(this, mTouchSessionData.initialScrollTop - iTouchDistanceY, ScrollTrigger.TOUCH); bScrollingPerformed = true; } } break; default: } if (bScrollingPerformed) { oEvent.preventDefault(); } }
[ "function", "(", "mOptions", ",", "oEvent", ")", "{", "if", "(", "oEvent", ".", "type", "!==", "\"touchmove\"", "&&", "oEvent", ".", "pointerType", "!==", "\"touch\"", ")", "{", "return", ";", "}", "var", "oScrollExtension", "=", "this", ".", "_getScrollExtension", "(", ")", ";", "var", "mTouchSessionData", "=", "internal", "(", "this", ")", ".", "mTouchSessionData", ";", "if", "(", "!", "mTouchSessionData", ")", "{", "return", ";", "}", "var", "oTouchObject", "=", "oEvent", ".", "touches", "?", "oEvent", ".", "touches", "[", "0", "]", ":", "oEvent", ";", "var", "iTouchDistanceX", "=", "(", "oTouchObject", ".", "pageX", "-", "mTouchSessionData", ".", "initialPageX", ")", ";", "var", "iTouchDistanceY", "=", "(", "oTouchObject", ".", "pageY", "-", "mTouchSessionData", ".", "initialPageY", ")", ";", "var", "bScrollingPerformed", "=", "false", ";", "if", "(", "!", "mTouchSessionData", ".", "touchMoveDirection", ")", "{", "if", "(", "iTouchDistanceX", "===", "0", "&&", "iTouchDistanceY", "===", "0", ")", "{", "return", ";", "}", "mTouchSessionData", ".", "touchMoveDirection", "=", "Math", ".", "abs", "(", "iTouchDistanceX", ")", ">", "Math", ".", "abs", "(", "iTouchDistanceY", ")", "?", "\"horizontal\"", ":", "\"vertical\"", ";", "}", "switch", "(", "mTouchSessionData", ".", "touchMoveDirection", ")", "{", "case", "\"horizontal\"", ":", "var", "oHSb", "=", "oScrollExtension", ".", "getHorizontalScrollbar", "(", ")", ";", "if", "(", "oHSb", "&&", "(", "mOptions", ".", "scrollDirection", "===", "ScrollDirection", ".", "HORIZONAL", "||", "mOptions", ".", "scrollDirection", "===", "ScrollDirection", ".", "BOTH", ")", ")", "{", "this", ".", "_getKeyboardExtension", "(", ")", ".", "setActionMode", "(", "false", ")", ";", "if", "(", "mTouchSessionData", ".", "initialScrolledToEnd", "==", "null", ")", "{", "if", "(", "iTouchDistanceX", "<", "0", ")", "{", "// Scrolling to the right.", "mTouchSessionData", ".", "initialScrolledToEnd", "=", "oHSb", ".", "scrollLeft", "===", "oHSb", ".", "scrollWidth", "-", "oHSb", ".", "offsetWidth", ";", "}", "else", "{", "// Scrolling to the left.", "mTouchSessionData", ".", "initialScrolledToEnd", "=", "oHSb", ".", "scrollLeft", "===", "0", ";", "}", "}", "if", "(", "!", "mTouchSessionData", ".", "initialScrolledToEnd", ")", "{", "oHSb", ".", "scrollLeft", "=", "mTouchSessionData", ".", "initialScrollLeft", "-", "iTouchDistanceX", ";", "bScrollingPerformed", "=", "true", ";", "}", "}", "break", ";", "case", "\"vertical\"", ":", "var", "oVSb", "=", "oScrollExtension", ".", "getVerticalScrollbar", "(", ")", ";", "if", "(", "oVSb", "&&", "(", "mOptions", ".", "scrollDirection", "===", "ScrollDirection", ".", "VERTICAL", "||", "mOptions", ".", "scrollDirection", "===", "ScrollDirection", ".", "BOTH", ")", ")", "{", "this", ".", "_getKeyboardExtension", "(", ")", ".", "setActionMode", "(", "false", ")", ";", "if", "(", "mTouchSessionData", ".", "initialScrolledToEnd", "==", "null", ")", "{", "if", "(", "iTouchDistanceY", "<", "0", ")", "{", "// Scrolling down.", "mTouchSessionData", ".", "initialScrolledToEnd", "=", "oVSb", ".", "scrollTop", "===", "oVSb", ".", "scrollHeight", "-", "oVSb", ".", "offsetHeight", ";", "}", "else", "{", "// Scrolling up.", "mTouchSessionData", ".", "initialScrolledToEnd", "=", "oVSb", ".", "scrollTop", "===", "0", ";", "}", "}", "if", "(", "!", "mTouchSessionData", ".", "initialScrolledToEnd", ")", "{", "VerticalScrollingHelper", ".", "updateScrollPosition", "(", "this", ",", "mTouchSessionData", ".", "initialScrollTop", "-", "iTouchDistanceY", ",", "ScrollTrigger", ".", "TOUCH", ")", ";", "bScrollingPerformed", "=", "true", ";", "}", "}", "break", ";", "default", ":", "}", "if", "(", "bScrollingPerformed", ")", "{", "oEvent", ".", "preventDefault", "(", ")", ";", "}", "}" ]
Handles touch move events. @param {TableScrollExtension.EventListenerOptions} mOptions The options. @param {jQuery.Event} oEvent The touch or pointer event object.
[ "Handles", "touch", "move", "events", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/TableScrollExtension.js#L977-L1052
4,129
SAP/openui5
src/sap.ui.table/src/sap/ui/table/TableScrollExtension.js
function(oTable) { var oScrollExtension = oTable._getScrollExtension(); var aEventListenerTargets = ScrollingHelper.getEventListenerTargets(oTable); oScrollExtension._mMouseWheelEventListener = this.addMouseWheelEventListener(aEventListenerTargets, oTable, { scrollDirection: ScrollDirection.BOTH }); oScrollExtension._mTouchEventListener = this.addTouchEventListener(aEventListenerTargets, oTable, { scrollDirection: ScrollDirection.BOTH }); }
javascript
function(oTable) { var oScrollExtension = oTable._getScrollExtension(); var aEventListenerTargets = ScrollingHelper.getEventListenerTargets(oTable); oScrollExtension._mMouseWheelEventListener = this.addMouseWheelEventListener(aEventListenerTargets, oTable, { scrollDirection: ScrollDirection.BOTH }); oScrollExtension._mTouchEventListener = this.addTouchEventListener(aEventListenerTargets, oTable, { scrollDirection: ScrollDirection.BOTH }); }
[ "function", "(", "oTable", ")", "{", "var", "oScrollExtension", "=", "oTable", ".", "_getScrollExtension", "(", ")", ";", "var", "aEventListenerTargets", "=", "ScrollingHelper", ".", "getEventListenerTargets", "(", "oTable", ")", ";", "oScrollExtension", ".", "_mMouseWheelEventListener", "=", "this", ".", "addMouseWheelEventListener", "(", "aEventListenerTargets", ",", "oTable", ",", "{", "scrollDirection", ":", "ScrollDirection", ".", "BOTH", "}", ")", ";", "oScrollExtension", ".", "_mTouchEventListener", "=", "this", ".", "addTouchEventListener", "(", "aEventListenerTargets", ",", "oTable", ",", "{", "scrollDirection", ":", "ScrollDirection", ".", "BOTH", "}", ")", ";", "}" ]
Adds mouse wheel and touch event listeners. @param {sap.ui.table.Table} oTable Instance of the table.
[ "Adds", "mouse", "wheel", "and", "touch", "event", "listeners", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/TableScrollExtension.js#L1059-L1069
4,130
SAP/openui5
src/sap.ui.table/src/sap/ui/table/TableScrollExtension.js
function(aEventListenerTargets, oTable, mOptions) { var fnOnMouseWheelEventHandler = ScrollingHelper.onMouseWheelScrolling.bind(oTable, mOptions); for (var i = 0; i < aEventListenerTargets.length; i++) { aEventListenerTargets[i].addEventListener("wheel", fnOnMouseWheelEventHandler); } return {wheel: fnOnMouseWheelEventHandler}; }
javascript
function(aEventListenerTargets, oTable, mOptions) { var fnOnMouseWheelEventHandler = ScrollingHelper.onMouseWheelScrolling.bind(oTable, mOptions); for (var i = 0; i < aEventListenerTargets.length; i++) { aEventListenerTargets[i].addEventListener("wheel", fnOnMouseWheelEventHandler); } return {wheel: fnOnMouseWheelEventHandler}; }
[ "function", "(", "aEventListenerTargets", ",", "oTable", ",", "mOptions", ")", "{", "var", "fnOnMouseWheelEventHandler", "=", "ScrollingHelper", ".", "onMouseWheelScrolling", ".", "bind", "(", "oTable", ",", "mOptions", ")", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "aEventListenerTargets", ".", "length", ";", "i", "++", ")", "{", "aEventListenerTargets", "[", "i", "]", ".", "addEventListener", "(", "\"wheel\"", ",", "fnOnMouseWheelEventHandler", ")", ";", "}", "return", "{", "wheel", ":", "fnOnMouseWheelEventHandler", "}", ";", "}" ]
Adds mouse wheel event listeners to HTMLElements. @param {HTMLElement[]} aEventListenerTargets The elements to add listeners to. @param {sap.ui.table.Table} oTable The table instance to be set as the context of the listeners. @param {TableScrollExtension.EventListenerOptions} mOptions The options. @returns {{wheel: Function}} A key value map containing the event names as keys and listener functions as values.
[ "Adds", "mouse", "wheel", "event", "listeners", "to", "HTMLElements", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/TableScrollExtension.js#L1079-L1087
4,131
SAP/openui5
src/sap.ui.table/src/sap/ui/table/TableScrollExtension.js
function(aEventListenerTargets, oTable, mOptions) { var fnOnTouchStartEventHandler = ScrollingHelper.onTouchStart.bind(oTable, mOptions); var fnOnTouchMoveEventHandler = ScrollingHelper.onTouchMoveScrolling.bind(oTable, mOptions); var mListeners = {}; for (var i = 0; i < aEventListenerTargets.length; i++) { /* Touch events */ // IE/Edge and Chrome on desktops and windows tablets - pointer events; // other browsers and tablets - touch events. if (Device.support.pointer && Device.system.desktop) { aEventListenerTargets[i].addEventListener("pointerdown", fnOnTouchStartEventHandler); aEventListenerTargets[i].addEventListener("pointermove", fnOnTouchMoveEventHandler, Device.browser.chrome ? {passive: true} : false); } else if (Device.support.touch) { aEventListenerTargets[i].addEventListener("touchstart", fnOnTouchStartEventHandler); aEventListenerTargets[i].addEventListener("touchmove", fnOnTouchMoveEventHandler); } } if (Device.support.pointer && Device.system.desktop) { mListeners = {pointerdown: fnOnTouchStartEventHandler, pointermove: fnOnTouchMoveEventHandler}; } else if (Device.support.touch) { mListeners = {touchstart: fnOnTouchStartEventHandler, touchmove: fnOnTouchMoveEventHandler}; } return mListeners; }
javascript
function(aEventListenerTargets, oTable, mOptions) { var fnOnTouchStartEventHandler = ScrollingHelper.onTouchStart.bind(oTable, mOptions); var fnOnTouchMoveEventHandler = ScrollingHelper.onTouchMoveScrolling.bind(oTable, mOptions); var mListeners = {}; for (var i = 0; i < aEventListenerTargets.length; i++) { /* Touch events */ // IE/Edge and Chrome on desktops and windows tablets - pointer events; // other browsers and tablets - touch events. if (Device.support.pointer && Device.system.desktop) { aEventListenerTargets[i].addEventListener("pointerdown", fnOnTouchStartEventHandler); aEventListenerTargets[i].addEventListener("pointermove", fnOnTouchMoveEventHandler, Device.browser.chrome ? {passive: true} : false); } else if (Device.support.touch) { aEventListenerTargets[i].addEventListener("touchstart", fnOnTouchStartEventHandler); aEventListenerTargets[i].addEventListener("touchmove", fnOnTouchMoveEventHandler); } } if (Device.support.pointer && Device.system.desktop) { mListeners = {pointerdown: fnOnTouchStartEventHandler, pointermove: fnOnTouchMoveEventHandler}; } else if (Device.support.touch) { mListeners = {touchstart: fnOnTouchStartEventHandler, touchmove: fnOnTouchMoveEventHandler}; } return mListeners; }
[ "function", "(", "aEventListenerTargets", ",", "oTable", ",", "mOptions", ")", "{", "var", "fnOnTouchStartEventHandler", "=", "ScrollingHelper", ".", "onTouchStart", ".", "bind", "(", "oTable", ",", "mOptions", ")", ";", "var", "fnOnTouchMoveEventHandler", "=", "ScrollingHelper", ".", "onTouchMoveScrolling", ".", "bind", "(", "oTable", ",", "mOptions", ")", ";", "var", "mListeners", "=", "{", "}", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "aEventListenerTargets", ".", "length", ";", "i", "++", ")", "{", "/* Touch events */", "// IE/Edge and Chrome on desktops and windows tablets - pointer events;", "// other browsers and tablets - touch events.", "if", "(", "Device", ".", "support", ".", "pointer", "&&", "Device", ".", "system", ".", "desktop", ")", "{", "aEventListenerTargets", "[", "i", "]", ".", "addEventListener", "(", "\"pointerdown\"", ",", "fnOnTouchStartEventHandler", ")", ";", "aEventListenerTargets", "[", "i", "]", ".", "addEventListener", "(", "\"pointermove\"", ",", "fnOnTouchMoveEventHandler", ",", "Device", ".", "browser", ".", "chrome", "?", "{", "passive", ":", "true", "}", ":", "false", ")", ";", "}", "else", "if", "(", "Device", ".", "support", ".", "touch", ")", "{", "aEventListenerTargets", "[", "i", "]", ".", "addEventListener", "(", "\"touchstart\"", ",", "fnOnTouchStartEventHandler", ")", ";", "aEventListenerTargets", "[", "i", "]", ".", "addEventListener", "(", "\"touchmove\"", ",", "fnOnTouchMoveEventHandler", ")", ";", "}", "}", "if", "(", "Device", ".", "support", ".", "pointer", "&&", "Device", ".", "system", ".", "desktop", ")", "{", "mListeners", "=", "{", "pointerdown", ":", "fnOnTouchStartEventHandler", ",", "pointermove", ":", "fnOnTouchMoveEventHandler", "}", ";", "}", "else", "if", "(", "Device", ".", "support", ".", "touch", ")", "{", "mListeners", "=", "{", "touchstart", ":", "fnOnTouchStartEventHandler", ",", "touchmove", ":", "fnOnTouchMoveEventHandler", "}", ";", "}", "return", "mListeners", ";", "}" ]
Adds touch event listeners to HTMLElements. @param {HTMLElement[]} aEventListenerTargets The elements to add listeners to. @param {sap.ui.table.Table} oTable The table instance to be set as the context of the listeners. @param {TableScrollExtension.EventListenerOptions} mOptions The options. @returns {{pointerdown: Function, pointermove: Function, touchstart: Function, touchmove: Function}} A key value map containing the event names as keys and listener functions as values.
[ "Adds", "touch", "event", "listeners", "to", "HTMLElements", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/TableScrollExtension.js#L1100-L1126
4,132
SAP/openui5
src/sap.ui.table/src/sap/ui/table/TableScrollExtension.js
function(oTable) { var oScrollExtension = oTable._getScrollExtension(); var aEventTargets = ScrollingHelper.getEventListenerTargets(oTable); function removeEventListener(oTarget, mEventListenerMap) { for (var sEventName in mEventListenerMap) { var fnListener = mEventListenerMap[sEventName]; if (fnListener) { oTarget.removeEventListener(sEventName, fnListener); } } } for (var i = 0; i < aEventTargets.length; i++) { removeEventListener(aEventTargets[i], oScrollExtension._mMouseWheelEventListener); removeEventListener(aEventTargets[i], oScrollExtension._mTouchEventListener); } delete oScrollExtension._mMouseWheelEventListener; delete oScrollExtension._mTouchEventListener; }
javascript
function(oTable) { var oScrollExtension = oTable._getScrollExtension(); var aEventTargets = ScrollingHelper.getEventListenerTargets(oTable); function removeEventListener(oTarget, mEventListenerMap) { for (var sEventName in mEventListenerMap) { var fnListener = mEventListenerMap[sEventName]; if (fnListener) { oTarget.removeEventListener(sEventName, fnListener); } } } for (var i = 0; i < aEventTargets.length; i++) { removeEventListener(aEventTargets[i], oScrollExtension._mMouseWheelEventListener); removeEventListener(aEventTargets[i], oScrollExtension._mTouchEventListener); } delete oScrollExtension._mMouseWheelEventListener; delete oScrollExtension._mTouchEventListener; }
[ "function", "(", "oTable", ")", "{", "var", "oScrollExtension", "=", "oTable", ".", "_getScrollExtension", "(", ")", ";", "var", "aEventTargets", "=", "ScrollingHelper", ".", "getEventListenerTargets", "(", "oTable", ")", ";", "function", "removeEventListener", "(", "oTarget", ",", "mEventListenerMap", ")", "{", "for", "(", "var", "sEventName", "in", "mEventListenerMap", ")", "{", "var", "fnListener", "=", "mEventListenerMap", "[", "sEventName", "]", ";", "if", "(", "fnListener", ")", "{", "oTarget", ".", "removeEventListener", "(", "sEventName", ",", "fnListener", ")", ";", "}", "}", "}", "for", "(", "var", "i", "=", "0", ";", "i", "<", "aEventTargets", ".", "length", ";", "i", "++", ")", "{", "removeEventListener", "(", "aEventTargets", "[", "i", "]", ",", "oScrollExtension", ".", "_mMouseWheelEventListener", ")", ";", "removeEventListener", "(", "aEventTargets", "[", "i", "]", ",", "oScrollExtension", ".", "_mTouchEventListener", ")", ";", "}", "delete", "oScrollExtension", ".", "_mMouseWheelEventListener", ";", "delete", "oScrollExtension", ".", "_mTouchEventListener", ";", "}" ]
Removes mouse wheel and touch event listeners. @param {sap.ui.table.Table} oTable Instance of the table.
[ "Removes", "mouse", "wheel", "and", "touch", "event", "listeners", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/TableScrollExtension.js#L1133-L1153
4,133
SAP/openui5
src/sap.ui.core/src/jquery.sap.history.js
calculateStepsToHash
function calculateStepsToHash(sCurrentHash, sToHash, bPrefix){ var iCurrentIndex = jQuery.inArray(sCurrentHash, hashHistory), iToIndex, i, tempHash; if (iCurrentIndex > 0) { if (bPrefix) { for (i = iCurrentIndex - 1; i >= 0 ; i--) { tempHash = hashHistory[i]; if (tempHash.indexOf(sToHash) === 0 && !isVirtualHash(tempHash)) { return i - iCurrentIndex; } } } else { iToIndex = jQuery.inArray(sToHash, hashHistory); //When back to home is needed, and application is started with nonempty hash but it's nonbookmarkable if ((iToIndex === -1) && sToHash.length === 0) { return -1 * iCurrentIndex; } if ((iToIndex > -1) && (iToIndex < iCurrentIndex)) { return iToIndex - iCurrentIndex; } } } return 0; }
javascript
function calculateStepsToHash(sCurrentHash, sToHash, bPrefix){ var iCurrentIndex = jQuery.inArray(sCurrentHash, hashHistory), iToIndex, i, tempHash; if (iCurrentIndex > 0) { if (bPrefix) { for (i = iCurrentIndex - 1; i >= 0 ; i--) { tempHash = hashHistory[i]; if (tempHash.indexOf(sToHash) === 0 && !isVirtualHash(tempHash)) { return i - iCurrentIndex; } } } else { iToIndex = jQuery.inArray(sToHash, hashHistory); //When back to home is needed, and application is started with nonempty hash but it's nonbookmarkable if ((iToIndex === -1) && sToHash.length === 0) { return -1 * iCurrentIndex; } if ((iToIndex > -1) && (iToIndex < iCurrentIndex)) { return iToIndex - iCurrentIndex; } } } return 0; }
[ "function", "calculateStepsToHash", "(", "sCurrentHash", ",", "sToHash", ",", "bPrefix", ")", "{", "var", "iCurrentIndex", "=", "jQuery", ".", "inArray", "(", "sCurrentHash", ",", "hashHistory", ")", ",", "iToIndex", ",", "i", ",", "tempHash", ";", "if", "(", "iCurrentIndex", ">", "0", ")", "{", "if", "(", "bPrefix", ")", "{", "for", "(", "i", "=", "iCurrentIndex", "-", "1", ";", "i", ">=", "0", ";", "i", "--", ")", "{", "tempHash", "=", "hashHistory", "[", "i", "]", ";", "if", "(", "tempHash", ".", "indexOf", "(", "sToHash", ")", "===", "0", "&&", "!", "isVirtualHash", "(", "tempHash", ")", ")", "{", "return", "i", "-", "iCurrentIndex", ";", "}", "}", "}", "else", "{", "iToIndex", "=", "jQuery", ".", "inArray", "(", "sToHash", ",", "hashHistory", ")", ";", "//When back to home is needed, and application is started with nonempty hash but it's nonbookmarkable", "if", "(", "(", "iToIndex", "===", "-", "1", ")", "&&", "sToHash", ".", "length", "===", "0", ")", "{", "return", "-", "1", "*", "iCurrentIndex", ";", "}", "if", "(", "(", "iToIndex", ">", "-", "1", ")", "&&", "(", "iToIndex", "<", "iCurrentIndex", ")", ")", "{", "return", "iToIndex", "-", "iCurrentIndex", ";", "}", "}", "}", "return", "0", ";", "}" ]
This function calculates the number of steps from the sCurrentHash to sToHash. If the sCurrentHash or the sToHash is not in the history stack, it returns 0. @private
[ "This", "function", "calculates", "the", "number", "of", "steps", "from", "the", "sCurrentHash", "to", "sToHash", ".", "If", "the", "sCurrentHash", "or", "the", "sToHash", "is", "not", "in", "the", "history", "stack", "it", "returns", "0", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/jquery.sap.history.js#L385-L413
4,134
SAP/openui5
src/sap.ui.core/src/jquery.sap.history.js
detectHashChange
function detectHashChange(oEvent, bManual){ //Firefox will decode the hash when it's set to the window.location.hash, //so we need to parse the href instead of reading the window.location.hash var sHash = (window.location.href.split("#")[1] || ""); sHash = formatHash(sHash); if (bManual || !mSkipHandler[sHash]) { aHashChangeBuffer.push(sHash); } if (!bInProcessing) { bInProcessing = true; if (aHashChangeBuffer.length > 0) { var newHash = aHashChangeBuffer.shift(); if (mSkipHandler[newHash]) { reorganizeHistoryArray(newHash); delete mSkipHandler[newHash]; } else { onHashChange(newHash); } currentHash = newHash; } bInProcessing = false; } }
javascript
function detectHashChange(oEvent, bManual){ //Firefox will decode the hash when it's set to the window.location.hash, //so we need to parse the href instead of reading the window.location.hash var sHash = (window.location.href.split("#")[1] || ""); sHash = formatHash(sHash); if (bManual || !mSkipHandler[sHash]) { aHashChangeBuffer.push(sHash); } if (!bInProcessing) { bInProcessing = true; if (aHashChangeBuffer.length > 0) { var newHash = aHashChangeBuffer.shift(); if (mSkipHandler[newHash]) { reorganizeHistoryArray(newHash); delete mSkipHandler[newHash]; } else { onHashChange(newHash); } currentHash = newHash; } bInProcessing = false; } }
[ "function", "detectHashChange", "(", "oEvent", ",", "bManual", ")", "{", "//Firefox will decode the hash when it's set to the window.location.hash,", "//so we need to parse the href instead of reading the window.location.hash", "var", "sHash", "=", "(", "window", ".", "location", ".", "href", ".", "split", "(", "\"#\"", ")", "[", "1", "]", "||", "\"\"", ")", ";", "sHash", "=", "formatHash", "(", "sHash", ")", ";", "if", "(", "bManual", "||", "!", "mSkipHandler", "[", "sHash", "]", ")", "{", "aHashChangeBuffer", ".", "push", "(", "sHash", ")", ";", "}", "if", "(", "!", "bInProcessing", ")", "{", "bInProcessing", "=", "true", ";", "if", "(", "aHashChangeBuffer", ".", "length", ">", "0", ")", "{", "var", "newHash", "=", "aHashChangeBuffer", ".", "shift", "(", ")", ";", "if", "(", "mSkipHandler", "[", "newHash", "]", ")", "{", "reorganizeHistoryArray", "(", "newHash", ")", ";", "delete", "mSkipHandler", "[", "newHash", "]", ";", "}", "else", "{", "onHashChange", "(", "newHash", ")", ";", "}", "currentHash", "=", "newHash", ";", "}", "bInProcessing", "=", "false", ";", "}", "}" ]
This function is bound to the window's hashchange event, and it detects the change of the hash. When history is added by calling the addHistory or addVirtualHistory function, it will not call the real onHashChange function because changes are already done. Only when a hash is navigated by clicking the back or forward buttons in the browser, the onHashChange will be called. @private
[ "This", "function", "is", "bound", "to", "the", "window", "s", "hashchange", "event", "and", "it", "detects", "the", "change", "of", "the", "hash", ".", "When", "history", "is", "added", "by", "calling", "the", "addHistory", "or", "addVirtualHistory", "function", "it", "will", "not", "call", "the", "real", "onHashChange", "function", "because", "changes", "are", "already", "done", ".", "Only", "when", "a", "hash", "is", "navigated", "by", "clicking", "the", "back", "or", "forward", "buttons", "in", "the", "browser", "the", "onHashChange", "will", "be", "called", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/jquery.sap.history.js#L425-L450
4,135
SAP/openui5
src/sap.ui.core/src/jquery.sap.history.js
getNextSuffix
function getNextSuffix(sHash){ var sPath = sHash ? sHash : ""; if (isVirtualHash(sPath)) { var iIndex = sPath.lastIndexOf(skipSuffix); sPath = sPath.slice(0, iIndex); } return sPath + skipSuffix + skipIndex++; }
javascript
function getNextSuffix(sHash){ var sPath = sHash ? sHash : ""; if (isVirtualHash(sPath)) { var iIndex = sPath.lastIndexOf(skipSuffix); sPath = sPath.slice(0, iIndex); } return sPath + skipSuffix + skipIndex++; }
[ "function", "getNextSuffix", "(", "sHash", ")", "{", "var", "sPath", "=", "sHash", "?", "sHash", ":", "\"\"", ";", "if", "(", "isVirtualHash", "(", "sPath", ")", ")", "{", "var", "iIndex", "=", "sPath", ".", "lastIndexOf", "(", "skipSuffix", ")", ";", "sPath", "=", "sPath", ".", "slice", "(", "0", ",", "iIndex", ")", ";", "}", "return", "sPath", "+", "skipSuffix", "+", "skipIndex", "++", ";", "}" ]
This function returns a hash with suffix added to the end based on the sHash parameter. It handles as well when the current hash is already with suffix. It returns a new suffix with a unique number in the end. @private
[ "This", "function", "returns", "a", "hash", "with", "suffix", "added", "to", "the", "end", "based", "on", "the", "sHash", "parameter", ".", "It", "handles", "as", "well", "when", "the", "current", "hash", "is", "already", "with", "suffix", ".", "It", "returns", "a", "new", "suffix", "with", "a", "unique", "number", "in", "the", "end", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/jquery.sap.history.js#L478-L487
4,136
SAP/openui5
src/sap.ui.core/src/jquery.sap.history.js
preGenHash
function preGenHash(sIdf, oStateData){ var sEncodedIdf = window.encodeURIComponent(sIdf); var sEncodedData = window.encodeURIComponent(window.JSON.stringify(oStateData)); return sEncodedIdf + sIdSeperator + sEncodedData; }
javascript
function preGenHash(sIdf, oStateData){ var sEncodedIdf = window.encodeURIComponent(sIdf); var sEncodedData = window.encodeURIComponent(window.JSON.stringify(oStateData)); return sEncodedIdf + sIdSeperator + sEncodedData; }
[ "function", "preGenHash", "(", "sIdf", ",", "oStateData", ")", "{", "var", "sEncodedIdf", "=", "window", ".", "encodeURIComponent", "(", "sIdf", ")", ";", "var", "sEncodedData", "=", "window", ".", "encodeURIComponent", "(", "window", ".", "JSON", ".", "stringify", "(", "oStateData", ")", ")", ";", "return", "sEncodedIdf", "+", "sIdSeperator", "+", "sEncodedData", ";", "}" ]
This function encode the identifier and data into a string. @private
[ "This", "function", "encode", "the", "identifier", "and", "data", "into", "a", "string", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/jquery.sap.history.js#L494-L498
4,137
SAP/openui5
src/sap.ui.core/src/jquery.sap.history.js
getAppendId
function getAppendId(sHash){ var iIndex = jQuery.inArray(currentHash, hashHistory), i, sHistory; if (iIndex > -1) { for (i = 0 ; i < iIndex + 1 ; i++) { sHistory = hashHistory[i]; if (sHistory.slice(0, sHistory.length - 2) === sHash) { return uid(); } } } return ""; }
javascript
function getAppendId(sHash){ var iIndex = jQuery.inArray(currentHash, hashHistory), i, sHistory; if (iIndex > -1) { for (i = 0 ; i < iIndex + 1 ; i++) { sHistory = hashHistory[i]; if (sHistory.slice(0, sHistory.length - 2) === sHash) { return uid(); } } } return ""; }
[ "function", "getAppendId", "(", "sHash", ")", "{", "var", "iIndex", "=", "jQuery", ".", "inArray", "(", "currentHash", ",", "hashHistory", ")", ",", "i", ",", "sHistory", ";", "if", "(", "iIndex", ">", "-", "1", ")", "{", "for", "(", "i", "=", "0", ";", "i", "<", "iIndex", "+", "1", ";", "i", "++", ")", "{", "sHistory", "=", "hashHistory", "[", "i", "]", ";", "if", "(", "sHistory", ".", "slice", "(", "0", ",", "sHistory", ".", "length", "-", "2", ")", "===", "sHash", ")", "{", "return", "uid", "(", ")", ";", "}", "}", "}", "return", "\"\"", ";", "}" ]
This function checks if the combination of the identifier and data is unique in the current history stack. If yes, it returns an empty string. Otherwise it returns a unique id. @private
[ "This", "function", "checks", "if", "the", "combination", "of", "the", "identifier", "and", "data", "is", "unique", "in", "the", "current", "history", "stack", ".", "If", "yes", "it", "returns", "an", "empty", "string", ".", "Otherwise", "it", "returns", "a", "unique", "id", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/jquery.sap.history.js#L506-L519
4,138
SAP/openui5
src/sap.ui.core/src/jquery.sap.history.js
reorganizeHistoryArray
function reorganizeHistoryArray(sHash){ var iIndex = jQuery.inArray(currentHash, hashHistory); if ( !(iIndex === -1 || iIndex === hashHistory.length - 1) ) { hashHistory.splice(iIndex + 1, hashHistory.length - 1 - iIndex); } hashHistory.push(sHash); }
javascript
function reorganizeHistoryArray(sHash){ var iIndex = jQuery.inArray(currentHash, hashHistory); if ( !(iIndex === -1 || iIndex === hashHistory.length - 1) ) { hashHistory.splice(iIndex + 1, hashHistory.length - 1 - iIndex); } hashHistory.push(sHash); }
[ "function", "reorganizeHistoryArray", "(", "sHash", ")", "{", "var", "iIndex", "=", "jQuery", ".", "inArray", "(", "currentHash", ",", "hashHistory", ")", ";", "if", "(", "!", "(", "iIndex", "===", "-", "1", "||", "iIndex", "===", "hashHistory", ".", "length", "-", "1", ")", ")", "{", "hashHistory", ".", "splice", "(", "iIndex", "+", "1", ",", "hashHistory", ".", "length", "-", "1", "-", "iIndex", ")", ";", "}", "hashHistory", ".", "push", "(", "sHash", ")", ";", "}" ]
This function manages the internal array of history records. @private
[ "This", "function", "manages", "the", "internal", "array", "of", "history", "records", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/jquery.sap.history.js#L526-L533
4,139
SAP/openui5
src/sap.ui.core/src/jquery.sap.history.js
calcStepsToRealHistory
function calcStepsToRealHistory(sCurrentHash, bForward){ var iIndex = jQuery.inArray(sCurrentHash, hashHistory), i; if (iIndex !== -1) { if (bForward) { for (i = iIndex ; i < hashHistory.length ; i++) { if (!isVirtualHash(hashHistory[i])) { return i - iIndex; } } } else { for (i = iIndex ; i >= 0 ; i--) { if (!isVirtualHash(hashHistory[i])) { return i - iIndex; } } return -1 * (iIndex + 1); } } }
javascript
function calcStepsToRealHistory(sCurrentHash, bForward){ var iIndex = jQuery.inArray(sCurrentHash, hashHistory), i; if (iIndex !== -1) { if (bForward) { for (i = iIndex ; i < hashHistory.length ; i++) { if (!isVirtualHash(hashHistory[i])) { return i - iIndex; } } } else { for (i = iIndex ; i >= 0 ; i--) { if (!isVirtualHash(hashHistory[i])) { return i - iIndex; } } return -1 * (iIndex + 1); } } }
[ "function", "calcStepsToRealHistory", "(", "sCurrentHash", ",", "bForward", ")", "{", "var", "iIndex", "=", "jQuery", ".", "inArray", "(", "sCurrentHash", ",", "hashHistory", ")", ",", "i", ";", "if", "(", "iIndex", "!==", "-", "1", ")", "{", "if", "(", "bForward", ")", "{", "for", "(", "i", "=", "iIndex", ";", "i", "<", "hashHistory", ".", "length", ";", "i", "++", ")", "{", "if", "(", "!", "isVirtualHash", "(", "hashHistory", "[", "i", "]", ")", ")", "{", "return", "i", "-", "iIndex", ";", "}", "}", "}", "else", "{", "for", "(", "i", "=", "iIndex", ";", "i", ">=", "0", ";", "i", "--", ")", "{", "if", "(", "!", "isVirtualHash", "(", "hashHistory", "[", "i", "]", ")", ")", "{", "return", "i", "-", "iIndex", ";", "}", "}", "return", "-", "1", "*", "(", "iIndex", "+", "1", ")", ";", "}", "}", "}" ]
This function calculates the steps forward or backward that need to skip the virtual history states. @private
[ "This", "function", "calculates", "the", "steps", "forward", "or", "backward", "that", "need", "to", "skip", "the", "virtual", "history", "states", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/jquery.sap.history.js#L549-L569
4,140
SAP/openui5
src/sap.ui.core/src/jquery.sap.history.js
onHashChange
function onHashChange(sHash){ var oRoute, iStep, oParsedHash, iNewHashIndex, sNavType; //handle the nonbookmarkable hash if (currentHash === undefined) { //url with hash opened from bookmark oParsedHash = parseHashToObject(sHash); if (!oParsedHash || !oParsedHash.bBookmarkable) { if (jQuery.isFunction(defaultHandler)) { defaultHandler(jQuery.sap.history.NavType.Bookmark); } return; } } if (sHash.length === 0) { if (jQuery.isFunction(defaultHandler)) { defaultHandler(jQuery.sap.history.NavType.Back); } } else { //application restored from bookmark with non-empty hash, and later navigates back to the first hash token //the defaultHandler should be triggered iNewHashIndex = hashHistory.indexOf(sHash); if (iNewHashIndex === 0) { oParsedHash = parseHashToObject(sHash); if (!oParsedHash || !oParsedHash.bBookmarkable) { if (jQuery.isFunction(defaultHandler)) { defaultHandler(jQuery.sap.history.NavType.Back); } return; } } //need to handle when iNewHashIndex equals -1. //This happens when user navigates out the current application, and later navigates back. //In this case, the hashHistory is an empty array. if (isVirtualHash(sHash)) { //this is a virtual history, should do the skipping calculation if (isVirtualHash(currentHash)) { //go back to the first one that is not virtual iStep = calcStepsToRealHistory(sHash, false); window.history.go(iStep); } else { var sameFamilyRegex = new RegExp(escapeRegExp(currentHash + skipSuffix) + "[0-9]*$"); if (sameFamilyRegex.test(sHash)) { //going forward //search forward in history for the first non-virtual hash //if there is, change to that one window.history.go //if not, stay and return false iStep = calcStepsToRealHistory(sHash, true); if (iStep) { window.history.go(iStep); } else { window.history.back(); } } else { //going backward //search backward for the first non-virtual hash and there must be one iStep = calcStepsToRealHistory(sHash, false); window.history.go(iStep); } } } else { if (iNewHashIndex === -1) { sNavType = jQuery.sap.history.NavType.Unknown; hashHistory.push(sHash); } else { if (hashHistory.indexOf(currentHash, iNewHashIndex + 1) === -1) { sNavType = jQuery.sap.history.NavType.Forward; } else { sNavType = jQuery.sap.history.NavType.Back; } } oParsedHash = parseHashToObject(sHash); if (oParsedHash) { oRoute = findRouteByIdentifier(oParsedHash.sIdentifier); if (oRoute) { oRoute.action.apply(null, [oParsedHash.oStateData, sNavType]); } } else { Log.error("hash format error! The current Hash: " + sHash); } } } }
javascript
function onHashChange(sHash){ var oRoute, iStep, oParsedHash, iNewHashIndex, sNavType; //handle the nonbookmarkable hash if (currentHash === undefined) { //url with hash opened from bookmark oParsedHash = parseHashToObject(sHash); if (!oParsedHash || !oParsedHash.bBookmarkable) { if (jQuery.isFunction(defaultHandler)) { defaultHandler(jQuery.sap.history.NavType.Bookmark); } return; } } if (sHash.length === 0) { if (jQuery.isFunction(defaultHandler)) { defaultHandler(jQuery.sap.history.NavType.Back); } } else { //application restored from bookmark with non-empty hash, and later navigates back to the first hash token //the defaultHandler should be triggered iNewHashIndex = hashHistory.indexOf(sHash); if (iNewHashIndex === 0) { oParsedHash = parseHashToObject(sHash); if (!oParsedHash || !oParsedHash.bBookmarkable) { if (jQuery.isFunction(defaultHandler)) { defaultHandler(jQuery.sap.history.NavType.Back); } return; } } //need to handle when iNewHashIndex equals -1. //This happens when user navigates out the current application, and later navigates back. //In this case, the hashHistory is an empty array. if (isVirtualHash(sHash)) { //this is a virtual history, should do the skipping calculation if (isVirtualHash(currentHash)) { //go back to the first one that is not virtual iStep = calcStepsToRealHistory(sHash, false); window.history.go(iStep); } else { var sameFamilyRegex = new RegExp(escapeRegExp(currentHash + skipSuffix) + "[0-9]*$"); if (sameFamilyRegex.test(sHash)) { //going forward //search forward in history for the first non-virtual hash //if there is, change to that one window.history.go //if not, stay and return false iStep = calcStepsToRealHistory(sHash, true); if (iStep) { window.history.go(iStep); } else { window.history.back(); } } else { //going backward //search backward for the first non-virtual hash and there must be one iStep = calcStepsToRealHistory(sHash, false); window.history.go(iStep); } } } else { if (iNewHashIndex === -1) { sNavType = jQuery.sap.history.NavType.Unknown; hashHistory.push(sHash); } else { if (hashHistory.indexOf(currentHash, iNewHashIndex + 1) === -1) { sNavType = jQuery.sap.history.NavType.Forward; } else { sNavType = jQuery.sap.history.NavType.Back; } } oParsedHash = parseHashToObject(sHash); if (oParsedHash) { oRoute = findRouteByIdentifier(oParsedHash.sIdentifier); if (oRoute) { oRoute.action.apply(null, [oParsedHash.oStateData, sNavType]); } } else { Log.error("hash format error! The current Hash: " + sHash); } } } }
[ "function", "onHashChange", "(", "sHash", ")", "{", "var", "oRoute", ",", "iStep", ",", "oParsedHash", ",", "iNewHashIndex", ",", "sNavType", ";", "//handle the nonbookmarkable hash", "if", "(", "currentHash", "===", "undefined", ")", "{", "//url with hash opened from bookmark", "oParsedHash", "=", "parseHashToObject", "(", "sHash", ")", ";", "if", "(", "!", "oParsedHash", "||", "!", "oParsedHash", ".", "bBookmarkable", ")", "{", "if", "(", "jQuery", ".", "isFunction", "(", "defaultHandler", ")", ")", "{", "defaultHandler", "(", "jQuery", ".", "sap", ".", "history", ".", "NavType", ".", "Bookmark", ")", ";", "}", "return", ";", "}", "}", "if", "(", "sHash", ".", "length", "===", "0", ")", "{", "if", "(", "jQuery", ".", "isFunction", "(", "defaultHandler", ")", ")", "{", "defaultHandler", "(", "jQuery", ".", "sap", ".", "history", ".", "NavType", ".", "Back", ")", ";", "}", "}", "else", "{", "//application restored from bookmark with non-empty hash, and later navigates back to the first hash token", "//the defaultHandler should be triggered", "iNewHashIndex", "=", "hashHistory", ".", "indexOf", "(", "sHash", ")", ";", "if", "(", "iNewHashIndex", "===", "0", ")", "{", "oParsedHash", "=", "parseHashToObject", "(", "sHash", ")", ";", "if", "(", "!", "oParsedHash", "||", "!", "oParsedHash", ".", "bBookmarkable", ")", "{", "if", "(", "jQuery", ".", "isFunction", "(", "defaultHandler", ")", ")", "{", "defaultHandler", "(", "jQuery", ".", "sap", ".", "history", ".", "NavType", ".", "Back", ")", ";", "}", "return", ";", "}", "}", "//need to handle when iNewHashIndex equals -1.", "//This happens when user navigates out the current application, and later navigates back.", "//In this case, the hashHistory is an empty array.", "if", "(", "isVirtualHash", "(", "sHash", ")", ")", "{", "//this is a virtual history, should do the skipping calculation", "if", "(", "isVirtualHash", "(", "currentHash", ")", ")", "{", "//go back to the first one that is not virtual", "iStep", "=", "calcStepsToRealHistory", "(", "sHash", ",", "false", ")", ";", "window", ".", "history", ".", "go", "(", "iStep", ")", ";", "}", "else", "{", "var", "sameFamilyRegex", "=", "new", "RegExp", "(", "escapeRegExp", "(", "currentHash", "+", "skipSuffix", ")", "+", "\"[0-9]*$\"", ")", ";", "if", "(", "sameFamilyRegex", ".", "test", "(", "sHash", ")", ")", "{", "//going forward", "//search forward in history for the first non-virtual hash", "//if there is, change to that one window.history.go", "//if not, stay and return false", "iStep", "=", "calcStepsToRealHistory", "(", "sHash", ",", "true", ")", ";", "if", "(", "iStep", ")", "{", "window", ".", "history", ".", "go", "(", "iStep", ")", ";", "}", "else", "{", "window", ".", "history", ".", "back", "(", ")", ";", "}", "}", "else", "{", "//going backward", "//search backward for the first non-virtual hash and there must be one", "iStep", "=", "calcStepsToRealHistory", "(", "sHash", ",", "false", ")", ";", "window", ".", "history", ".", "go", "(", "iStep", ")", ";", "}", "}", "}", "else", "{", "if", "(", "iNewHashIndex", "===", "-", "1", ")", "{", "sNavType", "=", "jQuery", ".", "sap", ".", "history", ".", "NavType", ".", "Unknown", ";", "hashHistory", ".", "push", "(", "sHash", ")", ";", "}", "else", "{", "if", "(", "hashHistory", ".", "indexOf", "(", "currentHash", ",", "iNewHashIndex", "+", "1", ")", "===", "-", "1", ")", "{", "sNavType", "=", "jQuery", ".", "sap", ".", "history", ".", "NavType", ".", "Forward", ";", "}", "else", "{", "sNavType", "=", "jQuery", ".", "sap", ".", "history", ".", "NavType", ".", "Back", ";", "}", "}", "oParsedHash", "=", "parseHashToObject", "(", "sHash", ")", ";", "if", "(", "oParsedHash", ")", "{", "oRoute", "=", "findRouteByIdentifier", "(", "oParsedHash", ".", "sIdentifier", ")", ";", "if", "(", "oRoute", ")", "{", "oRoute", ".", "action", ".", "apply", "(", "null", ",", "[", "oParsedHash", ".", "oStateData", ",", "sNavType", "]", ")", ";", "}", "}", "else", "{", "Log", ".", "error", "(", "\"hash format error! The current Hash: \"", "+", "sHash", ")", ";", "}", "}", "}", "}" ]
This is the main function that handles the hash change event. @private
[ "This", "is", "the", "main", "function", "that", "handles", "the", "hash", "change", "event", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/jquery.sap.history.js#L577-L669
4,141
SAP/openui5
src/sap.ui.core/src/jquery.sap.history.js
findRouteByIdentifier
function findRouteByIdentifier(sIdf){ var i; for (i = 0 ; i < routes.length ; i++) { if (routes[i].sIdentifier === sIdf) { return routes[i]; } } }
javascript
function findRouteByIdentifier(sIdf){ var i; for (i = 0 ; i < routes.length ; i++) { if (routes[i].sIdentifier === sIdf) { return routes[i]; } } }
[ "function", "findRouteByIdentifier", "(", "sIdf", ")", "{", "var", "i", ";", "for", "(", "i", "=", "0", ";", "i", "<", "routes", ".", "length", ";", "i", "++", ")", "{", "if", "(", "routes", "[", "i", "]", ".", "sIdentifier", "===", "sIdf", ")", "{", "return", "routes", "[", "i", "]", ";", "}", "}", "}" ]
This function returns the route object matched by the identifier passed as parameter. @private
[ "This", "function", "returns", "the", "route", "object", "matched", "by", "the", "identifier", "passed", "as", "parameter", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/jquery.sap.history.js#L675-L682
4,142
SAP/openui5
src/sap.ui.core/src/sap/ui/core/Locale.js
function() { var sLanguage = this.sLanguage || "", m; // cut off any ext. language sub tags if ( sLanguage.indexOf("-") >= 0 ) { sLanguage = sLanguage.slice(0, sLanguage.indexOf("-")); } // convert to new ISO codes sLanguage = M_ISO639_OLD_TO_NEW[sLanguage] || sLanguage; // handle special cases for Chinese: map 'Traditional Chinese' (or region TW which implies Traditional) to 'zf' if ( sLanguage === "zh" ) { if ( this.sScript === "Hant" || (!this.sScript && this.sRegion === "TW") ) { sLanguage = "zf"; } } // recognize SAP supportability pseudo languages if ( this.sPrivateUse && (m = /-(saptrc|sappsd)(?:-|$)/i.exec(this.sPrivateUse)) ) { sLanguage = (m[1].toLowerCase() === "saptrc") ? "1Q" : "2Q"; } // by convention, SAP systems seem to use uppercase letters return sLanguage.toUpperCase(); }
javascript
function() { var sLanguage = this.sLanguage || "", m; // cut off any ext. language sub tags if ( sLanguage.indexOf("-") >= 0 ) { sLanguage = sLanguage.slice(0, sLanguage.indexOf("-")); } // convert to new ISO codes sLanguage = M_ISO639_OLD_TO_NEW[sLanguage] || sLanguage; // handle special cases for Chinese: map 'Traditional Chinese' (or region TW which implies Traditional) to 'zf' if ( sLanguage === "zh" ) { if ( this.sScript === "Hant" || (!this.sScript && this.sRegion === "TW") ) { sLanguage = "zf"; } } // recognize SAP supportability pseudo languages if ( this.sPrivateUse && (m = /-(saptrc|sappsd)(?:-|$)/i.exec(this.sPrivateUse)) ) { sLanguage = (m[1].toLowerCase() === "saptrc") ? "1Q" : "2Q"; } // by convention, SAP systems seem to use uppercase letters return sLanguage.toUpperCase(); }
[ "function", "(", ")", "{", "var", "sLanguage", "=", "this", ".", "sLanguage", "||", "\"\"", ",", "m", ";", "// cut off any ext. language sub tags", "if", "(", "sLanguage", ".", "indexOf", "(", "\"-\"", ")", ">=", "0", ")", "{", "sLanguage", "=", "sLanguage", ".", "slice", "(", "0", ",", "sLanguage", ".", "indexOf", "(", "\"-\"", ")", ")", ";", "}", "// convert to new ISO codes", "sLanguage", "=", "M_ISO639_OLD_TO_NEW", "[", "sLanguage", "]", "||", "sLanguage", ";", "// handle special cases for Chinese: map 'Traditional Chinese' (or region TW which implies Traditional) to 'zf'", "if", "(", "sLanguage", "===", "\"zh\"", ")", "{", "if", "(", "this", ".", "sScript", "===", "\"Hant\"", "||", "(", "!", "this", ".", "sScript", "&&", "this", ".", "sRegion", "===", "\"TW\"", ")", ")", "{", "sLanguage", "=", "\"zf\"", ";", "}", "}", "// recognize SAP supportability pseudo languages", "if", "(", "this", ".", "sPrivateUse", "&&", "(", "m", "=", "/", "-(saptrc|sappsd)(?:-|$)", "/", "i", ".", "exec", "(", "this", ".", "sPrivateUse", ")", ")", ")", "{", "sLanguage", "=", "(", "m", "[", "1", "]", ".", "toLowerCase", "(", ")", "===", "\"saptrc\"", ")", "?", "\"1Q\"", ":", "\"2Q\"", ";", "}", "// by convention, SAP systems seem to use uppercase letters", "return", "sLanguage", ".", "toUpperCase", "(", ")", ";", "}" ]
Best guess to get a proper SAP Logon Language for this locale. Conversions taken into account: <ul> <li>use the language part only</li> <li>convert old ISO639 codes to newer ones (e.g. 'iw' to 'he')</li> <li>for Chinese, map 'Traditional Chinese' to SAP proprietary code 'zf'</li> <li>map private extensions x-sap1q and x-sap2q to SAP pseudo languages '1Q' and '2Q'</li> <li>remove ext. language sub tags</li> <li>convert to uppercase</li> </ul> Note that the conversion also returns a result for languages that are not supported by the default set of SAP languages. This method has no knowledge about the concrete languages of any given backend system. @return {string} a language code that should @public @since 1.17.0 @deprecated As of 1.44, use {@link sap.ui.core.Configuration#getSAPLogonLanguage} instead as that class allows to configure an SAP Logon language.
[ "Best", "guess", "to", "get", "a", "proper", "SAP", "Logon", "Language", "for", "this", "locale", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/Locale.js#L241-L268
4,143
SAP/openui5
src/sap.ui.core/src/sap/ui/core/Locale.js
getDesigntimePropertyAsArray
function getDesigntimePropertyAsArray(sValue) { var m = /\$([-a-z0-9A-Z._]+)(?::([^$]*))?\$/.exec(sValue); return (m && m[2]) ? m[2].split(/,/) : null; }
javascript
function getDesigntimePropertyAsArray(sValue) { var m = /\$([-a-z0-9A-Z._]+)(?::([^$]*))?\$/.exec(sValue); return (m && m[2]) ? m[2].split(/,/) : null; }
[ "function", "getDesigntimePropertyAsArray", "(", "sValue", ")", "{", "var", "m", "=", "/", "\\$([-a-z0-9A-Z._]+)(?::([^$]*))?\\$", "/", ".", "exec", "(", "sValue", ")", ";", "return", "(", "m", "&&", "m", "[", "2", "]", ")", "?", "m", "[", "2", "]", ".", "split", "(", "/", ",", "/", ")", ":", "null", ";", "}" ]
Helper to analyze and parse designtime variables @private
[ "Helper", "to", "analyze", "and", "parse", "designtime", "variables" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/Locale.js#L284-L287
4,144
SAP/openui5
src/sap.ui.core/src/sap/ui/core/XMLTemplateProcessor.js
getHandleChildrenStrategy
function getHandleChildrenStrategy(bAsync, fnCallback) { // sync strategy ensures processing order by just being sync function syncStrategy(node, oAggregation, mAggregations) { var childNode, vChild, aChildren = []; for (childNode = node.firstChild; childNode; childNode = childNode.nextSibling) { vChild = fnCallback(node, oAggregation, mAggregations, childNode); if (vChild) { aChildren.push(unwrapSyncPromise(vChild)); } } return SyncPromise.resolve(aChildren); } // async strategy ensures processing order by chaining the callbacks function asyncStrategy(node, oAggregation, mAggregations) { var childNode, pChain = Promise.resolve(), aChildPromises = []; for (childNode = node.firstChild; childNode; childNode = childNode.nextSibling) { pChain = pChain.then(fnCallback.bind(null, node, oAggregation, mAggregations, childNode)); aChildPromises.push(pChain); } return Promise.all(aChildPromises); } return bAsync ? asyncStrategy : syncStrategy; }
javascript
function getHandleChildrenStrategy(bAsync, fnCallback) { // sync strategy ensures processing order by just being sync function syncStrategy(node, oAggregation, mAggregations) { var childNode, vChild, aChildren = []; for (childNode = node.firstChild; childNode; childNode = childNode.nextSibling) { vChild = fnCallback(node, oAggregation, mAggregations, childNode); if (vChild) { aChildren.push(unwrapSyncPromise(vChild)); } } return SyncPromise.resolve(aChildren); } // async strategy ensures processing order by chaining the callbacks function asyncStrategy(node, oAggregation, mAggregations) { var childNode, pChain = Promise.resolve(), aChildPromises = []; for (childNode = node.firstChild; childNode; childNode = childNode.nextSibling) { pChain = pChain.then(fnCallback.bind(null, node, oAggregation, mAggregations, childNode)); aChildPromises.push(pChain); } return Promise.all(aChildPromises); } return bAsync ? asyncStrategy : syncStrategy; }
[ "function", "getHandleChildrenStrategy", "(", "bAsync", ",", "fnCallback", ")", "{", "// sync strategy ensures processing order by just being sync", "function", "syncStrategy", "(", "node", ",", "oAggregation", ",", "mAggregations", ")", "{", "var", "childNode", ",", "vChild", ",", "aChildren", "=", "[", "]", ";", "for", "(", "childNode", "=", "node", ".", "firstChild", ";", "childNode", ";", "childNode", "=", "childNode", ".", "nextSibling", ")", "{", "vChild", "=", "fnCallback", "(", "node", ",", "oAggregation", ",", "mAggregations", ",", "childNode", ")", ";", "if", "(", "vChild", ")", "{", "aChildren", ".", "push", "(", "unwrapSyncPromise", "(", "vChild", ")", ")", ";", "}", "}", "return", "SyncPromise", ".", "resolve", "(", "aChildren", ")", ";", "}", "// async strategy ensures processing order by chaining the callbacks", "function", "asyncStrategy", "(", "node", ",", "oAggregation", ",", "mAggregations", ")", "{", "var", "childNode", ",", "pChain", "=", "Promise", ".", "resolve", "(", ")", ",", "aChildPromises", "=", "[", "]", ";", "for", "(", "childNode", "=", "node", ".", "firstChild", ";", "childNode", ";", "childNode", "=", "childNode", ".", "nextSibling", ")", "{", "pChain", "=", "pChain", ".", "then", "(", "fnCallback", ".", "bind", "(", "null", ",", "node", ",", "oAggregation", ",", "mAggregations", ",", "childNode", ")", ")", ";", "aChildPromises", ".", "push", "(", "pChain", ")", ";", "}", "return", "Promise", ".", "all", "(", "aChildPromises", ")", ";", "}", "return", "bAsync", "?", "asyncStrategy", ":", "syncStrategy", ";", "}" ]
Creates a function based on the passed mode and callback which applies a callback to each child of a node. @param {boolean} bAsync The strategy to choose @param {function} fnCallback The callback to apply @returns {function} The created function @private
[ "Creates", "a", "function", "based", "on", "the", "passed", "mode", "and", "callback", "which", "applies", "a", "callback", "to", "each", "child", "of", "a", "node", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/XMLTemplateProcessor.js#L98-L129
4,145
SAP/openui5
src/sap.ui.core/src/sap/ui/core/XMLTemplateProcessor.js
syncStrategy
function syncStrategy(node, oAggregation, mAggregations) { var childNode, vChild, aChildren = []; for (childNode = node.firstChild; childNode; childNode = childNode.nextSibling) { vChild = fnCallback(node, oAggregation, mAggregations, childNode); if (vChild) { aChildren.push(unwrapSyncPromise(vChild)); } } return SyncPromise.resolve(aChildren); }
javascript
function syncStrategy(node, oAggregation, mAggregations) { var childNode, vChild, aChildren = []; for (childNode = node.firstChild; childNode; childNode = childNode.nextSibling) { vChild = fnCallback(node, oAggregation, mAggregations, childNode); if (vChild) { aChildren.push(unwrapSyncPromise(vChild)); } } return SyncPromise.resolve(aChildren); }
[ "function", "syncStrategy", "(", "node", ",", "oAggregation", ",", "mAggregations", ")", "{", "var", "childNode", ",", "vChild", ",", "aChildren", "=", "[", "]", ";", "for", "(", "childNode", "=", "node", ".", "firstChild", ";", "childNode", ";", "childNode", "=", "childNode", ".", "nextSibling", ")", "{", "vChild", "=", "fnCallback", "(", "node", ",", "oAggregation", ",", "mAggregations", ",", "childNode", ")", ";", "if", "(", "vChild", ")", "{", "aChildren", ".", "push", "(", "unwrapSyncPromise", "(", "vChild", ")", ")", ";", "}", "}", "return", "SyncPromise", ".", "resolve", "(", "aChildren", ")", ";", "}" ]
sync strategy ensures processing order by just being sync
[ "sync", "strategy", "ensures", "processing", "order", "by", "just", "being", "sync" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/XMLTemplateProcessor.js#L101-L113
4,146
SAP/openui5
src/sap.ui.core/src/sap/ui/core/XMLTemplateProcessor.js
asyncStrategy
function asyncStrategy(node, oAggregation, mAggregations) { var childNode, pChain = Promise.resolve(), aChildPromises = []; for (childNode = node.firstChild; childNode; childNode = childNode.nextSibling) { pChain = pChain.then(fnCallback.bind(null, node, oAggregation, mAggregations, childNode)); aChildPromises.push(pChain); } return Promise.all(aChildPromises); }
javascript
function asyncStrategy(node, oAggregation, mAggregations) { var childNode, pChain = Promise.resolve(), aChildPromises = []; for (childNode = node.firstChild; childNode; childNode = childNode.nextSibling) { pChain = pChain.then(fnCallback.bind(null, node, oAggregation, mAggregations, childNode)); aChildPromises.push(pChain); } return Promise.all(aChildPromises); }
[ "function", "asyncStrategy", "(", "node", ",", "oAggregation", ",", "mAggregations", ")", "{", "var", "childNode", ",", "pChain", "=", "Promise", ".", "resolve", "(", ")", ",", "aChildPromises", "=", "[", "]", ";", "for", "(", "childNode", "=", "node", ".", "firstChild", ";", "childNode", ";", "childNode", "=", "childNode", ".", "nextSibling", ")", "{", "pChain", "=", "pChain", ".", "then", "(", "fnCallback", ".", "bind", "(", "null", ",", "node", ",", "oAggregation", ",", "mAggregations", ",", "childNode", ")", ")", ";", "aChildPromises", ".", "push", "(", "pChain", ")", ";", "}", "return", "Promise", ".", "all", "(", "aChildPromises", ")", ";", "}" ]
async strategy ensures processing order by chaining the callbacks
[ "async", "strategy", "ensures", "processing", "order", "by", "chaining", "the", "callbacks" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/XMLTemplateProcessor.js#L116-L126
4,147
SAP/openui5
src/sap.ui.core/src/sap/ui/core/XMLTemplateProcessor.js
spliceContentIntoResult
function spliceContentIntoResult(vContent) { // equivalent to aResult.apply(start, deleteCount, content1, content2...) var args = [i, 1].concat(vContent); Array.prototype.splice.apply(aResult, args); }
javascript
function spliceContentIntoResult(vContent) { // equivalent to aResult.apply(start, deleteCount, content1, content2...) var args = [i, 1].concat(vContent); Array.prototype.splice.apply(aResult, args); }
[ "function", "spliceContentIntoResult", "(", "vContent", ")", "{", "// equivalent to aResult.apply(start, deleteCount, content1, content2...)", "var", "args", "=", "[", "i", ",", "1", "]", ".", "concat", "(", "vContent", ")", ";", "Array", ".", "prototype", ".", "splice", ".", "apply", "(", "aResult", ",", "args", ")", ";", "}" ]
replace the Promise with a variable number of contents in aResult
[ "replace", "the", "Promise", "with", "a", "variable", "number", "of", "contents", "in", "aResult" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/XMLTemplateProcessor.js#L336-L340
4,148
SAP/openui5
src/sap.ui.core/src/sap/ui/core/XMLTemplateProcessor.js
parseNode
function parseNode(xmlNode, bRoot, bIgnoreTopLevelTextNodes) { if ( xmlNode.nodeType === 1 /* ELEMENT_NODE */ ) { var sLocalName = localName(xmlNode); if (xmlNode.namespaceURI === "http://www.w3.org/1999/xhtml" || xmlNode.namespaceURI === "http://www.w3.org/2000/svg") { // write opening tag aResult.push("<" + sLocalName + " "); // write attributes var bHasId = false; for (var i = 0; i < xmlNode.attributes.length; i++) { var attr = xmlNode.attributes[i]; var value = attr.value; if (attr.name === "id") { bHasId = true; value = getId(oView, xmlNode); } aResult.push(attr.name + "=\"" + encodeXML(value) + "\" "); } if ( bRoot === true ) { aResult.push("data-sap-ui-preserve" + "=\"" + oView.getId() + "\" "); if (!bHasId) { aResult.push("id" + "=\"" + oView.getId() + "\" "); } } aResult.push(">"); // write children var oContent = xmlNode; if (window.HTMLTemplateElement && xmlNode instanceof HTMLTemplateElement && xmlNode.content instanceof DocumentFragment) { // <template> support (HTMLTemplateElement has no childNodes, but a content node which contains the childNodes) oContent = xmlNode.content; } parseChildren(oContent); aResult.push("</" + sLocalName + ">"); } else if (sLocalName === "FragmentDefinition" && xmlNode.namespaceURI === "sap.ui.core") { // a Fragment element - which is not turned into a control itself. Only its content is parsed. parseChildren(xmlNode, false, true); // TODO: check if this branch is required or can be handled by the below one } else { // assumption: an ELEMENT_NODE with non-XHTML namespace is an SAPUI5 control and the namespace equals the library name pResultChain = pResultChain.then(function() { // Chaining the Promises as we need to make sure the order in which the XML DOM nodes are processed is fixed (depth-first, pre-order). // The order of processing (and Promise resolution) is mandatory for keeping the order of the UI5 Controls' aggregation fixed and compatible. return createControlOrExtension(xmlNode).then(function(aChildControls) { for (var i = 0; i < aChildControls.length; i++) { var oChild = aChildControls[i]; if (oView.getMetadata().hasAggregation("content")) { oView.addAggregation("content", oChild); // can oView really have an association called "content"? } else if (oView.getMetadata().hasAssociation(("content"))) { oView.addAssociation("content", oChild); } } return aChildControls; }); }); aResult.push(pResultChain); } } else if (xmlNode.nodeType === 3 /* TEXT_NODE */ && !bIgnoreTopLevelTextNodes) { var text = xmlNode.textContent || xmlNode.text, parentName = localName(xmlNode.parentNode); if (text) { if (parentName != "style") { text = encodeXML(text); } aResult.push(text); } } }
javascript
function parseNode(xmlNode, bRoot, bIgnoreTopLevelTextNodes) { if ( xmlNode.nodeType === 1 /* ELEMENT_NODE */ ) { var sLocalName = localName(xmlNode); if (xmlNode.namespaceURI === "http://www.w3.org/1999/xhtml" || xmlNode.namespaceURI === "http://www.w3.org/2000/svg") { // write opening tag aResult.push("<" + sLocalName + " "); // write attributes var bHasId = false; for (var i = 0; i < xmlNode.attributes.length; i++) { var attr = xmlNode.attributes[i]; var value = attr.value; if (attr.name === "id") { bHasId = true; value = getId(oView, xmlNode); } aResult.push(attr.name + "=\"" + encodeXML(value) + "\" "); } if ( bRoot === true ) { aResult.push("data-sap-ui-preserve" + "=\"" + oView.getId() + "\" "); if (!bHasId) { aResult.push("id" + "=\"" + oView.getId() + "\" "); } } aResult.push(">"); // write children var oContent = xmlNode; if (window.HTMLTemplateElement && xmlNode instanceof HTMLTemplateElement && xmlNode.content instanceof DocumentFragment) { // <template> support (HTMLTemplateElement has no childNodes, but a content node which contains the childNodes) oContent = xmlNode.content; } parseChildren(oContent); aResult.push("</" + sLocalName + ">"); } else if (sLocalName === "FragmentDefinition" && xmlNode.namespaceURI === "sap.ui.core") { // a Fragment element - which is not turned into a control itself. Only its content is parsed. parseChildren(xmlNode, false, true); // TODO: check if this branch is required or can be handled by the below one } else { // assumption: an ELEMENT_NODE with non-XHTML namespace is an SAPUI5 control and the namespace equals the library name pResultChain = pResultChain.then(function() { // Chaining the Promises as we need to make sure the order in which the XML DOM nodes are processed is fixed (depth-first, pre-order). // The order of processing (and Promise resolution) is mandatory for keeping the order of the UI5 Controls' aggregation fixed and compatible. return createControlOrExtension(xmlNode).then(function(aChildControls) { for (var i = 0; i < aChildControls.length; i++) { var oChild = aChildControls[i]; if (oView.getMetadata().hasAggregation("content")) { oView.addAggregation("content", oChild); // can oView really have an association called "content"? } else if (oView.getMetadata().hasAssociation(("content"))) { oView.addAssociation("content", oChild); } } return aChildControls; }); }); aResult.push(pResultChain); } } else if (xmlNode.nodeType === 3 /* TEXT_NODE */ && !bIgnoreTopLevelTextNodes) { var text = xmlNode.textContent || xmlNode.text, parentName = localName(xmlNode.parentNode); if (text) { if (parentName != "style") { text = encodeXML(text); } aResult.push(text); } } }
[ "function", "parseNode", "(", "xmlNode", ",", "bRoot", ",", "bIgnoreTopLevelTextNodes", ")", "{", "if", "(", "xmlNode", ".", "nodeType", "===", "1", "/* ELEMENT_NODE */", ")", "{", "var", "sLocalName", "=", "localName", "(", "xmlNode", ")", ";", "if", "(", "xmlNode", ".", "namespaceURI", "===", "\"http://www.w3.org/1999/xhtml\"", "||", "xmlNode", ".", "namespaceURI", "===", "\"http://www.w3.org/2000/svg\"", ")", "{", "// write opening tag", "aResult", ".", "push", "(", "\"<\"", "+", "sLocalName", "+", "\" \"", ")", ";", "// write attributes", "var", "bHasId", "=", "false", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "xmlNode", ".", "attributes", ".", "length", ";", "i", "++", ")", "{", "var", "attr", "=", "xmlNode", ".", "attributes", "[", "i", "]", ";", "var", "value", "=", "attr", ".", "value", ";", "if", "(", "attr", ".", "name", "===", "\"id\"", ")", "{", "bHasId", "=", "true", ";", "value", "=", "getId", "(", "oView", ",", "xmlNode", ")", ";", "}", "aResult", ".", "push", "(", "attr", ".", "name", "+", "\"=\\\"\"", "+", "encodeXML", "(", "value", ")", "+", "\"\\\" \"", ")", ";", "}", "if", "(", "bRoot", "===", "true", ")", "{", "aResult", ".", "push", "(", "\"data-sap-ui-preserve\"", "+", "\"=\\\"\"", "+", "oView", ".", "getId", "(", ")", "+", "\"\\\" \"", ")", ";", "if", "(", "!", "bHasId", ")", "{", "aResult", ".", "push", "(", "\"id\"", "+", "\"=\\\"\"", "+", "oView", ".", "getId", "(", ")", "+", "\"\\\" \"", ")", ";", "}", "}", "aResult", ".", "push", "(", "\">\"", ")", ";", "// write children", "var", "oContent", "=", "xmlNode", ";", "if", "(", "window", ".", "HTMLTemplateElement", "&&", "xmlNode", "instanceof", "HTMLTemplateElement", "&&", "xmlNode", ".", "content", "instanceof", "DocumentFragment", ")", "{", "// <template> support (HTMLTemplateElement has no childNodes, but a content node which contains the childNodes)", "oContent", "=", "xmlNode", ".", "content", ";", "}", "parseChildren", "(", "oContent", ")", ";", "aResult", ".", "push", "(", "\"</\"", "+", "sLocalName", "+", "\">\"", ")", ";", "}", "else", "if", "(", "sLocalName", "===", "\"FragmentDefinition\"", "&&", "xmlNode", ".", "namespaceURI", "===", "\"sap.ui.core\"", ")", "{", "// a Fragment element - which is not turned into a control itself. Only its content is parsed.", "parseChildren", "(", "xmlNode", ",", "false", ",", "true", ")", ";", "// TODO: check if this branch is required or can be handled by the below one", "}", "else", "{", "// assumption: an ELEMENT_NODE with non-XHTML namespace is an SAPUI5 control and the namespace equals the library name", "pResultChain", "=", "pResultChain", ".", "then", "(", "function", "(", ")", "{", "// Chaining the Promises as we need to make sure the order in which the XML DOM nodes are processed is fixed (depth-first, pre-order).", "// The order of processing (and Promise resolution) is mandatory for keeping the order of the UI5 Controls' aggregation fixed and compatible.", "return", "createControlOrExtension", "(", "xmlNode", ")", ".", "then", "(", "function", "(", "aChildControls", ")", "{", "for", "(", "var", "i", "=", "0", ";", "i", "<", "aChildControls", ".", "length", ";", "i", "++", ")", "{", "var", "oChild", "=", "aChildControls", "[", "i", "]", ";", "if", "(", "oView", ".", "getMetadata", "(", ")", ".", "hasAggregation", "(", "\"content\"", ")", ")", "{", "oView", ".", "addAggregation", "(", "\"content\"", ",", "oChild", ")", ";", "// can oView really have an association called \"content\"?", "}", "else", "if", "(", "oView", ".", "getMetadata", "(", ")", ".", "hasAssociation", "(", "(", "\"content\"", ")", ")", ")", "{", "oView", ".", "addAssociation", "(", "\"content\"", ",", "oChild", ")", ";", "}", "}", "return", "aChildControls", ";", "}", ")", ";", "}", ")", ";", "aResult", ".", "push", "(", "pResultChain", ")", ";", "}", "}", "else", "if", "(", "xmlNode", ".", "nodeType", "===", "3", "/* TEXT_NODE */", "&&", "!", "bIgnoreTopLevelTextNodes", ")", "{", "var", "text", "=", "xmlNode", ".", "textContent", "||", "xmlNode", ".", "text", ",", "parentName", "=", "localName", "(", "xmlNode", ".", "parentNode", ")", ";", "if", "(", "text", ")", "{", "if", "(", "parentName", "!=", "\"style\"", ")", "{", "text", "=", "encodeXML", "(", "text", ")", ";", "}", "aResult", ".", "push", "(", "text", ")", ";", "}", "}", "}" ]
Parses an XML node that might represent a UI5 control or simple XHTML. XHTML will be added to the aResult array as a sequence of strings, UI5 controls will be instantiated and added as controls @param {Element} xmlNode the XML node to parse @param {boolean} bRoot whether this node is the root node @param {boolean} bIgnoreTopLevelTextNodes @returns {Promise} resolving with the content of the parsed node, which is a tree structure containing DOM Strings & UI5 Controls
[ "Parses", "an", "XML", "node", "that", "might", "represent", "a", "UI5", "control", "or", "simple", "XHTML", ".", "XHTML", "will", "be", "added", "to", "the", "aResult", "array", "as", "a", "sequence", "of", "strings", "UI5", "controls", "will", "be", "instantiated", "and", "added", "as", "controls" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/XMLTemplateProcessor.js#L366-L444
4,149
SAP/openui5
src/sap.ui.core/src/sap/ui/core/XMLTemplateProcessor.js
parseChildren
function parseChildren(xmlNode, bRoot, bIgnoreToplevelTextNodes) { var children = xmlNode.childNodes; for (var i = 0; i < children.length; i++) { parseNode(children[i], bRoot, bIgnoreToplevelTextNodes); } }
javascript
function parseChildren(xmlNode, bRoot, bIgnoreToplevelTextNodes) { var children = xmlNode.childNodes; for (var i = 0; i < children.length; i++) { parseNode(children[i], bRoot, bIgnoreToplevelTextNodes); } }
[ "function", "parseChildren", "(", "xmlNode", ",", "bRoot", ",", "bIgnoreToplevelTextNodes", ")", "{", "var", "children", "=", "xmlNode", ".", "childNodes", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "children", ".", "length", ";", "i", "++", ")", "{", "parseNode", "(", "children", "[", "i", "]", ",", "bRoot", ",", "bIgnoreToplevelTextNodes", ")", ";", "}", "}" ]
Parses the children of an XML node. @param {Element} xmlNode the xml node which will be parsed @param {boolean} bRoot @param {boolean} bIgnoreToplevelTextNodes @returns {Promise[]} each resolving to the according child nodes content
[ "Parses", "the", "children", "of", "an", "XML", "node", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/XMLTemplateProcessor.js#L454-L459
4,150
SAP/openui5
src/sap.ui.core/src/sap/ui/core/XMLTemplateProcessor.js
findControlClass
function findControlClass(sNamespaceURI, sLocalName) { var sClassName; var mLibraries = sap.ui.getCore().getLoadedLibraries(); jQuery.each(mLibraries, function(sLibName, oLibrary) { if ( sNamespaceURI === oLibrary.namespace || sNamespaceURI === oLibrary.name ) { sClassName = oLibrary.name + "." + ((oLibrary.tagNames && oLibrary.tagNames[sLocalName]) || sLocalName); } }); // TODO guess library from sNamespaceURI and load corresponding lib!? sClassName = sClassName || sNamespaceURI + "." + sLocalName; // ensure that control and library are loaded function getObjectFallback(oClassObject) { // some modules might not return a class definition, so we fallback to the global // this is against the AMD definition, but is required for backward compatibility if (!oClassObject) { Log.error("Control '" + sClassName + "' did not return a class definition from sap.ui.define.", "", "XMLTemplateProcessor"); oClassObject = ObjectPath.get(sClassName); } if (!oClassObject) { Log.error("Can't find object class '" + sClassName + "' for XML-view", "", "XMLTemplateProcessor"); } return oClassObject; } var sResourceName = sClassName.replace(/\./g, "/"); var oClassObject = sap.ui.require(sResourceName); if (!oClassObject) { if (bAsync) { return new Promise(function(resolve) { sap.ui.require([sResourceName], function(oClassObject) { oClassObject = getObjectFallback(oClassObject); resolve(oClassObject); }); }); } else { oClassObject = sap.ui.requireSync(sResourceName); oClassObject = getObjectFallback(oClassObject); } } return oClassObject; }
javascript
function findControlClass(sNamespaceURI, sLocalName) { var sClassName; var mLibraries = sap.ui.getCore().getLoadedLibraries(); jQuery.each(mLibraries, function(sLibName, oLibrary) { if ( sNamespaceURI === oLibrary.namespace || sNamespaceURI === oLibrary.name ) { sClassName = oLibrary.name + "." + ((oLibrary.tagNames && oLibrary.tagNames[sLocalName]) || sLocalName); } }); // TODO guess library from sNamespaceURI and load corresponding lib!? sClassName = sClassName || sNamespaceURI + "." + sLocalName; // ensure that control and library are loaded function getObjectFallback(oClassObject) { // some modules might not return a class definition, so we fallback to the global // this is against the AMD definition, but is required for backward compatibility if (!oClassObject) { Log.error("Control '" + sClassName + "' did not return a class definition from sap.ui.define.", "", "XMLTemplateProcessor"); oClassObject = ObjectPath.get(sClassName); } if (!oClassObject) { Log.error("Can't find object class '" + sClassName + "' for XML-view", "", "XMLTemplateProcessor"); } return oClassObject; } var sResourceName = sClassName.replace(/\./g, "/"); var oClassObject = sap.ui.require(sResourceName); if (!oClassObject) { if (bAsync) { return new Promise(function(resolve) { sap.ui.require([sResourceName], function(oClassObject) { oClassObject = getObjectFallback(oClassObject); resolve(oClassObject); }); }); } else { oClassObject = sap.ui.requireSync(sResourceName); oClassObject = getObjectFallback(oClassObject); } } return oClassObject; }
[ "function", "findControlClass", "(", "sNamespaceURI", ",", "sLocalName", ")", "{", "var", "sClassName", ";", "var", "mLibraries", "=", "sap", ".", "ui", ".", "getCore", "(", ")", ".", "getLoadedLibraries", "(", ")", ";", "jQuery", ".", "each", "(", "mLibraries", ",", "function", "(", "sLibName", ",", "oLibrary", ")", "{", "if", "(", "sNamespaceURI", "===", "oLibrary", ".", "namespace", "||", "sNamespaceURI", "===", "oLibrary", ".", "name", ")", "{", "sClassName", "=", "oLibrary", ".", "name", "+", "\".\"", "+", "(", "(", "oLibrary", ".", "tagNames", "&&", "oLibrary", ".", "tagNames", "[", "sLocalName", "]", ")", "||", "sLocalName", ")", ";", "}", "}", ")", ";", "// TODO guess library from sNamespaceURI and load corresponding lib!?", "sClassName", "=", "sClassName", "||", "sNamespaceURI", "+", "\".\"", "+", "sLocalName", ";", "// ensure that control and library are loaded", "function", "getObjectFallback", "(", "oClassObject", ")", "{", "// some modules might not return a class definition, so we fallback to the global", "// this is against the AMD definition, but is required for backward compatibility", "if", "(", "!", "oClassObject", ")", "{", "Log", ".", "error", "(", "\"Control '\"", "+", "sClassName", "+", "\"' did not return a class definition from sap.ui.define.\"", ",", "\"\"", ",", "\"XMLTemplateProcessor\"", ")", ";", "oClassObject", "=", "ObjectPath", ".", "get", "(", "sClassName", ")", ";", "}", "if", "(", "!", "oClassObject", ")", "{", "Log", ".", "error", "(", "\"Can't find object class '\"", "+", "sClassName", "+", "\"' for XML-view\"", ",", "\"\"", ",", "\"XMLTemplateProcessor\"", ")", ";", "}", "return", "oClassObject", ";", "}", "var", "sResourceName", "=", "sClassName", ".", "replace", "(", "/", "\\.", "/", "g", ",", "\"/\"", ")", ";", "var", "oClassObject", "=", "sap", ".", "ui", ".", "require", "(", "sResourceName", ")", ";", "if", "(", "!", "oClassObject", ")", "{", "if", "(", "bAsync", ")", "{", "return", "new", "Promise", "(", "function", "(", "resolve", ")", "{", "sap", ".", "ui", ".", "require", "(", "[", "sResourceName", "]", ",", "function", "(", "oClassObject", ")", "{", "oClassObject", "=", "getObjectFallback", "(", "oClassObject", ")", ";", "resolve", "(", "oClassObject", ")", ";", "}", ")", ";", "}", ")", ";", "}", "else", "{", "oClassObject", "=", "sap", ".", "ui", ".", "requireSync", "(", "sResourceName", ")", ";", "oClassObject", "=", "getObjectFallback", "(", "oClassObject", ")", ";", "}", "}", "return", "oClassObject", ";", "}" ]
Requests the control class if not loaded yet. If the View is set to async=true, an async XHR is sent, otherwise a sync XHR. @param {string} sNamespaceURI @param {string} sLocalName @returns {function|Promise|undefined} the loaded ControlClass plain or resolved from a Promise
[ "Requests", "the", "control", "class", "if", "not", "loaded", "yet", ".", "If", "the", "View", "is", "set", "to", "async", "=", "true", "an", "async", "XHR", "is", "sent", "otherwise", "a", "sync", "XHR", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/XMLTemplateProcessor.js#L469-L510
4,151
SAP/openui5
src/sap.ui.core/src/sap/ui/core/XMLTemplateProcessor.js
getObjectFallback
function getObjectFallback(oClassObject) { // some modules might not return a class definition, so we fallback to the global // this is against the AMD definition, but is required for backward compatibility if (!oClassObject) { Log.error("Control '" + sClassName + "' did not return a class definition from sap.ui.define.", "", "XMLTemplateProcessor"); oClassObject = ObjectPath.get(sClassName); } if (!oClassObject) { Log.error("Can't find object class '" + sClassName + "' for XML-view", "", "XMLTemplateProcessor"); } return oClassObject; }
javascript
function getObjectFallback(oClassObject) { // some modules might not return a class definition, so we fallback to the global // this is against the AMD definition, but is required for backward compatibility if (!oClassObject) { Log.error("Control '" + sClassName + "' did not return a class definition from sap.ui.define.", "", "XMLTemplateProcessor"); oClassObject = ObjectPath.get(sClassName); } if (!oClassObject) { Log.error("Can't find object class '" + sClassName + "' for XML-view", "", "XMLTemplateProcessor"); } return oClassObject; }
[ "function", "getObjectFallback", "(", "oClassObject", ")", "{", "// some modules might not return a class definition, so we fallback to the global", "// this is against the AMD definition, but is required for backward compatibility", "if", "(", "!", "oClassObject", ")", "{", "Log", ".", "error", "(", "\"Control '\"", "+", "sClassName", "+", "\"' did not return a class definition from sap.ui.define.\"", ",", "\"\"", ",", "\"XMLTemplateProcessor\"", ")", ";", "oClassObject", "=", "ObjectPath", ".", "get", "(", "sClassName", ")", ";", "}", "if", "(", "!", "oClassObject", ")", "{", "Log", ".", "error", "(", "\"Can't find object class '\"", "+", "sClassName", "+", "\"' for XML-view\"", ",", "\"\"", ",", "\"XMLTemplateProcessor\"", ")", ";", "}", "return", "oClassObject", ";", "}" ]
ensure that control and library are loaded
[ "ensure", "that", "control", "and", "library", "are", "loaded" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/XMLTemplateProcessor.js#L481-L492
4,152
SAP/openui5
src/sap.ui.core/src/sap/ui/core/XMLTemplateProcessor.js
function (oViewClass) { var mViewParameters = { id: id ? getId(oView, node, id) : undefined, xmlNode: node, containingView: oView._oContainingView, processingMode: oView._sProcessingMode // add processing mode, so it can be propagated to subviews inside the HTML block }; // running with owner component if (oView.fnScopedRunWithOwner) { return oView.fnScopedRunWithOwner(function () { return new oViewClass(mViewParameters); }); } // no owner component // (or fully sync path, which handles the owner propagation on a higher level) return new oViewClass(mViewParameters); }
javascript
function (oViewClass) { var mViewParameters = { id: id ? getId(oView, node, id) : undefined, xmlNode: node, containingView: oView._oContainingView, processingMode: oView._sProcessingMode // add processing mode, so it can be propagated to subviews inside the HTML block }; // running with owner component if (oView.fnScopedRunWithOwner) { return oView.fnScopedRunWithOwner(function () { return new oViewClass(mViewParameters); }); } // no owner component // (or fully sync path, which handles the owner propagation on a higher level) return new oViewClass(mViewParameters); }
[ "function", "(", "oViewClass", ")", "{", "var", "mViewParameters", "=", "{", "id", ":", "id", "?", "getId", "(", "oView", ",", "node", ",", "id", ")", ":", "undefined", ",", "xmlNode", ":", "node", ",", "containingView", ":", "oView", ".", "_oContainingView", ",", "processingMode", ":", "oView", ".", "_sProcessingMode", "// add processing mode, so it can be propagated to subviews inside the HTML block", "}", ";", "// running with owner component", "if", "(", "oView", ".", "fnScopedRunWithOwner", ")", "{", "return", "oView", ".", "fnScopedRunWithOwner", "(", "function", "(", ")", "{", "return", "new", "oViewClass", "(", "mViewParameters", ")", ";", "}", ")", ";", "}", "// no owner component", "// (or fully sync path, which handles the owner propagation on a higher level)", "return", "new", "oViewClass", "(", "mViewParameters", ")", ";", "}" ]
plain HTML node - create a new View control creates a view instance, but makes sure the new view receives the correct owner component
[ "plain", "HTML", "node", "-", "create", "a", "new", "View", "control", "creates", "a", "view", "instance", "but", "makes", "sure", "the", "new", "view", "receives", "the", "correct", "owner", "component" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/XMLTemplateProcessor.js#L532-L548
4,153
SAP/openui5
src/sap.ui.core/src/sap/ui/core/XMLTemplateProcessor.js
function() { // Pass processingMode to Fragments only if (oClass.getMetadata().isA("sap.ui.core.Fragment") && node.getAttribute("type") !== "JS" && oView._sProcessingMode === "sequential") { mSettings.processingMode = "sequential"; } if (oView.fnScopedRunWithOwner) { return oView.fnScopedRunWithOwner(function() { return new oClass(mSettings); }); } else { return new oClass(mSettings); } }
javascript
function() { // Pass processingMode to Fragments only if (oClass.getMetadata().isA("sap.ui.core.Fragment") && node.getAttribute("type") !== "JS" && oView._sProcessingMode === "sequential") { mSettings.processingMode = "sequential"; } if (oView.fnScopedRunWithOwner) { return oView.fnScopedRunWithOwner(function() { return new oClass(mSettings); }); } else { return new oClass(mSettings); } }
[ "function", "(", ")", "{", "// Pass processingMode to Fragments only", "if", "(", "oClass", ".", "getMetadata", "(", ")", ".", "isA", "(", "\"sap.ui.core.Fragment\"", ")", "&&", "node", ".", "getAttribute", "(", "\"type\"", ")", "!==", "\"JS\"", "&&", "oView", ".", "_sProcessingMode", "===", "\"sequential\"", ")", "{", "mSettings", ".", "processingMode", "=", "\"sequential\"", ";", "}", "if", "(", "oView", ".", "fnScopedRunWithOwner", ")", "{", "return", "oView", ".", "fnScopedRunWithOwner", "(", "function", "(", ")", "{", "return", "new", "oClass", "(", "mSettings", ")", ";", "}", ")", ";", "}", "else", "{", "return", "new", "oClass", "(", "mSettings", ")", ";", "}", "}" ]
call the control constructor with the according owner in scope
[ "call", "the", "control", "constructor", "with", "the", "according", "owner", "in", "scope" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/XMLTemplateProcessor.js#L927-L939
4,154
SAP/openui5
src/sap.ui.core/src/sap/ui/base/BindingParser.js
makeFormatter
function makeFormatter(aFragments) { var fnFormatter = function() { var aResult = [], l = aFragments.length, i; for (i = 0; i < l; i++) { if ( typeof aFragments[i] === "number" ) { // a numerical fragment references the part with the same number aResult.push(arguments[aFragments[i]]); } else { // anything else is a string fragment aResult.push(aFragments[i]); } } return aResult.join(''); }; fnFormatter.textFragments = aFragments; return fnFormatter; }
javascript
function makeFormatter(aFragments) { var fnFormatter = function() { var aResult = [], l = aFragments.length, i; for (i = 0; i < l; i++) { if ( typeof aFragments[i] === "number" ) { // a numerical fragment references the part with the same number aResult.push(arguments[aFragments[i]]); } else { // anything else is a string fragment aResult.push(aFragments[i]); } } return aResult.join(''); }; fnFormatter.textFragments = aFragments; return fnFormatter; }
[ "function", "makeFormatter", "(", "aFragments", ")", "{", "var", "fnFormatter", "=", "function", "(", ")", "{", "var", "aResult", "=", "[", "]", ",", "l", "=", "aFragments", ".", "length", ",", "i", ";", "for", "(", "i", "=", "0", ";", "i", "<", "l", ";", "i", "++", ")", "{", "if", "(", "typeof", "aFragments", "[", "i", "]", "===", "\"number\"", ")", "{", "// a numerical fragment references the part with the same number", "aResult", ".", "push", "(", "arguments", "[", "aFragments", "[", "i", "]", "]", ")", ";", "}", "else", "{", "// anything else is a string fragment", "aResult", ".", "push", "(", "aFragments", "[", "i", "]", ")", ";", "}", "}", "return", "aResult", ".", "join", "(", "''", ")", ";", "}", ";", "fnFormatter", ".", "textFragments", "=", "aFragments", ";", "return", "fnFormatter", ";", "}" ]
Helper to create a formatter function. Only used to reduce the closure size of the formatter @param {number[]|string[]} aFragments array of fragments, either a literal text or the index of the binding's part @returns {function} a formatter function
[ "Helper", "to", "create", "a", "formatter", "function", ".", "Only", "used", "to", "reduce", "the", "closure", "size", "of", "the", "formatter" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/base/BindingParser.js#L94-L113
4,155
SAP/openui5
src/sap.ui.core/src/sap/ui/base/BindingParser.js
makeSimpleBindingInfo
function makeSimpleBindingInfo(sPath) { var iPos = sPath.indexOf(">"), oBindingInfo = { path : sPath }; if ( iPos > 0 ) { oBindingInfo.model = sPath.slice(0,iPos); oBindingInfo.path = sPath.slice(iPos + 1); } return oBindingInfo; }
javascript
function makeSimpleBindingInfo(sPath) { var iPos = sPath.indexOf(">"), oBindingInfo = { path : sPath }; if ( iPos > 0 ) { oBindingInfo.model = sPath.slice(0,iPos); oBindingInfo.path = sPath.slice(iPos + 1); } return oBindingInfo; }
[ "function", "makeSimpleBindingInfo", "(", "sPath", ")", "{", "var", "iPos", "=", "sPath", ".", "indexOf", "(", "\">\"", ")", ",", "oBindingInfo", "=", "{", "path", ":", "sPath", "}", ";", "if", "(", "iPos", ">", "0", ")", "{", "oBindingInfo", ".", "model", "=", "sPath", ".", "slice", "(", "0", ",", "iPos", ")", ";", "oBindingInfo", ".", "path", "=", "sPath", ".", "slice", "(", "iPos", "+", "1", ")", ";", "}", "return", "oBindingInfo", ";", "}" ]
Creates a binding info object with the given path. If the path contains a model specifier (prefix separated with a '>'), the <code>model</code> property is set as well and the prefix is removed from the path. @param {string} sPath the given path @returns {object} a binding info object
[ "Creates", "a", "binding", "info", "object", "with", "the", "given", "path", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/base/BindingParser.js#L127-L137
4,156
SAP/openui5
src/sap.ui.core/src/sap/ui/base/BindingParser.js
expression
function expression(sInput, iStart, oBindingMode) { var oBinding = ExpressionParser.parse(resolveEmbeddedBinding.bind(null, oEnv), sString, iStart, null, bStaticContext ? oContext : null); /** * Recursively sets the mode <code>oBindingMode</code> on the given binding (or its * parts). * * @param {object} oBinding * a binding which may be composite * @param {int} [iIndex] * index provided by <code>forEach</code> */ function setMode(oBinding, iIndex) { if (oBinding.parts) { oBinding.parts.forEach(function (vPart, i) { if (typeof vPart === "string") { vPart = oBinding.parts[i] = {path : vPart}; } setMode(vPart, i); }); b2ndLevelMergedNeeded = b2ndLevelMergedNeeded || iIndex !== undefined; } else { oBinding.mode = oBindingMode; } } if (sInput.charAt(oBinding.at) !== "}") { throw new SyntaxError("Expected '}' and instead saw '" + sInput.charAt(oBinding.at) + "' in expression binding " + sInput + " at position " + oBinding.at); } oBinding.at += 1; if (oBinding.result) { setMode(oBinding.result); } else { aFragments[aFragments.length - 1] = String(oBinding.constant); bUnescaped = true; } return oBinding; }
javascript
function expression(sInput, iStart, oBindingMode) { var oBinding = ExpressionParser.parse(resolveEmbeddedBinding.bind(null, oEnv), sString, iStart, null, bStaticContext ? oContext : null); /** * Recursively sets the mode <code>oBindingMode</code> on the given binding (or its * parts). * * @param {object} oBinding * a binding which may be composite * @param {int} [iIndex] * index provided by <code>forEach</code> */ function setMode(oBinding, iIndex) { if (oBinding.parts) { oBinding.parts.forEach(function (vPart, i) { if (typeof vPart === "string") { vPart = oBinding.parts[i] = {path : vPart}; } setMode(vPart, i); }); b2ndLevelMergedNeeded = b2ndLevelMergedNeeded || iIndex !== undefined; } else { oBinding.mode = oBindingMode; } } if (sInput.charAt(oBinding.at) !== "}") { throw new SyntaxError("Expected '}' and instead saw '" + sInput.charAt(oBinding.at) + "' in expression binding " + sInput + " at position " + oBinding.at); } oBinding.at += 1; if (oBinding.result) { setMode(oBinding.result); } else { aFragments[aFragments.length - 1] = String(oBinding.constant); bUnescaped = true; } return oBinding; }
[ "function", "expression", "(", "sInput", ",", "iStart", ",", "oBindingMode", ")", "{", "var", "oBinding", "=", "ExpressionParser", ".", "parse", "(", "resolveEmbeddedBinding", ".", "bind", "(", "null", ",", "oEnv", ")", ",", "sString", ",", "iStart", ",", "null", ",", "bStaticContext", "?", "oContext", ":", "null", ")", ";", "/**\n\t\t\t * Recursively sets the mode <code>oBindingMode</code> on the given binding (or its\n\t\t\t * parts).\n\t\t\t *\n\t\t\t * @param {object} oBinding\n\t\t\t * a binding which may be composite\n\t\t\t * @param {int} [iIndex]\n\t\t\t * index provided by <code>forEach</code>\n\t\t\t */", "function", "setMode", "(", "oBinding", ",", "iIndex", ")", "{", "if", "(", "oBinding", ".", "parts", ")", "{", "oBinding", ".", "parts", ".", "forEach", "(", "function", "(", "vPart", ",", "i", ")", "{", "if", "(", "typeof", "vPart", "===", "\"string\"", ")", "{", "vPart", "=", "oBinding", ".", "parts", "[", "i", "]", "=", "{", "path", ":", "vPart", "}", ";", "}", "setMode", "(", "vPart", ",", "i", ")", ";", "}", ")", ";", "b2ndLevelMergedNeeded", "=", "b2ndLevelMergedNeeded", "||", "iIndex", "!==", "undefined", ";", "}", "else", "{", "oBinding", ".", "mode", "=", "oBindingMode", ";", "}", "}", "if", "(", "sInput", ".", "charAt", "(", "oBinding", ".", "at", ")", "!==", "\"}\"", ")", "{", "throw", "new", "SyntaxError", "(", "\"Expected '}' and instead saw '\"", "+", "sInput", ".", "charAt", "(", "oBinding", ".", "at", ")", "+", "\"' in expression binding \"", "+", "sInput", "+", "\" at position \"", "+", "oBinding", ".", "at", ")", ";", "}", "oBinding", ".", "at", "+=", "1", ";", "if", "(", "oBinding", ".", "result", ")", "{", "setMode", "(", "oBinding", ".", "result", ")", ";", "}", "else", "{", "aFragments", "[", "aFragments", ".", "length", "-", "1", "]", "=", "String", "(", "oBinding", ".", "constant", ")", ";", "bUnescaped", "=", "true", ";", "}", "return", "oBinding", ";", "}" ]
Parses an expression. Sets the flags accordingly. @param {string} sInput The input string to parse from @param {int} iStart The start index @param {sap.ui.model.BindingMode} oBindingMode the binding mode @returns {object} a result object with the binding in <code>result</code> and the index after the last character belonging to the expression in <code>at</code> @throws SyntaxError if the expression string is invalid
[ "Parses", "an", "expression", ".", "Sets", "the", "flags", "accordingly", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/base/BindingParser.js#L415-L458
4,157
SAP/openui5
src/sap.ui.core/src/sap/ui/model/odata/type/UnitMixin.js
formatValue
function formatValue(aValues, sTargetType) { var oFormatOptions, that = this; if (this.mCustomUnits === undefined && aValues && aValues[2] !== undefined) { if (aValues[2] === null) { // no unit customizing available this.mCustomUnits = null; } else { this.mCustomUnits = mCodeList2CustomUnits.get(aValues[2]); if (!this.mCustomUnits) { this.mCustomUnits = {}; Object.keys(aValues[2]).forEach(function (sKey) { that.mCustomUnits[sKey] = that.getCustomUnitForKey(aValues[2], sKey); }); mCodeList2CustomUnits.set(aValues[2], this.mCustomUnits); } oFormatOptions = {}; oFormatOptions[sFormatOptionName] = this.mCustomUnits; fnBaseType.prototype.setFormatOptions.call(this, Object.assign(oFormatOptions, this.oFormatOptions)); } } // composite binding calls formatValue several times, // where some parts are not yet available if (!aValues || aValues[0] === undefined || aValues[1] === undefined || this.mCustomUnits === undefined && aValues[2] === undefined) { return null; } return fnBaseType.prototype.formatValue.call(this, aValues.slice(0, 2), sTargetType); }
javascript
function formatValue(aValues, sTargetType) { var oFormatOptions, that = this; if (this.mCustomUnits === undefined && aValues && aValues[2] !== undefined) { if (aValues[2] === null) { // no unit customizing available this.mCustomUnits = null; } else { this.mCustomUnits = mCodeList2CustomUnits.get(aValues[2]); if (!this.mCustomUnits) { this.mCustomUnits = {}; Object.keys(aValues[2]).forEach(function (sKey) { that.mCustomUnits[sKey] = that.getCustomUnitForKey(aValues[2], sKey); }); mCodeList2CustomUnits.set(aValues[2], this.mCustomUnits); } oFormatOptions = {}; oFormatOptions[sFormatOptionName] = this.mCustomUnits; fnBaseType.prototype.setFormatOptions.call(this, Object.assign(oFormatOptions, this.oFormatOptions)); } } // composite binding calls formatValue several times, // where some parts are not yet available if (!aValues || aValues[0] === undefined || aValues[1] === undefined || this.mCustomUnits === undefined && aValues[2] === undefined) { return null; } return fnBaseType.prototype.formatValue.call(this, aValues.slice(0, 2), sTargetType); }
[ "function", "formatValue", "(", "aValues", ",", "sTargetType", ")", "{", "var", "oFormatOptions", ",", "that", "=", "this", ";", "if", "(", "this", ".", "mCustomUnits", "===", "undefined", "&&", "aValues", "&&", "aValues", "[", "2", "]", "!==", "undefined", ")", "{", "if", "(", "aValues", "[", "2", "]", "===", "null", ")", "{", "// no unit customizing available", "this", ".", "mCustomUnits", "=", "null", ";", "}", "else", "{", "this", ".", "mCustomUnits", "=", "mCodeList2CustomUnits", ".", "get", "(", "aValues", "[", "2", "]", ")", ";", "if", "(", "!", "this", ".", "mCustomUnits", ")", "{", "this", ".", "mCustomUnits", "=", "{", "}", ";", "Object", ".", "keys", "(", "aValues", "[", "2", "]", ")", ".", "forEach", "(", "function", "(", "sKey", ")", "{", "that", ".", "mCustomUnits", "[", "sKey", "]", "=", "that", ".", "getCustomUnitForKey", "(", "aValues", "[", "2", "]", ",", "sKey", ")", ";", "}", ")", ";", "mCodeList2CustomUnits", ".", "set", "(", "aValues", "[", "2", "]", ",", "this", ".", "mCustomUnits", ")", ";", "}", "oFormatOptions", "=", "{", "}", ";", "oFormatOptions", "[", "sFormatOptionName", "]", "=", "this", ".", "mCustomUnits", ";", "fnBaseType", ".", "prototype", ".", "setFormatOptions", ".", "call", "(", "this", ",", "Object", ".", "assign", "(", "oFormatOptions", ",", "this", ".", "oFormatOptions", ")", ")", ";", "}", "}", "// composite binding calls formatValue several times,", "// where some parts are not yet available", "if", "(", "!", "aValues", "||", "aValues", "[", "0", "]", "===", "undefined", "||", "aValues", "[", "1", "]", "===", "undefined", "||", "this", ".", "mCustomUnits", "===", "undefined", "&&", "aValues", "[", "2", "]", "===", "undefined", ")", "{", "return", "null", ";", "}", "return", "fnBaseType", ".", "prototype", ".", "formatValue", ".", "call", "(", "this", ",", "aValues", ".", "slice", "(", "0", ",", "2", ")", ",", "sTargetType", ")", ";", "}" ]
Formats the given values of the parts of the composite type to the given target type. @param {any[]} aValues Array of part values to be formatted; contains in the following order: Measure or amount, unit or currency, and the corresponding customizing. The first call to this method where all parts are set determines the customizing; subsequent calls use this customizing, so that the corresponding part may be omitted. Changes to the customizing part after this first method call are not considered: The customizing for this instance remains unchanged. @param {string} sTargetType The target type; must be "string" or a type with "string" as its {@link sap.ui.base.DataType#getPrimitiveType primitive type}. See {@link sap.ui.model.odata.type} for more information. @returns {string} The formatted output value; <code>null</code>, if <code>aValues</code> is <code>undefined</code> or <code>null</code> or if the measure or amount, the unit or currency or the corresponding customizing contained therein is <code>undefined</code>. @throws {sap.ui.model.FormatException} If <code>sTargetType</code> is unsupported @function @name sap.ui.model.odata.type.UnitMixin#formatValue @public @since 1.63.0
[ "Formats", "the", "given", "values", "of", "the", "parts", "of", "the", "composite", "type", "to", "the", "given", "target", "type", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/type/UnitMixin.js#L120-L151
4,158
SAP/openui5
src/sap.ui.core/src/sap/ui/model/odata/type/UnitMixin.js
parseValue
function parseValue(vValue, sSourceType, aCurrentValues) { var iDecimals, iFractionDigits, aMatches, sUnit, aValues; if (this.mCustomUnits === undefined) { throw new ParseException("Cannot parse value without customizing"); } aValues = fnBaseType.prototype.parseValue.apply(this, arguments); sUnit = aValues[1] || aCurrentValues[1]; // remove trailing decimal zeroes and separator if (aValues[0].includes(".")) { aValues[0] = aValues[0].replace(rTrailingZeros, "").replace(rSeparator, ""); } if (sUnit && this.mCustomUnits) { aMatches = rDecimals.exec(aValues[0]); iFractionDigits = aMatches ? aMatches[1].length : 0; // If the unit is not in mCustomUnits, the base class throws a ParseException. iDecimals = this.mCustomUnits[sUnit].decimals; if (iFractionDigits > iDecimals) { throw new ParseException(iDecimals ? getText("EnterNumberFraction", [iDecimals]) : getText("EnterInt")); } } if (!this.bParseAsString) { aValues[0] = Number(aValues[0]); } return aValues; }
javascript
function parseValue(vValue, sSourceType, aCurrentValues) { var iDecimals, iFractionDigits, aMatches, sUnit, aValues; if (this.mCustomUnits === undefined) { throw new ParseException("Cannot parse value without customizing"); } aValues = fnBaseType.prototype.parseValue.apply(this, arguments); sUnit = aValues[1] || aCurrentValues[1]; // remove trailing decimal zeroes and separator if (aValues[0].includes(".")) { aValues[0] = aValues[0].replace(rTrailingZeros, "").replace(rSeparator, ""); } if (sUnit && this.mCustomUnits) { aMatches = rDecimals.exec(aValues[0]); iFractionDigits = aMatches ? aMatches[1].length : 0; // If the unit is not in mCustomUnits, the base class throws a ParseException. iDecimals = this.mCustomUnits[sUnit].decimals; if (iFractionDigits > iDecimals) { throw new ParseException(iDecimals ? getText("EnterNumberFraction", [iDecimals]) : getText("EnterInt")); } } if (!this.bParseAsString) { aValues[0] = Number(aValues[0]); } return aValues; }
[ "function", "parseValue", "(", "vValue", ",", "sSourceType", ",", "aCurrentValues", ")", "{", "var", "iDecimals", ",", "iFractionDigits", ",", "aMatches", ",", "sUnit", ",", "aValues", ";", "if", "(", "this", ".", "mCustomUnits", "===", "undefined", ")", "{", "throw", "new", "ParseException", "(", "\"Cannot parse value without customizing\"", ")", ";", "}", "aValues", "=", "fnBaseType", ".", "prototype", ".", "parseValue", ".", "apply", "(", "this", ",", "arguments", ")", ";", "sUnit", "=", "aValues", "[", "1", "]", "||", "aCurrentValues", "[", "1", "]", ";", "// remove trailing decimal zeroes and separator", "if", "(", "aValues", "[", "0", "]", ".", "includes", "(", "\".\"", ")", ")", "{", "aValues", "[", "0", "]", "=", "aValues", "[", "0", "]", ".", "replace", "(", "rTrailingZeros", ",", "\"\"", ")", ".", "replace", "(", "rSeparator", ",", "\"\"", ")", ";", "}", "if", "(", "sUnit", "&&", "this", ".", "mCustomUnits", ")", "{", "aMatches", "=", "rDecimals", ".", "exec", "(", "aValues", "[", "0", "]", ")", ";", "iFractionDigits", "=", "aMatches", "?", "aMatches", "[", "1", "]", ".", "length", ":", "0", ";", "// If the unit is not in mCustomUnits, the base class throws a ParseException.", "iDecimals", "=", "this", ".", "mCustomUnits", "[", "sUnit", "]", ".", "decimals", ";", "if", "(", "iFractionDigits", ">", "iDecimals", ")", "{", "throw", "new", "ParseException", "(", "iDecimals", "?", "getText", "(", "\"EnterNumberFraction\"", ",", "[", "iDecimals", "]", ")", ":", "getText", "(", "\"EnterInt\"", ")", ")", ";", "}", "}", "if", "(", "!", "this", ".", "bParseAsString", ")", "{", "aValues", "[", "0", "]", "=", "Number", "(", "aValues", "[", "0", "]", ")", ";", "}", "return", "aValues", ";", "}" ]
Parses the given string value to an array containing measure or amount, and unit or currency. @param {string} vValue The value to be parsed @param {string} sSourceType The source type (the expected type of <code>vValue</code>); must be "string", or a type with "string" as its {@link sap.ui.base.DataType#getPrimitiveType primitive type}. See {@link sap.ui.model.odata.type} for more information. @param {any[]} aCurrentValues The current values of all binding parts @returns {any[]} An array containing measure or amount, and unit or currency in this order. Measure or amount, and unit or currency, are string values unless the format option <code>parseAsString</code> is <code>false</code>; in this case, the measure or amount is a number. @throws {sap.ui.model.ParseException} If {@link #formatValue} has not yet been called with a customizing part or if <code>sSourceType</code> is unsupported or if the given string cannot be parsed @function @name sap.ui.model.odata.type.UnitMixin#parseValue @public @see sap.ui.model.type.Unit#parseValue @since 1.63.0
[ "Parses", "the", "given", "string", "value", "to", "an", "array", "containing", "measure", "or", "amount", "and", "unit", "or", "currency", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/type/UnitMixin.js#L181-L210
4,159
SAP/openui5
src/sap.ui.fl/src/sap/ui/fl/changeHandler/BaseRename.js
function(oChange, oControl, mPropertyBag) { var oModifier = mPropertyBag.modifier; var sPropertyName = mRenameSettings.propertyName; var oChangeDefinition = oChange.getDefinition(); var sText = oChangeDefinition.texts[mRenameSettings.changePropertyName]; var sValue = sText.value; if (oChangeDefinition.texts && sText && typeof (sValue) === "string") { oChange.setRevertData(oModifier.getPropertyBindingOrProperty(oControl, sPropertyName)); oModifier.setPropertyBindingOrProperty(oControl, sPropertyName, sValue); return true; } else { Utils.log.error("Change does not contain sufficient information to be applied: [" + oChangeDefinition.layer + "]" + oChangeDefinition.namespace + "/" + oChangeDefinition.fileName + "." + oChangeDefinition.fileType); //however subsequent changes should be applied } }
javascript
function(oChange, oControl, mPropertyBag) { var oModifier = mPropertyBag.modifier; var sPropertyName = mRenameSettings.propertyName; var oChangeDefinition = oChange.getDefinition(); var sText = oChangeDefinition.texts[mRenameSettings.changePropertyName]; var sValue = sText.value; if (oChangeDefinition.texts && sText && typeof (sValue) === "string") { oChange.setRevertData(oModifier.getPropertyBindingOrProperty(oControl, sPropertyName)); oModifier.setPropertyBindingOrProperty(oControl, sPropertyName, sValue); return true; } else { Utils.log.error("Change does not contain sufficient information to be applied: [" + oChangeDefinition.layer + "]" + oChangeDefinition.namespace + "/" + oChangeDefinition.fileName + "." + oChangeDefinition.fileType); //however subsequent changes should be applied } }
[ "function", "(", "oChange", ",", "oControl", ",", "mPropertyBag", ")", "{", "var", "oModifier", "=", "mPropertyBag", ".", "modifier", ";", "var", "sPropertyName", "=", "mRenameSettings", ".", "propertyName", ";", "var", "oChangeDefinition", "=", "oChange", ".", "getDefinition", "(", ")", ";", "var", "sText", "=", "oChangeDefinition", ".", "texts", "[", "mRenameSettings", ".", "changePropertyName", "]", ";", "var", "sValue", "=", "sText", ".", "value", ";", "if", "(", "oChangeDefinition", ".", "texts", "&&", "sText", "&&", "typeof", "(", "sValue", ")", "===", "\"string\"", ")", "{", "oChange", ".", "setRevertData", "(", "oModifier", ".", "getPropertyBindingOrProperty", "(", "oControl", ",", "sPropertyName", ")", ")", ";", "oModifier", ".", "setPropertyBindingOrProperty", "(", "oControl", ",", "sPropertyName", ",", "sValue", ")", ";", "return", "true", ";", "}", "else", "{", "Utils", ".", "log", ".", "error", "(", "\"Change does not contain sufficient information to be applied: [\"", "+", "oChangeDefinition", ".", "layer", "+", "\"]\"", "+", "oChangeDefinition", ".", "namespace", "+", "\"/\"", "+", "oChangeDefinition", ".", "fileName", "+", "\".\"", "+", "oChangeDefinition", ".", "fileType", ")", ";", "//however subsequent changes should be applied", "}", "}" ]
Renames a control. @param {sap.ui.fl.Change} oChange change wrapper object with instructions to be applied on the control map @param {sap.ui.core.Control} oControl Control that matches the change selector for applying the change @param {object} mPropertyBag property bag @param {object} mPropertyBag.modifier modifier for the controls @returns {boolean} true if successful @public
[ "Renames", "a", "control", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.fl/src/sap/ui/fl/changeHandler/BaseRename.js#L46-L61
4,160
SAP/openui5
src/sap.ui.fl/src/sap/ui/fl/changeHandler/BaseRename.js
function(oChange, oControl, mPropertyBag) { var oModifier = mPropertyBag.modifier; var sPropertyName = mRenameSettings.propertyName; var vOldValue = oChange.getRevertData(); if (vOldValue || vOldValue === "") { oModifier.setPropertyBindingOrProperty(oControl, sPropertyName, vOldValue); oChange.resetRevertData(); return true; } else { Utils.log.error("Change doesn't contain sufficient information to be reverted. Most Likely the Change didn't go through applyChange."); } }
javascript
function(oChange, oControl, mPropertyBag) { var oModifier = mPropertyBag.modifier; var sPropertyName = mRenameSettings.propertyName; var vOldValue = oChange.getRevertData(); if (vOldValue || vOldValue === "") { oModifier.setPropertyBindingOrProperty(oControl, sPropertyName, vOldValue); oChange.resetRevertData(); return true; } else { Utils.log.error("Change doesn't contain sufficient information to be reverted. Most Likely the Change didn't go through applyChange."); } }
[ "function", "(", "oChange", ",", "oControl", ",", "mPropertyBag", ")", "{", "var", "oModifier", "=", "mPropertyBag", ".", "modifier", ";", "var", "sPropertyName", "=", "mRenameSettings", ".", "propertyName", ";", "var", "vOldValue", "=", "oChange", ".", "getRevertData", "(", ")", ";", "if", "(", "vOldValue", "||", "vOldValue", "===", "\"\"", ")", "{", "oModifier", ".", "setPropertyBindingOrProperty", "(", "oControl", ",", "sPropertyName", ",", "vOldValue", ")", ";", "oChange", ".", "resetRevertData", "(", ")", ";", "return", "true", ";", "}", "else", "{", "Utils", ".", "log", ".", "error", "(", "\"Change doesn't contain sufficient information to be reverted. Most Likely the Change didn't go through applyChange.\"", ")", ";", "}", "}" ]
Reverts a Rename Change @param {sap.ui.fl.Change} oChange change wrapper object with instructions to be applied on the control map @param {sap.ui.core.Control} oControl Control that matches the change selector for applying the change @param {object} mPropertyBag property bag @param {object} mPropertyBag.modifier modifier for the controls @returns {boolean} true if successful @public
[ "Reverts", "a", "Rename", "Change" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.fl/src/sap/ui/fl/changeHandler/BaseRename.js#L73-L85
4,161
SAP/openui5
src/sap.ui.fl/src/sap/ui/fl/changeHandler/BaseRename.js
function(oChange, mSpecificChangeInfo, mPropertyBag) { var oChangeDefinition = oChange.getDefinition(); var sChangePropertyName = mRenameSettings.changePropertyName; var sTranslationTextType = mRenameSettings.translationTextType; var oControlToBeRenamed = mPropertyBag.modifier.bySelector(oChange.getSelector(), mPropertyBag.appComponent); oChangeDefinition.content.originalControlType = mPropertyBag.modifier.getControlType(oControlToBeRenamed); if (typeof (mSpecificChangeInfo.value) === "string") { Base.setTextInChange(oChangeDefinition, sChangePropertyName, mSpecificChangeInfo.value, sTranslationTextType); } else { throw new Error("oSpecificChangeInfo.value attribute required"); } }
javascript
function(oChange, mSpecificChangeInfo, mPropertyBag) { var oChangeDefinition = oChange.getDefinition(); var sChangePropertyName = mRenameSettings.changePropertyName; var sTranslationTextType = mRenameSettings.translationTextType; var oControlToBeRenamed = mPropertyBag.modifier.bySelector(oChange.getSelector(), mPropertyBag.appComponent); oChangeDefinition.content.originalControlType = mPropertyBag.modifier.getControlType(oControlToBeRenamed); if (typeof (mSpecificChangeInfo.value) === "string") { Base.setTextInChange(oChangeDefinition, sChangePropertyName, mSpecificChangeInfo.value, sTranslationTextType); } else { throw new Error("oSpecificChangeInfo.value attribute required"); } }
[ "function", "(", "oChange", ",", "mSpecificChangeInfo", ",", "mPropertyBag", ")", "{", "var", "oChangeDefinition", "=", "oChange", ".", "getDefinition", "(", ")", ";", "var", "sChangePropertyName", "=", "mRenameSettings", ".", "changePropertyName", ";", "var", "sTranslationTextType", "=", "mRenameSettings", ".", "translationTextType", ";", "var", "oControlToBeRenamed", "=", "mPropertyBag", ".", "modifier", ".", "bySelector", "(", "oChange", ".", "getSelector", "(", ")", ",", "mPropertyBag", ".", "appComponent", ")", ";", "oChangeDefinition", ".", "content", ".", "originalControlType", "=", "mPropertyBag", ".", "modifier", ".", "getControlType", "(", "oControlToBeRenamed", ")", ";", "if", "(", "typeof", "(", "mSpecificChangeInfo", ".", "value", ")", "===", "\"string\"", ")", "{", "Base", ".", "setTextInChange", "(", "oChangeDefinition", ",", "sChangePropertyName", ",", "mSpecificChangeInfo", ".", "value", ",", "sTranslationTextType", ")", ";", "}", "else", "{", "throw", "new", "Error", "(", "\"oSpecificChangeInfo.value attribute required\"", ")", ";", "}", "}" ]
Completes the change by adding change handler specific content @param {sap.ui.fl.Change} oChange change wrapper object to be completed @param {object} mSpecificChangeInfo with attribute (e.g. textLabel) to be included in the change @public
[ "Completes", "the", "change", "by", "adding", "change", "handler", "specific", "content" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.fl/src/sap/ui/fl/changeHandler/BaseRename.js#L94-L107
4,162
SAP/openui5
src/sap.ui.fl/src/sap/ui/fl/support/apps/contentbrowser/controller/ContentDetailsEdit.controller.js
function (oRouteMatch) { var that = this; var mRouteArguments = oRouteMatch.getParameter("arguments"); var oModelData = {}; oModelData.layer = mRouteArguments.layer; oModelData.namespace = decodeURIComponent(mRouteArguments.namespace); oModelData.fileName = mRouteArguments.fileName; oModelData.fileType = mRouteArguments.fileType; // correct namespace if (oModelData.namespace[oModelData.namespace.length - 1] !== "/") { oModelData.namespace += "/"; } var sContentSuffix = oModelData.namespace + oModelData.fileName + "." + oModelData.fileType; var oPage = that.getView().getContent()[0]; oPage.setBusy(true); return LRepConnector.getContent(oModelData.layer, sContentSuffix, null, null, true).then( that._onContentReceived.bind(that, oModelData, oPage, sContentSuffix), function () { oPage.setBusy(false); } ); }
javascript
function (oRouteMatch) { var that = this; var mRouteArguments = oRouteMatch.getParameter("arguments"); var oModelData = {}; oModelData.layer = mRouteArguments.layer; oModelData.namespace = decodeURIComponent(mRouteArguments.namespace); oModelData.fileName = mRouteArguments.fileName; oModelData.fileType = mRouteArguments.fileType; // correct namespace if (oModelData.namespace[oModelData.namespace.length - 1] !== "/") { oModelData.namespace += "/"; } var sContentSuffix = oModelData.namespace + oModelData.fileName + "." + oModelData.fileType; var oPage = that.getView().getContent()[0]; oPage.setBusy(true); return LRepConnector.getContent(oModelData.layer, sContentSuffix, null, null, true).then( that._onContentReceived.bind(that, oModelData, oPage, sContentSuffix), function () { oPage.setBusy(false); } ); }
[ "function", "(", "oRouteMatch", ")", "{", "var", "that", "=", "this", ";", "var", "mRouteArguments", "=", "oRouteMatch", ".", "getParameter", "(", "\"arguments\"", ")", ";", "var", "oModelData", "=", "{", "}", ";", "oModelData", ".", "layer", "=", "mRouteArguments", ".", "layer", ";", "oModelData", ".", "namespace", "=", "decodeURIComponent", "(", "mRouteArguments", ".", "namespace", ")", ";", "oModelData", ".", "fileName", "=", "mRouteArguments", ".", "fileName", ";", "oModelData", ".", "fileType", "=", "mRouteArguments", ".", "fileType", ";", "// correct namespace", "if", "(", "oModelData", ".", "namespace", "[", "oModelData", ".", "namespace", ".", "length", "-", "1", "]", "!==", "\"/\"", ")", "{", "oModelData", ".", "namespace", "+=", "\"/\"", ";", "}", "var", "sContentSuffix", "=", "oModelData", ".", "namespace", "+", "oModelData", ".", "fileName", "+", "\".\"", "+", "oModelData", ".", "fileType", ";", "var", "oPage", "=", "that", ".", "getView", "(", ")", ".", "getContent", "(", ")", "[", "0", "]", ";", "oPage", ".", "setBusy", "(", "true", ")", ";", "return", "LRepConnector", ".", "getContent", "(", "oModelData", ".", "layer", ",", "sContentSuffix", ",", "null", ",", "null", ",", "true", ")", ".", "then", "(", "that", ".", "_onContentReceived", ".", "bind", "(", "that", ",", "oModelData", ",", "oPage", ",", "sContentSuffix", ")", ",", "function", "(", ")", "{", "oPage", ".", "setBusy", "(", "false", ")", ";", "}", ")", ";", "}" ]
Handler if a route was matched; Obtains information about layer, namespace, filename, and file type from the route's arguments, and then requests content from Layered Repository. @param {Object} oRouteMatch - route object which is specified in the router and matched via regexp @returns {Promise} - <code>LRepConnector</code> "getContent" promise @private
[ "Handler", "if", "a", "route", "was", "matched", ";", "Obtains", "information", "about", "layer", "namespace", "filename", "and", "file", "type", "from", "the", "route", "s", "arguments", "and", "then", "requests", "content", "from", "Layered", "Repository", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.fl/src/sap/ui/fl/support/apps/contentbrowser/controller/ContentDetailsEdit.controller.js#L62-L87
4,163
SAP/openui5
src/sap.ui.fl/src/sap/ui/fl/support/apps/contentbrowser/controller/ContentDetailsEdit.controller.js
function (sLayer, sNameSpace, sFileName, sFileType, sData, sTransportId, sPackageName) { return LRepConnector.saveFile(sLayer, sNameSpace, sFileName, sFileType, sData, sTransportId, sPackageName).then(this._navToDisplayMode.bind(this)); }
javascript
function (sLayer, sNameSpace, sFileName, sFileType, sData, sTransportId, sPackageName) { return LRepConnector.saveFile(sLayer, sNameSpace, sFileName, sFileType, sData, sTransportId, sPackageName).then(this._navToDisplayMode.bind(this)); }
[ "function", "(", "sLayer", ",", "sNameSpace", ",", "sFileName", ",", "sFileType", ",", "sData", ",", "sTransportId", ",", "sPackageName", ")", "{", "return", "LRepConnector", ".", "saveFile", "(", "sLayer", ",", "sNameSpace", ",", "sFileName", ",", "sFileType", ",", "sData", ",", "sTransportId", ",", "sPackageName", ")", ".", "then", "(", "this", ".", "_navToDisplayMode", ".", "bind", "(", "this", ")", ")", ";", "}" ]
Send request to back end to saved file. After the file has been successfully saved, navigates to "Display" mode of the content. @returns {Promise} - <code>LRepConnector</code> "saveFiles" promise @private
[ "Send", "request", "to", "back", "end", "to", "saved", "file", ".", "After", "the", "file", "has", "been", "successfully", "saved", "navigates", "to", "Display", "mode", "of", "the", "content", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.fl/src/sap/ui/fl/support/apps/contentbrowser/controller/ContentDetailsEdit.controller.js#L193-L195
4,164
SAP/openui5
src/sap.ui.documentation/src/sap/ui/documentation/sdk/Component.js
function () { this._oErrorHandler = new ErrorHandler(this); // set the device model this.setModel(models.createDeviceModel(), "device"); // set the global libs data this.setModel(new JSONModel(), "libsData"); // set the global version data this.setModel(new JSONModel(), "versionData"); // call the base component's init function and create the App view UIComponent.prototype.init.apply(this, arguments); // Load VersionInfo model promise this.loadVersionInfo(); // create the views based on the url/hash this.getRouter().initialize(); }
javascript
function () { this._oErrorHandler = new ErrorHandler(this); // set the device model this.setModel(models.createDeviceModel(), "device"); // set the global libs data this.setModel(new JSONModel(), "libsData"); // set the global version data this.setModel(new JSONModel(), "versionData"); // call the base component's init function and create the App view UIComponent.prototype.init.apply(this, arguments); // Load VersionInfo model promise this.loadVersionInfo(); // create the views based on the url/hash this.getRouter().initialize(); }
[ "function", "(", ")", "{", "this", ".", "_oErrorHandler", "=", "new", "ErrorHandler", "(", "this", ")", ";", "// set the device model", "this", ".", "setModel", "(", "models", ".", "createDeviceModel", "(", ")", ",", "\"device\"", ")", ";", "// set the global libs data", "this", ".", "setModel", "(", "new", "JSONModel", "(", ")", ",", "\"libsData\"", ")", ";", "// set the global version data", "this", ".", "setModel", "(", "new", "JSONModel", "(", ")", ",", "\"versionData\"", ")", ";", "// call the base component's init function and create the App view", "UIComponent", ".", "prototype", ".", "init", ".", "apply", "(", "this", ",", "arguments", ")", ";", "// Load VersionInfo model promise", "this", ".", "loadVersionInfo", "(", ")", ";", "// create the views based on the url/hash", "this", ".", "getRouter", "(", ")", ".", "initialize", "(", ")", ";", "}" ]
The component is initialized by UI5 automatically during the startup of the app and calls the init method once. In this method, the device models are set and the router is initialized. @public @override
[ "The", "component", "is", "initialized", "by", "UI5", "automatically", "during", "the", "startup", "of", "the", "app", "and", "calls", "the", "init", "method", "once", ".", "In", "this", "method", "the", "device", "models", "are", "set", "and", "the", "router", "is", "initialized", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.documentation/src/sap/ui/documentation/sdk/Component.js#L47-L68
4,165
SAP/openui5
src/sap.ui.documentation/src/sap/ui/documentation/sdk/Component.js
function () { this._oErrorHandler.destroy(); this._oConfigUtil.destroy(); this._oConfigUtil = null; // call the base component's destroy function UIComponent.prototype.destroy.apply(this, arguments); }
javascript
function () { this._oErrorHandler.destroy(); this._oConfigUtil.destroy(); this._oConfigUtil = null; // call the base component's destroy function UIComponent.prototype.destroy.apply(this, arguments); }
[ "function", "(", ")", "{", "this", ".", "_oErrorHandler", ".", "destroy", "(", ")", ";", "this", ".", "_oConfigUtil", ".", "destroy", "(", ")", ";", "this", ".", "_oConfigUtil", "=", "null", ";", "// call the base component's destroy function", "UIComponent", ".", "prototype", ".", "destroy", ".", "apply", "(", "this", ",", "arguments", ")", ";", "}" ]
The component is destroyed by UI5 automatically. In this method, the ListSelector and ErrorHandler are destroyed. @public @override
[ "The", "component", "is", "destroyed", "by", "UI5", "automatically", ".", "In", "this", "method", "the", "ListSelector", "and", "ErrorHandler", "are", "destroyed", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.documentation/src/sap/ui/documentation/sdk/Component.js#L76-L82
4,166
SAP/openui5
src/sap.ui.documentation/src/sap/ui/documentation/sdk/Component.js
function() { if (this._sContentDensityClass === undefined) { // check whether FLP has already set the content density class; do nothing in this case if (jQuery(document.body).hasClass("sapUiSizeCozy") || jQuery(document.body).hasClass("sapUiSizeCompact")) { this._sContentDensityClass = ""; } // The default density class for the sap.ui.documentation project will be compact this._sContentDensityClass = "sapUiSizeCompact"; } return this._sContentDensityClass; }
javascript
function() { if (this._sContentDensityClass === undefined) { // check whether FLP has already set the content density class; do nothing in this case if (jQuery(document.body).hasClass("sapUiSizeCozy") || jQuery(document.body).hasClass("sapUiSizeCompact")) { this._sContentDensityClass = ""; } // The default density class for the sap.ui.documentation project will be compact this._sContentDensityClass = "sapUiSizeCompact"; } return this._sContentDensityClass; }
[ "function", "(", ")", "{", "if", "(", "this", ".", "_sContentDensityClass", "===", "undefined", ")", "{", "// check whether FLP has already set the content density class; do nothing in this case", "if", "(", "jQuery", "(", "document", ".", "body", ")", ".", "hasClass", "(", "\"sapUiSizeCozy\"", ")", "||", "jQuery", "(", "document", ".", "body", ")", ".", "hasClass", "(", "\"sapUiSizeCompact\"", ")", ")", "{", "this", ".", "_sContentDensityClass", "=", "\"\"", ";", "}", "// The default density class for the sap.ui.documentation project will be compact", "this", ".", "_sContentDensityClass", "=", "\"sapUiSizeCompact\"", ";", "}", "return", "this", ".", "_sContentDensityClass", ";", "}" ]
This method can be called to determine whether the sapUiSizeCompact or sapUiSizeCozy design mode class should be set, which influences the size appearance of some controls. @public @return {string} css class, either 'sapUiSizeCompact' or 'sapUiSizeCozy' - or an empty string if no css class should be set
[ "This", "method", "can", "be", "called", "to", "determine", "whether", "the", "sapUiSizeCompact", "or", "sapUiSizeCozy", "design", "mode", "class", "should", "be", "set", "which", "influences", "the", "size", "appearance", "of", "some", "controls", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.documentation/src/sap/ui/documentation/sdk/Component.js#L90-L100
4,167
SAP/openui5
src/sap.ui.core/src/sap/ui/core/cache/LRUPersistentCache.js
function (bDeserialize) { var self = this, oItem, sMsrDeserialize = "[sync ] _getAll: deserialize"; return new Promise(function (resolve, reject) { var entries = [], transaction = self._db.transaction([self.defaultOptions._contentStoreName], "readonly"), objectStore = transaction.objectStore(self.defaultOptions._contentStoreName); transaction.onerror = function (event) { reject(collectErrorData(event)); }; transaction.oncomplete = function (event) { resolve(entries); }; objectStore.openCursor().onsuccess = function (event) { var cursor = event.target.result; if (cursor && cursor.value) { //cursor.value is ItemData oItem = new Item(cursor.value, sMsrDeserialize, sMsrCatGet).deserialize(); entries.push({ key: oItem.oData.key, value: oItem.oData.value }); cursor.continue(); } }; }); }
javascript
function (bDeserialize) { var self = this, oItem, sMsrDeserialize = "[sync ] _getAll: deserialize"; return new Promise(function (resolve, reject) { var entries = [], transaction = self._db.transaction([self.defaultOptions._contentStoreName], "readonly"), objectStore = transaction.objectStore(self.defaultOptions._contentStoreName); transaction.onerror = function (event) { reject(collectErrorData(event)); }; transaction.oncomplete = function (event) { resolve(entries); }; objectStore.openCursor().onsuccess = function (event) { var cursor = event.target.result; if (cursor && cursor.value) { //cursor.value is ItemData oItem = new Item(cursor.value, sMsrDeserialize, sMsrCatGet).deserialize(); entries.push({ key: oItem.oData.key, value: oItem.oData.value }); cursor.continue(); } }; }); }
[ "function", "(", "bDeserialize", ")", "{", "var", "self", "=", "this", ",", "oItem", ",", "sMsrDeserialize", "=", "\"[sync ] _getAll: deserialize\"", ";", "return", "new", "Promise", "(", "function", "(", "resolve", ",", "reject", ")", "{", "var", "entries", "=", "[", "]", ",", "transaction", "=", "self", ".", "_db", ".", "transaction", "(", "[", "self", ".", "defaultOptions", ".", "_contentStoreName", "]", ",", "\"readonly\"", ")", ",", "objectStore", "=", "transaction", ".", "objectStore", "(", "self", ".", "defaultOptions", ".", "_contentStoreName", ")", ";", "transaction", ".", "onerror", "=", "function", "(", "event", ")", "{", "reject", "(", "collectErrorData", "(", "event", ")", ")", ";", "}", ";", "transaction", ".", "oncomplete", "=", "function", "(", "event", ")", "{", "resolve", "(", "entries", ")", ";", "}", ";", "objectStore", ".", "openCursor", "(", ")", ".", "onsuccess", "=", "function", "(", "event", ")", "{", "var", "cursor", "=", "event", ".", "target", ".", "result", ";", "if", "(", "cursor", "&&", "cursor", ".", "value", ")", "{", "//cursor.value is ItemData", "oItem", "=", "new", "Item", "(", "cursor", ".", "value", ",", "sMsrDeserialize", ",", "sMsrCatGet", ")", ".", "deserialize", "(", ")", ";", "entries", ".", "push", "(", "{", "key", ":", "oItem", ".", "oData", ".", "key", ",", "value", ":", "oItem", ".", "oData", ".", "value", "}", ")", ";", "cursor", ".", "continue", "(", ")", ";", "}", "}", ";", "}", ")", ";", "}" ]
Retrieves all items. @param {boolean} bDeserialize whether to deserialize the content or not @returns {Promise} a promise that would be resolved in case of successful operation or rejected with value of the error message if the operation fails. When resolved the Promise will return the array of all entries in the following format: <code>{key: <myKey>, value: <myValue>}</code> @private
[ "Retrieves", "all", "items", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/cache/LRUPersistentCache.js#L194-L223
4,168
SAP/openui5
src/sap.ui.core/src/sap/ui/core/cache/LRUPersistentCache.js
cloneMetadata
function cloneMetadata(source) { var backupMetadata = initMetadata(source.__ui5version); for (var index in source.__byIndex__) { backupMetadata.__byIndex__[index] = source.__byIndex__[index]; } for (var key in source.__byKey__) { backupMetadata.__byKey__[key] = source.__byKey__[key]; } return backupMetadata; }
javascript
function cloneMetadata(source) { var backupMetadata = initMetadata(source.__ui5version); for (var index in source.__byIndex__) { backupMetadata.__byIndex__[index] = source.__byIndex__[index]; } for (var key in source.__byKey__) { backupMetadata.__byKey__[key] = source.__byKey__[key]; } return backupMetadata; }
[ "function", "cloneMetadata", "(", "source", ")", "{", "var", "backupMetadata", "=", "initMetadata", "(", "source", ".", "__ui5version", ")", ";", "for", "(", "var", "index", "in", "source", ".", "__byIndex__", ")", "{", "backupMetadata", ".", "__byIndex__", "[", "index", "]", "=", "source", ".", "__byIndex__", "[", "index", "]", ";", "}", "for", "(", "var", "key", "in", "source", ".", "__byKey__", ")", "{", "backupMetadata", ".", "__byKey__", "[", "key", "]", "=", "source", ".", "__byKey__", "[", "key", "]", ";", "}", "return", "backupMetadata", ";", "}" ]
Clones a given metadata instance @param source the instance to clone @returns {*} cloned metadata
[ "Clones", "a", "given", "metadata", "instance" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/cache/LRUPersistentCache.js#L722-L731
4,169
SAP/openui5
src/sap.ui.core/src/sap/ui/core/cache/LRUPersistentCache.js
cleanAndStore
function cleanAndStore(self, key, value) { return new Promise(function (resolve, reject) { var attempt = 0; _cleanAndStore(self, key, value); function _cleanAndStore(self, key, value) { attempt++; Log.debug("Cache Manager LRUPersistentCache: cleanAndStore: freeing space attempt [" + (attempt) + "]"); deleteItemAndUpdateMetadata(self).then(function (deletedKey) { Log.debug("Cache Manager LRUPersistentCache: cleanAndStore: deleted item with key [" + deletedKey + "]. Going to put " + key); return internalSet(self, key, value).then(resolve, function (event) { if (isQuotaExceeded(event)) { Log.debug("Cache Manager LRUPersistentCache: cleanAndStore: QuotaExceedError during freeing up space..."); if (getItemCount(self) > 0) { _cleanAndStore(self, key, value); } else { reject("Cache Manager LRUPersistentCache: cleanAndStore: even when the cache is empty, the new item with key [" + key + "] cannot be added"); } } else { reject("Cache Manager LRUPersistentCache: cleanAndStore: cannot free space: " + collectErrorData(event)); } }); }, reject); } }); }
javascript
function cleanAndStore(self, key, value) { return new Promise(function (resolve, reject) { var attempt = 0; _cleanAndStore(self, key, value); function _cleanAndStore(self, key, value) { attempt++; Log.debug("Cache Manager LRUPersistentCache: cleanAndStore: freeing space attempt [" + (attempt) + "]"); deleteItemAndUpdateMetadata(self).then(function (deletedKey) { Log.debug("Cache Manager LRUPersistentCache: cleanAndStore: deleted item with key [" + deletedKey + "]. Going to put " + key); return internalSet(self, key, value).then(resolve, function (event) { if (isQuotaExceeded(event)) { Log.debug("Cache Manager LRUPersistentCache: cleanAndStore: QuotaExceedError during freeing up space..."); if (getItemCount(self) > 0) { _cleanAndStore(self, key, value); } else { reject("Cache Manager LRUPersistentCache: cleanAndStore: even when the cache is empty, the new item with key [" + key + "] cannot be added"); } } else { reject("Cache Manager LRUPersistentCache: cleanAndStore: cannot free space: " + collectErrorData(event)); } }); }, reject); } }); }
[ "function", "cleanAndStore", "(", "self", ",", "key", ",", "value", ")", "{", "return", "new", "Promise", "(", "function", "(", "resolve", ",", "reject", ")", "{", "var", "attempt", "=", "0", ";", "_cleanAndStore", "(", "self", ",", "key", ",", "value", ")", ";", "function", "_cleanAndStore", "(", "self", ",", "key", ",", "value", ")", "{", "attempt", "++", ";", "Log", ".", "debug", "(", "\"Cache Manager LRUPersistentCache: cleanAndStore: freeing space attempt [\"", "+", "(", "attempt", ")", "+", "\"]\"", ")", ";", "deleteItemAndUpdateMetadata", "(", "self", ")", ".", "then", "(", "function", "(", "deletedKey", ")", "{", "Log", ".", "debug", "(", "\"Cache Manager LRUPersistentCache: cleanAndStore: deleted item with key [\"", "+", "deletedKey", "+", "\"]. Going to put \"", "+", "key", ")", ";", "return", "internalSet", "(", "self", ",", "key", ",", "value", ")", ".", "then", "(", "resolve", ",", "function", "(", "event", ")", "{", "if", "(", "isQuotaExceeded", "(", "event", ")", ")", "{", "Log", ".", "debug", "(", "\"Cache Manager LRUPersistentCache: cleanAndStore: QuotaExceedError during freeing up space...\"", ")", ";", "if", "(", "getItemCount", "(", "self", ")", ">", "0", ")", "{", "_cleanAndStore", "(", "self", ",", "key", ",", "value", ")", ";", "}", "else", "{", "reject", "(", "\"Cache Manager LRUPersistentCache: cleanAndStore: even when the cache is empty, the new item with key [\"", "+", "key", "+", "\"] cannot be added\"", ")", ";", "}", "}", "else", "{", "reject", "(", "\"Cache Manager LRUPersistentCache: cleanAndStore: cannot free space: \"", "+", "collectErrorData", "(", "event", ")", ")", ";", "}", "}", ")", ";", "}", ",", "reject", ")", ";", "}", "}", ")", ";", "}" ]
Tries to free space until the given new item is successfully added. @param {sap.ui.core.cache.LRUPersistentCache} self the instance of the Cache Manager @param {ItemData} oItem the item to free space for @returns {Promise} a promise that will resolve if the given item is added, or reject - if not.
[ "Tries", "to", "free", "space", "until", "the", "given", "new", "item", "is", "successfully", "added", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/cache/LRUPersistentCache.js#L782-L809
4,170
SAP/openui5
src/sap.ui.core/src/sap/ui/core/cache/LRUPersistentCache.js
deleteMetadataForEntry
function deleteMetadataForEntry(self, key) { var iIndex = self._metadata.__byKey__[key]; delete self._metadata.__byKey__[key]; delete self._metadata.__byIndex__[iIndex]; seekMetadataLRU(self); }
javascript
function deleteMetadataForEntry(self, key) { var iIndex = self._metadata.__byKey__[key]; delete self._metadata.__byKey__[key]; delete self._metadata.__byIndex__[iIndex]; seekMetadataLRU(self); }
[ "function", "deleteMetadataForEntry", "(", "self", ",", "key", ")", "{", "var", "iIndex", "=", "self", ".", "_metadata", ".", "__byKey__", "[", "key", "]", ";", "delete", "self", ".", "_metadata", ".", "__byKey__", "[", "key", "]", ";", "delete", "self", ".", "_metadata", ".", "__byIndex__", "[", "iIndex", "]", ";", "seekMetadataLRU", "(", "self", ")", ";", "}" ]
Deletes all metadata for given key @param self the instance @param key the key for the entry
[ "Deletes", "all", "metadata", "for", "given", "key" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/cache/LRUPersistentCache.js#L820-L825
4,171
SAP/openui5
src/sap.ui.core/src/sap/ui/core/cache/LRUPersistentCache.js
debugMsr
function debugMsr(sMsg, sKey, sMsrId) { //avoid redundant string concatenation & getMeasurement call if (Log.getLevel() >= Log.Level.DEBUG) { Log.debug(sMsg + " for key [" + sKey + "] took: " + Measurement.getMeasurement(sMsrId).duration); } }
javascript
function debugMsr(sMsg, sKey, sMsrId) { //avoid redundant string concatenation & getMeasurement call if (Log.getLevel() >= Log.Level.DEBUG) { Log.debug(sMsg + " for key [" + sKey + "] took: " + Measurement.getMeasurement(sMsrId).duration); } }
[ "function", "debugMsr", "(", "sMsg", ",", "sKey", ",", "sMsrId", ")", "{", "//avoid redundant string concatenation & getMeasurement call", "if", "(", "Log", ".", "getLevel", "(", ")", ">=", "Log", ".", "Level", ".", "DEBUG", ")", "{", "Log", ".", "debug", "(", "sMsg", "+", "\" for key [\"", "+", "sKey", "+", "\"] took: \"", "+", "Measurement", ".", "getMeasurement", "(", "sMsrId", ")", ".", "duration", ")", ";", "}", "}" ]
Logs a debug message related to certain measurement if log level is debug or higher @param {string} sMsg the message @param {string} sKey the key to log message for @param {string} sMsrId the measurementId to use for obtaining the jquery.sap.measure measurement
[ "Logs", "a", "debug", "message", "related", "to", "certain", "measurement", "if", "log", "level", "is", "debug", "or", "higher" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/cache/LRUPersistentCache.js#L898-L903
4,172
SAP/openui5
src/sap.ui.core/src/sap/ui/model/odata/v4/ODataParentBinding.js
ODataParentBinding
function ODataParentBinding() { // initialize members introduced by ODataBinding asODataBinding.call(this); // the aggregated query options this.mAggregatedQueryOptions = {}; // whether the aggregated query options are processed the first time this.bAggregatedQueryOptionsInitial = true; // auto-$expand/$select: promises to wait until child bindings have provided // their path and query options this.aChildCanUseCachePromises = []; // counts the sent but not yet completed PATCHes this.iPatchCounter = 0; // whether all sent PATCHes have been successfully processed this.bPatchSuccess = true; this.oReadGroupLock = undefined; // see #createReadGroupLock this.oResumePromise = undefined; // see #getResumePromise }
javascript
function ODataParentBinding() { // initialize members introduced by ODataBinding asODataBinding.call(this); // the aggregated query options this.mAggregatedQueryOptions = {}; // whether the aggregated query options are processed the first time this.bAggregatedQueryOptionsInitial = true; // auto-$expand/$select: promises to wait until child bindings have provided // their path and query options this.aChildCanUseCachePromises = []; // counts the sent but not yet completed PATCHes this.iPatchCounter = 0; // whether all sent PATCHes have been successfully processed this.bPatchSuccess = true; this.oReadGroupLock = undefined; // see #createReadGroupLock this.oResumePromise = undefined; // see #getResumePromise }
[ "function", "ODataParentBinding", "(", ")", "{", "// initialize members introduced by ODataBinding", "asODataBinding", ".", "call", "(", "this", ")", ";", "// the aggregated query options", "this", ".", "mAggregatedQueryOptions", "=", "{", "}", ";", "// whether the aggregated query options are processed the first time", "this", ".", "bAggregatedQueryOptionsInitial", "=", "true", ";", "// auto-$expand/$select: promises to wait until child bindings have provided", "// their path and query options", "this", ".", "aChildCanUseCachePromises", "=", "[", "]", ";", "// counts the sent but not yet completed PATCHes", "this", ".", "iPatchCounter", "=", "0", ";", "// whether all sent PATCHes have been successfully processed", "this", ".", "bPatchSuccess", "=", "true", ";", "this", ".", "oReadGroupLock", "=", "undefined", ";", "// see #createReadGroupLock", "this", ".", "oResumePromise", "=", "undefined", ";", "// see #getResumePromise", "}" ]
A mixin for all OData V4 bindings with dependent bindings. @alias sap.ui.model.odata.v4.ODataParentBinding @extends sap.ui.model.odata.v4.ODataBinding @mixin
[ "A", "mixin", "for", "all", "OData", "V4", "bindings", "with", "dependent", "bindings", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/v4/ODataParentBinding.js#L24-L41
4,173
SAP/openui5
src/sap.ui.demokit/src/sap/ui/demokit/util/jsanalyzer/ModuleAnalyzer.js
getParamInfo
function getParamInfo(sParamName, aDocTags) { //set default parameter type if there are no @ definitions for the type var sParamType = '', sParamDescription = '', iParamNameIndex, iDocStartIndex, rEgexMatchType = /{(.*)}/, aMatch; for (var i = 0; i < aDocTags.length; i++) { if ( aDocTags[i].tag !== 'param' ) { continue; } aMatch = rEgexMatchType.exec(aDocTags[i].content); iParamNameIndex = aDocTags[i].content.indexOf(sParamName); if ( aMatch && iParamNameIndex > -1 ) { //get the match without the curly brackets sParamType = aMatch[1]; iDocStartIndex = iParamNameIndex + sParamName.length; sParamDescription = aDocTags[i].content.substr(iDocStartIndex); //clean the doc from - symbol if they come after the param name and trim the extra whitespace sParamDescription = sParamDescription.replace(/[-]/, '').trim(); // prevent unnecessary looping! break; } } return { name: sParamName, type: sParamType, doc: sParamDescription }; }
javascript
function getParamInfo(sParamName, aDocTags) { //set default parameter type if there are no @ definitions for the type var sParamType = '', sParamDescription = '', iParamNameIndex, iDocStartIndex, rEgexMatchType = /{(.*)}/, aMatch; for (var i = 0; i < aDocTags.length; i++) { if ( aDocTags[i].tag !== 'param' ) { continue; } aMatch = rEgexMatchType.exec(aDocTags[i].content); iParamNameIndex = aDocTags[i].content.indexOf(sParamName); if ( aMatch && iParamNameIndex > -1 ) { //get the match without the curly brackets sParamType = aMatch[1]; iDocStartIndex = iParamNameIndex + sParamName.length; sParamDescription = aDocTags[i].content.substr(iDocStartIndex); //clean the doc from - symbol if they come after the param name and trim the extra whitespace sParamDescription = sParamDescription.replace(/[-]/, '').trim(); // prevent unnecessary looping! break; } } return { name: sParamName, type: sParamType, doc: sParamDescription }; }
[ "function", "getParamInfo", "(", "sParamName", ",", "aDocTags", ")", "{", "//set default parameter type if there are no @ definitions for the type", "var", "sParamType", "=", "''", ",", "sParamDescription", "=", "''", ",", "iParamNameIndex", ",", "iDocStartIndex", ",", "rEgexMatchType", "=", "/", "{(.*)}", "/", ",", "aMatch", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "aDocTags", ".", "length", ";", "i", "++", ")", "{", "if", "(", "aDocTags", "[", "i", "]", ".", "tag", "!==", "'param'", ")", "{", "continue", ";", "}", "aMatch", "=", "rEgexMatchType", ".", "exec", "(", "aDocTags", "[", "i", "]", ".", "content", ")", ";", "iParamNameIndex", "=", "aDocTags", "[", "i", "]", ".", "content", ".", "indexOf", "(", "sParamName", ")", ";", "if", "(", "aMatch", "&&", "iParamNameIndex", ">", "-", "1", ")", "{", "//get the match without the curly brackets", "sParamType", "=", "aMatch", "[", "1", "]", ";", "iDocStartIndex", "=", "iParamNameIndex", "+", "sParamName", ".", "length", ";", "sParamDescription", "=", "aDocTags", "[", "i", "]", ".", "content", ".", "substr", "(", "iDocStartIndex", ")", ";", "//clean the doc from - symbol if they come after the param name and trim the extra whitespace", "sParamDescription", "=", "sParamDescription", ".", "replace", "(", "/", "[-]", "/", ",", "''", ")", ".", "trim", "(", ")", ";", "// prevent unnecessary looping!", "break", ";", "}", "}", "return", "{", "name", ":", "sParamName", ",", "type", ":", "sParamType", ",", "doc", ":", "sParamDescription", "}", ";", "}" ]
Get the documentation information needed for a given parameter @param {string} sParamName Name of the parameter to be fetched @param {array} aDocTags With documentation tags @return {Object} Parameter information
[ "Get", "the", "documentation", "information", "needed", "for", "a", "given", "parameter" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.demokit/src/sap/ui/demokit/util/jsanalyzer/ModuleAnalyzer.js#L497-L536
4,174
SAP/openui5
src/sap.ui.core/src/sap/ui/core/mvc/HTMLViewRenderer.js
function(oControl) { var sTemp = HTMLViewRenderer._getHTML(rm, oControl, sHTML); if (sTemp) { sHTML = sTemp; } else { aDeferred.push(oControl); } }
javascript
function(oControl) { var sTemp = HTMLViewRenderer._getHTML(rm, oControl, sHTML); if (sTemp) { sHTML = sTemp; } else { aDeferred.push(oControl); } }
[ "function", "(", "oControl", ")", "{", "var", "sTemp", "=", "HTMLViewRenderer", ".", "_getHTML", "(", "rm", ",", "oControl", ",", "sHTML", ")", ";", "if", "(", "sTemp", ")", "{", "sHTML", "=", "sTemp", ";", "}", "else", "{", "aDeferred", ".", "push", "(", "oControl", ")", ";", "}", "}" ]
helper method to render the controls
[ "helper", "method", "to", "render", "the", "controls" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/mvc/HTMLViewRenderer.js#L54-L61
4,175
SAP/openui5
src/sap.m/src/sap/m/TextArea.js
scrollIntoView
function scrollIntoView() { jQuery(window).scrollTop(0); scrollContainer.scrollTop($this.offset().top - scrollContainer.offset().top + scrollContainer.scrollTop()); }
javascript
function scrollIntoView() { jQuery(window).scrollTop(0); scrollContainer.scrollTop($this.offset().top - scrollContainer.offset().top + scrollContainer.scrollTop()); }
[ "function", "scrollIntoView", "(", ")", "{", "jQuery", "(", "window", ")", ".", "scrollTop", "(", "0", ")", ";", "scrollContainer", ".", "scrollTop", "(", "$this", ".", "offset", "(", ")", ".", "top", "-", "scrollContainer", ".", "offset", "(", ")", ".", "top", "+", "scrollContainer", ".", "scrollTop", "(", ")", ")", ";", "}" ]
Workaround for the scroll-into-view bug in the WebView Windows Phone 8.1 As the browser does not scroll the window as it should, scroll the parent scroll container to make the hidden text visible
[ "Workaround", "for", "the", "scroll", "-", "into", "-", "view", "bug", "in", "the", "WebView", "Windows", "Phone", "8", ".", "1", "As", "the", "browser", "does", "not", "scroll", "the", "window", "as", "it", "should", "scroll", "the", "parent", "scroll", "container", "to", "make", "the", "hidden", "text", "visible" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.m/src/sap/m/TextArea.js#L746-L749
4,176
SAP/openui5
src/sap.ui.core/src/sap/ui/model/odata/type/Boolean.js
getMessage
function getMessage(sKey, aParameters) { return sap.ui.getCore().getLibraryResourceBundle().getText(sKey, aParameters); }
javascript
function getMessage(sKey, aParameters) { return sap.ui.getCore().getLibraryResourceBundle().getText(sKey, aParameters); }
[ "function", "getMessage", "(", "sKey", ",", "aParameters", ")", "{", "return", "sap", ".", "ui", ".", "getCore", "(", ")", ".", "getLibraryResourceBundle", "(", ")", ".", "getText", "(", "sKey", ",", "aParameters", ")", ";", "}" ]
Returns the locale-dependent text for the given key. Fetches the resource bundle and stores it in the type if necessary. @param {string} sKey the key @param {any[]} aParameters the parameters @returns {string} the locale-dependent text for the key
[ "Returns", "the", "locale", "-", "dependent", "text", "for", "the", "given", "key", ".", "Fetches", "the", "resource", "bundle", "and", "stores", "it", "in", "the", "type", "if", "necessary", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/type/Boolean.js#L36-L38
4,177
SAP/openui5
src/sap.ui.core/src/sap/ui/core/util/DraftEnabledMockServer.js
function(oEvent) { var oNewEntity = oEvent.getParameter("oEntity"); oNewEntity.IsActiveEntity = false; oNewEntity.HasActiveEntity = false; oNewEntity.HasDraftEntity = false; }
javascript
function(oEvent) { var oNewEntity = oEvent.getParameter("oEntity"); oNewEntity.IsActiveEntity = false; oNewEntity.HasActiveEntity = false; oNewEntity.HasDraftEntity = false; }
[ "function", "(", "oEvent", ")", "{", "var", "oNewEntity", "=", "oEvent", ".", "getParameter", "(", "\"oEntity\"", ")", ";", "oNewEntity", ".", "IsActiveEntity", "=", "false", ";", "oNewEntity", ".", "HasActiveEntity", "=", "false", ";", "oNewEntity", ".", "HasDraftEntity", "=", "false", ";", "}" ]
callback function to update draft specific properties post creation
[ "callback", "function", "to", "update", "draft", "specific", "properties", "post", "creation" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/util/DraftEnabledMockServer.js#L30-L35
4,178
SAP/openui5
src/sap.ui.core/src/sap/ui/core/util/DraftEnabledMockServer.js
function(oEvent) { var oXhr = oEvent.getParameter("oXhr"); var oEntry = jQuery.sap.sjax({ url: oXhr.url, dataType: "json" }).data.d; // navigate to draft nodes and delete nodes for (var i = 0; i < this._oDraftMetadata.draftNodes.length; i++) { for (var navprop in this._mEntitySets[this._oDraftMetadata.draftRootName].navprops) { if (this._mEntitySets[this._oDraftMetadata.draftRootName].navprops[navprop].to.entitySet === this._oDraftMetadata.draftNodes[i]) { var oResponse = jQuery.sap.sjax({ url: oEntry[navprop].__deferred.uri, dataType: "json" }); if (oResponse.data && oResponse.data.d && oResponse.data.d.results) { var oNode; for (var j = 0; j < oResponse.data.d.results.length; j++) { oNode = oResponse.data.d.results[j]; jQuery.sap.sjax({ url: oNode.__metadata.uri, type: "DELETE" }); } } } } } }
javascript
function(oEvent) { var oXhr = oEvent.getParameter("oXhr"); var oEntry = jQuery.sap.sjax({ url: oXhr.url, dataType: "json" }).data.d; // navigate to draft nodes and delete nodes for (var i = 0; i < this._oDraftMetadata.draftNodes.length; i++) { for (var navprop in this._mEntitySets[this._oDraftMetadata.draftRootName].navprops) { if (this._mEntitySets[this._oDraftMetadata.draftRootName].navprops[navprop].to.entitySet === this._oDraftMetadata.draftNodes[i]) { var oResponse = jQuery.sap.sjax({ url: oEntry[navprop].__deferred.uri, dataType: "json" }); if (oResponse.data && oResponse.data.d && oResponse.data.d.results) { var oNode; for (var j = 0; j < oResponse.data.d.results.length; j++) { oNode = oResponse.data.d.results[j]; jQuery.sap.sjax({ url: oNode.__metadata.uri, type: "DELETE" }); } } } } } }
[ "function", "(", "oEvent", ")", "{", "var", "oXhr", "=", "oEvent", ".", "getParameter", "(", "\"oXhr\"", ")", ";", "var", "oEntry", "=", "jQuery", ".", "sap", ".", "sjax", "(", "{", "url", ":", "oXhr", ".", "url", ",", "dataType", ":", "\"json\"", "}", ")", ".", "data", ".", "d", ";", "// navigate to draft nodes and delete nodes", "for", "(", "var", "i", "=", "0", ";", "i", "<", "this", ".", "_oDraftMetadata", ".", "draftNodes", ".", "length", ";", "i", "++", ")", "{", "for", "(", "var", "navprop", "in", "this", ".", "_mEntitySets", "[", "this", ".", "_oDraftMetadata", ".", "draftRootName", "]", ".", "navprops", ")", "{", "if", "(", "this", ".", "_mEntitySets", "[", "this", ".", "_oDraftMetadata", ".", "draftRootName", "]", ".", "navprops", "[", "navprop", "]", ".", "to", ".", "entitySet", "===", "this", ".", "_oDraftMetadata", ".", "draftNodes", "[", "i", "]", ")", "{", "var", "oResponse", "=", "jQuery", ".", "sap", ".", "sjax", "(", "{", "url", ":", "oEntry", "[", "navprop", "]", ".", "__deferred", ".", "uri", ",", "dataType", ":", "\"json\"", "}", ")", ";", "if", "(", "oResponse", ".", "data", "&&", "oResponse", ".", "data", ".", "d", "&&", "oResponse", ".", "data", ".", "d", ".", "results", ")", "{", "var", "oNode", ";", "for", "(", "var", "j", "=", "0", ";", "j", "<", "oResponse", ".", "data", ".", "d", ".", "results", ".", "length", ";", "j", "++", ")", "{", "oNode", "=", "oResponse", ".", "data", ".", "d", ".", "results", "[", "j", "]", ";", "jQuery", ".", "sap", ".", "sjax", "(", "{", "url", ":", "oNode", ".", "__metadata", ".", "uri", ",", "type", ":", "\"DELETE\"", "}", ")", ";", "}", "}", "}", "}", "}", "}" ]
callback function to update draft specific properties pre deletion
[ "callback", "function", "to", "update", "draft", "specific", "properties", "pre", "deletion" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/util/DraftEnabledMockServer.js#L37-L64
4,179
SAP/openui5
src/sap.ui.core/src/sap/ui/core/util/DraftEnabledMockServer.js
function(sEntityset, mEntitySets) { var aSemanticKey = []; for (var annotationsProperty in this._oDraftMetadata.annotations) { if (annotationsProperty.lastIndexOf(mEntitySets[sEntityset].type) > -1) { aSemanticKey = this._oDraftMetadata.annotations[annotationsProperty][this._oConstants.COM_SAP_VOCABULARIES_COMMON_V1_SEMANTICKEY] || []; break; } } var aSemanticKeys = []; var element; for (var i = 0; i < aSemanticKey.length; i++) { element = aSemanticKey[i]; for (var key in element) { aSemanticKeys.push(element[key]); } } return aSemanticKeys; }
javascript
function(sEntityset, mEntitySets) { var aSemanticKey = []; for (var annotationsProperty in this._oDraftMetadata.annotations) { if (annotationsProperty.lastIndexOf(mEntitySets[sEntityset].type) > -1) { aSemanticKey = this._oDraftMetadata.annotations[annotationsProperty][this._oConstants.COM_SAP_VOCABULARIES_COMMON_V1_SEMANTICKEY] || []; break; } } var aSemanticKeys = []; var element; for (var i = 0; i < aSemanticKey.length; i++) { element = aSemanticKey[i]; for (var key in element) { aSemanticKeys.push(element[key]); } } return aSemanticKeys; }
[ "function", "(", "sEntityset", ",", "mEntitySets", ")", "{", "var", "aSemanticKey", "=", "[", "]", ";", "for", "(", "var", "annotationsProperty", "in", "this", ".", "_oDraftMetadata", ".", "annotations", ")", "{", "if", "(", "annotationsProperty", ".", "lastIndexOf", "(", "mEntitySets", "[", "sEntityset", "]", ".", "type", ")", ">", "-", "1", ")", "{", "aSemanticKey", "=", "this", ".", "_oDraftMetadata", ".", "annotations", "[", "annotationsProperty", "]", "[", "this", ".", "_oConstants", ".", "COM_SAP_VOCABULARIES_COMMON_V1_SEMANTICKEY", "]", "||", "[", "]", ";", "break", ";", "}", "}", "var", "aSemanticKeys", "=", "[", "]", ";", "var", "element", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "aSemanticKey", ".", "length", ";", "i", "++", ")", "{", "element", "=", "aSemanticKey", "[", "i", "]", ";", "for", "(", "var", "key", "in", "element", ")", "{", "aSemanticKeys", ".", "push", "(", "element", "[", "key", "]", ")", ";", "}", "}", "return", "aSemanticKeys", ";", "}" ]
Returns an array with key of the corresponding "draft-less" entity type @param {string} sEntityset name of the entityset @param {object} mEntitySets @return {object} array with key of the corresponding "draft-less" entity type
[ "Returns", "an", "array", "with", "key", "of", "the", "corresponding", "draft", "-", "less", "entity", "type" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/util/DraftEnabledMockServer.js#L132-L149
4,180
SAP/openui5
src/sap.ui.core/src/sap/ui/core/util/DraftEnabledMockServer.js
function(mEntitySets) { var that = this; this._oDraftMetadata.draftNodes = []; this._oDraftMetadata.draftRootKey = mEntitySets[this._oDraftMetadata.draftRootName].keys.filter(function(x) { return that._calcSemanticKeys(that._oDraftMetadata.draftRootName, mEntitySets).indexOf(x) < 0; })[0]; var oAnnotations = that._oDraftMetadata.annotations; var oEntitySetsAnnotations = oAnnotations.EntityContainer[Object.keys(oAnnotations.EntityContainer)[0]]; //iterate over entitysets annotations for (var sEntityset in oEntitySetsAnnotations) { //get entity set var oEntitySetAnnotations = oEntitySetsAnnotations[sEntityset]; //iterate over annotations of entity set annotations and look for the draft node sets if (oEntitySetAnnotations[that._oConstants.COM_SAP_VOCABULARIES_COMMON_V1_DRAFTNODE]) { this._oDraftMetadata.draftNodes.push(sEntityset); } } for (var j = 0; j < this._oDraftMetadata.draftNodes.length; j++) { this.attachAfter(MockServer.HTTPMETHOD.GET, this._fnDraftAdministrativeData, this._oDraftMetadata.draftNodes[j]); } }
javascript
function(mEntitySets) { var that = this; this._oDraftMetadata.draftNodes = []; this._oDraftMetadata.draftRootKey = mEntitySets[this._oDraftMetadata.draftRootName].keys.filter(function(x) { return that._calcSemanticKeys(that._oDraftMetadata.draftRootName, mEntitySets).indexOf(x) < 0; })[0]; var oAnnotations = that._oDraftMetadata.annotations; var oEntitySetsAnnotations = oAnnotations.EntityContainer[Object.keys(oAnnotations.EntityContainer)[0]]; //iterate over entitysets annotations for (var sEntityset in oEntitySetsAnnotations) { //get entity set var oEntitySetAnnotations = oEntitySetsAnnotations[sEntityset]; //iterate over annotations of entity set annotations and look for the draft node sets if (oEntitySetAnnotations[that._oConstants.COM_SAP_VOCABULARIES_COMMON_V1_DRAFTNODE]) { this._oDraftMetadata.draftNodes.push(sEntityset); } } for (var j = 0; j < this._oDraftMetadata.draftNodes.length; j++) { this.attachAfter(MockServer.HTTPMETHOD.GET, this._fnDraftAdministrativeData, this._oDraftMetadata.draftNodes[j]); } }
[ "function", "(", "mEntitySets", ")", "{", "var", "that", "=", "this", ";", "this", ".", "_oDraftMetadata", ".", "draftNodes", "=", "[", "]", ";", "this", ".", "_oDraftMetadata", ".", "draftRootKey", "=", "mEntitySets", "[", "this", ".", "_oDraftMetadata", ".", "draftRootName", "]", ".", "keys", ".", "filter", "(", "function", "(", "x", ")", "{", "return", "that", ".", "_calcSemanticKeys", "(", "that", ".", "_oDraftMetadata", ".", "draftRootName", ",", "mEntitySets", ")", ".", "indexOf", "(", "x", ")", "<", "0", ";", "}", ")", "[", "0", "]", ";", "var", "oAnnotations", "=", "that", ".", "_oDraftMetadata", ".", "annotations", ";", "var", "oEntitySetsAnnotations", "=", "oAnnotations", ".", "EntityContainer", "[", "Object", ".", "keys", "(", "oAnnotations", ".", "EntityContainer", ")", "[", "0", "]", "]", ";", "//iterate over entitysets annotations", "for", "(", "var", "sEntityset", "in", "oEntitySetsAnnotations", ")", "{", "//get entity set", "var", "oEntitySetAnnotations", "=", "oEntitySetsAnnotations", "[", "sEntityset", "]", ";", "//iterate over annotations of entity set annotations and look for the draft node sets", "if", "(", "oEntitySetAnnotations", "[", "that", ".", "_oConstants", ".", "COM_SAP_VOCABULARIES_COMMON_V1_DRAFTNODE", "]", ")", "{", "this", ".", "_oDraftMetadata", ".", "draftNodes", ".", "push", "(", "sEntityset", ")", ";", "}", "}", "for", "(", "var", "j", "=", "0", ";", "j", "<", "this", ".", "_oDraftMetadata", ".", "draftNodes", ".", "length", ";", "j", "++", ")", "{", "this", ".", "attachAfter", "(", "MockServer", ".", "HTTPMETHOD", ".", "GET", ",", "this", ".", "_fnDraftAdministrativeData", ",", "this", ".", "_oDraftMetadata", ".", "draftNodes", "[", "j", "]", ")", ";", "}", "}" ]
Calculates the draft key of the draft root entityset and a list of all draft nodes @param {object} mEntitySets
[ "Calculates", "the", "draft", "key", "of", "the", "draft", "root", "entityset", "and", "a", "list", "of", "all", "draft", "nodes" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/util/DraftEnabledMockServer.js#L155-L175
4,181
SAP/openui5
src/sap.ui.core/src/sap/ui/core/util/DraftEnabledMockServer.js
function(oEntry) { var oResponse; var fnGrep = function(aContains, aContained) { return aContains.filter(function(x) { return aContained.indexOf(x) < 0; })[0]; }; // navigate to draft nodes and activate nodes for (var i = 0; i < this._oDraftMetadata.draftNodes.length; i++) { for (var navprop in this._mEntitySets[this._oDraftMetadata.draftRootName].navprops) { if (this._mEntitySets[this._oDraftMetadata.draftRootName].navprops[navprop].to.entitySet === this._oDraftMetadata.draftNodes[i]) { oResponse = jQuery.sap.sjax({ url: oEntry[navprop].__deferred.uri, dataType: "json" }); if (oResponse.success && oResponse.data && oResponse.data.d && oResponse.data.d.results) { var oNode; for (var j = 0; j < oResponse.data.d.results.length; j++) { oNode = oResponse.data.d.results[j]; oNode.IsActiveEntity = true; oNode.HasActiveEntity = false; oNode.HasDraftEntity = false; oNode[this._oDraftMetadata.draftRootKey] = this._oConstants.EMPTY_GUID; var aSemanticDraftNodeKeys = this._calcSemanticKeys(this._oDraftMetadata.draftNodes[i], this._mEntitySets); var sDraftKey = fnGrep(this._mEntitySets[this._oDraftMetadata.draftNodes[i]].keys, aSemanticDraftNodeKeys); oNode[sDraftKey] = this._oConstants.EMPTY_GUID; jQuery.sap.sjax({ url: oNode.__metadata.uri, type: "PATCH", data: JSON.stringify(oNode) }); } } } } } oEntry.IsActiveEntity = true; oEntry.HasActiveEntity = false; oEntry.HasDraftEntity = false; oEntry[this._oDraftMetadata.draftRootKey] = this._oConstants.EMPTY_GUID; jQuery.sap.sjax({ url: oEntry.__metadata.uri, type: "PATCH", data: JSON.stringify(oEntry) }); return oEntry; }
javascript
function(oEntry) { var oResponse; var fnGrep = function(aContains, aContained) { return aContains.filter(function(x) { return aContained.indexOf(x) < 0; })[0]; }; // navigate to draft nodes and activate nodes for (var i = 0; i < this._oDraftMetadata.draftNodes.length; i++) { for (var navprop in this._mEntitySets[this._oDraftMetadata.draftRootName].navprops) { if (this._mEntitySets[this._oDraftMetadata.draftRootName].navprops[navprop].to.entitySet === this._oDraftMetadata.draftNodes[i]) { oResponse = jQuery.sap.sjax({ url: oEntry[navprop].__deferred.uri, dataType: "json" }); if (oResponse.success && oResponse.data && oResponse.data.d && oResponse.data.d.results) { var oNode; for (var j = 0; j < oResponse.data.d.results.length; j++) { oNode = oResponse.data.d.results[j]; oNode.IsActiveEntity = true; oNode.HasActiveEntity = false; oNode.HasDraftEntity = false; oNode[this._oDraftMetadata.draftRootKey] = this._oConstants.EMPTY_GUID; var aSemanticDraftNodeKeys = this._calcSemanticKeys(this._oDraftMetadata.draftNodes[i], this._mEntitySets); var sDraftKey = fnGrep(this._mEntitySets[this._oDraftMetadata.draftNodes[i]].keys, aSemanticDraftNodeKeys); oNode[sDraftKey] = this._oConstants.EMPTY_GUID; jQuery.sap.sjax({ url: oNode.__metadata.uri, type: "PATCH", data: JSON.stringify(oNode) }); } } } } } oEntry.IsActiveEntity = true; oEntry.HasActiveEntity = false; oEntry.HasDraftEntity = false; oEntry[this._oDraftMetadata.draftRootKey] = this._oConstants.EMPTY_GUID; jQuery.sap.sjax({ url: oEntry.__metadata.uri, type: "PATCH", data: JSON.stringify(oEntry) }); return oEntry; }
[ "function", "(", "oEntry", ")", "{", "var", "oResponse", ";", "var", "fnGrep", "=", "function", "(", "aContains", ",", "aContained", ")", "{", "return", "aContains", ".", "filter", "(", "function", "(", "x", ")", "{", "return", "aContained", ".", "indexOf", "(", "x", ")", "<", "0", ";", "}", ")", "[", "0", "]", ";", "}", ";", "// navigate to draft nodes and activate nodes", "for", "(", "var", "i", "=", "0", ";", "i", "<", "this", ".", "_oDraftMetadata", ".", "draftNodes", ".", "length", ";", "i", "++", ")", "{", "for", "(", "var", "navprop", "in", "this", ".", "_mEntitySets", "[", "this", ".", "_oDraftMetadata", ".", "draftRootName", "]", ".", "navprops", ")", "{", "if", "(", "this", ".", "_mEntitySets", "[", "this", ".", "_oDraftMetadata", ".", "draftRootName", "]", ".", "navprops", "[", "navprop", "]", ".", "to", ".", "entitySet", "===", "this", ".", "_oDraftMetadata", ".", "draftNodes", "[", "i", "]", ")", "{", "oResponse", "=", "jQuery", ".", "sap", ".", "sjax", "(", "{", "url", ":", "oEntry", "[", "navprop", "]", ".", "__deferred", ".", "uri", ",", "dataType", ":", "\"json\"", "}", ")", ";", "if", "(", "oResponse", ".", "success", "&&", "oResponse", ".", "data", "&&", "oResponse", ".", "data", ".", "d", "&&", "oResponse", ".", "data", ".", "d", ".", "results", ")", "{", "var", "oNode", ";", "for", "(", "var", "j", "=", "0", ";", "j", "<", "oResponse", ".", "data", ".", "d", ".", "results", ".", "length", ";", "j", "++", ")", "{", "oNode", "=", "oResponse", ".", "data", ".", "d", ".", "results", "[", "j", "]", ";", "oNode", ".", "IsActiveEntity", "=", "true", ";", "oNode", ".", "HasActiveEntity", "=", "false", ";", "oNode", ".", "HasDraftEntity", "=", "false", ";", "oNode", "[", "this", ".", "_oDraftMetadata", ".", "draftRootKey", "]", "=", "this", ".", "_oConstants", ".", "EMPTY_GUID", ";", "var", "aSemanticDraftNodeKeys", "=", "this", ".", "_calcSemanticKeys", "(", "this", ".", "_oDraftMetadata", ".", "draftNodes", "[", "i", "]", ",", "this", ".", "_mEntitySets", ")", ";", "var", "sDraftKey", "=", "fnGrep", "(", "this", ".", "_mEntitySets", "[", "this", ".", "_oDraftMetadata", ".", "draftNodes", "[", "i", "]", "]", ".", "keys", ",", "aSemanticDraftNodeKeys", ")", ";", "oNode", "[", "sDraftKey", "]", "=", "this", ".", "_oConstants", ".", "EMPTY_GUID", ";", "jQuery", ".", "sap", ".", "sjax", "(", "{", "url", ":", "oNode", ".", "__metadata", ".", "uri", ",", "type", ":", "\"PATCH\"", ",", "data", ":", "JSON", ".", "stringify", "(", "oNode", ")", "}", ")", ";", "}", "}", "}", "}", "}", "oEntry", ".", "IsActiveEntity", "=", "true", ";", "oEntry", ".", "HasActiveEntity", "=", "false", ";", "oEntry", ".", "HasDraftEntity", "=", "false", ";", "oEntry", "[", "this", ".", "_oDraftMetadata", ".", "draftRootKey", "]", "=", "this", ".", "_oConstants", ".", "EMPTY_GUID", ";", "jQuery", ".", "sap", ".", "sjax", "(", "{", "url", ":", "oEntry", ".", "__metadata", ".", "uri", ",", "type", ":", "\"PATCH\"", ",", "data", ":", "JSON", ".", "stringify", "(", "oEntry", ")", "}", ")", ";", "return", "oEntry", ";", "}" ]
Activates a draft document @param {object} oEntry the draft document
[ "Activates", "a", "draft", "document" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/util/DraftEnabledMockServer.js#L343-L389
4,182
SAP/openui5
src/sap.m/src/sap/m/NotificationListGroup.js
comparePriority
function comparePriority(firstPriority, secondPriority) { if (firstPriority == secondPriority) { return firstPriority; } if ((firstPriority == 'None')) { return secondPriority; } if ((firstPriority == 'Low') && (secondPriority != 'None')) { return secondPriority; } if ((firstPriority == 'Medium') && (secondPriority != 'None' && secondPriority != 'Low')) { return secondPriority; } return firstPriority; }
javascript
function comparePriority(firstPriority, secondPriority) { if (firstPriority == secondPriority) { return firstPriority; } if ((firstPriority == 'None')) { return secondPriority; } if ((firstPriority == 'Low') && (secondPriority != 'None')) { return secondPriority; } if ((firstPriority == 'Medium') && (secondPriority != 'None' && secondPriority != 'Low')) { return secondPriority; } return firstPriority; }
[ "function", "comparePriority", "(", "firstPriority", ",", "secondPriority", ")", "{", "if", "(", "firstPriority", "==", "secondPriority", ")", "{", "return", "firstPriority", ";", "}", "if", "(", "(", "firstPriority", "==", "'None'", ")", ")", "{", "return", "secondPriority", ";", "}", "if", "(", "(", "firstPriority", "==", "'Low'", ")", "&&", "(", "secondPriority", "!=", "'None'", ")", ")", "{", "return", "secondPriority", ";", "}", "if", "(", "(", "firstPriority", "==", "'Medium'", ")", "&&", "(", "secondPriority", "!=", "'None'", "&&", "secondPriority", "!=", "'Low'", ")", ")", "{", "return", "secondPriority", ";", "}", "return", "firstPriority", ";", "}" ]
Compares two priorities and returns the higher one. @private @param {sap.ui.core.Priority} firstPriority First priority string to be compared. @param {sap.ui.core.Priority} secondPriority Second priority string to be compared. @returns {sap.ui.core.Priority} The highest priority.
[ "Compares", "two", "priorities", "and", "returns", "the", "higher", "one", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.m/src/sap/m/NotificationListGroup.js#L468-L486
4,183
SAP/openui5
src/sap.ui.table/src/sap/ui/table/TableSyncExtension.js
function(iIndex, bSelected) { var oTable = this.getTable(); var oRow = oTable.getRows()[iIndex]; if (oRow && bSelected != null) { TableUtils.toggleRowSelection(oTable, oRow.getIndex(), bSelected); } }
javascript
function(iIndex, bSelected) { var oTable = this.getTable(); var oRow = oTable.getRows()[iIndex]; if (oRow && bSelected != null) { TableUtils.toggleRowSelection(oTable, oRow.getIndex(), bSelected); } }
[ "function", "(", "iIndex", ",", "bSelected", ")", "{", "var", "oTable", "=", "this", ".", "getTable", "(", ")", ";", "var", "oRow", "=", "oTable", ".", "getRows", "(", ")", "[", "iIndex", "]", ";", "if", "(", "oRow", "&&", "bSelected", "!=", "null", ")", "{", "TableUtils", ".", "toggleRowSelection", "(", "oTable", ",", "oRow", ".", "getIndex", "(", ")", ",", "bSelected", ")", ";", "}", "}" ]
Sets the selection state of a row. @param {int} iIndex The index of the row in the aggregation. @param {boolean} bSelected Whether the row should be selected.
[ "Sets", "the", "selection", "state", "of", "a", "row", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/TableSyncExtension.js#L20-L27
4,184
SAP/openui5
src/sap.ui.table/src/sap/ui/table/TableSyncExtension.js
function(iIndex, bHovered) { var oTable = this.getTable(); var oRow = oTable.getRows()[iIndex]; if (oRow && bHovered != null) { oRow._setHovered(bHovered); } }
javascript
function(iIndex, bHovered) { var oTable = this.getTable(); var oRow = oTable.getRows()[iIndex]; if (oRow && bHovered != null) { oRow._setHovered(bHovered); } }
[ "function", "(", "iIndex", ",", "bHovered", ")", "{", "var", "oTable", "=", "this", ".", "getTable", "(", ")", ";", "var", "oRow", "=", "oTable", ".", "getRows", "(", ")", "[", "iIndex", "]", ";", "if", "(", "oRow", "&&", "bHovered", "!=", "null", ")", "{", "oRow", ".", "_setHovered", "(", "bHovered", ")", ";", "}", "}" ]
Sets the hover state of a row. @param {int} iIndex The index of the row in the aggregation. @param {boolean} bHovered Whether the row should be hovered.
[ "Sets", "the", "hover", "state", "of", "a", "row", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/TableSyncExtension.js#L35-L42
4,185
SAP/openui5
src/sap.ui.core/src/sap/ui/thirdparty/qunit.js
function( handler ) { var hooks = []; // Hooks are ignored on skipped tests if ( this.skip ) { return hooks; } if ( this.module.testEnvironment && QUnit.objectType( this.module.testEnvironment[ handler ] ) === "function" ) { hooks.push( this.queueHook( this.module.testEnvironment[ handler ], handler ) ); } return hooks; }
javascript
function( handler ) { var hooks = []; // Hooks are ignored on skipped tests if ( this.skip ) { return hooks; } if ( this.module.testEnvironment && QUnit.objectType( this.module.testEnvironment[ handler ] ) === "function" ) { hooks.push( this.queueHook( this.module.testEnvironment[ handler ], handler ) ); } return hooks; }
[ "function", "(", "handler", ")", "{", "var", "hooks", "=", "[", "]", ";", "// Hooks are ignored on skipped tests", "if", "(", "this", ".", "skip", ")", "{", "return", "hooks", ";", "}", "if", "(", "this", ".", "module", ".", "testEnvironment", "&&", "QUnit", ".", "objectType", "(", "this", ".", "module", ".", "testEnvironment", "[", "handler", "]", ")", "===", "\"function\"", ")", "{", "hooks", ".", "push", "(", "this", ".", "queueHook", "(", "this", ".", "module", ".", "testEnvironment", "[", "handler", "]", ",", "handler", ")", ")", ";", "}", "return", "hooks", ";", "}" ]
Currently only used for module level hooks, can be used to add global level ones
[ "Currently", "only", "used", "for", "module", "level", "hooks", "can", "be", "used", "to", "add", "global", "level", "ones" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/thirdparty/qunit.js#L947-L961
4,186
SAP/openui5
src/sap.ui.core/src/sap/ui/thirdparty/qunit.js
generateHash
function generateHash( module, testName ) { var hex, i = 0, hash = 0, str = module + "\x1C" + testName, len = str.length; for ( ; i < len; i++ ) { hash = ( ( hash << 5 ) - hash ) + str.charCodeAt( i ); hash |= 0; } // Convert the possibly negative integer hash code into an 8 character hex string, which isn't // strictly necessary but increases user understanding that the id is a SHA-like hash hex = ( 0x100000000 + hash ).toString( 16 ); if ( hex.length < 8 ) { hex = "0000000" + hex; } return hex.slice( -8 ); }
javascript
function generateHash( module, testName ) { var hex, i = 0, hash = 0, str = module + "\x1C" + testName, len = str.length; for ( ; i < len; i++ ) { hash = ( ( hash << 5 ) - hash ) + str.charCodeAt( i ); hash |= 0; } // Convert the possibly negative integer hash code into an 8 character hex string, which isn't // strictly necessary but increases user understanding that the id is a SHA-like hash hex = ( 0x100000000 + hash ).toString( 16 ); if ( hex.length < 8 ) { hex = "0000000" + hex; } return hex.slice( -8 ); }
[ "function", "generateHash", "(", "module", ",", "testName", ")", "{", "var", "hex", ",", "i", "=", "0", ",", "hash", "=", "0", ",", "str", "=", "module", "+", "\"\\x1C\"", "+", "testName", ",", "len", "=", "str", ".", "length", ";", "for", "(", ";", "i", "<", "len", ";", "i", "++", ")", "{", "hash", "=", "(", "(", "hash", "<<", "5", ")", "-", "hash", ")", "+", "str", ".", "charCodeAt", "(", "i", ")", ";", "hash", "|=", "0", ";", "}", "// Convert the possibly negative integer hash code into an 8 character hex string, which isn't", "// strictly necessary but increases user understanding that the id is a SHA-like hash", "hex", "=", "(", "0x100000000", "+", "hash", ")", ".", "toString", "(", "16", ")", ";", "if", "(", "hex", ".", "length", "<", "8", ")", "{", "hex", "=", "\"0000000\"", "+", "hex", ";", "}", "return", "hex", ".", "slice", "(", "-", "8", ")", ";", "}" ]
Based on Java's String.hashCode, a simple but not rigorously collision resistant hashing function
[ "Based", "on", "Java", "s", "String", ".", "hashCode", "a", "simple", "but", "not", "rigorously", "collision", "resistant", "hashing", "function" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/thirdparty/qunit.js#L1220-L1240
4,187
SAP/openui5
src/sap.ui.core/src/sap/ui/thirdparty/qunit.js
bindCallbacks
function bindCallbacks( o, callbacks, args ) { var prop = QUnit.objectType( o ); if ( prop ) { if ( QUnit.objectType( callbacks[ prop ] ) === "function" ) { return callbacks[ prop ].apply( callbacks, args ); } else { return callbacks[ prop ]; // or undefined } } }
javascript
function bindCallbacks( o, callbacks, args ) { var prop = QUnit.objectType( o ); if ( prop ) { if ( QUnit.objectType( callbacks[ prop ] ) === "function" ) { return callbacks[ prop ].apply( callbacks, args ); } else { return callbacks[ prop ]; // or undefined } } }
[ "function", "bindCallbacks", "(", "o", ",", "callbacks", ",", "args", ")", "{", "var", "prop", "=", "QUnit", ".", "objectType", "(", "o", ")", ";", "if", "(", "prop", ")", "{", "if", "(", "QUnit", ".", "objectType", "(", "callbacks", "[", "prop", "]", ")", "===", "\"function\"", ")", "{", "return", "callbacks", "[", "prop", "]", ".", "apply", "(", "callbacks", ",", "args", ")", ";", "}", "else", "{", "return", "callbacks", "[", "prop", "]", ";", "// or undefined", "}", "}", "}" ]
Call the o related callback with the given arguments.
[ "Call", "the", "o", "related", "callback", "with", "the", "given", "arguments", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/thirdparty/qunit.js#L1427-L1436
4,188
SAP/openui5
src/sap.ui.core/src/sap/ui/thirdparty/qunit.js
function( fn ) { var args, l = fn.length; if ( !l ) { return ""; } args = new Array( l ); while ( l-- ) { // 97 is 'a' args[ l ] = String.fromCharCode( 97 + l ); } return " " + args.join( ", " ) + " "; }
javascript
function( fn ) { var args, l = fn.length; if ( !l ) { return ""; } args = new Array( l ); while ( l-- ) { // 97 is 'a' args[ l ] = String.fromCharCode( 97 + l ); } return " " + args.join( ", " ) + " "; }
[ "function", "(", "fn", ")", "{", "var", "args", ",", "l", "=", "fn", ".", "length", ";", "if", "(", "!", "l", ")", "{", "return", "\"\"", ";", "}", "args", "=", "new", "Array", "(", "l", ")", ";", "while", "(", "l", "--", ")", "{", "// 97 is 'a'", "args", "[", "l", "]", "=", "String", ".", "fromCharCode", "(", "97", "+", "l", ")", ";", "}", "return", "\" \"", "+", "args", ".", "join", "(", "\", \"", ")", "+", "\" \"", ";", "}" ]
function calls it internally, it's the arguments part of the function
[ "function", "calls", "it", "internally", "it", "s", "the", "arguments", "part", "of", "the", "function" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/thirdparty/qunit.js#L1864-L1879
4,189
SAP/openui5
src/sap.ui.core/src/sap/ui/thirdparty/qunit.js
escapeText
function escapeText( s ) { if ( !s ) { return ""; } s = s + ""; // Both single quotes and double quotes (for attributes) return s.replace( /['"<>&]/g, function( s ) { switch ( s ) { case "'": return "&#039;"; case "\"": return "&quot;"; case "<": return "&lt;"; case ">": return "&gt;"; case "&": return "&amp;"; } }); }
javascript
function escapeText( s ) { if ( !s ) { return ""; } s = s + ""; // Both single quotes and double quotes (for attributes) return s.replace( /['"<>&]/g, function( s ) { switch ( s ) { case "'": return "&#039;"; case "\"": return "&quot;"; case "<": return "&lt;"; case ">": return "&gt;"; case "&": return "&amp;"; } }); }
[ "function", "escapeText", "(", "s", ")", "{", "if", "(", "!", "s", ")", "{", "return", "\"\"", ";", "}", "s", "=", "s", "+", "\"\"", ";", "// Both single quotes and double quotes (for attributes)", "return", "s", ".", "replace", "(", "/", "['\"<>&]", "/", "g", ",", "function", "(", "s", ")", "{", "switch", "(", "s", ")", "{", "case", "\"'\"", ":", "return", "\"&#039;\"", ";", "case", "\"\\\"\"", ":", "return", "\"&quot;\"", ";", "case", "\"<\"", ":", "return", "\"&lt;\"", ";", "case", "\">\"", ":", "return", "\"&gt;\"", ";", "case", "\"&\"", ":", "return", "\"&amp;\"", ";", "}", "}", ")", ";", "}" ]
Escape text for attribute or text content.
[ "Escape", "text", "for", "attribute", "or", "text", "content", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/thirdparty/qunit.js#L3162-L3183
4,190
SAP/openui5
src/sap.uxap/src/sap/uxap/component/Component.js
function () { //step1: create model from configuration this._oModel = null; //internal component model this._oViewConfig = { //internal view configuration viewData: { component: this } }; //step2: load model from the component configuration switch (this.oComponentData.mode) { case ObjectPageConfigurationMode.JsonURL: // jsonUrl bootstraps the ObjectPageLayout on a json config url jsonConfigurationURL // case 1: load from an XML view + json for the object page layout configuration this._oModel = new UIComponent(this.oComponentData.jsonConfigurationURL); this._oViewConfig.viewName = "sap.uxap.component.ObjectPageLayoutUXDrivenFactory"; this._oViewConfig.type = ViewType.XML; break; case ObjectPageConfigurationMode.JsonModel: // JsonModel bootstraps the ObjectPageLayout from the external model objectPageLayoutMedatadata this._oViewConfig.viewName = "sap.uxap.component.ObjectPageLayoutUXDrivenFactory"; this._oViewConfig.type = ViewType.XML; break; default: Log.error("UxAPComponent :: missing bootstrap information. Expecting one of the following: JsonURL, JsonModel and FacetsAnnotation"); } //create the UIComponent UIComponent.prototype.init.call(this); }
javascript
function () { //step1: create model from configuration this._oModel = null; //internal component model this._oViewConfig = { //internal view configuration viewData: { component: this } }; //step2: load model from the component configuration switch (this.oComponentData.mode) { case ObjectPageConfigurationMode.JsonURL: // jsonUrl bootstraps the ObjectPageLayout on a json config url jsonConfigurationURL // case 1: load from an XML view + json for the object page layout configuration this._oModel = new UIComponent(this.oComponentData.jsonConfigurationURL); this._oViewConfig.viewName = "sap.uxap.component.ObjectPageLayoutUXDrivenFactory"; this._oViewConfig.type = ViewType.XML; break; case ObjectPageConfigurationMode.JsonModel: // JsonModel bootstraps the ObjectPageLayout from the external model objectPageLayoutMedatadata this._oViewConfig.viewName = "sap.uxap.component.ObjectPageLayoutUXDrivenFactory"; this._oViewConfig.type = ViewType.XML; break; default: Log.error("UxAPComponent :: missing bootstrap information. Expecting one of the following: JsonURL, JsonModel and FacetsAnnotation"); } //create the UIComponent UIComponent.prototype.init.call(this); }
[ "function", "(", ")", "{", "//step1: create model from configuration", "this", ".", "_oModel", "=", "null", ";", "//internal component model", "this", ".", "_oViewConfig", "=", "{", "//internal view configuration", "viewData", ":", "{", "component", ":", "this", "}", "}", ";", "//step2: load model from the component configuration", "switch", "(", "this", ".", "oComponentData", ".", "mode", ")", "{", "case", "ObjectPageConfigurationMode", ".", "JsonURL", ":", "// jsonUrl bootstraps the ObjectPageLayout on a json config url jsonConfigurationURL", "// case 1: load from an XML view + json for the object page layout configuration", "this", ".", "_oModel", "=", "new", "UIComponent", "(", "this", ".", "oComponentData", ".", "jsonConfigurationURL", ")", ";", "this", ".", "_oViewConfig", ".", "viewName", "=", "\"sap.uxap.component.ObjectPageLayoutUXDrivenFactory\"", ";", "this", ".", "_oViewConfig", ".", "type", "=", "ViewType", ".", "XML", ";", "break", ";", "case", "ObjectPageConfigurationMode", ".", "JsonModel", ":", "// JsonModel bootstraps the ObjectPageLayout from the external model objectPageLayoutMedatadata", "this", ".", "_oViewConfig", ".", "viewName", "=", "\"sap.uxap.component.ObjectPageLayoutUXDrivenFactory\"", ";", "this", ".", "_oViewConfig", ".", "type", "=", "ViewType", ".", "XML", ";", "break", ";", "default", ":", "Log", ".", "error", "(", "\"UxAPComponent :: missing bootstrap information. Expecting one of the following: JsonURL, JsonModel and FacetsAnnotation\"", ")", ";", "}", "//create the UIComponent", "UIComponent", ".", "prototype", ".", "init", ".", "call", "(", "this", ")", ";", "}" ]
initialize the view containing the objectPageLayout
[ "initialize", "the", "view", "containing", "the", "objectPageLayout" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.uxap/src/sap/uxap/component/Component.js#L28-L57
4,191
SAP/openui5
src/sap.uxap/src/sap/uxap/component/Component.js
function () { var oController; //step3: create view this._oView = sap.ui.view(this._oViewConfig); //step4: bind the view with the model if (this._oModel) { oController = this._oView.getController(); //some factory requires pre-processing once the view and model are created if (oController && oController.connectToComponent) { oController.connectToComponent(this._oModel); } //can now apply the model and rely on the underlying factory logic this._oView.setModel(this._oModel, "objectPageLayoutMetadata"); } return this._oView; }
javascript
function () { var oController; //step3: create view this._oView = sap.ui.view(this._oViewConfig); //step4: bind the view with the model if (this._oModel) { oController = this._oView.getController(); //some factory requires pre-processing once the view and model are created if (oController && oController.connectToComponent) { oController.connectToComponent(this._oModel); } //can now apply the model and rely on the underlying factory logic this._oView.setModel(this._oModel, "objectPageLayoutMetadata"); } return this._oView; }
[ "function", "(", ")", "{", "var", "oController", ";", "//step3: create view", "this", ".", "_oView", "=", "sap", ".", "ui", ".", "view", "(", "this", ".", "_oViewConfig", ")", ";", "//step4: bind the view with the model", "if", "(", "this", ".", "_oModel", ")", "{", "oController", "=", "this", ".", "_oView", ".", "getController", "(", ")", ";", "//some factory requires pre-processing once the view and model are created", "if", "(", "oController", "&&", "oController", ".", "connectToComponent", ")", "{", "oController", ".", "connectToComponent", "(", "this", ".", "_oModel", ")", ";", "}", "//can now apply the model and rely on the underlying factory logic", "this", ".", "_oView", ".", "setModel", "(", "this", ".", "_oModel", ",", "\"objectPageLayoutMetadata\"", ")", ";", "}", "return", "this", ".", "_oView", ";", "}" ]
Create view corresponding to the chosen config @returns {sap.ui.view} Created view
[ "Create", "view", "corresponding", "to", "the", "chosen", "config" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.uxap/src/sap/uxap/component/Component.js#L63-L83
4,192
SAP/openui5
src/sap.uxap/src/sap/uxap/component/Component.js
function (vName) { if (this.oComponentData.mode === ObjectPageConfigurationMode.JsonModel) { var oController = this._oView.getController(); //some factory requires post-processing once the view and model are created if (oController && oController.connectToComponent) { oController.connectToComponent(this.getModel("objectPageLayoutMetadata")); } } return UIComponent.prototype.propagateProperties.apply(this, arguments); }
javascript
function (vName) { if (this.oComponentData.mode === ObjectPageConfigurationMode.JsonModel) { var oController = this._oView.getController(); //some factory requires post-processing once the view and model are created if (oController && oController.connectToComponent) { oController.connectToComponent(this.getModel("objectPageLayoutMetadata")); } } return UIComponent.prototype.propagateProperties.apply(this, arguments); }
[ "function", "(", "vName", ")", "{", "if", "(", "this", ".", "oComponentData", ".", "mode", "===", "ObjectPageConfigurationMode", ".", "JsonModel", ")", "{", "var", "oController", "=", "this", ".", "_oView", ".", "getController", "(", ")", ";", "//some factory requires post-processing once the view and model are created", "if", "(", "oController", "&&", "oController", ".", "connectToComponent", ")", "{", "oController", ".", "connectToComponent", "(", "this", ".", "getModel", "(", "\"objectPageLayoutMetadata\"", ")", ")", ";", "}", "}", "return", "UIComponent", ".", "prototype", ".", "propagateProperties", ".", "apply", "(", "this", ",", "arguments", ")", ";", "}" ]
traps propagated properties for postprocessing on useExternalModel cases @param {*} vName the name of the property @returns {*} result of the function
[ "traps", "propagated", "properties", "for", "postprocessing", "on", "useExternalModel", "cases" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.uxap/src/sap/uxap/component/Component.js#L90-L101
4,193
SAP/openui5
src/sap.uxap/src/sap/uxap/component/Component.js
function () { if (this._oView) { this._oView.destroy(); this._oView = null; } if (this._oModel) { this._oModel.destroy(); this._oModel = null; } if (UIComponent.prototype.destroy) { UIComponent.prototype.destroy.call(this); } }
javascript
function () { if (this._oView) { this._oView.destroy(); this._oView = null; } if (this._oModel) { this._oModel.destroy(); this._oModel = null; } if (UIComponent.prototype.destroy) { UIComponent.prototype.destroy.call(this); } }
[ "function", "(", ")", "{", "if", "(", "this", ".", "_oView", ")", "{", "this", ".", "_oView", ".", "destroy", "(", ")", ";", "this", ".", "_oView", "=", "null", ";", "}", "if", "(", "this", ".", "_oModel", ")", "{", "this", ".", "_oModel", ".", "destroy", "(", ")", ";", "this", ".", "_oModel", "=", "null", ";", "}", "if", "(", "UIComponent", ".", "prototype", ".", "destroy", ")", "{", "UIComponent", ".", "prototype", ".", "destroy", ".", "call", "(", "this", ")", ";", "}", "}" ]
destroy the view and model before exiting
[ "destroy", "the", "view", "and", "model", "before", "exiting" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.uxap/src/sap/uxap/component/Component.js#L106-L120
4,194
SAP/openui5
src/sap.ui.core/src/sap/ui/core/FocusHandler.js
function(sControlId, sRelatedControlId, oCore){ var oControl = sControlId ? oCore && oCore.byId(sControlId) : null; if (oControl) { var oRelatedControl = sRelatedControlId ? oCore.byId(sRelatedControlId) : null; var oEvent = jQuery.Event("sapfocusleave"); oEvent.target = oControl.getDomRef(); oEvent.relatedControlId = oRelatedControl ? oRelatedControl.getId() : null; oEvent.relatedControlFocusInfo = oRelatedControl ? oRelatedControl.getFocusInfo() : null; //TODO: Cleanup the popup! The following is shit var oControlUIArea = oControl.getUIArea(); var oUiArea = null; if (oControlUIArea) { oUiArea = oCore.getUIArea(oControlUIArea.getId()); } else { var oPopupUIAreaDomRef = oCore.getStaticAreaRef(); if (containsOrEquals(oPopupUIAreaDomRef, oEvent.target)) { oUiArea = oCore.getUIArea(oPopupUIAreaDomRef.id); } } if (oUiArea) { oUiArea._handleEvent(oEvent); } } }
javascript
function(sControlId, sRelatedControlId, oCore){ var oControl = sControlId ? oCore && oCore.byId(sControlId) : null; if (oControl) { var oRelatedControl = sRelatedControlId ? oCore.byId(sRelatedControlId) : null; var oEvent = jQuery.Event("sapfocusleave"); oEvent.target = oControl.getDomRef(); oEvent.relatedControlId = oRelatedControl ? oRelatedControl.getId() : null; oEvent.relatedControlFocusInfo = oRelatedControl ? oRelatedControl.getFocusInfo() : null; //TODO: Cleanup the popup! The following is shit var oControlUIArea = oControl.getUIArea(); var oUiArea = null; if (oControlUIArea) { oUiArea = oCore.getUIArea(oControlUIArea.getId()); } else { var oPopupUIAreaDomRef = oCore.getStaticAreaRef(); if (containsOrEquals(oPopupUIAreaDomRef, oEvent.target)) { oUiArea = oCore.getUIArea(oPopupUIAreaDomRef.id); } } if (oUiArea) { oUiArea._handleEvent(oEvent); } } }
[ "function", "(", "sControlId", ",", "sRelatedControlId", ",", "oCore", ")", "{", "var", "oControl", "=", "sControlId", "?", "oCore", "&&", "oCore", ".", "byId", "(", "sControlId", ")", ":", "null", ";", "if", "(", "oControl", ")", "{", "var", "oRelatedControl", "=", "sRelatedControlId", "?", "oCore", ".", "byId", "(", "sRelatedControlId", ")", ":", "null", ";", "var", "oEvent", "=", "jQuery", ".", "Event", "(", "\"sapfocusleave\"", ")", ";", "oEvent", ".", "target", "=", "oControl", ".", "getDomRef", "(", ")", ";", "oEvent", ".", "relatedControlId", "=", "oRelatedControl", "?", "oRelatedControl", ".", "getId", "(", ")", ":", "null", ";", "oEvent", ".", "relatedControlFocusInfo", "=", "oRelatedControl", "?", "oRelatedControl", ".", "getFocusInfo", "(", ")", ":", "null", ";", "//TODO: Cleanup the popup! The following is shit", "var", "oControlUIArea", "=", "oControl", ".", "getUIArea", "(", ")", ";", "var", "oUiArea", "=", "null", ";", "if", "(", "oControlUIArea", ")", "{", "oUiArea", "=", "oCore", ".", "getUIArea", "(", "oControlUIArea", ".", "getId", "(", ")", ")", ";", "}", "else", "{", "var", "oPopupUIAreaDomRef", "=", "oCore", ".", "getStaticAreaRef", "(", ")", ";", "if", "(", "containsOrEquals", "(", "oPopupUIAreaDomRef", ",", "oEvent", ".", "target", ")", ")", "{", "oUiArea", "=", "oCore", ".", "getUIArea", "(", "oPopupUIAreaDomRef", ".", "id", ")", ";", "}", "}", "if", "(", "oUiArea", ")", "{", "oUiArea", ".", "_handleEvent", "(", "oEvent", ")", ";", "}", "}", "}" ]
Calls the onsapfocusleave function on the control with id sControlId with the information about the given related control. @param {string} sControlId @param {string} sRelatedControlId @private
[ "Calls", "the", "onsapfocusleave", "function", "on", "the", "control", "with", "id", "sControlId", "with", "the", "information", "about", "the", "given", "related", "control", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/FocusHandler.js#L302-L325
4,195
SAP/openui5
src/sap.ui.core/src/sap/ui/core/date/Japanese.js
toJapanese
function toJapanese(oGregorian) { var iEra = UniversalDate.getEraByDate(CalendarType.Japanese, oGregorian.year, oGregorian.month, oGregorian.day), iEraStartYear = UniversalDate.getEraStartDate(CalendarType.Japanese, iEra).year; return { era: iEra, year: oGregorian.year - iEraStartYear + 1, month: oGregorian.month, day: oGregorian.day }; }
javascript
function toJapanese(oGregorian) { var iEra = UniversalDate.getEraByDate(CalendarType.Japanese, oGregorian.year, oGregorian.month, oGregorian.day), iEraStartYear = UniversalDate.getEraStartDate(CalendarType.Japanese, iEra).year; return { era: iEra, year: oGregorian.year - iEraStartYear + 1, month: oGregorian.month, day: oGregorian.day }; }
[ "function", "toJapanese", "(", "oGregorian", ")", "{", "var", "iEra", "=", "UniversalDate", ".", "getEraByDate", "(", "CalendarType", ".", "Japanese", ",", "oGregorian", ".", "year", ",", "oGregorian", ".", "month", ",", "oGregorian", ".", "day", ")", ",", "iEraStartYear", "=", "UniversalDate", ".", "getEraStartDate", "(", "CalendarType", ".", "Japanese", ",", "iEra", ")", ".", "year", ";", "return", "{", "era", ":", "iEra", ",", "year", ":", "oGregorian", ".", "year", "-", "iEraStartYear", "+", "1", ",", "month", ":", "oGregorian", ".", "month", ",", "day", ":", "oGregorian", ".", "day", "}", ";", "}" ]
Find the matching japanese date for the given gregorian date @param {object} oGregorian @return {object}
[ "Find", "the", "matching", "japanese", "date", "for", "the", "given", "gregorian", "date" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/date/Japanese.js#L53-L62
4,196
SAP/openui5
src/sap.ui.core/src/sap/ui/core/date/Japanese.js
toGregorian
function toGregorian(oJapanese) { var iEraStartYear = UniversalDate.getEraStartDate(CalendarType.Japanese, oJapanese.era).year; return { year: iEraStartYear + oJapanese.year - 1, month: oJapanese.month, day: oJapanese.day }; }
javascript
function toGregorian(oJapanese) { var iEraStartYear = UniversalDate.getEraStartDate(CalendarType.Japanese, oJapanese.era).year; return { year: iEraStartYear + oJapanese.year - 1, month: oJapanese.month, day: oJapanese.day }; }
[ "function", "toGregorian", "(", "oJapanese", ")", "{", "var", "iEraStartYear", "=", "UniversalDate", ".", "getEraStartDate", "(", "CalendarType", ".", "Japanese", ",", "oJapanese", ".", "era", ")", ".", "year", ";", "return", "{", "year", ":", "iEraStartYear", "+", "oJapanese", ".", "year", "-", "1", ",", "month", ":", "oJapanese", ".", "month", ",", "day", ":", "oJapanese", ".", "day", "}", ";", "}" ]
Calculate gregorian year from japanes era and year @param {object} oJapanese @return {int}
[ "Calculate", "gregorian", "year", "from", "japanes", "era", "and", "year" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/date/Japanese.js#L70-L77
4,197
SAP/openui5
src/sap.ui.core/src/sap/ui/core/date/Japanese.js
toGregorianArguments
function toGregorianArguments(aArgs) { var oJapanese, oGregorian, iEra, vYear = aArgs[0]; if (typeof vYear == "number") { if (vYear >= 100) { // Year greater than 100 will be treated as gregorian year return aArgs; } else { // Year less than 100 is emperor year in the current era iEra = UniversalDate.getCurrentEra(CalendarType.Japanese); vYear = [iEra, vYear]; } } else if (!Array.isArray(vYear)) { // Invalid year vYear = []; } oJapanese = { era: vYear[0], year: vYear[1], month: aArgs[1], day: aArgs[2] !== undefined ? aArgs[2] : 1 }; oGregorian = toGregorian(oJapanese); aArgs[0] = oGregorian.year; return aArgs; }
javascript
function toGregorianArguments(aArgs) { var oJapanese, oGregorian, iEra, vYear = aArgs[0]; if (typeof vYear == "number") { if (vYear >= 100) { // Year greater than 100 will be treated as gregorian year return aArgs; } else { // Year less than 100 is emperor year in the current era iEra = UniversalDate.getCurrentEra(CalendarType.Japanese); vYear = [iEra, vYear]; } } else if (!Array.isArray(vYear)) { // Invalid year vYear = []; } oJapanese = { era: vYear[0], year: vYear[1], month: aArgs[1], day: aArgs[2] !== undefined ? aArgs[2] : 1 }; oGregorian = toGregorian(oJapanese); aArgs[0] = oGregorian.year; return aArgs; }
[ "function", "toGregorianArguments", "(", "aArgs", ")", "{", "var", "oJapanese", ",", "oGregorian", ",", "iEra", ",", "vYear", "=", "aArgs", "[", "0", "]", ";", "if", "(", "typeof", "vYear", "==", "\"number\"", ")", "{", "if", "(", "vYear", ">=", "100", ")", "{", "// Year greater than 100 will be treated as gregorian year", "return", "aArgs", ";", "}", "else", "{", "// Year less than 100 is emperor year in the current era", "iEra", "=", "UniversalDate", ".", "getCurrentEra", "(", "CalendarType", ".", "Japanese", ")", ";", "vYear", "=", "[", "iEra", ",", "vYear", "]", ";", "}", "}", "else", "if", "(", "!", "Array", ".", "isArray", "(", "vYear", ")", ")", "{", "// Invalid year", "vYear", "=", "[", "]", ";", "}", "oJapanese", "=", "{", "era", ":", "vYear", "[", "0", "]", ",", "year", ":", "vYear", "[", "1", "]", ",", "month", ":", "aArgs", "[", "1", "]", ",", "day", ":", "aArgs", "[", "2", "]", "!==", "undefined", "?", "aArgs", "[", "2", "]", ":", "1", "}", ";", "oGregorian", "=", "toGregorian", "(", "oJapanese", ")", ";", "aArgs", "[", "0", "]", "=", "oGregorian", ".", "year", ";", "return", "aArgs", ";", "}" ]
Convert arguments array from japanese date to gregorian data @param {object} oJapanese @return {int}
[ "Convert", "arguments", "array", "from", "japanese", "date", "to", "gregorian", "data" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/date/Japanese.js#L85-L112
4,198
SAP/openui5
src/sap.ui.documentation/src/sap/ui/documentation/sdk/controller/BaseController.js
function (oEvent) { var oSource = oEvent.getSource ? oEvent.getSource() : oEvent.target; if (!this.oDisclaimerPopover) { sap.ui.core.Fragment.load({ name: "sap.ui.documentation.sdk.view.LegalDisclaimerPopover" }).then(function (oPopover) { this.oDisclaimerPopover = oPopover; oPopover.openBy(oSource); }.bind(this)); return; // We continue execution in the promise } else if (this.oDisclaimerPopover.isOpen()) { this.oDisclaimerPopover.close(); } this.oDisclaimerPopover.openBy(oSource); }
javascript
function (oEvent) { var oSource = oEvent.getSource ? oEvent.getSource() : oEvent.target; if (!this.oDisclaimerPopover) { sap.ui.core.Fragment.load({ name: "sap.ui.documentation.sdk.view.LegalDisclaimerPopover" }).then(function (oPopover) { this.oDisclaimerPopover = oPopover; oPopover.openBy(oSource); }.bind(this)); return; // We continue execution in the promise } else if (this.oDisclaimerPopover.isOpen()) { this.oDisclaimerPopover.close(); } this.oDisclaimerPopover.openBy(oSource); }
[ "function", "(", "oEvent", ")", "{", "var", "oSource", "=", "oEvent", ".", "getSource", "?", "oEvent", ".", "getSource", "(", ")", ":", "oEvent", ".", "target", ";", "if", "(", "!", "this", ".", "oDisclaimerPopover", ")", "{", "sap", ".", "ui", ".", "core", ".", "Fragment", ".", "load", "(", "{", "name", ":", "\"sap.ui.documentation.sdk.view.LegalDisclaimerPopover\"", "}", ")", ".", "then", "(", "function", "(", "oPopover", ")", "{", "this", ".", "oDisclaimerPopover", "=", "oPopover", ";", "oPopover", ".", "openBy", "(", "oSource", ")", ";", "}", ".", "bind", "(", "this", ")", ")", ";", "return", ";", "// We continue execution in the promise", "}", "else", "if", "(", "this", ".", "oDisclaimerPopover", ".", "isOpen", "(", ")", ")", "{", "this", ".", "oDisclaimerPopover", ".", "close", "(", ")", ";", "}", "this", ".", "oDisclaimerPopover", ".", "openBy", "(", "oSource", ")", ";", "}" ]
Opens a legal disclaimer for Links Popover. @param {sap.ui.base.Event} oEvent: the <code>Image</code> press event @public
[ "Opens", "a", "legal", "disclaimer", "for", "Links", "Popover", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.documentation/src/sap/ui/documentation/sdk/controller/BaseController.js#L134-L152
4,199
SAP/openui5
src/sap.ui.documentation/src/sap/ui/documentation/sdk/controller/BaseController.js
function (sControlName, oControlsData) { var oLibComponentModel = oControlsData.libComponentInfos, oLibInfo = library._getLibraryInfoSingleton(); return oLibInfo._getActualComponent(oLibComponentModel, sControlName); }
javascript
function (sControlName, oControlsData) { var oLibComponentModel = oControlsData.libComponentInfos, oLibInfo = library._getLibraryInfoSingleton(); return oLibInfo._getActualComponent(oLibComponentModel, sControlName); }
[ "function", "(", "sControlName", ",", "oControlsData", ")", "{", "var", "oLibComponentModel", "=", "oControlsData", ".", "libComponentInfos", ",", "oLibInfo", "=", "library", ".", "_getLibraryInfoSingleton", "(", ")", ";", "return", "oLibInfo", ".", "_getActualComponent", "(", "oLibComponentModel", ",", "sControlName", ")", ";", "}" ]
Retrieves the actual component for the control. @param {string} sControlName @return {string} the actual component
[ "Retrieves", "the", "actual", "component", "for", "the", "control", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.documentation/src/sap/ui/documentation/sdk/controller/BaseController.js#L159-L163