_id
stringlengths
2
6
title
stringlengths
0
58
partition
stringclasses
3 values
text
stringlengths
52
373k
language
stringclasses
1 value
meta_information
dict
q18900
train
function(sFormatId) { check(!sFormatId || M_ABAP_TIME_FORMAT_PATTERN.hasOwnProperty(sFormatId), "sFormatId must be one of ['0','1','2','3','4'] or empty"); var mChanges = this.oConfiguration._collect(); this.sLegacyTimeFormat = mChanges.legacyTimeFormat = sFormatId = sFormatId || ""; this.setTimePattern("short", M_ABAP_TIME_FORMAT_PATTERN[sFormatId]["short"]); this.setTimePattern("medium", M_ABAP_TIME_FORMAT_PATTERN[sFormatId]["medium"]); this._setDayPeriods("abbreviated", M_ABAP_TIME_FORMAT_PATTERN[sFormatId].dayPeriods); this.oConfiguration._endCollect(); return this; }
javascript
{ "resource": "" }
q18901
train
function(sFormatId) { sFormatId = sFormatId ? sFormatId.toUpperCase() : ""; check(!sFormatId || M_ABAP_NUMBER_FORMAT_SYMBOLS.hasOwnProperty(sFormatId), "sFormatId must be one of [' ','X','Y'] or empty"); var mChanges = this.oConfiguration._collect(); this.sLegacyNumberFormat = mChanges.legacyNumberFormat = sFormatId; this.setNumberSymbol("group", M_ABAP_NUMBER_FORMAT_SYMBOLS[sFormatId].groupingSeparator); this.setNumberSymbol("decimal", M_ABAP_NUMBER_FORMAT_SYMBOLS[sFormatId].decimalSeparator); this.oConfiguration._endCollect(); return this; }
javascript
{ "resource": "" }
q18902
train
function(aMappings) { check(Array.isArray(aMappings), "aMappings must be an Array"); var mChanges = this.oConfiguration._collect(); this.aLegacyDateCalendarCustomizing = mChanges.legacyDateCalendarCustomizing = aMappings; this.oConfiguration._endCollect(); return this; }
javascript
{ "resource": "" }
q18903
train
function(oEvent) { var oTable = this.getTable(); if (!oTable || TableUtils.getCellInfo(oEvent.target).cell == null) { return; } if (oTable._mTimeouts._cleanupACCExtension) { clearTimeout(oTable._mTimeouts._cleanupACCExtension); oTable._mTimeouts._cleanupACCExtension = null; } this.updateAccForCurrentCell("Focus"); }
javascript
{ "resource": "" }
q18904
train
function(oEvent) { var oTable = this.getTable(); if (!oTable) { return; } oTable.$("sapUiTableGridCnt").attr("role", ExtensionHelper.getAriaAttributesFor(this, "CONTENT", {}).role); oTable._mTimeouts._cleanupACCExtension = setTimeout(function() { var oTable = this.getTable(); if (!oTable) { return; } this._iLastRowNumber = null; this._iLastColumnNumber = null; ExtensionHelper.cleanupCellModifications(this); oTable._mTimeouts._cleanupACCExtension = null; }.bind(this), 100); }
javascript
{ "resource": "" }
q18905
train
function(aPositions) { for (var index = 0; index < aPositions.length; index++) { var oPosition = aPositions[index]; var oChildControl = oPosition.getControl(); if (oChildControl) { AbsoluteLayout.cleanUpControl(oChildControl); } } }
javascript
{ "resource": "" }
q18906
train
function(oControl){ var bAdapted = false; if (oControl.getParent() && oControl.getParent().getComputedPosition) { var oPos = oControl.getParent().getComputedPosition(); if (oPos.top && oPos.bottom || oPos.height) { jQuery(oControl.getDomRef()).css("height", "100%"); bAdapted = true; } if (oPos.left && oPos.right || oPos.width) { jQuery(oControl.getDomRef()).css("width", "100%"); bAdapted = true; } if (bAdapted) { AbsoluteLayoutRenderer.updatePositionStyles(oControl.getParent()); } } return bAdapted; }
javascript
{ "resource": "" }
q18907
train
function(oThis, sProp, oValue, sChangeType) { var bHasDomRef = !!oThis.getDomRef(); oThis.setProperty(sProp, oValue, bHasDomRef); if (bHasDomRef) { oThis.contentChanged(null, sChangeType); } return oThis; }
javascript
{ "resource": "" }
q18908
adjustConstraints
train
function adjustConstraints(oType, oConstraints) { var oAdjustedConstraints = {}; if (oConstraints) { switch (oConstraints.displayFormat) { case "Date": oAdjustedConstraints.isDateOnly = true; break; case undefined: break; default: Log.warning("Illegal displayFormat: " + oConstraints.displayFormat, null, oType.getName()); } oAdjustedConstraints.nullable = oConstraints.nullable; } return oAdjustedConstraints; }
javascript
{ "resource": "" }
q18909
train
function(oTable, iColumnIndex, bHoverFirstMenuItem, oCell) { if (!oTable || iColumnIndex == null || iColumnIndex < 0) { return; } if (bHoverFirstMenuItem == null) { bHoverFirstMenuItem = false; } var oColumns = oTable.getColumns(); if (iColumnIndex >= oColumns.length) { return; } var oColumn = oColumns[iColumnIndex]; if (!oColumn.getVisible()) { return; } // Close all menus. for (var i = 0; i < oColumns.length; i++) { // If column menus of other columns are open, close them. if (oColumns[i] !== oColumn) { MenuUtils.closeColumnContextMenu(oTable, i); } } MenuUtils.closeDataCellContextMenu(oTable); var colspan = oCell && oCell.attr("colspan"); if (colspan && colspan !== "1") { return; // headers with span do not have connection to a column, do not open the context menu } oColumn._openMenu(oCell && oCell[0] || oColumn.getDomRef(), bHoverFirstMenuItem); }
javascript
{ "resource": "" }
q18910
train
function(oTable, iColumnIndex) { if (!oTable || iColumnIndex == null || iColumnIndex < 0) { return; } var oColumns = oTable.getColumns(); if (iColumnIndex >= oColumns.length) { return; } var oColumn = oColumns[iColumnIndex]; oColumn._closeMenu(); }
javascript
{ "resource": "" }
q18911
train
function(oTable) { if (!oTable) { return; } var oMenu = oTable._oCellContextMenu; var bMenuOpen = oMenu != null && oMenu.bOpen; if (bMenuOpen) { oMenu.close(); } }
javascript
{ "resource": "" }
q18912
train
function(oTable) { if (!oTable || !oTable._oCellContextMenu) { return; } oTable._oCellContextMenu.destroy(); oTable._oCellContextMenu = null; }
javascript
{ "resource": "" }
q18913
train
function(assert, mActual, mExpected, sMessage) { var aUnexpectedElements = []; for (var sId in mActual) { if (!mExpected[sId]) { aUnexpectedElements.push(mActual[sId]); } } // enrich with helpful info to more easily identify the leaked control for (var i = 0; i < aUnexpectedElements.length; i++) { if (typeof aUnexpectedElements[i].getText === "function") { aUnexpectedElements[i] += " (text: '" + aUnexpectedElements[i].getText() + "')"; } } sMessage = sMessage + (aUnexpectedElements.length > 0 ? ". LEFTOVERS: " + aUnexpectedElements.join(", ") : ""); assert.equal(aUnexpectedElements.length, 0, sMessage); }
javascript
{ "resource": "" }
q18914
getSortComparator
train
function getSortComparator(fnCompare) { return function(vValue1, vValue2) { if (vValue1 === vValue2) { return 0; } if (vValue1 === null) { return -1; } if (vValue2 === null) { return 1; } return fnCompare(vValue1, vValue2); }; }
javascript
{ "resource": "" }
q18915
reset
train
function reset() { aBuffer = that.aBuffer = []; aRenderedControls = that.aRenderedControls = []; aStyleStack = that.aStyleStack = [{}]; }
javascript
{ "resource": "" }
q18916
triggerBeforeRendering
train
function triggerBeforeRendering(oControl){ bLocked = true; try { var oEvent = jQuery.Event("BeforeRendering"); // store the element on the event (aligned with jQuery syntax) oEvent.srcControl = oControl; oControl._handleEvent(oEvent); } finally { bLocked = false; } }
javascript
{ "resource": "" }
q18917
isDomPatchingEnabled
train
function isDomPatchingEnabled() { if (bDomPatching === undefined) { bDomPatching = sap.ui.getCore().getConfiguration().getDomPatching(); if (bDomPatching) { Log.warning("DOM Patching is enabled: This feature should be used only for testing purposes!"); } } return bDomPatching; }
javascript
{ "resource": "" }
q18918
train
function(oRm, oControl) { if (oControl.getResizeEnabled()) { fnRenderToggler(oRm, oControl); } if (oControl.hasItems()) { if (oControl.getVisibleStatus() == NotificationBarStatus.Max) { fnWriteItemsMaximized(oRm, oControl); } else { fnWriteItemsDefault(oRm, oControl); } } }
javascript
{ "resource": "" }
q18919
train
function(oRm, oNotifier, bMessageNotifier) { var sId = oNotifier.getId(); oRm.write("<li"); oRm.writeElementData(oNotifier); oRm.addClass("sapUiNotifier"); oRm.writeClasses(); // ItemNavigation can only handle focusable items oRm.writeAttribute("tabindex", "-1"); oRm.writeAttribute("aria-describedby", sId + '-description>'); oRm.write(">"); // li element fnWriteNotifierIcon(oRm, oNotifier.getIcon(), bMessageNotifier); // adding an element to enable a oRm.write('<div id="' + sId + '-description"'); oRm.addStyle("display", "none"); oRm.writeStyles(); oRm.write(">"); oRm.write("</div>"); var iCount = oNotifier.getMessages().length; if (iCount > 0) { // opening the div with corresponding classes oRm.write('<div id="' + sId + '-counter" role="tooltip"'); oRm.addClass("sapUiNotifierMessageCount"); if (bMessageNotifier) { oRm.addClass("sapUiMessage"); } oRm.writeClasses(); oRm.write(">"); // write the div's content if (iCount > 99) { iCount = ">99"; } oRm.write(iCount); // closing the div oRm.write("</div>"); } oRm.write("</li>"); // li element }
javascript
{ "resource": "" }
q18920
train
function(oRm, aNotifiers) { for ( var i = 0; i < aNotifiers.length; i++) { fnRenderNotifier(oRm, aNotifiers[i], false); } }
javascript
{ "resource": "" }
q18921
train
function (oRm, sUri, bMessageNotifier) { if (sUri == null || sUri == "") { var icon = new Icon({ useIconTooltip: false }); icon.addStyleClass("sapUiNotifierIcon"); if (bMessageNotifier) { icon.setSrc("sap-icon://alert"); } else { icon.setSrc("sap-icon://notification-2"); } oRm.renderControl(icon); return; } oRm.write("<img alt=\"\""); oRm.addClass("sapUiNotifierIcon"); oRm.writeClasses(); oRm.writeAttributeEscaped("src", sUri); oRm.write("/>"); }
javascript
{ "resource": "" }
q18922
train
function(oRm, oNotifier, oNotiBar) { fnRenderNotifier(oRm, oNotifier, true); fnRenderMessageNotifierMessageArea(oRm, oNotifier, oNotiBar); }
javascript
{ "resource": "" }
q18923
train
function(oRm, oMessageNotifier, oNotiBar) { if (oMessageNotifier.hasItems()) { var aMessages = oMessageNotifier.getMessages(); var lastItem = aMessages[aMessages.length - 1]; var oMA = oMessageNotifier._oMessageArea; // this ensures that this message is selectable from the bar oMA._message = lastItem; var sId = oNotiBar.getId() + "-inplaceMessage-" + oMA._message.getId(); oRm.write("<li"); oRm.writeAttribute("id", sId); oRm.addClass("sapUiInPlaceMessage"); oRm.writeClasses(); if (oNotiBar._gapMessageArea) { var sMargin = oNotiBar._gapMessageArea + "px"; oRm.addStyle("margin-left", sMargin); oRm.writeStyles(); } oRm.write(">"); // oRm.renderControl(oMA); if (lastItem.getText() != "") { oRm.write("<div"); oRm.writeControlData(oMA); // enable inplace message for item navigation oRm.writeAttribute("tabindex", "-1"); oRm.addClass("sapUiNotifierMessageText"); oRm.addClass("sapUiInPlaceMessage"); // if the latest message is read-only don't provide a visual selectable link if (oMessageNotifier._bEnableMessageSelect && !oMA._message.getReadOnly()) { // if there is an event handler show the inplace message // clickable oRm.addClass("sapUiInPlaceMessageSelectable"); } oRm.writeClasses(); oRm.write(">"); oRm.writeEscaped(lastItem.getText()); oRm.write("</div>"); // Text } if (lastItem.getTimestamp() != "") { oRm.write("<div"); oRm.addClass("sapUiNotifierMessageTimestamp"); oRm.addClass("sapUiInPlaceMessage"); oRm.writeClasses(); oRm.write(">"); oRm.writeEscaped(lastItem.getTimestamp()); oRm.write("</div>"); // Timestamp } oRm.write("</li>"); } }
javascript
{ "resource": "" }
q18924
getViewSettingsItemByKey
train
function getViewSettingsItemByKey(aViewSettingsItems, sKey) { var i, oItem; // convenience, also allow strings // find item with this key for (i = 0; i < aViewSettingsItems.length; i++) { if (aViewSettingsItems[i].getKey() === sKey) { oItem = aViewSettingsItems[i]; break; } } return oItem; }
javascript
{ "resource": "" }
q18925
findViewSettingsItemByKey
train
function findViewSettingsItemByKey(vItemOrKey, aViewSettingsItems, sErrorMessage) { var oItem; // convenience, also allow strings if (typeof vItemOrKey === "string") { // find item with this key oItem = getViewSettingsItemByKey(aViewSettingsItems, vItemOrKey); if (!oItem) { Log.error(sErrorMessage); } } else { oItem = vItemOrKey; } return oItem; }
javascript
{ "resource": "" }
q18926
restoreCustomTabContentAggregation
train
function restoreCustomTabContentAggregation(sAggregationName, oCustomTab) { // Make sure page1 exists, as this method may be called on destroy(), after the page was destroyed // Suppress creation of new page as the following logic is needed only when a page already exists if (!this._getPage1(true)) { return; } // only the 'customTabs' aggregation is manipulated with shenanigans if (sAggregationName === 'customTabs' && oCustomTab) { /* oCustomTab must be an instance of the "customTab" aggregation type and must be the last opened page */ if (oCustomTab.getMetadata().getName() === this.getMetadata().getManagedAggregation(sAggregationName).type && this._vContentPage === oCustomTab.getId()) { /* the iContentPage property corresponds to the custom tab id - set the custom tab content aggregation back to the custom tab instance */ var oPage1Content = this._getPage1().getContent(); oPage1Content.forEach(function (oContent) { oCustomTab.addAggregation('content', oContent, true); }); } } else if (!sAggregationName && !oCustomTab) { /* when these parameters are missing, cycle through all custom tabs and detect if any needs manipulation */ var oPage1Content = this._getPage1().getContent(); /* the vContentPage property corresponds to a custom tab id - set the custom tab content aggregation back to the corresponding custom tab instance, so it can be reused later */ this.getCustomTabs().forEach(function (oCustomTab) { if (this._vContentPage === oCustomTab.getId()) { oPage1Content.forEach(function (oContent) { oCustomTab.addAggregation('content', oContent, true); }); } }, this); } }
javascript
{ "resource": "" }
q18927
train
function(sOperator) { this.sOperator = sOperator || StringFilterOperator.StartsWith; switch (this.sOperator) { case StringFilterOperator.Equals: this.fnOperator = fnEquals; break; case StringFilterOperator.Contains: this.fnOperator = fnContains; break; case StringFilterOperator.StartsWith: this.fnOperator = fnStartsWith; break; case StringFilterOperator.AnyWordStartsWith: this.fnOperator = fnAnyWordStartsWith; break; default: //warning when operator has been given but it doesn't match a value from sap.m.StringFilterOperator enum Log.warning("Unknown string compare operator. Use values from sap.m.StringFilterOperator. Default operator should be used."); this.fnOperator = fnContains; break; } }
javascript
{ "resource": "" }
q18928
getText
train
function getText(sKey, aParams) { return sap.ui.getCore().getLibraryResourceBundle().getText(sKey, aParams); }
javascript
{ "resource": "" }
q18929
train
function (oIssue) { var element = sap.ui.getCore().byId(oIssue.context.id), className = ""; if (oIssue.context.id === "WEBPAGE") { className = "sap.ui.core"; } else if (element) { className = element.getMetadata().getName(); } return { severity: oIssue.severity, name: oIssue.rule.title, description: oIssue.rule.description, resolution: oIssue.rule.resolution, resolutionUrls: oIssue.rule.resolutionurls, audiences: oIssue.rule.audiences, categories: oIssue.rule.categories, details: oIssue.details, ruleLibName: oIssue.rule.libName, ruleId: oIssue.rule.id, async: oIssue.rule.async === true, // Ensure async is either true or false minVersion: oIssue.rule.minversion, context: { className: className, id: oIssue.context.id } }; }
javascript
{ "resource": "" }
q18930
train
function (rules, selectedRulesIDs, issues) { var rulesViewModel = {}, issueCount = 0, group = {}, library = {}, rule = {}, rulesCopy = jQuery.extend(true, {}, rules), issuesCopy = jQuery.extend(true, {}, issues); for (group in rulesCopy) { rulesViewModel[group] = jQuery.extend(true, {}, rulesCopy[group].ruleset._mRules); library = rulesViewModel[group]; // Create non-enumerable properties Object.defineProperty(library, 'selected', { enumerable: false, configurable: true, writable: true, value: false }); Object.defineProperty(library, 'issueCount', { enumerable: false, configurable: true, writable: true, value: 0 }); for (rule in rulesCopy[group].ruleset._mRules) { library[rule] = jQuery.extend(true, [], library[rule]); // Create non-enumerable properties Object.defineProperty(library[rule], 'selected', { enumerable: false, configurable: true, writable: true, value: false }); Object.defineProperty(library[rule], 'issueCount', { enumerable: false, configurable: true, writable: true, value: 0 }); // Add selected flag to library and rule level. if (selectedRulesIDs[rule]) { library[rule].selected = true; library.selected = true; } // Add issue count to library and rule level. if (issuesCopy[group] && issuesCopy[group][rule]) { // Not creating a new array to keep the properties. library[rule].push.apply(library[rule], issuesCopy[group][rule]); issueCount = issuesCopy[group][rule].length; library[rule].issueCount = issueCount; library.issueCount += issueCount; } } } return rulesViewModel; }
javascript
{ "resource": "" }
q18931
train
function(oRules) { var index = 0, innerIndex = 0, treeTableModel = {}, rulesViewModel, rule, rules = []; rulesViewModel = this.getRulesViewModel(oRules, [], []); for (var libraryName in rulesViewModel) { treeTableModel[index] = { name: libraryName, id: libraryName + " " + index, selected: true, type: "lib", nodes: rules }; for (var ruleName in rulesViewModel[libraryName]) { rule = rulesViewModel[libraryName][ruleName]; rules.push({ name: rule.title, description: rule.description, id: rule.id, audiences: rule.audiences.toString(), categories: rule.categories.toString(), minversion: rule.minversion, resolution: rule.resolution, title: rule.title, libName: libraryName, selected: true }); innerIndex++; } rules = []; index++; } return treeTableModel; }
javascript
{ "resource": "" }
q18932
train
function(issuesModel) { var treeTableModel = {}, index = 0, innerIndex = 0, issueCount = 0, oSortedSeverityCount, iHighSeverityCount = 0, iMediumSeverityCount = 0, iLowSeverityCount = 0; for (var libName in issuesModel) { treeTableModel[index] = { name: libName, showAudiences: false, showCategories: false, type: "lib" }; for (var rule in issuesModel[libName]) { oSortedSeverityCount = this._sortSeverityIssuesByPriority(issuesModel[libName][rule]); treeTableModel[index][innerIndex] = { formattedName: this._getFormattedName({ name: issuesModel[libName][rule][0].name, highCount: oSortedSeverityCount.high, mediumCount: oSortedSeverityCount.medium, lowCount: oSortedSeverityCount.low, highName: 'H', mediumName: 'M', lowName: 'L'}), name: issuesModel[libName][rule][0].name, showAudiences: true, showCategories: true, categories: issuesModel[libName][rule][0].categories.join(", "), audiences: issuesModel[libName][rule][0].audiences.join(", "), issueCount: issuesModel[libName][rule].length, description: issuesModel[libName][rule][0].description, resolution: issuesModel[libName][rule][0].resolution, type: "rule", ruleLibName: issuesModel[libName][rule][0].ruleLibName, ruleId: issuesModel[libName][rule][0].ruleId, selected: issuesModel[libName][rule][0].selected, details: issuesModel[libName][rule][0].details, severity: issuesModel[libName][rule][0].severity }; issueCount += issuesModel[libName][rule].length; innerIndex++; iHighSeverityCount += oSortedSeverityCount.high; iMediumSeverityCount += oSortedSeverityCount.medium; iLowSeverityCount += oSortedSeverityCount.low; } treeTableModel[index].formattedName = this._getFormattedName({ name: treeTableModel[index].name, highCount: iHighSeverityCount, mediumCount: iMediumSeverityCount, lowCount: iLowSeverityCount, highName: 'High', mediumName: 'Medium', lowName: 'Low' }); treeTableModel[index].name += " (" + issueCount + " issues)"; treeTableModel[index].issueCount = issueCount; issueCount = 0; innerIndex = 0; index++; iHighSeverityCount = 0; iMediumSeverityCount = 0; iLowSeverityCount = 0; } return treeTableModel; }
javascript
{ "resource": "" }
q18933
train
function (oIssues) { var viewModel = []; for (var i = 0; i < oIssues.length; i++) { viewModel.push(_convertIssueToViewModel(oIssues[i])); } return viewModel; }
javascript
{ "resource": "" }
q18934
train
function (oIssues) { var groupedIssues = {}, issue = {}; for (var i = 0; i < oIssues.length; i++) { issue = oIssues[i]; if (!groupedIssues[issue.ruleLibName]) { groupedIssues[issue.ruleLibName] = {}; } if (!groupedIssues[issue.ruleLibName][issue.ruleId]) { groupedIssues[issue.ruleLibName][issue.ruleId] = []; } groupedIssues[issue.ruleLibName][issue.ruleId].push(issue); } return groupedIssues; }
javascript
{ "resource": "" }
q18935
train
function(rm, sClassName, bShouldAdd) { if (sClassName && (!!bShouldAdd || arguments.length == 2)) { rm.addClass(sClassName); if (TAGCONTEXT) { TAGCONTEXT.writeClasses = true; } } return TableRendererUtils; }
javascript
{ "resource": "" }
q18936
train
function(rm, sName, oValue, bShouldAdd) { if (sName && oValue && (!!bShouldAdd || arguments.length == 3)) { rm.addStyle(sName, oValue); if (TAGCONTEXT) { TAGCONTEXT.writeStyles = true; } } return TableRendererUtils; }
javascript
{ "resource": "" }
q18937
train
function(rm, oTable, oConfig) { oConfig = oConfig || {}; rm.write("<", oConfig.tag || "div"); TAGCONTEXT = oConfig; if (oConfig.furtherSettings) { oConfig.furtherSettings(rm, oTable); } if (Array.isArray(oConfig.classname) && oConfig.classname.length) { for (var i = 0; i < oConfig.classname.length; i++) { TableRendererUtils.addClass(rm, oConfig.classname[i]); } } else if (oConfig.classname) { TableRendererUtils.addClass(rm, oConfig.classname); } if (oConfig.id) { rm.writeAttribute("id", (oConfig.element || oTable).getId() + "-" + oConfig.id); } else if (oConfig.element) { if (oConfig.element instanceof Control) { rm.writeControlData(oConfig.element); } else { rm.writeElementData(oConfig.element); } } if (oConfig.attributes) { for (var name in oConfig.attributes) { if (oConfig.attributes.hasOwnProperty(name)) { rm.writeAttribute(name, oConfig.attributes[name]); } } } if (typeof oConfig.tabindex === "number") { rm.writeAttribute("tabindex", "" + oConfig.tabindex); } if (oConfig.aria) { oTable._getAccRenderExtension().writeAriaAttributesFor(rm, oTable, oConfig.aria, oConfig.ariaconfig); } if (TAGCONTEXT.writeClasses) { rm.writeClasses(); } if (TAGCONTEXT.writeStyles) { rm.writeStyles(); } TAGCONTEXT = null; rm.write(">"); return TableRendererUtils; }
javascript
{ "resource": "" }
q18938
train
function(rm, oTable, oConfig) { TableRendererUtils.startElement(rm, oTable, oConfig); TableRendererUtils.endElement(rm, oConfig ? oConfig.tag : null); return TableRendererUtils; }
javascript
{ "resource": "" }
q18939
train
function (listener, listenerContext, priority) { validateListener(listener, 'add'); return this._registerListener(listener, false, listenerContext, priority); }
javascript
{ "resource": "" }
q18940
train
function (listener, context) { validateListener(listener, 'remove'); var i = this._indexOfListener(listener, context); if (i !== -1) { this._bindings[i]._destroy(); //no reason to a SignalBinding exist if it isn't attached to a signal this._bindings.splice(i, 1); } return listener; }
javascript
{ "resource": "" }
q18941
train
function (sRoute, oData) { var oHistory = History.getInstance(); var oPrevHash = oHistory.getPreviousHash(); if (oPrevHash !== undefined) { window.history.go(-1); } else { var bReplace = true; // otherwise we go backwards with a forward history this.navTo(sRoute, oData, bReplace); } }
javascript
{ "resource": "" }
q18942
train
function (o, oExtension, sTypeClass, sNonDefaultValue, bDeepCopy) { if (sTypeClass === "EntitySet" && oExtension.value === sNonDefaultValue) { // potentially nested structure so do deep copy if (bDeepCopy) { jQuery.extend(true, o, mV2ToV4[oExtension.name]); } else { // Warning: Passing false for the first argument is not supported! jQuery.extend(o, mV2ToV4[oExtension.name]); } } }
javascript
{ "resource": "" }
q18943
train
function (sV2AnnotationName, oEntitySet, oProperty) { var aNames = mV2ToV4PropertyCollection[sV2AnnotationName], sTerm = aNames[0], sCollection = aNames[1], oAnnotation = oEntitySet[sTerm] || {}, aCollection = oAnnotation[sCollection] || []; aCollection.push({ "PropertyPath" : oProperty.name }); oAnnotation[sCollection] = aCollection; oEntitySet[sTerm] = oAnnotation; }
javascript
{ "resource": "" }
q18944
train
function (o, oExtension, sTypeClass) { switch (oExtension.name) { case "aggregation-role": if (oExtension.value === "dimension") { o["com.sap.vocabularies.Analytics.v1.Dimension"] = oBoolTrue; } else if (oExtension.value === "measure") { o["com.sap.vocabularies.Analytics.v1.Measure"] = oBoolTrue; } break; case "display-format": if (oExtension.value === "NonNegative") { o["com.sap.vocabularies.Common.v1.IsDigitSequence"] = oBoolTrue; } else if (oExtension.value === "UpperCase") { o["com.sap.vocabularies.Common.v1.IsUpperCase"] = oBoolTrue; } break; case "pageable": case "topable": Utils.addEntitySetAnnotation(o, oExtension, sTypeClass, "false", false); break; case "creatable": Utils.addEntitySetAnnotation(o, oExtension, sTypeClass, "false", true); break; case "deletable": case "deletable-path": Utils.handleXableAndXablePath(o, oExtension, sTypeClass, "Org.OData.Capabilities.V1.DeleteRestrictions", "Deletable"); break; case "updatable": case "updatable-path": Utils.handleXableAndXablePath(o, oExtension, sTypeClass, "Org.OData.Capabilities.V1.UpdateRestrictions", "Updatable"); break; case "requires-filter": Utils.addEntitySetAnnotation(o, oExtension, sTypeClass, "true", true); break; case "field-control": o["com.sap.vocabularies.Common.v1.FieldControl"] = { "Path" : oExtension.value }; break; case "heading": o["com.sap.vocabularies.Common.v1.Heading"] = { "String" : oExtension.value }; break; case "label": o["com.sap.vocabularies.Common.v1.Label"] = { "String" : oExtension.value }; break; case "precision": o["Org.OData.Measures.V1.Scale"] = { "Path" : oExtension.value }; break; case "quickinfo": o["com.sap.vocabularies.Common.v1.QuickInfo"] = { "String" : oExtension.value }; break; case "text": o["com.sap.vocabularies.Common.v1.Text"] = { "Path" : oExtension.value }; break; case "visible": if (oExtension.value === "false") { o["com.sap.vocabularies.Common.v1.FieldControl"] = { "EnumMember" : "com.sap.vocabularies.Common.v1.FieldControlType/Hidden" }; o["com.sap.vocabularies.UI.v1.Hidden"] = oBoolTrue; } break; default: // no transformation for V2 annotation supported or necessary } }
javascript
{ "resource": "" }
q18945
train
function (aArray, vExpectedPropertyValue, sPropertyName) { var i, n; sPropertyName = sPropertyName || "name"; if (aArray) { for (i = 0, n = aArray.length; i < n; i += 1) { if (aArray[i][sPropertyName] === vExpectedPropertyValue) { return i; } } } return -1; }
javascript
{ "resource": "" }
q18946
train
function (aArray, vExpectedPropertyValue, sPropertyName) { var iIndex = Utils.findIndex(aArray, vExpectedPropertyValue, sPropertyName); return iIndex < 0 ? null : aArray[iIndex]; }
javascript
{ "resource": "" }
q18947
train
function (oAnnotations, sQualifiedName, bInContainer) { var o = bInContainer ? oAnnotations.EntityContainer : oAnnotations.propertyAnnotations; return o && o[sQualifiedName] || {}; }
javascript
{ "resource": "" }
q18948
train
function (oEntityContainer, sArrayName, sName, bAsPath) { var k, vResult = bAsPath ? undefined : null; if (oEntityContainer) { k = Utils.findIndex(oEntityContainer[sArrayName], sName); if (k >= 0) { vResult = bAsPath ? oEntityContainer.$path + "/" + sArrayName + "/" + k : oEntityContainer[sArrayName][k]; } } return vResult; }
javascript
{ "resource": "" }
q18949
train
function (vModel, sNamespace) { var oSchema = null, aSchemas = Array.isArray(vModel) ? vModel : vModel.getObject("/dataServices/schema"); if (aSchemas) { aSchemas.forEach(function (o) { if (o.namespace === sNamespace) { oSchema = o; return false; // break } }); } return oSchema; }
javascript
{ "resource": "" }
q18950
train
function (oAnnotations, oData, oMetaModel) { var aSchemas = oData.dataServices.schema; if (!aSchemas) { return; } aSchemas.forEach(function (oSchema, i) { var sSchemaVersion; // remove datajs artefact for inline annotations in $metadata delete oSchema.annotations; Utils.liftSAPData(oSchema); oSchema.$path = "/dataServices/schema/" + i; sSchemaVersion = oSchema["sap:schema-version"]; if (sSchemaVersion) { oSchema["Org.Odata.Core.V1.SchemaVersion"] = { String : sSchemaVersion }; } jQuery.extend(oSchema, oAnnotations[oSchema.namespace]); Utils.visitParents(oSchema, oAnnotations, "association", function (oAssociation, mChildAnnotations) { Utils.visitChildren(oAssociation.end, mChildAnnotations); }); Utils.visitParents(oSchema, oAnnotations, "complexType", function (oComplexType, mChildAnnotations) { Utils.visitChildren(oComplexType.property, mChildAnnotations, "Property"); Utils.addSapSemantics(oComplexType); }); // visit all entity types before visiting the entity sets to ensure that V2 // annotations are already lifted up and can be used for calculating entity // set annotations which are based on V2 annotations on entity properties Utils.visitParents(oSchema, oAnnotations, "entityType", Utils.visitEntityType); Utils.visitParents(oSchema, oAnnotations, "entityContainer", function (oEntityContainer, mChildAnnotations) { Utils.visitChildren(oEntityContainer.associationSet, mChildAnnotations); Utils.visitChildren(oEntityContainer.entitySet, mChildAnnotations, "EntitySet", aSchemas); Utils.visitChildren(oEntityContainer.functionImport, mChildAnnotations, "", null, Utils.visitParameters.bind(this, oAnnotations, oSchema, oEntityContainer)); }); }); Utils.addUnitAnnotations(aSchemas, oMetaModel); }
javascript
{ "resource": "" }
q18951
train
function (aChildren, mChildAnnotations, sTypeClass, aSchemas, fnCallback, iStartIndex) { if (!aChildren) { return; } if (iStartIndex) { aChildren = aChildren.slice(iStartIndex); } aChildren.forEach(function (oChild) { // lift SAP data for easy access to SAP Annotations for OData V 2.0 Utils.liftSAPData(oChild, sTypeClass); }); aChildren.forEach(function (oChild) { var oEntityType; if (sTypeClass === "EntitySet") { // calculated entity set annotations need to be added before V4 // annotations are merged oEntityType = Utils.getObject(aSchemas, "entityType", oChild.entityType); Utils.calculateEntitySetAnnotations(oChild, oEntityType); } if (fnCallback) { fnCallback(oChild); } // merge V4 annotations after child annotations are processed jQuery.extend(oChild, mChildAnnotations[oChild.name || oChild.role]); }); }
javascript
{ "resource": "" }
q18952
train
function (oAnnotations, oSchema, oEntityContainer, oFunctionImport) { var mAnnotations; if (!oFunctionImport.parameter) { return; } mAnnotations = Utils.getChildAnnotations(oAnnotations, oSchema.namespace + "." + oEntityContainer.name, true); oFunctionImport.parameter.forEach( function (oParam) { Utils.liftSAPData(oParam); jQuery.extend(oParam, mAnnotations[oFunctionImport.name + "/" + oParam.name]); } ); }
javascript
{ "resource": "" }
q18953
findIndexInArray
train
function findIndexInArray(aArray, fnPredicate) { if (aArray == null) { throw new TypeError('findIndex called with null or undefined array'); } if (typeof fnPredicate !== 'function') { throw new TypeError('predicate must be a function'); } var iLength = aArray.length; var fnThisArg = arguments[1]; var vValue; for (var iIndex = 0; iIndex < iLength; iIndex++) { vValue = aArray[iIndex]; if (fnPredicate.call(fnThisArg, vValue, iIndex, aArray)) { return iIndex; } } return -1; }
javascript
{ "resource": "" }
q18954
train
function (oEvent) { var iPageY = oEvent.touches && oEvent.touches.length ? oEvent.touches[0].pageY : oEvent.pageY; this._bIsDrag = false; if (!this.getIsExpanded()) { return; } this._stopAnimation(); this._startDrag(iPageY); oEvent.preventDefault(); this._mousedown = true; }
javascript
{ "resource": "" }
q18955
train
function (oEvent) { var iPageY = oEvent.touches && oEvent.touches.length ? oEvent.touches[0].pageY : oEvent.pageY; if (!this._mousedown || !this.getIsExpanded()) { return; } //galaxy s5 android 5.0 fires touchmove every time - so see if it's far enough to call it a drag if (!this._bIsDrag && this._dragSession && this._dragSession.positions.length) { //there is a touch at least 5px away vertically from the initial touch var bFarEnough = this._dragSession.positions.some(function(pos) { return Math.abs(pos.pageY - iPageY) > 5; }); if (bFarEnough) { this._bIsDrag = true; } } this._doDrag(iPageY, oEvent.timeStamp); this._mousedown = true; }
javascript
{ "resource": "" }
q18956
train
function (oEvent) { var iPageY = oEvent.changedTouches && oEvent.changedTouches.length ? oEvent.changedTouches[0].pageY : oEvent.pageY; if (this._bIsDrag === false) { this.fireTap(oEvent); this._dragSession = null; } this._bIsDrag = true; if (!this.getIsExpanded()) { this._dragSession = null; return; } this._endDrag(iPageY, oEvent.timeStamp); this._mousedown = false; }
javascript
{ "resource": "" }
q18957
checkModifierKeys
train
function checkModifierKeys(oEvent, bCtrlKey, bAltKey, bShiftKey) { return oEvent.shiftKey == bShiftKey && oEvent.altKey == bAltKey && getCtrlKey(oEvent) == bCtrlKey; }
javascript
{ "resource": "" }
q18958
train
function (sType) { if (!sType) { return null; } else { // remove core prefix sType = sType.replace("sap.ui.core.", ""); // only take text after last dot var index = sType.lastIndexOf("."); return (index !== -1) ? sType.substr(index + 1) : sType; } }
javascript
{ "resource": "" }
q18959
train
function (controlName) { var oLibComponentModel = data.libComponentInfos; jQuery.sap.require("sap.ui.core.util.LibraryInfo"); var LibraryInfo = sap.ui.require("sap/ui/core/util/LibraryInfo"); var oLibInfo = new LibraryInfo(); var sActualControlComponent = oLibInfo._getActualComponent(oLibComponentModel, controlName); return sActualControlComponent; }
javascript
{ "resource": "" }
q18960
loadOwnDesignTime
train
function loadOwnDesignTime(oMetadata) { if (isPlainObject(oMetadata._oDesignTime) || !oMetadata._oDesignTime) { return Promise.resolve(oMetadata._oDesignTime || {}); } return new Promise(function(fnResolve) { var sModule; if (typeof oMetadata._oDesignTime === "string") { //oMetadata._oDesignTime points to resource path to another file, for example: "sap/ui/core/designtime/<control>.designtime" sModule = oMetadata._oDesignTime; } else { sModule = oMetadata.getName().replace(/\./g, "/") + ".designtime"; } preloadDesigntimeLibrary(oMetadata).then(function(oLib) { sap.ui.require([sModule], function(mDesignTime) { mDesignTime.designtimeModule = sModule; oMetadata._oDesignTime = mDesignTime; mDesignTime._oLib = oLib; fnResolve(mDesignTime); }); }); }); }
javascript
{ "resource": "" }
q18961
getScopeBasedDesignTime
train
function getScopeBasedDesignTime(mMetadata, sScopeKey) { var mResult = mMetadata; if ("default" in mMetadata) { mResult = merge( {}, mMetadata.default, sScopeKey !== "default" && mMetadata[sScopeKey] || null ); } return mResult; }
javascript
{ "resource": "" }
q18962
openExternalLink
train
function openExternalLink (oEvent) { var newWindow = window.open(); newWindow.opener = null; newWindow.location = oEvent.currentTarget.href; oEvent.preventDefault(); }
javascript
{ "resource": "" }
q18963
setMinColWidths
train
function setMinColWidths(oTable) { var oTableRef = oTable.getDomRef(); var iAbsoluteMinWidth = TableUtils.Column.getMinColumnWidth(); var aNotFixedVariableColumns = []; var bColumnHeaderVisible = oTable.getColumnHeaderVisible(); function calcNewWidth(iDomWidth, iMinWidth) { if (iDomWidth <= iMinWidth) { // tolerance of -5px to make the resizing smooother return Math.max(iDomWidth, iMinWidth - 5, iAbsoluteMinWidth) + "px"; } return -1; } function isFixNeeded(col) { var minWidth = Math.max(col._minWidth || 0, iAbsoluteMinWidth, col.getMinWidth()); var colWidth = col.getWidth(); var aColHeaders; var colHeader; var domWidth; // if a column has variable width, check if its current width of the // first corresponding <th> element in less than minimum and store it; // do not change freezed columns if (TableUtils.isVariableWidth(colWidth) && !TableUtils.isFixedColumn(oTable, col.getIndex())) { aColHeaders = oTableRef.querySelectorAll('th[data-sap-ui-colid="' + col.getId() + '"]'); colHeader = aColHeaders[bColumnHeaderVisible ? 0 : 1]; // if column headers have display:none, use data table domWidth = colHeader ? colHeader.offsetWidth : null; if (domWidth !== null) { if (domWidth <= minWidth) { return {headers : aColHeaders, newWidth: calcNewWidth(domWidth, minWidth)}; } else if (colHeader && colHeader.style.width != colWidth) { aNotFixedVariableColumns.push({col: col, header: colHeader, minWidth: minWidth, headers: aColHeaders}); // reset the minimum style width that was set previously return {headers : aColHeaders, newWidth: colWidth}; } aNotFixedVariableColumns.push({col: col, header: colHeader, minWidth: minWidth, headers: aColHeaders}); } } return null; } function adaptColWidth(oColInfo) { if (oColInfo) { Array.prototype.forEach.call(oColInfo.headers, function(header) { header.style.width = oColInfo.newWidth; }); } } // adjust widths of all found column headers oTable._getVisibleColumns().map(isFixNeeded).forEach(adaptColWidth); //Check the rest of the flexible non-adapted columns //Due to adaptations they could be smaller now. if (aNotFixedVariableColumns.length) { var iDomWidth; for (var i = 0; i < aNotFixedVariableColumns.length; i++) { iDomWidth = aNotFixedVariableColumns[i].header && aNotFixedVariableColumns[i].header.offsetWidth; aNotFixedVariableColumns[i].newWidth = calcNewWidth(iDomWidth, aNotFixedVariableColumns[i].minWidth); if (parseInt(aNotFixedVariableColumns[i].newWidth) >= 0) { adaptColWidth(aNotFixedVariableColumns[i]); } } } }
javascript
{ "resource": "" }
q18964
train
function(mArguments) { var sTitle = this._oTitleProvider && this._oTitleProvider.getTitle(); if (sTitle) { this.fireTitleChanged({ name: this._oOptions._name, title: sTitle }); } this._bIsDisplayed = true; return this.fireEvent(this.M_EVENTS.DISPLAY, mArguments); }
javascript
{ "resource": "" }
q18965
train
function(oData, fnFunction, oListener) { var bHasListener = this.hasListeners("titleChanged"), sTitle = this._oTitleProvider && this._oTitleProvider.getTitle(); this.attachEvent(this.M_EVENTS.TITLE_CHANGED, oData, fnFunction, oListener); // in case the title is changed before the first event listener is attached, we need to notify, too if (!bHasListener && sTitle && this._bIsDisplayed) { this.fireTitleChanged({ name: this._oOptions._name, title: sTitle }); } return this; }
javascript
{ "resource": "" }
q18966
callback
train
function callback(mutationsList, observer) { mutationsList.forEach(function (mutation) { if (mutation.type == 'childList') { var addedNodes = mutation.addedNodes, removedNodes = mutation.removedNodes, node, xnode, count, aTags, i; for (count = 0; count < addedNodes.length; count++) { node = addedNodes[count]; if (!document.createCustomElement._querySelector) { return; } if (node.tagName && document.createCustomElement.hasOwnProperty(node.tagName.toLowerCase())) { if (!node._control) { document.createCustomElement[node.tagName.toLowerCase()].connectToNode(node); } node._control._connectedCallback(); } if (node.tagName) { aTags = node.querySelectorAll(document.createCustomElement._querySelector); for (i = 0; i < aTags.length; i++) { xnode = aTags[i]; if (xnode.tagName && document.createCustomElement.hasOwnProperty(xnode.tagName.toLowerCase())) { if (!xnode._control) { document.createCustomElement[xnode.tagName.toLowerCase()].connectToNode(xnode); } xnode._control._connectedCallback(); } } } } for (count = 0; count < removedNodes.length; count++) { node = removedNodes[count]; if (!document.createCustomElement._querySelector) { return; } if (node._control) { node._control._disconnectedCallback(); } if (node.tagName) { aTags = node.querySelectorAll(document.createCustomElement._querySelector); for (i = 0; i < aTags.length; i++) { xnode = aTags[i]; if (xnode._control) { xnode._control._disconnectedCallback(); } } } } } else if (mutation.type === "attributes" && mutation.target && mutation.target._control) { mutation.target._control._changeProperty.call(mutation.target._control, mutation.attributeName, mutation.target.getAttribute(mutation.attributeName)); } }); }
javascript
{ "resource": "" }
q18967
createContextInterface
train
function createContextInterface(oWithControl, mSettings, i, vBindingOrContext) { /* * Returns the single binding or model context related to the current formatter call. * * @param {number} [iPart] * index of part in case of the root formatter of a composite binding * @returns {sap.ui.model.Binding|sap.ui.model.Context} * single binding or model context */ function getBindingOrContext(iPart) { if (!vBindingOrContext) { // lazy initialization // BEWARE: this is not yet defined when createContextInterface() is called! vBindingOrContext = oWithControl.getBinding("any"); if (vBindingOrContext instanceof CompositeBinding) { vBindingOrContext = vBindingOrContext.getBindings(); if (i !== undefined) { // not a root formatter vBindingOrContext = vBindingOrContext[i]; } } } return Array.isArray(vBindingOrContext) ? vBindingOrContext[iPart] : vBindingOrContext; } /** * Returns the resolved path for the given single binding or model context. * * @param {sap.ui.model.Binding|sap.ui.model.Context} oBindingOrContext * single binding or model context * @returns {string} * the resolved path */ function getPath(oBindingOrContext) { return oBindingOrContext instanceof Context ? oBindingOrContext.getPath() : oBindingOrContext.getModel().resolve( oBindingOrContext.getPath(), oBindingOrContext.getContext()); } /** * Context interface provided by XML template processing as an additional first argument to * any formatter function which opts in to this mechanism. Candidates for such formatter * functions are all those used in binding expressions which are evaluated during XML * template processing, including those used inside template instructions like * <code>&lt;template:if></code>. The formatter function needs to be marked with a property * <code>requiresIContext = true</code> to express that it requires this extended signature * (compared to ordinary formatter functions). The usual arguments are provided after the * first one (currently: the raw value from the model). * * This interface provides callback functions to access the model and path which are needed * to process OData V4 annotations. It initially offers a subset of methods from * {@link sap.ui.model.Context} so that formatters might also be called with a context * object for convenience, e.g. outside of XML template processing (see below for an * exception to this rule). * * <b>Example:</b> Suppose you have a formatter function called "foo" like below and it is * used within an XML template like * <code>&lt;template:if test="{path: '...', formatter: 'foo'}"></code>. * In this case <code>foo</code> is called with arguments <code>oInterface, vRawValue</code> * such that * <code>oInterface.getModel().getObject(oInterface.getPath()) === vRawValue</code> holds. * <pre> * window.foo = function (oInterface, vRawValue) { * //TODO ... * }; * window.foo.requiresIContext = true; * </pre> * * <b>Composite Binding Examples:</b> Suppose you have the same formatter function and it is * used in a composite binding like <code>&lt;Text text="{path: 'Label', formatter: 'foo'}: * {path: 'Value', formatter: 'foo'}"/></code>. * In this case <code>oInterface.getPath()</code> refers to ".../Label" in the 1st call and * ".../Value" in the 2nd call. This means each formatter call knows which part of the * composite binding it belongs to and behaves just as if it was an ordinary binding. * * Suppose your formatter is not used within a part of the composite binding, but at the * root of the composite binding in order to aggregate all parts like <code> * &lt;Text text="{parts: [{path: 'Label'}, {path: 'Value'}], formatter: 'foo'}"/></code>. * In this case <code>oInterface.getPath(0)</code> refers to ".../Label" and * <code>oInterface.getPath(1)</code> refers to ".../Value". This means, the root formatter * can access the ith part of the composite binding at will (since 1.31.0); see also * {@link #.getInterface getInterface}. * The function <code>foo</code> is called with arguments such that <code> * oInterface.getModel(i).getObject(oInterface.getPath(i)) === arguments[i + 1]</code> * holds. * This use is not supported within an expression binding, that is, <code>&lt;Text * text="{= ${parts: [{path: 'Label'}, {path: 'Value'}], formatter: 'foo'} }"/></code> * does not work as expected because the property <code>requiresIContext = true</code> is * ignored. * * To distinguish those two use cases, just check whether <code>oInterface.getModel() === * undefined</code>, in which case the formatter is called on root level of a composite * binding. To find out the number of parts, probe for the smallest non-negative integer * where <code>oInterface.getModel(i) === undefined</code>. * This additional functionality is, of course, not available from * {@link sap.ui.model.Context}, i.e. such formatters MUST be called with an instance of * this context interface. * * @interface * @name sap.ui.core.util.XMLPreprocessor.IContext * @public * @since 1.27.1 */ return /** @lends sap.ui.core.util.XMLPreprocessor.IContext */ { /** * Returns a context interface for the indicated part in case of the root formatter of a * composite binding. The new interface provides access to the original settings, but * only to the model and path of the indicated part: * <pre> * this.getInterface(i).getSetting(sName) === this.getSetting(sName); * this.getInterface(i).getModel() === this.getModel(i); * this.getInterface(i).getPath() === this.getPath(i); * </pre> * * If a path is given, the new interface points to the resolved path as follows: * <pre> * this.getInterface(i, "foo/bar").getPath() === this.getPath(i) + "/foo/bar"; * this.getInterface(i, "/absolute/path").getPath() === "/absolute/path"; * </pre> * A formatter which is not at the root level of a composite binding can also provide a * path, but must not provide an index: * <pre> * this.getInterface("foo/bar").getPath() === this.getPath() + "/foo/bar"; * this.getInterface("/absolute/path").getPath() === "/absolute/path"; * </pre> * Note that at least one argument must be present. * * @param {number} [iPart] * index of part in case of the root formatter of a composite binding * @param {string} [sPath] * a path, interpreted relative to <code>this.getPath(iPart)</code> * @returns {sap.ui.core.util.XMLPreprocessor.IContext} * the context interface related to the indicated part * @throws {Error} * In case an index is given but the current interface does not belong to the root * formatter of a composite binding, or in case the given index is invalid (e.g. * missing or out of range), or in case a path is missing because no index is given, * or in case a path is given but the model cannot not create a binding context * synchronously * @public * @since 1.31.0 */ getInterface : function (iPart, sPath) { var oBaseContext, oBindingOrContext, oModel; if (typeof iPart === "string") { sPath = iPart; iPart = undefined; } getBindingOrContext(); // initialize vBindingOrContext if (Array.isArray(vBindingOrContext)) { if (iPart >= 0 && iPart < vBindingOrContext.length) { oBindingOrContext = vBindingOrContext[iPart]; } else { throw new Error("Invalid index of part: " + iPart); } } else if (iPart !== undefined) { throw new Error("Not the root formatter of a composite binding"); } else if (sPath) { oBindingOrContext = vBindingOrContext; } else { throw new Error("Missing path"); } if (sPath) { oModel = oBindingOrContext.getModel(); if (sPath.charAt(0) !== '/') { // relative path needs a base context oBaseContext = oBindingOrContext instanceof Context ? oBindingOrContext : oModel.createBindingContext(oBindingOrContext.getPath(), oBindingOrContext.getContext()); } oBindingOrContext = oModel.createBindingContext(sPath, oBaseContext); if (!oBindingOrContext) { throw new Error( "Model could not create binding context synchronously: " + oModel); } } return createContextInterface(null, mSettings, undefined, oBindingOrContext); }, /** * Returns the model related to the current formatter call. * * @param {number} [iPart] * index of part in case of the root formatter of a composite binding * (since 1.31.0) * @returns {sap.ui.model.Model} * the model related to the current formatter call, or (since 1.31.0) * <code>undefined</code> in case of a root formatter if no <code>iPart</code> is * given or if <code>iPart</code> is out of range * @public */ getModel : function (iPart) { var oBindingOrContext = getBindingOrContext(iPart); return oBindingOrContext && oBindingOrContext.getModel(); }, /** * Returns the absolute path related to the current formatter call. * * @param {number} [iPart] * index of part in case of the root formatter of a composite binding (since 1.31.0) * @returns {string} * the absolute path related to the current formatter call, or (since 1.31.0) * <code>undefined</code> in case of a root formatter if no <code>iPart</code> is * given or if <code>iPart</code> is out of range * @public */ getPath : function (iPart) { var oBindingOrContext = getBindingOrContext(iPart); return oBindingOrContext && getPath(oBindingOrContext); }, /** * Returns the value of the setting with the given name which was provided to the XML * template processing. * * @param {string} sName * the name of the setting * @returns {any} * the value of the setting * @throws {Error} * if the name is one of the reserved names: "bindingContexts", "models" * @public */ getSetting : function (sName) { if (sName === "bindingContexts" || sName === "models") { throw new Error("Illegal argument: " + sName); } return mSettings[sName]; } }; }
javascript
{ "resource": "" }
q18968
getPath
train
function getPath(oBindingOrContext) { return oBindingOrContext instanceof Context ? oBindingOrContext.getPath() : oBindingOrContext.getModel().resolve( oBindingOrContext.getPath(), oBindingOrContext.getContext()); }
javascript
{ "resource": "" }
q18969
getAny
train
function getAny(oWithControl, oBindingInfo, mSettings, oScope, bAsync) { var bValueAsPromise = false; /* * Prepares the given binding info or part of it; makes it "one time" and binds its * formatter function (if opted in) to an interface object. * * @param {object} oInfo * a binding info or a part of it * @param {number} i * index of binding info's part (if applicable) */ function prepare(oInfo, i) { var fnFormatter = oInfo.formatter, oModel, sModelName = oInfo.model; if (oInfo.path && oInfo.path.indexOf(">") > 0) { sModelName = oInfo.path.slice(0, oInfo.path.indexOf(">")); } oModel = oWithControl.getModel(sModelName); if (fnFormatter && fnFormatter.requiresIContext === true) { fnFormatter = oInfo.formatter = fnFormatter.bind(null, createContextInterface(oWithControl, mSettings, i)); } // wrap formatter only if there is a formatter and async is allowed and either // - we use $$valueAsPromise ourselves, or // - we are top-level and at least one child has used $$valueAsPromise if (fnFormatter && bAsync && (oModel && oModel.$$valueAsPromise || i === undefined && bValueAsPromise)) { oInfo.formatter = function () { var that = this; return SyncPromise.all(arguments).then(function (aArguments) { return fnFormatter.apply(that, aArguments); }); }; oInfo.formatter.textFragments = fnFormatter.textFragments; } oInfo.mode = BindingMode.OneTime; oInfo.parameters = oInfo.parameters || {}; oInfo.parameters.scope = oScope; if (bAsync && oModel && oModel.$$valueAsPromise) { // opt-in to async behavior bValueAsPromise = oInfo.parameters.$$valueAsPromise = true; } } try { if (oBindingInfo.parts) { oBindingInfo.parts.forEach(prepare); } prepare(oBindingInfo); oWithControl.bindProperty("any", oBindingInfo); return oWithControl.getBinding("any") ? SyncPromise.resolve(oWithControl.getAny()) : null; } catch (e) { return SyncPromise.reject(e); } finally { oWithControl.unbindProperty("any", true); } }
javascript
{ "resource": "" }
q18970
stopAndGo
train
function stopAndGo(aElements, fnCallback) { var i = -1; /* * Visits the next element, taking the result of the previous callback into account. * * @param {boolean} bFound * Whether an element was approved by the corresponding callback * @returns {sap.ui.base.SyncPromise|any} * First call returns a <code>sap.ui.base.SyncPromise</code> which resolves with a later * call's result. */ function next(bFound) { if (bFound) { return aElements[i]; } i += 1; if (i < aElements.length) { return fnCallback(aElements[i], i, aElements).then(next); } } return aElements.length ? next() : oSyncPromiseResolved; }
javascript
{ "resource": "" }
q18971
train
function (fnVisitor, sNamespace, sLocalName) { var fnOldVisitor = mVisitors[sNamespace]; if (fnVisitor !== null && typeof fnVisitor !== "function" || fnVisitor === visitNodeWrapper) { throw new Error("Invalid visitor: " + fnVisitor); } if (!sNamespace || sNamespace === sNAMESPACE || sNamespace === "sap.ui.core" || sNamespace.indexOf(" ") >= 0) { throw new Error("Invalid namespace: " + sNamespace); } Log.debug("Plug-in visitor for namespace '" + sNamespace + "', local name '" + sLocalName + "'", fnVisitor, sXMLPreprocessor); if (sLocalName) { sNamespace = sNamespace + " " + sLocalName; fnOldVisitor = mVisitors[sNamespace] || fnOldVisitor; } mVisitors[sNamespace] = fnVisitor; return fnOldVisitor || visitNodeWrapper; }
javascript
{ "resource": "" }
q18972
train
function (aElements, fnCallback) { try { return SyncPromise.resolve(stopAndGo(aElements, fnCallback)); } catch (e) { return SyncPromise.reject(e); } }
javascript
{ "resource": "" }
q18973
train
function (sPath) { var oBindingInfo, oModel, sResolvedPath; sPath = sPath || ""; if (sPath[0] === "{") { throw new Error("Must be a simple path, not a binding: " + sPath); } oBindingInfo = BindingParser.simpleParser("{" + sPath + "}"); oModel = oWithControl.getModel(oBindingInfo.model); if (!oModel) { throw new Error("Unknown model '" + oBindingInfo.model + "': " + sPath); } sResolvedPath = oModel.resolve(oBindingInfo.path, oWithControl.getBindingContext(oBindingInfo.model)); if (!sResolvedPath) { throw new Error("Cannot resolve path: " + sPath); } return oModel.createBindingContext(sResolvedPath); }
javascript
{ "resource": "" }
q18974
getResolvedBinding
train
function getResolvedBinding(sValue, oElement, oWithControl, bMandatory, fnCallIfConstant) { var vBindingInfo, oPromise; Measurement.average(sPerformanceGetResolvedBinding, "", aPerformanceCategories); try { vBindingInfo = BindingParser.complexParser(sValue, oScope, bMandatory, true, true, true) || sValue; // in case there is no binding and nothing to unescape } catch (e) { return SyncPromise.reject(e); } if (vBindingInfo.functionsNotFound) { if (bMandatory) { warn(oElement, 'Function name(s)', vBindingInfo.functionsNotFound.join(", "), 'not found'); } Measurement.end(sPerformanceGetResolvedBinding); return null; // treat incomplete bindings as unrelated } if (typeof vBindingInfo === "object") { oPromise = getAny(oWithControl, vBindingInfo, mSettings, oScope, !oViewInfo.sync); if (bMandatory && !oPromise) { warn(oElement, 'Binding not ready'); } else if (oViewInfo.sync && oPromise && oPromise.isPending()) { error("Async formatter in sync view in " + sValue + " of ", oElement); } } else { oPromise = SyncPromise.resolve(vBindingInfo); if (fnCallIfConstant) { // string fnCallIfConstant(); } } Measurement.end(sPerformanceGetResolvedBinding); return oPromise; }
javascript
{ "resource": "" }
q18975
liftChildNodes
train
function liftChildNodes(oParent, oWithControl, oTarget) { return visitChildNodes(oParent, oWithControl).then(function () { var oChild; oTarget = oTarget || oParent; while ((oChild = oParent.firstChild)) { oTarget.parentNode.insertBefore(oChild, oTarget); } }); }
javascript
{ "resource": "" }
q18976
visitAttribute
train
function visitAttribute(oElement, oAttribute, oWithControl) { if (fnSupportInfo) { fnSupportInfo({context:undefined /*context from node clone*/, env:{caller:"visitAttribute", before: {name: oAttribute.name, value: oAttribute.value}}}); } return resolveAttributeBinding(oElement, oAttribute, oWithControl) .then(function () { if (fnSupportInfo) { fnSupportInfo({context:undefined /*context from node clone*/, env:{caller:"visitAttribute", after: {name: oAttribute.name, value: oAttribute.value}}}); } }); }
javascript
{ "resource": "" }
q18977
visitAttributes
train
function visitAttributes(oElement, oWithControl) { /* * Comparator for DOM attributes by name. * * @param {Attr} oAttributeA * @param {Attr} oAttributeB * @returns {number} <0, 0, >0 */ function comparator(oAttributeA, oAttributeB) { return oAttributeA.name.localeCompare(oAttributeB.name); } return stopAndGo( // Note: iterate over a shallow copy to account for removal of attributes! // Note: sort attributes by name to achieve a stable log order across browsers Array.prototype.slice.apply(oElement.attributes).sort(comparator), function (oAttribute) { return visitAttribute(oElement, oAttribute, oWithControl); }); }
javascript
{ "resource": "" }
q18978
visitChildNodes
train
function visitChildNodes(oNode, oWithControl) { return stopAndGo( // cache live collection so that removing a template node does not hurt Array.prototype.slice.apply(oNode.childNodes), function (oChild) { return visitNode(oChild, oWithControl); }); }
javascript
{ "resource": "" }
q18979
visitNode
train
function visitNode(oNode, oWithControl) { var fnVisitor; function visitAttributesAndChildren() { return visitAttributes(oNode, oWithControl).then(function () { return visitChildNodes(oNode, oWithControl); }).then(function () { if (fnSupportInfo) { fnSupportInfo({context:oNode, env:{caller:"visitNode", after: {name: oNode.tagName}}}); } }); } // process only ELEMENT_NODEs if (oNode.nodeType !== 1 /* Node.ELEMENT_NODE */) { return oSyncPromiseResolved; } if (fnSupportInfo) { fnSupportInfo({context:oNode, env:{caller:"visitNode", before: {name: oNode.tagName}}}); } if (oNode.namespaceURI === sNAMESPACE) { switch (oNode.localName) { case "alias": return templateAlias(oNode, oWithControl); case "if": return templateIf(oNode, oWithControl); case "repeat": return templateRepeat(oNode, oWithControl); case "with": return templateWith(oNode, oWithControl); default: error("Unexpected tag ", oNode); } } else if (oNode.namespaceURI === "sap.ui.core") { switch (oNode.localName) { case "ExtensionPoint": return templateExtensionPoint(oNode, oWithControl).then(function (bResult) { if (bResult) { return visitAttributesAndChildren(); } }); case "Fragment": if (oNode.getAttribute("type") === "XML") { return templateFragment(oNode, oWithControl); } break; // no default } } else { fnVisitor = mVisitors[oNode.namespaceURI + " " + oNode.localName] || mVisitors[oNode.namespaceURI]; if (fnVisitor) { iNestingLevel++; debug(oNode, "Calling visitor"); return fnVisitor(oNode, createCallbackInterface(oWithControl)) .then(function (vVisitorResult) { if (vVisitorResult !== undefined) { // prepare for later enhancements using return value error("Unexpected return value from visitor for ", oNode); } debugFinished(oNode); iNestingLevel -= 1; }); } } return visitAttributesAndChildren(); }
javascript
{ "resource": "" }
q18980
restoreSelectedChildren
train
function restoreSelectedChildren(oNode, aExpandingParents, oFirstCollapsedParent) { var bIsExpanded = oNode.getExpanded(), bNodeReferredInParents = false, bIncludeInExpandingParents = bIsExpanded && !!oNode.getSelectedForNodes().length, oFirstCollapsedParentNode = (oFirstCollapsedParent || bIsExpanded) ? oFirstCollapsedParent : oNode, i; //check if any of the expanded parents, that have references, refers the current node //if so - remove the reference for (i = 0; i < aExpandingParents.length; i++) { if (aExpandingParents[i].getSelectedForNodes().indexOf(oNode.getId()) !== -1) { bNodeReferredInParents = true; aExpandingParents[i].removeAssociation("selectedForNodes", oNode, true); } } //if the node is referred somewhere in its parents and it has a collapsed parent //add a reference to the node in the first collapsed parent (if it is not already there) if (oFirstCollapsedParentNode && bNodeReferredInParents && oFirstCollapsedParentNode !== oNode) { if (oFirstCollapsedParentNode.getSelectedForNodes().indexOf(oNode.getId()) === -1) { oFirstCollapsedParentNode.addAssociation("selectedForNodes", oNode, true); } oFirstCollapsedParentNode.$().addClass('sapUiTreeNodeSelectedParent'); } //include the node in the expanding parents only if it has references to selected child nodes if (bIncludeInExpandingParents) { aExpandingParents.push(oNode); } var aNodes = oNode._getNodes(); for (i = 0; i < aNodes.length; i++) { restoreSelectedChildren(aNodes[i], aExpandingParents, oFirstCollapsedParentNode); } //exclude the node from the expanding parents if (bIncludeInExpandingParents) { aExpandingParents.pop(oNode); } }
javascript
{ "resource": "" }
q18981
rememberSelectedChildren
train
function rememberSelectedChildren(oNode, oRootNode) { var aNodes = oNode._getNodes(), oCurrentNode; for (var i = 0; i < aNodes.length; i++) { oCurrentNode = aNodes[i]; if (oCurrentNode.getIsSelected()) { oRootNode.addAssociation("selectedForNodes", oCurrentNode, true); } rememberSelectedChildren(oCurrentNode, oRootNode); } }
javascript
{ "resource": "" }
q18982
train
function(oThis){ var iVisibleItems = 0; var jAreaRef = oThis.$("area"); var jItems = jAreaRef.children(); var bRtl = sap.ui.getCore().getConfiguration().getRTL(); var lastOffsetLeft = (bRtl ? 100000 : 0); jItems.each(function(iIdx) { if (iIdx == 0) { return true; } var currentOffsetLeft = this.offsetLeft; var bLineBreak = (bRtl ? (currentOffsetLeft >= lastOffsetLeft) : (currentOffsetLeft <= lastOffsetLeft)); if (bLineBreak) { iVisibleItems = iIdx; return false; } else if (jQuery(this).attr("id") == oThis.getId() + "-ovrflw") { // This is the overflow button, there was no line break iVisibleItems = iIdx; return false; } else { // Regular item, to the right of the last one, so just proceed lastOffsetLeft = currentOffsetLeft; return true; } }); return iVisibleItems; }
javascript
{ "resource": "" }
q18983
train
function(oThis){ var iVisibleItems = getVisibleItemCount(oThis); var _iVisibleItems = iVisibleItems; var jAreaRef = oThis.$("area"); var jItems = jAreaRef.children(); var jOvrFlwRef = oThis.$("ovrflw"); var bUpdateFocus = false; if (iVisibleItems < jItems.length - 1) { jOvrFlwRef.attr("style", "display:block;"); if (!oThis.oOvrFlwMnu) { oThis.oOvrFlwMnu = new Menu(oThis.getId() + "-ovrflwmnu"); oThis.oOvrFlwMnu.bUseTopStyle = oThis.getDesign() == MenuBarDesign.Header; oThis.oOvrFlwMnu.attachItemSelect(function(oEvent){ var oItem = oEvent.getParameter("item"); if (!(oItem instanceof _DelegatorMenuItem)) { var oItemRootMenu = Menu.prototype.getRootMenu.apply(oItem.getParent()); oItemRootMenu.fireItemSelect({item: oItem}); } else if (oItem.bNoSubMenu && oItem instanceof _DelegatorMenuItem) { oItem.oAlterEgoItm.fireSelect({item: oItem.oAlterEgoItm}); } }); } oThis.oOvrFlwMnu.destroyItems(); var aItems = oThis.getItems(); for (var i = 0; i < aItems.length; i++) { var oItem = aItems[i]; if (iVisibleItems != 0) { if (oItem.getVisible()) { iVisibleItems--; } if (iVisibleItems == 0) { oThis.sLastVisibleItemId = oItem.getId(); } } else { oThis.oOvrFlwMnu.addItem(new _DelegatorMenuItem(oItem)); if (oItem.getId() == oThis.sCurrentFocusedItemRefId) { bUpdateFocus = true; } } } if (sap.ui.getCore().getConfiguration().getAccessibility()) { jItems.attr("aria-setsize", _iVisibleItems + 1); jOvrFlwRef.attr("aria-posinset", _iVisibleItems + 1); } } else { jOvrFlwRef.attr("style", "display:none;"); if (oThis.oOvrFlwMnu) { oThis.oOvrFlwMnu.destroyItems(); } oThis.sLastVisibleItemId = null; if (sap.ui.getCore().getConfiguration().getAccessibility()) { jItems.attr("aria-setsize", _iVisibleItems); jOvrFlwRef.attr("aria-posinset", 0); } } jAreaRef.scrollTop(0); if (bUpdateFocus) { oThis.sCurrentFocusedItemRefId = oThis.sLastVisibleItemId; document.getElementById(oThis.sLastVisibleItemId).focus(); } }
javascript
{ "resource": "" }
q18984
parseAndValidateSystemQueryOption
train
function parseAndValidateSystemQueryOption (mOptions, sOptionName, aAllowed) { var sExpandOptionName, mExpandOptions, sExpandPath, vValue = mOptions[sOptionName]; if (!bSystemQueryOptionsAllowed || aAllowed.indexOf(sOptionName) < 0) { throw new Error("System query option " + sOptionName + " is not supported"); } if ((sOptionName === "$expand" || sOptionName === "$select") && typeof vValue === "string") { vValue = _Parser.parseSystemQueryOption(sOptionName + "=" + vValue)[sOptionName]; mOptions[sOptionName] = vValue; } if (sOptionName === "$expand") { for (sExpandPath in vValue) { mExpandOptions = vValue[sExpandPath]; if (mExpandOptions === null || typeof mExpandOptions !== "object") { // normalize empty expand options to {} mExpandOptions = vValue[sExpandPath] = {}; } for (sExpandOptionName in mExpandOptions) { parseAndValidateSystemQueryOption(mExpandOptions, sExpandOptionName, aExpandQueryOptions); } } } else if (sOptionName === "$count") { if (typeof vValue === "boolean") { if (!vValue) { delete mOptions.$count; } } else { switch (typeof vValue === "string" && vValue.toLowerCase()) { case "false": delete mOptions.$count; break; case "true": mOptions.$count = true; break; default: throw new Error("Invalid value for $count: " + vValue); } } } }
javascript
{ "resource": "" }
q18985
startsWithQualifiedName
train
function startsWithQualifiedName(sMetaPath) { var iDotPos = sMetaPath.indexOf("."), iSlashPos = sMetaPath.indexOf("/"); return iDotPos > 0 && (iSlashPos < 0 || iDotPos < iSlashPos); }
javascript
{ "resource": "" }
q18986
_checkAggregationBindingTemplateID
train
function _checkAggregationBindingTemplateID(oOverlay, vStableElement){ var mAggregationInfo = OverlayUtil.getAggregationInformation(oOverlay, oOverlay.getElement().sParentAggregationName); if (!mAggregationInfo.templateId) { return true; } else { return !FlexUtils.checkControlId(mAggregationInfo.templateId, vStableElement.appComponent); } }
javascript
{ "resource": "" }
q18987
train
function (oFlexibleColumnLayout, oSettings) { var oModeToMaxColumnsCountMapping = { Normal: 3, MasterDetail: 2, SingleColumn: 1 }, iInitial, iMax; oSettings || (oSettings = {}); this._oFCL = oFlexibleColumnLayout; // Layout types this._defaultLayoutType = LT.OneColumn; this._defaultTwoColumnLayoutType = [LT.TwoColumnsBeginExpanded, LT.TwoColumnsMidExpanded].indexOf(oSettings.defaultTwoColumnLayoutType) !== -1 ? oSettings.defaultTwoColumnLayoutType : LT.TwoColumnsBeginExpanded; this._defaultThreeColumnLayoutType = [LT.ThreeColumnsMidExpanded, LT.ThreeColumnsEndExpanded].indexOf(oSettings.defaultThreeColumnLayoutType) !== -1 ? oSettings.defaultThreeColumnLayoutType : LT.ThreeColumnsMidExpanded; // Maximum number of columns and mode (deprecated) if (["Normal", "MasterDetail", "SingleColumn"].indexOf(oSettings.mode) !== -1 && !oSettings.maxColumnsCount) { iMax = oModeToMaxColumnsCountMapping[oSettings.mode]; } else { iMax = oSettings.maxColumnsCount ? parseInt(oSettings.maxColumnsCount) : 3; if (iMax < 1 || iMax > 3) { iMax = 3; } } this._maxColumnsCount = iMax; // Initial number of columns (1 by default, can be set to 2 for MasterDetail or Normal modes only) iInitial = oSettings.initialColumnsCount ? parseInt(oSettings.initialColumnsCount) : 1; if (iInitial < 1 || iInitial > 2 || this._maxColumnsCount === 1) { iInitial = 1; } this._initialColumnsCount = iInitial; }
javascript
{ "resource": "" }
q18988
train
function(sId, bFilled, sColor, iBorderWidth) { this.sId = sId || uid(); this.bFilled = (bFilled == true); this.sColor = sColor || 'blue'; if ( isNaN(iBorderWidth ) ) { this.iBorderWidth = 2; } else if ( iBorderWidth <= 0 ) { this.iBorderWidth = 0; } else { this.iBorderWidth = iBorderWidth; } }
javascript
{ "resource": "" }
q18989
createDefaultToolbar
train
function createDefaultToolbar(oCreationRow) { return new OverflowToolbar({ content: [ new ToolbarSpacer(), new Button({ text: TableUtils.getResourceText("TBL_CREATIONROW_APPLY"), type: MLibrary.ButtonType.Emphasized, enabled: oCreationRow.getApplyEnabled(), press: function() { oCreationRow._fireApply(); } }) ], style: MLibrary.ToolbarStyle.Clear, ariaLabelledBy: [oCreationRow.getId() + "-label"] }); }
javascript
{ "resource": "" }
q18990
train
function (aControls) { if (this.hasControls()) { this.removeAllAggregation("controls"); } var bIsArray = Array.isArray(aControls); if (bIsArray && aControls.length > 0) { // iterate through the given array but suppress invalidate for (var i = 0; i < aControls.length; i++) { this.addAggregation("controls", aControls[i], true); } this.invalidate(); } }
javascript
{ "resource": "" }
q18991
train
function(element, key) { var aData = element.getAggregation("customData"); if (aData) { for (var i = 0; i < aData.length; i++) { if (aData[i].getKey() == key) { return aData[i]; } } } return null; }
javascript
{ "resource": "" }
q18992
train
function(element, key, value, writeToDom) { // DELETE if (value === null) { // delete this property var dataObject = getDataObject(element, key); if (!dataObject) { return; } var dataCount = element.getAggregation("customData").length; if (dataCount == 1) { element.destroyAggregation("customData", true); // destroy if there is no other data } else { element.removeAggregation("customData", dataObject, true); dataObject.destroy(); } // ADD or CHANGE } else { var CustomData = sap.ui.requireSync('sap/ui/core/CustomData'); var dataObject = getDataObject(element, key); if (dataObject) { dataObject.setValue(value); dataObject.setWriteToDom(writeToDom); } else { var dataObject = new CustomData({key:key,value:value, writeToDom:writeToDom}); element.addAggregation("customData", dataObject, true); } } }
javascript
{ "resource": "" }
q18993
train
function (aSelectedRulesPlain) { // if we persist settings - load any selection presets, else use the default ones if (this.model.getProperty("/persistingSettings")) { var aPersistedPresets = Storage.getSelectionPresets(); if (aPersistedPresets) { this.model.setProperty("/selectionPresets", aPersistedPresets); } } var aPresets = this.model.getProperty("/selectionPresets"), iLastSystemPresetPosition = 0; // add System Presets to Rule Presets Popover this.getSystemPresets().forEach(function (oSystemPreset) { var isFound = aPresets.some(function (oPreset) { if (oSystemPreset.id === oPreset.id) { if (!oPreset.isModified) { var bIsSelected = oPreset.selected; oPreset = jQuery.extend({}, oSystemPreset); oPreset.selected = bIsSelected; if (bIsSelected) { SelectionUtils.setSelectedRules(oPreset.selections); } } return true; } }); if (!isFound) { var mSystemPresetConfig = { disableDelete: true, isSystemPreset: true }; aPresets.splice(iLastSystemPresetPosition + 1, 0, jQuery.extend(mSystemPresetConfig, oSystemPreset)); } iLastSystemPresetPosition++; }); // find the selected preset var oSelectedPreset = null; aPresets.some(function (oCurrent) { if (oCurrent.selected) { oSelectedPreset = oCurrent; return true; } }); // sync 'My Selections' with current selections if (oSelectedPreset.isMySelection) { oSelectedPreset.selections = aSelectedRulesPlain; } // need to init the current preset this.model.setProperty("/selectionPresetsCurrent", oSelectedPreset); }
javascript
{ "resource": "" }
q18994
train
function (aSelectedRulesPlain) { var oPreset = this.model.getProperty("/selectionPresetsCurrent"); oPreset.selections = aSelectedRulesPlain; if (!(oPreset.isModified || oPreset.isMySelection)) { oPreset.isModified = true; oPreset.title = oPreset.title + " *"; } this.model.setProperty("/selectionPresetsCurrent", oPreset); if (PresetsUtils.isPersistingAllowed()) { PresetsUtils.persistSelectionPresets(); } }
javascript
{ "resource": "" }
q18995
train
function (sId, sTitle, sDescription, aSelections) { var oRulesToExport = { id: sId, title: sTitle, description: sDescription, dateExported: (new Date()).toISOString(), version: "1.0", selections: aSelections }; var oExportObject = JSON.stringify(oRulesToExport); File.save(oExportObject, constants.RULE_SELECTION_EXPORT_FILE_NAME, 'json', 'text/plain'); }
javascript
{ "resource": "" }
q18996
train
function (oImport) { var bIsFileValid = true; if (!oImport.hasOwnProperty("title")) { bIsFileValid = false; } if (!oImport.hasOwnProperty("selections")) { bIsFileValid = false; } else if (!Array.isArray(oImport.selections)) { bIsFileValid = false; } else { for (var i = 0; i < oImport.selections.length; i++) { var oRuleSelection = oImport.selections[i]; if (!oRuleSelection.hasOwnProperty("ruleId") || !oRuleSelection.hasOwnProperty("libName")) { bIsFileValid = false; break; } } } return bIsFileValid; }
javascript
{ "resource": "" }
q18997
preloadLibraryAsync
train
function preloadLibraryAsync(libConfig) { var that = this; libConfig = evalLibConfig(libConfig); var lib = libConfig.name, fileType = libConfig.fileType, libPackage = lib.replace(/\./g, '/'), http2 = this.oConfiguration.getDepCache(); if ( fileType === 'none' || !!sap.ui.loader._.getModuleState(libPackage + '/library.js') ) { return Promise.resolve(true); } var libInfo = mLibraryPreloadBundles[lib] || (mLibraryPreloadBundles[lib] = { }); // return any existing promise (either lib is currently loading or has been loaded) if ( libInfo.promise ) { return libInfo.promise; } // otherwise mark as pending libInfo.pending = true; libInfo.async = true; // first preload code, resolves with list of dependencies (or undefined) var p; if ( fileType !== 'json' /* 'js' or 'both', not forced to JSON */ ) { var sPreloadModule = libPackage + (http2 ? '/library-h2-preload.js' : '/library-preload.js'); p = sap.ui.loader._.loadJSResourceAsync(sPreloadModule).then( function() { return dependenciesFromManifest(lib); }, function(e) { // loading library-preload.js failed, might be an old style lib with a library-preload.json only. // with json === false, this fallback can be suppressed if ( fileType !== 'js' /* 'both' */ ) { Log.error("failed to load '" + sPreloadModule + "' (" + (e && e.message || e) + "), falling back to library-preload.json"); return loadJSONAsync(lib); } // ignore other errors } ); } else { p = loadJSONAsync(lib); } // load dependencies, if there are any libInfo.promise = p.then(function(dependencies) { var aPromises = [], oManifest = getManifest(lib); if ( dependencies && dependencies.length ) { dependencies = VersionInfo._getTransitiveDependencyForLibraries(dependencies); aPromises = dependencies.map(preloadLibraryAsync.bind(that)); } if (oManifest && Version(oManifest._version).compareTo("1.9.0") >= 0) { aPromises.push(that.getLibraryResourceBundle(lib, true)); } return Promise.all(aPromises).then(function() { libInfo.pending = false; }); }); // return resulting promise return libInfo.promise; }
javascript
{ "resource": "" }
q18998
registerPreloadedModules
train
function registerPreloadedModules(oData, sURL) { var modules = oData.modules, fnUI5ToRJS = function(sName) { return /^jquery\.sap\./.test(sName) ? sName : sName.replace(/\./g, "/"); }; if ( Version(oData.version || "1.0").compareTo("2.0") < 0 ) { modules = {}; for ( var sName in oData.modules ) { modules[fnUI5ToRJS(sName) + ".js"] = oData.modules[sName]; } } sap.ui.require.preload(modules, oData.name, sURL); }
javascript
{ "resource": "" }
q18999
preprocessDependencies
train
function preprocessDependencies(dependencies) { if (Array.isArray(dependencies)) { // remove .library-preload suffix from dependencies return dependencies.map(function (dep) { return dep.replace(/\.library-preload$/, ''); }); } return dependencies; }
javascript
{ "resource": "" }