repo
stringlengths 5
67
| path
stringlengths 4
116
| func_name
stringlengths 0
58
| original_string
stringlengths 52
373k
| language
stringclasses 1
value | code
stringlengths 52
373k
| code_tokens
list | docstring
stringlengths 4
11.8k
| docstring_tokens
list | sha
stringlengths 40
40
| url
stringlengths 86
226
| partition
stringclasses 1
value |
---|---|---|---|---|---|---|---|---|---|---|---|
SAP/openui5
|
src/sap.ui.core/src/sap/ui/core/Configuration.js
|
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
|
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;
}
|
[
"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",
";",
"}"
] |
Allows to specify one of the legacy ABAP time formats.
This method sets the time patterns for 'short' and 'medium' style to the corresponding ABAP
formats and sets the day period texts to "AM"/"PM" or "am"/"pm" respectively. When called
with a null or undefined format id, any previously applied format will be removed.
After changing the legacy time format, the framework tries to update localization
specific parts of the UI. See the documentation of {@link sap.ui.core.Configuration#setLanguage}
for details and restrictions.
@param {string} sFormatId id of the ABAP time format (one of '0','1','2','3','4')
@return {sap.ui.core.Configuration.FormatSettings} Returns <code>this</code> to allow method chaining
@public
|
[
"Allows",
"to",
"specify",
"one",
"of",
"the",
"legacy",
"ABAP",
"time",
"formats",
"."
] |
8a832fca01cb1cdf8df589788e0c5723e2a33c70
|
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/Configuration.js#L2092-L2101
|
train
|
|
SAP/openui5
|
src/sap.ui.core/src/sap/ui/core/Configuration.js
|
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
|
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;
}
|
[
"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",
";",
"}"
] |
Allows to specify one of the legacy ABAP number format.
This method will modify the 'group' and 'decimal' symbols. When called with a null
or undefined format id, any previously applied format will be removed.
After changing the legacy number format, the framework tries to update localization
specific parts of the UI. See the documentation of {@link sap.ui.core.Configuration#setLanguage}
for details and restrictions.
@param {string} sFormatId id of the ABAP number format set (one of ' ','X','Y')
@return {sap.ui.core.Configuration.FormatSettings} Returns <code>this</code> to allow method chaining
@public
|
[
"Allows",
"to",
"specify",
"one",
"of",
"the",
"legacy",
"ABAP",
"number",
"format",
"."
] |
8a832fca01cb1cdf8df589788e0c5723e2a33c70
|
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/Configuration.js#L2126-L2135
|
train
|
|
SAP/openui5
|
src/sap.ui.core/src/sap/ui/core/Configuration.js
|
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
|
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;
}
|
[
"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",
";",
"}"
] |
Allows to specify the customizing data for Islamic calendar support
@param {object[]} aMappings contains the customizing data for the support of Islamic calendar.
@param {string} aMappings[].dateFormat The date format
@param {string} aMappings[].islamicMonthStart The Islamic date
@param {string} aMappings[].gregDate The corresponding Gregorian date
@return {sap.ui.core.Configuration.FormatSettings} Returns <code>this</code> to allow method chaining
@public
|
[
"Allows",
"to",
"specify",
"the",
"customizing",
"data",
"for",
"Islamic",
"calendar",
"support"
] |
8a832fca01cb1cdf8df589788e0c5723e2a33c70
|
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/Configuration.js#L2147-L2154
|
train
|
|
SAP/openui5
|
src/sap.ui.table/src/sap/ui/table/TableAccExtension.js
|
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
|
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");
}
|
[
"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\"",
")",
";",
"}"
] |
Delegate for the focusin event.
@private
@param {jQuery.Event} oEvent The event object.
|
[
"Delegate",
"for",
"the",
"focusin",
"event",
"."
] |
8a832fca01cb1cdf8df589788e0c5723e2a33c70
|
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/TableAccExtension.js#L958-L968
|
train
|
|
SAP/openui5
|
src/sap.ui.table/src/sap/ui/table/TableAccExtension.js
|
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
|
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);
}
|
[
"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",
")",
";",
"}"
] |
Delegate for the focusout event.
@private
@param {jQuery.Event} oEvent The event object.
|
[
"Delegate",
"for",
"the",
"focusout",
"event",
"."
] |
8a832fca01cb1cdf8df589788e0c5723e2a33c70
|
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/TableAccExtension.js#L976-L992
|
train
|
|
SAP/openui5
|
src/sap.ui.commons/src/sap/ui/commons/layout/AbsoluteLayout.js
|
function(aPositions) {
for (var index = 0; index < aPositions.length; index++) {
var oPosition = aPositions[index];
var oChildControl = oPosition.getControl();
if (oChildControl) {
AbsoluteLayout.cleanUpControl(oChildControl);
}
}
}
|
javascript
|
function(aPositions) {
for (var index = 0; index < aPositions.length; index++) {
var oPosition = aPositions[index];
var oChildControl = oPosition.getControl();
if (oChildControl) {
AbsoluteLayout.cleanUpControl(oChildControl);
}
}
}
|
[
"function",
"(",
"aPositions",
")",
"{",
"for",
"(",
"var",
"index",
"=",
"0",
";",
"index",
"<",
"aPositions",
".",
"length",
";",
"index",
"++",
")",
"{",
"var",
"oPosition",
"=",
"aPositions",
"[",
"index",
"]",
";",
"var",
"oChildControl",
"=",
"oPosition",
".",
"getControl",
"(",
")",
";",
"if",
"(",
"oChildControl",
")",
"{",
"AbsoluteLayout",
".",
"cleanUpControl",
"(",
"oChildControl",
")",
";",
"}",
"}",
"}"
] |
Cleanup modifications of all child controls of the given positions.
@private
|
[
"Cleanup",
"modifications",
"of",
"all",
"child",
"controls",
"of",
"the",
"given",
"positions",
"."
] |
8a832fca01cb1cdf8df589788e0c5723e2a33c70
|
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.commons/src/sap/ui/commons/layout/AbsoluteLayout.js#L520-L528
|
train
|
|
SAP/openui5
|
src/sap.ui.commons/src/sap/ui/commons/layout/AbsoluteLayout.js
|
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
|
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;
}
|
[
"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",
";",
"}"
] |
Adapt the sizes of controls if necessary.
@private
|
[
"Adapt",
"the",
"sizes",
"of",
"controls",
"if",
"necessary",
"."
] |
8a832fca01cb1cdf8df589788e0c5723e2a33c70
|
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.commons/src/sap/ui/commons/layout/AbsoluteLayout.js#L564-L581
|
train
|
|
SAP/openui5
|
src/sap.ui.commons/src/sap/ui/commons/layout/AbsoluteLayout.js
|
function(oThis, sProp, oValue, sChangeType) {
var bHasDomRef = !!oThis.getDomRef();
oThis.setProperty(sProp, oValue, bHasDomRef);
if (bHasDomRef) {
oThis.contentChanged(null, sChangeType);
}
return oThis;
}
|
javascript
|
function(oThis, sProp, oValue, sChangeType) {
var bHasDomRef = !!oThis.getDomRef();
oThis.setProperty(sProp, oValue, bHasDomRef);
if (bHasDomRef) {
oThis.contentChanged(null, sChangeType);
}
return oThis;
}
|
[
"function",
"(",
"oThis",
",",
"sProp",
",",
"oValue",
",",
"sChangeType",
")",
"{",
"var",
"bHasDomRef",
"=",
"!",
"!",
"oThis",
".",
"getDomRef",
"(",
")",
";",
"oThis",
".",
"setProperty",
"(",
"sProp",
",",
"oValue",
",",
"bHasDomRef",
")",
";",
"if",
"(",
"bHasDomRef",
")",
"{",
"oThis",
".",
"contentChanged",
"(",
"null",
",",
"sChangeType",
")",
";",
"}",
"return",
"oThis",
";",
"}"
] |
Sets the value of the given property and triggers Dom change if
possible.
@private
|
[
"Sets",
"the",
"value",
"of",
"the",
"given",
"property",
"and",
"triggers",
"Dom",
"change",
"if",
"possible",
"."
] |
8a832fca01cb1cdf8df589788e0c5723e2a33c70
|
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.commons/src/sap/ui/commons/layout/AbsoluteLayout.js#L590-L597
|
train
|
|
SAP/openui5
|
src/sap.ui.core/src/sap/ui/model/odata/type/DateTime.js
|
adjustConstraints
|
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
|
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;
}
|
[
"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",
";",
"}"
] |
Adjusts the constraints for DateTimeBase.
@param {sap.ui.model.odata.type.DateTime} oType
the type
@param {object} [oConstraints]
constraints, see {@link #constructor}
@returns {object}
the constraints adjusted for DateTimeBase
|
[
"Adjusts",
"the",
"constraints",
"for",
"DateTimeBase",
"."
] |
8a832fca01cb1cdf8df589788e0c5723e2a33c70
|
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/type/DateTime.js#L21-L38
|
train
|
SAP/openui5
|
src/sap.ui.table/src/sap/ui/table/TableMenuUtils.js
|
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
|
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);
}
|
[
"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",
";",
"}",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"oColumns",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"oColumns",
"[",
"i",
"]",
"!==",
"oColumn",
")",
"{",
"MenuUtils",
".",
"closeColumnContextMenu",
"(",
"oTable",
",",
"i",
")",
";",
"}",
"}",
"MenuUtils",
".",
"closeDataCellContextMenu",
"(",
"oTable",
")",
";",
"var",
"colspan",
"=",
"oCell",
"&&",
"oCell",
".",
"attr",
"(",
"\"colspan\"",
")",
";",
"if",
"(",
"colspan",
"&&",
"colspan",
"!==",
"\"1\"",
")",
"{",
"return",
";",
"}",
"oColumn",
".",
"_openMenu",
"(",
"oCell",
"&&",
"oCell",
"[",
"0",
"]",
"||",
"oColumn",
".",
"getDomRef",
"(",
")",
",",
"bHoverFirstMenuItem",
")",
";",
"}"
] |
Opens the context menu of a column.
If context menus of other columns are open, they will be closed.
@param {sap.ui.table.Table} oTable Instance of the table.
@param {int} iColumnIndex The index of the column to open the context menu on.
@param {boolean} [bHoverFirstMenuItem] If <code>true</code>, the first item in the opened menu will be hovered.
@param {jQuery} oCell The column header cell to which the menu should be attached.
@see openContextMenu
@see closeColumnContextMenu
@private
|
[
"Opens",
"the",
"context",
"menu",
"of",
"a",
"column",
".",
"If",
"context",
"menus",
"of",
"other",
"columns",
"are",
"open",
"they",
"will",
"be",
"closed",
"."
] |
8a832fca01cb1cdf8df589788e0c5723e2a33c70
|
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/TableMenuUtils.js#L149-L183
|
train
|
|
SAP/openui5
|
src/sap.ui.table/src/sap/ui/table/TableMenuUtils.js
|
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
|
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();
}
|
[
"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",
"(",
")",
";",
"}"
] |
Closes the context menu of a column.
@param {sap.ui.table.Table} oTable Instance of the table.
@param {int} iColumnIndex The index of the column to close the context menu on.
@see openContextMenu
@see openColumnContextMenu
@private
|
[
"Closes",
"the",
"context",
"menu",
"of",
"a",
"column",
"."
] |
8a832fca01cb1cdf8df589788e0c5723e2a33c70
|
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/TableMenuUtils.js#L194-L207
|
train
|
|
SAP/openui5
|
src/sap.ui.table/src/sap/ui/table/TableMenuUtils.js
|
function(oTable) {
if (!oTable) {
return;
}
var oMenu = oTable._oCellContextMenu;
var bMenuOpen = oMenu != null && oMenu.bOpen;
if (bMenuOpen) {
oMenu.close();
}
}
|
javascript
|
function(oTable) {
if (!oTable) {
return;
}
var oMenu = oTable._oCellContextMenu;
var bMenuOpen = oMenu != null && oMenu.bOpen;
if (bMenuOpen) {
oMenu.close();
}
}
|
[
"function",
"(",
"oTable",
")",
"{",
"if",
"(",
"!",
"oTable",
")",
"{",
"return",
";",
"}",
"var",
"oMenu",
"=",
"oTable",
".",
"_oCellContextMenu",
";",
"var",
"bMenuOpen",
"=",
"oMenu",
"!=",
"null",
"&&",
"oMenu",
".",
"bOpen",
";",
"if",
"(",
"bMenuOpen",
")",
"{",
"oMenu",
".",
"close",
"(",
")",
";",
"}",
"}"
] |
Closes the currently open data cell context menu.
Index information are not required as there is only one data cell context menu object and therefore only this one can be open.
@param {sap.ui.table.Table} oTable Instance of the table.
@see openContextMenu
@see openDataCellContextMenu
@private
|
[
"Closes",
"the",
"currently",
"open",
"data",
"cell",
"context",
"menu",
".",
"Index",
"information",
"are",
"not",
"required",
"as",
"there",
"is",
"only",
"one",
"data",
"cell",
"context",
"menu",
"object",
"and",
"therefore",
"only",
"this",
"one",
"can",
"be",
"open",
"."
] |
8a832fca01cb1cdf8df589788e0c5723e2a33c70
|
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/TableMenuUtils.js#L313-L324
|
train
|
|
SAP/openui5
|
src/sap.ui.table/src/sap/ui/table/TableMenuUtils.js
|
function(oTable) {
if (!oTable || !oTable._oCellContextMenu) {
return;
}
oTable._oCellContextMenu.destroy();
oTable._oCellContextMenu = null;
}
|
javascript
|
function(oTable) {
if (!oTable || !oTable._oCellContextMenu) {
return;
}
oTable._oCellContextMenu.destroy();
oTable._oCellContextMenu = null;
}
|
[
"function",
"(",
"oTable",
")",
"{",
"if",
"(",
"!",
"oTable",
"||",
"!",
"oTable",
".",
"_oCellContextMenu",
")",
"{",
"return",
";",
"}",
"oTable",
".",
"_oCellContextMenu",
".",
"destroy",
"(",
")",
";",
"oTable",
".",
"_oCellContextMenu",
"=",
"null",
";",
"}"
] |
Destroys the cell context menu.
@param {sap.ui.table.Table} oTable Instance of the table.
|
[
"Destroys",
"the",
"cell",
"context",
"menu",
"."
] |
8a832fca01cb1cdf8df589788e0c5723e2a33c70
|
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/TableMenuUtils.js#L331-L338
|
train
|
|
SAP/openui5
|
src/sap.ui.core/src/sap/ui/qunit/utils/MemoryLeakCheck.js
|
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
|
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);
}
|
[
"function",
"(",
"assert",
",",
"mActual",
",",
"mExpected",
",",
"sMessage",
")",
"{",
"var",
"aUnexpectedElements",
"=",
"[",
"]",
";",
"for",
"(",
"var",
"sId",
"in",
"mActual",
")",
"{",
"if",
"(",
"!",
"mExpected",
"[",
"sId",
"]",
")",
"{",
"aUnexpectedElements",
".",
"push",
"(",
"mActual",
"[",
"sId",
"]",
")",
";",
"}",
"}",
"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",
")",
";",
"}"
] |
asserts that both given maps have the same entries
|
[
"asserts",
"that",
"both",
"given",
"maps",
"have",
"the",
"same",
"entries"
] |
8a832fca01cb1cdf8df589788e0c5723e2a33c70
|
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/qunit/utils/MemoryLeakCheck.js#L156-L174
|
train
|
|
SAP/openui5
|
src/sap.ui.core/src/sap/ui/model/odata/v2/ODataListBinding.js
|
getSortComparator
|
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
|
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);
};
}
|
[
"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",
")",
";",
"}",
";",
"}"
] |
Creates a comparator usable for sorting.
The OData comparators return "NaN" for comparisons containing null values. While this is a valid result when used for filtering,
for sorting the null values need to be put in order, so the comparator must return either -1 or 1 instead, to have null sorted
at the top in ascending order and on the bottom in descending order.
@private
|
[
"Creates",
"a",
"comparator",
"usable",
"for",
"sorting",
"."
] |
8a832fca01cb1cdf8df589788e0c5723e2a33c70
|
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/v2/ODataListBinding.js#L1269-L1282
|
train
|
SAP/openui5
|
src/sap.ui.core/src/sap/ui/core/RenderManager.js
|
reset
|
function reset() {
aBuffer = that.aBuffer = [];
aRenderedControls = that.aRenderedControls = [];
aStyleStack = that.aStyleStack = [{}];
}
|
javascript
|
function reset() {
aBuffer = that.aBuffer = [];
aRenderedControls = that.aRenderedControls = [];
aStyleStack = that.aStyleStack = [{}];
}
|
[
"function",
"reset",
"(",
")",
"{",
"aBuffer",
"=",
"that",
".",
"aBuffer",
"=",
"[",
"]",
";",
"aRenderedControls",
"=",
"that",
".",
"aRenderedControls",
"=",
"[",
"]",
";",
"aStyleStack",
"=",
"that",
".",
"aStyleStack",
"=",
"[",
"{",
"}",
"]",
";",
"}"
] |
Reset all rendering related buffers.
|
[
"Reset",
"all",
"rendering",
"related",
"buffers",
"."
] |
8a832fca01cb1cdf8df589788e0c5723e2a33c70
|
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/RenderManager.js#L114-L118
|
train
|
SAP/openui5
|
src/sap.ui.core/src/sap/ui/core/RenderManager.js
|
triggerBeforeRendering
|
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
|
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;
}
}
|
[
"function",
"triggerBeforeRendering",
"(",
"oControl",
")",
"{",
"bLocked",
"=",
"true",
";",
"try",
"{",
"var",
"oEvent",
"=",
"jQuery",
".",
"Event",
"(",
"\"BeforeRendering\"",
")",
";",
"oEvent",
".",
"srcControl",
"=",
"oControl",
";",
"oControl",
".",
"_handleEvent",
"(",
"oEvent",
")",
";",
"}",
"finally",
"{",
"bLocked",
"=",
"false",
";",
"}",
"}"
] |
Triggers the BeforeRendering event on the given Control
|
[
"Triggers",
"the",
"BeforeRendering",
"event",
"on",
"the",
"given",
"Control"
] |
8a832fca01cb1cdf8df589788e0c5723e2a33c70
|
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/RenderManager.js#L577-L587
|
train
|
SAP/openui5
|
src/sap.ui.core/src/sap/ui/core/RenderManager.js
|
isDomPatchingEnabled
|
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
|
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;
}
|
[
"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",
";",
"}"
] |
Determines whether Dom Patching is enabled or not
@returns {boolean} whether or not dom patching is enabled
@private
|
[
"Determines",
"whether",
"Dom",
"Patching",
"is",
"enabled",
"or",
"not"
] |
8a832fca01cb1cdf8df589788e0c5723e2a33c70
|
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/RenderManager.js#L1831-L1840
|
train
|
SAP/openui5
|
src/sap.ui.ux3/src/sap/ui/ux3/NotificationBarRenderer.js
|
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
|
function(oRm, oControl) {
if (oControl.getResizeEnabled()) {
fnRenderToggler(oRm, oControl);
}
if (oControl.hasItems()) {
if (oControl.getVisibleStatus() == NotificationBarStatus.Max) {
fnWriteItemsMaximized(oRm, oControl);
} else {
fnWriteItemsDefault(oRm, oControl);
}
}
}
|
[
"function",
"(",
"oRm",
",",
"oControl",
")",
"{",
"if",
"(",
"oControl",
".",
"getResizeEnabled",
"(",
")",
")",
"{",
"fnRenderToggler",
"(",
"oRm",
",",
"oControl",
")",
";",
"}",
"if",
"(",
"oControl",
".",
"hasItems",
"(",
")",
")",
"{",
"if",
"(",
"oControl",
".",
"getVisibleStatus",
"(",
")",
"==",
"NotificationBarStatus",
".",
"Max",
")",
"{",
"fnWriteItemsMaximized",
"(",
"oRm",
",",
"oControl",
")",
";",
"}",
"else",
"{",
"fnWriteItemsDefault",
"(",
"oRm",
",",
"oControl",
")",
";",
"}",
"}",
"}"
] |
Renders all notifiers
|
[
"Renders",
"all",
"notifiers"
] |
8a832fca01cb1cdf8df589788e0c5723e2a33c70
|
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.ux3/src/sap/ui/ux3/NotificationBarRenderer.js#L232-L244
|
train
|
|
SAP/openui5
|
src/sap.ui.ux3/src/sap/ui/ux3/NotificationBarRenderer.js
|
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
|
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
}
|
[
"function",
"(",
"oRm",
",",
"oNotifier",
",",
"bMessageNotifier",
")",
"{",
"var",
"sId",
"=",
"oNotifier",
".",
"getId",
"(",
")",
";",
"oRm",
".",
"write",
"(",
"\"<li\"",
")",
";",
"oRm",
".",
"writeElementData",
"(",
"oNotifier",
")",
";",
"oRm",
".",
"addClass",
"(",
"\"sapUiNotifier\"",
")",
";",
"oRm",
".",
"writeClasses",
"(",
")",
";",
"oRm",
".",
"writeAttribute",
"(",
"\"tabindex\"",
",",
"\"-1\"",
")",
";",
"oRm",
".",
"writeAttribute",
"(",
"\"aria-describedby\"",
",",
"sId",
"+",
"'-description>'",
")",
";",
"oRm",
".",
"write",
"(",
"\">\"",
")",
";",
"fnWriteNotifierIcon",
"(",
"oRm",
",",
"oNotifier",
".",
"getIcon",
"(",
")",
",",
"bMessageNotifier",
")",
";",
"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",
")",
"{",
"oRm",
".",
"write",
"(",
"'<div id=\"'",
"+",
"sId",
"+",
"'-counter\" role=\"tooltip\"'",
")",
";",
"oRm",
".",
"addClass",
"(",
"\"sapUiNotifierMessageCount\"",
")",
";",
"if",
"(",
"bMessageNotifier",
")",
"{",
"oRm",
".",
"addClass",
"(",
"\"sapUiMessage\"",
")",
";",
"}",
"oRm",
".",
"writeClasses",
"(",
")",
";",
"oRm",
".",
"write",
"(",
"\">\"",
")",
";",
"if",
"(",
"iCount",
">",
"99",
")",
"{",
"iCount",
"=",
"\">99\"",
";",
"}",
"oRm",
".",
"write",
"(",
"iCount",
")",
";",
"oRm",
".",
"write",
"(",
"\"</div>\"",
")",
";",
"}",
"oRm",
".",
"write",
"(",
"\"</li>\"",
")",
";",
"}"
] |
Renders a single notifier
|
[
"Renders",
"a",
"single",
"notifier"
] |
8a832fca01cb1cdf8df589788e0c5723e2a33c70
|
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.ux3/src/sap/ui/ux3/NotificationBarRenderer.js#L344-L389
|
train
|
|
SAP/openui5
|
src/sap.ui.ux3/src/sap/ui/ux3/NotificationBarRenderer.js
|
function(oRm, aNotifiers) {
for ( var i = 0; i < aNotifiers.length; i++) {
fnRenderNotifier(oRm, aNotifiers[i], false);
}
}
|
javascript
|
function(oRm, aNotifiers) {
for ( var i = 0; i < aNotifiers.length; i++) {
fnRenderNotifier(oRm, aNotifiers[i], false);
}
}
|
[
"function",
"(",
"oRm",
",",
"aNotifiers",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"aNotifiers",
".",
"length",
";",
"i",
"++",
")",
"{",
"fnRenderNotifier",
"(",
"oRm",
",",
"aNotifiers",
"[",
"i",
"]",
",",
"false",
")",
";",
"}",
"}"
] |
Renders given map of notifiers
|
[
"Renders",
"given",
"map",
"of",
"notifiers"
] |
8a832fca01cb1cdf8df589788e0c5723e2a33c70
|
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.ux3/src/sap/ui/ux3/NotificationBarRenderer.js#L420-L424
|
train
|
|
SAP/openui5
|
src/sap.ui.ux3/src/sap/ui/ux3/NotificationBarRenderer.js
|
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
|
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("/>");
}
|
[
"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",
"(",
")",
";",
"}"
] |
Renders the notifier's icon. If there is no icon set a default icon is
used
|
[
"Renders",
"the",
"notifier",
"s",
"icon",
".",
"If",
"there",
"is",
"no",
"icon",
"set",
"a",
"default",
"icon",
"is",
"used"
] |
8a832fca01cb1cdf8df589788e0c5723e2a33c70
|
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.ux3/src/sap/ui/ux3/NotificationBarRenderer.js#L430-L452
|
train
|
|
SAP/openui5
|
src/sap.ui.ux3/src/sap/ui/ux3/NotificationBarRenderer.js
|
function(oRm, oNotifier, oNotiBar) {
fnRenderNotifier(oRm, oNotifier, true);
fnRenderMessageNotifierMessageArea(oRm, oNotifier, oNotiBar);
}
|
javascript
|
function(oRm, oNotifier, oNotiBar) {
fnRenderNotifier(oRm, oNotifier, true);
fnRenderMessageNotifierMessageArea(oRm, oNotifier, oNotiBar);
}
|
[
"function",
"(",
"oRm",
",",
"oNotifier",
",",
"oNotiBar",
")",
"{",
"fnRenderNotifier",
"(",
"oRm",
",",
"oNotifier",
",",
"true",
")",
";",
"fnRenderMessageNotifierMessageArea",
"(",
"oRm",
",",
"oNotifier",
",",
"oNotiBar",
")",
";",
"}"
] |
This renders a given message notifier and its message area next to the
notifier icon
|
[
"This",
"renders",
"a",
"given",
"message",
"notifier",
"and",
"its",
"message",
"area",
"next",
"to",
"the",
"notifier",
"icon"
] |
8a832fca01cb1cdf8df589788e0c5723e2a33c70
|
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.ux3/src/sap/ui/ux3/NotificationBarRenderer.js#L458-L461
|
train
|
|
SAP/openui5
|
src/sap.ui.ux3/src/sap/ui/ux3/NotificationBarRenderer.js
|
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
|
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>");
}
}
|
[
"function",
"(",
"oRm",
",",
"oMessageNotifier",
",",
"oNotiBar",
")",
"{",
"if",
"(",
"oMessageNotifier",
".",
"hasItems",
"(",
")",
")",
"{",
"var",
"aMessages",
"=",
"oMessageNotifier",
".",
"getMessages",
"(",
")",
";",
"var",
"lastItem",
"=",
"aMessages",
"[",
"aMessages",
".",
"length",
"-",
"1",
"]",
";",
"var",
"oMA",
"=",
"oMessageNotifier",
".",
"_oMessageArea",
";",
"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",
"(",
"\">\"",
")",
";",
"if",
"(",
"lastItem",
".",
"getText",
"(",
")",
"!=",
"\"\"",
")",
"{",
"oRm",
".",
"write",
"(",
"\"<div\"",
")",
";",
"oRm",
".",
"writeControlData",
"(",
"oMA",
")",
";",
"oRm",
".",
"writeAttribute",
"(",
"\"tabindex\"",
",",
"\"-1\"",
")",
";",
"oRm",
".",
"addClass",
"(",
"\"sapUiNotifierMessageText\"",
")",
";",
"oRm",
".",
"addClass",
"(",
"\"sapUiInPlaceMessage\"",
")",
";",
"if",
"(",
"oMessageNotifier",
".",
"_bEnableMessageSelect",
"&&",
"!",
"oMA",
".",
"_message",
".",
"getReadOnly",
"(",
")",
")",
"{",
"oRm",
".",
"addClass",
"(",
"\"sapUiInPlaceMessageSelectable\"",
")",
";",
"}",
"oRm",
".",
"writeClasses",
"(",
")",
";",
"oRm",
".",
"write",
"(",
"\">\"",
")",
";",
"oRm",
".",
"writeEscaped",
"(",
"lastItem",
".",
"getText",
"(",
")",
")",
";",
"oRm",
".",
"write",
"(",
"\"</div>\"",
")",
";",
"}",
"if",
"(",
"lastItem",
".",
"getTimestamp",
"(",
")",
"!=",
"\"\"",
")",
"{",
"oRm",
".",
"write",
"(",
"\"<div\"",
")",
";",
"oRm",
".",
"addClass",
"(",
"\"sapUiNotifierMessageTimestamp\"",
")",
";",
"oRm",
".",
"addClass",
"(",
"\"sapUiInPlaceMessage\"",
")",
";",
"oRm",
".",
"writeClasses",
"(",
")",
";",
"oRm",
".",
"write",
"(",
"\">\"",
")",
";",
"oRm",
".",
"writeEscaped",
"(",
"lastItem",
".",
"getTimestamp",
"(",
")",
")",
";",
"oRm",
".",
"write",
"(",
"\"</div>\"",
")",
";",
"}",
"oRm",
".",
"write",
"(",
"\"</li>\"",
")",
";",
"}",
"}"
] |
Renders the message area next to a message notifier
|
[
"Renders",
"the",
"message",
"area",
"next",
"to",
"a",
"message",
"notifier"
] |
8a832fca01cb1cdf8df589788e0c5723e2a33c70
|
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.ux3/src/sap/ui/ux3/NotificationBarRenderer.js#L466-L520
|
train
|
|
SAP/openui5
|
src/sap.m/src/sap/m/ViewSettingsDialog.js
|
getViewSettingsItemByKey
|
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
|
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;
}
|
[
"function",
"getViewSettingsItemByKey",
"(",
"aViewSettingsItems",
",",
"sKey",
")",
"{",
"var",
"i",
",",
"oItem",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"aViewSettingsItems",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"aViewSettingsItems",
"[",
"i",
"]",
".",
"getKey",
"(",
")",
"===",
"sKey",
")",
"{",
"oItem",
"=",
"aViewSettingsItems",
"[",
"i",
"]",
";",
"break",
";",
"}",
"}",
"return",
"oItem",
";",
"}"
] |
Gets an sap.m.ViewSettingsItem from a list of items by a given key.
@param {array} aViewSettingsItems The list of sap.m.ViewSettingsItem objects to be searched
@param {string} sKey The key of the searched item
@returns {*} The sap.m.ViewSettingsItem found in the list of items
@private
|
[
"Gets",
"an",
"sap",
".",
"m",
".",
"ViewSettingsItem",
"from",
"a",
"list",
"of",
"items",
"by",
"a",
"given",
"key",
"."
] |
8a832fca01cb1cdf8df589788e0c5723e2a33c70
|
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.m/src/sap/m/ViewSettingsDialog.js#L2942-L2955
|
train
|
SAP/openui5
|
src/sap.m/src/sap/m/ViewSettingsDialog.js
|
findViewSettingsItemByKey
|
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
|
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;
}
|
[
"function",
"findViewSettingsItemByKey",
"(",
"vItemOrKey",
",",
"aViewSettingsItems",
",",
"sErrorMessage",
")",
"{",
"var",
"oItem",
";",
"if",
"(",
"typeof",
"vItemOrKey",
"===",
"\"string\"",
")",
"{",
"oItem",
"=",
"getViewSettingsItemByKey",
"(",
"aViewSettingsItems",
",",
"vItemOrKey",
")",
";",
"if",
"(",
"!",
"oItem",
")",
"{",
"Log",
".",
"error",
"(",
"sErrorMessage",
")",
";",
"}",
"}",
"else",
"{",
"oItem",
"=",
"vItemOrKey",
";",
"}",
"return",
"oItem",
";",
"}"
] |
Finds an sap.m.ViewSettingsItem from a list of items by a given key.
If it does not succeed logs an error.
@param {sap.m.ViewSettingsItem|string} vItemOrKey The searched item or its key
@param {array} aViewSettingsItems The list of sap.m.ViewSettingsItem objects to be searched
@param {string} sErrorMessage The error message that will be logged if the item is not found
@returns {*} The sap.m.ViewSettingsItem found in the list of items
@private
|
[
"Finds",
"an",
"sap",
".",
"m",
".",
"ViewSettingsItem",
"from",
"a",
"list",
"of",
"items",
"by",
"a",
"given",
"key",
".",
"If",
"it",
"does",
"not",
"succeed",
"logs",
"an",
"error",
"."
] |
8a832fca01cb1cdf8df589788e0c5723e2a33c70
|
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.m/src/sap/m/ViewSettingsDialog.js#L2967-L2983
|
train
|
SAP/openui5
|
src/sap.m/src/sap/m/ViewSettingsDialog.js
|
restoreCustomTabContentAggregation
|
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
|
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);
}
}
|
[
"function",
"restoreCustomTabContentAggregation",
"(",
"sAggregationName",
",",
"oCustomTab",
")",
"{",
"if",
"(",
"!",
"this",
".",
"_getPage1",
"(",
"true",
")",
")",
"{",
"return",
";",
"}",
"if",
"(",
"sAggregationName",
"===",
"'customTabs'",
"&&",
"oCustomTab",
")",
"{",
"if",
"(",
"oCustomTab",
".",
"getMetadata",
"(",
")",
".",
"getName",
"(",
")",
"===",
"this",
".",
"getMetadata",
"(",
")",
".",
"getManagedAggregation",
"(",
"sAggregationName",
")",
".",
"type",
"&&",
"this",
".",
"_vContentPage",
"===",
"oCustomTab",
".",
"getId",
"(",
")",
")",
"{",
"var",
"oPage1Content",
"=",
"this",
".",
"_getPage1",
"(",
")",
".",
"getContent",
"(",
")",
";",
"oPage1Content",
".",
"forEach",
"(",
"function",
"(",
"oContent",
")",
"{",
"oCustomTab",
".",
"addAggregation",
"(",
"'content'",
",",
"oContent",
",",
"true",
")",
";",
"}",
")",
";",
"}",
"}",
"else",
"if",
"(",
"!",
"sAggregationName",
"&&",
"!",
"oCustomTab",
")",
"{",
"var",
"oPage1Content",
"=",
"this",
".",
"_getPage1",
"(",
")",
".",
"getContent",
"(",
")",
";",
"this",
".",
"getCustomTabs",
"(",
")",
".",
"forEach",
"(",
"function",
"(",
"oCustomTab",
")",
"{",
"if",
"(",
"this",
".",
"_vContentPage",
"===",
"oCustomTab",
".",
"getId",
"(",
")",
")",
"{",
"oPage1Content",
".",
"forEach",
"(",
"function",
"(",
"oContent",
")",
"{",
"oCustomTab",
".",
"addAggregation",
"(",
"'content'",
",",
"oContent",
",",
"true",
")",
";",
"}",
")",
";",
"}",
"}",
",",
"this",
")",
";",
"}",
"}"
] |
Handle the "content" aggregation of a custom tab, as the items in it might be transferred to the dialog page
instance.
@param {string} sAggregationName The string identifying the aggregation that the given object should be removed from
@param {object} oCustomTab Custom tab instance
@private
|
[
"Handle",
"the",
"content",
"aggregation",
"of",
"a",
"custom",
"tab",
"as",
"the",
"items",
"in",
"it",
"might",
"be",
"transferred",
"to",
"the",
"dialog",
"page",
"instance",
"."
] |
8a832fca01cb1cdf8df589788e0c5723e2a33c70
|
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.m/src/sap/m/ViewSettingsDialog.js#L3158-L3191
|
train
|
SAP/openui5
|
src/sap.m/src/sap/m/ViewSettingsDialog.js
|
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
|
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;
}
}
|
[
"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",
":",
"Log",
".",
"warning",
"(",
"\"Unknown string compare operator. Use values from sap.m.StringFilterOperator. Default operator should be used.\"",
")",
";",
"this",
".",
"fnOperator",
"=",
"fnContains",
";",
"break",
";",
"}",
"}"
] |
String filter helper class.
@param {string} sOperator sap.m.StringFilterOperator value. Default is sap.m.StringFilterOperator.StartsWith.
@constructor
@private
|
[
"String",
"filter",
"helper",
"class",
"."
] |
8a832fca01cb1cdf8df589788e0c5723e2a33c70
|
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.m/src/sap/m/ViewSettingsDialog.js#L3228-L3250
|
train
|
|
SAP/openui5
|
src/sap.ui.core/src/sap/ui/model/odata/type/Decimal.js
|
getText
|
function getText(sKey, aParams) {
return sap.ui.getCore().getLibraryResourceBundle().getText(sKey, aParams);
}
|
javascript
|
function getText(sKey, aParams) {
return sap.ui.getCore().getLibraryResourceBundle().getText(sKey, aParams);
}
|
[
"function",
"getText",
"(",
"sKey",
",",
"aParams",
")",
"{",
"return",
"sap",
".",
"ui",
".",
"getCore",
"(",
")",
".",
"getLibraryResourceBundle",
"(",
")",
".",
"getText",
"(",
"sKey",
",",
"aParams",
")",
";",
"}"
] |
Fetches a text from the message bundle and formats it using the parameters.
@param {string} sKey
the message key
@param {any[]} aParams
the message parameters
@returns {string}
the message
|
[
"Fetches",
"a",
"text",
"from",
"the",
"message",
"bundle",
"and",
"formats",
"it",
"using",
"the",
"parameters",
"."
] |
8a832fca01cb1cdf8df589788e0c5723e2a33c70
|
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/type/Decimal.js#L68-L70
|
train
|
SAP/openui5
|
src/sap.ui.support/src/sap/ui/support/supportRules/IssueManager.js
|
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
|
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
}
};
}
|
[
"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",
",",
"minVersion",
":",
"oIssue",
".",
"rule",
".",
"minversion",
",",
"context",
":",
"{",
"className",
":",
"className",
",",
"id",
":",
"oIssue",
".",
"context",
".",
"id",
"}",
"}",
";",
"}"
] |
Converts Issue Object to a ViewModel that can be used by the IssueManager.
@param {object} oIssue Issue Object that is to be converted
@returns {object} Converted Issue Object
|
[
"Converts",
"Issue",
"Object",
"to",
"a",
"ViewModel",
"that",
"can",
"be",
"used",
"by",
"the",
"IssueManager",
"."
] |
8a832fca01cb1cdf8df589788e0c5723e2a33c70
|
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.support/src/sap/ui/support/supportRules/IssueManager.js#L23-L51
|
train
|
|
SAP/openui5
|
src/sap.ui.support/src/sap/ui/support/supportRules/IssueManager.js
|
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
|
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;
}
|
[
"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",
"]",
";",
"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",
"]",
")",
";",
"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",
"}",
")",
";",
"if",
"(",
"selectedRulesIDs",
"[",
"rule",
"]",
")",
"{",
"library",
"[",
"rule",
"]",
".",
"selected",
"=",
"true",
";",
"library",
".",
"selected",
"=",
"true",
";",
"}",
"if",
"(",
"issuesCopy",
"[",
"group",
"]",
"&&",
"issuesCopy",
"[",
"group",
"]",
"[",
"rule",
"]",
")",
"{",
"library",
"[",
"rule",
"]",
".",
"push",
".",
"apply",
"(",
"library",
"[",
"rule",
"]",
",",
"issuesCopy",
"[",
"group",
"]",
"[",
"rule",
"]",
")",
";",
"issueCount",
"=",
"issuesCopy",
"[",
"group",
"]",
"[",
"rule",
"]",
".",
"length",
";",
"library",
"[",
"rule",
"]",
".",
"issueCount",
"=",
"issueCount",
";",
"library",
".",
"issueCount",
"+=",
"issueCount",
";",
"}",
"}",
"}",
"return",
"rulesViewModel",
";",
"}"
] |
Gets rules and issues, and converts each rule to a ruleViewModel - parameters should be converted as specified beforehand.
@public
@method
@name sap.ui.support.IssueManager.getRulesViewModel
@param {object} rules All the rules from _mRulesets
@param {array} selectedRulesIDs The rule ID's of the selected rules.
@param {array} issues The issues to map to the rulesViewModel
The issues passes should be grouped and in ViewModel format.
@returns {object} rulesViewModel All the rules with issues, selected flag and issueCount properties
The issues are in ViewModel format.
|
[
"Gets",
"rules",
"and",
"issues",
"and",
"converts",
"each",
"rule",
"to",
"a",
"ruleViewModel",
"-",
"parameters",
"should",
"be",
"converted",
"as",
"specified",
"beforehand",
"."
] |
8a832fca01cb1cdf8df589788e0c5723e2a33c70
|
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.support/src/sap/ui/support/supportRules/IssueManager.js#L133-L195
|
train
|
|
SAP/openui5
|
src/sap.ui.support/src/sap/ui/support/supportRules/IssueManager.js
|
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
|
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;
}
|
[
"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",
";",
"}"
] |
Gets rules and converts them into treeTable format.
@public
@method
@name sap.ui.support.IssueManager.getTreeTableViewModel
@param {object} oRules Deserialized rules found within the current state
@returns {object} TreeTableModel Rules in treeTable usable format
The rules are in a TreeTable format.
|
[
"Gets",
"rules",
"and",
"converts",
"them",
"into",
"treeTable",
"format",
"."
] |
8a832fca01cb1cdf8df589788e0c5723e2a33c70
|
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.support/src/sap/ui/support/supportRules/IssueManager.js#L206-L244
|
train
|
|
SAP/openui5
|
src/sap.ui.support/src/sap/ui/support/supportRules/IssueManager.js
|
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
|
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;
}
|
[
"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",
";",
"}"
] |
Gets issues in TreeTable format.
@public
@method
@name sap.ui.support.IssueManager.getIssuesViewModel
@param {object} issuesModel All the issues after they have been grouped with <code>groupIssues</code>
@returns {object} All the issues in TreeTable usable model
|
[
"Gets",
"issues",
"in",
"TreeTable",
"format",
"."
] |
8a832fca01cb1cdf8df589788e0c5723e2a33c70
|
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.support/src/sap/ui/support/supportRules/IssueManager.js#L254-L330
|
train
|
|
SAP/openui5
|
src/sap.ui.support/src/sap/ui/support/supportRules/IssueManager.js
|
function (oIssues) {
var viewModel = [];
for (var i = 0; i < oIssues.length; i++) {
viewModel.push(_convertIssueToViewModel(oIssues[i]));
}
return viewModel;
}
|
javascript
|
function (oIssues) {
var viewModel = [];
for (var i = 0; i < oIssues.length; i++) {
viewModel.push(_convertIssueToViewModel(oIssues[i]));
}
return viewModel;
}
|
[
"function",
"(",
"oIssues",
")",
"{",
"var",
"viewModel",
"=",
"[",
"]",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"oIssues",
".",
"length",
";",
"i",
"++",
")",
"{",
"viewModel",
".",
"push",
"(",
"_convertIssueToViewModel",
"(",
"oIssues",
"[",
"i",
"]",
")",
")",
";",
"}",
"return",
"viewModel",
";",
"}"
] |
Converts issues to view model format.
@public
@method
@name sap.ui.support.IssueManager.convertToViewModel
@param {array} oIssues The issues to convert
@returns {array} viewModel Issues in ViewModel format
|
[
"Converts",
"issues",
"to",
"view",
"model",
"format",
"."
] |
8a832fca01cb1cdf8df589788e0c5723e2a33c70
|
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.support/src/sap/ui/support/supportRules/IssueManager.js#L398-L404
|
train
|
|
SAP/openui5
|
src/sap.ui.support/src/sap/ui/support/supportRules/IssueManager.js
|
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
|
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;
}
|
[
"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",
";",
"}"
] |
Groups all issues by library and rule ID.
@public
@method
@name sap.ui.support.IssueManager.groupIssues
@param {array} oIssues The issues to group. Must be in a ViewModel format
@returns {array} groupedIssues Grouped issues by library and rule id
|
[
"Groups",
"all",
"issues",
"by",
"library",
"and",
"rule",
"ID",
"."
] |
8a832fca01cb1cdf8df589788e0c5723e2a33c70
|
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.support/src/sap/ui/support/supportRules/IssueManager.js#L414-L433
|
train
|
|
SAP/openui5
|
src/sap.ui.table/src/sap/ui/table/TableRendererUtils.js
|
function(rm, sClassName, bShouldAdd) {
if (sClassName && (!!bShouldAdd || arguments.length == 2)) {
rm.addClass(sClassName);
if (TAGCONTEXT) {
TAGCONTEXT.writeClasses = true;
}
}
return TableRendererUtils;
}
|
javascript
|
function(rm, sClassName, bShouldAdd) {
if (sClassName && (!!bShouldAdd || arguments.length == 2)) {
rm.addClass(sClassName);
if (TAGCONTEXT) {
TAGCONTEXT.writeClasses = true;
}
}
return TableRendererUtils;
}
|
[
"function",
"(",
"rm",
",",
"sClassName",
",",
"bShouldAdd",
")",
"{",
"if",
"(",
"sClassName",
"&&",
"(",
"!",
"!",
"bShouldAdd",
"||",
"arguments",
".",
"length",
"==",
"2",
")",
")",
"{",
"rm",
".",
"addClass",
"(",
"sClassName",
")",
";",
"if",
"(",
"TAGCONTEXT",
")",
"{",
"TAGCONTEXT",
".",
"writeClasses",
"=",
"true",
";",
"}",
"}",
"return",
"TableRendererUtils",
";",
"}"
] |
Adds the given CSS class if no condition is given or the condition is truthy.
@param {sap.ui.core.RenderManager} rm Instance of the rendermanager
@param {string} sClassName The CSS class which should be written
@param {boolean} [bShouldAdd] optional condition
@returns TableRendererUtils to allow method chaining
@private
|
[
"Adds",
"the",
"given",
"CSS",
"class",
"if",
"no",
"condition",
"is",
"given",
"or",
"the",
"condition",
"is",
"truthy",
"."
] |
8a832fca01cb1cdf8df589788e0c5723e2a33c70
|
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/TableRendererUtils.js#L33-L41
|
train
|
|
SAP/openui5
|
src/sap.ui.table/src/sap/ui/table/TableRendererUtils.js
|
function(rm, sName, oValue, bShouldAdd) {
if (sName && oValue && (!!bShouldAdd || arguments.length == 3)) {
rm.addStyle(sName, oValue);
if (TAGCONTEXT) {
TAGCONTEXT.writeStyles = true;
}
}
return TableRendererUtils;
}
|
javascript
|
function(rm, sName, oValue, bShouldAdd) {
if (sName && oValue && (!!bShouldAdd || arguments.length == 3)) {
rm.addStyle(sName, oValue);
if (TAGCONTEXT) {
TAGCONTEXT.writeStyles = true;
}
}
return TableRendererUtils;
}
|
[
"function",
"(",
"rm",
",",
"sName",
",",
"oValue",
",",
"bShouldAdd",
")",
"{",
"if",
"(",
"sName",
"&&",
"oValue",
"&&",
"(",
"!",
"!",
"bShouldAdd",
"||",
"arguments",
".",
"length",
"==",
"3",
")",
")",
"{",
"rm",
".",
"addStyle",
"(",
"sName",
",",
"oValue",
")",
";",
"if",
"(",
"TAGCONTEXT",
")",
"{",
"TAGCONTEXT",
".",
"writeStyles",
"=",
"true",
";",
"}",
"}",
"return",
"TableRendererUtils",
";",
"}"
] |
Adds the given style if no condition is given or the condition is truthy.
@param {sap.ui.core.RenderManager} rm Instance of the rendermanager
@param {string} sName The style name which should be written
@param {string} oValue The style value which should be written
@param {boolean} [bShouldAdd] optional condition
@returns TableRendererUtils to allow method chaining
@private
|
[
"Adds",
"the",
"given",
"style",
"if",
"no",
"condition",
"is",
"given",
"or",
"the",
"condition",
"is",
"truthy",
"."
] |
8a832fca01cb1cdf8df589788e0c5723e2a33c70
|
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/TableRendererUtils.js#L54-L62
|
train
|
|
SAP/openui5
|
src/sap.ui.table/src/sap/ui/table/TableRendererUtils.js
|
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
|
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;
}
|
[
"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",
";",
"}"
] |
Writes the starting tag of an element with the given settings.
@param {sap.ui.core.RenderManager} rm Instance of the rendermanager
@param {sap.ui.table.Table} oTable Instance of the table
@param {object} oConfig the configuration of the start tag
@param {string} [oConfig.tag] The tag type which should be used. If nothing is given <code>div</code> is used.
@param {string|string[]} [oConfig.classname] CSS class(es) which should be added to the element.
@param {string} [oConfig.id] The id which should be used. The id is automatically prefixed with the id of the <code>oTable</code>
of with the id of <code>oConfig.element</code> (if given).
@param {sap.ui.core.Element} [oConfig.element] If an id is given, the id is prefixed with the id of <code>oConfig.element</code>. If no id is given
the control/element data of this element is written.
@param {number} [oConfig.tabindex] The value of the tabindex attribute, if needed.
@param {object} [oConfig.attributes] Map of name value pairs of further attributes which should be written (NOTE: No escaping is done!)
@param {string} [oConfig.aria] The key as defined in the AccRenderExtension to render the aria attributes (see writeAriaAttributesFor)
@param {object} [oConfig.ariaconfig] Map of further aria configurations (see <code>writeAriaAttributesFor</code>)
@param {function} [oConfig.furtherSettings] Callback function which can be used for additional settings (which are not covered by the features of this function)
on the start element
@param {boolean} [oConfig.writeClasses] Whether the <code>writeClasses</code> function of the render manager should be called. This flag is automatically set
when the <code>classname</code> attribute is given or when the <code>TableRendererUtils.addClass</code> function is
used within the <code>furtherSettings</code> callback.
@param {boolean} [oConfig.writeStyles] Whether the <code>writeStyles</code> function of the render manager should be called. This flag is automatically set
when the <code>TableRendererUtils.addStyle</code> function is used within the <code>furtherSettings</code> callback.
@returns TableRendererUtils to allow method chaining
@private
|
[
"Writes",
"the",
"starting",
"tag",
"of",
"an",
"element",
"with",
"the",
"given",
"settings",
"."
] |
8a832fca01cb1cdf8df589788e0c5723e2a33c70
|
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/TableRendererUtils.js#L92-L146
|
train
|
|
SAP/openui5
|
src/sap.ui.table/src/sap/ui/table/TableRendererUtils.js
|
function(rm, oTable, oConfig) {
TableRendererUtils.startElement(rm, oTable, oConfig);
TableRendererUtils.endElement(rm, oConfig ? oConfig.tag : null);
return TableRendererUtils;
}
|
javascript
|
function(rm, oTable, oConfig) {
TableRendererUtils.startElement(rm, oTable, oConfig);
TableRendererUtils.endElement(rm, oConfig ? oConfig.tag : null);
return TableRendererUtils;
}
|
[
"function",
"(",
"rm",
",",
"oTable",
",",
"oConfig",
")",
"{",
"TableRendererUtils",
".",
"startElement",
"(",
"rm",
",",
"oTable",
",",
"oConfig",
")",
";",
"TableRendererUtils",
".",
"endElement",
"(",
"rm",
",",
"oConfig",
"?",
"oConfig",
".",
"tag",
":",
"null",
")",
";",
"return",
"TableRendererUtils",
";",
"}"
] |
Writes the starting and end tag of an element with the given settings.
@param {sap.ui.core.RenderManager} rm Instance of the rendermanager
@param {sap.ui.table.Table} oTable Instance of the table
@param {object} oConfig the configuration of the start tag
@returns TableRendererUtils to allow method chaining
@see TableRendererUtils#startElement
@see TableRendererUtils#endElement
@private
|
[
"Writes",
"the",
"starting",
"and",
"end",
"tag",
"of",
"an",
"element",
"with",
"the",
"given",
"settings",
"."
] |
8a832fca01cb1cdf8df589788e0c5723e2a33c70
|
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/TableRendererUtils.js#L173-L177
|
train
|
|
SAP/openui5
|
src/sap.ui.core/src/sap/ui/thirdparty/signals.js
|
function (listener, listenerContext, priority) {
validateListener(listener, 'add');
return this._registerListener(listener, false, listenerContext, priority);
}
|
javascript
|
function (listener, listenerContext, priority) {
validateListener(listener, 'add');
return this._registerListener(listener, false, listenerContext, priority);
}
|
[
"function",
"(",
"listener",
",",
"listenerContext",
",",
"priority",
")",
"{",
"validateListener",
"(",
"listener",
",",
"'add'",
")",
";",
"return",
"this",
".",
"_registerListener",
"(",
"listener",
",",
"false",
",",
"listenerContext",
",",
"priority",
")",
";",
"}"
] |
Add a listener to the signal.
@param {Function} listener Signal handler function.
@param {Object} [listenerContext] Context on which listener will be executed (object that should represent the `this` variable inside listener function).
@param {Number} [priority] The priority level of the event listener. Listeners with higher priority will be executed before listeners with lower priority. Listeners with same priority level will be executed at the same order as they were added. (default = 0)
@return {SignalBinding} An Object representing the binding between the Signal and listener.
|
[
"Add",
"a",
"listener",
"to",
"the",
"signal",
"."
] |
8a832fca01cb1cdf8df589788e0c5723e2a33c70
|
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/thirdparty/signals.js#L296-L299
|
train
|
|
SAP/openui5
|
src/sap.ui.core/src/sap/ui/thirdparty/signals.js
|
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
|
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;
}
|
[
"function",
"(",
"listener",
",",
"context",
")",
"{",
"validateListener",
"(",
"listener",
",",
"'remove'",
")",
";",
"var",
"i",
"=",
"this",
".",
"_indexOfListener",
"(",
"listener",
",",
"context",
")",
";",
"if",
"(",
"i",
"!==",
"-",
"1",
")",
"{",
"this",
".",
"_bindings",
"[",
"i",
"]",
".",
"_destroy",
"(",
")",
";",
"this",
".",
"_bindings",
".",
"splice",
"(",
"i",
",",
"1",
")",
";",
"}",
"return",
"listener",
";",
"}"
] |
Remove a single listener from the dispatch queue.
@param {Function} listener Handler function that should be removed.
@param {Object} [context] Execution context (since you can add the same handler multiple times if executing in a different context).
@return {Function} Listener handler function.
|
[
"Remove",
"a",
"single",
"listener",
"from",
"the",
"dispatch",
"queue",
"."
] |
8a832fca01cb1cdf8df589788e0c5723e2a33c70
|
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/thirdparty/signals.js#L319-L328
|
train
|
|
SAP/openui5
|
src/sap.ui.demokit/src/sap/ui/demokit/explored/util/MyRouter.js
|
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
|
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);
}
}
|
[
"function",
"(",
"sRoute",
",",
"oData",
")",
"{",
"var",
"oHistory",
"=",
"History",
".",
"getInstance",
"(",
")",
";",
"var",
"oPrevHash",
"=",
"oHistory",
".",
"getPreviousHash",
"(",
")",
";",
"if",
"(",
"oPrevHash",
"!==",
"undefined",
")",
"{",
"window",
".",
"history",
".",
"go",
"(",
"-",
"1",
")",
";",
"}",
"else",
"{",
"var",
"bReplace",
"=",
"true",
";",
"this",
".",
"navTo",
"(",
"sRoute",
",",
"oData",
",",
"bReplace",
")",
";",
"}",
"}"
] |
mobile nav back handling
|
[
"mobile",
"nav",
"back",
"handling"
] |
8a832fca01cb1cdf8df589788e0c5723e2a33c70
|
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.demokit/src/sap/ui/demokit/explored/util/MyRouter.js#L17-L26
|
train
|
|
SAP/openui5
|
src/sap.ui.core/src/sap/ui/model/odata/_ODataMetaModelUtils.js
|
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
|
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]);
}
}
}
|
[
"function",
"(",
"o",
",",
"oExtension",
",",
"sTypeClass",
",",
"sNonDefaultValue",
",",
"bDeepCopy",
")",
"{",
"if",
"(",
"sTypeClass",
"===",
"\"EntitySet\"",
"&&",
"oExtension",
".",
"value",
"===",
"sNonDefaultValue",
")",
"{",
"if",
"(",
"bDeepCopy",
")",
"{",
"jQuery",
".",
"extend",
"(",
"true",
",",
"o",
",",
"mV2ToV4",
"[",
"oExtension",
".",
"name",
"]",
")",
";",
"}",
"else",
"{",
"jQuery",
".",
"extend",
"(",
"o",
",",
"mV2ToV4",
"[",
"oExtension",
".",
"name",
"]",
")",
";",
"}",
"}",
"}"
] |
Adds EntitySet V4 annotation for current extension if extension value is equal to
the given non-default value. Depending on bDeepCopy the annotation will be merged
with deep copy.
@param {object} o
any object
@param {object} oExtension
the SAP Annotation (OData Version 2.0) for which a V4 annotation needs to be added
@param {string} sTypeClass
the type class of the given object; supported type classes are "Property" and
"EntitySet"
@param {string} sNonDefaultValue
if current extension value is equal to this sNonDefaultValue the annotation is
added
@param {boolean} bDeepCopy
if true the annotation is mixed in as deep copy of the entry in mV2ToV4 map
|
[
"Adds",
"EntitySet",
"V4",
"annotation",
"for",
"current",
"extension",
"if",
"extension",
"value",
"is",
"equal",
"to",
"the",
"given",
"non",
"-",
"default",
"value",
".",
"Depending",
"on",
"bDeepCopy",
"the",
"annotation",
"will",
"be",
"merged",
"with",
"deep",
"copy",
"."
] |
8a832fca01cb1cdf8df589788e0c5723e2a33c70
|
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/_ODataMetaModelUtils.js#L181-L191
|
train
|
|
SAP/openui5
|
src/sap.ui.core/src/sap/ui/model/odata/_ODataMetaModelUtils.js
|
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
|
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;
}
|
[
"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",
";",
"}"
] |
Adds current property to the property collection for given V2 annotation.
@param {string} sV2AnnotationName
V2 annotation name (key in map mV2ToV4PropertyCollection)
@param {object} oEntitySet
the entity set
@param {object} oProperty
the property of the entity
|
[
"Adds",
"current",
"property",
"to",
"the",
"property",
"collection",
"for",
"given",
"V2",
"annotation",
"."
] |
8a832fca01cb1cdf8df589788e0c5723e2a33c70
|
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/_ODataMetaModelUtils.js#L270-L280
|
train
|
|
SAP/openui5
|
src/sap.ui.core/src/sap/ui/model/odata/_ODataMetaModelUtils.js
|
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
|
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
}
}
|
[
"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",
":",
"}",
"}"
] |
Adds the corresponding V4 annotation to the given object based on the given SAP
extension.
@param {object} o
any object
@param {object} oExtension
the SAP Annotation (OData Version 2.0) for which a V4 annotation needs to be added
@param {string} sTypeClass
the type class of the given object; supported type classes are "Property" and
"EntitySet"
|
[
"Adds",
"the",
"corresponding",
"V4",
"annotation",
"to",
"the",
"given",
"object",
"based",
"on",
"the",
"given",
"SAP",
"extension",
"."
] |
8a832fca01cb1cdf8df589788e0c5723e2a33c70
|
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/_ODataMetaModelUtils.js#L461-L528
|
train
|
|
SAP/openui5
|
src/sap.ui.core/src/sap/ui/model/odata/_ODataMetaModelUtils.js
|
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
|
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;
}
|
[
"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",
";",
"}"
] |
Returns the index of the first object inside the given array, where the property with the
given name has the given expected value.
@param {object[]} [aArray]
some array
@param {any} vExpectedPropertyValue
expected value of the property with given name
@param {string} [sPropertyName="name"]
some property name
@returns {number}
the index of the first object found or <code>-1</code> if no such object is found
|
[
"Returns",
"the",
"index",
"of",
"the",
"first",
"object",
"inside",
"the",
"given",
"array",
"where",
"the",
"property",
"with",
"the",
"given",
"name",
"has",
"the",
"given",
"expected",
"value",
"."
] |
8a832fca01cb1cdf8df589788e0c5723e2a33c70
|
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/_ODataMetaModelUtils.js#L586-L598
|
train
|
|
SAP/openui5
|
src/sap.ui.core/src/sap/ui/model/odata/_ODataMetaModelUtils.js
|
function (aArray, vExpectedPropertyValue, sPropertyName) {
var iIndex = Utils.findIndex(aArray, vExpectedPropertyValue, sPropertyName);
return iIndex < 0 ? null : aArray[iIndex];
}
|
javascript
|
function (aArray, vExpectedPropertyValue, sPropertyName) {
var iIndex = Utils.findIndex(aArray, vExpectedPropertyValue, sPropertyName);
return iIndex < 0 ? null : aArray[iIndex];
}
|
[
"function",
"(",
"aArray",
",",
"vExpectedPropertyValue",
",",
"sPropertyName",
")",
"{",
"var",
"iIndex",
"=",
"Utils",
".",
"findIndex",
"(",
"aArray",
",",
"vExpectedPropertyValue",
",",
"sPropertyName",
")",
";",
"return",
"iIndex",
"<",
"0",
"?",
"null",
":",
"aArray",
"[",
"iIndex",
"]",
";",
"}"
] |
Returns the object inside the given array, where the property with the given name has
the given expected value.
@param {object[]} aArray
some array
@param {any} vExpectedPropertyValue
expected value of the property with given name
@param {string} [sPropertyName="name"]
some property name
@returns {object}
the object found or <code>null</code> if no such object is found
|
[
"Returns",
"the",
"object",
"inside",
"the",
"given",
"array",
"where",
"the",
"property",
"with",
"the",
"given",
"name",
"has",
"the",
"given",
"expected",
"value",
"."
] |
8a832fca01cb1cdf8df589788e0c5723e2a33c70
|
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/_ODataMetaModelUtils.js#L613-L617
|
train
|
|
SAP/openui5
|
src/sap.ui.core/src/sap/ui/model/odata/_ODataMetaModelUtils.js
|
function (oAnnotations, sQualifiedName, bInContainer) {
var o = bInContainer
? oAnnotations.EntityContainer
: oAnnotations.propertyAnnotations;
return o && o[sQualifiedName] || {};
}
|
javascript
|
function (oAnnotations, sQualifiedName, bInContainer) {
var o = bInContainer
? oAnnotations.EntityContainer
: oAnnotations.propertyAnnotations;
return o && o[sQualifiedName] || {};
}
|
[
"function",
"(",
"oAnnotations",
",",
"sQualifiedName",
",",
"bInContainer",
")",
"{",
"var",
"o",
"=",
"bInContainer",
"?",
"oAnnotations",
".",
"EntityContainer",
":",
"oAnnotations",
".",
"propertyAnnotations",
";",
"return",
"o",
"&&",
"o",
"[",
"sQualifiedName",
"]",
"||",
"{",
"}",
";",
"}"
] |
Gets the map from child name to annotations for a parent with the given qualified
name which lives inside the entity container as indicated.
@param {sap.ui.model.odata.ODataAnnotations} oAnnotations
the OData annotations
@param {string} sQualifiedName
the parent's qualified name
@param {boolean} bInContainer
whether the parent lives inside the entity container (or beside it)
@returns {object}
the map from child name to annotations
|
[
"Gets",
"the",
"map",
"from",
"child",
"name",
"to",
"annotations",
"for",
"a",
"parent",
"with",
"the",
"given",
"qualified",
"name",
"which",
"lives",
"inside",
"the",
"entity",
"container",
"as",
"indicated",
"."
] |
8a832fca01cb1cdf8df589788e0c5723e2a33c70
|
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/_ODataMetaModelUtils.js#L632-L637
|
train
|
|
SAP/openui5
|
src/sap.ui.core/src/sap/ui/model/odata/_ODataMetaModelUtils.js
|
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
|
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;
}
|
[
"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",
";",
"}"
] |
Returns the thing with the given simple name from the given entity container.
@param {object} oEntityContainer
the entity container
@param {string} sArrayName
name of array within entity container which will be searched
@param {string} sName
a simple name, e.g. "Foo"
@param {boolean} [bAsPath=false]
determines whether the thing itself is returned or just its path
@returns {object|string}
(the path to) the thing with the given qualified name; <code>undefined</code> (for a
path) or <code>null</code> (for an object) if no such thing is found
|
[
"Returns",
"the",
"thing",
"with",
"the",
"given",
"simple",
"name",
"from",
"the",
"given",
"entity",
"container",
"."
] |
8a832fca01cb1cdf8df589788e0c5723e2a33c70
|
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/_ODataMetaModelUtils.js#L654-L668
|
train
|
|
SAP/openui5
|
src/sap.ui.core/src/sap/ui/model/odata/_ODataMetaModelUtils.js
|
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
|
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;
}
|
[
"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",
";",
"}",
"}",
")",
";",
"}",
"return",
"oSchema",
";",
"}"
] |
Returns the schema with the given namespace.
@param {sap.ui.model.Model|object[]} vModel
either a model or an array of schemas
@param {string} sNamespace
a namespace, e.g. "ACME"
@returns {object}
the schema with the given namespace; <code>null</code> if no such schema is found
|
[
"Returns",
"the",
"schema",
"with",
"the",
"given",
"namespace",
"."
] |
8a832fca01cb1cdf8df589788e0c5723e2a33c70
|
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/_ODataMetaModelUtils.js#L724-L740
|
train
|
|
SAP/openui5
|
src/sap.ui.core/src/sap/ui/model/odata/_ODataMetaModelUtils.js
|
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
|
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);
}
|
[
"function",
"(",
"oAnnotations",
",",
"oData",
",",
"oMetaModel",
")",
"{",
"var",
"aSchemas",
"=",
"oData",
".",
"dataServices",
".",
"schema",
";",
"if",
"(",
"!",
"aSchemas",
")",
"{",
"return",
";",
"}",
"aSchemas",
".",
"forEach",
"(",
"function",
"(",
"oSchema",
",",
"i",
")",
"{",
"var",
"sSchemaVersion",
";",
"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",
")",
";",
"}",
")",
";",
"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",
")",
";",
"}"
] |
Merges the given annotation data into the given metadata and lifts SAPData extensions.
@param {object} oAnnotations
annotations "JSON"
@param {object} oData
metadata "JSON"
@param {sap.ui.model.odata.ODataMetaModel} oMetaModel
the metamodel
|
[
"Merges",
"the",
"given",
"annotation",
"data",
"into",
"the",
"given",
"metadata",
"and",
"lifts",
"SAPData",
"extensions",
"."
] |
8a832fca01cb1cdf8df589788e0c5723e2a33c70
|
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/_ODataMetaModelUtils.js#L954-L1003
|
train
|
|
SAP/openui5
|
src/sap.ui.core/src/sap/ui/model/odata/_ODataMetaModelUtils.js
|
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
|
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]);
});
}
|
[
"function",
"(",
"aChildren",
",",
"mChildAnnotations",
",",
"sTypeClass",
",",
"aSchemas",
",",
"fnCallback",
",",
"iStartIndex",
")",
"{",
"if",
"(",
"!",
"aChildren",
")",
"{",
"return",
";",
"}",
"if",
"(",
"iStartIndex",
")",
"{",
"aChildren",
"=",
"aChildren",
".",
"slice",
"(",
"iStartIndex",
")",
";",
"}",
"aChildren",
".",
"forEach",
"(",
"function",
"(",
"oChild",
")",
"{",
"Utils",
".",
"liftSAPData",
"(",
"oChild",
",",
"sTypeClass",
")",
";",
"}",
")",
";",
"aChildren",
".",
"forEach",
"(",
"function",
"(",
"oChild",
")",
"{",
"var",
"oEntityType",
";",
"if",
"(",
"sTypeClass",
"===",
"\"EntitySet\"",
")",
"{",
"oEntityType",
"=",
"Utils",
".",
"getObject",
"(",
"aSchemas",
",",
"\"entityType\"",
",",
"oChild",
".",
"entityType",
")",
";",
"Utils",
".",
"calculateEntitySetAnnotations",
"(",
"oChild",
",",
"oEntityType",
")",
";",
"}",
"if",
"(",
"fnCallback",
")",
"{",
"fnCallback",
"(",
"oChild",
")",
";",
"}",
"jQuery",
".",
"extend",
"(",
"oChild",
",",
"mChildAnnotations",
"[",
"oChild",
".",
"name",
"||",
"oChild",
".",
"role",
"]",
")",
";",
"}",
")",
";",
"}"
] |
Visits all children inside the given array, lifts "SAPData" extensions and
inlines OData V4 annotations for each child.
@param {object[]} aChildren
any array of children
@param {object} mChildAnnotations
map from child name (or role) to annotations
@param {string} [sTypeClass]
the type class of the given children; supported type classes are "Property"
and "EntitySet"
@param {object[]} [aSchemas]
Array of OData data service schemas (needed only for type class "EntitySet")
@param {function} [fnCallback]
optional callback for each child
@param {number} [iStartIndex=0]
optional start index in the given array
|
[
"Visits",
"all",
"children",
"inside",
"the",
"given",
"array",
"lifts",
"SAPData",
"extensions",
"and",
"inlines",
"OData",
"V4",
"annotations",
"for",
"each",
"child",
"."
] |
8a832fca01cb1cdf8df589788e0c5723e2a33c70
|
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/_ODataMetaModelUtils.js#L1023-L1051
|
train
|
|
SAP/openui5
|
src/sap.ui.core/src/sap/ui/model/odata/_ODataMetaModelUtils.js
|
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
|
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]);
}
);
}
|
[
"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",
"]",
")",
";",
"}",
")",
";",
"}"
] |
Visits all parameters of the given function import.
@param {object} oAnnotations
annotations "JSON"
@param {object} oSchema
OData data service schema
@param {object} oEntityContainer
the entity container
@param {object} oFunctionImport
a function import's V2 metadata object
|
[
"Visits",
"all",
"parameters",
"of",
"the",
"given",
"function",
"import",
"."
] |
8a832fca01cb1cdf8df589788e0c5723e2a33c70
|
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/_ODataMetaModelUtils.js#L1079-L1094
|
train
|
|
SAP/openui5
|
src/sap.m/src/sap/m/TimePickerSlider.js
|
findIndexInArray
|
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
|
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;
}
|
[
"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",
";",
"}"
] |
Finds the index of an element, satisfying provided predicate.
@param {array} aArray The array to be predicted
@param {function} fnPredicate Testing function
@returns {number} The index in the array, if an element in the array satisfies the provided testing function
@private
|
[
"Finds",
"the",
"index",
"of",
"an",
"element",
"satisfying",
"provided",
"predicate",
"."
] |
8a832fca01cb1cdf8df589788e0c5723e2a33c70
|
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.m/src/sap/m/TimePickerSlider.js#L1210-L1229
|
train
|
SAP/openui5
|
src/sap.m/src/sap/m/TimePickerSlider.js
|
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
|
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;
}
|
[
"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",
";",
"}"
] |
Default onTouchStart handler.
@param {jQuery.Event} oEvent Event object
|
[
"Default",
"onTouchStart",
"handler",
"."
] |
8a832fca01cb1cdf8df589788e0c5723e2a33c70
|
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.m/src/sap/m/TimePickerSlider.js#L1235-L1248
|
train
|
|
SAP/openui5
|
src/sap.m/src/sap/m/TimePickerSlider.js
|
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
|
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;
}
|
[
"function",
"(",
"oEvent",
")",
"{",
"var",
"iPageY",
"=",
"oEvent",
".",
"touches",
"&&",
"oEvent",
".",
"touches",
".",
"length",
"?",
"oEvent",
".",
"touches",
"[",
"0",
"]",
".",
"pageY",
":",
"oEvent",
".",
"pageY",
";",
"if",
"(",
"!",
"this",
".",
"_mousedown",
"||",
"!",
"this",
".",
"getIsExpanded",
"(",
")",
")",
"{",
"return",
";",
"}",
"if",
"(",
"!",
"this",
".",
"_bIsDrag",
"&&",
"this",
".",
"_dragSession",
"&&",
"this",
".",
"_dragSession",
".",
"positions",
".",
"length",
")",
"{",
"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",
";",
"}"
] |
Default onTouchMove handler.
@param {jQuery.Event} oEvent Event object
|
[
"Default",
"onTouchMove",
"handler",
"."
] |
8a832fca01cb1cdf8df589788e0c5723e2a33c70
|
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.m/src/sap/m/TimePickerSlider.js#L1254-L1276
|
train
|
|
SAP/openui5
|
src/sap.m/src/sap/m/TimePickerSlider.js
|
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
|
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;
}
|
[
"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",
";",
"}"
] |
Default onTouchEnd handler.
@param {jQuery.Event} oEvent Event object
|
[
"Default",
"onTouchEnd",
"handler",
"."
] |
8a832fca01cb1cdf8df589788e0c5723e2a33c70
|
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.m/src/sap/m/TimePickerSlider.js#L1282-L1300
|
train
|
|
SAP/openui5
|
src/sap.ui.core/src/sap/ui/events/PseudoEvents.js
|
checkModifierKeys
|
function checkModifierKeys(oEvent, bCtrlKey, bAltKey, bShiftKey) {
return oEvent.shiftKey == bShiftKey && oEvent.altKey == bAltKey && getCtrlKey(oEvent) == bCtrlKey;
}
|
javascript
|
function checkModifierKeys(oEvent, bCtrlKey, bAltKey, bShiftKey) {
return oEvent.shiftKey == bShiftKey && oEvent.altKey == bAltKey && getCtrlKey(oEvent) == bCtrlKey;
}
|
[
"function",
"checkModifierKeys",
"(",
"oEvent",
",",
"bCtrlKey",
",",
"bAltKey",
",",
"bShiftKey",
")",
"{",
"return",
"oEvent",
".",
"shiftKey",
"==",
"bShiftKey",
"&&",
"oEvent",
".",
"altKey",
"==",
"bAltKey",
"&&",
"getCtrlKey",
"(",
"oEvent",
")",
"==",
"bCtrlKey",
";",
"}"
] |
Convenience method to check an event for a certain combination of modifier keys
@private
|
[
"Convenience",
"method",
"to",
"check",
"an",
"event",
"for",
"a",
"certain",
"combination",
"of",
"modifier",
"keys"
] |
8a832fca01cb1cdf8df589788e0c5723e2a33c70
|
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/events/PseudoEvents.js#L20-L22
|
train
|
SAP/openui5
|
src/sap.ui.demokit/src/sap/ui/demokit/explored/view/entity.controller.js
|
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
|
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;
}
}
|
[
"function",
"(",
"sType",
")",
"{",
"if",
"(",
"!",
"sType",
")",
"{",
"return",
"null",
";",
"}",
"else",
"{",
"sType",
"=",
"sType",
".",
"replace",
"(",
"\"sap.ui.core.\"",
",",
"\"\"",
")",
";",
"var",
"index",
"=",
"sType",
".",
"lastIndexOf",
"(",
"\".\"",
")",
";",
"return",
"(",
"index",
"!==",
"-",
"1",
")",
"?",
"sType",
".",
"substr",
"(",
"index",
"+",
"1",
")",
":",
"sType",
";",
"}",
"}"
] |
Converts the type to a friendly readable text
|
[
"Converts",
"the",
"type",
"to",
"a",
"friendly",
"readable",
"text"
] |
8a832fca01cb1cdf8df589788e0c5723e2a33c70
|
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.demokit/src/sap/ui/demokit/explored/view/entity.controller.js#L476-L486
|
train
|
|
SAP/openui5
|
src/sap.ui.demokit/src/sap/ui/demokit/explored/view/entity.controller.js
|
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
|
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;
}
|
[
"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",
";",
"}"
] |
the actual component for the control
@param {string} controlName
@return {string} sActualControlComponent
|
[
"the",
"actual",
"component",
"for",
"the",
"control"
] |
8a832fca01cb1cdf8df589788e0c5723e2a33c70
|
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.demokit/src/sap/ui/demokit/explored/view/entity.controller.js#L542-L549
|
train
|
|
SAP/openui5
|
src/sap.ui.core/src/sap/ui/base/ManagedObjectMetadata.js
|
loadOwnDesignTime
|
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
|
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);
});
});
});
}
|
[
"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\"",
")",
"{",
"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",
")",
";",
"}",
")",
";",
"}",
")",
";",
"}",
")",
";",
"}"
] |
Returns a promise that resolves with the own, unmerged designtime data.
If the class is marked as having no designtime data, the promise will resolve with null.
@private
|
[
"Returns",
"a",
"promise",
"that",
"resolves",
"with",
"the",
"own",
"unmerged",
"designtime",
"data",
".",
"If",
"the",
"class",
"is",
"marked",
"as",
"having",
"no",
"designtime",
"data",
"the",
"promise",
"will",
"resolve",
"with",
"null",
"."
] |
8a832fca01cb1cdf8df589788e0c5723e2a33c70
|
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/base/ManagedObjectMetadata.js#L1804-L1826
|
train
|
SAP/openui5
|
src/sap.ui.core/src/sap/ui/base/ManagedObjectMetadata.js
|
getScopeBasedDesignTime
|
function getScopeBasedDesignTime(mMetadata, sScopeKey) {
var mResult = mMetadata;
if ("default" in mMetadata) {
mResult = merge(
{},
mMetadata.default,
sScopeKey !== "default" && mMetadata[sScopeKey] || null
);
}
return mResult;
}
|
javascript
|
function getScopeBasedDesignTime(mMetadata, sScopeKey) {
var mResult = mMetadata;
if ("default" in mMetadata) {
mResult = merge(
{},
mMetadata.default,
sScopeKey !== "default" && mMetadata[sScopeKey] || null
);
}
return mResult;
}
|
[
"function",
"getScopeBasedDesignTime",
"(",
"mMetadata",
",",
"sScopeKey",
")",
"{",
"var",
"mResult",
"=",
"mMetadata",
";",
"if",
"(",
"\"default\"",
"in",
"mMetadata",
")",
"{",
"mResult",
"=",
"merge",
"(",
"{",
"}",
",",
"mMetadata",
".",
"default",
",",
"sScopeKey",
"!==",
"\"default\"",
"&&",
"mMetadata",
"[",
"sScopeKey",
"]",
"||",
"null",
")",
";",
"}",
"return",
"mResult",
";",
"}"
] |
Extracts metadata from metadata map by scope key
@param {object} mMetadata metadata map received from loader
@param {string} sScopeKey scope name to be extracted
@private
|
[
"Extracts",
"metadata",
"from",
"metadata",
"map",
"by",
"scope",
"key"
] |
8a832fca01cb1cdf8df589788e0c5723e2a33c70
|
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/base/ManagedObjectMetadata.js#L1873-L1885
|
train
|
SAP/openui5
|
src/sap.m/src/sap/m/FormattedText.js
|
openExternalLink
|
function openExternalLink (oEvent) {
var newWindow = window.open();
newWindow.opener = null;
newWindow.location = oEvent.currentTarget.href;
oEvent.preventDefault();
}
|
javascript
|
function openExternalLink (oEvent) {
var newWindow = window.open();
newWindow.opener = null;
newWindow.location = oEvent.currentTarget.href;
oEvent.preventDefault();
}
|
[
"function",
"openExternalLink",
"(",
"oEvent",
")",
"{",
"var",
"newWindow",
"=",
"window",
".",
"open",
"(",
")",
";",
"newWindow",
".",
"opener",
"=",
"null",
";",
"newWindow",
".",
"location",
"=",
"oEvent",
".",
"currentTarget",
".",
"href",
";",
"oEvent",
".",
"preventDefault",
"(",
")",
";",
"}"
] |
prohibit a new window from accessing window.opener.location
|
[
"prohibit",
"a",
"new",
"window",
"from",
"accessing",
"window",
".",
"opener",
".",
"location"
] |
8a832fca01cb1cdf8df589788e0c5723e2a33c70
|
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.m/src/sap/m/FormattedText.js#L282-L287
|
train
|
SAP/openui5
|
src/sap.ui.table/src/sap/ui/table/Table.js
|
setMinColWidths
|
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
|
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]);
}
}
}
}
|
[
"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",
")",
"{",
"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",
"(",
"TableUtils",
".",
"isVariableWidth",
"(",
"colWidth",
")",
"&&",
"!",
"TableUtils",
".",
"isFixedColumn",
"(",
"oTable",
",",
"col",
".",
"getIndex",
"(",
")",
")",
")",
"{",
"aColHeaders",
"=",
"oTableRef",
".",
"querySelectorAll",
"(",
"'th[data-sap-ui-colid=\"'",
"+",
"col",
".",
"getId",
"(",
")",
"+",
"'\"]'",
")",
";",
"colHeader",
"=",
"aColHeaders",
"[",
"bColumnHeaderVisible",
"?",
"0",
":",
"1",
"]",
";",
"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",
"}",
")",
";",
"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",
";",
"}",
")",
";",
"}",
"}",
"oTable",
".",
"_getVisibleColumns",
"(",
")",
".",
"map",
"(",
"isFixNeeded",
")",
".",
"forEach",
"(",
"adaptColWidth",
")",
";",
"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",
"]",
")",
";",
"}",
"}",
"}",
"}"
] |
the only place to fix the minimum column width
|
[
"the",
"only",
"place",
"to",
"fix",
"the",
"minimum",
"column",
"width"
] |
8a832fca01cb1cdf8df589788e0c5723e2a33c70
|
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/Table.js#L1564-L1628
|
train
|
SAP/openui5
|
src/sap.ui.core/src/sap/ui/core/routing/Target.js
|
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
|
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);
}
|
[
"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",
")",
";",
"}"
] |
Fire event created to attached listeners.
@param {object} [mArguments] the arguments to pass along with the event.
@return {sap.ui.core.routing.Target} <code>this</code> to allow method chaining
@protected
|
[
"Fire",
"event",
"created",
"to",
"attached",
"listeners",
"."
] |
8a832fca01cb1cdf8df589788e0c5723e2a33c70
|
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/routing/Target.js#L167-L179
|
train
|
|
SAP/openui5
|
src/sap.ui.core/src/sap/ui/core/routing/Target.js
|
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
|
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;
}
|
[
"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",
")",
";",
"if",
"(",
"!",
"bHasListener",
"&&",
"sTitle",
"&&",
"this",
".",
"_bIsDisplayed",
")",
"{",
"this",
".",
"fireTitleChanged",
"(",
"{",
"name",
":",
"this",
".",
"_oOptions",
".",
"_name",
",",
"title",
":",
"sTitle",
"}",
")",
";",
"}",
"return",
"this",
";",
"}"
] |
Will be fired when the title of this Target has been changed.
@name sap.ui.core.routing.Target#titleChanged
@event
@param {object} oEvent
@param {sap.ui.base.EventProvider} oEvent.getSource
@param {object} oEvent.getParameters
@param {string} oEvent.getParameters.title The name of this target
@param {string} oEvent.getParameters.title The current displayed title
@private
Attach event-handler <code>fnFunction</code> to the 'titleChanged' event of this <code>sap.ui.core.routing.Target</code>.<br/>
When the first event handler is registered later than the last title change, it's still called with the last changed title because
when title is set with static text, the event is fired synchronously with the instantiation of this Target and the event handler can't
be registered before the event is fired.
@param {object} [oData] The object, that should be passed along with the event-object when firing the event.
@param {function} fnFunction The function to call, when the event occurs. This function will be called on the
oListener-instance (if present) or in a 'static way'.
@param {object} [oListener] Object on which to call the given function.
@return {sap.ui.core.routing.Target} <code>this</code> to allow method chaining
@private
|
[
"Will",
"be",
"fired",
"when",
"the",
"title",
"of",
"this",
"Target",
"has",
"been",
"changed",
"."
] |
8a832fca01cb1cdf8df589788e0c5723e2a33c70
|
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/routing/Target.js#L209-L222
|
train
|
|
SAP/openui5
|
src/sap.ui.integration/src/sap/ui/integration/util/CustomElements.js
|
callback
|
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
|
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));
}
});
}
|
[
"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",
")",
")",
";",
"}",
"}",
")",
";",
"}"
] |
Callback function to execute when mutations are observed
|
[
"Callback",
"function",
"to",
"execute",
"when",
"mutations",
"are",
"observed"
] |
8a832fca01cb1cdf8df589788e0c5723e2a33c70
|
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.integration/src/sap/ui/integration/util/CustomElements.js#L73-L129
|
train
|
SAP/openui5
|
src/sap.ui.core/src/sap/ui/core/util/XMLPreprocessor.js
|
createContextInterface
|
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><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><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><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>
* <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><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
|
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><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><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><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>
* <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><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];
}
};
}
|
[
"function",
"createContextInterface",
"(",
"oWithControl",
",",
"mSettings",
",",
"i",
",",
"vBindingOrContext",
")",
"{",
"function",
"getBindingOrContext",
"(",
"iPart",
")",
"{",
"if",
"(",
"!",
"vBindingOrContext",
")",
"{",
"vBindingOrContext",
"=",
"oWithControl",
".",
"getBinding",
"(",
"\"any\"",
")",
";",
"if",
"(",
"vBindingOrContext",
"instanceof",
"CompositeBinding",
")",
"{",
"vBindingOrContext",
"=",
"vBindingOrContext",
".",
"getBindings",
"(",
")",
";",
"if",
"(",
"i",
"!==",
"undefined",
")",
"{",
"vBindingOrContext",
"=",
"vBindingOrContext",
"[",
"i",
"]",
";",
"}",
"}",
"}",
"return",
"Array",
".",
"isArray",
"(",
"vBindingOrContext",
")",
"?",
"vBindingOrContext",
"[",
"iPart",
"]",
":",
"vBindingOrContext",
";",
"}",
"function",
"getPath",
"(",
"oBindingOrContext",
")",
"{",
"return",
"oBindingOrContext",
"instanceof",
"Context",
"?",
"oBindingOrContext",
".",
"getPath",
"(",
")",
":",
"oBindingOrContext",
".",
"getModel",
"(",
")",
".",
"resolve",
"(",
"oBindingOrContext",
".",
"getPath",
"(",
")",
",",
"oBindingOrContext",
".",
"getContext",
"(",
")",
")",
";",
"}",
"return",
"{",
"getInterface",
":",
"function",
"(",
"iPart",
",",
"sPath",
")",
"{",
"var",
"oBaseContext",
",",
"oBindingOrContext",
",",
"oModel",
";",
"if",
"(",
"typeof",
"iPart",
"===",
"\"string\"",
")",
"{",
"sPath",
"=",
"iPart",
";",
"iPart",
"=",
"undefined",
";",
"}",
"getBindingOrContext",
"(",
")",
";",
"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",
")",
"!==",
"'/'",
")",
"{",
"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",
")",
";",
"}",
",",
"getModel",
":",
"function",
"(",
"iPart",
")",
"{",
"var",
"oBindingOrContext",
"=",
"getBindingOrContext",
"(",
"iPart",
")",
";",
"return",
"oBindingOrContext",
"&&",
"oBindingOrContext",
".",
"getModel",
"(",
")",
";",
"}",
",",
"getPath",
":",
"function",
"(",
"iPart",
")",
"{",
"var",
"oBindingOrContext",
"=",
"getBindingOrContext",
"(",
"iPart",
")",
";",
"return",
"oBindingOrContext",
"&&",
"getPath",
"(",
"oBindingOrContext",
")",
";",
"}",
",",
"getSetting",
":",
"function",
"(",
"sName",
")",
"{",
"if",
"(",
"sName",
"===",
"\"bindingContexts\"",
"||",
"sName",
"===",
"\"models\"",
")",
"{",
"throw",
"new",
"Error",
"(",
"\"Illegal argument: \"",
"+",
"sName",
")",
";",
"}",
"return",
"mSettings",
"[",
"sName",
"]",
";",
"}",
"}",
";",
"}"
] |
Creates the context interface for a call to the given control's formatter of the binding part
with given index.
@param {sap.ui.core.util._with} oWithControl
the "with" control
@param {object} mSettings
map/JSON-object with initial property values, etc.
@param {number} [i]
index of part inside a composite binding
@param {sap.ui.model.Binding|sap.ui.model.Binding[]|sap.ui.model.Context}
[vBindingOrContext]
single binding or model context or array of parts; if this parameter is given,
"oWithControl" and "i" are ignored, else it is lazily computed from those two
@returns {sap.ui.core.util.XMLPreprocessor.IContext}
the callback interface
|
[
"Creates",
"the",
"context",
"interface",
"for",
"a",
"call",
"to",
"the",
"given",
"control",
"s",
"formatter",
"of",
"the",
"binding",
"part",
"with",
"given",
"index",
"."
] |
8a832fca01cb1cdf8df589788e0c5723e2a33c70
|
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/util/XMLPreprocessor.js#L86-L326
|
train
|
SAP/openui5
|
src/sap.ui.core/src/sap/ui/core/util/XMLPreprocessor.js
|
getPath
|
function getPath(oBindingOrContext) {
return oBindingOrContext instanceof Context
? oBindingOrContext.getPath()
: oBindingOrContext.getModel().resolve(
oBindingOrContext.getPath(), oBindingOrContext.getContext());
}
|
javascript
|
function getPath(oBindingOrContext) {
return oBindingOrContext instanceof Context
? oBindingOrContext.getPath()
: oBindingOrContext.getModel().resolve(
oBindingOrContext.getPath(), oBindingOrContext.getContext());
}
|
[
"function",
"getPath",
"(",
"oBindingOrContext",
")",
"{",
"return",
"oBindingOrContext",
"instanceof",
"Context",
"?",
"oBindingOrContext",
".",
"getPath",
"(",
")",
":",
"oBindingOrContext",
".",
"getModel",
"(",
")",
".",
"resolve",
"(",
"oBindingOrContext",
".",
"getPath",
"(",
")",
",",
"oBindingOrContext",
".",
"getContext",
"(",
")",
")",
";",
"}"
] |
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
|
[
"Returns",
"the",
"resolved",
"path",
"for",
"the",
"given",
"single",
"binding",
"or",
"model",
"context",
"."
] |
8a832fca01cb1cdf8df589788e0c5723e2a33c70
|
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/util/XMLPreprocessor.js#L123-L128
|
train
|
SAP/openui5
|
src/sap.ui.core/src/sap/ui/core/util/XMLPreprocessor.js
|
getAny
|
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
|
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);
}
}
|
[
"function",
"getAny",
"(",
"oWithControl",
",",
"oBindingInfo",
",",
"mSettings",
",",
"oScope",
",",
"bAsync",
")",
"{",
"var",
"bValueAsPromise",
"=",
"false",
";",
"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",
")",
")",
";",
"}",
"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",
")",
"{",
"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",
")",
";",
"}",
"}"
] |
Gets the value of the control's "any" property via the given binding info.
@param {sap.ui.core.util._with} oWithControl
the "with" control
@param {object} oBindingInfo
the binding info
@param {object} mSettings
map/JSON-object with initial property values, etc.
@param {object} oScope
map of currently known aliases
@param {boolean} bAsync
whether async processing is allowed
@returns {sap.ui.base.SyncPromise|null}
a sync promise which resolves with the property value or is rejected with a corresponding
error (for example, an error thrown by a formatter), or <code>null</code> in case the
binding is not ready (because it refers to a model which is not available)
|
[
"Gets",
"the",
"value",
"of",
"the",
"control",
"s",
"any",
"property",
"via",
"the",
"given",
"binding",
"info",
"."
] |
8a832fca01cb1cdf8df589788e0c5723e2a33c70
|
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/util/XMLPreprocessor.js#L346-L408
|
train
|
SAP/openui5
|
src/sap.ui.core/src/sap/ui/core/util/XMLPreprocessor.js
|
stopAndGo
|
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
|
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;
}
|
[
"function",
"stopAndGo",
"(",
"aElements",
",",
"fnCallback",
")",
"{",
"var",
"i",
"=",
"-",
"1",
";",
"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",
";",
"}"
] |
Visits the given elements one-by-one, calls the given callback for each of them and stops
and waits for each sync promise returned by the callback before going on to the next element.
If a sync promise resolves with a truthy value, iteration stops and the corresponding element
becomes the result of the returned sync promise.
@param {any[]} aElements
Whatever elements we want to visit
@param {function} fnCallback
A function to be called with a single element and its index and the array (like
{@link Array#find} does it), returning a {@link sap.ui.base.SyncPromise}.
@returns {sap.ui.base.SyncPromise}
A sync promise which resolves with the first element where the callback's sync promise
resolved with a truthy value, or resolves with <code>undefined</code> as soon as the last
callback's sync promise has resolved, or is rejected with a corresponding error if any
callback returns a rejected sync promise or throws an error
@throws {Error}
If the first callback throws
|
[
"Visits",
"the",
"given",
"elements",
"one",
"-",
"by",
"-",
"one",
"calls",
"the",
"given",
"callback",
"for",
"each",
"of",
"them",
"and",
"stops",
"and",
"waits",
"for",
"each",
"sync",
"promise",
"returned",
"by",
"the",
"callback",
"before",
"going",
"on",
"to",
"the",
"next",
"element",
".",
"If",
"a",
"sync",
"promise",
"resolves",
"with",
"a",
"truthy",
"value",
"iteration",
"stops",
"and",
"the",
"corresponding",
"element",
"becomes",
"the",
"result",
"of",
"the",
"returned",
"sync",
"promise",
"."
] |
8a832fca01cb1cdf8df589788e0c5723e2a33c70
|
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/util/XMLPreprocessor.js#L429-L454
|
train
|
SAP/openui5
|
src/sap.ui.core/src/sap/ui/core/util/XMLPreprocessor.js
|
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
|
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;
}
|
[
"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",
";",
"}"
] |
Plug-in the given visitor which is called for each matching XML element.
@param {function} [fnVisitor]
Visitor function, will be called with the matching XML DOM element and a
{@link sap.ui.core.util.XMLPreprocessor.ICallback callback interface} which uses a map
of currently known variables; must return <code>undefined</code>.
Must be either a function or <code>null</code>, nothing else.
@param {string} sNamespace
The expected namespace URI; must not contain spaces;
"http://schemas.sap.com/sapui5/extension/sap.ui.core.template/1" and "sap.ui.core" are
reserved
@param {string} [sLocalName]
The expected local name; if it is missing, the local name is ignored for a match.
@returns {function}
The visitor function which previously matched elements with the given namespace and
local name, or a function which calls "visitNode" but never <code>null</code> so that
you can safely delegate to it.
In general, you cannot restore the previous state by calling <code>plugIn</code> again
with this function.
@throws {Error}
If visitor or namespace is invalid
@private
|
[
"Plug",
"-",
"in",
"the",
"given",
"visitor",
"which",
"is",
"called",
"for",
"each",
"matching",
"XML",
"element",
"."
] |
8a832fca01cb1cdf8df589788e0c5723e2a33c70
|
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/util/XMLPreprocessor.js#L531-L550
|
train
|
|
SAP/openui5
|
src/sap.ui.core/src/sap/ui/core/util/XMLPreprocessor.js
|
function (aElements, fnCallback) {
try {
return SyncPromise.resolve(stopAndGo(aElements, fnCallback));
} catch (e) {
return SyncPromise.reject(e);
}
}
|
javascript
|
function (aElements, fnCallback) {
try {
return SyncPromise.resolve(stopAndGo(aElements, fnCallback));
} catch (e) {
return SyncPromise.reject(e);
}
}
|
[
"function",
"(",
"aElements",
",",
"fnCallback",
")",
"{",
"try",
"{",
"return",
"SyncPromise",
".",
"resolve",
"(",
"stopAndGo",
"(",
"aElements",
",",
"fnCallback",
")",
")",
";",
"}",
"catch",
"(",
"e",
")",
"{",
"return",
"SyncPromise",
".",
"reject",
"(",
"e",
")",
";",
"}",
"}"
] |
Visits the given elements one-by-one, calls the given callback for each of
them and stops and waits for each thenable returned by the callback before
going on to the next element. If a thenable resolves with a truthy value,
iteration stops and the corresponding element becomes the result of the
returned thenable.
<b>Note:</b> If the visitor function is used for synchronous XML Templating,
the callback must return a sync promise; in other cases, any thenable is OK.
@param {any[]} aElements
Whatever elements we want to visit
@param {function} fnCallback
A function to be called with a single element and its index and the array
(like {@link Array#find} does it), returning a thenable, preferrably a
{@link sap.ui.base.SyncPromise}
@returns {sap.ui.base.SyncPromise}
A sync promise which resolves with the first element where the callback's
thenable resolved with a truthy value, or resolves with
<code>undefined</code> as soon as the last callback's thenable has
resolved, or is rejected with a corresponding error if any callback returns
a rejected thenable or throws an error
|
[
"Visits",
"the",
"given",
"elements",
"one",
"-",
"by",
"-",
"one",
"calls",
"the",
"given",
"callback",
"for",
"each",
"of",
"them",
"and",
"stops",
"and",
"waits",
"for",
"each",
"thenable",
"returned",
"by",
"the",
"callback",
"before",
"going",
"on",
"to",
"the",
"next",
"element",
".",
"If",
"a",
"thenable",
"resolves",
"with",
"a",
"truthy",
"value",
"iteration",
"stops",
"and",
"the",
"corresponding",
"element",
"becomes",
"the",
"result",
"of",
"the",
"returned",
"thenable",
"."
] |
8a832fca01cb1cdf8df589788e0c5723e2a33c70
|
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/util/XMLPreprocessor.js#L644-L650
|
train
|
|
SAP/openui5
|
src/sap.ui.core/src/sap/ui/core/util/XMLPreprocessor.js
|
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
|
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);
}
|
[
"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",
")",
";",
"}"
] |
Returns the model's context which corresponds to the given simple binding
path. Uses the map of currently known variables.
@param {string} [sPath=""]
A simple binding path which may include a model name ("a variable"), for
example "var>some/relative/path", but not a binding ("{...}")
@returns {sap.ui.model.Context}
The corresponding context which holds the model and the resolved, absolute
path
@throws {Error}
If a binding is given, if the path refers to an unknown model, or if the
path cannot be resolved (typically because a relative path was given for a
model without a binding context)
|
[
"Returns",
"the",
"model",
"s",
"context",
"which",
"corresponds",
"to",
"the",
"given",
"simple",
"binding",
"path",
".",
"Uses",
"the",
"map",
"of",
"currently",
"known",
"variables",
"."
] |
8a832fca01cb1cdf8df589788e0c5723e2a33c70
|
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/util/XMLPreprocessor.js#L667-L687
|
train
|
|
SAP/openui5
|
src/sap.ui.core/src/sap/ui/core/util/XMLPreprocessor.js
|
getResolvedBinding
|
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
|
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;
}
|
[
"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",
";",
"}",
"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",
";",
"}",
"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",
")",
"{",
"fnCallIfConstant",
"(",
")",
";",
"}",
"}",
"Measurement",
".",
"end",
"(",
"sPerformanceGetResolvedBinding",
")",
";",
"return",
"oPromise",
";",
"}"
] |
Interprets the given value as a binding and returns the resulting value; takes care
of unescaping and thus also of constant expressions.
@param {string} sValue
an XML DOM attribute value
@param {Element} oElement
the XML DOM element
@param {sap.ui.core.util._with} oWithControl
the "with" control
@param {boolean} bMandatory
whether a binding is actually required (e.g. by a <code>template:if</code>) and not
optional (e.g. for {@link resolveAttributeBinding}); if so, the binding parser
unescapes the given value (which is a prerequisite for constant expressions) and
warnings are logged for functions not found
@param {function} [fnCallIfConstant]
optional function to be called in case the return value is obviously a constant,
not influenced by any binding
@returns {sap.ui.base.SyncPromise|null}
a sync promise which resolves with the property value or is rejected with a
corresponding error (for example, an error thrown by a formatter), or
<code>null</code> in case the binding is not ready (because it refers to a model
which is not available)
@throws {Error}
if a formatter returns a promise in sync mode
|
[
"Interprets",
"the",
"given",
"value",
"as",
"a",
"binding",
"and",
"returns",
"the",
"resulting",
"value",
";",
"takes",
"care",
"of",
"unescaping",
"and",
"thus",
"also",
"of",
"constant",
"expressions",
"."
] |
8a832fca01cb1cdf8df589788e0c5723e2a33c70
|
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/util/XMLPreprocessor.js#L1086-L1125
|
train
|
SAP/openui5
|
src/sap.ui.core/src/sap/ui/core/util/XMLPreprocessor.js
|
liftChildNodes
|
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
|
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);
}
});
}
|
[
"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",
")",
";",
"}",
"}",
")",
";",
"}"
] |
Visits the child nodes of the given parent element. Lifts them up by inserting them
before the target element.
@param {Element} oParent the XML DOM DOM element
@param {sap.ui.core.util._with} oWithControl the "with" control
@param {Element} [oTarget=oParent] the target DOM element
@returns {sap.ui.base.SyncPromise}
A sync promise which resolves with <code>undefined</code> as soon as visiting and
lifting is done, or is rejected with a corresponding error if visiting fails.
|
[
"Visits",
"the",
"child",
"nodes",
"of",
"the",
"given",
"parent",
"element",
".",
"Lifts",
"them",
"up",
"by",
"inserting",
"them",
"before",
"the",
"target",
"element",
"."
] |
8a832fca01cb1cdf8df589788e0c5723e2a33c70
|
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/util/XMLPreprocessor.js#L1207-L1216
|
train
|
SAP/openui5
|
src/sap.ui.core/src/sap/ui/core/util/XMLPreprocessor.js
|
visitAttribute
|
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
|
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}}});
}
});
}
|
[
"function",
"visitAttribute",
"(",
"oElement",
",",
"oAttribute",
",",
"oWithControl",
")",
"{",
"if",
"(",
"fnSupportInfo",
")",
"{",
"fnSupportInfo",
"(",
"{",
"context",
":",
"undefined",
",",
"env",
":",
"{",
"caller",
":",
"\"visitAttribute\"",
",",
"before",
":",
"{",
"name",
":",
"oAttribute",
".",
"name",
",",
"value",
":",
"oAttribute",
".",
"value",
"}",
"}",
"}",
")",
";",
"}",
"return",
"resolveAttributeBinding",
"(",
"oElement",
",",
"oAttribute",
",",
"oWithControl",
")",
".",
"then",
"(",
"function",
"(",
")",
"{",
"if",
"(",
"fnSupportInfo",
")",
"{",
"fnSupportInfo",
"(",
"{",
"context",
":",
"undefined",
",",
"env",
":",
"{",
"caller",
":",
"\"visitAttribute\"",
",",
"after",
":",
"{",
"name",
":",
"oAttribute",
".",
"name",
",",
"value",
":",
"oAttribute",
".",
"value",
"}",
"}",
"}",
")",
";",
"}",
"}",
")",
";",
"}"
] |
Visits the given attribute of the given element. If the attribute value represents a
binding expression that can be resolved, it is replaced with the resulting value.
@param {Element} oElement the XML DOM element
@param {Attr} oAttribute one of the element's attribute nodes
@param {sap.ui.core.template._with} oWithControl the "with" control
@returns {sap.ui.base.SyncPromise}
A sync promise which resolves with <code>undefined</code> as soon as the
attribute's value has been replaced, or is rejected with a corresponding error if
getting the binding's value fails.
|
[
"Visits",
"the",
"given",
"attribute",
"of",
"the",
"given",
"element",
".",
"If",
"the",
"attribute",
"value",
"represents",
"a",
"binding",
"expression",
"that",
"can",
"be",
"resolved",
"it",
"is",
"replaced",
"with",
"the",
"resulting",
"value",
"."
] |
8a832fca01cb1cdf8df589788e0c5723e2a33c70
|
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/util/XMLPreprocessor.js#L1726-L1736
|
train
|
SAP/openui5
|
src/sap.ui.core/src/sap/ui/core/util/XMLPreprocessor.js
|
visitAttributes
|
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
|
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);
});
}
|
[
"function",
"visitAttributes",
"(",
"oElement",
",",
"oWithControl",
")",
"{",
"function",
"comparator",
"(",
"oAttributeA",
",",
"oAttributeB",
")",
"{",
"return",
"oAttributeA",
".",
"name",
".",
"localeCompare",
"(",
"oAttributeB",
".",
"name",
")",
";",
"}",
"return",
"stopAndGo",
"(",
"Array",
".",
"prototype",
".",
"slice",
".",
"apply",
"(",
"oElement",
".",
"attributes",
")",
".",
"sort",
"(",
"comparator",
")",
",",
"function",
"(",
"oAttribute",
")",
"{",
"return",
"visitAttribute",
"(",
"oElement",
",",
"oAttribute",
",",
"oWithControl",
")",
";",
"}",
")",
";",
"}"
] |
Visits all attributes of the given element. If an attribute value represents a
binding expression that can be resolved, it is replaced with the resulting value.
@param {Element} oElement the XML DOM element
@param {sap.ui.core.template._with} oWithControl the "with" control
@returns {sap.ui.base.SyncPromise}
A sync promise which resolves with <code>undefined</code> as soon as all
attributes' values have been replaced, or is rejected with a corresponding error if
getting some binding's value fails.
|
[
"Visits",
"all",
"attributes",
"of",
"the",
"given",
"element",
".",
"If",
"an",
"attribute",
"value",
"represents",
"a",
"binding",
"expression",
"that",
"can",
"be",
"resolved",
"it",
"is",
"replaced",
"with",
"the",
"resulting",
"value",
"."
] |
8a832fca01cb1cdf8df589788e0c5723e2a33c70
|
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/util/XMLPreprocessor.js#L1749-L1768
|
train
|
SAP/openui5
|
src/sap.ui.core/src/sap/ui/core/util/XMLPreprocessor.js
|
visitChildNodes
|
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
|
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);
});
}
|
[
"function",
"visitChildNodes",
"(",
"oNode",
",",
"oWithControl",
")",
"{",
"return",
"stopAndGo",
"(",
"Array",
".",
"prototype",
".",
"slice",
".",
"apply",
"(",
"oNode",
".",
"childNodes",
")",
",",
"function",
"(",
"oChild",
")",
"{",
"return",
"visitNode",
"(",
"oChild",
",",
"oWithControl",
")",
";",
"}",
")",
";",
"}"
] |
Visits all child nodes of the given node.
@param {Node} oNode the XML DOM node
@param {sap.ui.core.util._with} oWithControl the "with" control
@returns {sap.ui.base.SyncPromise}
A sync promise which resolves with <code>undefined</code> as soon as visiting is
done, or is rejected with a corresponding error if visiting fails.
|
[
"Visits",
"all",
"child",
"nodes",
"of",
"the",
"given",
"node",
"."
] |
8a832fca01cb1cdf8df589788e0c5723e2a33c70
|
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/util/XMLPreprocessor.js#L1779-L1786
|
train
|
SAP/openui5
|
src/sap.ui.core/src/sap/ui/core/util/XMLPreprocessor.js
|
visitNode
|
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
|
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();
}
|
[
"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",
"}",
"}",
"}",
")",
";",
"}",
"}",
")",
";",
"}",
"if",
"(",
"oNode",
".",
"nodeType",
"!==",
"1",
")",
"{",
"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",
";",
"}",
"}",
"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",
")",
"{",
"error",
"(",
"\"Unexpected return value from visitor for \"",
",",
"oNode",
")",
";",
"}",
"debugFinished",
"(",
"oNode",
")",
";",
"iNestingLevel",
"-=",
"1",
";",
"}",
")",
";",
"}",
"}",
"return",
"visitAttributesAndChildren",
"(",
")",
";",
"}"
] |
Visits the given node.
@param {Node} oNode the XML DOM node
@param {sap.ui.core.template._with} oWithControl the "with" control
@returns {sap.ui.base.SyncPromise}
A sync promise which resolves with <code>undefined</code> as soon as visiting is
done, or is rejected with a corresponding error if visiting fails.
@throws {Error}
If an unexpected tag in the template namespace is encountered
|
[
"Visits",
"the",
"given",
"node",
"."
] |
8a832fca01cb1cdf8df589788e0c5723e2a33c70
|
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/util/XMLPreprocessor.js#L1799-L1873
|
train
|
SAP/openui5
|
src/sap.ui.commons/src/sap/ui/commons/Tree.js
|
restoreSelectedChildren
|
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
|
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);
}
}
|
[
"function",
"restoreSelectedChildren",
"(",
"oNode",
",",
"aExpandingParents",
",",
"oFirstCollapsedParent",
")",
"{",
"var",
"bIsExpanded",
"=",
"oNode",
".",
"getExpanded",
"(",
")",
",",
"bNodeReferredInParents",
"=",
"false",
",",
"bIncludeInExpandingParents",
"=",
"bIsExpanded",
"&&",
"!",
"!",
"oNode",
".",
"getSelectedForNodes",
"(",
")",
".",
"length",
",",
"oFirstCollapsedParentNode",
"=",
"(",
"oFirstCollapsedParent",
"||",
"bIsExpanded",
")",
"?",
"oFirstCollapsedParent",
":",
"oNode",
",",
"i",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"aExpandingParents",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"aExpandingParents",
"[",
"i",
"]",
".",
"getSelectedForNodes",
"(",
")",
".",
"indexOf",
"(",
"oNode",
".",
"getId",
"(",
")",
")",
"!==",
"-",
"1",
")",
"{",
"bNodeReferredInParents",
"=",
"true",
";",
"aExpandingParents",
"[",
"i",
"]",
".",
"removeAssociation",
"(",
"\"selectedForNodes\"",
",",
"oNode",
",",
"true",
")",
";",
"}",
"}",
"if",
"(",
"oFirstCollapsedParentNode",
"&&",
"bNodeReferredInParents",
"&&",
"oFirstCollapsedParentNode",
"!==",
"oNode",
")",
"{",
"if",
"(",
"oFirstCollapsedParentNode",
".",
"getSelectedForNodes",
"(",
")",
".",
"indexOf",
"(",
"oNode",
".",
"getId",
"(",
")",
")",
"===",
"-",
"1",
")",
"{",
"oFirstCollapsedParentNode",
".",
"addAssociation",
"(",
"\"selectedForNodes\"",
",",
"oNode",
",",
"true",
")",
";",
"}",
"oFirstCollapsedParentNode",
".",
"$",
"(",
")",
".",
"addClass",
"(",
"'sapUiTreeNodeSelectedParent'",
")",
";",
"}",
"if",
"(",
"bIncludeInExpandingParents",
")",
"{",
"aExpandingParents",
".",
"push",
"(",
"oNode",
")",
";",
"}",
"var",
"aNodes",
"=",
"oNode",
".",
"_getNodes",
"(",
")",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"aNodes",
".",
"length",
";",
"i",
"++",
")",
"{",
"restoreSelectedChildren",
"(",
"aNodes",
"[",
"i",
"]",
",",
"aExpandingParents",
",",
"oFirstCollapsedParentNode",
")",
";",
"}",
"if",
"(",
"bIncludeInExpandingParents",
")",
"{",
"aExpandingParents",
".",
"pop",
"(",
"oNode",
")",
";",
"}",
"}"
] |
Removes the references inside the expanded node of its selected children, because
they are no longer needed.
@param {sap.ui.commons.TreeNode} oNode The current node to look at
@param {object} aExpandingParents Array of parents of the current node that have selectedForNodes references
@param {sap.ui.commons.TreeNode} oFirstCollapsedParent The topmost collapsed parent node of the current node
|
[
"Removes",
"the",
"references",
"inside",
"the",
"expanded",
"node",
"of",
"its",
"selected",
"children",
"because",
"they",
"are",
"no",
"longer",
"needed",
"."
] |
8a832fca01cb1cdf8df589788e0c5723e2a33c70
|
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.commons/src/sap/ui/commons/Tree.js#L518-L557
|
train
|
SAP/openui5
|
src/sap.ui.commons/src/sap/ui/commons/Tree.js
|
rememberSelectedChildren
|
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
|
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);
}
}
|
[
"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",
")",
";",
"}",
"}"
] |
Adds references inside the collapsed node of all its selected children recursively.
@param {sap.ui.commons.TreeNode} oNode The current node to look at
@param {sap.ui.commons.TreeNode} oRootNode The root node that was collapsed
|
[
"Adds",
"references",
"inside",
"the",
"collapsed",
"node",
"of",
"all",
"its",
"selected",
"children",
"recursively",
"."
] |
8a832fca01cb1cdf8df589788e0c5723e2a33c70
|
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.commons/src/sap/ui/commons/Tree.js#L564-L577
|
train
|
SAP/openui5
|
src/sap.ui.commons/src/sap/ui/commons/MenuBar.js
|
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
|
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;
}
|
[
"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\"",
")",
"{",
"iVisibleItems",
"=",
"iIdx",
";",
"return",
"false",
";",
"}",
"else",
"{",
"lastOffsetLeft",
"=",
"currentOffsetLeft",
";",
"return",
"true",
";",
"}",
"}",
")",
";",
"return",
"iVisibleItems",
";",
"}"
] |
Compute actual number of items currently hidden due to overflow
|
[
"Compute",
"actual",
"number",
"of",
"items",
"currently",
"hidden",
"due",
"to",
"overflow"
] |
8a832fca01cb1cdf8df589788e0c5723e2a33c70
|
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.commons/src/sap/ui/commons/MenuBar.js#L446-L478
|
train
|
|
SAP/openui5
|
src/sap.ui.commons/src/sap/ui/commons/MenuBar.js
|
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
|
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();
}
}
|
[
"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",
"(",
")",
";",
"}",
"}"
] |
Handle the resize of the menubar
|
[
"Handle",
"the",
"resize",
"of",
"the",
"menubar"
] |
8a832fca01cb1cdf8df589788e0c5723e2a33c70
|
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.commons/src/sap/ui/commons/MenuBar.js#L482-L547
|
train
|
|
SAP/openui5
|
src/sap.ui.core/src/sap/ui/model/odata/v4/ODataModel.js
|
parseAndValidateSystemQueryOption
|
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
|
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);
}
}
}
}
|
[
"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\"",
")",
"{",
"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",
")",
";",
"}",
"}",
"}",
"}"
] |
Parses the query options for the given option name "sOptionName" in the given map of
query options "mOptions" to an object if necessary.
Validates if the given query option name is allowed.
@param {object} mOptions Map of query options by name
@param {string} sOptionName Name of the query option
@param {string[]} aAllowed The allowed system query options
@throws {error} If the given query option name is not allowed
|
[
"Parses",
"the",
"query",
"options",
"for",
"the",
"given",
"option",
"name",
"sOptionName",
"in",
"the",
"given",
"map",
"of",
"query",
"options",
"mOptions",
"to",
"an",
"object",
"if",
"necessary",
".",
"Validates",
"if",
"the",
"given",
"query",
"option",
"name",
"is",
"allowed",
"."
] |
8a832fca01cb1cdf8df589788e0c5723e2a33c70
|
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/v4/ODataModel.js#L724-L768
|
train
|
SAP/openui5
|
src/sap.ui.core/src/sap/ui/model/odata/v4/ODataModel.js
|
startsWithQualifiedName
|
function startsWithQualifiedName(sMetaPath) {
var iDotPos = sMetaPath.indexOf("."),
iSlashPos = sMetaPath.indexOf("/");
return iDotPos > 0 && (iSlashPos < 0 || iDotPos < iSlashPos);
}
|
javascript
|
function startsWithQualifiedName(sMetaPath) {
var iDotPos = sMetaPath.indexOf("."),
iSlashPos = sMetaPath.indexOf("/");
return iDotPos > 0 && (iSlashPos < 0 || iDotPos < iSlashPos);
}
|
[
"function",
"startsWithQualifiedName",
"(",
"sMetaPath",
")",
"{",
"var",
"iDotPos",
"=",
"sMetaPath",
".",
"indexOf",
"(",
"\".\"",
")",
",",
"iSlashPos",
"=",
"sMetaPath",
".",
"indexOf",
"(",
"\"/\"",
")",
";",
"return",
"iDotPos",
">",
"0",
"&&",
"(",
"iSlashPos",
"<",
"0",
"||",
"iDotPos",
"<",
"iSlashPos",
")",
";",
"}"
] |
Checks if the given meta path contains a dot in its first segment.
@param {string} sMetaPath The meta path
@returns {boolean} Whether the given meta path contains a dot in its first segment
|
[
"Checks",
"if",
"the",
"given",
"meta",
"path",
"contains",
"a",
"dot",
"in",
"its",
"first",
"segment",
"."
] |
8a832fca01cb1cdf8df589788e0c5723e2a33c70
|
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/v4/ODataModel.js#L896-L901
|
train
|
SAP/openui5
|
src/sap.ui.rta/src/sap/ui/rta/plugin/Plugin.js
|
_checkAggregationBindingTemplateID
|
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
|
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);
}
}
|
[
"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",
")",
";",
"}",
"}"
] |
Check if related binding template has stable id
|
[
"Check",
"if",
"related",
"binding",
"template",
"has",
"stable",
"id"
] |
8a832fca01cb1cdf8df589788e0c5723e2a33c70
|
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.rta/src/sap/ui/rta/plugin/Plugin.js#L271-L278
|
train
|
SAP/openui5
|
src/sap.f/src/sap/f/FlexibleColumnLayoutSemanticHelper.js
|
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
|
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;
}
|
[
"function",
"(",
"oFlexibleColumnLayout",
",",
"oSettings",
")",
"{",
"var",
"oModeToMaxColumnsCountMapping",
"=",
"{",
"Normal",
":",
"3",
",",
"MasterDetail",
":",
"2",
",",
"SingleColumn",
":",
"1",
"}",
",",
"iInitial",
",",
"iMax",
";",
"oSettings",
"||",
"(",
"oSettings",
"=",
"{",
"}",
")",
";",
"this",
".",
"_oFCL",
"=",
"oFlexibleColumnLayout",
";",
"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",
";",
"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",
";",
"iInitial",
"=",
"oSettings",
".",
"initialColumnsCount",
"?",
"parseInt",
"(",
"oSettings",
".",
"initialColumnsCount",
")",
":",
"1",
";",
"if",
"(",
"iInitial",
"<",
"1",
"||",
"iInitial",
">",
"2",
"||",
"this",
".",
"_maxColumnsCount",
"===",
"1",
")",
"{",
"iInitial",
"=",
"1",
";",
"}",
"this",
".",
"_initialColumnsCount",
"=",
"iInitial",
";",
"}"
] |
Constructor for an sap.f.FlexibleColumnLayoutSemanticHelper.
@class
Helper class, facilitating the implementation of the recommended UX design of a <code>sap.f.FlexibleColumnLayout</code>-based app.
<b>Note:</b> Using this class is not mandatory in order to build an app with <code>sap.f.FlexibleColumnLayout</code>, but exists for convenience only.
<ul>The usage of <code>sap.f.FlexibleColumnLayoutSemanticHelper</code> revolves around two main methods:
<li><code>getCurrentUIState</code>Suggests which action buttons to show in each <code>sap.f.FlexibleColumnLayout</code> column,
based on the current control state (number and visibility of columns, layout, etc..)</li>
<li><code>getNextUIState</code>Suggests which <code>layout</code> to use when navigating to another view level (e.g. from one view to two views).</li></ul>
Sample usage of the class:
<pre>
<code>
var helper = sap.f.FlexibleColumnLayoutSemanticHelper.getInstanceFor(myFlexibleColumnLayout);
helper.getCurrentUIState();
helper.getNextUIState(2);
helper.getNextUIState(0);
</code>
</pre>
Calling <code>getCurrentUIState()</code> will return information which action buttons (Close, FullScreen, ExitFullScreen)
must be currently shown in which column, according to UX guidelines, as well as to what layout clicking them should lead.
Calling <code>getNextUIState(2)</code> will return information about the expected layout and action buttons if the
application should display three views (master-detail-detail), based on the current state.
Similarly, calling <code>getNextUIState(0)</code> will return information about the expected layout and action buttons
if the application should display the initial view only (master), based on the current state.
For more information, see {@link sap.f.FlexibleColumnLayoutSemanticHelper#getCurrentUIState} and {@link sap.f.FlexibleColumnLayoutSemanticHelper#getNextUIState}
@version ${version}
@param {sap.f.FlexibleColumnLayout} oFlexibleColumnLayout
The <code>sap.f.FlexibleColumnLayout</code> object whose state will be manipulated.
@param {object} oSettings Determines the rules that will be used by the helper.
@param {sap.f.LayoutType} oSettings.defaultTwoColumnLayoutType
Determines what two-column layout type will be suggested by default:
<code>sap.f.LayoutType.TwoColumnsBeginExpanded</code> (default) or <code>sap.f.LayoutType.TwoColumnsMidExpanded</code>.
@param {sap.f.LayoutType} oSettings.defaultThreeColumnLayoutType
Determines what three-column layout type will be suggested by default:
<code>sap.f.LayoutType.ThreeColumnsMidExpanded</code> (default) or <code>sap.f.LayoutType.ThreeColumnsEndExpanded</code>.
@param {int} oSettings.maxColumnsCount
Determines the maximum number of columns that will be displayed side by side.
<ul>Possible values:
<li>Value of <code>1</code> only single-column layouts will be suggested.</li>
<li>Value of <code>2</code> Up to 2-column layouts will be suggested.</li>
<li>Value of <code>3</code> (default) - Up to 3-column layouts will be suggested.</li></ul>
@param {int} oSettings.initialColumnsCount
Determines whether a single-column or a 2-column layout will be suggested
for logical level 0.
<ul>Possible values:
<li>Value of <code>1</code> (default) - A single-column layout will be suggested
for logical level 0.</li>
<li>Value of <code>2</code> - A 2-column layout will be suggested for logical level 0.</li></ul>
@param {string} oSettings.mode
<b>Deprecated as of version 1.50</b>, use <code>maxColumnsCount</code> param
instead.
Determines the suggested layout types: <code>Normal</code> (3-column layouts),
<code>MasterDetail</code> (2-column layouts for the first two pages, all other
pages will open in fullscreen), and <code>SingleColumn</code> (one page at a
time only).
@public
@since 1.46.0
@alias sap.f.FlexibleColumnLayoutSemanticHelper
|
[
"Constructor",
"for",
"an",
"sap",
".",
"f",
".",
"FlexibleColumnLayoutSemanticHelper",
"."
] |
8a832fca01cb1cdf8df589788e0c5723e2a33c70
|
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.f/src/sap/f/FlexibleColumnLayoutSemanticHelper.js#L99-L134
|
train
|
|
SAP/openui5
|
src/sap.ui.core/src/sap/ui/debug/Highlighter.js
|
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
|
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;
}
}
|
[
"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",
";",
"}",
"}"
] |
Creates a new highlighter object without displaying it.
The DOM node is not created until the first call to method {@link #highlight}.
@param {string} [sId] id that is used by the new highlighter
@param {boolean} [bFilled] whether the box of the highlighter is partially opaque (20%), defaults to false
@param {string} [sColor] the CSS color of the border and the box (defaults to blue)
@param {int} [iBorderWidth] the width of the border
@class Helper class to display a colored rectangle around and above a given DOM node
@author Frank Weigel
@since 0.8.7
@public
@alias sap.ui.debug.Highlighter
|
[
"Creates",
"a",
"new",
"highlighter",
"object",
"without",
"displaying",
"it",
"."
] |
8a832fca01cb1cdf8df589788e0c5723e2a33c70
|
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/debug/Highlighter.js#L31-L42
|
train
|
|
SAP/openui5
|
src/sap.ui.table/src/sap/ui/table/CreationRow.js
|
createDefaultToolbar
|
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
|
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"]
});
}
|
[
"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\"",
"]",
"}",
")",
";",
"}"
] |
Creates a default toolbar providing basic buttons and functionality.
@param {sap.ui.table.CreationRow} oCreationRow The creation row to get the settings for the toolbar creation from.
@returns {sap.m.OverflowToolbar} The default toolbar.
|
[
"Creates",
"a",
"default",
"toolbar",
"providing",
"basic",
"buttons",
"and",
"functionality",
"."
] |
8a832fca01cb1cdf8df589788e0c5723e2a33c70
|
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/CreationRow.js#L165-L181
|
train
|
SAP/openui5
|
src/sap.ui.commons/src/sap/ui/commons/FormattedTextView.js
|
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
|
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();
}
}
|
[
"function",
"(",
"aControls",
")",
"{",
"if",
"(",
"this",
".",
"hasControls",
"(",
")",
")",
"{",
"this",
".",
"removeAllAggregation",
"(",
"\"controls\"",
")",
";",
"}",
"var",
"bIsArray",
"=",
"Array",
".",
"isArray",
"(",
"aControls",
")",
";",
"if",
"(",
"bIsArray",
"&&",
"aControls",
".",
"length",
">",
"0",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"aControls",
".",
"length",
";",
"i",
"++",
")",
"{",
"this",
".",
"addAggregation",
"(",
"\"controls\"",
",",
"aControls",
"[",
"i",
"]",
",",
"true",
")",
";",
"}",
"this",
".",
"invalidate",
"(",
")",
";",
"}",
"}"
] |
Sets the controls to be rendered.
@param {array} aControls Controls should be rendered
@private
|
[
"Sets",
"the",
"controls",
"to",
"be",
"rendered",
"."
] |
8a832fca01cb1cdf8df589788e0c5723e2a33c70
|
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.commons/src/sap/ui/commons/FormattedTextView.js#L227-L240
|
train
|
|
SAP/openui5
|
src/sap.ui.core/src/sap/ui/core/Element.js
|
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
|
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;
}
|
[
"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",
";",
"}"
] |
Returns the data object with the given key
|
[
"Returns",
"the",
"data",
"object",
"with",
"the",
"given",
"key"
] |
8a832fca01cb1cdf8df589788e0c5723e2a33c70
|
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/Element.js#L908-L918
|
train
|
|
SAP/openui5
|
src/sap.ui.core/src/sap/ui/core/Element.js
|
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
|
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);
}
}
}
|
[
"function",
"(",
"element",
",",
"key",
",",
"value",
",",
"writeToDom",
")",
"{",
"if",
"(",
"value",
"===",
"null",
")",
"{",
"var",
"dataObject",
"=",
"getDataObject",
"(",
"element",
",",
"key",
")",
";",
"if",
"(",
"!",
"dataObject",
")",
"{",
"return",
";",
"}",
"var",
"dataCount",
"=",
"element",
".",
"getAggregation",
"(",
"\"customData\"",
")",
".",
"length",
";",
"if",
"(",
"dataCount",
"==",
"1",
")",
"{",
"element",
".",
"destroyAggregation",
"(",
"\"customData\"",
",",
"true",
")",
";",
"}",
"else",
"{",
"element",
".",
"removeAggregation",
"(",
"\"customData\"",
",",
"dataObject",
",",
"true",
")",
";",
"dataObject",
".",
"destroy",
"(",
")",
";",
"}",
"}",
"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",
")",
";",
"}",
"}",
"}"
] |
Contains the data modification logic
|
[
"Contains",
"the",
"data",
"modification",
"logic"
] |
8a832fca01cb1cdf8df589788e0c5723e2a33c70
|
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/Element.js#L923-L952
|
train
|
|
SAP/openui5
|
src/sap.ui.support/src/sap/ui/support/supportRules/ui/models/PresetsUtils.js
|
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
|
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);
}
|
[
"function",
"(",
"aSelectedRulesPlain",
")",
"{",
"if",
"(",
"this",
".",
"model",
".",
"getProperty",
"(",
"\"/persistingSettings\"",
")",
")",
"{",
"var",
"aPersistedPresets",
"=",
"Storage",
".",
"getSelectionPresets",
"(",
")",
";",
"if",
"(",
"aPersistedPresets",
")",
"{",
"this",
".",
"model",
".",
"setProperty",
"(",
"\"/selectionPresets\"",
",",
"aPersistedPresets",
")",
";",
"}",
"}",
"var",
"aPresets",
"=",
"this",
".",
"model",
".",
"getProperty",
"(",
"\"/selectionPresets\"",
")",
",",
"iLastSystemPresetPosition",
"=",
"0",
";",
"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",
"++",
";",
"}",
")",
";",
"var",
"oSelectedPreset",
"=",
"null",
";",
"aPresets",
".",
"some",
"(",
"function",
"(",
"oCurrent",
")",
"{",
"if",
"(",
"oCurrent",
".",
"selected",
")",
"{",
"oSelectedPreset",
"=",
"oCurrent",
";",
"return",
"true",
";",
"}",
"}",
")",
";",
"if",
"(",
"oSelectedPreset",
".",
"isMySelection",
")",
"{",
"oSelectedPreset",
".",
"selections",
"=",
"aSelectedRulesPlain",
";",
"}",
"this",
".",
"model",
".",
"setProperty",
"(",
"\"/selectionPresetsCurrent\"",
",",
"oSelectedPreset",
")",
";",
"}"
] |
Initializes the current selection preset
@param {Array} aSelectedRulesPlain The plain list of selected rules (same format as in the presets json file)
|
[
"Initializes",
"the",
"current",
"selection",
"preset"
] |
8a832fca01cb1cdf8df589788e0c5723e2a33c70
|
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.support/src/sap/ui/support/supportRules/ui/models/PresetsUtils.js#L34-L89
|
train
|
|
SAP/openui5
|
src/sap.ui.support/src/sap/ui/support/supportRules/ui/models/PresetsUtils.js
|
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
|
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();
}
}
|
[
"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",
"(",
")",
";",
"}",
"}"
] |
Synchronizes the current rules selection with the current selection preset
@param {Array} aSelectedRulesPlain The plain list of selected rules (same format as in the presets json file)
|
[
"Synchronizes",
"the",
"current",
"rules",
"selection",
"with",
"the",
"current",
"selection",
"preset"
] |
8a832fca01cb1cdf8df589788e0c5723e2a33c70
|
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.support/src/sap/ui/support/supportRules/ui/models/PresetsUtils.js#L95-L110
|
train
|
|
SAP/openui5
|
src/sap.ui.support/src/sap/ui/support/supportRules/ui/models/PresetsUtils.js
|
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
|
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');
}
|
[
"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'",
")",
";",
"}"
] |
Exports the given selections to a file
@param {string} sId The id of the export
@param {string} sTitle The title of the export
@param {string} sDescription Some description of what is exported
@param {array} aSelections An array of rules IDs which are selected
|
[
"Exports",
"the",
"given",
"selections",
"to",
"a",
"file"
] |
8a832fca01cb1cdf8df589788e0c5723e2a33c70
|
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.support/src/sap/ui/support/supportRules/ui/models/PresetsUtils.js#L119-L132
|
train
|
|
SAP/openui5
|
src/sap.ui.support/src/sap/ui/support/supportRules/ui/models/PresetsUtils.js
|
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
|
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;
}
|
[
"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",
";",
"}"
] |
Validates if the given import is in the correct format.
@param {Object} oImport The preset object to import
@return {boolean} Is the import data a valid rule preset file
|
[
"Validates",
"if",
"the",
"given",
"import",
"is",
"in",
"the",
"correct",
"format",
"."
] |
8a832fca01cb1cdf8df589788e0c5723e2a33c70
|
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.support/src/sap/ui/support/supportRules/ui/models/PresetsUtils.js#L139-L161
|
train
|
|
SAP/openui5
|
src/sap.ui.core/src/sap/ui/core/Core.js
|
preloadLibraryAsync
|
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
|
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;
}
|
[
"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",
"]",
"=",
"{",
"}",
")",
";",
"if",
"(",
"libInfo",
".",
"promise",
")",
"{",
"return",
"libInfo",
".",
"promise",
";",
"}",
"libInfo",
".",
"pending",
"=",
"true",
";",
"libInfo",
".",
"async",
"=",
"true",
";",
"var",
"p",
";",
"if",
"(",
"fileType",
"!==",
"'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",
")",
"{",
"if",
"(",
"fileType",
"!==",
"'js'",
")",
"{",
"Log",
".",
"error",
"(",
"\"failed to load '\"",
"+",
"sPreloadModule",
"+",
"\"' (\"",
"+",
"(",
"e",
"&&",
"e",
".",
"message",
"||",
"e",
")",
"+",
"\"), falling back to library-preload.json\"",
")",
";",
"return",
"loadJSONAsync",
"(",
"lib",
")",
";",
"}",
"}",
")",
";",
"}",
"else",
"{",
"p",
"=",
"loadJSONAsync",
"(",
"lib",
")",
";",
"}",
"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",
"libInfo",
".",
"promise",
";",
"}"
] |
Preloads a library asynchronously.
@param {string|object} libConfig Name of the library to preload or settings object describing library
@param {string} [libConfig.name] Name of the library to preload
@param {boolean|undefined} [libConfig.json] Whether library supports only JSON (<code>true</code>) or only JS (<code>false</code>)
or whether both should be tried (undefined)
@returns {Promise} A promise to be fulfilled when the library has been preloaded
@private
|
[
"Preloads",
"a",
"library",
"asynchronously",
"."
] |
8a832fca01cb1cdf8df589788e0c5723e2a33c70
|
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/Core.js#L1599-L1669
|
train
|
SAP/openui5
|
src/sap.ui.core/src/sap/ui/core/Core.js
|
registerPreloadedModules
|
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
|
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);
}
|
[
"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",
")",
";",
"}"
] |
Adds all resources from a preload bundle to the preload cache.
When a resource exists already in the cache, the new content is ignored.
@param {object} oData Preload bundle
@param {string} [oData.url] URL from which the bundle has been loaded
@param {string} [oData.name] Unique name of the bundle
@param {string} [oData.version='1.0'] Format version of the preload bundle
@param {object} oData.modules Map of resources keyed by their resource name; each resource must be a string or a function
@private
|
[
"Adds",
"all",
"resources",
"from",
"a",
"preload",
"bundle",
"to",
"the",
"preload",
"cache",
"."
] |
8a832fca01cb1cdf8df589788e0c5723e2a33c70
|
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/Core.js#L1716-L1728
|
train
|
SAP/openui5
|
src/sap.ui.core/src/sap/ui/core/Core.js
|
preprocessDependencies
|
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
|
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;
}
|
[
"function",
"preprocessDependencies",
"(",
"dependencies",
")",
"{",
"if",
"(",
"Array",
".",
"isArray",
"(",
"dependencies",
")",
")",
"{",
"return",
"dependencies",
".",
"map",
"(",
"function",
"(",
"dep",
")",
"{",
"return",
"dep",
".",
"replace",
"(",
"/",
"\\.library-preload$",
"/",
",",
"''",
")",
";",
"}",
")",
";",
"}",
"return",
"dependencies",
";",
"}"
] |
Preprocessed given dependencies
@param {object} oDependencies - Dependencies to preprocess
@returns {object} oDependencies - Proprocessed dependencies
|
[
"Preprocessed",
"given",
"dependencies"
] |
8a832fca01cb1cdf8df589788e0c5723e2a33c70
|
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/Core.js#L1736-L1744
|
train
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.