_id
stringlengths 2
6
| title
stringlengths 0
58
| partition
stringclasses 3
values | text
stringlengths 52
373k
| language
stringclasses 1
value | meta_information
dict |
|---|---|---|---|---|---|
q19100
|
train
|
function(oTable) {
var oScrollExtension = oTable._getScrollExtension();
var iVerticalScrollRange = oScrollExtension.getVerticalScrollHeight() - oScrollExtension.getVerticalScrollbarHeight();
return Math.max(0, iVerticalScrollRange);
}
|
javascript
|
{
"resource": ""
}
|
|
q19101
|
train
|
function(oTable) {
var oScrollExtension = oTable._getScrollExtension();
var iVirtualRowCount = oTable._getTotalRowCount() - oTable.getVisibleRowCount();
var iScrollRangeWithoutBuffer;
if (TableUtils.isVariableRowHeightEnabled(oTable)) {
iScrollRangeWithoutBuffer = VerticalScrollingHelper.getScrollRange(oTable) - VerticalScrollingHelper.getScrollRangeBuffer(oTable);
// The last row is part of the buffer. To correctly calculate the fraction of the scroll range allocated to a row, all rows must be
// considered. This is not the case if the scroll range is at its maximum, then the buffer must be excluded from calculation
// completely.
var bScrollRangeMaxedOut = oScrollExtension.getVerticalScrollHeight() === MAX_VERTICAL_SCROLL_HEIGHT;
if (!bScrollRangeMaxedOut) {
iScrollRangeWithoutBuffer += oTable._getDefaultRowHeight();
}
} else {
iScrollRangeWithoutBuffer = VerticalScrollingHelper.getScrollRange(oTable);
}
return iScrollRangeWithoutBuffer / Math.max(1, iVirtualRowCount);
}
|
javascript
|
{
"resource": ""
}
|
|
q19102
|
train
|
function(oTable) {
if (!TableUtils.isVariableRowHeightEnabled(oTable)) {
return false;
}
var iScrollRange = VerticalScrollingHelper.getScrollRange(oTable);
var nScrollPosition = VerticalScrollingHelper.getScrollPosition(oTable);
var iScrollRangeBugger = VerticalScrollingHelper.getScrollRangeBuffer(oTable);
return iScrollRange - nScrollPosition <= iScrollRangeBugger;
}
|
javascript
|
{
"resource": ""
}
|
|
q19103
|
train
|
function(oTable) {
if (!oTable || !oTable._aRowHeights) {
return 0;
}
var aRowHeights = oTable._aRowHeights;
var iEstimatedViewportHeight = oTable._getDefaultRowHeight() * oTable.getVisibleRowCount();
// Only sum rows filled with data, ignore empty rows.
if (oTable.getVisibleRowCount() >= oTable._getTotalRowCount()) {
aRowHeights = aRowHeights.slice(0, oTable._getTotalRowCount());
}
var iInnerVerticalScrollRange = aRowHeights.reduce(function(a, b) { return a + b; }, 0) - iEstimatedViewportHeight;
if (iInnerVerticalScrollRange > 0) {
iInnerVerticalScrollRange = Math.ceil(iInnerVerticalScrollRange);
}
return Math.max(0, iInnerVerticalScrollRange);
}
|
javascript
|
{
"resource": ""
}
|
|
q19104
|
train
|
function(oTable, oEvent) {
var bExecuteDefault = true;
if (internal(oTable).fnOnRowsUpdatedPreprocessor != null) {
bExecuteDefault = internal(oTable).fnOnRowsUpdatedPreprocessor.call(oTable, oEvent) !== false;
}
internal(oTable).fnOnRowsUpdatedPreprocessor = null;
return bExecuteDefault;
}
|
javascript
|
{
"resource": ""
}
|
|
q19105
|
train
|
function(oTable) {
var oScrollExtension = oTable._getScrollExtension();
var aScrollAreas = VerticalScrollingHelper.getScrollAreas(oTable);
var oVSb = oScrollExtension.getVerticalScrollbar();
if (!oScrollExtension._onVerticalScrollEventHandler) {
oScrollExtension._onVerticalScrollEventHandler = VerticalScrollingHelper.onScroll.bind(oTable);
}
for (var i = 0; i < aScrollAreas.length; i++) {
aScrollAreas[i].addEventListener("scroll", oScrollExtension._onVerticalScrollEventHandler);
}
if (oVSb) {
if (!oScrollExtension._onVerticalScrollbarMouseDownEventHandler) {
oScrollExtension._onVerticalScrollbarMouseDownEventHandler = VerticalScrollingHelper.onScrollbarMouseDown.bind(oTable);
}
oVSb.addEventListener("mousedown", oScrollExtension._onVerticalScrollbarMouseDownEventHandler);
}
oTable.attachEvent("_rowsUpdated", VerticalScrollingHelper.onRowsUpdated);
}
|
javascript
|
{
"resource": ""
}
|
|
q19106
|
train
|
function(oTable) {
var oScrollExtension = oTable._getScrollExtension();
var aScrollAreas = VerticalScrollingHelper.getScrollAreas(oTable);
var oVSb = oScrollExtension.getVerticalScrollbar();
if (oScrollExtension._onVerticalScrollEventHandler) {
for (var i = 0; i < aScrollAreas.length; i++) {
aScrollAreas[i].removeEventListener("scroll", oScrollExtension._onVerticalScrollEventHandler);
}
delete oScrollExtension._onVerticalScrollEventHandler;
}
if (oVSb && oScrollExtension._onVerticalScrollbarMouseDownEventHandler) {
oVSb.removeEventListener("mousedown", oScrollExtension._onVerticalScrollbarMouseDownEventHandler);
delete oScrollExtension._onVerticalScrollbarMouseDownEventHandler;
}
oTable.detachEvent("_rowsUpdated", VerticalScrollingHelper.onRowsUpdated);
}
|
javascript
|
{
"resource": ""
}
|
|
q19107
|
train
|
function(oTable) {
var aScrollAreas = [
oTable._getScrollExtension().getVerticalScrollbar()
];
return aScrollAreas.filter(function(oScrollArea) {
return oScrollArea != null;
});
}
|
javascript
|
{
"resource": ""
}
|
|
q19108
|
train
|
function(mOptions, oEvent) {
if (oEvent.type === "touchstart" || oEvent.pointerType === "touch") {
var oScrollExtension = this._getScrollExtension();
var oHSb = oScrollExtension.getHorizontalScrollbar();
var oVSb = oScrollExtension.getVerticalScrollbar();
var oTouchObject = oEvent.touches ? oEvent.touches[0] : oEvent;
internal(this).mTouchSessionData = {
initialPageX: oTouchObject.pageX,
initialPageY: oTouchObject.pageY,
initialScrollTop: oVSb ? oVSb.scrollTop : 0,
initialScrollLeft: oHSb ? oHSb.scrollLeft : 0,
initialScrolledToEnd: null,
touchMoveDirection: null
};
}
}
|
javascript
|
{
"resource": ""
}
|
|
q19109
|
train
|
function(mOptions, oEvent) {
if (oEvent.type !== "touchmove" && oEvent.pointerType !== "touch") {
return;
}
var oScrollExtension = this._getScrollExtension();
var mTouchSessionData = internal(this).mTouchSessionData;
if (!mTouchSessionData) {
return;
}
var oTouchObject = oEvent.touches ? oEvent.touches[0] : oEvent;
var iTouchDistanceX = (oTouchObject.pageX - mTouchSessionData.initialPageX);
var iTouchDistanceY = (oTouchObject.pageY - mTouchSessionData.initialPageY);
var bScrollingPerformed = false;
if (!mTouchSessionData.touchMoveDirection) {
if (iTouchDistanceX === 0 && iTouchDistanceY === 0) {
return;
}
mTouchSessionData.touchMoveDirection = Math.abs(iTouchDistanceX) > Math.abs(iTouchDistanceY) ? "horizontal" : "vertical";
}
switch (mTouchSessionData.touchMoveDirection) {
case "horizontal":
var oHSb = oScrollExtension.getHorizontalScrollbar();
if (oHSb && (mOptions.scrollDirection === ScrollDirection.HORIZONAL
|| mOptions.scrollDirection === ScrollDirection.BOTH)) {
this._getKeyboardExtension().setActionMode(false);
if (mTouchSessionData.initialScrolledToEnd == null) {
if (iTouchDistanceX < 0) { // Scrolling to the right.
mTouchSessionData.initialScrolledToEnd = oHSb.scrollLeft === oHSb.scrollWidth - oHSb.offsetWidth;
} else { // Scrolling to the left.
mTouchSessionData.initialScrolledToEnd = oHSb.scrollLeft === 0;
}
}
if (!mTouchSessionData.initialScrolledToEnd) {
oHSb.scrollLeft = mTouchSessionData.initialScrollLeft - iTouchDistanceX;
bScrollingPerformed = true;
}
}
break;
case "vertical":
var oVSb = oScrollExtension.getVerticalScrollbar();
if (oVSb && (mOptions.scrollDirection === ScrollDirection.VERTICAL
|| mOptions.scrollDirection === ScrollDirection.BOTH)) {
this._getKeyboardExtension().setActionMode(false);
if (mTouchSessionData.initialScrolledToEnd == null) {
if (iTouchDistanceY < 0) { // Scrolling down.
mTouchSessionData.initialScrolledToEnd = oVSb.scrollTop === oVSb.scrollHeight - oVSb.offsetHeight;
} else { // Scrolling up.
mTouchSessionData.initialScrolledToEnd = oVSb.scrollTop === 0;
}
}
if (!mTouchSessionData.initialScrolledToEnd) {
VerticalScrollingHelper.updateScrollPosition(this, mTouchSessionData.initialScrollTop - iTouchDistanceY,
ScrollTrigger.TOUCH);
bScrollingPerformed = true;
}
}
break;
default:
}
if (bScrollingPerformed) {
oEvent.preventDefault();
}
}
|
javascript
|
{
"resource": ""
}
|
|
q19110
|
train
|
function(oTable) {
var oScrollExtension = oTable._getScrollExtension();
var aEventListenerTargets = ScrollingHelper.getEventListenerTargets(oTable);
oScrollExtension._mMouseWheelEventListener = this.addMouseWheelEventListener(aEventListenerTargets, oTable, {
scrollDirection: ScrollDirection.BOTH
});
oScrollExtension._mTouchEventListener = this.addTouchEventListener(aEventListenerTargets, oTable, {
scrollDirection: ScrollDirection.BOTH
});
}
|
javascript
|
{
"resource": ""
}
|
|
q19111
|
train
|
function(aEventListenerTargets, oTable, mOptions) {
var fnOnMouseWheelEventHandler = ScrollingHelper.onMouseWheelScrolling.bind(oTable, mOptions);
for (var i = 0; i < aEventListenerTargets.length; i++) {
aEventListenerTargets[i].addEventListener("wheel", fnOnMouseWheelEventHandler);
}
return {wheel: fnOnMouseWheelEventHandler};
}
|
javascript
|
{
"resource": ""
}
|
|
q19112
|
train
|
function(aEventListenerTargets, oTable, mOptions) {
var fnOnTouchStartEventHandler = ScrollingHelper.onTouchStart.bind(oTable, mOptions);
var fnOnTouchMoveEventHandler = ScrollingHelper.onTouchMoveScrolling.bind(oTable, mOptions);
var mListeners = {};
for (var i = 0; i < aEventListenerTargets.length; i++) {
/* Touch events */
// IE/Edge and Chrome on desktops and windows tablets - pointer events;
// other browsers and tablets - touch events.
if (Device.support.pointer && Device.system.desktop) {
aEventListenerTargets[i].addEventListener("pointerdown", fnOnTouchStartEventHandler);
aEventListenerTargets[i].addEventListener("pointermove", fnOnTouchMoveEventHandler,
Device.browser.chrome ? {passive: true} : false);
} else if (Device.support.touch) {
aEventListenerTargets[i].addEventListener("touchstart", fnOnTouchStartEventHandler);
aEventListenerTargets[i].addEventListener("touchmove", fnOnTouchMoveEventHandler);
}
}
if (Device.support.pointer && Device.system.desktop) {
mListeners = {pointerdown: fnOnTouchStartEventHandler, pointermove: fnOnTouchMoveEventHandler};
} else if (Device.support.touch) {
mListeners = {touchstart: fnOnTouchStartEventHandler, touchmove: fnOnTouchMoveEventHandler};
}
return mListeners;
}
|
javascript
|
{
"resource": ""
}
|
|
q19113
|
train
|
function(oTable) {
var oScrollExtension = oTable._getScrollExtension();
var aEventTargets = ScrollingHelper.getEventListenerTargets(oTable);
function removeEventListener(oTarget, mEventListenerMap) {
for (var sEventName in mEventListenerMap) {
var fnListener = mEventListenerMap[sEventName];
if (fnListener) {
oTarget.removeEventListener(sEventName, fnListener);
}
}
}
for (var i = 0; i < aEventTargets.length; i++) {
removeEventListener(aEventTargets[i], oScrollExtension._mMouseWheelEventListener);
removeEventListener(aEventTargets[i], oScrollExtension._mTouchEventListener);
}
delete oScrollExtension._mMouseWheelEventListener;
delete oScrollExtension._mTouchEventListener;
}
|
javascript
|
{
"resource": ""
}
|
|
q19114
|
calculateStepsToHash
|
train
|
function calculateStepsToHash(sCurrentHash, sToHash, bPrefix){
var iCurrentIndex = jQuery.inArray(sCurrentHash, hashHistory),
iToIndex,
i,
tempHash;
if (iCurrentIndex > 0) {
if (bPrefix) {
for (i = iCurrentIndex - 1; i >= 0 ; i--) {
tempHash = hashHistory[i];
if (tempHash.indexOf(sToHash) === 0 && !isVirtualHash(tempHash)) {
return i - iCurrentIndex;
}
}
} else {
iToIndex = jQuery.inArray(sToHash, hashHistory);
//When back to home is needed, and application is started with nonempty hash but it's nonbookmarkable
if ((iToIndex === -1) && sToHash.length === 0) {
return -1 * iCurrentIndex;
}
if ((iToIndex > -1) && (iToIndex < iCurrentIndex)) {
return iToIndex - iCurrentIndex;
}
}
}
return 0;
}
|
javascript
|
{
"resource": ""
}
|
q19115
|
detectHashChange
|
train
|
function detectHashChange(oEvent, bManual){
//Firefox will decode the hash when it's set to the window.location.hash,
//so we need to parse the href instead of reading the window.location.hash
var sHash = (window.location.href.split("#")[1] || "");
sHash = formatHash(sHash);
if (bManual || !mSkipHandler[sHash]) {
aHashChangeBuffer.push(sHash);
}
if (!bInProcessing) {
bInProcessing = true;
if (aHashChangeBuffer.length > 0) {
var newHash = aHashChangeBuffer.shift();
if (mSkipHandler[newHash]) {
reorganizeHistoryArray(newHash);
delete mSkipHandler[newHash];
} else {
onHashChange(newHash);
}
currentHash = newHash;
}
bInProcessing = false;
}
}
|
javascript
|
{
"resource": ""
}
|
q19116
|
getNextSuffix
|
train
|
function getNextSuffix(sHash){
var sPath = sHash ? sHash : "";
if (isVirtualHash(sPath)) {
var iIndex = sPath.lastIndexOf(skipSuffix);
sPath = sPath.slice(0, iIndex);
}
return sPath + skipSuffix + skipIndex++;
}
|
javascript
|
{
"resource": ""
}
|
q19117
|
preGenHash
|
train
|
function preGenHash(sIdf, oStateData){
var sEncodedIdf = window.encodeURIComponent(sIdf);
var sEncodedData = window.encodeURIComponent(window.JSON.stringify(oStateData));
return sEncodedIdf + sIdSeperator + sEncodedData;
}
|
javascript
|
{
"resource": ""
}
|
q19118
|
getAppendId
|
train
|
function getAppendId(sHash){
var iIndex = jQuery.inArray(currentHash, hashHistory),
i, sHistory;
if (iIndex > -1) {
for (i = 0 ; i < iIndex + 1 ; i++) {
sHistory = hashHistory[i];
if (sHistory.slice(0, sHistory.length - 2) === sHash) {
return uid();
}
}
}
return "";
}
|
javascript
|
{
"resource": ""
}
|
q19119
|
reorganizeHistoryArray
|
train
|
function reorganizeHistoryArray(sHash){
var iIndex = jQuery.inArray(currentHash, hashHistory);
if ( !(iIndex === -1 || iIndex === hashHistory.length - 1) ) {
hashHistory.splice(iIndex + 1, hashHistory.length - 1 - iIndex);
}
hashHistory.push(sHash);
}
|
javascript
|
{
"resource": ""
}
|
q19120
|
calcStepsToRealHistory
|
train
|
function calcStepsToRealHistory(sCurrentHash, bForward){
var iIndex = jQuery.inArray(sCurrentHash, hashHistory),
i;
if (iIndex !== -1) {
if (bForward) {
for (i = iIndex ; i < hashHistory.length ; i++) {
if (!isVirtualHash(hashHistory[i])) {
return i - iIndex;
}
}
} else {
for (i = iIndex ; i >= 0 ; i--) {
if (!isVirtualHash(hashHistory[i])) {
return i - iIndex;
}
}
return -1 * (iIndex + 1);
}
}
}
|
javascript
|
{
"resource": ""
}
|
q19121
|
onHashChange
|
train
|
function onHashChange(sHash){
var oRoute, iStep, oParsedHash, iNewHashIndex, sNavType;
//handle the nonbookmarkable hash
if (currentHash === undefined) {
//url with hash opened from bookmark
oParsedHash = parseHashToObject(sHash);
if (!oParsedHash || !oParsedHash.bBookmarkable) {
if (jQuery.isFunction(defaultHandler)) {
defaultHandler(jQuery.sap.history.NavType.Bookmark);
}
return;
}
}
if (sHash.length === 0) {
if (jQuery.isFunction(defaultHandler)) {
defaultHandler(jQuery.sap.history.NavType.Back);
}
} else {
//application restored from bookmark with non-empty hash, and later navigates back to the first hash token
//the defaultHandler should be triggered
iNewHashIndex = hashHistory.indexOf(sHash);
if (iNewHashIndex === 0) {
oParsedHash = parseHashToObject(sHash);
if (!oParsedHash || !oParsedHash.bBookmarkable) {
if (jQuery.isFunction(defaultHandler)) {
defaultHandler(jQuery.sap.history.NavType.Back);
}
return;
}
}
//need to handle when iNewHashIndex equals -1.
//This happens when user navigates out the current application, and later navigates back.
//In this case, the hashHistory is an empty array.
if (isVirtualHash(sHash)) {
//this is a virtual history, should do the skipping calculation
if (isVirtualHash(currentHash)) {
//go back to the first one that is not virtual
iStep = calcStepsToRealHistory(sHash, false);
window.history.go(iStep);
} else {
var sameFamilyRegex = new RegExp(escapeRegExp(currentHash + skipSuffix) + "[0-9]*$");
if (sameFamilyRegex.test(sHash)) {
//going forward
//search forward in history for the first non-virtual hash
//if there is, change to that one window.history.go
//if not, stay and return false
iStep = calcStepsToRealHistory(sHash, true);
if (iStep) {
window.history.go(iStep);
} else {
window.history.back();
}
} else {
//going backward
//search backward for the first non-virtual hash and there must be one
iStep = calcStepsToRealHistory(sHash, false);
window.history.go(iStep);
}
}
} else {
if (iNewHashIndex === -1) {
sNavType = jQuery.sap.history.NavType.Unknown;
hashHistory.push(sHash);
} else {
if (hashHistory.indexOf(currentHash, iNewHashIndex + 1) === -1) {
sNavType = jQuery.sap.history.NavType.Forward;
} else {
sNavType = jQuery.sap.history.NavType.Back;
}
}
oParsedHash = parseHashToObject(sHash);
if (oParsedHash) {
oRoute = findRouteByIdentifier(oParsedHash.sIdentifier);
if (oRoute) {
oRoute.action.apply(null, [oParsedHash.oStateData, sNavType]);
}
} else {
Log.error("hash format error! The current Hash: " + sHash);
}
}
}
}
|
javascript
|
{
"resource": ""
}
|
q19122
|
findRouteByIdentifier
|
train
|
function findRouteByIdentifier(sIdf){
var i;
for (i = 0 ; i < routes.length ; i++) {
if (routes[i].sIdentifier === sIdf) {
return routes[i];
}
}
}
|
javascript
|
{
"resource": ""
}
|
q19123
|
train
|
function() {
var sLanguage = this.sLanguage || "",
m;
// cut off any ext. language sub tags
if ( sLanguage.indexOf("-") >= 0 ) {
sLanguage = sLanguage.slice(0, sLanguage.indexOf("-"));
}
// convert to new ISO codes
sLanguage = M_ISO639_OLD_TO_NEW[sLanguage] || sLanguage;
// handle special cases for Chinese: map 'Traditional Chinese' (or region TW which implies Traditional) to 'zf'
if ( sLanguage === "zh" ) {
if ( this.sScript === "Hant" || (!this.sScript && this.sRegion === "TW") ) {
sLanguage = "zf";
}
}
// recognize SAP supportability pseudo languages
if ( this.sPrivateUse && (m = /-(saptrc|sappsd)(?:-|$)/i.exec(this.sPrivateUse)) ) {
sLanguage = (m[1].toLowerCase() === "saptrc") ? "1Q" : "2Q";
}
// by convention, SAP systems seem to use uppercase letters
return sLanguage.toUpperCase();
}
|
javascript
|
{
"resource": ""
}
|
|
q19124
|
getDesigntimePropertyAsArray
|
train
|
function getDesigntimePropertyAsArray(sValue) {
var m = /\$([-a-z0-9A-Z._]+)(?::([^$]*))?\$/.exec(sValue);
return (m && m[2]) ? m[2].split(/,/) : null;
}
|
javascript
|
{
"resource": ""
}
|
q19125
|
getHandleChildrenStrategy
|
train
|
function getHandleChildrenStrategy(bAsync, fnCallback) {
// sync strategy ensures processing order by just being sync
function syncStrategy(node, oAggregation, mAggregations) {
var childNode,
vChild,
aChildren = [];
for (childNode = node.firstChild; childNode; childNode = childNode.nextSibling) {
vChild = fnCallback(node, oAggregation, mAggregations, childNode);
if (vChild) {
aChildren.push(unwrapSyncPromise(vChild));
}
}
return SyncPromise.resolve(aChildren);
}
// async strategy ensures processing order by chaining the callbacks
function asyncStrategy(node, oAggregation, mAggregations) {
var childNode,
pChain = Promise.resolve(),
aChildPromises = [];
for (childNode = node.firstChild; childNode; childNode = childNode.nextSibling) {
pChain = pChain.then(fnCallback.bind(null, node, oAggregation, mAggregations, childNode));
aChildPromises.push(pChain);
}
return Promise.all(aChildPromises);
}
return bAsync ? asyncStrategy : syncStrategy;
}
|
javascript
|
{
"resource": ""
}
|
q19126
|
syncStrategy
|
train
|
function syncStrategy(node, oAggregation, mAggregations) {
var childNode,
vChild,
aChildren = [];
for (childNode = node.firstChild; childNode; childNode = childNode.nextSibling) {
vChild = fnCallback(node, oAggregation, mAggregations, childNode);
if (vChild) {
aChildren.push(unwrapSyncPromise(vChild));
}
}
return SyncPromise.resolve(aChildren);
}
|
javascript
|
{
"resource": ""
}
|
q19127
|
asyncStrategy
|
train
|
function asyncStrategy(node, oAggregation, mAggregations) {
var childNode,
pChain = Promise.resolve(),
aChildPromises = [];
for (childNode = node.firstChild; childNode; childNode = childNode.nextSibling) {
pChain = pChain.then(fnCallback.bind(null, node, oAggregation, mAggregations, childNode));
aChildPromises.push(pChain);
}
return Promise.all(aChildPromises);
}
|
javascript
|
{
"resource": ""
}
|
q19128
|
spliceContentIntoResult
|
train
|
function spliceContentIntoResult(vContent) {
// equivalent to aResult.apply(start, deleteCount, content1, content2...)
var args = [i, 1].concat(vContent);
Array.prototype.splice.apply(aResult, args);
}
|
javascript
|
{
"resource": ""
}
|
q19129
|
parseNode
|
train
|
function parseNode(xmlNode, bRoot, bIgnoreTopLevelTextNodes) {
if ( xmlNode.nodeType === 1 /* ELEMENT_NODE */ ) {
var sLocalName = localName(xmlNode);
if (xmlNode.namespaceURI === "http://www.w3.org/1999/xhtml" || xmlNode.namespaceURI === "http://www.w3.org/2000/svg") {
// write opening tag
aResult.push("<" + sLocalName + " ");
// write attributes
var bHasId = false;
for (var i = 0; i < xmlNode.attributes.length; i++) {
var attr = xmlNode.attributes[i];
var value = attr.value;
if (attr.name === "id") {
bHasId = true;
value = getId(oView, xmlNode);
}
aResult.push(attr.name + "=\"" + encodeXML(value) + "\" ");
}
if ( bRoot === true ) {
aResult.push("data-sap-ui-preserve" + "=\"" + oView.getId() + "\" ");
if (!bHasId) {
aResult.push("id" + "=\"" + oView.getId() + "\" ");
}
}
aResult.push(">");
// write children
var oContent = xmlNode;
if (window.HTMLTemplateElement && xmlNode instanceof HTMLTemplateElement && xmlNode.content instanceof DocumentFragment) {
// <template> support (HTMLTemplateElement has no childNodes, but a content node which contains the childNodes)
oContent = xmlNode.content;
}
parseChildren(oContent);
aResult.push("</" + sLocalName + ">");
} else if (sLocalName === "FragmentDefinition" && xmlNode.namespaceURI === "sap.ui.core") {
// a Fragment element - which is not turned into a control itself. Only its content is parsed.
parseChildren(xmlNode, false, true);
// TODO: check if this branch is required or can be handled by the below one
} else {
// assumption: an ELEMENT_NODE with non-XHTML namespace is an SAPUI5 control and the namespace equals the library name
pResultChain = pResultChain.then(function() {
// Chaining the Promises as we need to make sure the order in which the XML DOM nodes are processed is fixed (depth-first, pre-order).
// The order of processing (and Promise resolution) is mandatory for keeping the order of the UI5 Controls' aggregation fixed and compatible.
return createControlOrExtension(xmlNode).then(function(aChildControls) {
for (var i = 0; i < aChildControls.length; i++) {
var oChild = aChildControls[i];
if (oView.getMetadata().hasAggregation("content")) {
oView.addAggregation("content", oChild);
// can oView really have an association called "content"?
} else if (oView.getMetadata().hasAssociation(("content"))) {
oView.addAssociation("content", oChild);
}
}
return aChildControls;
});
});
aResult.push(pResultChain);
}
} else if (xmlNode.nodeType === 3 /* TEXT_NODE */ && !bIgnoreTopLevelTextNodes) {
var text = xmlNode.textContent || xmlNode.text,
parentName = localName(xmlNode.parentNode);
if (text) {
if (parentName != "style") {
text = encodeXML(text);
}
aResult.push(text);
}
}
}
|
javascript
|
{
"resource": ""
}
|
q19130
|
parseChildren
|
train
|
function parseChildren(xmlNode, bRoot, bIgnoreToplevelTextNodes) {
var children = xmlNode.childNodes;
for (var i = 0; i < children.length; i++) {
parseNode(children[i], bRoot, bIgnoreToplevelTextNodes);
}
}
|
javascript
|
{
"resource": ""
}
|
q19131
|
findControlClass
|
train
|
function findControlClass(sNamespaceURI, sLocalName) {
var sClassName;
var mLibraries = sap.ui.getCore().getLoadedLibraries();
jQuery.each(mLibraries, function(sLibName, oLibrary) {
if ( sNamespaceURI === oLibrary.namespace || sNamespaceURI === oLibrary.name ) {
sClassName = oLibrary.name + "." + ((oLibrary.tagNames && oLibrary.tagNames[sLocalName]) || sLocalName);
}
});
// TODO guess library from sNamespaceURI and load corresponding lib!?
sClassName = sClassName || sNamespaceURI + "." + sLocalName;
// ensure that control and library are loaded
function getObjectFallback(oClassObject) {
// some modules might not return a class definition, so we fallback to the global
// this is against the AMD definition, but is required for backward compatibility
if (!oClassObject) {
Log.error("Control '" + sClassName + "' did not return a class definition from sap.ui.define.", "", "XMLTemplateProcessor");
oClassObject = ObjectPath.get(sClassName);
}
if (!oClassObject) {
Log.error("Can't find object class '" + sClassName + "' for XML-view", "", "XMLTemplateProcessor");
}
return oClassObject;
}
var sResourceName = sClassName.replace(/\./g, "/");
var oClassObject = sap.ui.require(sResourceName);
if (!oClassObject) {
if (bAsync) {
return new Promise(function(resolve) {
sap.ui.require([sResourceName], function(oClassObject) {
oClassObject = getObjectFallback(oClassObject);
resolve(oClassObject);
});
});
} else {
oClassObject = sap.ui.requireSync(sResourceName);
oClassObject = getObjectFallback(oClassObject);
}
}
return oClassObject;
}
|
javascript
|
{
"resource": ""
}
|
q19132
|
getObjectFallback
|
train
|
function getObjectFallback(oClassObject) {
// some modules might not return a class definition, so we fallback to the global
// this is against the AMD definition, but is required for backward compatibility
if (!oClassObject) {
Log.error("Control '" + sClassName + "' did not return a class definition from sap.ui.define.", "", "XMLTemplateProcessor");
oClassObject = ObjectPath.get(sClassName);
}
if (!oClassObject) {
Log.error("Can't find object class '" + sClassName + "' for XML-view", "", "XMLTemplateProcessor");
}
return oClassObject;
}
|
javascript
|
{
"resource": ""
}
|
q19133
|
train
|
function (oViewClass) {
var mViewParameters = {
id: id ? getId(oView, node, id) : undefined,
xmlNode: node,
containingView: oView._oContainingView,
processingMode: oView._sProcessingMode // add processing mode, so it can be propagated to subviews inside the HTML block
};
// running with owner component
if (oView.fnScopedRunWithOwner) {
return oView.fnScopedRunWithOwner(function () {
return new oViewClass(mViewParameters);
});
}
// no owner component
// (or fully sync path, which handles the owner propagation on a higher level)
return new oViewClass(mViewParameters);
}
|
javascript
|
{
"resource": ""
}
|
|
q19134
|
train
|
function() {
// Pass processingMode to Fragments only
if (oClass.getMetadata().isA("sap.ui.core.Fragment") && node.getAttribute("type") !== "JS" && oView._sProcessingMode === "sequential") {
mSettings.processingMode = "sequential";
}
if (oView.fnScopedRunWithOwner) {
return oView.fnScopedRunWithOwner(function() {
return new oClass(mSettings);
});
} else {
return new oClass(mSettings);
}
}
|
javascript
|
{
"resource": ""
}
|
|
q19135
|
makeFormatter
|
train
|
function makeFormatter(aFragments) {
var fnFormatter = function() {
var aResult = [],
l = aFragments.length,
i;
for (i = 0; i < l; i++) {
if ( typeof aFragments[i] === "number" ) {
// a numerical fragment references the part with the same number
aResult.push(arguments[aFragments[i]]);
} else {
// anything else is a string fragment
aResult.push(aFragments[i]);
}
}
return aResult.join('');
};
fnFormatter.textFragments = aFragments;
return fnFormatter;
}
|
javascript
|
{
"resource": ""
}
|
q19136
|
makeSimpleBindingInfo
|
train
|
function makeSimpleBindingInfo(sPath) {
var iPos = sPath.indexOf(">"),
oBindingInfo = { path : sPath };
if ( iPos > 0 ) {
oBindingInfo.model = sPath.slice(0,iPos);
oBindingInfo.path = sPath.slice(iPos + 1);
}
return oBindingInfo;
}
|
javascript
|
{
"resource": ""
}
|
q19137
|
expression
|
train
|
function expression(sInput, iStart, oBindingMode) {
var oBinding = ExpressionParser.parse(resolveEmbeddedBinding.bind(null, oEnv), sString,
iStart, null, bStaticContext ? oContext : null);
/**
* Recursively sets the mode <code>oBindingMode</code> on the given binding (or its
* parts).
*
* @param {object} oBinding
* a binding which may be composite
* @param {int} [iIndex]
* index provided by <code>forEach</code>
*/
function setMode(oBinding, iIndex) {
if (oBinding.parts) {
oBinding.parts.forEach(function (vPart, i) {
if (typeof vPart === "string") {
vPart = oBinding.parts[i] = {path : vPart};
}
setMode(vPart, i);
});
b2ndLevelMergedNeeded = b2ndLevelMergedNeeded || iIndex !== undefined;
} else {
oBinding.mode = oBindingMode;
}
}
if (sInput.charAt(oBinding.at) !== "}") {
throw new SyntaxError("Expected '}' and instead saw '"
+ sInput.charAt(oBinding.at)
+ "' in expression binding "
+ sInput
+ " at position "
+ oBinding.at);
}
oBinding.at += 1;
if (oBinding.result) {
setMode(oBinding.result);
} else {
aFragments[aFragments.length - 1] = String(oBinding.constant);
bUnescaped = true;
}
return oBinding;
}
|
javascript
|
{
"resource": ""
}
|
q19138
|
formatValue
|
train
|
function formatValue(aValues, sTargetType) {
var oFormatOptions,
that = this;
if (this.mCustomUnits === undefined && aValues && aValues[2] !== undefined) {
if (aValues[2] === null) { // no unit customizing available
this.mCustomUnits = null;
} else {
this.mCustomUnits = mCodeList2CustomUnits.get(aValues[2]);
if (!this.mCustomUnits) {
this.mCustomUnits = {};
Object.keys(aValues[2]).forEach(function (sKey) {
that.mCustomUnits[sKey] = that.getCustomUnitForKey(aValues[2], sKey);
});
mCodeList2CustomUnits.set(aValues[2], this.mCustomUnits);
}
oFormatOptions = {};
oFormatOptions[sFormatOptionName] = this.mCustomUnits;
fnBaseType.prototype.setFormatOptions.call(this,
Object.assign(oFormatOptions, this.oFormatOptions));
}
}
// composite binding calls formatValue several times,
// where some parts are not yet available
if (!aValues || aValues[0] === undefined || aValues[1] === undefined
|| this.mCustomUnits === undefined && aValues[2] === undefined) {
return null;
}
return fnBaseType.prototype.formatValue.call(this, aValues.slice(0, 2), sTargetType);
}
|
javascript
|
{
"resource": ""
}
|
q19139
|
parseValue
|
train
|
function parseValue(vValue, sSourceType, aCurrentValues) {
var iDecimals, iFractionDigits, aMatches, sUnit, aValues;
if (this.mCustomUnits === undefined) {
throw new ParseException("Cannot parse value without customizing");
}
aValues = fnBaseType.prototype.parseValue.apply(this, arguments);
sUnit = aValues[1] || aCurrentValues[1];
// remove trailing decimal zeroes and separator
if (aValues[0].includes(".")) {
aValues[0] = aValues[0].replace(rTrailingZeros, "").replace(rSeparator, "");
}
if (sUnit && this.mCustomUnits) {
aMatches = rDecimals.exec(aValues[0]);
iFractionDigits = aMatches ? aMatches[1].length : 0;
// If the unit is not in mCustomUnits, the base class throws a ParseException.
iDecimals = this.mCustomUnits[sUnit].decimals;
if (iFractionDigits > iDecimals) {
throw new ParseException(iDecimals
? getText("EnterNumberFraction", [iDecimals])
: getText("EnterInt"));
}
}
if (!this.bParseAsString) {
aValues[0] = Number(aValues[0]);
}
return aValues;
}
|
javascript
|
{
"resource": ""
}
|
q19140
|
train
|
function(oChange, oControl, mPropertyBag) {
var oModifier = mPropertyBag.modifier;
var sPropertyName = mRenameSettings.propertyName;
var oChangeDefinition = oChange.getDefinition();
var sText = oChangeDefinition.texts[mRenameSettings.changePropertyName];
var sValue = sText.value;
if (oChangeDefinition.texts && sText && typeof (sValue) === "string") {
oChange.setRevertData(oModifier.getPropertyBindingOrProperty(oControl, sPropertyName));
oModifier.setPropertyBindingOrProperty(oControl, sPropertyName, sValue);
return true;
} else {
Utils.log.error("Change does not contain sufficient information to be applied: [" + oChangeDefinition.layer + "]" + oChangeDefinition.namespace + "/" + oChangeDefinition.fileName + "." + oChangeDefinition.fileType);
//however subsequent changes should be applied
}
}
|
javascript
|
{
"resource": ""
}
|
|
q19141
|
train
|
function(oChange, oControl, mPropertyBag) {
var oModifier = mPropertyBag.modifier;
var sPropertyName = mRenameSettings.propertyName;
var vOldValue = oChange.getRevertData();
if (vOldValue || vOldValue === "") {
oModifier.setPropertyBindingOrProperty(oControl, sPropertyName, vOldValue);
oChange.resetRevertData();
return true;
} else {
Utils.log.error("Change doesn't contain sufficient information to be reverted. Most Likely the Change didn't go through applyChange.");
}
}
|
javascript
|
{
"resource": ""
}
|
|
q19142
|
train
|
function(oChange, mSpecificChangeInfo, mPropertyBag) {
var oChangeDefinition = oChange.getDefinition();
var sChangePropertyName = mRenameSettings.changePropertyName;
var sTranslationTextType = mRenameSettings.translationTextType;
var oControlToBeRenamed = mPropertyBag.modifier.bySelector(oChange.getSelector(), mPropertyBag.appComponent);
oChangeDefinition.content.originalControlType = mPropertyBag.modifier.getControlType(oControlToBeRenamed);
if (typeof (mSpecificChangeInfo.value) === "string") {
Base.setTextInChange(oChangeDefinition, sChangePropertyName, mSpecificChangeInfo.value, sTranslationTextType);
} else {
throw new Error("oSpecificChangeInfo.value attribute required");
}
}
|
javascript
|
{
"resource": ""
}
|
|
q19143
|
train
|
function (oRouteMatch) {
var that = this;
var mRouteArguments = oRouteMatch.getParameter("arguments");
var oModelData = {};
oModelData.layer = mRouteArguments.layer;
oModelData.namespace = decodeURIComponent(mRouteArguments.namespace);
oModelData.fileName = mRouteArguments.fileName;
oModelData.fileType = mRouteArguments.fileType;
// correct namespace
if (oModelData.namespace[oModelData.namespace.length - 1] !== "/") {
oModelData.namespace += "/";
}
var sContentSuffix = oModelData.namespace + oModelData.fileName + "." + oModelData.fileType;
var oPage = that.getView().getContent()[0];
oPage.setBusy(true);
return LRepConnector.getContent(oModelData.layer, sContentSuffix, null, null, true).then(
that._onContentReceived.bind(that, oModelData, oPage, sContentSuffix),
function () {
oPage.setBusy(false);
}
);
}
|
javascript
|
{
"resource": ""
}
|
|
q19144
|
train
|
function (sLayer, sNameSpace, sFileName, sFileType, sData, sTransportId, sPackageName) {
return LRepConnector.saveFile(sLayer, sNameSpace, sFileName, sFileType, sData, sTransportId, sPackageName).then(this._navToDisplayMode.bind(this));
}
|
javascript
|
{
"resource": ""
}
|
|
q19145
|
train
|
function () {
this._oErrorHandler = new ErrorHandler(this);
// set the device model
this.setModel(models.createDeviceModel(), "device");
// set the global libs data
this.setModel(new JSONModel(), "libsData");
// set the global version data
this.setModel(new JSONModel(), "versionData");
// call the base component's init function and create the App view
UIComponent.prototype.init.apply(this, arguments);
// Load VersionInfo model promise
this.loadVersionInfo();
// create the views based on the url/hash
this.getRouter().initialize();
}
|
javascript
|
{
"resource": ""
}
|
|
q19146
|
train
|
function () {
this._oErrorHandler.destroy();
this._oConfigUtil.destroy();
this._oConfigUtil = null;
// call the base component's destroy function
UIComponent.prototype.destroy.apply(this, arguments);
}
|
javascript
|
{
"resource": ""
}
|
|
q19147
|
train
|
function() {
if (this._sContentDensityClass === undefined) {
// check whether FLP has already set the content density class; do nothing in this case
if (jQuery(document.body).hasClass("sapUiSizeCozy") || jQuery(document.body).hasClass("sapUiSizeCompact")) {
this._sContentDensityClass = "";
}
// The default density class for the sap.ui.documentation project will be compact
this._sContentDensityClass = "sapUiSizeCompact";
}
return this._sContentDensityClass;
}
|
javascript
|
{
"resource": ""
}
|
|
q19148
|
train
|
function (bDeserialize) {
var self = this, oItem,
sMsrDeserialize = "[sync ] _getAll: deserialize";
return new Promise(function (resolve, reject) {
var entries = [],
transaction = self._db.transaction([self.defaultOptions._contentStoreName], "readonly"),
objectStore = transaction.objectStore(self.defaultOptions._contentStoreName);
transaction.onerror = function (event) {
reject(collectErrorData(event));
};
transaction.oncomplete = function (event) {
resolve(entries);
};
objectStore.openCursor().onsuccess = function (event) {
var cursor = event.target.result;
if (cursor && cursor.value) { //cursor.value is ItemData
oItem = new Item(cursor.value, sMsrDeserialize, sMsrCatGet).deserialize();
entries.push({
key: oItem.oData.key,
value: oItem.oData.value
});
cursor.continue();
}
};
});
}
|
javascript
|
{
"resource": ""
}
|
|
q19149
|
cloneMetadata
|
train
|
function cloneMetadata(source) {
var backupMetadata = initMetadata(source.__ui5version);
for (var index in source.__byIndex__) {
backupMetadata.__byIndex__[index] = source.__byIndex__[index];
}
for (var key in source.__byKey__) {
backupMetadata.__byKey__[key] = source.__byKey__[key];
}
return backupMetadata;
}
|
javascript
|
{
"resource": ""
}
|
q19150
|
cleanAndStore
|
train
|
function cleanAndStore(self, key, value) {
return new Promise(function (resolve, reject) {
var attempt = 0;
_cleanAndStore(self, key, value);
function _cleanAndStore(self, key, value) {
attempt++;
Log.debug("Cache Manager LRUPersistentCache: cleanAndStore: freeing space attempt [" + (attempt) + "]");
deleteItemAndUpdateMetadata(self).then(function (deletedKey) {
Log.debug("Cache Manager LRUPersistentCache: cleanAndStore: deleted item with key [" + deletedKey + "]. Going to put " + key);
return internalSet(self, key, value).then(resolve, function (event) {
if (isQuotaExceeded(event)) {
Log.debug("Cache Manager LRUPersistentCache: cleanAndStore: QuotaExceedError during freeing up space...");
if (getItemCount(self) > 0) {
_cleanAndStore(self, key, value);
} else {
reject("Cache Manager LRUPersistentCache: cleanAndStore: even when the cache is empty, the new item with key [" + key + "] cannot be added");
}
} else {
reject("Cache Manager LRUPersistentCache: cleanAndStore: cannot free space: " + collectErrorData(event));
}
});
}, reject);
}
});
}
|
javascript
|
{
"resource": ""
}
|
q19151
|
deleteMetadataForEntry
|
train
|
function deleteMetadataForEntry(self, key) {
var iIndex = self._metadata.__byKey__[key];
delete self._metadata.__byKey__[key];
delete self._metadata.__byIndex__[iIndex];
seekMetadataLRU(self);
}
|
javascript
|
{
"resource": ""
}
|
q19152
|
debugMsr
|
train
|
function debugMsr(sMsg, sKey, sMsrId) {
//avoid redundant string concatenation & getMeasurement call
if (Log.getLevel() >= Log.Level.DEBUG) {
Log.debug(sMsg + " for key [" + sKey + "] took: " + Measurement.getMeasurement(sMsrId).duration);
}
}
|
javascript
|
{
"resource": ""
}
|
q19153
|
ODataParentBinding
|
train
|
function ODataParentBinding() {
// initialize members introduced by ODataBinding
asODataBinding.call(this);
// the aggregated query options
this.mAggregatedQueryOptions = {};
// whether the aggregated query options are processed the first time
this.bAggregatedQueryOptionsInitial = true;
// auto-$expand/$select: promises to wait until child bindings have provided
// their path and query options
this.aChildCanUseCachePromises = [];
// counts the sent but not yet completed PATCHes
this.iPatchCounter = 0;
// whether all sent PATCHes have been successfully processed
this.bPatchSuccess = true;
this.oReadGroupLock = undefined; // see #createReadGroupLock
this.oResumePromise = undefined; // see #getResumePromise
}
|
javascript
|
{
"resource": ""
}
|
q19154
|
getParamInfo
|
train
|
function getParamInfo(sParamName, aDocTags) {
//set default parameter type if there are no @ definitions for the type
var sParamType = '',
sParamDescription = '',
iParamNameIndex,
iDocStartIndex,
rEgexMatchType = /{(.*)}/,
aMatch;
for (var i = 0; i < aDocTags.length; i++) {
if ( aDocTags[i].tag !== 'param' ) {
continue;
}
aMatch = rEgexMatchType.exec(aDocTags[i].content);
iParamNameIndex = aDocTags[i].content.indexOf(sParamName);
if ( aMatch && iParamNameIndex > -1 ) {
//get the match without the curly brackets
sParamType = aMatch[1];
iDocStartIndex = iParamNameIndex + sParamName.length;
sParamDescription = aDocTags[i].content.substr(iDocStartIndex);
//clean the doc from - symbol if they come after the param name and trim the extra whitespace
sParamDescription = sParamDescription.replace(/[-]/, '').trim();
// prevent unnecessary looping!
break;
}
}
return {
name: sParamName,
type: sParamType,
doc: sParamDescription
};
}
|
javascript
|
{
"resource": ""
}
|
q19155
|
train
|
function(oControl) {
var sTemp = HTMLViewRenderer._getHTML(rm, oControl, sHTML);
if (sTemp) {
sHTML = sTemp;
} else {
aDeferred.push(oControl);
}
}
|
javascript
|
{
"resource": ""
}
|
|
q19156
|
scrollIntoView
|
train
|
function scrollIntoView() {
jQuery(window).scrollTop(0);
scrollContainer.scrollTop($this.offset().top - scrollContainer.offset().top + scrollContainer.scrollTop());
}
|
javascript
|
{
"resource": ""
}
|
q19157
|
getMessage
|
train
|
function getMessage(sKey, aParameters) {
return sap.ui.getCore().getLibraryResourceBundle().getText(sKey, aParameters);
}
|
javascript
|
{
"resource": ""
}
|
q19158
|
train
|
function(oEvent) {
var oNewEntity = oEvent.getParameter("oEntity");
oNewEntity.IsActiveEntity = false;
oNewEntity.HasActiveEntity = false;
oNewEntity.HasDraftEntity = false;
}
|
javascript
|
{
"resource": ""
}
|
|
q19159
|
train
|
function(oEvent) {
var oXhr = oEvent.getParameter("oXhr");
var oEntry = jQuery.sap.sjax({
url: oXhr.url,
dataType: "json"
}).data.d;
// navigate to draft nodes and delete nodes
for (var i = 0; i < this._oDraftMetadata.draftNodes.length; i++) {
for (var navprop in this._mEntitySets[this._oDraftMetadata.draftRootName].navprops) {
if (this._mEntitySets[this._oDraftMetadata.draftRootName].navprops[navprop].to.entitySet === this._oDraftMetadata.draftNodes[i]) {
var oResponse = jQuery.sap.sjax({
url: oEntry[navprop].__deferred.uri,
dataType: "json"
});
if (oResponse.data && oResponse.data.d && oResponse.data.d.results) {
var oNode;
for (var j = 0; j < oResponse.data.d.results.length; j++) {
oNode = oResponse.data.d.results[j];
jQuery.sap.sjax({
url: oNode.__metadata.uri,
type: "DELETE"
});
}
}
}
}
}
}
|
javascript
|
{
"resource": ""
}
|
|
q19160
|
train
|
function(sEntityset, mEntitySets) {
var aSemanticKey = [];
for (var annotationsProperty in this._oDraftMetadata.annotations) {
if (annotationsProperty.lastIndexOf(mEntitySets[sEntityset].type) > -1) {
aSemanticKey = this._oDraftMetadata.annotations[annotationsProperty][this._oConstants.COM_SAP_VOCABULARIES_COMMON_V1_SEMANTICKEY] || [];
break;
}
}
var aSemanticKeys = [];
var element;
for (var i = 0; i < aSemanticKey.length; i++) {
element = aSemanticKey[i];
for (var key in element) {
aSemanticKeys.push(element[key]);
}
}
return aSemanticKeys;
}
|
javascript
|
{
"resource": ""
}
|
|
q19161
|
train
|
function(mEntitySets) {
var that = this;
this._oDraftMetadata.draftNodes = [];
this._oDraftMetadata.draftRootKey = mEntitySets[this._oDraftMetadata.draftRootName].keys.filter(function(x) {
return that._calcSemanticKeys(that._oDraftMetadata.draftRootName, mEntitySets).indexOf(x) < 0;
})[0];
var oAnnotations = that._oDraftMetadata.annotations;
var oEntitySetsAnnotations = oAnnotations.EntityContainer[Object.keys(oAnnotations.EntityContainer)[0]];
//iterate over entitysets annotations
for (var sEntityset in oEntitySetsAnnotations) {
//get entity set
var oEntitySetAnnotations = oEntitySetsAnnotations[sEntityset];
//iterate over annotations of entity set annotations and look for the draft node sets
if (oEntitySetAnnotations[that._oConstants.COM_SAP_VOCABULARIES_COMMON_V1_DRAFTNODE]) {
this._oDraftMetadata.draftNodes.push(sEntityset);
}
}
for (var j = 0; j < this._oDraftMetadata.draftNodes.length; j++) {
this.attachAfter(MockServer.HTTPMETHOD.GET, this._fnDraftAdministrativeData, this._oDraftMetadata.draftNodes[j]);
}
}
|
javascript
|
{
"resource": ""
}
|
|
q19162
|
train
|
function(oEntry) {
var oResponse;
var fnGrep = function(aContains, aContained) {
return aContains.filter(function(x) {
return aContained.indexOf(x) < 0;
})[0];
};
// navigate to draft nodes and activate nodes
for (var i = 0; i < this._oDraftMetadata.draftNodes.length; i++) {
for (var navprop in this._mEntitySets[this._oDraftMetadata.draftRootName].navprops) {
if (this._mEntitySets[this._oDraftMetadata.draftRootName].navprops[navprop].to.entitySet === this._oDraftMetadata.draftNodes[i]) {
oResponse = jQuery.sap.sjax({
url: oEntry[navprop].__deferred.uri,
dataType: "json"
});
if (oResponse.success && oResponse.data && oResponse.data.d && oResponse.data.d.results) {
var oNode;
for (var j = 0; j < oResponse.data.d.results.length; j++) {
oNode = oResponse.data.d.results[j];
oNode.IsActiveEntity = true;
oNode.HasActiveEntity = false;
oNode.HasDraftEntity = false;
oNode[this._oDraftMetadata.draftRootKey] = this._oConstants.EMPTY_GUID;
var aSemanticDraftNodeKeys = this._calcSemanticKeys(this._oDraftMetadata.draftNodes[i], this._mEntitySets);
var sDraftKey = fnGrep(this._mEntitySets[this._oDraftMetadata.draftNodes[i]].keys, aSemanticDraftNodeKeys);
oNode[sDraftKey] = this._oConstants.EMPTY_GUID;
jQuery.sap.sjax({
url: oNode.__metadata.uri,
type: "PATCH",
data: JSON.stringify(oNode)
});
}
}
}
}
}
oEntry.IsActiveEntity = true;
oEntry.HasActiveEntity = false;
oEntry.HasDraftEntity = false;
oEntry[this._oDraftMetadata.draftRootKey] = this._oConstants.EMPTY_GUID;
jQuery.sap.sjax({
url: oEntry.__metadata.uri,
type: "PATCH",
data: JSON.stringify(oEntry)
});
return oEntry;
}
|
javascript
|
{
"resource": ""
}
|
|
q19163
|
comparePriority
|
train
|
function comparePriority(firstPriority, secondPriority) {
if (firstPriority == secondPriority) {
return firstPriority;
}
if ((firstPriority == 'None')) {
return secondPriority;
}
if ((firstPriority == 'Low') && (secondPriority != 'None')) {
return secondPriority;
}
if ((firstPriority == 'Medium') && (secondPriority != 'None' && secondPriority != 'Low')) {
return secondPriority;
}
return firstPriority;
}
|
javascript
|
{
"resource": ""
}
|
q19164
|
train
|
function(iIndex, bSelected) {
var oTable = this.getTable();
var oRow = oTable.getRows()[iIndex];
if (oRow && bSelected != null) {
TableUtils.toggleRowSelection(oTable, oRow.getIndex(), bSelected);
}
}
|
javascript
|
{
"resource": ""
}
|
|
q19165
|
train
|
function(iIndex, bHovered) {
var oTable = this.getTable();
var oRow = oTable.getRows()[iIndex];
if (oRow && bHovered != null) {
oRow._setHovered(bHovered);
}
}
|
javascript
|
{
"resource": ""
}
|
|
q19166
|
train
|
function( handler ) {
var hooks = [];
// Hooks are ignored on skipped tests
if ( this.skip ) {
return hooks;
}
if ( this.module.testEnvironment &&
QUnit.objectType( this.module.testEnvironment[ handler ] ) === "function" ) {
hooks.push( this.queueHook( this.module.testEnvironment[ handler ], handler ) );
}
return hooks;
}
|
javascript
|
{
"resource": ""
}
|
|
q19167
|
generateHash
|
train
|
function generateHash( module, testName ) {
var hex,
i = 0,
hash = 0,
str = module + "\x1C" + testName,
len = str.length;
for ( ; i < len; i++ ) {
hash = ( ( hash << 5 ) - hash ) + str.charCodeAt( i );
hash |= 0;
}
// Convert the possibly negative integer hash code into an 8 character hex string, which isn't
// strictly necessary but increases user understanding that the id is a SHA-like hash
hex = ( 0x100000000 + hash ).toString( 16 );
if ( hex.length < 8 ) {
hex = "0000000" + hex;
}
return hex.slice( -8 );
}
|
javascript
|
{
"resource": ""
}
|
q19168
|
bindCallbacks
|
train
|
function bindCallbacks( o, callbacks, args ) {
var prop = QUnit.objectType( o );
if ( prop ) {
if ( QUnit.objectType( callbacks[ prop ] ) === "function" ) {
return callbacks[ prop ].apply( callbacks, args );
} else {
return callbacks[ prop ]; // or undefined
}
}
}
|
javascript
|
{
"resource": ""
}
|
q19169
|
train
|
function( fn ) {
var args,
l = fn.length;
if ( !l ) {
return "";
}
args = new Array( l );
while ( l-- ) {
// 97 is 'a'
args[ l ] = String.fromCharCode( 97 + l );
}
return " " + args.join( ", " ) + " ";
}
|
javascript
|
{
"resource": ""
}
|
|
q19170
|
escapeText
|
train
|
function escapeText( s ) {
if ( !s ) {
return "";
}
s = s + "";
// Both single quotes and double quotes (for attributes)
return s.replace( /['"<>&]/g, function( s ) {
switch ( s ) {
case "'":
return "'";
case "\"":
return """;
case "<":
return "<";
case ">":
return ">";
case "&":
return "&";
}
});
}
|
javascript
|
{
"resource": ""
}
|
q19171
|
train
|
function () {
//step1: create model from configuration
this._oModel = null; //internal component model
this._oViewConfig = { //internal view configuration
viewData: {
component: this
}
};
//step2: load model from the component configuration
switch (this.oComponentData.mode) {
case ObjectPageConfigurationMode.JsonURL:
// jsonUrl bootstraps the ObjectPageLayout on a json config url jsonConfigurationURL
// case 1: load from an XML view + json for the object page layout configuration
this._oModel = new UIComponent(this.oComponentData.jsonConfigurationURL);
this._oViewConfig.viewName = "sap.uxap.component.ObjectPageLayoutUXDrivenFactory";
this._oViewConfig.type = ViewType.XML;
break;
case ObjectPageConfigurationMode.JsonModel:
// JsonModel bootstraps the ObjectPageLayout from the external model objectPageLayoutMedatadata
this._oViewConfig.viewName = "sap.uxap.component.ObjectPageLayoutUXDrivenFactory";
this._oViewConfig.type = ViewType.XML;
break;
default:
Log.error("UxAPComponent :: missing bootstrap information. Expecting one of the following: JsonURL, JsonModel and FacetsAnnotation");
}
//create the UIComponent
UIComponent.prototype.init.call(this);
}
|
javascript
|
{
"resource": ""
}
|
|
q19172
|
train
|
function () {
var oController;
//step3: create view
this._oView = sap.ui.view(this._oViewConfig);
//step4: bind the view with the model
if (this._oModel) {
oController = this._oView.getController();
//some factory requires pre-processing once the view and model are created
if (oController && oController.connectToComponent) {
oController.connectToComponent(this._oModel);
}
//can now apply the model and rely on the underlying factory logic
this._oView.setModel(this._oModel, "objectPageLayoutMetadata");
}
return this._oView;
}
|
javascript
|
{
"resource": ""
}
|
|
q19173
|
train
|
function (vName) {
if (this.oComponentData.mode === ObjectPageConfigurationMode.JsonModel) {
var oController = this._oView.getController();
//some factory requires post-processing once the view and model are created
if (oController && oController.connectToComponent) {
oController.connectToComponent(this.getModel("objectPageLayoutMetadata"));
}
}
return UIComponent.prototype.propagateProperties.apply(this, arguments);
}
|
javascript
|
{
"resource": ""
}
|
|
q19174
|
train
|
function () {
if (this._oView) {
this._oView.destroy();
this._oView = null;
}
if (this._oModel) {
this._oModel.destroy();
this._oModel = null;
}
if (UIComponent.prototype.destroy) {
UIComponent.prototype.destroy.call(this);
}
}
|
javascript
|
{
"resource": ""
}
|
|
q19175
|
train
|
function(sControlId, sRelatedControlId, oCore){
var oControl = sControlId ? oCore && oCore.byId(sControlId) : null;
if (oControl) {
var oRelatedControl = sRelatedControlId ? oCore.byId(sRelatedControlId) : null;
var oEvent = jQuery.Event("sapfocusleave");
oEvent.target = oControl.getDomRef();
oEvent.relatedControlId = oRelatedControl ? oRelatedControl.getId() : null;
oEvent.relatedControlFocusInfo = oRelatedControl ? oRelatedControl.getFocusInfo() : null;
//TODO: Cleanup the popup! The following is shit
var oControlUIArea = oControl.getUIArea();
var oUiArea = null;
if (oControlUIArea) {
oUiArea = oCore.getUIArea(oControlUIArea.getId());
} else {
var oPopupUIAreaDomRef = oCore.getStaticAreaRef();
if (containsOrEquals(oPopupUIAreaDomRef, oEvent.target)) {
oUiArea = oCore.getUIArea(oPopupUIAreaDomRef.id);
}
}
if (oUiArea) {
oUiArea._handleEvent(oEvent);
}
}
}
|
javascript
|
{
"resource": ""
}
|
|
q19176
|
toJapanese
|
train
|
function toJapanese(oGregorian) {
var iEra = UniversalDate.getEraByDate(CalendarType.Japanese, oGregorian.year, oGregorian.month, oGregorian.day),
iEraStartYear = UniversalDate.getEraStartDate(CalendarType.Japanese, iEra).year;
return {
era: iEra,
year: oGregorian.year - iEraStartYear + 1,
month: oGregorian.month,
day: oGregorian.day
};
}
|
javascript
|
{
"resource": ""
}
|
q19177
|
toGregorian
|
train
|
function toGregorian(oJapanese) {
var iEraStartYear = UniversalDate.getEraStartDate(CalendarType.Japanese, oJapanese.era).year;
return {
year: iEraStartYear + oJapanese.year - 1,
month: oJapanese.month,
day: oJapanese.day
};
}
|
javascript
|
{
"resource": ""
}
|
q19178
|
toGregorianArguments
|
train
|
function toGregorianArguments(aArgs) {
var oJapanese, oGregorian,
iEra,
vYear = aArgs[0];
if (typeof vYear == "number") {
if (vYear >= 100) {
// Year greater than 100 will be treated as gregorian year
return aArgs;
} else {
// Year less than 100 is emperor year in the current era
iEra = UniversalDate.getCurrentEra(CalendarType.Japanese);
vYear = [iEra, vYear];
}
} else if (!Array.isArray(vYear)) {
// Invalid year
vYear = [];
}
oJapanese = {
era: vYear[0],
year: vYear[1],
month: aArgs[1],
day: aArgs[2] !== undefined ? aArgs[2] : 1
};
oGregorian = toGregorian(oJapanese);
aArgs[0] = oGregorian.year;
return aArgs;
}
|
javascript
|
{
"resource": ""
}
|
q19179
|
train
|
function (oEvent) {
var oSource = oEvent.getSource ? oEvent.getSource() : oEvent.target;
if (!this.oDisclaimerPopover) {
sap.ui.core.Fragment.load({
name: "sap.ui.documentation.sdk.view.LegalDisclaimerPopover"
}).then(function (oPopover) {
this.oDisclaimerPopover = oPopover;
oPopover.openBy(oSource);
}.bind(this));
return; // We continue execution in the promise
} else if (this.oDisclaimerPopover.isOpen()) {
this.oDisclaimerPopover.close();
}
this.oDisclaimerPopover.openBy(oSource);
}
|
javascript
|
{
"resource": ""
}
|
|
q19180
|
train
|
function (sControlName, oControlsData) {
var oLibComponentModel = oControlsData.libComponentInfos,
oLibInfo = library._getLibraryInfoSingleton();
return oLibInfo._getActualComponent(oLibComponentModel, sControlName);
}
|
javascript
|
{
"resource": ""
}
|
|
q19181
|
train
|
function(oEvent) {
var oImage = this.byId("phoneImage");
if (Device.system.phone && oImage) {
oImage.toggleStyleClass("phoneHeaderImageLandscape", oEvent.landscape);
}
}
|
javascript
|
{
"resource": ""
}
|
|
q19182
|
train
|
function (sControlName) {
return APIInfo.getIndexJsonPromise().then(function (aData) {
function findSymbol (a) {
return a.some(function (o) {
var bFound = o.name === sControlName;
if (!bFound && o.nodes) {
return findSymbol(o.nodes);
}
return bFound;
});
}
return findSymbol(aData);
});
}
|
javascript
|
{
"resource": ""
}
|
|
q19183
|
cssSizeToPx
|
train
|
function cssSizeToPx(sCssSize) {
if (sCssSize === 0 || sCssSize === "0") {
return 0;
}
var aMatch = sCssSize.match(/^(\d+(\.\d+)?)(px|rem)$/),
iValue;
if (aMatch) {
if (aMatch[3] === "px") {
iValue = parseFloat(aMatch[1]);
} else {
iValue = Rem.toPx(parseFloat(aMatch[1]));
}
} else {
Log.error("Css size '" + sCssSize + "' is not supported for GridContainer. Only 'px' and 'rem' are supported.");
iValue = NaN;
}
return Math.ceil(iValue);
}
|
javascript
|
{
"resource": ""
}
|
q19184
|
train
|
function (oNode) {
// do not count the artifical root node
if (!oNode || !oNode.isArtificial) {
iNodeCounter++;
}
if (oNode) {
// Always reset selectAllMode
oNode.nodeState.selectAllMode = false;
if (this._mTreeState.selected[oNode.groupID]) {
// remember changed index, push it to the limit!
if (!oNode.isArtificial) {
aChangedIndices.push(iNodeCounter);
}
// deslect the node
this.setNodeSelection(oNode.nodeState, false);
//also remember the old lead index
if (oNode.groupID === this._sLeadSelectionGroupID) {
iOldLeadIndex = iNodeCounter;
}
return true;
}
}
}
|
javascript
|
{
"resource": ""
}
|
|
q19185
|
isValidTextKey
|
train
|
function isValidTextKey(oControl, sKey) {
var mTexts = oControl.getTextsToBeHyphenated();
if (typeof mTexts !== "object") {
Log.error("[UI5 Hyphenation] The result of getTextsToBeHyphenated method is not a map object.", oControl.getId());
return false;
}
if (Object.keys(mTexts).indexOf(sKey) < 0) {
Log.error("[UI5 Hyphenation] The key " + sKey + " is not found in the result of getTextsToBeHyphenated method.", oControl.getId());
return false;
}
return true;
}
|
javascript
|
{
"resource": ""
}
|
q19186
|
diffTexts
|
train
|
function diffTexts(mTextsMain, mTextsToDiff) {
var aDiffs = [];
Object.keys(mTextsMain).forEach(function(sKey) {
if (!(sKey in mTextsToDiff && mTextsMain[sKey] === mTextsToDiff[sKey])) {
aDiffs.push(sKey);
}
});
return aDiffs;
}
|
javascript
|
{
"resource": ""
}
|
q19187
|
shouldUseThirdParty
|
train
|
function shouldUseThirdParty() {
var sHyphenationConfig = Core.getConfiguration().getHyphenation(),
oHyphenationInstance = Hyphenation.getInstance();
if (sHyphenationConfig === "native" || sHyphenationConfig === "disable") {
return false;
}
if (sHyphenationConfig === "thirdparty") {
return true;
}
return oHyphenationInstance.isLanguageSupported()
&& !oHyphenationInstance.canUseNativeHyphenation()
&& oHyphenationInstance.canUseThirdPartyHyphenation();
}
|
javascript
|
{
"resource": ""
}
|
q19188
|
shouldControlHyphenate
|
train
|
function shouldControlHyphenate(oControl) {
var sHyphenationConfig = Core.getConfiguration().getHyphenation();
if (sHyphenationConfig === 'disable') {
return false;
}
if (oControl.getWrappingType() === WrappingType.Hyphenated && !oControl.getWrapping()) {
Log.warning("[UI5 Hyphenation] The property wrappingType=Hyphenated will not take effect unless wrapping=true.", oControl.getId());
}
return oControl.getWrapping() && oControl.getWrappingType() === WrappingType.Hyphenated;
}
|
javascript
|
{
"resource": ""
}
|
q19189
|
hyphenateTexts
|
train
|
function hyphenateTexts(oControl) {
if (!shouldControlHyphenate(oControl) || !shouldUseThirdParty()) {
// no hyphenation needed
oControl._mHyphenatedTexts = {};
oControl._mUnhyphenatedTexts = {};
return;
}
var mTexts = oControl.getTextsToBeHyphenated(),
aChangedTextKeys = diffTexts(mTexts, oControl._mUnhyphenatedTexts);
if (aChangedTextKeys.length > 0) {
oControl._mUnhyphenatedTexts = mTexts;
aChangedTextKeys.forEach(function(sKey) {
delete oControl._mHyphenatedTexts[sKey];
});
var oHyphenation = Hyphenation.getInstance();
if (!oHyphenation.isLanguageInitialized()) {
oHyphenation.initialize().then(function () {
var mDomRefs = oControl.isActive() ? oControl.getDomRefsForHyphenatedTexts() : null,
bNeedInvalidate = false;
aChangedTextKeys.forEach(function(sKey) {
oControl._mHyphenatedTexts[sKey] = oHyphenation.hyphenate(mTexts[sKey]);
if (mDomRefs && sKey in mDomRefs) {
setNodeValue(mDomRefs[sKey], oControl._mHyphenatedTexts[sKey]);
} else {
bNeedInvalidate = true;
}
});
if (bNeedInvalidate) {
oControl.invalidate();
}
});
} else {
aChangedTextKeys.forEach(function(sKey) {
oControl._mHyphenatedTexts[sKey] = oHyphenation.hyphenate(mTexts[sKey]);
});
}
}
}
|
javascript
|
{
"resource": ""
}
|
q19190
|
parseNumberAndUnit
|
train
|
function parseNumberAndUnit(mUnitPatterns, sValue) {
var oBestMatch = {
numberValue: undefined,
cldrCode: []
};
if (typeof sValue !== "string") {
return oBestMatch;
}
var iBestLength = Number.POSITIVE_INFINITY;
var sUnitCode, sKey;
for (sUnitCode in mUnitPatterns) {
for (sKey in mUnitPatterns[sUnitCode]) {
//use only unit patterns
if (sKey.indexOf("unitPattern") === 0) {
var sUnitPattern = mUnitPatterns[sUnitCode][sKey];
// IMPORTANT:
// To increase performance we are using native string operations instead of regex,
// to match the patterns against the input.
//
// sample input: e.g. "mi 12 tsd. ms²"
// unit pattern: e.g. "mi {0} ms²"
// The smallest resulting number (String length) will be the best match
var iNumberPatternIndex = sUnitPattern.indexOf("{0}");
var bContainsExpression = iNumberPatternIndex > -1;
if (bContainsExpression) {
//escape regex characters to match it properly
var sPrefix = sUnitPattern.substring(0, iNumberPatternIndex);
var sPostfix = sUnitPattern.substring(iNumberPatternIndex + "{0}".length);
var bMatches = sValue.startsWith(sPrefix) && sValue.endsWith(sPostfix);
var match = bMatches && sValue.substring(sPrefix.length, sValue.length - sPostfix.length);
if (match) {
//get the match with the shortest result.
// e.g. 1km -> (.+)m -> "1k" -> length 2
// e.g. 1km -> (.+)km -> "1" -> length 1
if (match.length < iBestLength) {
iBestLength = match.length;
oBestMatch.numberValue = match;
oBestMatch.cldrCode = [sUnitCode];
} else if (match.length === iBestLength && oBestMatch.cldrCode.indexOf(sUnitCode) === -1) {
//ambiguous unit (en locale)
// e.g. 100 c -> (.+) c -> duration-century
// e.g. 100 c -> (.+) c -> volume-cup
oBestMatch.cldrCode.push(sUnitCode);
}
}
} else if (sUnitPattern === sValue) {
oBestMatch.cldrCode = [sUnitCode];
//for units which do not have a number representation, get the number from the pattern
var sNumber;
if (sKey.endsWith("-zero")) {
sNumber = "0";
} else if (sKey.endsWith("-one")) {
sNumber = "1";
} else if (sKey.endsWith("-two")) {
sNumber = "2";
}
oBestMatch.numberValue = sNumber;
return oBestMatch;
}
}
}
}
return oBestMatch;
}
|
javascript
|
{
"resource": ""
}
|
q19191
|
parseNumberAndCurrency
|
train
|
function parseNumberAndCurrency(oConfig) {
var sValue = oConfig.value;
// Search for known symbols (longest match)
// no distinction between default and custom currencies
var oMatch = findLongestMatch(sValue, oConfig.currencySymbols);
// Search for currency code
if (!oMatch.code) {
// before falling back to the default regex for ISO codes we check the
// codes for custom currencies (if defined)
oMatch = findLongestMatch(sValue, oConfig.customCurrencyCodes);
if (!oMatch.code && !oConfig.customCurrenciesAvailable) {
// Match 3-letter iso code
var aIsoMatches = sValue.match(/(^[A-Z]{3}|[A-Z]{3}$)/);
oMatch.code = aIsoMatches && aIsoMatches[0];
}
}
// Remove symbol/code from value
if (oMatch.code) {
var iLastCodeIndex = oMatch.code.length - 1;
var sLastCodeChar = oMatch.code.charAt(iLastCodeIndex);
var iDelimiterPos;
var rValidDelimiters = /[\-\s]+/;
// Check whether last character of matched code is a number
if (/\d$/.test(sLastCodeChar)) {
// Check whether parse string starts with the matched code
if (sValue.startsWith(oMatch.code)) {
iDelimiterPos = iLastCodeIndex + 1;
// \s matching any whitespace character including
// non-breaking ws and invisible non-breaking ws
if (!rValidDelimiters.test(sValue.charAt(iDelimiterPos))) {
return undefined;
}
}
// Check whether first character of matched code is a number
} else if (/^\d/.test(oMatch.code)) {
// Check whether parse string ends with the matched code
if (sValue.endsWith(oMatch.code)) {
iDelimiterPos = sValue.indexOf(oMatch.code) - 1;
if (!rValidDelimiters.test(sValue.charAt(iDelimiterPos))) {
return undefined;
}
}
}
sValue = sValue.replace(oMatch.symbol || oMatch.code, "");
}
// Set currency code to undefined, as the defined custom currencies
// contain multiple currencies having the same symbol.
if (oConfig.duplicatedSymbols && oConfig.duplicatedSymbols[oMatch.symbol]) {
oMatch.code = undefined;
Log.error("The parsed currency symbol '" + oMatch.symbol + "' is defined multiple " +
"times in custom currencies.Therefore the result is not distinct.");
}
return {
numberValue: sValue,
currencyCode: oMatch.code || undefined
};
}
|
javascript
|
{
"resource": ""
}
|
q19192
|
_getLibraries
|
train
|
function _getLibraries() {
var libraries = Global.versioninfo ? Global.versioninfo.libraries : undefined;
var formattedLibraries = Object.create(null);
if (libraries !== undefined) {
libraries.forEach(function (element, index, array) {
formattedLibraries[element.name] = element.version;
});
}
return formattedLibraries;
}
|
javascript
|
{
"resource": ""
}
|
q19193
|
_getLoadedLibraries
|
train
|
function _getLoadedLibraries() {
var libraries = sap.ui.getCore().getLoadedLibraries();
var formattedLibraries = Object.create(null);
Object.keys(sap.ui.getCore().getLoadedLibraries()).forEach(function (element, index, array) {
formattedLibraries[element] = libraries[element].version;
});
return formattedLibraries;
}
|
javascript
|
{
"resource": ""
}
|
q19194
|
_getFrameworkInformation
|
train
|
function _getFrameworkInformation() {
return {
commonInformation: {
frameworkName: _getFrameworkName(),
version: Global.version,
buildTime: Global.buildinfo.buildtime,
lastChange: Global.buildinfo.lastchange,
jquery: jQuery.fn.jquery,
userAgent: navigator.userAgent,
applicationHREF: window.location.href,
documentTitle: document.title,
documentMode: document.documentMode || '',
debugMode: jQuery.sap.debug(),
statistics: jQuery.sap.statistics()
},
configurationBootstrap: window['sap-ui-config'] || Object.create(null),
configurationComputed: {
theme: configurationInfo.getTheme(),
language: configurationInfo.getLanguage(),
formatLocale: configurationInfo.getFormatLocale(),
accessibility: configurationInfo.getAccessibility(),
animation: configurationInfo.getAnimation(),
rtl: configurationInfo.getRTL(),
debug: configurationInfo.getDebug(),
inspect: configurationInfo.getInspect(),
originInfo: configurationInfo.getOriginInfo(),
noDuplicateIds: configurationInfo.getNoDuplicateIds()
},
libraries: _getLibraries(),
loadedLibraries: _getLoadedLibraries(),
loadedModules: LoaderExtensions.getAllRequiredModules().sort(),
URLParameters: new UriParameters(window.location.href).mParams
};
}
|
javascript
|
{
"resource": ""
}
|
q19195
|
train
|
function (nodeElement, resultArray) {
var node = nodeElement;
var childNode = node.firstElementChild;
var results = resultArray;
var subResult = results;
var control = sap.ui.getCore().byId(node.id);
if (node.getAttribute('data-sap-ui') && control) {
results.push({
id: control.getId(),
name: control.getMetadata().getName(),
type: 'sap-ui-control',
content: []
});
subResult = results[results.length - 1].content;
} else if (node.getAttribute('data-sap-ui-area')) {
results.push({
id: node.id,
name: 'sap-ui-area',
type: 'data-sap-ui',
content: []
});
subResult = results[results.length - 1].content;
}
while (childNode) {
this._createRenderedTreeModel(childNode, subResult);
childNode = childNode.nextElementSibling;
}
}
|
javascript
|
{
"resource": ""
}
|
|
q19196
|
train
|
function (control, inheritedMetadata) {
var inheritedMetadataProperties = inheritedMetadata.getProperties();
var result = Object.create(null);
result.meta = Object.create(null);
result.meta.controlName = inheritedMetadata.getName();
result.properties = Object.create(null);
Object.keys(inheritedMetadataProperties).forEach(function (key) {
result.properties[key] = Object.create(null);
result.properties[key].value = inheritedMetadataProperties[key].get(control);
result.properties[key].type = inheritedMetadataProperties[key].getType().getName ? inheritedMetadataProperties[key].getType().getName() : '';
});
return result;
}
|
javascript
|
{
"resource": ""
}
|
|
q19197
|
train
|
function (control) {
var result = [];
var inheritedMetadata = control.getMetadata().getParent();
while (inheritedMetadata instanceof ElementMetadata) {
result.push(this._copyInheritedProperties(control, inheritedMetadata));
inheritedMetadata = inheritedMetadata.getParent();
}
return result;
}
|
javascript
|
{
"resource": ""
}
|
|
q19198
|
train
|
function (controlId) {
var control = sap.ui.getCore().byId(controlId);
var properties = Object.create(null);
if (control) {
properties.own = this._getOwnProperties(control);
properties.inherited = this._getInheritedProperties(control);
}
return properties;
}
|
javascript
|
{
"resource": ""
}
|
|
q19199
|
train
|
function (control) {
var properties = control.getMetadata().getAllProperties();
var propertiesBindingData = Object.create(null);
for (var key in properties) {
if (properties.hasOwnProperty(key) && control.getBinding(key)) {
propertiesBindingData[key] = Object.create(null);
propertiesBindingData[key].path = control.getBinding(key).getPath();
propertiesBindingData[key].value = control.getBinding(key).getValue();
propertiesBindingData[key].type = control.getMetadata().getProperty(key).getType().getName ? control.getMetadata().getProperty(key).getType().getName() : '';
propertiesBindingData[key].mode = control.getBinding(key).getBindingMode();
propertiesBindingData[key].model = this._getModelFromContext(control, key);
}
}
return propertiesBindingData;
}
|
javascript
|
{
"resource": ""
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.