_id
stringlengths 2
6
| title
stringlengths 0
58
| partition
stringclasses 3
values | text
stringlengths 52
373k
| language
stringclasses 1
value | meta_information
dict |
|---|---|---|---|---|---|
q19400
|
train
|
function (key) {
var pDel, oMsr = startMeasurements("del", key);
Log.debug("Cache Manager: del called.");
pDel = this._callInstanceMethod("del", arguments).then(function callInstanceHandler() {
Log.debug("Cache Manager: del completed successfully.");
oMsr.endAsync();
//nothing to return, just logging.
}, function (e) {
Log.debug("Cache Manager: del failed. Error: " + e);
oMsr.endAsync();
throw e;
});
oMsr.endSync();
return pDel;
}
|
javascript
|
{
"resource": ""
}
|
|
q19401
|
train
|
function () {
var pReset, oMsr = startMeasurements("reset");
Log.debug("Cache Manager: Reset called.");
pReset = this._callInstanceMethod("reset", arguments).then(function callInstanceHandler() {
Log.debug("Cache Manager: Reset completed successfully.");
oMsr.endAsync();
//nothing to return, just logging.
}, function (e) {
Log.debug("Cache Manager: Reset failed. Error: " + e);
oMsr.endAsync();
throw e;
});
oMsr.endSync();
return pReset;
}
|
javascript
|
{
"resource": ""
}
|
|
q19402
|
train
|
function (sMethodName, aArgs) {
var pCallInstance, sMsrCallInstance = "[sync ] _callInstanceMethod";
Measurement.start(sMsrCallInstance, "CM", S_MSR_CAT_CACHE_MANAGER);
if (this._instance) {
Log.debug("Cache Manager: calling instance...");
return this._instance[sMethodName].apply(this._instance, aArgs);
}
Log.debug("Cache Manager: getting instance...");
pCallInstance = this._getInstance().then(function instanceResolving(instance) {
return instance[sMethodName].apply(instance, aArgs);
});
Measurement.end(sMsrCallInstance);
return pCallInstance;
}
|
javascript
|
{
"resource": ""
}
|
|
q19403
|
train
|
function () {
var aSupportedEnv = [];
if (this._bSupportedEnvironment == undefined) {
aSupportedEnv.push({
system: Device.system.SYSTEMTYPE.DESKTOP,
browserName: Device.browser.BROWSER.CHROME,
browserVersion: 49
});
aSupportedEnv.push({
system: Device.system.SYSTEMTYPE.DESKTOP,
browserName: Device.browser.BROWSER.INTERNET_EXPLORER,
browserVersion: 11
});
this._bSupportedEnvironment = aSupportedEnv.some(function (oSuppportedEnv) {
var bSupportedSystem = Device.system[oSuppportedEnv.system],
bSupportedBrowserName = oSuppportedEnv.browserName === Device.browser.name,
bSupportedBrowserVersion = Device.browser.version >= oSuppportedEnv.browserVersion;
return bSupportedSystem && bSupportedBrowserName && bSupportedBrowserVersion && window.indexedDB;
});
}
return this._bSupportedEnvironment;
}
|
javascript
|
{
"resource": ""
}
|
|
q19404
|
train
|
function (sContext) {
var oOptions = this._getContextOptions(sContext);
if (!oOptions) {
return this;
}
if (!this.isContextSensitive) {
Log.error("The bar control you are using does not implement all the members of the IBar interface", this);
return this;
}
//If this class does not gets added by the renderer, add it here
if (!this.getRenderer().shouldAddIBarContext()) {
this.addStyleClass(IBAR_CSS_CLASS + "-CTX");
}
if (this.isContextSensitive()) {
this.addStyleClass(oOptions.contextClass);
}
return this;
}
|
javascript
|
{
"resource": ""
}
|
|
q19405
|
train
|
function (sContext) {
var oOptions = this._getContextOptions(sContext);
if (!oOptions) {
return this;
}
if (!this.setHTMLTag) {
Log.error("The bar control you are using does not implement all the members of the IBar interface", this);
return this;
}
this.setHTMLTag(oOptions.tag);
return this;
}
|
javascript
|
{
"resource": ""
}
|
|
q19406
|
train
|
function (sContext) {
var oContext;
if (this.getContext) {
oContext = this.getContext();
} else {
oContext = mContexts;
}
var oOptions = oContext[sContext];
if (!oOptions) {
Log.error("The context " + sContext + " is not known", this);
return null;
}
return oOptions;
}
|
javascript
|
{
"resource": ""
}
|
|
q19407
|
train
|
function(oEvent) {
// in our use-case each tab contains a single subSection => only this subSection needs to be processed
var oSubSection = oEvent.getParameter("subSection"),
sId = oSubSection.getId(),
aBlocks;
//attach listeners that prettify the tab content upon its rendering
if (this._aVisitedTabs.indexOf(sId) < 0) { // avoid adding listeners to the same tab twice
aBlocks = oSubSection.getBlocks();
aBlocks.forEach(function(oBlock) {
oBlock.addEventDelegate({"onAfterRendering": this._prettify.bind(this)});
}.bind(this));
this._aVisitedTabs.push(sId);
}
}
|
javascript
|
{
"resource": ""
}
|
|
q19408
|
train
|
function (oEvent) {
var aItems = oEvent.getSource().getItems(),
iLen = aItems.length,
oItem;
while (iLen--) {
oItem = aItems[iLen];
// Access control lazy loading method if available
if (oItem._getLinkSender) {
var oCustomData = oItem.getCustomData(),
sClassName = oCustomData[0].getValue(),
sEntityId = oCustomData[1].getValue(),
sEntityType = oCustomData[2].getValue(),
sHref;
// oCustomData[3].getValue() is true if method is static, else it is false
if (oCustomData[3].getValue()) {
sEntityId = sClassName + "." + sEntityId;
}
sHref = "#/api/" + sClassName;
if (sEntityType !== "class") {
sHref += "/" + sEntityType + "/" + sEntityId;
}
// Set link href to allow open in new window functionality
oItem._getLinkSender().setHref(sHref);
}
}
}
|
javascript
|
{
"resource": ""
}
|
|
q19409
|
train
|
function () {
jQuery0.ajax(this.getConfig().docuPath + "disclaimer.json", {dataType: "json"}).then(function (oData) {
var oView = this.getView();
if (oData.showDisclaimer && oData.message) {
oView.byId("disclaimerBlock").setVisible(true);
oView.byId("disclaimerMessage").setText(oData.message);
}
}.bind(this), function () {
// This functionality should fail silently
});
}
|
javascript
|
{
"resource": ""
}
|
|
q19410
|
train
|
function () {
var oVersionModel = this.getModel("versionData"),
bIsDevVersion = oVersionModel.getProperty('/isDevVersion'),
bIsOpenUI5 = oVersionModel.getProperty('/isOpenUI5');
if (bIsOpenUI5) {
return 'https://help.sap.com/OpenUI5_PDF/OpenUI5.pdf';
}
return bIsDevVersion ? 'https://help.sap.com/DRAFT/SAPUI5_Internal_PDF/SAPUI5_Internal.pdf' : 'https://help.sap.com/SAPUI5_PDF/SAPUI5.pdf';
}
|
javascript
|
{
"resource": ""
}
|
|
q19411
|
train
|
function () {
var tempRules = [],
rawLSData;
try {
rawLSData = localStorage.getItem(constants.LOCAL_STORAGE_TEMP_RULES_KEY);
if (!rawLSData) {
return null;
}
tempRules = JSON.parse(decode(rawLSData));
tempRules = tempRules.map(function (tempRule) {
return RuleSerializer.deserialize(tempRule, true);
});
} catch (oError) {
// Swallow "Access Denied" exceptions in cross-origin scenarios.
}
return tempRules;
}
|
javascript
|
{
"resource": ""
}
|
|
q19412
|
train
|
function (rules) {
var stringifyRules = encode(JSON.stringify(rules));
localStorage.setItem(constants.LOCAL_STORAGE_TEMP_RULES_KEY, stringifyRules);
}
|
javascript
|
{
"resource": ""
}
|
|
q19413
|
train
|
function () {
var rawLSData = localStorage.getItem(constants.LOCAL_STORAGE_SELECTED_RULES_KEY);
if (!rawLSData) {
return null;
}
return JSON.parse(rawLSData);
}
|
javascript
|
{
"resource": ""
}
|
|
q19414
|
train
|
function() {
localStorage.removeItem(constants.LOCAL_STORAGE_TEMP_RULES_KEY);
localStorage.removeItem(constants.LOCAL_STORAGE_SELECTED_RULES_KEY);
localStorage.removeItem(constants.LOCAL_STORAGE_SELECTED_CONTEXT_KEY);
localStorage.removeItem(constants.LOCAL_STORAGE_SELECTED_CONTEXT_COMPONENT_KEY);
localStorage.removeItem(constants.LOCAL_STORAGE_SELECTED_VISIBLE_COLUMN_KEY);
localStorage.removeItem(constants.LOCAL_STORAGE_SELECTION_PRESETS_KEY);
localStorage.removeItem(constants.LOCAL_STORAGE_CUSTOM_PRESETS_KEY);
}
|
javascript
|
{
"resource": ""
}
|
|
q19415
|
train
|
function(sCookieName) {
var name = sCookieName + "=",
decodedCookie = decodeURIComponent(document.cookie),
ca = decodedCookie.split(';'),
sOutput = "";
for (var i = 0; i < ca.length; i++) {
var c = ca[i];
while (c.charAt(0) == ' ') {
c = c.substring(1);
}
if (c.indexOf(name) == 0) {
sOutput = c.substring(name.length, c.length);
return sOutput;
}
}
return sOutput;
}
|
javascript
|
{
"resource": ""
}
|
|
q19416
|
train
|
function (sComponentName, sAppVersion, oChangeFileContent) {
this._sComponentName = sComponentName || "";
this._sAppVersion = sAppVersion || Utils.DEFAULT_APP_VERSION;
this._mVariantManagement = {};
this.setChangeFileContent(oChangeFileContent, {});
this.sVariantTechnicalParameterName = "sap-ui-fl-control-variant-id";
this._oResourceBundle = sap.ui.getCore().getLibraryResourceBundle("sap.ui.fl");
}
|
javascript
|
{
"resource": ""
}
|
|
q19417
|
CONDITIONAL
|
train
|
function CONDITIONAL(fnCondition, fnThen, fnElse, aParts) {
return fnCondition(aParts) ? fnThen(aParts) : fnElse(aParts);
}
|
javascript
|
{
"resource": ""
}
|
q19418
|
DOT
|
train
|
function DOT(fnLeft, sIdentifier, aParts, oReference) {
var oParent = fnLeft(aParts),
vChild = oParent[sIdentifier];
if (oReference) {
oReference.base = oParent;
}
return vChild;
}
|
javascript
|
{
"resource": ""
}
|
q19419
|
FUNCTION_CALL
|
train
|
function FUNCTION_CALL(fnLeft, aArguments, aParts) {
var oReference = {};
// evaluate function expression and call it
return fnLeft(aParts, oReference).apply(oReference.base,
aArguments.map(function (fnArgument) {
return fnArgument(aParts); // evaluate argument
}));
}
|
javascript
|
{
"resource": ""
}
|
q19420
|
INFIX
|
train
|
function INFIX(fnLeft, fnRight, fnOperator, bLazy, aParts) {
return fnOperator(fnLeft(aParts),
bLazy ? fnRight.bind(null, aParts) : fnRight(aParts));
}
|
javascript
|
{
"resource": ""
}
|
q19421
|
MAP
|
train
|
function MAP(mMap, aParts) {
var sKey, mResult = {};
for (sKey in mMap) {
mResult[sKey] = mMap[sKey](aParts); // evaluate value
}
return mResult;
}
|
javascript
|
{
"resource": ""
}
|
q19422
|
PROPERTY_ACCESS
|
train
|
function PROPERTY_ACCESS(fnLeft, fnName, aParts, oReference) {
var oParent = fnLeft(aParts),
sIdentifier = fnName(aParts), // BEWARE: evaluate propertyNameValue AFTER baseValue!
vChild = oParent[sIdentifier];
if (oReference) {
oReference.base = oParent;
}
return vChild;
}
|
javascript
|
{
"resource": ""
}
|
q19423
|
addInfix
|
train
|
function addInfix(sId, iBindingPower, fnOperator, bLazy) {
// Note: this function is executed at load time only!
mSymbols[sId] = {
lbp: iBindingPower,
led: function (oToken, oParser, fnLeft) {
//lazy evaluation is right associative: performance optimization for guard and
//default operator, e.g. true || A || B || C does not execute the || for B and C
var rbp = bLazy ? this.lbp - 1 : this.lbp;
return INFIX.bind(null, fnLeft, oParser.expression(rbp),
fnOperator, bLazy);
},
nud: unexpected
};
return mSymbols[sId];
}
|
javascript
|
{
"resource": ""
}
|
q19424
|
saveBindingAsPart
|
train
|
function saveBindingAsPart(oBinding, iStart, bTargetTypeAny) {
var bHasNonPrimitiveValue = false,
sKey,
oPrimitiveValueBinding,
i;
/*
* Sets the target type of the given binding to the default "any", if applicable.
*
* @param {object} oBinding
* A binding
*/
function setTargetType(oBinding) {
if (bTargetTypeAny) {
if (oBinding.parts) {
oBinding.parts.forEach(setTargetType);
// Note: targetType not allowed here, see BindingParser.mergeParts
} else {
oBinding.targetType = oBinding.targetType || "any";
}
}
}
for (sKey in oBinding) {
switch (typeof oBinding[sKey]) {
case "boolean":
case "number":
case "string":
case "undefined":
break;
default:
// binding has at least one property of non-primitive value
bHasNonPrimitiveValue = true;
}
}
setTargetType(oBinding);
if (bHasNonPrimitiveValue) {
// the binding must be a complex binding; property "type" (and poss. others) are
// newly created objects and thus incomparable -> parse again to have the names
oPrimitiveValueBinding = JSTokenizer.parseJS(sInput, iStart).result;
setTargetType(oPrimitiveValueBinding);
} else {
// only primitive values; easily comparable
oPrimitiveValueBinding = oBinding;
}
for (i = 0; i < aParts.length; i += 1) {
// Note: order of top-level properties must not matter for equality!
if (deepEqual(aPrimitiveValueBindings[i], oPrimitiveValueBinding)) {
return i;
}
}
aPrimitiveValueBindings[i] = oPrimitiveValueBinding;
aParts[i] = oBinding;
return i;
}
|
javascript
|
{
"resource": ""
}
|
q19425
|
consumeToken
|
train
|
function consumeToken() {
var ch, oBinding, iIndex, aMatches, oToken;
oTokenizer.white();
ch = oTokenizer.getCh();
iIndex = oTokenizer.getIndex();
if ((ch === "$" || ch === "%") && sInput[iIndex + 1] === "{") { //binding
oBinding = fnResolveBinding(sInput, iIndex + 1);
oToken = {
id: "BINDING",
value: saveBindingAsPart(oBinding.result, iIndex + 1, ch === "%")
};
oTokenizer.setIndex(oBinding.at); //go to first character after binding string
} else if (rIdentifierStart.test(ch)) {
aMatches = rIdentifier.exec(sInput.slice(iIndex));
switch (aMatches[0]) {
case "false":
case "null":
case "true":
oToken = {id: "CONSTANT", value: oTokenizer.word()};
break;
case "in":
case "typeof":
oToken = {id: aMatches[0]};
oTokenizer.setIndex(iIndex + aMatches[0].length);
break;
default:
oToken = {id: "IDENTIFIER", value: aMatches[0]};
oTokenizer.setIndex(iIndex + aMatches[0].length);
}
} else if (rDigit.test(ch)
|| ch === "." && rDigit.test(sInput[iIndex + 1])) {
oToken = {id: "CONSTANT", value: oTokenizer.number()};
} else if (ch === "'" || ch === '"') {
oToken = {id: "CONSTANT", value: oTokenizer.string()};
} else {
rTokens.lastIndex = iIndex;
aMatches = rTokens.exec(sInput);
if (!aMatches || aMatches.index !== iIndex) {
return false; // end of input or unrecognized character
}
oToken = {id: aMatches[0]};
oTokenizer.setIndex(iIndex + aMatches[0].length);
}
oToken.input = sInput;
oToken.start = iIndex;
oToken.end = oTokenizer.getIndex();
aTokens.push(oToken);
return true;
}
|
javascript
|
{
"resource": ""
}
|
q19426
|
expression
|
train
|
function expression(rbp) {
var fnLeft;
oToken = advance();
if (!oToken) {
error("Expected expression but instead saw end of input", sInput);
}
fnLeft = mSymbols[oToken.id].nud(oToken, oParser);
while (iNextToken < aTokens.length) {
oToken = current();
if (rbp >= (mSymbols[oToken.id].lbp || 0)) {
break;
}
advance();
fnLeft = mSymbols[oToken.id].led(oToken, oParser, fnLeft);
}
return fnLeft;
}
|
javascript
|
{
"resource": ""
}
|
q19427
|
train
|
function(oEvent) {
var sFilter = oEvent.oSource.getFilter(),
oSearchField = this.getOwnerComponent().byId("controlsMaster").byId("searchField");
// Apply the value and fire a live change event so the list will be filtered
oSearchField.setValue(sFilter).fireLiveChange({
newValue: sFilter
});
// Show master page: this call will show the master page only on small screen sizes but not on phone
setTimeout(function () {
this.getSplitApp().showMaster();
}.bind(this), 0);
}
|
javascript
|
{
"resource": ""
}
|
|
q19428
|
_setItemTypeFormatter
|
train
|
function _setItemTypeFormatter(oAction) {
var that = this;
var oBindingInfo = ManagedObject.bindingParser("{path:''}");
// Async formatter to set ListItem type depending if the list item context is a correct navigation target (decided by the navigation service).
oBindingInfo.formatter = function (vValue) {
var oBindingContext = this.getBindingContext(),
oModel = this.getModel(),
sPath;
if (oBindingContext) {
sPath = oBindingContext.getPath();
}
var mParameters = BindingResolver.resolveValue(oAction.parameters, oModel, sPath);
if (vValue.__resolved) {
if (vValue.__enabled) {
return "Navigation";
} else {
return "Inactive";
}
}
if (!vValue.__promise) {
vValue.__promise = true;
that._oServiceManager.getService(_getServiceName(oAction.service)).then(function (oNavigationService) {
if (oNavigationService) {
oNavigationService
.enabled({
parameters: mParameters
})
.then(function (bEnabled) {
vValue.__resolved = true;
vValue.__enabled = bEnabled;
that.getModel().checkUpdate(true);
})
.catch(function () {
vValue.__resolved = true;
vValue.__enabled = false;
});
} else {
vValue.__resolved = true;
vValue.__enabled = false;
}
});
}
return "Inactive";
};
this._oItemTemplate.bindProperty("type", oBindingInfo);
}
|
javascript
|
{
"resource": ""
}
|
q19429
|
_setActionEnabledState
|
train
|
function _setActionEnabledState(oAction) {
var oBindingInfo;
if (typeof oAction.enabled === "string") {
oBindingInfo = ManagedObject.bindingParser(oAction.enabled);
oBindingInfo.formatter = function (vValue) {
if (vValue && (typeof vValue === "string")) {
return "Navigation";
} else {
return "Inactive";
}
};
}
if (oBindingInfo) {
this._oItemTemplate.bindProperty("type", oBindingInfo);
} else {
var bEnabled = oAction.enabled !== false ? true : false;
var sType = bEnabled ? "Navigation" : "Inactive";
this._oItemTemplate.setProperty("type", sType);
}
}
|
javascript
|
{
"resource": ""
}
|
q19430
|
train
|
function(oEvent) {
var sEntityType,
sEntityId,
aSplit,
sId = oEvent.getParameter("arguments").id;
if (sId) {
aSplit = sId.split("#");
if (aSplit.length === 2) {
sId = aSplit[0];
sEntityType = aSplit[1];
aSplit = sEntityType.split(":");
if (aSplit.length === 2) {
sEntityType = aSplit[0];
sEntityId = aSplit[1];
}
}
sId = sId.replace(/.html$/, "");
if (sEntityType === 'event') { // legacy keyword is singular
sEntityType = "events";
}
}
this.navTo("apiId", {id: sId, entityType: sEntityType, entityId: sEntityId});
}
|
javascript
|
{
"resource": ""
}
|
|
q19431
|
getReturnValueContextPath
|
train
|
function getReturnValueContextPath(sPath, sResponsePredicate) {
var sBoundParameterPath = sPath.slice(0, sPath.lastIndexOf("/")),
i = sBoundParameterPath.indexOf("(");
return (i < 0 ? sBoundParameterPath : sPath.slice(0, i)) + sResponsePredicate;
}
|
javascript
|
{
"resource": ""
}
|
q19432
|
buildPickerByType
|
train
|
function buildPickerByType(type){
var oPicker;
switch (type) {
case DateTimeInputType.DateTime:
oPicker = new DateTimePicker(this.getId() + "-Picker");
break;
case DateTimeInputType.Time:
oPicker = new TimePicker(this.getId() + "-Picker",
{localeId: sap.ui.getCore().getConfiguration().getFormatSettings().getFormatLocale().toString()});
break;
default: // default is date
oPicker = new DatePicker(this.getId() + "-Picker");
break;
}
// forward properties (also set default, may be different)
oPicker.setDisplayFormat(this.getDisplayFormat() || this._types[type].displayFormat);
oPicker.setValueFormat(this.getValueFormat() || this._types[type].valueFormat);
if (this.getDateValue()) {
oPicker.setDateValue(this.getDateValue()); // don't set Value -> as by switching type information can be lost
}
oPicker.setEnabled(this.getEnabled());
oPicker.setEditable(this.getEditable());
oPicker.setValueState(this.getValueState());
oPicker.setValueStateText(this.getValueStateText());
oPicker.setShowValueStateMessage(this.getShowValueStateMessage());
oPicker.setName(this.getName());
oPicker.setPlaceholder(this.getPlaceholder());
oPicker.setTextAlign(this.getTextAlign());
oPicker.setTextDirection(this.getTextDirection());
oPicker.setWidth("100%");
oPicker.attachChange(_handleChange, this);
var aAriaLabelledBy = this.getAriaLabelledBy();
for (var i = 0; i < aAriaLabelledBy.length; i++) {
oPicker.addAriaLabelledBy(aAriaLabelledBy[i]);
}
return oPicker;
}
|
javascript
|
{
"resource": ""
}
|
q19433
|
train
|
function(oController, viewId, aInvalidContent, fnProcessInvalidFunction) {
var _aInvalidControllerFunctions = [];
Object.keys(oController).forEach(function(sProtoKey) {
var sFnContent = oController[sProtoKey].toString().replace(/(\r\n|\n|\r)/gm, "");
aInvalidContent.forEach(function(sInvalidContent) {
if (sFnContent.indexOf(sInvalidContent) > 0) {
fnProcessInvalidFunction(oController.getMetadata().getName(), sProtoKey, sInvalidContent, viewId);
}
});
});
return _aInvalidControllerFunctions;
}
|
javascript
|
{
"resource": ""
}
|
|
q19434
|
getStashedControls
|
train
|
function getStashedControls(sId) {
if (!StashedControlSupport) {
StashedControlSupport = sap.ui.require("sap/ui/core/StashedControlSupport");
}
if (StashedControlSupport) {
return StashedControlSupport.getStashedControls(sId);
}
return [];
}
|
javascript
|
{
"resource": ""
}
|
q19435
|
updateGroup
|
train
|
function updateGroup(oContext) {
var oNewGroup = oBinding.getGroup(oContext);
if (oNewGroup.key !== sGroup) {
var oGroupHeader;
//If factory is defined use it
if (oBindingInfo.groupHeaderFactory) {
oGroupHeader = oBindingInfo.groupHeaderFactory(oNewGroup);
}
that[sGroupFunction](oNewGroup, oGroupHeader);
sGroup = oNewGroup.key;
}
}
|
javascript
|
{
"resource": ""
}
|
q19436
|
updateRecursive
|
train
|
function updateRecursive(oControl, oContexts) {
update(oControl, oContexts, null, function(oContext, oClone) {
updateRecursive(oClone, oBinding.getNodeContexts(oContext));
});
}
|
javascript
|
{
"resource": ""
}
|
q19437
|
train
|
function(oTable) {
return (oTable.getSelectionMode() !== SelectionMode.None && oTable.getSelectionBehavior() !== SelectionBehavior.RowOnly)
|| TableGrouping.isGroupMode(oTable);
}
|
javascript
|
{
"resource": ""
}
|
|
q19438
|
train
|
function(oTable) {
var sSelectionMode = oTable ? oTable.getSelectionMode() : SelectionMode.None;
return sSelectionMode === SelectionMode.MultiToggle && oTable.getEnableSelectAll();
}
|
javascript
|
{
"resource": ""
}
|
|
q19439
|
train
|
function(oTable) {
if (!oTable) {
return false;
}
var oRowSettingsTemplate = oTable.getRowSettingsTemplate();
if (!oRowSettingsTemplate) {
return false;
}
var sHighlight = oRowSettingsTemplate.getHighlight();
return oRowSettingsTemplate.isBound("highlight")
|| (sHighlight != null && sHighlight !== MessageType.None);
}
|
javascript
|
{
"resource": ""
}
|
|
q19440
|
train
|
function(oTable) {
var oRowActionTemplate = oTable ? oTable.getRowActionTemplate() : null;
return oRowActionTemplate != null
&& (oRowActionTemplate.isBound("visible") || oRowActionTemplate.getVisible())
&& TableUtils.getRowActionCount(oTable) > 0;
}
|
javascript
|
{
"resource": ""
}
|
|
q19441
|
train
|
function(oTable) {
if (!oTable) {
return false;
}
var iSelectableRowCount = oTable._getSelectableRowCount();
return iSelectableRowCount > 0 && iSelectableRowCount === oTable._getSelectedIndicesCount();
}
|
javascript
|
{
"resource": ""
}
|
|
q19442
|
train
|
function(oTable) {
var oBinding = oTable.getBinding("rows");
var iTotalRowCount = oTable._getTotalRowCount();
var bHasData = iTotalRowCount > 0;
if (oBinding && oBinding.providesGrandTotal) { // Analytical Binding
var bHasTotal = oBinding.providesGrandTotal() && oBinding.hasTotaledMeasures();
bHasData = (bHasTotal && iTotalRowCount > 1) || (!bHasTotal && iTotalRowCount > 0);
}
return bHasData;
}
|
javascript
|
{
"resource": ""
}
|
|
q19443
|
train
|
function(oTable) {
if (!oTable || !oTable.getDomRef()) {
return false;
}
return oTable.getDomRef().querySelector("#" + oTable.getId() + "-sapUiTableGridCnt > .sapUiLocalBusyIndicator") != null;
}
|
javascript
|
{
"resource": ""
}
|
|
q19444
|
train
|
function(oTable) {
if (!oTable) {
return false;
}
if (TableUtils.canUsePendingRequestsCounter(oTable)) {
return oTable._iPendingRequests > 0;
} else {
return oTable._bPendingRequest;
}
}
|
javascript
|
{
"resource": ""
}
|
|
q19445
|
train
|
function(oTable) {
var oBinding = oTable ? oTable.getBinding("rows") : null;
if (TableUtils.isA(oBinding, "sap.ui.model.analytics.AnalyticalBinding")) {
return oBinding.bUseBatchRequests;
} else if (TableUtils.isA(oBinding, "sap.ui.model.TreeBinding")) {
return false;
}
return true;
}
|
javascript
|
{
"resource": ""
}
|
|
q19446
|
train
|
function(oTable, vRowIndicator, bSelect, fnDoSelect) {
if (!oTable ||
!oTable.getBinding("rows") ||
oTable.getSelectionMode() === SelectionMode.None ||
vRowIndicator == null) {
return false;
}
function setSelectionState(iAbsoluteRowIndex) {
if (!oTable._isRowSelectable(iAbsoluteRowIndex)) {
return false;
}
oTable._iSourceRowIndex = iAbsoluteRowIndex; // To indicate that the selection was changed by user interaction.
var bSelectionChanged = false;
if (fnDoSelect) {
bSelectionChanged = fnDoSelect(iAbsoluteRowIndex, bSelect);
} else if (oTable.isIndexSelected(iAbsoluteRowIndex)) {
if (bSelect !== true) {
bSelectionChanged = true;
oTable.removeSelectionInterval(iAbsoluteRowIndex, iAbsoluteRowIndex);
}
} else if (bSelect !== false) {
bSelectionChanged = true;
oTable.addSelectionInterval(iAbsoluteRowIndex, iAbsoluteRowIndex);
}
delete oTable._iSourceRowIndex;
return bSelectionChanged;
}
// Variable vRowIndicator is a row index value.
if (typeof vRowIndicator === "number") {
if (vRowIndicator < 0 || vRowIndicator >= oTable._getTotalRowCount()) {
return false;
}
return setSelectionState(vRowIndicator);
// Variable vRowIndicator is a jQuery object or DOM element.
} else {
var $Cell = jQuery(vRowIndicator);
var oCellInfo = TableUtils.getCellInfo($Cell[0]);
var bIsRowSelectionAllowed = TableUtils.isRowSelectionAllowed(oTable);
if (!TableUtils.Grouping.isInGroupingRow($Cell[0])
&& ((oCellInfo.isOfType(TableUtils.CELLTYPE.DATACELL | TableUtils.CELLTYPE.ROWACTION) && bIsRowSelectionAllowed)
|| (oCellInfo.isOfType(TableUtils.CELLTYPE.ROWHEADER) && TableUtils.isRowSelectorSelectionAllowed(oTable)))) {
var iAbsoluteRowIndex;
if (oCellInfo.isOfType(TableUtils.CELLTYPE.DATACELL)) {
iAbsoluteRowIndex = oTable
.getRows()[parseInt($Cell.closest("tr", oTable.getDomRef()).attr("data-sap-ui-rowindex"))]
.getIndex();
} else { // CELLTYPES.ROWHEADER, CELLTYPES.ROWACTION
iAbsoluteRowIndex = oTable.getRows()[parseInt($Cell.attr("data-sap-ui-rowindex"))].getIndex();
}
return setSelectionState(iAbsoluteRowIndex);
}
return false;
}
}
|
javascript
|
{
"resource": ""
}
|
|
q19447
|
train
|
function(oTable) {
var oNoData = oTable.getNoData();
if (oNoData instanceof Control) {
return null;
} else if (typeof oNoData === "string" || oTable.getNoData() instanceof String) {
return oNoData;
} else {
return TableUtils.getResourceText("TBL_NO_DATA");
}
}
|
javascript
|
{
"resource": ""
}
|
|
q19448
|
train
|
function(oTable) {
if (oTable._iHeaderRowCount === undefined) {
if (!oTable.getColumnHeaderVisible()) {
oTable._iHeaderRowCount = 0;
} else {
var iHeaderRows = 1;
var aColumns = oTable.getColumns();
for (var i = 0; i < aColumns.length; i++) {
if (aColumns[i].shouldRender()) {
// only visible columns need to be considered. We don't invoke getVisibleColumns due to
// performance considerations. With several dozens of columns, it's quite costy to loop them twice.
iHeaderRows = Math.max(iHeaderRows, aColumns[i].getMultiLabels().length);
}
}
oTable._iHeaderRowCount = iHeaderRows;
}
}
return oTable._iHeaderRowCount;
}
|
javascript
|
{
"resource": ""
}
|
|
q19449
|
train
|
function(oTable, iIndex, oEvent) {
var oIN = oTable._getItemNavigation();
if (oIN) {
oIN.focusItem(iIndex, oEvent);
}
}
|
javascript
|
{
"resource": ""
}
|
|
q19450
|
train
|
function(oTable, oElement, bIncludePseudoCells) {
bIncludePseudoCells = bIncludePseudoCells === true;
if (!oTable || !oElement) {
return null;
}
var $Element = jQuery(oElement);
var oTableElement = oTable.getDomRef();
var sSelector = ".sapUiTableCell";
if (!bIncludePseudoCells) {
sSelector += ":not(.sapUiTablePseudoCell)";
}
var $Cell = $Element.closest(sSelector, oTableElement);
if ($Cell.length > 0) {
return $Cell;
}
return null;
}
|
javascript
|
{
"resource": ""
}
|
|
q19451
|
train
|
function(oTable, oElement, bIncludePseudoCells) {
bIncludePseudoCells = bIncludePseudoCells === true;
var $Element = jQuery(oElement);
var $Cell = TableUtils.getCell(oTable, oElement, bIncludePseudoCells);
if (!$Cell || $Cell[0] === $Element[0]) {
return null; // The element is not inside a table cell.
} else {
return $Cell;
}
}
|
javascript
|
{
"resource": ""
}
|
|
q19452
|
train
|
function(oTable, sIdSuffix, fnHandler, bRegisterParent) {
var oDomRef;
if (typeof sIdSuffix == "string") {
oDomRef = oTable.getDomRef(sIdSuffix);
} else {
Log.error("sIdSuffix must be a string", oTable);
return undefined;
}
if (typeof fnHandler !== "function") {
Log.error("fnHandler must be a function", oTable);
return undefined;
}
// make sure that each DOM element of the table can only have one resize handler in order to avoid memory leaks
TableUtils.deregisterResizeHandler(oTable, sIdSuffix);
if (!oTable._mResizeHandlerIds) {
oTable._mResizeHandlerIds = {};
}
if (bRegisterParent && oDomRef) {
oDomRef = oDomRef.parentNode;
}
if (oDomRef) {
oTable._mResizeHandlerIds[sIdSuffix] = ResizeHandler.register(oDomRef, fnHandler);
}
return oTable._mResizeHandlerIds[sIdSuffix];
}
|
javascript
|
{
"resource": ""
}
|
|
q19453
|
train
|
function(oTable, vIdSuffix) {
var aIdSuffix;
if (!oTable._mResizeHandlerIds) {
// no resize handler registered so far
return;
}
if (typeof vIdSuffix == "string") {
aIdSuffix = [vIdSuffix];
} else if (vIdSuffix === undefined) {
aIdSuffix = [];
// de-register all resize handlers if no specific is named
for (var sKey in oTable._mResizeHandlerIds) {
if (typeof sKey == "string" && oTable._mResizeHandlerIds.hasOwnProperty(sKey)) {
aIdSuffix.push(sKey);
}
}
} else if (Array.isArray(vIdSuffix)) {
aIdSuffix = vIdSuffix;
}
for (var i = 0; i < aIdSuffix.length; i++) {
var sIdSuffix = aIdSuffix[i];
if (oTable._mResizeHandlerIds[sIdSuffix]) {
ResizeHandler.deregister(oTable._mResizeHandlerIds[sIdSuffix]);
oTable._mResizeHandlerIds[sIdSuffix] = undefined;
}
}
}
|
javascript
|
{
"resource": ""
}
|
|
q19454
|
train
|
function(vObject, vCall, oThis) {
var oObject = typeof vObject === "function" ? vObject() : vObject;
if (!oObject || !vCall) {
return undefined;
}
oThis = oThis || oObject;
if (typeof vCall === "function") {
vCall.call(oThis, oObject);
return undefined;
} else {
var aParameters;
var aReturnValues = [];
for (var sFunctionName in vCall) {
if (typeof oObject[sFunctionName] === "function") {
aParameters = vCall[sFunctionName];
aReturnValues.push(oObject[sFunctionName].apply(oThis, aParameters));
} else {
aReturnValues.push(undefined);
}
}
if (aReturnValues.length === 1) {
return aReturnValues[0];
} else {
return aReturnValues;
}
}
}
|
javascript
|
{
"resource": ""
}
|
|
q19455
|
train
|
function(fn, mOptions) {
// Functionality taken from lodash open source library and adapted as needed
mOptions = Object.assign({
wait: 0,
leading: true
}, mOptions);
mOptions.maxWait = mOptions.wait;
mOptions.trailing = true;
mOptions.requestAnimationFrame = false;
return TableUtils.debounce(fn, mOptions);
}
|
javascript
|
{
"resource": ""
}
|
|
q19456
|
invoke
|
train
|
function invoke(vContext, vArguments, bAsync, bFinal) {
iLastInvocationTime = bFinal === true ? null : Date.now();
if (vArguments == null) {
return;
}
if (bAsync === true) {
var oPromise = Promise.resolve().then(function() {
if (!oPromise.canceled) {
fn.apply(vContext, vArguments);
}
oCancelablePromise = null;
});
oPromise.cancel = function() {
oPromise.canceled = true;
};
oCancelablePromise = oPromise;
} else {
fn.apply(vContext, vArguments);
}
}
|
javascript
|
{
"resource": ""
}
|
q19457
|
invokeDebounced
|
train
|
function invokeDebounced(vContext, vArguments) {
cancelTimer();
/**
* Executes a trailing invocation if it is enabled in the options.
*
* @param {boolean} [bFinal=true] Whether this is the final invocation.
*/
function _invoke(bFinal) {
bFinal = bFinal !== false;
if (bFinal) {
cancel();
}
if (mOptions.trailing) {
invoke(vContext, vArguments, null, bFinal);
}
}
if (mOptions.requestAnimationFrame) {
iTimerId = window.requestAnimationFrame(function() {
_invoke();
});
} else {
var iNow = Date.now();
var iTimeSinceLastInvocation = iLastInvocationTime == null ? 0 : iNow - iLastInvocationTime;
var iRemainingWaitTime = Math.max(0, bMaxWait ?
Math.min(mOptions.maxWait - iTimeSinceLastInvocation, mOptions.wait) :
mOptions.wait);
var bMaxWaitInvocation = iRemainingWaitTime < mOptions.wait;
iTimerId = setTimeout(function() {
if (bMaxWaitInvocation) {
var iTimerOvertime = Math.max(0, (Date.now() - iNow) - iRemainingWaitTime);
var iCancelWaitTime = mOptions.wait - iRemainingWaitTime;
if (iTimerOvertime > iCancelWaitTime) {
// The timer took longer, maybe because of a long-running synchronous execution. No need to wait more.
_invoke();
} else {
// Because there is some time left, the timer is restarted for cleanup. This is necessary for correct scheduling if
// the debounced method is called again during this time.
iTimerId = setTimeout(cancel, iCancelWaitTime - iTimerOvertime);
_invoke(false);
}
} else {
_invoke();
}
}, iRemainingWaitTime);
}
}
|
javascript
|
{
"resource": ""
}
|
q19458
|
_invoke
|
train
|
function _invoke(bFinal) {
bFinal = bFinal !== false;
if (bFinal) {
cancel();
}
if (mOptions.trailing) {
invoke(vContext, vArguments, null, bFinal);
}
}
|
javascript
|
{
"resource": ""
}
|
q19459
|
train
|
function(oCell) {
if (!oCell) {
return null;
}
var $Cell = jQuery(oCell);
var oCellInfo = TableUtils.getCellInfo($Cell);
if (oCellInfo.isOfType(CELLTYPE.ANY | CELLTYPE.PSEUDO)) {
var $InteractiveElements = $Cell.find(INTERACTIVE_ELEMENT_SELECTORS);
if ($InteractiveElements.length > 0) {
return $InteractiveElements;
}
}
return null;
}
|
javascript
|
{
"resource": ""
}
|
|
q19460
|
train
|
function(sCSSSize, bWithUnit) {
var iPixelValue;
if (typeof sCSSSize !== "string") {
return null;
}
if (sCSSSize.endsWith("px")) {
iPixelValue = parseInt(sCSSSize);
} else if (sCSSSize.endsWith("em") || sCSSSize.endsWith("rem")) {
iPixelValue = Math.ceil(parseFloat(sCSSSize) * TableUtils.getBaseFontSize());
} else {
return null;
}
if (bWithUnit) {
return iPixelValue + "px";
} else {
return iPixelValue;
}
}
|
javascript
|
{
"resource": ""
}
|
|
q19461
|
isValidRoundtrip
|
train
|
function isValidRoundtrip(oRequestTiming) {
var bComplete, bEmpty, bCached;
// if the request has been completed it has complete timing figures)
bComplete = oRequestTiming.startTime > 0 &&
oRequestTiming.startTime <= oRequestTiming.requestStart &&
oRequestTiming.requestStart <= oRequestTiming.responseEnd;
// encodedBodySize and transferSize info are not available in all browsers
if (oRequestTiming.encodedBodySize !== undefined && oRequestTiming.transferSize !== undefined) {
// if the body is empty a script tag responded from cache is assumed
bEmpty = oRequestTiming.encodedBodySize === 0;
// if transfer size is smaller than body an xhr responded from cache is assumed
bCached = oRequestTiming.transferSize < oRequestTiming.encodedBodySize;
}
return bComplete && !bEmpty && !bCached;
}
|
javascript
|
{
"resource": ""
}
|
q19462
|
createOwnerComponentInfo
|
train
|
function createOwnerComponentInfo(oSrcElement) {
var sId, sVersion;
if (oSrcElement) {
var Component, oComponent;
Component = sap.ui.require("sap/ui/core/Component");
while (Component && oSrcElement && oSrcElement.getParent) {
oComponent = Component.getOwnerComponentFor(oSrcElement);
if (oComponent || oSrcElement instanceof Component) {
oComponent = oComponent || oSrcElement;
var oApp = oComponent.getManifestEntry("sap.app");
// get app id or module name for FESR
sId = oApp && oApp.id || oComponent.getMetadata().getName();
sVersion = oApp && oApp.applicationVersion && oApp.applicationVersion.version;
}
oSrcElement = oSrcElement.getParent();
}
}
return {
id: sId ? sId : "undetermined",
version: sVersion ? sVersion : ""
};
}
|
javascript
|
{
"resource": ""
}
|
q19463
|
handleResponse
|
train
|
function handleResponse() {
if (this.readyState === 4 && this.pendingInteraction && !this.pendingInteraction.completed) {
// enrich interaction with information
var sContentLength = this.getResponseHeader("content-length"),
bCompressed = this.getResponseHeader("content-encoding") === "gzip",
sFesrec = this.getResponseHeader("sap-perf-fesrec");
this.pendingInteraction.bytesReceived += sContentLength ? parseInt(sContentLength) : 0;
this.pendingInteraction.bytesReceived += this.getAllResponseHeaders().length;
this.pendingInteraction.bytesSent += this.requestHeaderLength || 0;
// this should be true only if all responses are compressed
this.pendingInteraction.requestCompression = bCompressed && (this.pendingInteraction.requestCompression !== false);
// sap-perf-fesrec header contains milliseconds
this.pendingInteraction.networkTime += sFesrec ? Math.round(parseFloat(sFesrec, 10) / 1000) : 0;
var sSapStatistics = this.getResponseHeader("sap-statistics");
if (sSapStatistics) {
var aTimings = window.performance.getEntriesByType("resource");
this.pendingInteraction.sapStatistics.push({
// add response url for mapping purposes
url: this.responseURL,
statistics: sSapStatistics,
timing: aTimings ? aTimings[aTimings.length - 1] : undefined
});
}
delete this.requestHeaderLength;
delete this.pendingInteraction;
}
}
|
javascript
|
{
"resource": ""
}
|
q19464
|
train
|
function(fnFilter) {
var aFilteredInteractions = [];
if (fnFilter) {
for (var i = 0, l = aInteractions.length; i < l; i++) {
if (fnFilter(aInteractions[i])) {
aFilteredInteractions.push(aInteractions[i]);
}
}
}
return aFilteredInteractions;
}
|
javascript
|
{
"resource": ""
}
|
|
q19465
|
train
|
function(sType, oSrcElement) {
var iTime = now();
if (oPendingInteraction) {
finalizeInteraction(iTime);
}
// clear request timings for new interaction
if (window.performance.clearResourceTimings) {
window.performance.clearResourceTimings();
}
var oComponentInfo = createOwnerComponentInfo(oSrcElement);
// setup new pending interaction
oPendingInteraction = createMeasurement(iTime);
oPendingInteraction.event = sType;
oPendingInteraction.component = oComponentInfo.id;
oPendingInteraction.appVersion = oComponentInfo.version;
oPendingInteraction.start = iTime;
if (oSrcElement && oSrcElement.getId) {
oPendingInteraction.trigger = oSrcElement.getId();
}
Log.info("Interaction step started: trigger: " + oPendingInteraction.trigger + "; type: " + oPendingInteraction.event, "Interaction.js");
}
|
javascript
|
{
"resource": ""
}
|
|
q19466
|
train
|
function(bForce) {
if (oPendingInteraction) {
// set provisionary processing time from start to end and calculate later
if (!bForce) {
oPendingInteraction.processing = now() - oPendingInteraction.start;
} else {
finalizeInteraction(now());
}
}
}
|
javascript
|
{
"resource": ""
}
|
|
q19467
|
train
|
function(oEvent) {
if (bInteractionActive) {
// notify for a newly started interaction, but not more often than every 250ms.
if (!iScrollEventDelayId) {
Interaction.notifyEventStart(oEvent);
} else {
clearTimeout(iScrollEventDelayId);
}
iScrollEventDelayId = setTimeout(function(){
Interaction.notifyStepStart();
iScrollEventDelayId = 0;
}, 250);
}
}
|
javascript
|
{
"resource": ""
}
|
|
q19468
|
train
|
function(data, select, currentPath) {
var result = {};
// traversed path to get to data:
currentPath = currentPath || '';
if (typeof data !== 'object') {
return data;
}
if (typeof data.slice === 'function') {
return data.map(function(el, index) {
return fnMultiSelect(el, select, currentPath); // on same path
});
}
// If Object:
// Handle "__metadata" property
if (data.__metadata !== undefined && currentPath.length === 0) {
result.__metadata = data.__metadata;
}
// Take the relevant paths only.
select.filter(function(path) {
return (path + '/').indexOf(currentPath) === 0;
}).forEach(function(path, _, innerSelect) {
// then get the next property in given path
var propertyKey = path.substr(currentPath.length).split('/')[0];
// Check if we have that propertyKey on the current object
if (data[propertyKey] !== undefined) {
// in this case recurse again while adding this to the current path
result[propertyKey] = fnMultiSelect(data[propertyKey], innerSelect, currentPath + propertyKey + '/');
}
});
// Add specific results case handling
if (data.results !== undefined) { // recurse with same path
result.results = fnMultiSelect(data.results, select, currentPath);
}
return result;
}
|
javascript
|
{
"resource": ""
}
|
|
q19469
|
train
|
function(sRole, aAssociation, aAssociationSet, bFrom) {
var sEntitySet = jQuery(aAssociationSet).find("End[Role='" + sRole + "']").attr("EntitySet");
var sMultiplicity = jQuery(aAssociation).find("End[Role='" + sRole + "']").attr("Multiplicity");
var aPropRef = [];
var aConstraint = jQuery(aAssociation).find("ReferentialConstraint > [Role='" + sRole + "']");
if (aConstraint && aConstraint.length > 0) {
jQuery(aConstraint[0]).children("PropertyRef").each(function(iIndex, oPropRef) {
aPropRef.push(jQuery(oPropRef).attr("Name"));
});
} else {
var oPrinDeps = (bFrom) ? oPrincipals : oDependents;
jQuery(oPrinDeps).each(function(iIndex, oPrinDep) {
if (sRole === (jQuery(oPrinDep).attr("Role"))) {
jQuery(oPrinDep).children("PropertyRef").each(function(iIndex, oPropRef) {
aPropRef.push(jQuery(oPropRef).attr("Name"));
});
return false;
}
});
}
return {
"role": sRole,
"entitySet": sEntitySet,
"propRef": aPropRef,
"multiplicity": sMultiplicity
};
}
|
javascript
|
{
"resource": ""
}
|
|
q19470
|
train
|
function(sEntitySetName, sKeys) {
sKeys = decodeURIComponent(sKeys);
var oFoundEntry;
var oEntitySet = that._mEntitySets[sEntitySetName];
var aKeys = oEntitySet.keys;
// split keys
var aRequestedKeys = sKeys.split(',');
// check number of keys to be equal to the entity keys and validates keys type for quotations
if (aRequestedKeys.length !== aKeys.length) {
that._logAndThrowMockServerCustomError(400, that._oErrorMessages.INVALID_KEY_PREDICATE_QUANTITY);
}
that._isRequestedKeysValid(oEntitySet, aRequestedKeys);
if (aRequestedKeys.length === 1 && !aRequestedKeys[0].split('=')[1]) {
aRequestedKeys = [aKeys[0] + "=" + aRequestedKeys[0]];
}
jQuery.each(that._oMockdata[sEntitySetName], function(iIndex, oEntry) {
// check each key for existence and value
for (var i = 0; i < aRequestedKeys.length; i++) {
var aKeyVal = aRequestedKeys[i].split('=');
var sKey = that._trim(aKeyVal[0]);
//key doesn't match, continue to next entry
if (!aKeys || aKeys.indexOf(sKey) === -1) {
return true; // = continue
}
var sNewValue = that._trim(aKeyVal[1]);
var sOrigiValue = oEntry[sKey];
switch (oEntitySet.keysType[sKey]) {
case "Edm.String":
sNewValue = sNewValue.replace(/^\'|\'$/g, '');
break;
case "Edm.Time":
case "Edm.DateTime":
sOrigiValue = that._getDateTime(sOrigiValue);
break;
case "Edm.Int16":
case "Edm.Int32":
//case "Edm.Int64": In ODataModel this type is represented as a string. (https://openui5.hana.ondemand.com/docs/api/symbols/sap.ui.model.odata.type.Int64.html)
case "Edm.Decimal":
case "Edm.Byte":
case "Edm.Double":
case "Edm.Single":
case "Edm.SByte":
if (!that._isValidNumber(sNewValue)) {
//TODO check better handling
return false; // = break
}
sNewValue = parseFloat(sNewValue);
break;
case "Edm.Guid":
sNewValue = sNewValue.replace(/^guid\'|\'$/g, '');
break;
case "Edm.Boolean":
if (["true", "false"].indexOf(sNewValue) === -1) {
that._logAndThrowMockServerCustomError(400, that._oErrorMessages.INVALID_KEY_TYPE, sKey);
}
sNewValue = sNewValue === "true";
break;
case "Edm.Binary":
case "Edm.DateTimeOffset":
default:
sNewValue = sNewValue;
}
//value doesn't match, continue to next entry
if (sOrigiValue !== sNewValue) {
return true; // = continue
}
}
oFoundEntry = {
index: iIndex,
entry: oEntry
};
return false; // = break
});
return oFoundEntry;
}
|
javascript
|
{
"resource": ""
}
|
|
q19471
|
train
|
function(aUrlParams) {
var aUrlParamsNormalized = [];
var fnStartsWith = function(sValue) {
var apostLocation = sValue.indexOf("'");
var doubleQuotesLocation = sValue.indexOf("\"");
if (apostLocation === -1 && doubleQuotesLocation === -1) {
return null;
} else {
if (apostLocation > -1 && doubleQuotesLocation === -1) {
return "appost";
}
if (doubleQuotesLocation > -1 && apostLocation === -1) {
return "doublequotes";
}
if (apostLocation > -1 && doubleQuotesLocation > -1 && apostLocation < doubleQuotesLocation) {
return "appost";
}
if (apostLocation > -1 && doubleQuotesLocation > -1 && doubleQuotesLocation < apostLocation) {
return "doublequotes";
}
}
};
var fnAmpersandHandler = function(aParams, aParamsNorm, index, apostType) {
var stringAmpersand = aParams[index];
var j = index + 1;
while (j < aParams.length && aParams[j].indexOf(apostType) === -1) {
stringAmpersand = stringAmpersand + "&" + aParams[j];
j++;
}
stringAmpersand = stringAmpersand + "&" + aParams[j];
aParamsNorm.push(stringAmpersand);
index = j;
return index;
};
for (var i = 0; i < aUrlParams.length; i++) {
// there is no ' and no " in param values
if (!fnStartsWith(aUrlParams[i])) {
aUrlParamsNormalized.push(aUrlParams[i]);
}
// there is ' in param value
if (fnStartsWith(aUrlParams[i]) === "appost") {
var firstLocation = aUrlParams[i].indexOf("'");
if (aUrlParams[i].indexOf("'", firstLocation + 1) === -1) {
i = fnAmpersandHandler(aUrlParams, aUrlParamsNormalized, i, "'");
} else {
aUrlParamsNormalized.push(aUrlParams[i]);
}
}
// there is " in param value
if (fnStartsWith(aUrlParams[i]) === "doublequotes") {
var firstQuotesLocation = aUrlParams[i].indexOf("\"");
if (aUrlParams[i].indexOf("\"", firstQuotesLocation + 1) === -1) {
i = fnAmpersandHandler(aUrlParams, aUrlParamsNormalized, i, "\"");
} else {
aUrlParamsNormalized.push(aUrlParams[i]);
}
}
}
return aUrlParamsNormalized;
}
|
javascript
|
{
"resource": ""
}
|
|
q19472
|
_showDayPicker
|
train
|
function _showDayPicker(){
if (this._iMode == 3) {
_hideYearPicker.call(this, true);
}else if (this._iMode == 2) {
_hideMonthPicker.call(this, true);
}
var oDate = this._getFocusedDate();
var iItems = this._getItems();
var oDatesRow = this.getAggregation("datesRow");
var oDateRange = oDatesRow.getSelectedDates()[0];
oDateRange.setStartDate(CalendarUtils._createLocalDate(oDate, true));
// set number of days - but max number of days of this month
var oLastDayOfMonth = new UniversalDate(oDate.getTime());
oLastDayOfMonth.setUTCDate(1);
oLastDayOfMonth.setUTCMonth(oLastDayOfMonth.getUTCMonth() + 1);
oLastDayOfMonth.setUTCDate(0);
var iLastDay = oLastDayOfMonth.getUTCDate();
var iDays = Math.floor(iItems * 1.5);
if (iDays > iLastDay) {
// to be limited on real month length by opening
iDays = iLastDay;
}
oDatesRow.setDays(iDays);
if (oDatesRow.getDomRef()) {
// already rendered
oDatesRow.$().css("display", "");
} else {
var oRm = sap.ui.getCore().createRenderManager();
var $Container = this.$("content");
oRm.renderControl(oDatesRow);
oRm.flush($Container[0], false, true); // insert it
oRm.destroy();
}
this._showOverlay();
// set start date and focus date
_setDateInDatesRow.call(this, oDate);
if (this._iMode == 0) {
// remove tabindex from item
var oTimesRow = this.getAggregation("timesRow");
jQuery(oTimesRow._oItemNavigation.getItemDomRefs()[oTimesRow._oItemNavigation.getFocusedIndex()]).attr("tabindex", "-1");
}
this._iMode = 1;
}
|
javascript
|
{
"resource": ""
}
|
q19473
|
_hideDayPicker
|
train
|
function _hideDayPicker(bSkipFocus){
this._iMode = 0;
var oDatesRow = this.getAggregation("datesRow");
oDatesRow.$().css("display", "none");
this._hideOverlay();
if (!bSkipFocus) {
_renderTimesRow.call(this); // to focus date
// restore tabindex because if date not changed in _renderTimesRow only the focused date is updated
var oTimesRow = this.getAggregation("timesRow");
jQuery(oTimesRow._oItemNavigation.getItemDomRefs()[oTimesRow._oItemNavigation.getFocusedIndex()]).attr("tabindex", "0");
}
}
|
javascript
|
{
"resource": ""
}
|
q19474
|
_showMonthPicker
|
train
|
function _showMonthPicker(){
if (this._iMode == 1) {
_hideDayPicker.call(this, true);
}else if (this._iMode == 3) {
_hideYearPicker.call(this, true);
}
var oDate = this._getFocusedDate();
var oMonthPicker = this.getAggregation("monthPicker");
if (oMonthPicker.getDomRef()) {
// already rendered
oMonthPicker.$().css("display", "");
} else {
var oRm = sap.ui.getCore().createRenderManager();
var $Container = this.$("content");
oRm.renderControl(oMonthPicker);
oRm.flush($Container[0], false, true); // insert it
oRm.destroy();
}
this._showOverlay();
oMonthPicker.setMonth(oDate.getUTCMonth());
_setDisabledMonths.call(this, oDate.getUTCFullYear(), oMonthPicker);
if (this._iMode == 0) {
// remove tabindex from item
var oTimesRow = this.getAggregation("timesRow");
jQuery(oTimesRow._oItemNavigation.getItemDomRefs()[oTimesRow._oItemNavigation.getFocusedIndex()]).attr("tabindex", "-1");
}
this._iMode = 2;
_togglePrevNext.call(this);
}
|
javascript
|
{
"resource": ""
}
|
q19475
|
_hideMonthPicker
|
train
|
function _hideMonthPicker(bSkipFocus){
this._iMode = 0;
var oMonthPicker = this.getAggregation("monthPicker");
oMonthPicker.$().css("display", "none");
this._hideOverlay();
if (!bSkipFocus) {
_renderTimesRow.call(this); // to focus date
// restore tabindex because if date not changed in _renderTimesRow only the focused date is updated
var oTimesRow = this.getAggregation("timesRow");
jQuery(oTimesRow._oItemNavigation.getItemDomRefs()[oTimesRow._oItemNavigation.getFocusedIndex()]).attr("tabindex", "0");
}
}
|
javascript
|
{
"resource": ""
}
|
q19476
|
_hideYearPicker
|
train
|
function _hideYearPicker(bSkipFocus){
this._iMode = 0;
var oYearPicker = this.getAggregation("yearPicker");
oYearPicker.$().css("display", "none");
this._hideOverlay();
if (!bSkipFocus) {
_renderTimesRow.call(this); // to focus date
// restore tabindex because if date not changed in _renderTimesRow only the focused date is updated
var oTimesRow = this.getAggregation("timesRow");
jQuery(oTimesRow._oItemNavigation.getItemDomRefs()[oTimesRow._oItemNavigation.getFocusedIndex()]).attr("tabindex", "0");
}
}
|
javascript
|
{
"resource": ""
}
|
q19477
|
_handleDateFocus
|
train
|
function _handleDateFocus(oEvent){
var oFocusedDate = new UniversalDate(this._getFocusedDate().getTime());
var oDate = CalendarUtils._createUniversalUTCDate(oEvent.getParameter("date"), undefined, true);
var bNotVisible = oEvent.getParameter("otherMonth");
if (bNotVisible &&
oDate.getUTCMonth() == oFocusedDate.getUTCMonth() &&
oDate.getUTCFullYear() == oFocusedDate.getUTCFullYear()) {
// only show days in the same month
// set start date and focus date
_setDateInDatesRow.call(this, oDate);
}
}
|
javascript
|
{
"resource": ""
}
|
q19478
|
_handleSelectMonth
|
train
|
function _handleSelectMonth(oEvent){
var oFocusedDate = new UniversalDate(this._getFocusedDate().getTime());
var oMonthPicker = this.getAggregation("monthPicker");
var iMonth = oMonthPicker.getMonth();
oFocusedDate.setUTCMonth(iMonth);
if (iMonth != oFocusedDate.getUTCMonth() ) {
// day did not exist in this month (e.g. 31) -> go to last day of month
oFocusedDate.setUTCDate(0);
}
_focusDate.call(this, oFocusedDate, true);
_hideMonthPicker.call(this);
}
|
javascript
|
{
"resource": ""
}
|
q19479
|
_handleSelectYear
|
train
|
function _handleSelectYear(oEvent){
var oFocusedDate = new UniversalDate(this._getFocusedDate().getTime());
var oYearPicker = this.getAggregation("yearPicker");
var oDate = CalendarUtils._createUniversalUTCDate(oYearPicker.getDate());
var iMonth = oFocusedDate.getUTCMonth();
oDate.setUTCMonth(oFocusedDate.getUTCMonth(), oFocusedDate.getUTCDate()); // to keep day and month stable also for islamic date
oDate.setUTCHours(oFocusedDate.getUTCHours());
oDate.setUTCMinutes(oFocusedDate.getUTCMinutes());
oFocusedDate = oDate;
if (iMonth != oFocusedDate.getUTCMonth() ) {
// day did not exist in this year (29. Feb) -> go to last day of month
oFocusedDate.setUTCDate(0);
}
_focusDate.call(this, oFocusedDate, true);
_hideYearPicker.call(this);
}
|
javascript
|
{
"resource": ""
}
|
q19480
|
_setDateInDatesRow
|
train
|
function _setDateInDatesRow(oDate) {
var oDatesRow = this.getAggregation("datesRow");
var oHeader = this.getAggregation("header");
if (!this.getPickerPopup()) {
// set number of days - but max number of days of this month
var oLastDayOfMonth = new UniversalDate(oDate.getTime());
oLastDayOfMonth.setUTCDate(1);
oLastDayOfMonth.setUTCMonth(oLastDayOfMonth.getUTCMonth() + 1);
oLastDayOfMonth.setUTCDate(0);
var iDays = oDatesRow.getDays();
// set start day and selected day
var oStartDate = new UniversalDate(oDate.getTime());
oStartDate.setUTCDate( 1 + (Math.ceil(oDate.getUTCDate() / iDays) - 1) * iDays );
if (oLastDayOfMonth.getUTCDate() - oStartDate.getUTCDate() < iDays) {
oStartDate.setUTCDate(oLastDayOfMonth.getUTCDate() - iDays + 1);
}
oDatesRow.setStartDate(CalendarUtils._createLocalDate(oStartDate, true));
var iYear = oStartDate.getJSDate().getUTCFullYear();
var iYearMax = this._oMaxDate.getJSDate().getUTCFullYear();
var iYearMin = this._oMinDate.getJSDate().getUTCFullYear();
var iMonth = oStartDate.getJSDate().getUTCMonth();
var iMonthMax = this._oMaxDate.getJSDate().getUTCMonth();
var iMonthMin = this._oMinDate.getJSDate().getUTCMonth();
var iDate = oStartDate.getJSDate().getUTCDate();
var iDateMax = this._oMaxDate.getJSDate().getUTCDate();
var iDateMin = this._oMinDate.getJSDate().getUTCDate();
if (iDate <= 1 || (iYear == iYearMin && iMonth == iMonthMin && iDate <= iDateMin)) {
oHeader.setEnabledPrevious(false);
} else {
oHeader.setEnabledPrevious(true);
}
if ((iDate + iDays) >= oLastDayOfMonth.getUTCDate() || (iYear == iYearMax && iMonth == iMonthMax && iDate >= iDateMax)) {
oHeader.setEnabledNext(false);
} else {
oHeader.setEnabledNext(true);
}
} else {
oHeader.setEnabledPrevious(false);
oHeader.setEnabledNext(false);
}
oDatesRow.setDate(CalendarUtils._createLocalDate(oDate, true));
}
|
javascript
|
{
"resource": ""
}
|
q19481
|
train
|
function(oField, oDate, bUTC, oFormat) {
var iDay = bUTC ? oDate.getUTCDay() : oDate.getDay();
if (oField.digits < 4) {
return oFormat.aDaysAbbrev[iDay];
} else if (oField.digits == 4) {
return oFormat.aDaysWide[iDay];
} else if (oField.digits == 5) {
return oFormat.aDaysNarrow[iDay];
} else {
return oFormat.aDaysShort[iDay];
}
}
|
javascript
|
{
"resource": ""
}
|
|
q19482
|
mergeWithoutOverwrite
|
train
|
function mergeWithoutOverwrite(object1, object2) {
if (object1 === object2) {
return object1;
}
var oMergedObject = {};
// Clone object1
Object.keys(object1).forEach(function(sKey) {
oMergedObject[sKey] = object1[sKey];
});
// merge
Object.keys(object2).forEach(function(sKey) {
if (!oMergedObject.hasOwnProperty(sKey)) {
oMergedObject[sKey] = object2[sKey];
}
});
return oMergedObject;
}
|
javascript
|
{
"resource": ""
}
|
q19483
|
train
|
function(oControl) {
var oAppComponent = Utils.getAppComponentForControl(oControl);
var oFlexController = FlexControllerFactory.createForControl(oAppComponent);
var oRootControl = oAppComponent.getRootControl();
var oView = Utils.getViewForControl(oControl);
var oVariantModel = oAppComponent.getModel("$FlexVariants");
var mParams = {
rootControl : oRootControl,
view : oView,
variantModel : oVariantModel,
variantManagement : {},
flexController: oFlexController
};
var oVMControl;
var aForControlTypes;
jQuery.makeArray(mParams.rootControl.$().find(".sapUiFlVarMngmt")).map(function(oVariantManagementNode) {
oVMControl = sap.ui.getCore().byId(oVariantManagementNode.id);
if (oVMControl.getMetadata().getName() === "sap.ui.fl.variants.VariantManagement") {
aForControlTypes = oVMControl.getFor();
aForControlTypes.forEach(function(sControlType) {
mParams.variantManagement[sControlType] = mParams.variantModel.getLocalId(oVariantManagementNode.id, oAppComponent);
});
}
});
return mParams;
}
|
javascript
|
{
"resource": ""
}
|
|
q19484
|
train
|
function(oControl, mParams) {
mParams = mParams || this._determineParameters(oControl);
var fnCheckForControl = function (oControl) {
if (!mParams.variantManagement[oControl.getId()] && oControl.getParent() && oControl.getId() !== mParams.rootControl.getId()) {
return fnCheckForControl(oControl.getParent());
} else if (!oControl.getParent() || oControl.getId() === mParams.rootControl.getId()) {
return mParams.variantManagement[oControl.getId()] || "";
} else {
return mParams.variantManagement[oControl.getId()];
}
};
return fnCheckForControl(oControl);
}
|
javascript
|
{
"resource": ""
}
|
|
q19485
|
train
|
function(aControls, aChangeTypes) {
if (!aControls || aControls.length === 0) {
return this._reject("At least one control ID has to be provided as a parameter");
}
var oAppComponent = aControls[0].appComponent || Utils.getAppComponentForControl(aControls[0]);
if (!oAppComponent) {
return this._reject("App Component could not be determined");
}
var aIdsOfPassedControls = aControls.map(function (oControl) {
return oControl.id || oControl.getId();
});
var oFlexController = FlexControllerFactory.createForControl(oAppComponent);
return oFlexController.getComponentChanges({currentLayer: "USER", includeCtrlVariants: true})
.then(function (aChanges) {
return aChanges
.filter(this._filterBySelectors.bind(this, oAppComponent, aIdsOfPassedControls))
.filter(this._filterByChangeType.bind(this, aChangeTypes))
.some(this._ifValidFileType);
}.bind(this));
}
|
javascript
|
{
"resource": ""
}
|
|
q19486
|
train
|
function(oControl) {
try {
return !!this._getVariantManagement(oControl);
} catch (oError) {
Utils.log.error(oError.message);
return false;
}
}
|
javascript
|
{
"resource": ""
}
|
|
q19487
|
validateRegex
|
train
|
function validateRegex(sRegex) {
if (/.+/i.test(sRegex)) {
return true;
}
Log.error("The regex value '" + sRegex + "' is not valid");
return false;
}
|
javascript
|
{
"resource": ""
}
|
q19488
|
train
|
function(oAtt, aResult){
if (!oAtt.getSelected()) {
return;
}
aResult.push(oAtt);
var aValues = oAtt.getAttributesInternal();
for (var idx = 0; idx < aValues.length; idx++) {
_computeSelectedAttributes(aValues[idx], aResult);
}
}
|
javascript
|
{
"resource": ""
}
|
|
q19489
|
train
|
function(oList, bArrow){
function getNextOnSameLevel(oLst){
var oParent = oLst.getParent();
var aParentSubLists = oParent.getSubLists();
var idx = oParent.indexOfSubList(oLst) + 1;
if (idx < aParentSubLists.length) {
return aParentSubLists[idx];
}
return null;
}
function getFirstChild(oLst){
var aSubLists = oLst.getSubLists();
if (aSubLists.length > 0) {
return aSubLists[0];
}
return null;
}
function getNext(oLst){
var oNextListRef = getNextOnSameLevel(oLst);
if (oNextListRef) {
return oNextListRef;
}
var oParent = oLst.getParent();
if (oParent._iLevel > (bArrow ? 1 : 0)) {
return getNext(oParent);
} else {
return null;
}
}
if (oList._iLevel == 0) {
return getFirstChild(oList);
} else if (oList._iLevel == 1) {
return bArrow ? getFirstChild(oList) : getNextOnSameLevel(oList);
} else if (oList._iLevel > 1) {
var oNextList = getFirstChild(oList);
if (oNextList) {
return oNextList;
}
return getNext(oList);
}
return null;
}
|
javascript
|
{
"resource": ""
}
|
|
q19490
|
train
|
function(oList, oAttr){
if (oList._getAtt().getListOrder() != ExactOrder.Fixed /*Select*/) {
return -1;
}
var aAttributes = oList._getAtt().getAttributes();
var idx = 0;
for (var i = 0; i < aAttributes.length; i++) {
if (aAttributes[i] === oAttr) {
break;
}
if (aAttributes[i].getChangeListener()) {
idx++;
}
}
return idx;
}
|
javascript
|
{
"resource": ""
}
|
|
q19491
|
train
|
function(jRef, bWidth, iValue, fDoBefore, fDoAfter){
if (fDoBefore) {
var iVal = fDoBefore(jRef);
if (iVal != undefined) {
iValue = iVal;
}
}
var _fDoAfter = fDoAfter ? function(){fDoAfter(jRef);} : function(){};
if (jQuery.fx.off) {
if (bWidth) {
jRef.width(iValue);
} else {
jRef.height(iValue);
}
_fDoAfter();
} else {
var oParam = bWidth ? {width: iValue} : {height: iValue};
jRef.stop(true, true).animate(oParam, 200, 'linear', _fDoAfter);
}
}
|
javascript
|
{
"resource": ""
}
|
|
q19492
|
train
|
function(oEvent){
var iCurrentX = oEvent.pageX;
var iDiff = this._bRTL ? (this._iStartDragX - iCurrentX) : (iCurrentX - this._iStartDragX);
setWidth(this, this._iStartWidth + iDiff);
}
|
javascript
|
{
"resource": ""
}
|
|
q19493
|
train
|
function(oEvent){
jQuery(document.body).unbind("selectstart." + this.getId()).unbind("mouseup." + this.getId()).unbind("mousemove." + this.getId());
this.$("ghost").remove();
this.$("rsz").removeClass("sapUiUx3ExactLstRSzDrag");
this._iStartWidth = undefined;
this._iStartDragX = undefined;
this.focus();
}
|
javascript
|
{
"resource": ""
}
|
|
q19494
|
train
|
function(oList, iWidth){
iWidth = ExactAttribute._checkWidth(iWidth);
var sPos = oList._bRTL ? "right" : "left";
oList._iCurrentWidth = iWidth;
oList._getAtt()._setWidth(oList._iCurrentWidth);
oList.$("lst").css("width", iWidth + "px");
oList.$("rsz").css(sPos, (iWidth - 4) + "px");
if (oList._isTop()) {
if (!isTopHidden(oList)) {
oList.$("head").css("width", iWidth + "px");
oList.$("cntnt").css(sPos, (iWidth + 8) + "px");
oList.$("scroll").css(sPos, (iWidth + 8) + "px");
}
} else {
if (!oList.$().hasClass("sapUiUx3ExactLstCollapsed")) {
oList.$("cntnt").css("margin-" + sPos, iWidth + "px");
}
}
}
|
javascript
|
{
"resource": ""
}
|
|
q19495
|
train
|
function(oList){
var oAtt = oList._getAtt();
if (oAtt && !oList._isTop()) {
oList.$("head-txt").html(encodeXML(oAtt.getText())
+ "<span class=\"sapUiUx3ExactLstHeadInfo\"> (" + oList._lb.getSelectedIndices().length + "/" + oList._lb.getItems().length + ")</span>");
}
}
|
javascript
|
{
"resource": ""
}
|
|
q19496
|
train
|
function(oList, iLevel){
oList._iLevel = iLevel;
var aLists = oList.getSubLists();
for (var i = 0; i < aLists.length; i++) {
setLevel(aLists[i], iLevel + 1);
}
}
|
javascript
|
{
"resource": ""
}
|
|
q19497
|
train
|
function(oList){
if (oList._lb) {
var jListRef = jQuery(oList._lb.getDomRef());
oList.$("lst").removeClass("sapUiUx3ExactLstScroll");
if (jListRef.length > 0 && jListRef.outerHeight() < jListRef[0].scrollHeight) {
oList.$("lst").addClass("sapUiUx3ExactLstScroll");
return true;
}
}
return false;
}
|
javascript
|
{
"resource": ""
}
|
|
q19498
|
train
|
function(oList) {
if (oList._bCollapsed) {
var iWidth = oList.$("cntnt").height() - 50/*Space for Header Action Buttons - Maybe provide theme parameter in future*/;
var $txt = oList.$("head-txt");
$txt.css("width", iWidth + "px");
}
var aSubLists = oList.getSubLists();
for (var i = 0; i < aSubLists.length; i++) {
refreshCollapseHeaderTextWidth(aSubLists[i]);
}
}
|
javascript
|
{
"resource": ""
}
|
|
q19499
|
train
|
function(oList){
var jListContRef = oList.$("lst");
if (jListContRef.hasClass("sapUiUx3ExactLstExpanded")) {
//collapse
oList._oPopup.close();
} else {
//expand
oList._oPopup.open();
}
}
|
javascript
|
{
"resource": ""
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.