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 |
---|---|---|---|---|---|---|---|---|---|---|---|
ariatemplates/ariatemplates | src/aria/html/Select.js | function (value) {
if (this.options) {
for (var i = 0, l = this.options.length; i < l; i++) {
if (this.options[i].value === value) {
return i;
}
}
}
return -1;
} | javascript | function (value) {
if (this.options) {
for (var i = 0, l = this.options.length; i < l; i++) {
if (this.options[i].value === value) {
return i;
}
}
}
return -1;
} | [
"function",
"(",
"value",
")",
"{",
"if",
"(",
"this",
".",
"options",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"l",
"=",
"this",
".",
"options",
".",
"length",
";",
"i",
"<",
"l",
";",
"i",
"++",
")",
"{",
"if",
"(",
"this",
".",
"options",
"[",
"i",
"]",
".",
"value",
"===",
"value",
")",
"{",
"return",
"i",
";",
"}",
"}",
"}",
"return",
"-",
"1",
";",
"}"
]
| Function called to retrieve the selected index from a selected value
@param {Object} value Value to retrieve from the options | [
"Function",
"called",
"to",
"retrieve",
"the",
"selected",
"index",
"from",
"a",
"selected",
"value"
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/html/Select.js#L260-L269 | train |
|
ariatemplates/ariatemplates | src/aria/html/Select.js | function () {
var bind = this._bindingListeners.value;
if (bind) {
var selectedIndex = this._domElt.selectedIndex;
var value = "";
if (selectedIndex != -1) {
value = this.options[this._domElt.selectedIndex].value;
}
var newValue = this._transform(bind.transform, value, "fromWidget");
ariaUtilsJson.setValue(bind.inside, bind.to, newValue, bind.cb);
}
} | javascript | function () {
var bind = this._bindingListeners.value;
if (bind) {
var selectedIndex = this._domElt.selectedIndex;
var value = "";
if (selectedIndex != -1) {
value = this.options[this._domElt.selectedIndex].value;
}
var newValue = this._transform(bind.transform, value, "fromWidget");
ariaUtilsJson.setValue(bind.inside, bind.to, newValue, bind.cb);
}
} | [
"function",
"(",
")",
"{",
"var",
"bind",
"=",
"this",
".",
"_bindingListeners",
".",
"value",
";",
"if",
"(",
"bind",
")",
"{",
"var",
"selectedIndex",
"=",
"this",
".",
"_domElt",
".",
"selectedIndex",
";",
"var",
"value",
"=",
"\"\"",
";",
"if",
"(",
"selectedIndex",
"!=",
"-",
"1",
")",
"{",
"value",
"=",
"this",
".",
"options",
"[",
"this",
".",
"_domElt",
".",
"selectedIndex",
"]",
".",
"value",
";",
"}",
"var",
"newValue",
"=",
"this",
".",
"_transform",
"(",
"bind",
".",
"transform",
",",
"value",
",",
"\"fromWidget\"",
")",
";",
"ariaUtilsJson",
".",
"setValue",
"(",
"bind",
".",
"inside",
",",
"bind",
".",
"to",
",",
"newValue",
",",
"bind",
".",
"cb",
")",
";",
"}",
"}"
]
| set the value in the data model from the binding | [
"set",
"the",
"value",
"in",
"the",
"data",
"model",
"from",
"the",
"binding"
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/html/Select.js#L287-L301 | train |
|
ariatemplates/ariatemplates | src/aria/html/Select.js | function () {
var bind = this._bindingListeners.selectedIndex;
if (bind) {
var newIndex = this._transform(bind.transform, this._domElt.selectedIndex, "fromWidget");
ariaUtilsJson.setValue(bind.inside, bind.to, newIndex, bind.cb);
}
} | javascript | function () {
var bind = this._bindingListeners.selectedIndex;
if (bind) {
var newIndex = this._transform(bind.transform, this._domElt.selectedIndex, "fromWidget");
ariaUtilsJson.setValue(bind.inside, bind.to, newIndex, bind.cb);
}
} | [
"function",
"(",
")",
"{",
"var",
"bind",
"=",
"this",
".",
"_bindingListeners",
".",
"selectedIndex",
";",
"if",
"(",
"bind",
")",
"{",
"var",
"newIndex",
"=",
"this",
".",
"_transform",
"(",
"bind",
".",
"transform",
",",
"this",
".",
"_domElt",
".",
"selectedIndex",
",",
"\"fromWidget\"",
")",
";",
"ariaUtilsJson",
".",
"setValue",
"(",
"bind",
".",
"inside",
",",
"bind",
".",
"to",
",",
"newIndex",
",",
"bind",
".",
"cb",
")",
";",
"}",
"}"
]
| set the selectedIndex in the data model from the binding | [
"set",
"the",
"selectedIndex",
"in",
"the",
"data",
"model",
"from",
"the",
"binding"
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/html/Select.js#L306-L312 | train |
|
ariatemplates/ariatemplates | src/aria/modules/requestHandler/RequestHandler.js | function (jsonData, requestObject) {
var reqSerializer = requestObject ? requestObject.requestJsonSerializer : null;
var options = reqSerializer ? reqSerializer.options : null;
var instance = reqSerializer ? reqSerializer.instance : null;
if (instance) {
return ariaUtilsJson.convertToJsonString(jsonData, ariaUtilsJson.copy(options, true), instance);
} else {
options = options || this._requestJsonSerializer.options;
instance = this._requestJsonSerializer.instance;
return ariaUtilsJson.convertToJsonString(jsonData, ariaUtilsJson.copy(options, true), instance);
}
} | javascript | function (jsonData, requestObject) {
var reqSerializer = requestObject ? requestObject.requestJsonSerializer : null;
var options = reqSerializer ? reqSerializer.options : null;
var instance = reqSerializer ? reqSerializer.instance : null;
if (instance) {
return ariaUtilsJson.convertToJsonString(jsonData, ariaUtilsJson.copy(options, true), instance);
} else {
options = options || this._requestJsonSerializer.options;
instance = this._requestJsonSerializer.instance;
return ariaUtilsJson.convertToJsonString(jsonData, ariaUtilsJson.copy(options, true), instance);
}
} | [
"function",
"(",
"jsonData",
",",
"requestObject",
")",
"{",
"var",
"reqSerializer",
"=",
"requestObject",
"?",
"requestObject",
".",
"requestJsonSerializer",
":",
"null",
";",
"var",
"options",
"=",
"reqSerializer",
"?",
"reqSerializer",
".",
"options",
":",
"null",
";",
"var",
"instance",
"=",
"reqSerializer",
"?",
"reqSerializer",
".",
"instance",
":",
"null",
";",
"if",
"(",
"instance",
")",
"{",
"return",
"ariaUtilsJson",
".",
"convertToJsonString",
"(",
"jsonData",
",",
"ariaUtilsJson",
".",
"copy",
"(",
"options",
",",
"true",
")",
",",
"instance",
")",
";",
"}",
"else",
"{",
"options",
"=",
"options",
"||",
"this",
".",
"_requestJsonSerializer",
".",
"options",
";",
"instance",
"=",
"this",
".",
"_requestJsonSerializer",
".",
"instance",
";",
"return",
"ariaUtilsJson",
".",
"convertToJsonString",
"(",
"jsonData",
",",
"ariaUtilsJson",
".",
"copy",
"(",
"options",
",",
"true",
")",
",",
"instance",
")",
";",
"}",
"}"
]
| Serializes the data by using the serializer specified in the request or the one specified in the application
environment
@param {Object} jsonData
@param {aria.modules.RequestBeans:RequestObject} requestObject
@return {String} Stringified representation of the input data | [
"Serializes",
"the",
"data",
"by",
"using",
"the",
"serializer",
"specified",
"in",
"the",
"request",
"or",
"the",
"one",
"specified",
"in",
"the",
"application",
"environment"
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/modules/requestHandler/RequestHandler.js#L135-L148 | train |
|
ariatemplates/ariatemplates | src/aria/widgets/form/MultiAutoComplete.js | function (event) {
this.$AutoComplete._dom_onclick.call(this, event);
var element = event.target;
if (element.className === "closeBtn") {
this._removeMultiselectValue(element, event);
this._textInputField.focus();
}
if (element.className.indexOf("xMultiAutoComplete_Option_Text") != -1) {
var highlightedSuggestions = this.getHighlight();
var index = this._getIndexFromNode(element.parentNode);
if (this.controller.freeText && ariaUtilsJson.equals(highlightedSuggestions, [index])) {
this._editMultiselectValue(element);
} else {
this.highlightOption(index);
}
}
this.__resizeInput();
} | javascript | function (event) {
this.$AutoComplete._dom_onclick.call(this, event);
var element = event.target;
if (element.className === "closeBtn") {
this._removeMultiselectValue(element, event);
this._textInputField.focus();
}
if (element.className.indexOf("xMultiAutoComplete_Option_Text") != -1) {
var highlightedSuggestions = this.getHighlight();
var index = this._getIndexFromNode(element.parentNode);
if (this.controller.freeText && ariaUtilsJson.equals(highlightedSuggestions, [index])) {
this._editMultiselectValue(element);
} else {
this.highlightOption(index);
}
}
this.__resizeInput();
} | [
"function",
"(",
"event",
")",
"{",
"this",
".",
"$AutoComplete",
".",
"_dom_onclick",
".",
"call",
"(",
"this",
",",
"event",
")",
";",
"var",
"element",
"=",
"event",
".",
"target",
";",
"if",
"(",
"element",
".",
"className",
"===",
"\"closeBtn\"",
")",
"{",
"this",
".",
"_removeMultiselectValue",
"(",
"element",
",",
"event",
")",
";",
"this",
".",
"_textInputField",
".",
"focus",
"(",
")",
";",
"}",
"if",
"(",
"element",
".",
"className",
".",
"indexOf",
"(",
"\"xMultiAutoComplete_Option_Text\"",
")",
"!=",
"-",
"1",
")",
"{",
"var",
"highlightedSuggestions",
"=",
"this",
".",
"getHighlight",
"(",
")",
";",
"var",
"index",
"=",
"this",
".",
"_getIndexFromNode",
"(",
"element",
".",
"parentNode",
")",
";",
"if",
"(",
"this",
".",
"controller",
".",
"freeText",
"&&",
"ariaUtilsJson",
".",
"equals",
"(",
"highlightedSuggestions",
",",
"[",
"index",
"]",
")",
")",
"{",
"this",
".",
"_editMultiselectValue",
"(",
"element",
")",
";",
"}",
"else",
"{",
"this",
".",
"highlightOption",
"(",
"index",
")",
";",
"}",
"}",
"this",
".",
"__resizeInput",
"(",
")",
";",
"}"
]
| Internal method to handle the click event to remove suggestion. This event is used to set focus on input
field
@param {aria.DomEvent} event Event object
@protected | [
"Internal",
"method",
"to",
"handle",
"the",
"click",
"event",
"to",
"remove",
"suggestion",
".",
"This",
"event",
"is",
"used",
"to",
"set",
"focus",
"on",
"input",
"field"
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/widgets/form/MultiAutoComplete.js#L181-L198 | train |
|
ariatemplates/ariatemplates | src/aria/widgets/form/MultiAutoComplete.js | function () {
var skinObj = this._skinObj, frame = this._frame, obj = this._textInputField;
if (obj) {
var frameWidth = frame.innerWidth - skinObj.innerPaddingLeft - skinObj.innerPaddingRight, inputWidth = obj.offsetLeft;
obj.style.width = (frameWidth - inputWidth - 4) + "px";// tolerance of 1 character
}
} | javascript | function () {
var skinObj = this._skinObj, frame = this._frame, obj = this._textInputField;
if (obj) {
var frameWidth = frame.innerWidth - skinObj.innerPaddingLeft - skinObj.innerPaddingRight, inputWidth = obj.offsetLeft;
obj.style.width = (frameWidth - inputWidth - 4) + "px";// tolerance of 1 character
}
} | [
"function",
"(",
")",
"{",
"var",
"skinObj",
"=",
"this",
".",
"_skinObj",
",",
"frame",
"=",
"this",
".",
"_frame",
",",
"obj",
"=",
"this",
".",
"_textInputField",
";",
"if",
"(",
"obj",
")",
"{",
"var",
"frameWidth",
"=",
"frame",
".",
"innerWidth",
"-",
"skinObj",
".",
"innerPaddingLeft",
"-",
"skinObj",
".",
"innerPaddingRight",
",",
"inputWidth",
"=",
"obj",
".",
"offsetLeft",
";",
"obj",
".",
"style",
".",
"width",
"=",
"(",
"frameWidth",
"-",
"inputWidth",
"-",
"4",
")",
"+",
"\"px\"",
";",
"}",
"}"
]
| Private method to increase the textInput width on focus
@private | [
"Private",
"method",
"to",
"increase",
"the",
"textInput",
"width",
"on",
"focus"
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/widgets/form/MultiAutoComplete.js#L215-L222 | train |
|
ariatemplates/ariatemplates | src/aria/widgets/form/MultiAutoComplete.js | function () {
this.$AutoComplete.initWidget.call(this);
var cfg = this._cfg;
if (cfg.value) {
var report = this.controller.checkValue(cfg.value);
this._reactToControllerReport(report);
}
} | javascript | function () {
this.$AutoComplete.initWidget.call(this);
var cfg = this._cfg;
if (cfg.value) {
var report = this.controller.checkValue(cfg.value);
this._reactToControllerReport(report);
}
} | [
"function",
"(",
")",
"{",
"this",
".",
"$AutoComplete",
".",
"initWidget",
".",
"call",
"(",
"this",
")",
";",
"var",
"cfg",
"=",
"this",
".",
"_cfg",
";",
"if",
"(",
"cfg",
".",
"value",
")",
"{",
"var",
"report",
"=",
"this",
".",
"controller",
".",
"checkValue",
"(",
"cfg",
".",
"value",
")",
";",
"this",
".",
"_reactToControllerReport",
"(",
"report",
")",
";",
"}",
"}"
]
| Initialization method called by the delegate engine when the DOM is loaded | [
"Initialization",
"method",
"called",
"by",
"the",
"delegate",
"engine",
"when",
"the",
"DOM",
"is",
"loaded"
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/widgets/form/MultiAutoComplete.js#L226-L233 | train |
|
ariatemplates/ariatemplates | src/aria/widgets/form/MultiAutoComplete.js | function (value) {
var cfg = this._cfg;
var label = ariaUtilsString.escapeHTML(value.label || value);
return '<div class="xMultiAutoComplete_' + cfg.sclass
+ '_options"><span class="xMultiAutoComplete_Option_Text">' + label
+ '</span><span class="closeBtn"></span></div>';
} | javascript | function (value) {
var cfg = this._cfg;
var label = ariaUtilsString.escapeHTML(value.label || value);
return '<div class="xMultiAutoComplete_' + cfg.sclass
+ '_options"><span class="xMultiAutoComplete_Option_Text">' + label
+ '</span><span class="closeBtn"></span></div>';
} | [
"function",
"(",
"value",
")",
"{",
"var",
"cfg",
"=",
"this",
".",
"_cfg",
";",
"var",
"label",
"=",
"ariaUtilsString",
".",
"escapeHTML",
"(",
"value",
".",
"label",
"||",
"value",
")",
";",
"return",
"'<div class=\"xMultiAutoComplete_'",
"+",
"cfg",
".",
"sclass",
"+",
"'_options\"><span class=\"xMultiAutoComplete_Option_Text\">'",
"+",
"label",
"+",
"'</span><span class=\"closeBtn\"></span></div>'",
";",
"}"
]
| Generate markup for selected suggestion
@param {String} report
@param {aria.widgets.form.MultiAutoComplete} ref
@return {String} | [
"Generate",
"markup",
"for",
"selected",
"suggestion"
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/widgets/form/MultiAutoComplete.js#L269-L275 | train |
|
ariatemplates/ariatemplates | src/aria/widgets/form/MultiAutoComplete.js | function (input) {
var ellipsisContainer = input.previousSibling, elementoffsetWidth = ellipsisContainer.offsetWidth, frameWidth = this._frame.innerWidth;
// 10 is to consider margin and padding
if (elementoffsetWidth >= (frameWidth - 10)) {
ellipsisContainer.firstChild.className += " ellipsisClass";
var elementWidth = frameWidth - ellipsisContainer.offsetLeft
- (ellipsisContainer.firstChild.offsetLeft + ellipsisContainer.lastChild.offsetWidth) * 2;
ellipsisContainer.firstChild.style.maxWidth = elementWidth + "px";
}
} | javascript | function (input) {
var ellipsisContainer = input.previousSibling, elementoffsetWidth = ellipsisContainer.offsetWidth, frameWidth = this._frame.innerWidth;
// 10 is to consider margin and padding
if (elementoffsetWidth >= (frameWidth - 10)) {
ellipsisContainer.firstChild.className += " ellipsisClass";
var elementWidth = frameWidth - ellipsisContainer.offsetLeft
- (ellipsisContainer.firstChild.offsetLeft + ellipsisContainer.lastChild.offsetWidth) * 2;
ellipsisContainer.firstChild.style.maxWidth = elementWidth + "px";
}
} | [
"function",
"(",
"input",
")",
"{",
"var",
"ellipsisContainer",
"=",
"input",
".",
"previousSibling",
",",
"elementoffsetWidth",
"=",
"ellipsisContainer",
".",
"offsetWidth",
",",
"frameWidth",
"=",
"this",
".",
"_frame",
".",
"innerWidth",
";",
"if",
"(",
"elementoffsetWidth",
">=",
"(",
"frameWidth",
"-",
"10",
")",
")",
"{",
"ellipsisContainer",
".",
"firstChild",
".",
"className",
"+=",
"\" ellipsisClass\"",
";",
"var",
"elementWidth",
"=",
"frameWidth",
"-",
"ellipsisContainer",
".",
"offsetLeft",
"-",
"(",
"ellipsisContainer",
".",
"firstChild",
".",
"offsetLeft",
"+",
"ellipsisContainer",
".",
"lastChild",
".",
"offsetWidth",
")",
"*",
"2",
";",
"ellipsisContainer",
".",
"firstChild",
".",
"style",
".",
"maxWidth",
"=",
"elementWidth",
"+",
"\"px\"",
";",
"}",
"}"
]
| Method to create ellipsis for an added Suggestion
@param {HTMLElement} input textInputField
@private | [
"Method",
"to",
"create",
"ellipsis",
"for",
"an",
"added",
"Suggestion"
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/widgets/form/MultiAutoComplete.js#L281-L291 | train |
|
ariatemplates/ariatemplates | src/aria/widgets/form/MultiAutoComplete.js | function (event) {
if (event.type == "dblclick" && this.controller.freeText) {
var element = event.target;
if (element.className.indexOf("xMultiAutoComplete_Option_Text") != -1) {
this._editMultiselectValue(element, event);
}
}
} | javascript | function (event) {
if (event.type == "dblclick" && this.controller.freeText) {
var element = event.target;
if (element.className.indexOf("xMultiAutoComplete_Option_Text") != -1) {
this._editMultiselectValue(element, event);
}
}
} | [
"function",
"(",
"event",
")",
"{",
"if",
"(",
"event",
".",
"type",
"==",
"\"dblclick\"",
"&&",
"this",
".",
"controller",
".",
"freeText",
")",
"{",
"var",
"element",
"=",
"event",
".",
"target",
";",
"if",
"(",
"element",
".",
"className",
".",
"indexOf",
"(",
"\"xMultiAutoComplete_Option_Text\"",
")",
"!=",
"-",
"1",
")",
"{",
"this",
".",
"_editMultiselectValue",
"(",
"element",
",",
"event",
")",
";",
"}",
"}",
"}"
]
| Handling double click event for editing suggestion
@param {aria.utils.Event} event
@protected | [
"Handling",
"double",
"click",
"event",
"for",
"editing",
"suggestion"
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/widgets/form/MultiAutoComplete.js#L297-L304 | train |
|
ariatemplates/ariatemplates | src/aria/widgets/form/MultiAutoComplete.js | function (event) {
var inputField = this.getTextInputField();
var blurredElement = event.target;
if (blurredElement === inputField) {
if (inputField.nextSibling != null && inputField.value === "") {
this._makeInputFieldLastChild();
}
} else if (blurredElement.parentNode.className.indexOf("highlight") != -1) {
this.unhighlightOption(blurredElement.parentNode);
}
// call TextInput onblur handler with avoidCallback set to true
this.$TextInput._dom_onblur.call(this, event, true);
if (this._cfg.onblur) {
// timeout is needed to retrieve (on every browser) the activeElement
ariaCoreTimer.addCallback({
fn : function () {
var isAncestor = ariaUtilsDom.isAncestor;
var focusedEl = Aria.$window.document.activeElement;
// if onblur is defined and window lost focus ( ==null ) or if focus is not in the widget or
// dropdown element
if (this._cfg
&& (focusedEl == null || ((this._dropdownPopup == null || !isAncestor(focusedEl, this._dropdownPopup.domElement)) && !isAncestor(focusedEl, this._domElt)))) {
this.evalCallback(this._cfg.onblur);
}
},
scope : this,
delay : 100
});
}
} | javascript | function (event) {
var inputField = this.getTextInputField();
var blurredElement = event.target;
if (blurredElement === inputField) {
if (inputField.nextSibling != null && inputField.value === "") {
this._makeInputFieldLastChild();
}
} else if (blurredElement.parentNode.className.indexOf("highlight") != -1) {
this.unhighlightOption(blurredElement.parentNode);
}
// call TextInput onblur handler with avoidCallback set to true
this.$TextInput._dom_onblur.call(this, event, true);
if (this._cfg.onblur) {
// timeout is needed to retrieve (on every browser) the activeElement
ariaCoreTimer.addCallback({
fn : function () {
var isAncestor = ariaUtilsDom.isAncestor;
var focusedEl = Aria.$window.document.activeElement;
// if onblur is defined and window lost focus ( ==null ) or if focus is not in the widget or
// dropdown element
if (this._cfg
&& (focusedEl == null || ((this._dropdownPopup == null || !isAncestor(focusedEl, this._dropdownPopup.domElement)) && !isAncestor(focusedEl, this._domElt)))) {
this.evalCallback(this._cfg.onblur);
}
},
scope : this,
delay : 100
});
}
} | [
"function",
"(",
"event",
")",
"{",
"var",
"inputField",
"=",
"this",
".",
"getTextInputField",
"(",
")",
";",
"var",
"blurredElement",
"=",
"event",
".",
"target",
";",
"if",
"(",
"blurredElement",
"===",
"inputField",
")",
"{",
"if",
"(",
"inputField",
".",
"nextSibling",
"!=",
"null",
"&&",
"inputField",
".",
"value",
"===",
"\"\"",
")",
"{",
"this",
".",
"_makeInputFieldLastChild",
"(",
")",
";",
"}",
"}",
"else",
"if",
"(",
"blurredElement",
".",
"parentNode",
".",
"className",
".",
"indexOf",
"(",
"\"highlight\"",
")",
"!=",
"-",
"1",
")",
"{",
"this",
".",
"unhighlightOption",
"(",
"blurredElement",
".",
"parentNode",
")",
";",
"}",
"this",
".",
"$TextInput",
".",
"_dom_onblur",
".",
"call",
"(",
"this",
",",
"event",
",",
"true",
")",
";",
"if",
"(",
"this",
".",
"_cfg",
".",
"onblur",
")",
"{",
"ariaCoreTimer",
".",
"addCallback",
"(",
"{",
"fn",
":",
"function",
"(",
")",
"{",
"var",
"isAncestor",
"=",
"ariaUtilsDom",
".",
"isAncestor",
";",
"var",
"focusedEl",
"=",
"Aria",
".",
"$window",
".",
"document",
".",
"activeElement",
";",
"if",
"(",
"this",
".",
"_cfg",
"&&",
"(",
"focusedEl",
"==",
"null",
"||",
"(",
"(",
"this",
".",
"_dropdownPopup",
"==",
"null",
"||",
"!",
"isAncestor",
"(",
"focusedEl",
",",
"this",
".",
"_dropdownPopup",
".",
"domElement",
")",
")",
"&&",
"!",
"isAncestor",
"(",
"focusedEl",
",",
"this",
".",
"_domElt",
")",
")",
")",
")",
"{",
"this",
".",
"evalCallback",
"(",
"this",
".",
"_cfg",
".",
"onblur",
")",
";",
"}",
"}",
",",
"scope",
":",
"this",
",",
"delay",
":",
"100",
"}",
")",
";",
"}",
"}"
]
| Handling blur event
@param {aria.utils.Event} event
@protected | [
"Handling",
"blur",
"event"
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/widgets/form/MultiAutoComplete.js#L311-L343 | train |
|
ariatemplates/ariatemplates | src/aria/widgets/form/MultiAutoComplete.js | function (event) {
// flag that avoids to trigger the user callback when browsing the checkbox list
var avoidCallback = (this._hasFocus || this._keepFocus);
this.$TextInput._dom_onfocus.call(this, event, true);
if (this._cfg.onfocus && !avoidCallback) {
this.evalCallback(this._cfg.onfocus);
}
} | javascript | function (event) {
// flag that avoids to trigger the user callback when browsing the checkbox list
var avoidCallback = (this._hasFocus || this._keepFocus);
this.$TextInput._dom_onfocus.call(this, event, true);
if (this._cfg.onfocus && !avoidCallback) {
this.evalCallback(this._cfg.onfocus);
}
} | [
"function",
"(",
"event",
")",
"{",
"var",
"avoidCallback",
"=",
"(",
"this",
".",
"_hasFocus",
"||",
"this",
".",
"_keepFocus",
")",
";",
"this",
".",
"$TextInput",
".",
"_dom_onfocus",
".",
"call",
"(",
"this",
",",
"event",
",",
"true",
")",
";",
"if",
"(",
"this",
".",
"_cfg",
".",
"onfocus",
"&&",
"!",
"avoidCallback",
")",
"{",
"this",
".",
"evalCallback",
"(",
"this",
".",
"_cfg",
".",
"onfocus",
")",
";",
"}",
"}"
]
| Handling focus event
@param {aria.utils.Event} event
@protected | [
"Handling",
"focus",
"event"
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/widgets/form/MultiAutoComplete.js#L350-L357 | train |
|
ariatemplates/ariatemplates | src/aria/widgets/form/MultiAutoComplete.js | function () {
var inputField = this._textInputField;
var inputFieldParent = inputField.parentNode;
if (inputFieldParent.lastChild !== inputField) {
inputFieldParent.removeChild(inputField);
inputFieldParent.appendChild(inputField);
inputField.style.width = "0px";
this.__resizeInput();
}
} | javascript | function () {
var inputField = this._textInputField;
var inputFieldParent = inputField.parentNode;
if (inputFieldParent.lastChild !== inputField) {
inputFieldParent.removeChild(inputField);
inputFieldParent.appendChild(inputField);
inputField.style.width = "0px";
this.__resizeInput();
}
} | [
"function",
"(",
")",
"{",
"var",
"inputField",
"=",
"this",
".",
"_textInputField",
";",
"var",
"inputFieldParent",
"=",
"inputField",
".",
"parentNode",
";",
"if",
"(",
"inputFieldParent",
".",
"lastChild",
"!==",
"inputField",
")",
"{",
"inputFieldParent",
".",
"removeChild",
"(",
"inputField",
")",
";",
"inputFieldParent",
".",
"appendChild",
"(",
"inputField",
")",
";",
"inputField",
".",
"style",
".",
"width",
"=",
"\"0px\"",
";",
"this",
".",
"__resizeInput",
"(",
")",
";",
"}",
"}"
]
| Make the inputfield as last child of widget
@protected | [
"Make",
"the",
"inputfield",
"as",
"last",
"child",
"of",
"widget"
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/widgets/form/MultiAutoComplete.js#L362-L371 | train |
|
ariatemplates/ariatemplates | src/aria/widgets/form/MultiAutoComplete.js | function (domElement, event, isParent) {
var parent = (!isParent) ? domElement.parentNode : domElement;
var domUtil = ariaUtilsDom;
var label = parent.firstChild.textContent || parent.firstChild.innerText;
domUtil.removeElement(parent);
this._removeValue(label);
if (event && event.type == "click") {
this.getTextInputField().focus();
}
} | javascript | function (domElement, event, isParent) {
var parent = (!isParent) ? domElement.parentNode : domElement;
var domUtil = ariaUtilsDom;
var label = parent.firstChild.textContent || parent.firstChild.innerText;
domUtil.removeElement(parent);
this._removeValue(label);
if (event && event.type == "click") {
this.getTextInputField().focus();
}
} | [
"function",
"(",
"domElement",
",",
"event",
",",
"isParent",
")",
"{",
"var",
"parent",
"=",
"(",
"!",
"isParent",
")",
"?",
"domElement",
".",
"parentNode",
":",
"domElement",
";",
"var",
"domUtil",
"=",
"ariaUtilsDom",
";",
"var",
"label",
"=",
"parent",
".",
"firstChild",
".",
"textContent",
"||",
"parent",
".",
"firstChild",
".",
"innerText",
";",
"domUtil",
".",
"removeElement",
"(",
"parent",
")",
";",
"this",
".",
"_removeValue",
"(",
"label",
")",
";",
"if",
"(",
"event",
"&&",
"event",
".",
"type",
"==",
"\"click\"",
")",
"{",
"this",
".",
"getTextInputField",
"(",
")",
".",
"focus",
"(",
")",
";",
"}",
"}"
]
| To remove suggestion on click of close
@protected
@param {aria.utils.HTML} domElement
@param {aria.widgets.form.MultiAutoComplete} ref
@param {aria.utils.Event} event
@param {Boolean} if current element is a parent element itself | [
"To",
"remove",
"suggestion",
"on",
"click",
"of",
"close"
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/widgets/form/MultiAutoComplete.js#L513-L524 | train |
|
ariatemplates/ariatemplates | src/aria/widgets/form/MultiAutoComplete.js | function (domElement, event) {
var label;
var domUtil = ariaUtilsDom;
label = domElement.textContent || domElement.innerText;
domUtil.replaceDomElement(domElement.parentNode, this._textInputField);
var removedSuggestionInfo = this._removeValue(label);
var removedSuggestion = removedSuggestionInfo.removedSuggestion;
var removedSuggestionIndex = removedSuggestionInfo.removedSuggestionIndex;
this._keepFocus = true;
this._textInputField.focus();
if (removedSuggestion) {
var report = this.controller.editValue(removedSuggestion, removedSuggestionIndex);
this._reactToControllerReport(report);
}
this._restoreKeepFocus();
} | javascript | function (domElement, event) {
var label;
var domUtil = ariaUtilsDom;
label = domElement.textContent || domElement.innerText;
domUtil.replaceDomElement(domElement.parentNode, this._textInputField);
var removedSuggestionInfo = this._removeValue(label);
var removedSuggestion = removedSuggestionInfo.removedSuggestion;
var removedSuggestionIndex = removedSuggestionInfo.removedSuggestionIndex;
this._keepFocus = true;
this._textInputField.focus();
if (removedSuggestion) {
var report = this.controller.editValue(removedSuggestion, removedSuggestionIndex);
this._reactToControllerReport(report);
}
this._restoreKeepFocus();
} | [
"function",
"(",
"domElement",
",",
"event",
")",
"{",
"var",
"label",
";",
"var",
"domUtil",
"=",
"ariaUtilsDom",
";",
"label",
"=",
"domElement",
".",
"textContent",
"||",
"domElement",
".",
"innerText",
";",
"domUtil",
".",
"replaceDomElement",
"(",
"domElement",
".",
"parentNode",
",",
"this",
".",
"_textInputField",
")",
";",
"var",
"removedSuggestionInfo",
"=",
"this",
".",
"_removeValue",
"(",
"label",
")",
";",
"var",
"removedSuggestion",
"=",
"removedSuggestionInfo",
".",
"removedSuggestion",
";",
"var",
"removedSuggestionIndex",
"=",
"removedSuggestionInfo",
".",
"removedSuggestionIndex",
";",
"this",
".",
"_keepFocus",
"=",
"true",
";",
"this",
".",
"_textInputField",
".",
"focus",
"(",
")",
";",
"if",
"(",
"removedSuggestion",
")",
"{",
"var",
"report",
"=",
"this",
".",
"controller",
".",
"editValue",
"(",
"removedSuggestion",
",",
"removedSuggestionIndex",
")",
";",
"this",
".",
"_reactToControllerReport",
"(",
"report",
")",
";",
"}",
"this",
".",
"_restoreKeepFocus",
"(",
")",
";",
"}"
]
| To edit suggestion on doubleclick
@param {aria.utils.HTML} domElement
@param {aria.utils.Event} event
@protected | [
"To",
"edit",
"suggestion",
"on",
"doubleclick"
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/widgets/form/MultiAutoComplete.js#L531-L546 | train |
|
ariatemplates/ariatemplates | src/aria/widgets/form/MultiAutoComplete.js | function (label) {
var report = this.controller.removeValue(label);
var removedSuggestion = report.removedSuggestion;
var removedSuggestionIndex = report.removedSuggestionIndex;
this._reactToControllerReport(report);
this._textInputField.style.width = "0px";
this.__resizeInput();
return {
removedSuggestion : removedSuggestion,
removedSuggestionIndex : removedSuggestionIndex
};
} | javascript | function (label) {
var report = this.controller.removeValue(label);
var removedSuggestion = report.removedSuggestion;
var removedSuggestionIndex = report.removedSuggestionIndex;
this._reactToControllerReport(report);
this._textInputField.style.width = "0px";
this.__resizeInput();
return {
removedSuggestion : removedSuggestion,
removedSuggestionIndex : removedSuggestionIndex
};
} | [
"function",
"(",
"label",
")",
"{",
"var",
"report",
"=",
"this",
".",
"controller",
".",
"removeValue",
"(",
"label",
")",
";",
"var",
"removedSuggestion",
"=",
"report",
".",
"removedSuggestion",
";",
"var",
"removedSuggestionIndex",
"=",
"report",
".",
"removedSuggestionIndex",
";",
"this",
".",
"_reactToControllerReport",
"(",
"report",
")",
";",
"this",
".",
"_textInputField",
".",
"style",
".",
"width",
"=",
"\"0px\"",
";",
"this",
".",
"__resizeInput",
"(",
")",
";",
"return",
"{",
"removedSuggestion",
":",
"removedSuggestion",
",",
"removedSuggestionIndex",
":",
"removedSuggestionIndex",
"}",
";",
"}"
]
| To remove the label from widget
@param {String} label
@return {String|Object} the item removed from the controller.selectedValues array.
@protected | [
"To",
"remove",
"the",
"label",
"from",
"widget"
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/widgets/form/MultiAutoComplete.js#L570-L581 | train |
|
ariatemplates/ariatemplates | src/aria/widgets/form/MultiAutoComplete.js | function (suggestionNode, className) {
var suggestionNodeClassList = new aria.utils.ClassList(suggestionNode);
suggestionNodeClassList.remove(className);
suggestionNodeClassList.$dispose();
} | javascript | function (suggestionNode, className) {
var suggestionNodeClassList = new aria.utils.ClassList(suggestionNode);
suggestionNodeClassList.remove(className);
suggestionNodeClassList.$dispose();
} | [
"function",
"(",
"suggestionNode",
",",
"className",
")",
"{",
"var",
"suggestionNodeClassList",
"=",
"new",
"aria",
".",
"utils",
".",
"ClassList",
"(",
"suggestionNode",
")",
";",
"suggestionNodeClassList",
".",
"remove",
"(",
"className",
")",
";",
"suggestionNodeClassList",
".",
"$dispose",
"(",
")",
";",
"}"
]
| To remove class from DomElement
@param {HTMLElement} suggestionNode
@param {String} className
@protected | [
"To",
"remove",
"class",
"from",
"DomElement"
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/widgets/form/MultiAutoComplete.js#L613-L617 | train |
|
ariatemplates/ariatemplates | src/aria/widgets/form/MultiAutoComplete.js | function (suggestionNode) {
if (suggestionNode == null) {
suggestionNode = Aria.$window.document.activeElement;
if (suggestionNode.className.indexOf("highlight") === -1) {
suggestionNode = this._getSuggestionsContainer().children[this.getHighlightedOptionIndex() - 1];
}
// TODO Get currently focused element and check this is an highlighted option...
}
if (suggestionNode != null) {
this._removeClass(suggestionNode, 'highlight');
suggestionNode.firstChild.removeAttribute('tabindex');
}
} | javascript | function (suggestionNode) {
if (suggestionNode == null) {
suggestionNode = Aria.$window.document.activeElement;
if (suggestionNode.className.indexOf("highlight") === -1) {
suggestionNode = this._getSuggestionsContainer().children[this.getHighlightedOptionIndex() - 1];
}
// TODO Get currently focused element and check this is an highlighted option...
}
if (suggestionNode != null) {
this._removeClass(suggestionNode, 'highlight');
suggestionNode.firstChild.removeAttribute('tabindex');
}
} | [
"function",
"(",
"suggestionNode",
")",
"{",
"if",
"(",
"suggestionNode",
"==",
"null",
")",
"{",
"suggestionNode",
"=",
"Aria",
".",
"$window",
".",
"document",
".",
"activeElement",
";",
"if",
"(",
"suggestionNode",
".",
"className",
".",
"indexOf",
"(",
"\"highlight\"",
")",
"===",
"-",
"1",
")",
"{",
"suggestionNode",
"=",
"this",
".",
"_getSuggestionsContainer",
"(",
")",
".",
"children",
"[",
"this",
".",
"getHighlightedOptionIndex",
"(",
")",
"-",
"1",
"]",
";",
"}",
"}",
"if",
"(",
"suggestionNode",
"!=",
"null",
")",
"{",
"this",
".",
"_removeClass",
"(",
"suggestionNode",
",",
"'highlight'",
")",
";",
"suggestionNode",
".",
"firstChild",
".",
"removeAttribute",
"(",
"'tabindex'",
")",
";",
"}",
"}"
]
| Removes the highlighted state from the given option.
@param {HTMLElement} suggestionNode The HTML element corresponding to the highlighted option | [
"Removes",
"the",
"highlighted",
"state",
"from",
"the",
"given",
"option",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/widgets/form/MultiAutoComplete.js#L623-L636 | train |
|
ariatemplates/ariatemplates | src/aria/widgets/form/MultiAutoComplete.js | function (suggestionNode, className) {
var suggestionNodeClassList = new aria.utils.ClassList(suggestionNode);
suggestionNodeClassList.add(className);
suggestionNodeClassList.$dispose();
} | javascript | function (suggestionNode, className) {
var suggestionNodeClassList = new aria.utils.ClassList(suggestionNode);
suggestionNodeClassList.add(className);
suggestionNodeClassList.$dispose();
} | [
"function",
"(",
"suggestionNode",
",",
"className",
")",
"{",
"var",
"suggestionNodeClassList",
"=",
"new",
"aria",
".",
"utils",
".",
"ClassList",
"(",
"suggestionNode",
")",
";",
"suggestionNodeClassList",
".",
"add",
"(",
"className",
")",
";",
"suggestionNodeClassList",
".",
"$dispose",
"(",
")",
";",
"}"
]
| To add class for DomElement
@param {HTMLElement} suggestionNode
@param {String} className
@protected | [
"To",
"add",
"class",
"for",
"DomElement"
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/widgets/form/MultiAutoComplete.js#L679-L683 | train |
|
ariatemplates/ariatemplates | src/aria/widgets/form/MultiAutoComplete.js | function (index) {
var count = this.insertedOptionsCount();
if (index < 1 || index > count) {
this.$logError(this.INDEX_OUT_OF_BOUNDS, [count, index]);
return;
}
this.removeHighlight();
var suggestionNode = this._getSuggestionsContainer().children[index - 1];
this._addClass(suggestionNode, 'highlight');
suggestionNode.firstChild.setAttribute('tabindex', 0);
suggestionNode.firstChild.focus();
} | javascript | function (index) {
var count = this.insertedOptionsCount();
if (index < 1 || index > count) {
this.$logError(this.INDEX_OUT_OF_BOUNDS, [count, index]);
return;
}
this.removeHighlight();
var suggestionNode = this._getSuggestionsContainer().children[index - 1];
this._addClass(suggestionNode, 'highlight');
suggestionNode.firstChild.setAttribute('tabindex', 0);
suggestionNode.firstChild.focus();
} | [
"function",
"(",
"index",
")",
"{",
"var",
"count",
"=",
"this",
".",
"insertedOptionsCount",
"(",
")",
";",
"if",
"(",
"index",
"<",
"1",
"||",
"index",
">",
"count",
")",
"{",
"this",
".",
"$logError",
"(",
"this",
".",
"INDEX_OUT_OF_BOUNDS",
",",
"[",
"count",
",",
"index",
"]",
")",
";",
"return",
";",
"}",
"this",
".",
"removeHighlight",
"(",
")",
";",
"var",
"suggestionNode",
"=",
"this",
".",
"_getSuggestionsContainer",
"(",
")",
".",
"children",
"[",
"index",
"-",
"1",
"]",
";",
"this",
".",
"_addClass",
"(",
"suggestionNode",
",",
"'highlight'",
")",
";",
"suggestionNode",
".",
"firstChild",
".",
"setAttribute",
"(",
"'tabindex'",
",",
"0",
")",
";",
"suggestionNode",
".",
"firstChild",
".",
"focus",
"(",
")",
";",
"}"
]
| Exclusively highlights the inserted option located at the given index. That means that any other highlighted
option will not be highlighted anymore, and this even if the targeted option is already highlighted.
@param {Number} index Index of the option to highlight. 1-based.
@see removeHighlight
@see addHighlight | [
"Exclusively",
"highlights",
"the",
"inserted",
"option",
"located",
"at",
"the",
"given",
"index",
".",
"That",
"means",
"that",
"any",
"other",
"highlighted",
"option",
"will",
"not",
"be",
"highlighted",
"anymore",
"and",
"this",
"even",
"if",
"the",
"targeted",
"option",
"is",
"already",
"highlighted",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/widgets/form/MultiAutoComplete.js#L692-L707 | train |
|
ariatemplates/ariatemplates | src/aria/widgets/form/MultiAutoComplete.js | function () {
var suggestionContainer = this._textInputField.parentNode;
var highlightedArray = [];
for (var i = 0; i < suggestionContainer.children.length - 1; i++) {
var suggestionNode = suggestionContainer.children[i];
var suggestionNodeClassList = new aria.utils.ClassList(suggestionNode);
if (suggestionNodeClassList.contains("highlight")) {
highlightedArray.push(i + 1);
}
suggestionNodeClassList.$dispose();
}
return highlightedArray;
} | javascript | function () {
var suggestionContainer = this._textInputField.parentNode;
var highlightedArray = [];
for (var i = 0; i < suggestionContainer.children.length - 1; i++) {
var suggestionNode = suggestionContainer.children[i];
var suggestionNodeClassList = new aria.utils.ClassList(suggestionNode);
if (suggestionNodeClassList.contains("highlight")) {
highlightedArray.push(i + 1);
}
suggestionNodeClassList.$dispose();
}
return highlightedArray;
} | [
"function",
"(",
")",
"{",
"var",
"suggestionContainer",
"=",
"this",
".",
"_textInputField",
".",
"parentNode",
";",
"var",
"highlightedArray",
"=",
"[",
"]",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"suggestionContainer",
".",
"children",
".",
"length",
"-",
"1",
";",
"i",
"++",
")",
"{",
"var",
"suggestionNode",
"=",
"suggestionContainer",
".",
"children",
"[",
"i",
"]",
";",
"var",
"suggestionNodeClassList",
"=",
"new",
"aria",
".",
"utils",
".",
"ClassList",
"(",
"suggestionNode",
")",
";",
"if",
"(",
"suggestionNodeClassList",
".",
"contains",
"(",
"\"highlight\"",
")",
")",
"{",
"highlightedArray",
".",
"push",
"(",
"i",
"+",
"1",
")",
";",
"}",
"suggestionNodeClassList",
".",
"$dispose",
"(",
")",
";",
"}",
"return",
"highlightedArray",
";",
"}"
]
| Returns an array of indices of suggestions which have highlight class. Indexing starts with 1
@public
@return {Array} | [
"Returns",
"an",
"array",
"of",
"indices",
"of",
"suggestions",
"which",
"have",
"highlight",
"class",
".",
"Indexing",
"starts",
"with",
"1"
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/widgets/form/MultiAutoComplete.js#L714-L726 | train |
|
ariatemplates/ariatemplates | src/aria/widgets/form/MultiAutoComplete.js | function () {
var maxCount = 0, suggestion = this.controller.selectedSuggestions;
if (suggestion.length < this.controller.maxOptions) {
return this.controller.maxOptions;
} else {
for (var i = 0, len = suggestion.length; i < len; i++) {
if (ariaUtilsType.isObject(suggestion[i])) {
maxCount++;
}
}
return maxCount;
}
} | javascript | function () {
var maxCount = 0, suggestion = this.controller.selectedSuggestions;
if (suggestion.length < this.controller.maxOptions) {
return this.controller.maxOptions;
} else {
for (var i = 0, len = suggestion.length; i < len; i++) {
if (ariaUtilsType.isObject(suggestion[i])) {
maxCount++;
}
}
return maxCount;
}
} | [
"function",
"(",
")",
"{",
"var",
"maxCount",
"=",
"0",
",",
"suggestion",
"=",
"this",
".",
"controller",
".",
"selectedSuggestions",
";",
"if",
"(",
"suggestion",
".",
"length",
"<",
"this",
".",
"controller",
".",
"maxOptions",
")",
"{",
"return",
"this",
".",
"controller",
".",
"maxOptions",
";",
"}",
"else",
"{",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"len",
"=",
"suggestion",
".",
"length",
";",
"i",
"<",
"len",
";",
"i",
"++",
")",
"{",
"if",
"(",
"ariaUtilsType",
".",
"isObject",
"(",
"suggestion",
"[",
"i",
"]",
")",
")",
"{",
"maxCount",
"++",
";",
"}",
"}",
"return",
"maxCount",
";",
"}",
"}"
]
| Internal method for calculating the maxOptions allowed for setting it in template
@return {Number} | [
"Internal",
"method",
"for",
"calculating",
"the",
"maxOptions",
"allowed",
"for",
"setting",
"it",
"in",
"template"
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/widgets/form/MultiAutoComplete.js#L753-L765 | train |
|
ariatemplates/ariatemplates | src/aria/widgets/form/MultiAutoComplete.js | function () {
var indexes = this.getHighlight();
var rightMostIndex = indexes[indexes.length - 1];
var limit = this.insertedOptionsCount();
var index = rightMostIndex + 1;
if (index <= limit) {
this.highlightOption(index);
} else {
this.removeHighlight();
this._enterInputField();
}
} | javascript | function () {
var indexes = this.getHighlight();
var rightMostIndex = indexes[indexes.length - 1];
var limit = this.insertedOptionsCount();
var index = rightMostIndex + 1;
if (index <= limit) {
this.highlightOption(index);
} else {
this.removeHighlight();
this._enterInputField();
}
} | [
"function",
"(",
")",
"{",
"var",
"indexes",
"=",
"this",
".",
"getHighlight",
"(",
")",
";",
"var",
"rightMostIndex",
"=",
"indexes",
"[",
"indexes",
".",
"length",
"-",
"1",
"]",
";",
"var",
"limit",
"=",
"this",
".",
"insertedOptionsCount",
"(",
")",
";",
"var",
"index",
"=",
"rightMostIndex",
"+",
"1",
";",
"if",
"(",
"index",
"<=",
"limit",
")",
"{",
"this",
".",
"highlightOption",
"(",
"index",
")",
";",
"}",
"else",
"{",
"this",
".",
"removeHighlight",
"(",
")",
";",
"this",
".",
"_enterInputField",
"(",
")",
";",
"}",
"}"
]
| Performs right navigation when the widget is in highlighted mode. What it means is that it highlights the
next inserted option if there is one, otherwise it goes back to the text input field at its beginning. | [
"Performs",
"right",
"navigation",
"when",
"the",
"widget",
"is",
"in",
"highlighted",
"mode",
".",
"What",
"it",
"means",
"is",
"that",
"it",
"highlights",
"the",
"next",
"inserted",
"option",
"if",
"there",
"is",
"one",
"otherwise",
"it",
"goes",
"back",
"to",
"the",
"text",
"input",
"field",
"at",
"its",
"beginning",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/widgets/form/MultiAutoComplete.js#L843-L856 | train |
|
ariatemplates/ariatemplates | src/aria/utils/Accessibility.js | function (text, options) {
// -------------------------------------- input arguments processing
var document = Aria.$window.document;
if (options == null) {
options = {};
}
var parent = options.parent;
if (parent == null) {
parent = document.body;
}
var alert = options.alert;
// ------------------------------------------------------ processing
var waiReadTextElt = document.createElement("span");
waiReadTextElt.className = "xSROnly";
waiReadTextElt.setAttribute("role", alert ? "alert" : "status");
waiReadTextElt.setAttribute("aria-live", "assertive");
waiReadTextElt.setAttribute("aria-relevant", "additions");
if (alert) {
waiReadTextElt.style.visibility = "hidden";
}
parent.appendChild(waiReadTextElt);
var textChild = document.createElement("span");
var textNode = document.createTextNode(text);
textChild.appendChild(textNode);
waiReadTextElt.appendChild(textChild);
if (alert) {
waiReadTextElt.style.visibility = "visible";
}
setTimeout(function () {
// remove the node after 10ms
ariaUtilsDom.removeElement(waiReadTextElt);
}, 10);
} | javascript | function (text, options) {
// -------------------------------------- input arguments processing
var document = Aria.$window.document;
if (options == null) {
options = {};
}
var parent = options.parent;
if (parent == null) {
parent = document.body;
}
var alert = options.alert;
// ------------------------------------------------------ processing
var waiReadTextElt = document.createElement("span");
waiReadTextElt.className = "xSROnly";
waiReadTextElt.setAttribute("role", alert ? "alert" : "status");
waiReadTextElt.setAttribute("aria-live", "assertive");
waiReadTextElt.setAttribute("aria-relevant", "additions");
if (alert) {
waiReadTextElt.style.visibility = "hidden";
}
parent.appendChild(waiReadTextElt);
var textChild = document.createElement("span");
var textNode = document.createTextNode(text);
textChild.appendChild(textNode);
waiReadTextElt.appendChild(textChild);
if (alert) {
waiReadTextElt.style.visibility = "visible";
}
setTimeout(function () {
// remove the node after 10ms
ariaUtilsDom.removeElement(waiReadTextElt);
}, 10);
} | [
"function",
"(",
"text",
",",
"options",
")",
"{",
"var",
"document",
"=",
"Aria",
".",
"$window",
".",
"document",
";",
"if",
"(",
"options",
"==",
"null",
")",
"{",
"options",
"=",
"{",
"}",
";",
"}",
"var",
"parent",
"=",
"options",
".",
"parent",
";",
"if",
"(",
"parent",
"==",
"null",
")",
"{",
"parent",
"=",
"document",
".",
"body",
";",
"}",
"var",
"alert",
"=",
"options",
".",
"alert",
";",
"var",
"waiReadTextElt",
"=",
"document",
".",
"createElement",
"(",
"\"span\"",
")",
";",
"waiReadTextElt",
".",
"className",
"=",
"\"xSROnly\"",
";",
"waiReadTextElt",
".",
"setAttribute",
"(",
"\"role\"",
",",
"alert",
"?",
"\"alert\"",
":",
"\"status\"",
")",
";",
"waiReadTextElt",
".",
"setAttribute",
"(",
"\"aria-live\"",
",",
"\"assertive\"",
")",
";",
"waiReadTextElt",
".",
"setAttribute",
"(",
"\"aria-relevant\"",
",",
"\"additions\"",
")",
";",
"if",
"(",
"alert",
")",
"{",
"waiReadTextElt",
".",
"style",
".",
"visibility",
"=",
"\"hidden\"",
";",
"}",
"parent",
".",
"appendChild",
"(",
"waiReadTextElt",
")",
";",
"var",
"textChild",
"=",
"document",
".",
"createElement",
"(",
"\"span\"",
")",
";",
"var",
"textNode",
"=",
"document",
".",
"createTextNode",
"(",
"text",
")",
";",
"textChild",
".",
"appendChild",
"(",
"textNode",
")",
";",
"waiReadTextElt",
".",
"appendChild",
"(",
"textChild",
")",
";",
"if",
"(",
"alert",
")",
"{",
"waiReadTextElt",
".",
"style",
".",
"visibility",
"=",
"\"visible\"",
";",
"}",
"setTimeout",
"(",
"function",
"(",
")",
"{",
"ariaUtilsDom",
".",
"removeElement",
"(",
"waiReadTextElt",
")",
";",
"}",
",",
"10",
")",
";",
"}"
]
| Forces the screen reader to read the given piece of text.
<p>The options object can contain the following properties: </p>
<ul>
<li><em>parent</em>: the DOM element in which to put the temporarily generated element</li>
<li><em>alert</em>: whether or not to treat the generated element as an alert (role = "alert" instead of "status")</li>
</ul>
@param {String} text The text to be read
@param {Object} options Optional options object, see description for more information. | [
"Forces",
"the",
"screen",
"reader",
"to",
"read",
"the",
"given",
"piece",
"of",
"text",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/utils/Accessibility.js#L46-L87 | train |
|
ariatemplates/ariatemplates | src/aria/storage/LocalStorage.js | fallback | function fallback (self, instance) {
self._get = instance._get;
self._set = instance._set;
self._remove = instance._remove;
self._clear = instance._clear;
self.storage = ariaStorageUserData._STORAGE;
self.__keys = ariaStorageUserData._ALL_KEYS;
} | javascript | function fallback (self, instance) {
self._get = instance._get;
self._set = instance._set;
self._remove = instance._remove;
self._clear = instance._clear;
self.storage = ariaStorageUserData._STORAGE;
self.__keys = ariaStorageUserData._ALL_KEYS;
} | [
"function",
"fallback",
"(",
"self",
",",
"instance",
")",
"{",
"self",
".",
"_get",
"=",
"instance",
".",
"_get",
";",
"self",
".",
"_set",
"=",
"instance",
".",
"_set",
";",
"self",
".",
"_remove",
"=",
"instance",
".",
"_remove",
";",
"self",
".",
"_clear",
"=",
"instance",
".",
"_clear",
";",
"self",
".",
"storage",
"=",
"ariaStorageUserData",
".",
"_STORAGE",
";",
"self",
".",
"__keys",
"=",
"ariaStorageUserData",
".",
"_ALL_KEYS",
";",
"}"
]
| Modify a class instance to use methods from an instance of aria.storage.UserData used as fallback. This should
happen in IE7 since it doesn't support localStorage but UserData that provides the same functionalities | [
"Modify",
"a",
"class",
"instance",
"to",
"use",
"methods",
"from",
"an",
"instance",
"of",
"aria",
".",
"storage",
".",
"UserData",
"used",
"as",
"fallback",
".",
"This",
"should",
"happen",
"in",
"IE7",
"since",
"it",
"doesn",
"t",
"support",
"localStorage",
"but",
"UserData",
"that",
"provides",
"the",
"same",
"functionalities"
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/storage/LocalStorage.js#L26-L34 | train |
ariatemplates/ariatemplates | src/aria/storage/LocalStorage.js | function (options) {
var isIE7 = ariaCoreBrowser.isIE7;
// Throw an error only in IE7
this.$HTML5Storage.constructor.call(this, options, "localStorage", !isIE7);
if (!this.storage && isIE7) {
var instance = new ariaStorageUserData(options);
fallback(this, instance);
/**
* Whether or not this instance is using a fallback mechanism for localStorage
* @type aria.storage.UserData
* @protected
*/
this._fallback = instance;
}
} | javascript | function (options) {
var isIE7 = ariaCoreBrowser.isIE7;
// Throw an error only in IE7
this.$HTML5Storage.constructor.call(this, options, "localStorage", !isIE7);
if (!this.storage && isIE7) {
var instance = new ariaStorageUserData(options);
fallback(this, instance);
/**
* Whether or not this instance is using a fallback mechanism for localStorage
* @type aria.storage.UserData
* @protected
*/
this._fallback = instance;
}
} | [
"function",
"(",
"options",
")",
"{",
"var",
"isIE7",
"=",
"ariaCoreBrowser",
".",
"isIE7",
";",
"this",
".",
"$HTML5Storage",
".",
"constructor",
".",
"call",
"(",
"this",
",",
"options",
",",
"\"localStorage\"",
",",
"!",
"isIE7",
")",
";",
"if",
"(",
"!",
"this",
".",
"storage",
"&&",
"isIE7",
")",
"{",
"var",
"instance",
"=",
"new",
"ariaStorageUserData",
"(",
"options",
")",
";",
"fallback",
"(",
"this",
",",
"instance",
")",
";",
"this",
".",
"_fallback",
"=",
"instance",
";",
"}",
"}"
]
| Create an instance of LocalStorage. Try ot use userData if missing
@param {aria.storage.Beans:ConstructorArgs} options Constructor options | [
"Create",
"an",
"instance",
"of",
"LocalStorage",
".",
"Try",
"ot",
"use",
"userData",
"if",
"missing"
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/storage/LocalStorage.js#L54-L71 | train |
|
ariatemplates/ariatemplates | src/aria/utils/Json.js | function (property, recursive) {
var metaName = recursive ? jsonUtils.META_FOR_RECLISTENERS : jsonUtils.META_FOR_LISTENERS;
if (property != null) {// the comparison with null is important, as 0 or "" must be considered as valid
// property names
metaName += "_" + property;
}
return metaName;
} | javascript | function (property, recursive) {
var metaName = recursive ? jsonUtils.META_FOR_RECLISTENERS : jsonUtils.META_FOR_LISTENERS;
if (property != null) {// the comparison with null is important, as 0 or "" must be considered as valid
// property names
metaName += "_" + property;
}
return metaName;
} | [
"function",
"(",
"property",
",",
"recursive",
")",
"{",
"var",
"metaName",
"=",
"recursive",
"?",
"jsonUtils",
".",
"META_FOR_RECLISTENERS",
":",
"jsonUtils",
".",
"META_FOR_LISTENERS",
";",
"if",
"(",
"property",
"!=",
"null",
")",
"{",
"metaName",
"+=",
"\"_\"",
"+",
"property",
";",
"}",
"return",
"metaName",
";",
"}"
]
| Returns the container for listener for an optional target property. Returns a different container for recursive
listeners.
@private
@param {String} property can be null
@param {Boolean} recursive
@return {String} the property name of the container | [
"Returns",
"the",
"container",
"for",
"listener",
"for",
"an",
"optional",
"target",
"property",
".",
"Returns",
"a",
"different",
"container",
"for",
"recursive",
"listeners",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/utils/Json.js#L34-L41 | train |
|
ariatemplates/ariatemplates | src/aria/utils/Json.js | function (child, parent, oldProperty, newProperty) {
var childParents = child ? child[parProp] : null;
if (childParents) {
for (var index = 0, parentDescription; parentDescription = childParents[index]; index++) {
if (parentDescription.parent == parent && parentDescription.property == oldProperty) {
parentDescription.property = newProperty;
// there should be only one.
break;
}
}
}
} | javascript | function (child, parent, oldProperty, newProperty) {
var childParents = child ? child[parProp] : null;
if (childParents) {
for (var index = 0, parentDescription; parentDescription = childParents[index]; index++) {
if (parentDescription.parent == parent && parentDescription.property == oldProperty) {
parentDescription.property = newProperty;
// there should be only one.
break;
}
}
}
} | [
"function",
"(",
"child",
",",
"parent",
",",
"oldProperty",
",",
"newProperty",
")",
"{",
"var",
"childParents",
"=",
"child",
"?",
"child",
"[",
"parProp",
"]",
":",
"null",
";",
"if",
"(",
"childParents",
")",
"{",
"for",
"(",
"var",
"index",
"=",
"0",
",",
"parentDescription",
";",
"parentDescription",
"=",
"childParents",
"[",
"index",
"]",
";",
"index",
"++",
")",
"{",
"if",
"(",
"parentDescription",
".",
"parent",
"==",
"parent",
"&&",
"parentDescription",
".",
"property",
"==",
"oldProperty",
")",
"{",
"parentDescription",
".",
"property",
"=",
"newProperty",
";",
"break",
";",
"}",
"}",
"}",
"}"
]
| Update back-references when the property name under which a parent was referencing a child changed.
@param {Object} child child. This method does nothing if the child is null or does not have any back references)
@param {Object} parent
@param {String} oldProperty
@param {String} newProperty
@private | [
"Update",
"back",
"-",
"references",
"when",
"the",
"property",
"name",
"under",
"which",
"a",
"parent",
"was",
"referencing",
"a",
"child",
"changed",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/utils/Json.js#L89-L100 | train |
|
ariatemplates/ariatemplates | src/aria/utils/Json.js | function (propertyName) {
if (!ariaUtilsType.isString(propertyName)) {
return true;
}
// which property names are included for back references
return (propertyName != jsonUtils.OBJECT_PARENT_PROPERTY &&
propertyName.substr(0, jsonUtils.META_FOR_LISTENERS.length) != jsonUtils.META_FOR_LISTENERS &&
propertyName.substr(0, jsonUtils.META_FOR_RECLISTENERS.length) != jsonUtils.META_FOR_RECLISTENERS);
} | javascript | function (propertyName) {
if (!ariaUtilsType.isString(propertyName)) {
return true;
}
// which property names are included for back references
return (propertyName != jsonUtils.OBJECT_PARENT_PROPERTY &&
propertyName.substr(0, jsonUtils.META_FOR_LISTENERS.length) != jsonUtils.META_FOR_LISTENERS &&
propertyName.substr(0, jsonUtils.META_FOR_RECLISTENERS.length) != jsonUtils.META_FOR_RECLISTENERS);
} | [
"function",
"(",
"propertyName",
")",
"{",
"if",
"(",
"!",
"ariaUtilsType",
".",
"isString",
"(",
"propertyName",
")",
")",
"{",
"return",
"true",
";",
"}",
"return",
"(",
"propertyName",
"!=",
"jsonUtils",
".",
"OBJECT_PARENT_PROPERTY",
"&&",
"propertyName",
".",
"substr",
"(",
"0",
",",
"jsonUtils",
".",
"META_FOR_LISTENERS",
".",
"length",
")",
"!=",
"jsonUtils",
".",
"META_FOR_LISTENERS",
"&&",
"propertyName",
".",
"substr",
"(",
"0",
",",
"jsonUtils",
".",
"META_FOR_RECLISTENERS",
".",
"length",
")",
"!=",
"jsonUtils",
".",
"META_FOR_RECLISTENERS",
")",
";",
"}"
]
| Returns whether back references recursive methods will go down through links with that name.
@param {String} propertyName Property name.
@return {Boolean}
@private | [
"Returns",
"whether",
"back",
"references",
"recursive",
"methods",
"will",
"go",
"down",
"through",
"links",
"with",
"that",
"name",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/utils/Json.js#L108-L117 | train |
|
ariatemplates/ariatemplates | src/aria/utils/Json.js | function (node) {
var recMarker = jsonUtils.TEMP_REC_MARKER;
if (node[recMarker]) {
node[recMarker] = false;
delete node[recMarker];
var parents = node[jsonUtils.OBJECT_PARENT_PROPERTY];
if (parents) {
for (var index = 0, l = parents.length; index < l; index++) {
__cleanUpRecMarkers(parents[index].parent);
}
}
}
} | javascript | function (node) {
var recMarker = jsonUtils.TEMP_REC_MARKER;
if (node[recMarker]) {
node[recMarker] = false;
delete node[recMarker];
var parents = node[jsonUtils.OBJECT_PARENT_PROPERTY];
if (parents) {
for (var index = 0, l = parents.length; index < l; index++) {
__cleanUpRecMarkers(parents[index].parent);
}
}
}
} | [
"function",
"(",
"node",
")",
"{",
"var",
"recMarker",
"=",
"jsonUtils",
".",
"TEMP_REC_MARKER",
";",
"if",
"(",
"node",
"[",
"recMarker",
"]",
")",
"{",
"node",
"[",
"recMarker",
"]",
"=",
"false",
";",
"delete",
"node",
"[",
"recMarker",
"]",
";",
"var",
"parents",
"=",
"node",
"[",
"jsonUtils",
".",
"OBJECT_PARENT_PROPERTY",
"]",
";",
"if",
"(",
"parents",
")",
"{",
"for",
"(",
"var",
"index",
"=",
"0",
",",
"l",
"=",
"parents",
".",
"length",
";",
"index",
"<",
"l",
";",
"index",
"++",
")",
"{",
"__cleanUpRecMarkers",
"(",
"parents",
"[",
"index",
"]",
".",
"parent",
")",
";",
"}",
"}",
"}",
"}"
]
| Clean temporary markers pushed in the structure by exploring parents
@private
@param {Object} node to start with | [
"Clean",
"temporary",
"markers",
"pushed",
"in",
"the",
"structure",
"by",
"exploring",
"parents"
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/utils/Json.js#L152-L164 | train |
|
ariatemplates/ariatemplates | src/aria/utils/Json.js | function (newListeners, existingListeners) {
if (newListeners != null) {
if (!existingListeners) {
existingListeners = [];
}
existingListeners.push.apply(existingListeners, newListeners);
}
return existingListeners;
} | javascript | function (newListeners, existingListeners) {
if (newListeners != null) {
if (!existingListeners) {
existingListeners = [];
}
existingListeners.push.apply(existingListeners, newListeners);
}
return existingListeners;
} | [
"function",
"(",
"newListeners",
",",
"existingListeners",
")",
"{",
"if",
"(",
"newListeners",
"!=",
"null",
")",
"{",
"if",
"(",
"!",
"existingListeners",
")",
"{",
"existingListeners",
"=",
"[",
"]",
";",
"}",
"existingListeners",
".",
"push",
".",
"apply",
"(",
"existingListeners",
",",
"newListeners",
")",
";",
"}",
"return",
"existingListeners",
";",
"}"
]
| Append the given new array of listeners to the existing array of listeners. It is used when retrieving the array
of listeners to call. The resulting array of listeners can be modified without changing newListeners. If both
element are null, will return null
@param {Array} newListeners listeners to add, can be null
@param {Array} existingListeners existing listeners, can be null
@return {Array}
@private | [
"Append",
"the",
"given",
"new",
"array",
"of",
"listeners",
"to",
"the",
"existing",
"array",
"of",
"listeners",
".",
"It",
"is",
"used",
"when",
"retrieving",
"the",
"array",
"of",
"listeners",
"to",
"call",
".",
"The",
"resulting",
"array",
"of",
"listeners",
"can",
"be",
"modified",
"without",
"changing",
"newListeners",
".",
"If",
"both",
"element",
"are",
"null",
"will",
"return",
"null"
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/utils/Json.js#L175-L183 | train |
|
ariatemplates/ariatemplates | src/aria/utils/Json.js | function (node, property, recursive, listeners) {
if (property != null) {
// add property specific listeners
listeners = __retrievePropertySpecificListeners(node, property, recursive, listeners);
}
// recursive check
if (node[jsonUtils.TEMP_REC_MARKER]) {
return listeners;
}
// add general listeners
listeners = __retrievePropertySpecificListeners(node, null, recursive, listeners);
// case parent property is defined: look for "recursive" listener in parent nodes
var parents = node[jsonUtils.OBJECT_PARENT_PROPERTY];
if (parents) {
// mark this node has being visited
node[jsonUtils.TEMP_REC_MARKER] = true;
for (var index = 0, parentDesc; parentDesc = parents[index]; index++) {
listeners = __retrieveListeners(parentDesc.parent, parentDesc.property, true, listeners);
}
// at the end, clean recursive markup (only first call will have recursive set to null)
if (!recursive) {
__cleanUpRecMarkers(node);
}
}
return listeners;
} | javascript | function (node, property, recursive, listeners) {
if (property != null) {
// add property specific listeners
listeners = __retrievePropertySpecificListeners(node, property, recursive, listeners);
}
// recursive check
if (node[jsonUtils.TEMP_REC_MARKER]) {
return listeners;
}
// add general listeners
listeners = __retrievePropertySpecificListeners(node, null, recursive, listeners);
// case parent property is defined: look for "recursive" listener in parent nodes
var parents = node[jsonUtils.OBJECT_PARENT_PROPERTY];
if (parents) {
// mark this node has being visited
node[jsonUtils.TEMP_REC_MARKER] = true;
for (var index = 0, parentDesc; parentDesc = parents[index]; index++) {
listeners = __retrieveListeners(parentDesc.parent, parentDesc.property, true, listeners);
}
// at the end, clean recursive markup (only first call will have recursive set to null)
if (!recursive) {
__cleanUpRecMarkers(node);
}
}
return listeners;
} | [
"function",
"(",
"node",
",",
"property",
",",
"recursive",
",",
"listeners",
")",
"{",
"if",
"(",
"property",
"!=",
"null",
")",
"{",
"listeners",
"=",
"__retrievePropertySpecificListeners",
"(",
"node",
",",
"property",
",",
"recursive",
",",
"listeners",
")",
";",
"}",
"if",
"(",
"node",
"[",
"jsonUtils",
".",
"TEMP_REC_MARKER",
"]",
")",
"{",
"return",
"listeners",
";",
"}",
"listeners",
"=",
"__retrievePropertySpecificListeners",
"(",
"node",
",",
"null",
",",
"recursive",
",",
"listeners",
")",
";",
"var",
"parents",
"=",
"node",
"[",
"jsonUtils",
".",
"OBJECT_PARENT_PROPERTY",
"]",
";",
"if",
"(",
"parents",
")",
"{",
"node",
"[",
"jsonUtils",
".",
"TEMP_REC_MARKER",
"]",
"=",
"true",
";",
"for",
"(",
"var",
"index",
"=",
"0",
",",
"parentDesc",
";",
"parentDesc",
"=",
"parents",
"[",
"index",
"]",
";",
"index",
"++",
")",
"{",
"listeners",
"=",
"__retrieveListeners",
"(",
"parentDesc",
".",
"parent",
",",
"parentDesc",
".",
"property",
",",
"true",
",",
"listeners",
")",
";",
"}",
"if",
"(",
"!",
"recursive",
")",
"{",
"__cleanUpRecMarkers",
"(",
"node",
")",
";",
"}",
"}",
"return",
"listeners",
";",
"}"
]
| Retrieve listeners in node and its parents
@private
@param {Object} node
@param {String} property (may be null, for changes which are not related to a specific property, e.g. splice on
an array)
@param {Boolean} retrieve recursive listeners only, default is false
@param {Array} listeners | [
"Retrieve",
"listeners",
"in",
"node",
"and",
"its",
"parents"
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/utils/Json.js#L194-L224 | train |
|
ariatemplates/ariatemplates | src/aria/utils/Json.js | function (listeners, change, listenerToExclude) {
for (var idx = 0, length = listeners.length; idx < length; idx++) {
var lsn = listeners[idx];
if (lsn == listenerToExclude || !lsn) {
continue;
}
var fn = lsn.fn;
if (fn) {
// note that calling $callback has an impact on performances (x2)
// that's why we don't do it here
fn.call(lsn.scope, change, lsn.args);
}
}
} | javascript | function (listeners, change, listenerToExclude) {
for (var idx = 0, length = listeners.length; idx < length; idx++) {
var lsn = listeners[idx];
if (lsn == listenerToExclude || !lsn) {
continue;
}
var fn = lsn.fn;
if (fn) {
// note that calling $callback has an impact on performances (x2)
// that's why we don't do it here
fn.call(lsn.scope, change, lsn.args);
}
}
} | [
"function",
"(",
"listeners",
",",
"change",
",",
"listenerToExclude",
")",
"{",
"for",
"(",
"var",
"idx",
"=",
"0",
",",
"length",
"=",
"listeners",
".",
"length",
";",
"idx",
"<",
"length",
";",
"idx",
"++",
")",
"{",
"var",
"lsn",
"=",
"listeners",
"[",
"idx",
"]",
";",
"if",
"(",
"lsn",
"==",
"listenerToExclude",
"||",
"!",
"lsn",
")",
"{",
"continue",
";",
"}",
"var",
"fn",
"=",
"lsn",
".",
"fn",
";",
"if",
"(",
"fn",
")",
"{",
"fn",
".",
"call",
"(",
"lsn",
".",
"scope",
",",
"change",
",",
"lsn",
".",
"args",
")",
";",
"}",
"}",
"}"
]
| Call the given listeners with the given parameter.
@param {Array} listeners array of listeners to call (can be retrieved with __retrieveListeners)
@param {Object} change object describing the change
@param {Object} listenerToExclude (optional) potential listener callback belonging to the object that raised the
change and which doesn't want to be notified | [
"Call",
"the",
"given",
"listeners",
"with",
"the",
"given",
"parameter",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/utils/Json.js#L251-L264 | train |
|
ariatemplates/ariatemplates | src/aria/utils/Json.js | function (container, property, change, listenerToExclude) {
// retrieve listeners for this node and its parents
// arguments given to the callback
var listeners = __retrieveListeners(container, property);
if (listeners) {
change.dataHolder = container;
change.dataName = property;
__callListeners(listeners, change, listenerToExclude);
}
} | javascript | function (container, property, change, listenerToExclude) {
// retrieve listeners for this node and its parents
// arguments given to the callback
var listeners = __retrieveListeners(container, property);
if (listeners) {
change.dataHolder = container;
change.dataName = property;
__callListeners(listeners, change, listenerToExclude);
}
} | [
"function",
"(",
"container",
",",
"property",
",",
"change",
",",
"listenerToExclude",
")",
"{",
"var",
"listeners",
"=",
"__retrieveListeners",
"(",
"container",
",",
"property",
")",
";",
"if",
"(",
"listeners",
")",
"{",
"change",
".",
"dataHolder",
"=",
"container",
";",
"change",
".",
"dataName",
"=",
"property",
";",
"__callListeners",
"(",
"listeners",
",",
"change",
",",
"listenerToExclude",
")",
";",
"}",
"}"
]
| Notifies JSON listeners that a value on the object they listen to has changed
@private
@param {Object} container reference to the data holder object - e.g. data.search.preferedCity
@param {String} property name of the property - e.g. '$value'
@param {Object} change object describing the change made to the property (containing oldValue/newValue if the
change was made with setValue)
@param {Object} listenerToExclude (optional) potential listener callback belonging to the object that raised the
change and which doesn't want to be notified | [
"Notifies",
"JSON",
"listeners",
"that",
"a",
"value",
"on",
"the",
"object",
"they",
"listen",
"to",
"has",
"changed"
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/utils/Json.js#L276-L285 | train |
|
ariatemplates/ariatemplates | src/aria/utils/Json.js | function (container) {
if (container[parProp]) {
// back references already present, nothing to do
return;
}
// back references are not present yet
container[parProp] = [];
for (var childName in container) {
if (container.hasOwnProperty(childName) && __includePropForBackRef(childName)) {
var childValue = container[childName];
if (__isValidContainer(childValue)) {
this.__checkBackRefs(childValue);
// Add the container reference and property name to the child 'aria:parent' array
childValue[parProp].push({
parent : container,
property : childName
});
this.$raiseEvent({
name : 'aria-parent-metadata-added',
child: childValue,
parent: container,
property: childName
});
}
}
}
} | javascript | function (container) {
if (container[parProp]) {
// back references already present, nothing to do
return;
}
// back references are not present yet
container[parProp] = [];
for (var childName in container) {
if (container.hasOwnProperty(childName) && __includePropForBackRef(childName)) {
var childValue = container[childName];
if (__isValidContainer(childValue)) {
this.__checkBackRefs(childValue);
// Add the container reference and property name to the child 'aria:parent' array
childValue[parProp].push({
parent : container,
property : childName
});
this.$raiseEvent({
name : 'aria-parent-metadata-added',
child: childValue,
parent: container,
property: childName
});
}
}
}
} | [
"function",
"(",
"container",
")",
"{",
"if",
"(",
"container",
"[",
"parProp",
"]",
")",
"{",
"return",
";",
"}",
"container",
"[",
"parProp",
"]",
"=",
"[",
"]",
";",
"for",
"(",
"var",
"childName",
"in",
"container",
")",
"{",
"if",
"(",
"container",
".",
"hasOwnProperty",
"(",
"childName",
")",
"&&",
"__includePropForBackRef",
"(",
"childName",
")",
")",
"{",
"var",
"childValue",
"=",
"container",
"[",
"childName",
"]",
";",
"if",
"(",
"__isValidContainer",
"(",
"childValue",
")",
")",
"{",
"this",
".",
"__checkBackRefs",
"(",
"childValue",
")",
";",
"childValue",
"[",
"parProp",
"]",
".",
"push",
"(",
"{",
"parent",
":",
"container",
",",
"property",
":",
"childName",
"}",
")",
";",
"this",
".",
"$raiseEvent",
"(",
"{",
"name",
":",
"'aria-parent-metadata-added'",
",",
"child",
":",
"childValue",
",",
"parent",
":",
"container",
",",
"property",
":",
"childName",
"}",
")",
";",
"}",
"}",
"}",
"}"
]
| This method checks that back references up to container are present in the data model. If not, they are added
recursively.
@param {Object} container Must already be checked as a container according to __isValidContainer.
@private | [
"This",
"method",
"checks",
"that",
"back",
"references",
"up",
"to",
"container",
"are",
"present",
"in",
"the",
"data",
"model",
".",
"If",
"not",
"they",
"are",
"added",
"recursively",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/utils/Json.js#L419-L445 | train |
|
ariatemplates/ariatemplates | src/aria/utils/Json.js | function (item, options, serializerInstance) {
if (serializerInstance) {
if ("serialize" in serializerInstance) {
return serializerInstance.serialize(item, options);
} else {
this.$logError(this.INVALID_JSON_SERIALIZER_INSTANCE);
return null;
}
}
return this.__defaultJsonSerializer.serialize(item, options);
} | javascript | function (item, options, serializerInstance) {
if (serializerInstance) {
if ("serialize" in serializerInstance) {
return serializerInstance.serialize(item, options);
} else {
this.$logError(this.INVALID_JSON_SERIALIZER_INSTANCE);
return null;
}
}
return this.__defaultJsonSerializer.serialize(item, options);
} | [
"function",
"(",
"item",
",",
"options",
",",
"serializerInstance",
")",
"{",
"if",
"(",
"serializerInstance",
")",
"{",
"if",
"(",
"\"serialize\"",
"in",
"serializerInstance",
")",
"{",
"return",
"serializerInstance",
".",
"serialize",
"(",
"item",
",",
"options",
")",
";",
"}",
"else",
"{",
"this",
".",
"$logError",
"(",
"this",
".",
"INVALID_JSON_SERIALIZER_INSTANCE",
")",
";",
"return",
"null",
";",
"}",
"}",
"return",
"this",
".",
"__defaultJsonSerializer",
".",
"serialize",
"(",
"item",
",",
"options",
")",
";",
"}"
]
| Converts an object to a JSON string
@param {Object|Array|String|Number|Boolean|Date|RegExp|Function} item item to serialize
@param {Object} options options for the serialize method of the serializer - optional
@param {Object} serializerInstance instance of a serializer - optional. If not provided, an instance of
the default serializer (aria.utils.json.JsonSerializer) is used. If the provided instance does not have a
serialize method, an error is raised
@return {String} the JSON string. null if the JSON serialization failed | [
"Converts",
"an",
"object",
"to",
"a",
"JSON",
"string"
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/utils/Json.js#L456-L467 | train |
|
ariatemplates/ariatemplates | src/aria/utils/Json.js | function (str, ctxt, errMsg) {
var JSON = Aria.$global.JSON;
if (ctxt && ctxt.$classpath) {
ctxt = ctxt.$classpath;
}
if (typeof JSON !== "undefined" && typeof JSON.parse === "function") {
try {
return JSON.parse(str);
} catch (ex) {
// Fallback to eval
this.$logWarn(this.INVALID_JSON_SYNTAX, [ctxt, str]);
return this._loadWithEval(str, ctxt, errMsg);
}
}
return this._loadWithEval(str, ctxt, errMsg);
} | javascript | function (str, ctxt, errMsg) {
var JSON = Aria.$global.JSON;
if (ctxt && ctxt.$classpath) {
ctxt = ctxt.$classpath;
}
if (typeof JSON !== "undefined" && typeof JSON.parse === "function") {
try {
return JSON.parse(str);
} catch (ex) {
// Fallback to eval
this.$logWarn(this.INVALID_JSON_SYNTAX, [ctxt, str]);
return this._loadWithEval(str, ctxt, errMsg);
}
}
return this._loadWithEval(str, ctxt, errMsg);
} | [
"function",
"(",
"str",
",",
"ctxt",
",",
"errMsg",
")",
"{",
"var",
"JSON",
"=",
"Aria",
".",
"$global",
".",
"JSON",
";",
"if",
"(",
"ctxt",
"&&",
"ctxt",
".",
"$classpath",
")",
"{",
"ctxt",
"=",
"ctxt",
".",
"$classpath",
";",
"}",
"if",
"(",
"typeof",
"JSON",
"!==",
"\"undefined\"",
"&&",
"typeof",
"JSON",
".",
"parse",
"===",
"\"function\"",
")",
"{",
"try",
"{",
"return",
"JSON",
".",
"parse",
"(",
"str",
")",
";",
"}",
"catch",
"(",
"ex",
")",
"{",
"this",
".",
"$logWarn",
"(",
"this",
".",
"INVALID_JSON_SYNTAX",
",",
"[",
"ctxt",
",",
"str",
"]",
")",
";",
"return",
"this",
".",
"_loadWithEval",
"(",
"str",
",",
"ctxt",
",",
"errMsg",
")",
";",
"}",
"}",
"return",
"this",
".",
"_loadWithEval",
"(",
"str",
",",
"ctxt",
",",
"errMsg",
")",
";",
"}"
]
| Load a JSON string and return the corresponding object
@param {String} str the JSON string
@param {Object} ctxt caller object - optional - used to retrieve the caller classpath in case of error
@param {String} errMsg the error message to use in case of problem - optional - default:
aria.utils.Json.INVALID_JSON_CONTENT
@return {Object} | [
"Load",
"a",
"JSON",
"string",
"and",
"return",
"the",
"corresponding",
"object"
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/utils/Json.js#L839-L857 | train |
|
ariatemplates/ariatemplates | src/aria/utils/Json.js | function (str, ctxt, errMsg) {
var res = null;
try {
str = ('' + str).replace(/^\s/, ''); // remove first spaces
res = Aria["eval"]('return (' + str + ');');
} catch (ex) {
if (!errMsg) {
errMsg = this.INVALID_JSON_CONTENT;
}
this.$logError(errMsg, [ctxt, str], ex);
}
return res;
} | javascript | function (str, ctxt, errMsg) {
var res = null;
try {
str = ('' + str).replace(/^\s/, ''); // remove first spaces
res = Aria["eval"]('return (' + str + ');');
} catch (ex) {
if (!errMsg) {
errMsg = this.INVALID_JSON_CONTENT;
}
this.$logError(errMsg, [ctxt, str], ex);
}
return res;
} | [
"function",
"(",
"str",
",",
"ctxt",
",",
"errMsg",
")",
"{",
"var",
"res",
"=",
"null",
";",
"try",
"{",
"str",
"=",
"(",
"''",
"+",
"str",
")",
".",
"replace",
"(",
"/",
"^\\s",
"/",
",",
"''",
")",
";",
"res",
"=",
"Aria",
"[",
"\"eval\"",
"]",
"(",
"'return ('",
"+",
"str",
"+",
"');'",
")",
";",
"}",
"catch",
"(",
"ex",
")",
"{",
"if",
"(",
"!",
"errMsg",
")",
"{",
"errMsg",
"=",
"this",
".",
"INVALID_JSON_CONTENT",
";",
"}",
"this",
".",
"$logError",
"(",
"errMsg",
",",
"[",
"ctxt",
",",
"str",
"]",
",",
"ex",
")",
";",
"}",
"return",
"res",
";",
"}"
]
| Load a JSON string and return the corresponding object using eval
@param {String} str the JSON string
@param {Object} ctxt caller object - optional - used to retrieve the caller classpath in case of error
@param {String} errMsg the error message to use in case of problem - optional - default:
aria.utils.Json.INVALID_JSON_CONTENT
@return {Object}
@private | [
"Load",
"a",
"JSON",
"string",
"and",
"return",
"the",
"corresponding",
"object",
"using",
"eval"
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/utils/Json.js#L868-L882 | train |
|
ariatemplates/ariatemplates | src/aria/utils/Json.js | function (big, small) {
var isBigArray = typeUtils.isArray(big), isBigObject = typeUtils.isObject(big), isSmallArray = typeUtils.isArray(small), isSmallObject = typeUtils.isObject(small);
if (isBigArray && isSmallArray) {
for (var i = 0, l = small.length; i < l; i++) {
if (!this.contains(big[i], small[i])) {
return false;
}
}
} else if (isBigObject && isSmallObject) {
for (var key in small) {
if (small.hasOwnProperty(key)) {
if (key.match(/:/)) {
continue; // meta-data: we don't copy them
}
if (small.hasOwnProperty(key)) {
if (!this.contains(big[key], small[key])) {
return false;
}
}
}
}
} else {
var allTime = (typeUtils.isDate(big) && typeUtils.isDate(small));
if (allTime) {
return (small.getTime() === big.getTime());
} else {
return small === big;
}
}
return true;
} | javascript | function (big, small) {
var isBigArray = typeUtils.isArray(big), isBigObject = typeUtils.isObject(big), isSmallArray = typeUtils.isArray(small), isSmallObject = typeUtils.isObject(small);
if (isBigArray && isSmallArray) {
for (var i = 0, l = small.length; i < l; i++) {
if (!this.contains(big[i], small[i])) {
return false;
}
}
} else if (isBigObject && isSmallObject) {
for (var key in small) {
if (small.hasOwnProperty(key)) {
if (key.match(/:/)) {
continue; // meta-data: we don't copy them
}
if (small.hasOwnProperty(key)) {
if (!this.contains(big[key], small[key])) {
return false;
}
}
}
}
} else {
var allTime = (typeUtils.isDate(big) && typeUtils.isDate(small));
if (allTime) {
return (small.getTime() === big.getTime());
} else {
return small === big;
}
}
return true;
} | [
"function",
"(",
"big",
",",
"small",
")",
"{",
"var",
"isBigArray",
"=",
"typeUtils",
".",
"isArray",
"(",
"big",
")",
",",
"isBigObject",
"=",
"typeUtils",
".",
"isObject",
"(",
"big",
")",
",",
"isSmallArray",
"=",
"typeUtils",
".",
"isArray",
"(",
"small",
")",
",",
"isSmallObject",
"=",
"typeUtils",
".",
"isObject",
"(",
"small",
")",
";",
"if",
"(",
"isBigArray",
"&&",
"isSmallArray",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"l",
"=",
"small",
".",
"length",
";",
"i",
"<",
"l",
";",
"i",
"++",
")",
"{",
"if",
"(",
"!",
"this",
".",
"contains",
"(",
"big",
"[",
"i",
"]",
",",
"small",
"[",
"i",
"]",
")",
")",
"{",
"return",
"false",
";",
"}",
"}",
"}",
"else",
"if",
"(",
"isBigObject",
"&&",
"isSmallObject",
")",
"{",
"for",
"(",
"var",
"key",
"in",
"small",
")",
"{",
"if",
"(",
"small",
".",
"hasOwnProperty",
"(",
"key",
")",
")",
"{",
"if",
"(",
"key",
".",
"match",
"(",
"/",
":",
"/",
")",
")",
"{",
"continue",
";",
"}",
"if",
"(",
"small",
".",
"hasOwnProperty",
"(",
"key",
")",
")",
"{",
"if",
"(",
"!",
"this",
".",
"contains",
"(",
"big",
"[",
"key",
"]",
",",
"small",
"[",
"key",
"]",
")",
")",
"{",
"return",
"false",
";",
"}",
"}",
"}",
"}",
"}",
"else",
"{",
"var",
"allTime",
"=",
"(",
"typeUtils",
".",
"isDate",
"(",
"big",
")",
"&&",
"typeUtils",
".",
"isDate",
"(",
"small",
")",
")",
";",
"if",
"(",
"allTime",
")",
"{",
"return",
"(",
"small",
".",
"getTime",
"(",
")",
"===",
"big",
".",
"getTime",
"(",
")",
")",
";",
"}",
"else",
"{",
"return",
"small",
"===",
"big",
";",
"}",
"}",
"return",
"true",
";",
"}"
]
| Checks whether a JSON object is fully contained in another.
@param {Object} big the container JSON structure
@param {Object} small the contained JSON structure
@return {Boolean} true if <i>small</i> is contained in <i>big</i> | [
"Checks",
"whether",
"a",
"JSON",
"object",
"is",
"fully",
"contained",
"in",
"another",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/utils/Json.js#L969-L1000 | train |
|
ariatemplates/ariatemplates | src/aria/utils/Json.js | function (array, item, index) {
if (index == null) {
index = array.length;
}
this.splice(array, index, 0, item);
} | javascript | function (array, item, index) {
if (index == null) {
index = array.length;
}
this.splice(array, index, 0, item);
} | [
"function",
"(",
"array",
",",
"item",
",",
"index",
")",
"{",
"if",
"(",
"index",
"==",
"null",
")",
"{",
"index",
"=",
"array",
".",
"length",
";",
"}",
"this",
".",
"splice",
"(",
"array",
",",
"index",
",",
"0",
",",
"item",
")",
";",
"}"
]
| Add an item to an array, optionally giving the index, and notify listeners. If the index is not provided,
the item is added at the end of the array.
@param {Array} array array to be modified
@param {Object} item item to be added
@param {Number} index index where to add the item | [
"Add",
"an",
"item",
"to",
"an",
"array",
"optionally",
"giving",
"the",
"index",
"and",
"notify",
"listeners",
".",
"If",
"the",
"index",
"is",
"not",
"provided",
"the",
"item",
"is",
"added",
"at",
"the",
"end",
"of",
"the",
"array",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/utils/Json.js#L1009-L1014 | train |
|
ariatemplates/ariatemplates | src/aria/utils/Json.js | function (container) {
var raw = ariaUtilsObject.keys(container);
return ariaUtilsArray.filter(raw, function (key) {
return !aria.utils.Json.isMetadata(key);
});
} | javascript | function (container) {
var raw = ariaUtilsObject.keys(container);
return ariaUtilsArray.filter(raw, function (key) {
return !aria.utils.Json.isMetadata(key);
});
} | [
"function",
"(",
"container",
")",
"{",
"var",
"raw",
"=",
"ariaUtilsObject",
".",
"keys",
"(",
"container",
")",
";",
"return",
"ariaUtilsArray",
".",
"filter",
"(",
"raw",
",",
"function",
"(",
"key",
")",
"{",
"return",
"!",
"aria",
".",
"utils",
".",
"Json",
".",
"isMetadata",
"(",
"key",
")",
";",
"}",
")",
";",
"}"
]
| Retrieves all non metadata keys of a JSON object
@param {Object} container reference to the data holder object
@return {Array} an array containing all non metadata keys of the object
@see aria.utils.Object.keys | [
"Retrieves",
"all",
"non",
"metadata",
"keys",
"of",
"a",
"JSON",
"object"
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/utils/Json.js#L1041-L1046 | train |
|
ariatemplates/ariatemplates | src/aria/utils/Json.js | function (object) {
if (!object || !__isValidContainer(object)) {
return object;
}
var clone = typeUtils.isArray(object) ? [] : {};
for (var key in object) {
if (!this.isMetadata(key)) {
clone[key] = this.removeMetadata(object[key]);
}
}
return clone;
} | javascript | function (object) {
if (!object || !__isValidContainer(object)) {
return object;
}
var clone = typeUtils.isArray(object) ? [] : {};
for (var key in object) {
if (!this.isMetadata(key)) {
clone[key] = this.removeMetadata(object[key]);
}
}
return clone;
} | [
"function",
"(",
"object",
")",
"{",
"if",
"(",
"!",
"object",
"||",
"!",
"__isValidContainer",
"(",
"object",
")",
")",
"{",
"return",
"object",
";",
"}",
"var",
"clone",
"=",
"typeUtils",
".",
"isArray",
"(",
"object",
")",
"?",
"[",
"]",
":",
"{",
"}",
";",
"for",
"(",
"var",
"key",
"in",
"object",
")",
"{",
"if",
"(",
"!",
"this",
".",
"isMetadata",
"(",
"key",
")",
")",
"{",
"clone",
"[",
"key",
"]",
"=",
"this",
".",
"removeMetadata",
"(",
"object",
"[",
"key",
"]",
")",
";",
"}",
"}",
"return",
"clone",
";",
"}"
]
| Creates a copy of the object without metadata inside
@param {Object} object the object to copy
@return {Object} | [
"Creates",
"a",
"copy",
"of",
"the",
"object",
"without",
"metadata",
"inside"
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/utils/Json.js#L1065-L1076 | train |
|
ariatemplates/ariatemplates | src/aria/utils/Json.js | function( left, right) {
var isLeftArray = typeUtils.isArray(left),
isLeftObject = typeUtils.isObject(left),
isRightArray = typeUtils.isArray(right),
isRightObject = typeUtils.isObject(right),
leftDiff = null,
rightDiff = null,
__processContainer = function(list, __getKey) {
var key, diff;
for (var i = 0, l = list.length; i < l; i++) {
key = __getKey(i, list);
if ( (key.match && key.match(/:/)) || (left[key] === undefined && right[key] === undefined) ) {
continue;
}
diff = this.equalsDiff(left[key], right[key]);
if (!diff.equals) {
if (!leftDiff && !rightDiff) {
leftDiff = {};
rightDiff = {};
}
leftDiff[key] = diff.left;
rightDiff[key] = diff.right;
}
}
};
if (left === right) {
return {
equals : true,
left : null,
right : null
};
}
else if (isLeftArray && isRightArray) {
var longerList = left.length > right.length ? left : right;
__processContainer.call(this, longerList, function(i) { return i; });
return {
equals : leftDiff === null && rightDiff === null,
left : leftDiff,
right : rightDiff
};
} else if (isLeftObject && isRightObject) {
var allKeys = this.keys(left),
rightKeys = this.keys(right),
key;
for (var i = 0, l = rightKeys.length; i < l; i++) {
key = rightKeys[i];
if (left[key] === undefined) {
allKeys.push(key);
}
}
__processContainer.call(this, allKeys, function(i, keys) { return keys[i]; } );
return {
equals : leftDiff === null && rightDiff === null,
left : leftDiff,
right : rightDiff
};
} else if (typeUtils.isDate(right) && typeUtils.isDate(left)) {
if (left.getTime() === right.getTime()) {
return {
equals : true,
left : null,
right : null
};
}
}
return {
equals : false,
left : left,
right : right
};
} | javascript | function( left, right) {
var isLeftArray = typeUtils.isArray(left),
isLeftObject = typeUtils.isObject(left),
isRightArray = typeUtils.isArray(right),
isRightObject = typeUtils.isObject(right),
leftDiff = null,
rightDiff = null,
__processContainer = function(list, __getKey) {
var key, diff;
for (var i = 0, l = list.length; i < l; i++) {
key = __getKey(i, list);
if ( (key.match && key.match(/:/)) || (left[key] === undefined && right[key] === undefined) ) {
continue;
}
diff = this.equalsDiff(left[key], right[key]);
if (!diff.equals) {
if (!leftDiff && !rightDiff) {
leftDiff = {};
rightDiff = {};
}
leftDiff[key] = diff.left;
rightDiff[key] = diff.right;
}
}
};
if (left === right) {
return {
equals : true,
left : null,
right : null
};
}
else if (isLeftArray && isRightArray) {
var longerList = left.length > right.length ? left : right;
__processContainer.call(this, longerList, function(i) { return i; });
return {
equals : leftDiff === null && rightDiff === null,
left : leftDiff,
right : rightDiff
};
} else if (isLeftObject && isRightObject) {
var allKeys = this.keys(left),
rightKeys = this.keys(right),
key;
for (var i = 0, l = rightKeys.length; i < l; i++) {
key = rightKeys[i];
if (left[key] === undefined) {
allKeys.push(key);
}
}
__processContainer.call(this, allKeys, function(i, keys) { return keys[i]; } );
return {
equals : leftDiff === null && rightDiff === null,
left : leftDiff,
right : rightDiff
};
} else if (typeUtils.isDate(right) && typeUtils.isDate(left)) {
if (left.getTime() === right.getTime()) {
return {
equals : true,
left : null,
right : null
};
}
}
return {
equals : false,
left : left,
right : right
};
} | [
"function",
"(",
"left",
",",
"right",
")",
"{",
"var",
"isLeftArray",
"=",
"typeUtils",
".",
"isArray",
"(",
"left",
")",
",",
"isLeftObject",
"=",
"typeUtils",
".",
"isObject",
"(",
"left",
")",
",",
"isRightArray",
"=",
"typeUtils",
".",
"isArray",
"(",
"right",
")",
",",
"isRightObject",
"=",
"typeUtils",
".",
"isObject",
"(",
"right",
")",
",",
"leftDiff",
"=",
"null",
",",
"rightDiff",
"=",
"null",
",",
"__processContainer",
"=",
"function",
"(",
"list",
",",
"__getKey",
")",
"{",
"var",
"key",
",",
"diff",
";",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"l",
"=",
"list",
".",
"length",
";",
"i",
"<",
"l",
";",
"i",
"++",
")",
"{",
"key",
"=",
"__getKey",
"(",
"i",
",",
"list",
")",
";",
"if",
"(",
"(",
"key",
".",
"match",
"&&",
"key",
".",
"match",
"(",
"/",
":",
"/",
")",
")",
"||",
"(",
"left",
"[",
"key",
"]",
"===",
"undefined",
"&&",
"right",
"[",
"key",
"]",
"===",
"undefined",
")",
")",
"{",
"continue",
";",
"}",
"diff",
"=",
"this",
".",
"equalsDiff",
"(",
"left",
"[",
"key",
"]",
",",
"right",
"[",
"key",
"]",
")",
";",
"if",
"(",
"!",
"diff",
".",
"equals",
")",
"{",
"if",
"(",
"!",
"leftDiff",
"&&",
"!",
"rightDiff",
")",
"{",
"leftDiff",
"=",
"{",
"}",
";",
"rightDiff",
"=",
"{",
"}",
";",
"}",
"leftDiff",
"[",
"key",
"]",
"=",
"diff",
".",
"left",
";",
"rightDiff",
"[",
"key",
"]",
"=",
"diff",
".",
"right",
";",
"}",
"}",
"}",
";",
"if",
"(",
"left",
"===",
"right",
")",
"{",
"return",
"{",
"equals",
":",
"true",
",",
"left",
":",
"null",
",",
"right",
":",
"null",
"}",
";",
"}",
"else",
"if",
"(",
"isLeftArray",
"&&",
"isRightArray",
")",
"{",
"var",
"longerList",
"=",
"left",
".",
"length",
">",
"right",
".",
"length",
"?",
"left",
":",
"right",
";",
"__processContainer",
".",
"call",
"(",
"this",
",",
"longerList",
",",
"function",
"(",
"i",
")",
"{",
"return",
"i",
";",
"}",
")",
";",
"return",
"{",
"equals",
":",
"leftDiff",
"===",
"null",
"&&",
"rightDiff",
"===",
"null",
",",
"left",
":",
"leftDiff",
",",
"right",
":",
"rightDiff",
"}",
";",
"}",
"else",
"if",
"(",
"isLeftObject",
"&&",
"isRightObject",
")",
"{",
"var",
"allKeys",
"=",
"this",
".",
"keys",
"(",
"left",
")",
",",
"rightKeys",
"=",
"this",
".",
"keys",
"(",
"right",
")",
",",
"key",
";",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"l",
"=",
"rightKeys",
".",
"length",
";",
"i",
"<",
"l",
";",
"i",
"++",
")",
"{",
"key",
"=",
"rightKeys",
"[",
"i",
"]",
";",
"if",
"(",
"left",
"[",
"key",
"]",
"===",
"undefined",
")",
"{",
"allKeys",
".",
"push",
"(",
"key",
")",
";",
"}",
"}",
"__processContainer",
".",
"call",
"(",
"this",
",",
"allKeys",
",",
"function",
"(",
"i",
",",
"keys",
")",
"{",
"return",
"keys",
"[",
"i",
"]",
";",
"}",
")",
";",
"return",
"{",
"equals",
":",
"leftDiff",
"===",
"null",
"&&",
"rightDiff",
"===",
"null",
",",
"left",
":",
"leftDiff",
",",
"right",
":",
"rightDiff",
"}",
";",
"}",
"else",
"if",
"(",
"typeUtils",
".",
"isDate",
"(",
"right",
")",
"&&",
"typeUtils",
".",
"isDate",
"(",
"left",
")",
")",
"{",
"if",
"(",
"left",
".",
"getTime",
"(",
")",
"===",
"right",
".",
"getTime",
"(",
")",
")",
"{",
"return",
"{",
"equals",
":",
"true",
",",
"left",
":",
"null",
",",
"right",
":",
"null",
"}",
";",
"}",
"}",
"return",
"{",
"equals",
":",
"false",
",",
"left",
":",
"left",
",",
"right",
":",
"right",
"}",
";",
"}"
]
| Will determine whether two objects are equal and if not will provide the differences between the two.
A return object contains three properties, a boolean equals, an object left and an object right. If the
equals is true, the left and right objects will be null. If not, it will provide all the properties that
are in the left object and not in the right under the left property, and the similarly for right. If comparing
Arrays, they will be converted to Objects and only those indices that are different will be present in the results.
@param {Object} left - creates a diff of this object
@param {Object} right - the reference object to be used to check against
@return {Object} a report object containing the following properties:
{Boolean} equals - true or false whether these two objects are the same
{Object} left - the differences that are only in the left object
{Object} right - the differences that are only in the right object | [
"Will",
"determine",
"whether",
"two",
"objects",
"are",
"equal",
"and",
"if",
"not",
"will",
"provide",
"the",
"differences",
"between",
"the",
"two",
".",
"A",
"return",
"object",
"contains",
"three",
"properties",
"a",
"boolean",
"equals",
"an",
"object",
"left",
"and",
"an",
"object",
"right",
".",
"If",
"the",
"equals",
"is",
"true",
"the",
"left",
"and",
"right",
"objects",
"will",
"be",
"null",
".",
"If",
"not",
"it",
"will",
"provide",
"all",
"the",
"properties",
"that",
"are",
"in",
"the",
"left",
"object",
"and",
"not",
"in",
"the",
"right",
"under",
"the",
"left",
"property",
"and",
"the",
"similarly",
"for",
"right",
".",
"If",
"comparing",
"Arrays",
"they",
"will",
"be",
"converted",
"to",
"Objects",
"and",
"only",
"those",
"indices",
"that",
"are",
"different",
"will",
"be",
"present",
"in",
"the",
"results",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/utils/Json.js#L1091-L1162 | train |
|
ariatemplates/ariatemplates | src/aria/widgets/Template.js | function () {
var tplDiv = this._subTplDiv; // may be null at this time
if (tplDiv) {
tplDiv.className = "xTplContent"; // remove the loading indicator
ariaUtilsDom.replaceHTML(tplDiv, "#ERROR WHILE LOADING TEMPLATE#");
}
this._deleteTplcfg();
this.$callback(this.tplLoadCallback, {
success : false
});
} | javascript | function () {
var tplDiv = this._subTplDiv; // may be null at this time
if (tplDiv) {
tplDiv.className = "xTplContent"; // remove the loading indicator
ariaUtilsDom.replaceHTML(tplDiv, "#ERROR WHILE LOADING TEMPLATE#");
}
this._deleteTplcfg();
this.$callback(this.tplLoadCallback, {
success : false
});
} | [
"function",
"(",
")",
"{",
"var",
"tplDiv",
"=",
"this",
".",
"_subTplDiv",
";",
"if",
"(",
"tplDiv",
")",
"{",
"tplDiv",
".",
"className",
"=",
"\"xTplContent\"",
";",
"ariaUtilsDom",
".",
"replaceHTML",
"(",
"tplDiv",
",",
"\"#ERROR WHILE LOADING TEMPLATE#\"",
")",
";",
"}",
"this",
".",
"_deleteTplcfg",
"(",
")",
";",
"this",
".",
"$callback",
"(",
"this",
".",
"tplLoadCallback",
",",
"{",
"success",
":",
"false",
"}",
")",
";",
"}"
]
| Display an error message inside the template div. This might happen because the template context wasn't able
to initialize the template.
@protected | [
"Display",
"an",
"error",
"message",
"inside",
"the",
"template",
"div",
".",
"This",
"might",
"happen",
"because",
"the",
"template",
"context",
"wasn",
"t",
"able",
"to",
"initialize",
"the",
"template",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/widgets/Template.js#L154-L164 | train |
|
ariatemplates/ariatemplates | src/aria/widgets/Template.js | function () {
var tplcfg = this._tplcfg;
var cfg = this._cfg;
if (this._needCreatingModuleCtrl) {
if (!ariaCoreJsonValidator.normalize({
json : cfg.moduleCtrl,
beanName : "aria.templates.CfgBeans.InitModuleCtrl"
})) {
this._cfgOk = false;
return;
}
} else {
/* TODO: check that cfg.moduleCtrl is a module controller if it is not null */
tplcfg.moduleCtrl = cfg.moduleCtrl;
}
if (cfg.width > -1) {
tplcfg.width = cfg.width;
}
if (cfg.height > -1) {
tplcfg.height = cfg.height;
}
tplcfg.printOptions = cfg.printOptions;
tplcfg.baseTabIndex = cfg.baseTabIndex;
} | javascript | function () {
var tplcfg = this._tplcfg;
var cfg = this._cfg;
if (this._needCreatingModuleCtrl) {
if (!ariaCoreJsonValidator.normalize({
json : cfg.moduleCtrl,
beanName : "aria.templates.CfgBeans.InitModuleCtrl"
})) {
this._cfgOk = false;
return;
}
} else {
/* TODO: check that cfg.moduleCtrl is a module controller if it is not null */
tplcfg.moduleCtrl = cfg.moduleCtrl;
}
if (cfg.width > -1) {
tplcfg.width = cfg.width;
}
if (cfg.height > -1) {
tplcfg.height = cfg.height;
}
tplcfg.printOptions = cfg.printOptions;
tplcfg.baseTabIndex = cfg.baseTabIndex;
} | [
"function",
"(",
")",
"{",
"var",
"tplcfg",
"=",
"this",
".",
"_tplcfg",
";",
"var",
"cfg",
"=",
"this",
".",
"_cfg",
";",
"if",
"(",
"this",
".",
"_needCreatingModuleCtrl",
")",
"{",
"if",
"(",
"!",
"ariaCoreJsonValidator",
".",
"normalize",
"(",
"{",
"json",
":",
"cfg",
".",
"moduleCtrl",
",",
"beanName",
":",
"\"aria.templates.CfgBeans.InitModuleCtrl\"",
"}",
")",
")",
"{",
"this",
".",
"_cfgOk",
"=",
"false",
";",
"return",
";",
"}",
"}",
"else",
"{",
"tplcfg",
".",
"moduleCtrl",
"=",
"cfg",
".",
"moduleCtrl",
";",
"}",
"if",
"(",
"cfg",
".",
"width",
">",
"-",
"1",
")",
"{",
"tplcfg",
".",
"width",
"=",
"cfg",
".",
"width",
";",
"}",
"if",
"(",
"cfg",
".",
"height",
">",
"-",
"1",
")",
"{",
"tplcfg",
".",
"height",
"=",
"cfg",
".",
"height",
";",
"}",
"tplcfg",
".",
"printOptions",
"=",
"cfg",
".",
"printOptions",
";",
"tplcfg",
".",
"baseTabIndex",
"=",
"cfg",
".",
"baseTabIndex",
";",
"}"
]
| Verify that the configuration is valid. This will set this._cfgOk to either true or false
@protected | [
"Verify",
"that",
"the",
"configuration",
"is",
"valid",
".",
"This",
"will",
"set",
"this",
".",
"_cfgOk",
"to",
"either",
"true",
"or",
"false"
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/widgets/Template.js#L170-L193 | train |
|
ariatemplates/ariatemplates | src/aria/templates/SectionWrapper.js | function (domElt, sectionObject) {
if (domElt) {
while (domElt.nodeType != 1) {
domElt = domElt.parentNode;
}
}
this.$DomElementWrapper.constructor.call(this, domElt, sectionObject.tplCtxt);
/**
* Dynamically insert an adjacent section, without refreshing any other section.
* @param {String} where May be one of: beforeBegin, afterBegin, beforeEnd, afterEnd
* @param {String|aria.templates.CfgBeans:SectionCfg} sectionParam A string containing the new section id, or an
* object containing the new section configuration.
*/
this.insertAdjacentSection = function (where, sectionParam) {
if (where != "beforeBegin" && where != "afterBegin" && where != "beforeEnd" && where != "afterEnd") {
this.$logError(ariaUtilsDom.INSERT_ADJACENT_INVALID_POSITION, [where]);
return;
}
sectionObject.tplCtxt.insertAdjacentSections({
position : where,
refSection : {
domElt : domElt,
object : sectionObject
},
sections : [sectionParam]
});
};
/**
* Remove the section dynamically from the DOM.
*/
this.remove = function () {
sectionObject.$dispose();
var parentNode = domElt.parentNode;
ariaUtilsDom.removeElement(domElt);
ariaUtilsDom.refreshDomElt(parentNode);
this.$dispose();
};
/**
* Set the state of the processing indicator. It updates the datamodel if the section has a processing binding
* @param {Boolean} visible True if the loading indicator should be visible
* @param {String} message Text message to display inside the loading indicator
*/
this.setProcessingIndicator = function (visible, message) {
sectionObject.setProcessingIndicator(visible, message);
};
var parentClassListSetClassName = this.classList.setClassName;
this.classList.setClassName = function (className) {
parentClassListSetClassName.call(this, className);
sectionObject.updateClassList(className);
};
var parentDispose = this._dispose;
/**
* Clean the variables inside the closure.
* @private
*/
this._dispose = function () {
parentDispose.call(this);
sectionObject = null;
parentDispose = null;
};
} | javascript | function (domElt, sectionObject) {
if (domElt) {
while (domElt.nodeType != 1) {
domElt = domElt.parentNode;
}
}
this.$DomElementWrapper.constructor.call(this, domElt, sectionObject.tplCtxt);
/**
* Dynamically insert an adjacent section, without refreshing any other section.
* @param {String} where May be one of: beforeBegin, afterBegin, beforeEnd, afterEnd
* @param {String|aria.templates.CfgBeans:SectionCfg} sectionParam A string containing the new section id, or an
* object containing the new section configuration.
*/
this.insertAdjacentSection = function (where, sectionParam) {
if (where != "beforeBegin" && where != "afterBegin" && where != "beforeEnd" && where != "afterEnd") {
this.$logError(ariaUtilsDom.INSERT_ADJACENT_INVALID_POSITION, [where]);
return;
}
sectionObject.tplCtxt.insertAdjacentSections({
position : where,
refSection : {
domElt : domElt,
object : sectionObject
},
sections : [sectionParam]
});
};
/**
* Remove the section dynamically from the DOM.
*/
this.remove = function () {
sectionObject.$dispose();
var parentNode = domElt.parentNode;
ariaUtilsDom.removeElement(domElt);
ariaUtilsDom.refreshDomElt(parentNode);
this.$dispose();
};
/**
* Set the state of the processing indicator. It updates the datamodel if the section has a processing binding
* @param {Boolean} visible True if the loading indicator should be visible
* @param {String} message Text message to display inside the loading indicator
*/
this.setProcessingIndicator = function (visible, message) {
sectionObject.setProcessingIndicator(visible, message);
};
var parentClassListSetClassName = this.classList.setClassName;
this.classList.setClassName = function (className) {
parentClassListSetClassName.call(this, className);
sectionObject.updateClassList(className);
};
var parentDispose = this._dispose;
/**
* Clean the variables inside the closure.
* @private
*/
this._dispose = function () {
parentDispose.call(this);
sectionObject = null;
parentDispose = null;
};
} | [
"function",
"(",
"domElt",
",",
"sectionObject",
")",
"{",
"if",
"(",
"domElt",
")",
"{",
"while",
"(",
"domElt",
".",
"nodeType",
"!=",
"1",
")",
"{",
"domElt",
"=",
"domElt",
".",
"parentNode",
";",
"}",
"}",
"this",
".",
"$DomElementWrapper",
".",
"constructor",
".",
"call",
"(",
"this",
",",
"domElt",
",",
"sectionObject",
".",
"tplCtxt",
")",
";",
"this",
".",
"insertAdjacentSection",
"=",
"function",
"(",
"where",
",",
"sectionParam",
")",
"{",
"if",
"(",
"where",
"!=",
"\"beforeBegin\"",
"&&",
"where",
"!=",
"\"afterBegin\"",
"&&",
"where",
"!=",
"\"beforeEnd\"",
"&&",
"where",
"!=",
"\"afterEnd\"",
")",
"{",
"this",
".",
"$logError",
"(",
"ariaUtilsDom",
".",
"INSERT_ADJACENT_INVALID_POSITION",
",",
"[",
"where",
"]",
")",
";",
"return",
";",
"}",
"sectionObject",
".",
"tplCtxt",
".",
"insertAdjacentSections",
"(",
"{",
"position",
":",
"where",
",",
"refSection",
":",
"{",
"domElt",
":",
"domElt",
",",
"object",
":",
"sectionObject",
"}",
",",
"sections",
":",
"[",
"sectionParam",
"]",
"}",
")",
";",
"}",
";",
"this",
".",
"remove",
"=",
"function",
"(",
")",
"{",
"sectionObject",
".",
"$dispose",
"(",
")",
";",
"var",
"parentNode",
"=",
"domElt",
".",
"parentNode",
";",
"ariaUtilsDom",
".",
"removeElement",
"(",
"domElt",
")",
";",
"ariaUtilsDom",
".",
"refreshDomElt",
"(",
"parentNode",
")",
";",
"this",
".",
"$dispose",
"(",
")",
";",
"}",
";",
"this",
".",
"setProcessingIndicator",
"=",
"function",
"(",
"visible",
",",
"message",
")",
"{",
"sectionObject",
".",
"setProcessingIndicator",
"(",
"visible",
",",
"message",
")",
";",
"}",
";",
"var",
"parentClassListSetClassName",
"=",
"this",
".",
"classList",
".",
"setClassName",
";",
"this",
".",
"classList",
".",
"setClassName",
"=",
"function",
"(",
"className",
")",
"{",
"parentClassListSetClassName",
".",
"call",
"(",
"this",
",",
"className",
")",
";",
"sectionObject",
".",
"updateClassList",
"(",
"className",
")",
";",
"}",
";",
"var",
"parentDispose",
"=",
"this",
".",
"_dispose",
";",
"this",
".",
"_dispose",
"=",
"function",
"(",
")",
"{",
"parentDispose",
".",
"call",
"(",
"this",
")",
";",
"sectionObject",
"=",
"null",
";",
"parentDispose",
"=",
"null",
";",
"}",
";",
"}"
]
| Create a Wrapper object to allow safe changes in the DOM without giving direct access to the DOM. Note that a
closure is used to prevent access to the domElt object from the template.
@param {HTMLElement} domElt DOM element which is wrapped
@param {aria.templates.Section} sectionObject Section object which is wrapped | [
"Create",
"a",
"Wrapper",
"object",
"to",
"allow",
"safe",
"changes",
"in",
"the",
"DOM",
"without",
"giving",
"direct",
"access",
"to",
"the",
"DOM",
".",
"Note",
"that",
"a",
"closure",
"is",
"used",
"to",
"prevent",
"access",
"to",
"the",
"domElt",
"object",
"from",
"the",
"template",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/templates/SectionWrapper.js#L33-L98 | train |
|
ariatemplates/ariatemplates | src/aria/templates/CSSMgr.js | function (tplCtxt) {
this.$assert(133, tplCtxt.$TemplateCtxt);
var toLoad = tplCtxt.getCSSDependencies();
var tplClasspath = tplCtxt.tplClasspath;
var loadResult = this.loadClassPathDependencies(tplClasspath, toLoad, {
isTemplate : true
});
if (loadResult.changes) {
this.$raiseEvent({
name : "styleChange",
templateClasspath : tplClasspath
});
}
this.$raiseEvent({
name : "dependenciesLoaded",
templateClasspath : tplClasspath
});
return loadResult.classes;
} | javascript | function (tplCtxt) {
this.$assert(133, tplCtxt.$TemplateCtxt);
var toLoad = tplCtxt.getCSSDependencies();
var tplClasspath = tplCtxt.tplClasspath;
var loadResult = this.loadClassPathDependencies(tplClasspath, toLoad, {
isTemplate : true
});
if (loadResult.changes) {
this.$raiseEvent({
name : "styleChange",
templateClasspath : tplClasspath
});
}
this.$raiseEvent({
name : "dependenciesLoaded",
templateClasspath : tplClasspath
});
return loadResult.classes;
} | [
"function",
"(",
"tplCtxt",
")",
"{",
"this",
".",
"$assert",
"(",
"133",
",",
"tplCtxt",
".",
"$TemplateCtxt",
")",
";",
"var",
"toLoad",
"=",
"tplCtxt",
".",
"getCSSDependencies",
"(",
")",
";",
"var",
"tplClasspath",
"=",
"tplCtxt",
".",
"tplClasspath",
";",
"var",
"loadResult",
"=",
"this",
".",
"loadClassPathDependencies",
"(",
"tplClasspath",
",",
"toLoad",
",",
"{",
"isTemplate",
":",
"true",
"}",
")",
";",
"if",
"(",
"loadResult",
".",
"changes",
")",
"{",
"this",
".",
"$raiseEvent",
"(",
"{",
"name",
":",
"\"styleChange\"",
",",
"templateClasspath",
":",
"tplClasspath",
"}",
")",
";",
"}",
"this",
".",
"$raiseEvent",
"(",
"{",
"name",
":",
"\"dependenciesLoaded\"",
",",
"templateClasspath",
":",
"tplClasspath",
"}",
")",
";",
"return",
"loadResult",
".",
"classes",
";",
"}"
]
| Load the CSS dependencies of a template, it will prefix the CSS selectors and generate a style tag in the
head.
@param {aria.templates.TemplateCtxt} tplCtxt template context
@return {Array} Array of class prefixes | [
"Load",
"the",
"CSS",
"dependencies",
"of",
"a",
"template",
"it",
"will",
"prefix",
"the",
"CSS",
"selectors",
"and",
"generate",
"a",
"style",
"tag",
"in",
"the",
"head",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/templates/CSSMgr.js#L236-L258 | train |
|
ariatemplates/ariatemplates | src/aria/templates/CSSMgr.js | function (classpath, dependencies) {
if (this.__cssDependencies[classpath]) {
dependencies = this.__cssDependencies[classpath];
} else {
// Look at in the parents for the css inheritance.
var tpl = Aria.getClassRef(classpath);
var css = {};
if (dependencies) {
for (var i = 0, ii = dependencies.length; i < ii; i++) {
css[Aria.getClasspath(dependencies[i])] = true;
}
}
tpl = tpl.superclass;
while (tpl) {
var $css = tpl.$css;
if ($css) {
for (var i = 0, ii = $css.length; i < ii; i++) {
css[Aria.getClasspath($css[i])] = true;
}
}
tpl = tpl.constructor.superclass;
}
dependencies = ariaUtilsObject.keys(css);
// Store the css dependencies for performance reason
this.__cssDependencies[classpath] = dependencies;
}
var contextArgs = {
isWidget : true
};
this.loadClassPathDependencies(classpath, dependencies, contextArgs);
} | javascript | function (classpath, dependencies) {
if (this.__cssDependencies[classpath]) {
dependencies = this.__cssDependencies[classpath];
} else {
// Look at in the parents for the css inheritance.
var tpl = Aria.getClassRef(classpath);
var css = {};
if (dependencies) {
for (var i = 0, ii = dependencies.length; i < ii; i++) {
css[Aria.getClasspath(dependencies[i])] = true;
}
}
tpl = tpl.superclass;
while (tpl) {
var $css = tpl.$css;
if ($css) {
for (var i = 0, ii = $css.length; i < ii; i++) {
css[Aria.getClasspath($css[i])] = true;
}
}
tpl = tpl.constructor.superclass;
}
dependencies = ariaUtilsObject.keys(css);
// Store the css dependencies for performance reason
this.__cssDependencies[classpath] = dependencies;
}
var contextArgs = {
isWidget : true
};
this.loadClassPathDependencies(classpath, dependencies, contextArgs);
} | [
"function",
"(",
"classpath",
",",
"dependencies",
")",
"{",
"if",
"(",
"this",
".",
"__cssDependencies",
"[",
"classpath",
"]",
")",
"{",
"dependencies",
"=",
"this",
".",
"__cssDependencies",
"[",
"classpath",
"]",
";",
"}",
"else",
"{",
"var",
"tpl",
"=",
"Aria",
".",
"getClassRef",
"(",
"classpath",
")",
";",
"var",
"css",
"=",
"{",
"}",
";",
"if",
"(",
"dependencies",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"ii",
"=",
"dependencies",
".",
"length",
";",
"i",
"<",
"ii",
";",
"i",
"++",
")",
"{",
"css",
"[",
"Aria",
".",
"getClasspath",
"(",
"dependencies",
"[",
"i",
"]",
")",
"]",
"=",
"true",
";",
"}",
"}",
"tpl",
"=",
"tpl",
".",
"superclass",
";",
"while",
"(",
"tpl",
")",
"{",
"var",
"$css",
"=",
"tpl",
".",
"$css",
";",
"if",
"(",
"$css",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"ii",
"=",
"$css",
".",
"length",
";",
"i",
"<",
"ii",
";",
"i",
"++",
")",
"{",
"css",
"[",
"Aria",
".",
"getClasspath",
"(",
"$css",
"[",
"i",
"]",
")",
"]",
"=",
"true",
";",
"}",
"}",
"tpl",
"=",
"tpl",
".",
"constructor",
".",
"superclass",
";",
"}",
"dependencies",
"=",
"ariaUtilsObject",
".",
"keys",
"(",
"css",
")",
";",
"this",
".",
"__cssDependencies",
"[",
"classpath",
"]",
"=",
"dependencies",
";",
"}",
"var",
"contextArgs",
"=",
"{",
"isWidget",
":",
"true",
"}",
";",
"this",
".",
"loadClassPathDependencies",
"(",
"classpath",
",",
"dependencies",
",",
"contextArgs",
")",
";",
"}"
]
| Load the CSS dependencies of a Widget. It won't prefix the CSS selectors
@param {String} classpath Classpath of the widget
@param {Array} dependencies Array of CSS template classpaths to be loaded | [
"Load",
"the",
"CSS",
"dependencies",
"of",
"a",
"Widget",
".",
"It",
"won",
"t",
"prefix",
"the",
"CSS",
"selectors"
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/templates/CSSMgr.js#L265-L301 | train |
|
ariatemplates/ariatemplates | src/aria/templates/CSSMgr.js | function (tplClasspath, cssClasspath, contextArgs) {
this.$assert(195, tplClasspath && cssClasspath);
// Do something only if this CSS class is not yet loaded
var usage = this.__cssUsage[cssClasspath];
if (usage && usage.length) {
usage.push(tplClasspath);
this.__pathsLoaded.push(cssClasspath);
if (!this.__invalidClasspaths[cssClasspath]) {
return [];
}
} else {
this.__cssUsage[cssClasspath] = [tplClasspath];
}
// Starting from here, nobody is using this css, it should also be added to the DOM
// classpath may be invalid but not currently used
delete this.__invalidClasspaths[cssClasspath];
var cssCtxt = ariaTemplatesCSSCtxtManager.getContext(cssClasspath, contextArgs);
// Give a prefix to the Global file in order to have higher priority
if (cssClasspath == "aria.templates.GlobalStyle" || cssClasspath == "aria.templates.LegacyGeneralStyle"
|| cssClasspath == "aria.widgets.GlobalStyle") {
this.__getPrefix(cssClasspath);
}
if (cssCtxt.doPrefixing()) {
var prefixClass = this.__getPrefix(cssClasspath);
cssCtxt.prefixText(prefixClass);
}
// Remember the text to be loaded
this.__textLoaded[cssClasspath] = {
text : cssCtxt.getText(),
lines : cssCtxt.getNumLines()
};
// Build the association between this classpath and a style tag
var styleTag = this.__getStyleTag(cssCtxt);
this.__styleTagAssociation[cssClasspath] = styleTag;
this.__pathsLoaded.push(cssClasspath);
return [styleTag];
} | javascript | function (tplClasspath, cssClasspath, contextArgs) {
this.$assert(195, tplClasspath && cssClasspath);
// Do something only if this CSS class is not yet loaded
var usage = this.__cssUsage[cssClasspath];
if (usage && usage.length) {
usage.push(tplClasspath);
this.__pathsLoaded.push(cssClasspath);
if (!this.__invalidClasspaths[cssClasspath]) {
return [];
}
} else {
this.__cssUsage[cssClasspath] = [tplClasspath];
}
// Starting from here, nobody is using this css, it should also be added to the DOM
// classpath may be invalid but not currently used
delete this.__invalidClasspaths[cssClasspath];
var cssCtxt = ariaTemplatesCSSCtxtManager.getContext(cssClasspath, contextArgs);
// Give a prefix to the Global file in order to have higher priority
if (cssClasspath == "aria.templates.GlobalStyle" || cssClasspath == "aria.templates.LegacyGeneralStyle"
|| cssClasspath == "aria.widgets.GlobalStyle") {
this.__getPrefix(cssClasspath);
}
if (cssCtxt.doPrefixing()) {
var prefixClass = this.__getPrefix(cssClasspath);
cssCtxt.prefixText(prefixClass);
}
// Remember the text to be loaded
this.__textLoaded[cssClasspath] = {
text : cssCtxt.getText(),
lines : cssCtxt.getNumLines()
};
// Build the association between this classpath and a style tag
var styleTag = this.__getStyleTag(cssCtxt);
this.__styleTagAssociation[cssClasspath] = styleTag;
this.__pathsLoaded.push(cssClasspath);
return [styleTag];
} | [
"function",
"(",
"tplClasspath",
",",
"cssClasspath",
",",
"contextArgs",
")",
"{",
"this",
".",
"$assert",
"(",
"195",
",",
"tplClasspath",
"&&",
"cssClasspath",
")",
";",
"var",
"usage",
"=",
"this",
".",
"__cssUsage",
"[",
"cssClasspath",
"]",
";",
"if",
"(",
"usage",
"&&",
"usage",
".",
"length",
")",
"{",
"usage",
".",
"push",
"(",
"tplClasspath",
")",
";",
"this",
".",
"__pathsLoaded",
".",
"push",
"(",
"cssClasspath",
")",
";",
"if",
"(",
"!",
"this",
".",
"__invalidClasspaths",
"[",
"cssClasspath",
"]",
")",
"{",
"return",
"[",
"]",
";",
"}",
"}",
"else",
"{",
"this",
".",
"__cssUsage",
"[",
"cssClasspath",
"]",
"=",
"[",
"tplClasspath",
"]",
";",
"}",
"delete",
"this",
".",
"__invalidClasspaths",
"[",
"cssClasspath",
"]",
";",
"var",
"cssCtxt",
"=",
"ariaTemplatesCSSCtxtManager",
".",
"getContext",
"(",
"cssClasspath",
",",
"contextArgs",
")",
";",
"if",
"(",
"cssClasspath",
"==",
"\"aria.templates.GlobalStyle\"",
"||",
"cssClasspath",
"==",
"\"aria.templates.LegacyGeneralStyle\"",
"||",
"cssClasspath",
"==",
"\"aria.widgets.GlobalStyle\"",
")",
"{",
"this",
".",
"__getPrefix",
"(",
"cssClasspath",
")",
";",
"}",
"if",
"(",
"cssCtxt",
".",
"doPrefixing",
"(",
")",
")",
"{",
"var",
"prefixClass",
"=",
"this",
".",
"__getPrefix",
"(",
"cssClasspath",
")",
";",
"cssCtxt",
".",
"prefixText",
"(",
"prefixClass",
")",
";",
"}",
"this",
".",
"__textLoaded",
"[",
"cssClasspath",
"]",
"=",
"{",
"text",
":",
"cssCtxt",
".",
"getText",
"(",
")",
",",
"lines",
":",
"cssCtxt",
".",
"getNumLines",
"(",
")",
"}",
";",
"var",
"styleTag",
"=",
"this",
".",
"__getStyleTag",
"(",
"cssCtxt",
")",
";",
"this",
".",
"__styleTagAssociation",
"[",
"cssClasspath",
"]",
"=",
"styleTag",
";",
"this",
".",
"__pathsLoaded",
".",
"push",
"(",
"cssClasspath",
")",
";",
"return",
"[",
"styleTag",
"]",
";",
"}"
]
| Mark a CSS template dependency as "to be loaded". If it's already loaded this will simply register a new
dependency, otherwise it will buffer the changes that should be applied to the style tag or the pool of
styles
@param {String} tplClasspath Template classpath
@param {String} cssClasspath CSS template classpath
@return {Array} An array of tag pool's id that require a refresh
@private | [
"Mark",
"a",
"CSS",
"template",
"dependency",
"as",
"to",
"be",
"loaded",
".",
"If",
"it",
"s",
"already",
"loaded",
"this",
"will",
"simply",
"register",
"a",
"new",
"dependency",
"otherwise",
"it",
"will",
"buffer",
"the",
"changes",
"that",
"should",
"be",
"applied",
"to",
"the",
"style",
"tag",
"or",
"the",
"pool",
"of",
"styles"
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/templates/CSSMgr.js#L361-L404 | train |
|
ariatemplates/ariatemplates | src/aria/templates/CSSMgr.js | function (cssCtxt) {
var classpath = cssCtxt.tplClasspath;
var associatedTo = this.__styleTagAssociation[classpath];
if (associatedTo) {
return associatedTo;
}
if (cssCtxt.isTemplate()) {
associatedTo = "tpl";
} else if (cssCtxt.isWidget()) {
associatedTo = "wgt";
} else {
associatedTo = "pool" + this.__NEXT_TAG_INDEX;
this.__NEXT_TAG_INDEX += 1;
}
return associatedTo;
} | javascript | function (cssCtxt) {
var classpath = cssCtxt.tplClasspath;
var associatedTo = this.__styleTagAssociation[classpath];
if (associatedTo) {
return associatedTo;
}
if (cssCtxt.isTemplate()) {
associatedTo = "tpl";
} else if (cssCtxt.isWidget()) {
associatedTo = "wgt";
} else {
associatedTo = "pool" + this.__NEXT_TAG_INDEX;
this.__NEXT_TAG_INDEX += 1;
}
return associatedTo;
} | [
"function",
"(",
"cssCtxt",
")",
"{",
"var",
"classpath",
"=",
"cssCtxt",
".",
"tplClasspath",
";",
"var",
"associatedTo",
"=",
"this",
".",
"__styleTagAssociation",
"[",
"classpath",
"]",
";",
"if",
"(",
"associatedTo",
")",
"{",
"return",
"associatedTo",
";",
"}",
"if",
"(",
"cssCtxt",
".",
"isTemplate",
"(",
")",
")",
"{",
"associatedTo",
"=",
"\"tpl\"",
";",
"}",
"else",
"if",
"(",
"cssCtxt",
".",
"isWidget",
"(",
")",
")",
"{",
"associatedTo",
"=",
"\"wgt\"",
";",
"}",
"else",
"{",
"associatedTo",
"=",
"\"pool\"",
"+",
"this",
".",
"__NEXT_TAG_INDEX",
";",
"this",
".",
"__NEXT_TAG_INDEX",
"+=",
"1",
";",
"}",
"return",
"associatedTo",
";",
"}"
]
| Get the style tag id for a CSS classpath
@param {aria.templates.CSSCtxt} cssCtxt CSS Template Context | [
"Get",
"the",
"style",
"tag",
"id",
"for",
"a",
"CSS",
"classpath"
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/templates/CSSMgr.js#L410-L428 | train |
|
ariatemplates/ariatemplates | src/aria/templates/CSSMgr.js | function (classpath, dependencies) {
if (this.__cssDependencies[classpath]) {
dependencies = this.__cssDependencies[classpath];
}
this.unloadClassPathDependencies(classpath, dependencies);
} | javascript | function (classpath, dependencies) {
if (this.__cssDependencies[classpath]) {
dependencies = this.__cssDependencies[classpath];
}
this.unloadClassPathDependencies(classpath, dependencies);
} | [
"function",
"(",
"classpath",
",",
"dependencies",
")",
"{",
"if",
"(",
"this",
".",
"__cssDependencies",
"[",
"classpath",
"]",
")",
"{",
"dependencies",
"=",
"this",
".",
"__cssDependencies",
"[",
"classpath",
"]",
";",
"}",
"this",
".",
"unloadClassPathDependencies",
"(",
"classpath",
",",
"dependencies",
")",
";",
"}"
]
| Unload the CSS dependencies of a widget. This method will unload any dependency on the parent widgets.
@param {String} classpath Classpath of the widget
@param {Array} dependencies Array of CSS template classpaths to be loaded | [
"Unload",
"the",
"CSS",
"dependencies",
"of",
"a",
"widget",
".",
"This",
"method",
"will",
"unload",
"any",
"dependency",
"on",
"the",
"parent",
"widgets",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/templates/CSSMgr.js#L435-L441 | train |
|
ariatemplates/ariatemplates | src/aria/templates/CSSMgr.js | function (classpath, dependencies) {
if (!dependencies) {
return;
}
for (var i = 0, len = dependencies.length; i < len; i += 1) {
var cssClasspath = Aria.getClasspath(dependencies[i]);
this.__unload(classpath, cssClasspath);
}
} | javascript | function (classpath, dependencies) {
if (!dependencies) {
return;
}
for (var i = 0, len = dependencies.length; i < len; i += 1) {
var cssClasspath = Aria.getClasspath(dependencies[i]);
this.__unload(classpath, cssClasspath);
}
} | [
"function",
"(",
"classpath",
",",
"dependencies",
")",
"{",
"if",
"(",
"!",
"dependencies",
")",
"{",
"return",
";",
"}",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"len",
"=",
"dependencies",
".",
"length",
";",
"i",
"<",
"len",
";",
"i",
"+=",
"1",
")",
"{",
"var",
"cssClasspath",
"=",
"Aria",
".",
"getClasspath",
"(",
"dependencies",
"[",
"i",
"]",
")",
";",
"this",
".",
"__unload",
"(",
"classpath",
",",
"cssClasspath",
")",
";",
"}",
"}"
]
| Unload the CSS dependencies of any classpath. This method is not observable through events. This function
does not trigger a DOM update. CSS style elements are only removed if not needed during the next CSS
insertion.
@param {String} classpath Classpath on which the CSS templates depends on
@param {Array} dependencies Array of CSS templates to be removed | [
"Unload",
"the",
"CSS",
"dependencies",
"of",
"any",
"classpath",
".",
"This",
"method",
"is",
"not",
"observable",
"through",
"events",
".",
"This",
"function",
"does",
"not",
"trigger",
"a",
"DOM",
"update",
".",
"CSS",
"style",
"elements",
"are",
"only",
"removed",
"if",
"not",
"needed",
"during",
"the",
"next",
"CSS",
"insertion",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/templates/CSSMgr.js#L450-L459 | train |
|
ariatemplates/ariatemplates | src/aria/templates/CSSMgr.js | function (tplCtxt) {
this.$assert(169, tplCtxt.$TemplateCtxt);
var unload = tplCtxt.getCSSDependencies();
var tplClasspath = tplCtxt.tplClasspath;
this.unloadClassPathDependencies(tplClasspath, unload);
this.$raiseEvent({
name : "dependenciesUnloaded",
templateClasspath : tplClasspath
});
} | javascript | function (tplCtxt) {
this.$assert(169, tplCtxt.$TemplateCtxt);
var unload = tplCtxt.getCSSDependencies();
var tplClasspath = tplCtxt.tplClasspath;
this.unloadClassPathDependencies(tplClasspath, unload);
this.$raiseEvent({
name : "dependenciesUnloaded",
templateClasspath : tplClasspath
});
} | [
"function",
"(",
"tplCtxt",
")",
"{",
"this",
".",
"$assert",
"(",
"169",
",",
"tplCtxt",
".",
"$TemplateCtxt",
")",
";",
"var",
"unload",
"=",
"tplCtxt",
".",
"getCSSDependencies",
"(",
")",
";",
"var",
"tplClasspath",
"=",
"tplCtxt",
".",
"tplClasspath",
";",
"this",
".",
"unloadClassPathDependencies",
"(",
"tplClasspath",
",",
"unload",
")",
";",
"this",
".",
"$raiseEvent",
"(",
"{",
"name",
":",
"\"dependenciesUnloaded\"",
",",
"templateClasspath",
":",
"tplClasspath",
"}",
")",
";",
"}"
]
| Unload all the CSS dependencies of a template. This function does not trigger a DOM update. CSS style
elements are only removed if not needed during the next CSS insertion.
@param {aria.templates.TemplateCtxt} tplCtxt template context | [
"Unload",
"all",
"the",
"CSS",
"dependencies",
"of",
"a",
"template",
".",
"This",
"function",
"does",
"not",
"trigger",
"a",
"DOM",
"update",
".",
"CSS",
"style",
"elements",
"are",
"only",
"removed",
"if",
"not",
"needed",
"during",
"the",
"next",
"CSS",
"insertion",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/templates/CSSMgr.js#L466-L478 | train |
|
ariatemplates/ariatemplates | src/aria/templates/CSSMgr.js | function (cssClasspath) {
var prefixClass = this.__prefixes[cssClasspath];
if (!prefixClass) {
prefixClass = this.__PREFIX + this.__NEXT_PREFIX_INDEX;
this.__NEXT_PREFIX_INDEX += 1;
this.__prefixes[cssClasspath] = prefixClass;
}
return prefixClass;
} | javascript | function (cssClasspath) {
var prefixClass = this.__prefixes[cssClasspath];
if (!prefixClass) {
prefixClass = this.__PREFIX + this.__NEXT_PREFIX_INDEX;
this.__NEXT_PREFIX_INDEX += 1;
this.__prefixes[cssClasspath] = prefixClass;
}
return prefixClass;
} | [
"function",
"(",
"cssClasspath",
")",
"{",
"var",
"prefixClass",
"=",
"this",
".",
"__prefixes",
"[",
"cssClasspath",
"]",
";",
"if",
"(",
"!",
"prefixClass",
")",
"{",
"prefixClass",
"=",
"this",
".",
"__PREFIX",
"+",
"this",
".",
"__NEXT_PREFIX_INDEX",
";",
"this",
".",
"__NEXT_PREFIX_INDEX",
"+=",
"1",
";",
"this",
".",
"__prefixes",
"[",
"cssClasspath",
"]",
"=",
"prefixClass",
";",
"}",
"return",
"prefixClass",
";",
"}"
]
| Get the prefix for a CSS template.
@param {String} cssClasspath CSS template classpath
@return {String) class used as a prefix
@private | [
"Get",
"the",
"prefix",
"for",
"a",
"CSS",
"template",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/templates/CSSMgr.js#L486-L496 | train |
|
ariatemplates/ariatemplates | src/aria/templates/CSSMgr.js | function (tplClasspath, cssClasspath) {
this.$assert(230, tplClasspath && cssClasspath);
var removeUtil = ariaUtilsArray.remove;
// There should be someone using this css
var usage = this.__cssUsage[cssClasspath];
if (usage && usage.length) {
removeUtil(usage, tplClasspath);
removeUtil(this.__pathsLoaded, cssClasspath);
if (!usage.length) {
// No other templates depend on this class
delete this.__cssUsage[cssClasspath];
delete this.__textLoaded[cssClasspath];
// keep the prefix in case the css comes back
}
} // else should never be reached
} | javascript | function (tplClasspath, cssClasspath) {
this.$assert(230, tplClasspath && cssClasspath);
var removeUtil = ariaUtilsArray.remove;
// There should be someone using this css
var usage = this.__cssUsage[cssClasspath];
if (usage && usage.length) {
removeUtil(usage, tplClasspath);
removeUtil(this.__pathsLoaded, cssClasspath);
if (!usage.length) {
// No other templates depend on this class
delete this.__cssUsage[cssClasspath];
delete this.__textLoaded[cssClasspath];
// keep the prefix in case the css comes back
}
} // else should never be reached
} | [
"function",
"(",
"tplClasspath",
",",
"cssClasspath",
")",
"{",
"this",
".",
"$assert",
"(",
"230",
",",
"tplClasspath",
"&&",
"cssClasspath",
")",
";",
"var",
"removeUtil",
"=",
"ariaUtilsArray",
".",
"remove",
";",
"var",
"usage",
"=",
"this",
".",
"__cssUsage",
"[",
"cssClasspath",
"]",
";",
"if",
"(",
"usage",
"&&",
"usage",
".",
"length",
")",
"{",
"removeUtil",
"(",
"usage",
",",
"tplClasspath",
")",
";",
"removeUtil",
"(",
"this",
".",
"__pathsLoaded",
",",
"cssClasspath",
")",
";",
"if",
"(",
"!",
"usage",
".",
"length",
")",
"{",
"delete",
"this",
".",
"__cssUsage",
"[",
"cssClasspath",
"]",
";",
"delete",
"this",
".",
"__textLoaded",
"[",
"cssClasspath",
"]",
";",
"}",
"}",
"}"
]
| Update the private properties to mark a CSS template as unloaded. It won't update the list of prefixes
@param {String} tplClasspath Template classpath
@param {String} cssClasspath CSS template classpath
@private | [
"Update",
"the",
"private",
"properties",
"to",
"mark",
"a",
"CSS",
"template",
"as",
"unloaded",
".",
"It",
"won",
"t",
"update",
"the",
"list",
"of",
"prefixes"
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/templates/CSSMgr.js#L504-L521 | train |
|
ariatemplates/ariatemplates | src/aria/templates/CSSMgr.js | function (tagName) {
// A pointer to the style might be already there or an element with the correct id might be there
var tag = this.__styleTagPool[tagName];
if (!tag) {
var id = this.__TAG_PREFX + tagName;
tag = ariaUtilsDom.getElementById(id);
if (!tag) {
// If missing, create one
var document = Aria.$window.document;
var head = document.getElementsByTagName("head")[0];
tag = document.createElement("style");
tag.id = id;
tag.type = "text/css";
tag.media = "all"; // needed as the default media is screen in FF but all in IE
head.appendChild(tag);
tag = head.lastChild;
}
this.__styleTagPool[tagName] = tag;
}
return tag;
} | javascript | function (tagName) {
// A pointer to the style might be already there or an element with the correct id might be there
var tag = this.__styleTagPool[tagName];
if (!tag) {
var id = this.__TAG_PREFX + tagName;
tag = ariaUtilsDom.getElementById(id);
if (!tag) {
// If missing, create one
var document = Aria.$window.document;
var head = document.getElementsByTagName("head")[0];
tag = document.createElement("style");
tag.id = id;
tag.type = "text/css";
tag.media = "all"; // needed as the default media is screen in FF but all in IE
head.appendChild(tag);
tag = head.lastChild;
}
this.__styleTagPool[tagName] = tag;
}
return tag;
} | [
"function",
"(",
"tagName",
")",
"{",
"var",
"tag",
"=",
"this",
".",
"__styleTagPool",
"[",
"tagName",
"]",
";",
"if",
"(",
"!",
"tag",
")",
"{",
"var",
"id",
"=",
"this",
".",
"__TAG_PREFX",
"+",
"tagName",
";",
"tag",
"=",
"ariaUtilsDom",
".",
"getElementById",
"(",
"id",
")",
";",
"if",
"(",
"!",
"tag",
")",
"{",
"var",
"document",
"=",
"Aria",
".",
"$window",
".",
"document",
";",
"var",
"head",
"=",
"document",
".",
"getElementsByTagName",
"(",
"\"head\"",
")",
"[",
"0",
"]",
";",
"tag",
"=",
"document",
".",
"createElement",
"(",
"\"style\"",
")",
";",
"tag",
".",
"id",
"=",
"id",
";",
"tag",
".",
"type",
"=",
"\"text/css\"",
";",
"tag",
".",
"media",
"=",
"\"all\"",
";",
"head",
".",
"appendChild",
"(",
"tag",
")",
";",
"tag",
"=",
"head",
".",
"lastChild",
";",
"}",
"this",
".",
"__styleTagPool",
"[",
"tagName",
"]",
"=",
"tag",
";",
"}",
"return",
"tag",
";",
"}"
]
| Get the HTMLElement associated to a tag id. If it is missing it will be added to the DOM
@param {String} tagName Id of the tag
@return {HTMLElement} style tag
@private | [
"Get",
"the",
"HTMLElement",
"associated",
"to",
"a",
"tag",
"id",
".",
"If",
"it",
"is",
"missing",
"it",
"will",
"be",
"added",
"to",
"the",
"DOM"
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/templates/CSSMgr.js#L654-L680 | train |
|
ariatemplates/ariatemplates | src/aria/templates/CSSMgr.js | function () {
// Remove the style tags from the DOM
for (var tagName in this.__styleTagPool) {
if (this.__styleTagPool.hasOwnProperty(tagName)) {
this.__styleTagPool[tagName].parentNode.removeChild(this.__styleTagPool[tagName]);
}
}
if (this.__attachedToWindow) {
ariaUtilsAriaWindow.detachWindow();
this.__attachedToWindow = false;
}
this.__styleTagPool = {};
// Reset the variables
this.__textLoaded = {};
this.__pathsLoaded = [];
this.__prefixes = {};
this.__cssUsage = {};
this.__styleTagAssociation = {};
this.__invalidClasspaths = {};
this.__cssDependencies = {};
// Reset also the singletons
this.__PREFIX = this.classDefinition.$statics.__PREFIX;
this.__NEXT_PREFIX_INDEX = this.classDefinition.$statics.__NEXT_PREFIX_INDEX;
this.__NEXT_TAG_INDEX = this.classDefinition.$statics.__NEXT_TAG_INDEX;
this.__TAG_PREFX = this.classDefinition.$statics.__TAG_PREFX;
} | javascript | function () {
// Remove the style tags from the DOM
for (var tagName in this.__styleTagPool) {
if (this.__styleTagPool.hasOwnProperty(tagName)) {
this.__styleTagPool[tagName].parentNode.removeChild(this.__styleTagPool[tagName]);
}
}
if (this.__attachedToWindow) {
ariaUtilsAriaWindow.detachWindow();
this.__attachedToWindow = false;
}
this.__styleTagPool = {};
// Reset the variables
this.__textLoaded = {};
this.__pathsLoaded = [];
this.__prefixes = {};
this.__cssUsage = {};
this.__styleTagAssociation = {};
this.__invalidClasspaths = {};
this.__cssDependencies = {};
// Reset also the singletons
this.__PREFIX = this.classDefinition.$statics.__PREFIX;
this.__NEXT_PREFIX_INDEX = this.classDefinition.$statics.__NEXT_PREFIX_INDEX;
this.__NEXT_TAG_INDEX = this.classDefinition.$statics.__NEXT_TAG_INDEX;
this.__TAG_PREFX = this.classDefinition.$statics.__TAG_PREFX;
} | [
"function",
"(",
")",
"{",
"for",
"(",
"var",
"tagName",
"in",
"this",
".",
"__styleTagPool",
")",
"{",
"if",
"(",
"this",
".",
"__styleTagPool",
".",
"hasOwnProperty",
"(",
"tagName",
")",
")",
"{",
"this",
".",
"__styleTagPool",
"[",
"tagName",
"]",
".",
"parentNode",
".",
"removeChild",
"(",
"this",
".",
"__styleTagPool",
"[",
"tagName",
"]",
")",
";",
"}",
"}",
"if",
"(",
"this",
".",
"__attachedToWindow",
")",
"{",
"ariaUtilsAriaWindow",
".",
"detachWindow",
"(",
")",
";",
"this",
".",
"__attachedToWindow",
"=",
"false",
";",
"}",
"this",
".",
"__styleTagPool",
"=",
"{",
"}",
";",
"this",
".",
"__textLoaded",
"=",
"{",
"}",
";",
"this",
".",
"__pathsLoaded",
"=",
"[",
"]",
";",
"this",
".",
"__prefixes",
"=",
"{",
"}",
";",
"this",
".",
"__cssUsage",
"=",
"{",
"}",
";",
"this",
".",
"__styleTagAssociation",
"=",
"{",
"}",
";",
"this",
".",
"__invalidClasspaths",
"=",
"{",
"}",
";",
"this",
".",
"__cssDependencies",
"=",
"{",
"}",
";",
"this",
".",
"__PREFIX",
"=",
"this",
".",
"classDefinition",
".",
"$statics",
".",
"__PREFIX",
";",
"this",
".",
"__NEXT_PREFIX_INDEX",
"=",
"this",
".",
"classDefinition",
".",
"$statics",
".",
"__NEXT_PREFIX_INDEX",
";",
"this",
".",
"__NEXT_TAG_INDEX",
"=",
"this",
".",
"classDefinition",
".",
"$statics",
".",
"__NEXT_TAG_INDEX",
";",
"this",
".",
"__TAG_PREFX",
"=",
"this",
".",
"classDefinition",
".",
"$statics",
".",
"__TAG_PREFX",
";",
"}"
]
| Reset the singleton to it's initial state after creation. | [
"Reset",
"the",
"singleton",
"to",
"it",
"s",
"initial",
"state",
"after",
"creation",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/templates/CSSMgr.js#L685-L712 | train |
|
ariatemplates/ariatemplates | src/aria/templates/CSSMgr.js | function (classpath, cssTemplates) {
for (var i = 0, length = cssTemplates.length; i < length; i++) {
var cssClasspath = Aria.getClasspath(cssTemplates[i]);
if (!this.__globalUsage[cssClasspath]) {
this.__globalUsage[cssClasspath] = [];
}
this.__globalUsage[cssClasspath].push(classpath);
}
} | javascript | function (classpath, cssTemplates) {
for (var i = 0, length = cssTemplates.length; i < length; i++) {
var cssClasspath = Aria.getClasspath(cssTemplates[i]);
if (!this.__globalUsage[cssClasspath]) {
this.__globalUsage[cssClasspath] = [];
}
this.__globalUsage[cssClasspath].push(classpath);
}
} | [
"function",
"(",
"classpath",
",",
"cssTemplates",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"length",
"=",
"cssTemplates",
".",
"length",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"var",
"cssClasspath",
"=",
"Aria",
".",
"getClasspath",
"(",
"cssTemplates",
"[",
"i",
"]",
")",
";",
"if",
"(",
"!",
"this",
".",
"__globalUsage",
"[",
"cssClasspath",
"]",
")",
"{",
"this",
".",
"__globalUsage",
"[",
"cssClasspath",
"]",
"=",
"[",
"]",
";",
"}",
"this",
".",
"__globalUsage",
"[",
"cssClasspath",
"]",
".",
"push",
"(",
"classpath",
")",
";",
"}",
"}"
]
| Register a link between a classpath and a CSSTemplate. This is used during CSS reload to identify if a CSS
has to be reloaded.
@param {String} classpath classpath that have a dependency on some css
@param {Array} cssTemplates css classpaths or references | [
"Register",
"a",
"link",
"between",
"a",
"classpath",
"and",
"a",
"CSSTemplate",
".",
"This",
"is",
"used",
"during",
"CSS",
"reload",
"to",
"identify",
"if",
"a",
"CSS",
"has",
"to",
"be",
"reloaded",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/templates/CSSMgr.js#L758-L766 | train |
|
ariatemplates/ariatemplates | src/aria/templates/CSSMgr.js | function (classpath, cssTemplates, unload, timestampNextTime) {
var array = ariaUtilsArray, classMgr = ariaCoreClassMgr;
for (var i = 0, length = cssTemplates.length; i < length; i++) {
var cssClasspath = Aria.getClasspath(cssTemplates[i]);
var usage = this.__globalUsage[cssClasspath];
array.remove(usage, classpath);
if (unload) {
classMgr.unloadClass(cssClasspath, timestampNextTime);
// only invalidate if someone else is using it
this.invalidate(cssClasspath, usage.length > 0);
}
}
} | javascript | function (classpath, cssTemplates, unload, timestampNextTime) {
var array = ariaUtilsArray, classMgr = ariaCoreClassMgr;
for (var i = 0, length = cssTemplates.length; i < length; i++) {
var cssClasspath = Aria.getClasspath(cssTemplates[i]);
var usage = this.__globalUsage[cssClasspath];
array.remove(usage, classpath);
if (unload) {
classMgr.unloadClass(cssClasspath, timestampNextTime);
// only invalidate if someone else is using it
this.invalidate(cssClasspath, usage.length > 0);
}
}
} | [
"function",
"(",
"classpath",
",",
"cssTemplates",
",",
"unload",
",",
"timestampNextTime",
")",
"{",
"var",
"array",
"=",
"ariaUtilsArray",
",",
"classMgr",
"=",
"ariaCoreClassMgr",
";",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"length",
"=",
"cssTemplates",
".",
"length",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"var",
"cssClasspath",
"=",
"Aria",
".",
"getClasspath",
"(",
"cssTemplates",
"[",
"i",
"]",
")",
";",
"var",
"usage",
"=",
"this",
".",
"__globalUsage",
"[",
"cssClasspath",
"]",
";",
"array",
".",
"remove",
"(",
"usage",
",",
"classpath",
")",
";",
"if",
"(",
"unload",
")",
"{",
"classMgr",
".",
"unloadClass",
"(",
"cssClasspath",
",",
"timestampNextTime",
")",
";",
"this",
".",
"invalidate",
"(",
"cssClasspath",
",",
"usage",
".",
"length",
">",
"0",
")",
";",
"}",
"}",
"}"
]
| Unregister a link between a classpath and a CSSTemplate. This is used during CSS reload to identify if a CSS
has to be reloaded.
@param {String} classpath classpath that have a dependency on some css
@param {Array} cssTemplates classpaths or references
@param {Boolean} unload if true unload cssTemplate class as well and invalidate them
@param {Boolean} timestampNextTime if unload is asked, will trigger browser cache bypass for next load | [
"Unregister",
"a",
"link",
"between",
"a",
"classpath",
"and",
"a",
"CSSTemplate",
".",
"This",
"is",
"used",
"during",
"CSS",
"reload",
"to",
"identify",
"if",
"a",
"CSS",
"has",
"to",
"be",
"reloaded",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/templates/CSSMgr.js#L776-L788 | train |
|
ariatemplates/ariatemplates | src/aria/utils/validators/Validator.js | function (msg) {
if (this.utilsType.isObject(msg)) {
this.message = msg;
this.localized_message = msg.localizedMessage;
} else if (this.utilsType.isString(msg)) {
this.localized_message = msg;
this.message = ariaUtilsData.createMessage(msg);
}
} | javascript | function (msg) {
if (this.utilsType.isObject(msg)) {
this.message = msg;
this.localized_message = msg.localizedMessage;
} else if (this.utilsType.isString(msg)) {
this.localized_message = msg;
this.message = ariaUtilsData.createMessage(msg);
}
} | [
"function",
"(",
"msg",
")",
"{",
"if",
"(",
"this",
".",
"utilsType",
".",
"isObject",
"(",
"msg",
")",
")",
"{",
"this",
".",
"message",
"=",
"msg",
";",
"this",
".",
"localized_message",
"=",
"msg",
".",
"localizedMessage",
";",
"}",
"else",
"if",
"(",
"this",
".",
"utilsType",
".",
"isString",
"(",
"msg",
")",
")",
"{",
"this",
".",
"localized_message",
"=",
"msg",
";",
"this",
".",
"message",
"=",
"ariaUtilsData",
".",
"createMessage",
"(",
"msg",
")",
";",
"}",
"}"
]
| Sets the message if there is one otherwise set the message.
@param {String|Object} msg | [
"Sets",
"the",
"message",
"if",
"there",
"is",
"one",
"otherwise",
"set",
"the",
"message",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/utils/validators/Validator.js#L96-L104 | train |
|
ariatemplates/ariatemplates | src/aria/html/Element.js | makeUseless | function makeUseless (instance) {
instance.writeMarkup = Aria.empty;
instance.writeMarkupBegin = Aria.empty;
instance.writeMarkupEnd = Aria.empty;
instance.initWidget = Aria.empty;
} | javascript | function makeUseless (instance) {
instance.writeMarkup = Aria.empty;
instance.writeMarkupBegin = Aria.empty;
instance.writeMarkupEnd = Aria.empty;
instance.initWidget = Aria.empty;
} | [
"function",
"makeUseless",
"(",
"instance",
")",
"{",
"instance",
".",
"writeMarkup",
"=",
"Aria",
".",
"empty",
";",
"instance",
".",
"writeMarkupBegin",
"=",
"Aria",
".",
"empty",
";",
"instance",
".",
"writeMarkupEnd",
"=",
"Aria",
".",
"empty",
";",
"instance",
".",
"initWidget",
"=",
"Aria",
".",
"empty",
";",
"}"
]
| This function is called when the widget validation fails. It sets every public function to Aria.empty so that we
can safely assume that the configuration is valid inside the methods defined in the prototype.
@param {aria.html.Element) instance Instance of Element widget that should be made useless
@private | [
"This",
"function",
"is",
"called",
"when",
"the",
"widget",
"validation",
"fails",
".",
"It",
"sets",
"every",
"public",
"function",
"to",
"Aria",
".",
"empty",
"so",
"that",
"we",
"can",
"safely",
"assume",
"that",
"the",
"configuration",
"is",
"valid",
"inside",
"the",
"methods",
"defined",
"in",
"the",
"prototype",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/html/Element.js#L32-L37 | train |
ariatemplates/ariatemplates | src/aria/html/Element.js | function () {
var eventListeners = this._cfg.on, hasListeners = false, listArray;
var delegateManager = ariaUtilsDelegate;
var delegateFallbackEvents = [];
for (var listener in eventListeners) {
if (eventListeners.hasOwnProperty(listener)) {
hasListeners = true;
if (!delegateManager.isDelegated(listener)) {
delegateFallbackEvents.push(listener);
}
listArray = eventListeners[listener];
if (!ariaUtilsType.isArray(listArray)) {
listArray = [listArray];
}
for (var i = 0, listCount = listArray.length; i < listCount; i++) {
listArray[i] = this.$normCallback.call(this._context._tpl, listArray[i]);
}
eventListeners[listener] = listArray;
}
}
if (hasListeners) {
this.__delegateId = delegateManager.add({
fn : this._delegate,
scope : this
});
this.__delegateFallbackEvents = delegateFallbackEvents;
}
} | javascript | function () {
var eventListeners = this._cfg.on, hasListeners = false, listArray;
var delegateManager = ariaUtilsDelegate;
var delegateFallbackEvents = [];
for (var listener in eventListeners) {
if (eventListeners.hasOwnProperty(listener)) {
hasListeners = true;
if (!delegateManager.isDelegated(listener)) {
delegateFallbackEvents.push(listener);
}
listArray = eventListeners[listener];
if (!ariaUtilsType.isArray(listArray)) {
listArray = [listArray];
}
for (var i = 0, listCount = listArray.length; i < listCount; i++) {
listArray[i] = this.$normCallback.call(this._context._tpl, listArray[i]);
}
eventListeners[listener] = listArray;
}
}
if (hasListeners) {
this.__delegateId = delegateManager.add({
fn : this._delegate,
scope : this
});
this.__delegateFallbackEvents = delegateFallbackEvents;
}
} | [
"function",
"(",
")",
"{",
"var",
"eventListeners",
"=",
"this",
".",
"_cfg",
".",
"on",
",",
"hasListeners",
"=",
"false",
",",
"listArray",
";",
"var",
"delegateManager",
"=",
"ariaUtilsDelegate",
";",
"var",
"delegateFallbackEvents",
"=",
"[",
"]",
";",
"for",
"(",
"var",
"listener",
"in",
"eventListeners",
")",
"{",
"if",
"(",
"eventListeners",
".",
"hasOwnProperty",
"(",
"listener",
")",
")",
"{",
"hasListeners",
"=",
"true",
";",
"if",
"(",
"!",
"delegateManager",
".",
"isDelegated",
"(",
"listener",
")",
")",
"{",
"delegateFallbackEvents",
".",
"push",
"(",
"listener",
")",
";",
"}",
"listArray",
"=",
"eventListeners",
"[",
"listener",
"]",
";",
"if",
"(",
"!",
"ariaUtilsType",
".",
"isArray",
"(",
"listArray",
")",
")",
"{",
"listArray",
"=",
"[",
"listArray",
"]",
";",
"}",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"listCount",
"=",
"listArray",
".",
"length",
";",
"i",
"<",
"listCount",
";",
"i",
"++",
")",
"{",
"listArray",
"[",
"i",
"]",
"=",
"this",
".",
"$normCallback",
".",
"call",
"(",
"this",
".",
"_context",
".",
"_tpl",
",",
"listArray",
"[",
"i",
"]",
")",
";",
"}",
"eventListeners",
"[",
"listener",
"]",
"=",
"listArray",
";",
"}",
"}",
"if",
"(",
"hasListeners",
")",
"{",
"this",
".",
"__delegateId",
"=",
"delegateManager",
".",
"add",
"(",
"{",
"fn",
":",
"this",
".",
"_delegate",
",",
"scope",
":",
"this",
"}",
")",
";",
"this",
".",
"__delegateFallbackEvents",
"=",
"delegateFallbackEvents",
";",
"}",
"}"
]
| Since event's callbacks can be have several signatures as specified in
aria.widgetLibs.CommonBeans.Callback this function normalizes the callbacks for later use. It'll also ask
Delegate to generate a delegateId if needed.
@protected | [
"Since",
"event",
"s",
"callbacks",
"can",
"be",
"have",
"several",
"signatures",
"as",
"specified",
"in",
"aria",
".",
"widgetLibs",
".",
"CommonBeans",
".",
"Callback",
"this",
"function",
"normalizes",
"the",
"callbacks",
"for",
"later",
"use",
".",
"It",
"ll",
"also",
"ask",
"Delegate",
"to",
"generate",
"a",
"delegateId",
"if",
"needed",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/html/Element.js#L135-L164 | train |
|
ariatemplates/ariatemplates | src/aria/html/Element.js | function (event) {
var type = event.type, callbackArray = this._cfg.on[type], callback, returnValue;
if (callbackArray) {
var wrapped = new ariaTemplatesDomEventWrapper(event);
for (var i = 0, listCount = callbackArray.length; i < listCount; i++) {
callback = callbackArray[i];
returnValue = callback.fn.call(callback.scope, wrapped, callback.args);
if (returnValue === false) {
break;
}
}
wrapped.$dispose();
return returnValue;
}
} | javascript | function (event) {
var type = event.type, callbackArray = this._cfg.on[type], callback, returnValue;
if (callbackArray) {
var wrapped = new ariaTemplatesDomEventWrapper(event);
for (var i = 0, listCount = callbackArray.length; i < listCount; i++) {
callback = callbackArray[i];
returnValue = callback.fn.call(callback.scope, wrapped, callback.args);
if (returnValue === false) {
break;
}
}
wrapped.$dispose();
return returnValue;
}
} | [
"function",
"(",
"event",
")",
"{",
"var",
"type",
"=",
"event",
".",
"type",
",",
"callbackArray",
"=",
"this",
".",
"_cfg",
".",
"on",
"[",
"type",
"]",
",",
"callback",
",",
"returnValue",
";",
"if",
"(",
"callbackArray",
")",
"{",
"var",
"wrapped",
"=",
"new",
"ariaTemplatesDomEventWrapper",
"(",
"event",
")",
";",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"listCount",
"=",
"callbackArray",
".",
"length",
";",
"i",
"<",
"listCount",
";",
"i",
"++",
")",
"{",
"callback",
"=",
"callbackArray",
"[",
"i",
"]",
";",
"returnValue",
"=",
"callback",
".",
"fn",
".",
"call",
"(",
"callback",
".",
"scope",
",",
"wrapped",
",",
"callback",
".",
"args",
")",
";",
"if",
"(",
"returnValue",
"===",
"false",
")",
"{",
"break",
";",
"}",
"}",
"wrapped",
".",
"$dispose",
"(",
")",
";",
"return",
"returnValue",
";",
"}",
"}"
]
| Callback for delegated events. If an 'on' callback was registered it calls the appropriate callback
passing a aria.templates.DomEventWrapper to the callback function
@param {aria.DomEvent} event Wrapped event
@protected | [
"Callback",
"for",
"delegated",
"events",
".",
"If",
"an",
"on",
"callback",
"was",
"registered",
"it",
"calls",
"the",
"appropriate",
"callback",
"passing",
"a",
"aria",
".",
"templates",
".",
"DomEventWrapper",
"to",
"the",
"callback",
"function"
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/html/Element.js#L172-L186 | train |
|
ariatemplates/ariatemplates | src/aria/html/Element.js | function (out) {
var cfg = this._cfg;
var attributes = ariaUtilsHtml.buildAttributeList(cfg.attributes);
var markup = ["<", cfg.tagName, " id='", this._id, "' "];
if (attributes) {
markup.push(attributes, " ");
}
var delegateId = this.__delegateId;
if (delegateId) {
var delegateManager = ariaUtilsDelegate;
markup.push(delegateManager.getMarkup(delegateId), " ");
var delegateFallbackEvents = this.__delegateFallbackEvents;
for (var i = 0, l = delegateFallbackEvents.length; i < l; i++) {
markup.push(delegateManager.getFallbackMarkup(delegateFallbackEvents[i], delegateId, false), " ");
}
}
out.write(markup.join(""));
} | javascript | function (out) {
var cfg = this._cfg;
var attributes = ariaUtilsHtml.buildAttributeList(cfg.attributes);
var markup = ["<", cfg.tagName, " id='", this._id, "' "];
if (attributes) {
markup.push(attributes, " ");
}
var delegateId = this.__delegateId;
if (delegateId) {
var delegateManager = ariaUtilsDelegate;
markup.push(delegateManager.getMarkup(delegateId), " ");
var delegateFallbackEvents = this.__delegateFallbackEvents;
for (var i = 0, l = delegateFallbackEvents.length; i < l; i++) {
markup.push(delegateManager.getFallbackMarkup(delegateFallbackEvents[i], delegateId, false), " ");
}
}
out.write(markup.join(""));
} | [
"function",
"(",
"out",
")",
"{",
"var",
"cfg",
"=",
"this",
".",
"_cfg",
";",
"var",
"attributes",
"=",
"ariaUtilsHtml",
".",
"buildAttributeList",
"(",
"cfg",
".",
"attributes",
")",
";",
"var",
"markup",
"=",
"[",
"\"<\"",
",",
"cfg",
".",
"tagName",
",",
"\" id='\"",
",",
"this",
".",
"_id",
",",
"\"' \"",
"]",
";",
"if",
"(",
"attributes",
")",
"{",
"markup",
".",
"push",
"(",
"attributes",
",",
"\" \"",
")",
";",
"}",
"var",
"delegateId",
"=",
"this",
".",
"__delegateId",
";",
"if",
"(",
"delegateId",
")",
"{",
"var",
"delegateManager",
"=",
"ariaUtilsDelegate",
";",
"markup",
".",
"push",
"(",
"delegateManager",
".",
"getMarkup",
"(",
"delegateId",
")",
",",
"\" \"",
")",
";",
"var",
"delegateFallbackEvents",
"=",
"this",
".",
"__delegateFallbackEvents",
";",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"l",
"=",
"delegateFallbackEvents",
".",
"length",
";",
"i",
"<",
"l",
";",
"i",
"++",
")",
"{",
"markup",
".",
"push",
"(",
"delegateManager",
".",
"getFallbackMarkup",
"(",
"delegateFallbackEvents",
"[",
"i",
"]",
",",
"delegateId",
",",
"false",
")",
",",
"\" \"",
")",
";",
"}",
"}",
"out",
".",
"write",
"(",
"markup",
".",
"join",
"(",
"\"\"",
")",
")",
";",
"}"
]
| Write the opening tag without adding the ending '>'. This part is common to both opening and self closing
tag.
@param {aria.templates.MarkupWriter} out
@protected | [
"Write",
"the",
"opening",
"tag",
"without",
"adding",
"the",
"ending",
">",
".",
"This",
"part",
"is",
"common",
"to",
"both",
"opening",
"and",
"self",
"closing",
"tag",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/html/Element.js#L245-L265 | train |
|
ariatemplates/ariatemplates | src/aria/html/Element.js | function (args, propertyName) {
if (this._cfg) {
this.onbind(propertyName, this._transform(this._cfg.bind[propertyName].transform, args.newValue, "toWidget"), args.oldValue);
}
} | javascript | function (args, propertyName) {
if (this._cfg) {
this.onbind(propertyName, this._transform(this._cfg.bind[propertyName].transform, args.newValue, "toWidget"), args.oldValue);
}
} | [
"function",
"(",
"args",
",",
"propertyName",
")",
"{",
"if",
"(",
"this",
".",
"_cfg",
")",
"{",
"this",
".",
"onbind",
"(",
"propertyName",
",",
"this",
".",
"_transform",
"(",
"this",
".",
"_cfg",
".",
"bind",
"[",
"propertyName",
"]",
".",
"transform",
",",
"args",
".",
"newValue",
",",
"\"toWidget\"",
")",
",",
"args",
".",
"oldValue",
")",
";",
"}",
"}"
]
| Called when a change occurs for a value with binding.
@protected
@param {Object} args details about what changed
@param {String} propertyName key of the binding configuration that registered this callback
@override | [
"Called",
"when",
"a",
"change",
"occurs",
"for",
"a",
"value",
"with",
"binding",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/html/Element.js#L274-L278 | train |
|
ariatemplates/ariatemplates | src/aria/html/Element.js | function (listeners, eventType, callback, after) {
var listArray = listeners[eventType] || [];
if (!ariaUtilsType.isArray(listArray)) {
listArray = [listArray];
}
if (after) {
listArray.push(callback);
} else {
listArray.splice(0, 0, callback);
}
listeners[eventType] = listArray;
} | javascript | function (listeners, eventType, callback, after) {
var listArray = listeners[eventType] || [];
if (!ariaUtilsType.isArray(listArray)) {
listArray = [listArray];
}
if (after) {
listArray.push(callback);
} else {
listArray.splice(0, 0, callback);
}
listeners[eventType] = listArray;
} | [
"function",
"(",
"listeners",
",",
"eventType",
",",
"callback",
",",
"after",
")",
"{",
"var",
"listArray",
"=",
"listeners",
"[",
"eventType",
"]",
"||",
"[",
"]",
";",
"if",
"(",
"!",
"ariaUtilsType",
".",
"isArray",
"(",
"listArray",
")",
")",
"{",
"listArray",
"=",
"[",
"listArray",
"]",
";",
"}",
"if",
"(",
"after",
")",
"{",
"listArray",
".",
"push",
"(",
"callback",
")",
";",
"}",
"else",
"{",
"listArray",
".",
"splice",
"(",
"0",
",",
"0",
",",
"callback",
")",
";",
"}",
"listeners",
"[",
"eventType",
"]",
"=",
"listArray",
";",
"}"
]
| Add a listener for an event. It will be called before an already registered event, if any.
@protected
@param {aria.html.beans.ElementCfg:Properties.on} listeners Map of listeners
@param {String} eventType Type of the event
@param {aria.core.CfgBeans:Callback} callback listener to chain
@param {Boolean} after True if the listener has to be executed after all the other listeners. Otherwise,
it will be executed before | [
"Add",
"a",
"listener",
"for",
"an",
"event",
".",
"It",
"will",
"be",
"called",
"before",
"an",
"already",
"registered",
"event",
"if",
"any",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/html/Element.js#L289-L301 | train |
|
ariatemplates/ariatemplates | src/aria/$resourcesProviders.js | function (args) {
var output = [args.provider, args.caller];
if (args.onLoad) {
output.push(args.onLoad);
}
if (args.handler) {
output.push(args.handler);
}
if (args.resources) {
output.push(args.resources.join("-"));
}
return output.join("-");
} | javascript | function (args) {
var output = [args.provider, args.caller];
if (args.onLoad) {
output.push(args.onLoad);
}
if (args.handler) {
output.push(args.handler);
}
if (args.resources) {
output.push(args.resources.join("-"));
}
return output.join("-");
} | [
"function",
"(",
"args",
")",
"{",
"var",
"output",
"=",
"[",
"args",
".",
"provider",
",",
"args",
".",
"caller",
"]",
";",
"if",
"(",
"args",
".",
"onLoad",
")",
"{",
"output",
".",
"push",
"(",
"args",
".",
"onLoad",
")",
";",
"}",
"if",
"(",
"args",
".",
"handler",
")",
"{",
"output",
".",
"push",
"(",
"args",
".",
"handler",
")",
";",
"}",
"if",
"(",
"args",
".",
"resources",
")",
"{",
"output",
".",
"push",
"(",
"args",
".",
"resources",
".",
"join",
"(",
"\"-\"",
")",
")",
";",
"}",
"return",
"output",
".",
"join",
"(",
"\"-\"",
")",
";",
"}"
]
| Compute the key that will be used to store a certain instance of provider in the providers store
@param {Object} args
@return {String}
@private | [
"Compute",
"the",
"key",
"that",
"will",
"be",
"used",
"to",
"store",
"a",
"certain",
"instance",
"of",
"provider",
"in",
"the",
"providers",
"store"
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/$resourcesProviders.js#L34-L46 | train |
|
ariatemplates/ariatemplates | src/aria/$resourcesProviders.js | function (referencePath, baseLogicalPath, callerClasspath, onLoad, handler) {
var args = convertArguments(arguments);
if (args.onLoad) {
asyncRequire(args.provider).spreadSync(function (providerConstr) {
return fetchDataAfterLoading(providerConstr, args);
}).then(function () {
var callerPrototype = Aria.getClassRef(args.caller).prototype;
callerPrototype[args.onLoad].call(callerPrototype);
}).done();
}
return {
provider : getInstanceFromStore(args)
};
} | javascript | function (referencePath, baseLogicalPath, callerClasspath, onLoad, handler) {
var args = convertArguments(arguments);
if (args.onLoad) {
asyncRequire(args.provider).spreadSync(function (providerConstr) {
return fetchDataAfterLoading(providerConstr, args);
}).then(function () {
var callerPrototype = Aria.getClassRef(args.caller).prototype;
callerPrototype[args.onLoad].call(callerPrototype);
}).done();
}
return {
provider : getInstanceFromStore(args)
};
} | [
"function",
"(",
"referencePath",
",",
"baseLogicalPath",
",",
"callerClasspath",
",",
"onLoad",
",",
"handler",
")",
"{",
"var",
"args",
"=",
"convertArguments",
"(",
"arguments",
")",
";",
"if",
"(",
"args",
".",
"onLoad",
")",
"{",
"asyncRequire",
"(",
"args",
".",
"provider",
")",
".",
"spreadSync",
"(",
"function",
"(",
"providerConstr",
")",
"{",
"return",
"fetchDataAfterLoading",
"(",
"providerConstr",
",",
"args",
")",
";",
"}",
")",
".",
"then",
"(",
"function",
"(",
")",
"{",
"var",
"callerPrototype",
"=",
"Aria",
".",
"getClassRef",
"(",
"args",
".",
"caller",
")",
".",
"prototype",
";",
"callerPrototype",
"[",
"args",
".",
"onLoad",
"]",
".",
"call",
"(",
"callerPrototype",
")",
";",
"}",
")",
".",
"done",
"(",
")",
";",
"}",
"return",
"{",
"provider",
":",
"getInstanceFromStore",
"(",
"args",
")",
"}",
";",
"}"
]
| Public method that has to be used to obtain the instance of provider
@param {String} referencePath reference path of the provider module
@param {String} baseLogicalPath path of the provider module
@param {String} callerClasspath classpath of the caller,
@param {String} onLoad onLoad method of the caller prototype to call after the resources are fetched
@param {String} handler handler
@param {...*} var_args flattened list of resources
@return {Object} It contains a property "provider" whose value is the instance of the provider
@public | [
"Public",
"method",
"that",
"has",
"to",
"be",
"used",
"to",
"obtain",
"the",
"instance",
"of",
"provider"
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/$resourcesProviders.js#L169-L182 | train |
|
ariatemplates/ariatemplates | src/aria/$resourcesProviders.js | function (providerConstr, args) {
return new Promise(function (resolve) {
var instance = new providerConstr();
addInstanceToStore(args, instance);
createGetData(instance, args.caller);
if (args.hasOwnProperty("handler")) {
instance.setHandler(args.handler);
}
if (args.hasOwnProperty("resources")) {
instance.setResources(args.resources);
}
instance.fetchData(resolve, args.caller);
});
} | javascript | function (providerConstr, args) {
return new Promise(function (resolve) {
var instance = new providerConstr();
addInstanceToStore(args, instance);
createGetData(instance, args.caller);
if (args.hasOwnProperty("handler")) {
instance.setHandler(args.handler);
}
if (args.hasOwnProperty("resources")) {
instance.setResources(args.resources);
}
instance.fetchData(resolve, args.caller);
});
} | [
"function",
"(",
"providerConstr",
",",
"args",
")",
"{",
"return",
"new",
"Promise",
"(",
"function",
"(",
"resolve",
")",
"{",
"var",
"instance",
"=",
"new",
"providerConstr",
"(",
")",
";",
"addInstanceToStore",
"(",
"args",
",",
"instance",
")",
";",
"createGetData",
"(",
"instance",
",",
"args",
".",
"caller",
")",
";",
"if",
"(",
"args",
".",
"hasOwnProperty",
"(",
"\"handler\"",
")",
")",
"{",
"instance",
".",
"setHandler",
"(",
"args",
".",
"handler",
")",
";",
"}",
"if",
"(",
"args",
".",
"hasOwnProperty",
"(",
"\"resources\"",
")",
")",
"{",
"instance",
".",
"setResources",
"(",
"args",
".",
"resources",
")",
";",
"}",
"instance",
".",
"fetchData",
"(",
"resolve",
",",
"args",
".",
"caller",
")",
";",
"}",
")",
";",
"}"
]
| Create an instance of the contructor, set the handler and the resources, call the fetch method
@param {Function} providerConstr contructor of the provider
@param {Object} args see the value returned by "convertArguments" method
@return {Object} promise | [
"Create",
"an",
"instance",
"of",
"the",
"contructor",
"set",
"the",
"handler",
"and",
"the",
"resources",
"call",
"the",
"fetch",
"method"
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/$resourcesProviders.js#L190-L203 | train |
|
ariatemplates/ariatemplates | src/aria/core/JsonValidator.js | function (errors, throwsErrors) {
if (errors.length === 0) {
return true;
}
if (!throwsErrors) {
for (var i = 0; i < errors.length; i++) {
this.$logError(errors[i].msgId, errors[i].msgArgs);
}
} else {
var error, logs = aria.core.Log;
// aria.core.Log may not be available
if (logs) {
var messages = [];
for (var i = 0; i < errors.length; i++) {
errors[i].message = logs.prepareLoggedMessage(errors[i].msgId, errors[i].msgArgs);
messages.push(errors[i].message);
}
error = new Error(messages.join('\n'));
} else {
error = new Error();
}
error.errors = errors;
throw error;
}
return false;
} | javascript | function (errors, throwsErrors) {
if (errors.length === 0) {
return true;
}
if (!throwsErrors) {
for (var i = 0; i < errors.length; i++) {
this.$logError(errors[i].msgId, errors[i].msgArgs);
}
} else {
var error, logs = aria.core.Log;
// aria.core.Log may not be available
if (logs) {
var messages = [];
for (var i = 0; i < errors.length; i++) {
errors[i].message = logs.prepareLoggedMessage(errors[i].msgId, errors[i].msgArgs);
messages.push(errors[i].message);
}
error = new Error(messages.join('\n'));
} else {
error = new Error();
}
error.errors = errors;
throw error;
}
return false;
} | [
"function",
"(",
"errors",
",",
"throwsErrors",
")",
"{",
"if",
"(",
"errors",
".",
"length",
"===",
"0",
")",
"{",
"return",
"true",
";",
"}",
"if",
"(",
"!",
"throwsErrors",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"errors",
".",
"length",
";",
"i",
"++",
")",
"{",
"this",
".",
"$logError",
"(",
"errors",
"[",
"i",
"]",
".",
"msgId",
",",
"errors",
"[",
"i",
"]",
".",
"msgArgs",
")",
";",
"}",
"}",
"else",
"{",
"var",
"error",
",",
"logs",
"=",
"aria",
".",
"core",
".",
"Log",
";",
"if",
"(",
"logs",
")",
"{",
"var",
"messages",
"=",
"[",
"]",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"errors",
".",
"length",
";",
"i",
"++",
")",
"{",
"errors",
"[",
"i",
"]",
".",
"message",
"=",
"logs",
".",
"prepareLoggedMessage",
"(",
"errors",
"[",
"i",
"]",
".",
"msgId",
",",
"errors",
"[",
"i",
"]",
".",
"msgArgs",
")",
";",
"messages",
".",
"push",
"(",
"errors",
"[",
"i",
"]",
".",
"message",
")",
";",
"}",
"error",
"=",
"new",
"Error",
"(",
"messages",
".",
"join",
"(",
"'\\n'",
")",
")",
";",
"}",
"else",
"\\n",
"{",
"error",
"=",
"new",
"Error",
"(",
")",
";",
"}",
"error",
".",
"errors",
"=",
"errors",
";",
"}",
"throw",
"error",
";",
"}"
]
| Log all errors.
@param {Array} array of errors
@param {Boolean} throwsErrors (default false)
@return {Boolean} True if there were no error, false otherwise. | [
"Log",
"all",
"errors",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/core/JsonValidator.js#L259-L284 | train |
|
ariatemplates/ariatemplates | src/aria/core/JsonValidator.js | function (packageDef, typeName) {
var path = {
'$properties' : packageDef.$beans
};
var typeParts = typeName.split('.');
for (var i = 0; i < typeParts.length; i++) {
var elt = typeParts[i];
if (elt == '$contentType' && path.$contentType) {
// the content type of an Array or a Map can be used
// as a type elsewhere
path = path.$contentType;
} else if (typeof(path.$properties) == 'object' && path.$properties != null) {
path = path.$properties[elt];
} else {
path = null;
}
if (typeof(path) != 'object' || path == null) {
this._logError(this.INVALID_TYPE_REF, [typeName, this._currentBeanName, packageDef.$package]);
return this._typeRefError;
}
}
return path;
} | javascript | function (packageDef, typeName) {
var path = {
'$properties' : packageDef.$beans
};
var typeParts = typeName.split('.');
for (var i = 0; i < typeParts.length; i++) {
var elt = typeParts[i];
if (elt == '$contentType' && path.$contentType) {
// the content type of an Array or a Map can be used
// as a type elsewhere
path = path.$contentType;
} else if (typeof(path.$properties) == 'object' && path.$properties != null) {
path = path.$properties[elt];
} else {
path = null;
}
if (typeof(path) != 'object' || path == null) {
this._logError(this.INVALID_TYPE_REF, [typeName, this._currentBeanName, packageDef.$package]);
return this._typeRefError;
}
}
return path;
} | [
"function",
"(",
"packageDef",
",",
"typeName",
")",
"{",
"var",
"path",
"=",
"{",
"'$properties'",
":",
"packageDef",
".",
"$beans",
"}",
";",
"var",
"typeParts",
"=",
"typeName",
".",
"split",
"(",
"'.'",
")",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"typeParts",
".",
"length",
";",
"i",
"++",
")",
"{",
"var",
"elt",
"=",
"typeParts",
"[",
"i",
"]",
";",
"if",
"(",
"elt",
"==",
"'$contentType'",
"&&",
"path",
".",
"$contentType",
")",
"{",
"path",
"=",
"path",
".",
"$contentType",
";",
"}",
"else",
"if",
"(",
"typeof",
"(",
"path",
".",
"$properties",
")",
"==",
"'object'",
"&&",
"path",
".",
"$properties",
"!=",
"null",
")",
"{",
"path",
"=",
"path",
".",
"$properties",
"[",
"elt",
"]",
";",
"}",
"else",
"{",
"path",
"=",
"null",
";",
"}",
"if",
"(",
"typeof",
"(",
"path",
")",
"!=",
"'object'",
"||",
"path",
"==",
"null",
")",
"{",
"this",
".",
"_logError",
"(",
"this",
".",
"INVALID_TYPE_REF",
",",
"[",
"typeName",
",",
"this",
".",
"_currentBeanName",
",",
"packageDef",
".",
"$package",
"]",
")",
";",
"return",
"this",
".",
"_typeRefError",
";",
"}",
"}",
"return",
"path",
";",
"}"
]
| Find the given type in the given bean package.
@param {aria.core.BaseTypes:Package} packageDef bean package
@param {String} typeName type name. May not contain ':'. Contains the path to the bean inside the package
bp.
@return {aria.core.BaseTypes:Bean} definition of the requested bean, or this._typeRefError if it could
not be found | [
"Find",
"the",
"given",
"type",
"in",
"the",
"given",
"bean",
"package",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/core/JsonValidator.js#L294-L316 | train |
|
ariatemplates/ariatemplates | src/aria/core/JsonValidator.js | function (typeName, packageDef) {
var packageName, otherBP;
var i = typeName.indexOf(':');
// if no semicolumn, type is defined inside this package
if (i == -1) {
packageName = packageDef.$package;
otherBP = packageDef;
} else {
var ns = typeName.substr(0, i);
typeName = typeName.substr(i + 1);
packageName = (packageDef.$namespaces == null ? null : packageDef.$namespaces[ns]);
if (typeUtils.isObject(packageName)) {
packageName = packageName.$package;
}
if (!packageName) {
this._logError(this.UNDEFINED_PREFIX, [ns, this._currentBeanName]);
return this._typeRefError;
}
}
var fullName = packageName + "." + typeName;
var typeRef = this.__processedBeans[fullName];
if (typeRef) {
return typeRef;
}
if (!otherBP) {
otherBP = this.__loadedBeans[packageName];
if (!otherBP) {
this._logError(this.MISSING_BEANSPACKAGE, [packageName, this._currentBeanName]);
return this._typeRefError;
}
}
typeRef = this.__findTypeInBP(otherBP, typeName);
// update this type name with fully qualified name
if (typeRef != this._typeError && !typeRef[this._MD_TYPENAME]) {
typeRef[this._MD_TYPENAME] = fullName;
}
return typeRef;
} | javascript | function (typeName, packageDef) {
var packageName, otherBP;
var i = typeName.indexOf(':');
// if no semicolumn, type is defined inside this package
if (i == -1) {
packageName = packageDef.$package;
otherBP = packageDef;
} else {
var ns = typeName.substr(0, i);
typeName = typeName.substr(i + 1);
packageName = (packageDef.$namespaces == null ? null : packageDef.$namespaces[ns]);
if (typeUtils.isObject(packageName)) {
packageName = packageName.$package;
}
if (!packageName) {
this._logError(this.UNDEFINED_PREFIX, [ns, this._currentBeanName]);
return this._typeRefError;
}
}
var fullName = packageName + "." + typeName;
var typeRef = this.__processedBeans[fullName];
if (typeRef) {
return typeRef;
}
if (!otherBP) {
otherBP = this.__loadedBeans[packageName];
if (!otherBP) {
this._logError(this.MISSING_BEANSPACKAGE, [packageName, this._currentBeanName]);
return this._typeRefError;
}
}
typeRef = this.__findTypeInBP(otherBP, typeName);
// update this type name with fully qualified name
if (typeRef != this._typeError && !typeRef[this._MD_TYPENAME]) {
typeRef[this._MD_TYPENAME] = fullName;
}
return typeRef;
} | [
"function",
"(",
"typeName",
",",
"packageDef",
")",
"{",
"var",
"packageName",
",",
"otherBP",
";",
"var",
"i",
"=",
"typeName",
".",
"indexOf",
"(",
"':'",
")",
";",
"if",
"(",
"i",
"==",
"-",
"1",
")",
"{",
"packageName",
"=",
"packageDef",
".",
"$package",
";",
"otherBP",
"=",
"packageDef",
";",
"}",
"else",
"{",
"var",
"ns",
"=",
"typeName",
".",
"substr",
"(",
"0",
",",
"i",
")",
";",
"typeName",
"=",
"typeName",
".",
"substr",
"(",
"i",
"+",
"1",
")",
";",
"packageName",
"=",
"(",
"packageDef",
".",
"$namespaces",
"==",
"null",
"?",
"null",
":",
"packageDef",
".",
"$namespaces",
"[",
"ns",
"]",
")",
";",
"if",
"(",
"typeUtils",
".",
"isObject",
"(",
"packageName",
")",
")",
"{",
"packageName",
"=",
"packageName",
".",
"$package",
";",
"}",
"if",
"(",
"!",
"packageName",
")",
"{",
"this",
".",
"_logError",
"(",
"this",
".",
"UNDEFINED_PREFIX",
",",
"[",
"ns",
",",
"this",
".",
"_currentBeanName",
"]",
")",
";",
"return",
"this",
".",
"_typeRefError",
";",
"}",
"}",
"var",
"fullName",
"=",
"packageName",
"+",
"\".\"",
"+",
"typeName",
";",
"var",
"typeRef",
"=",
"this",
".",
"__processedBeans",
"[",
"fullName",
"]",
";",
"if",
"(",
"typeRef",
")",
"{",
"return",
"typeRef",
";",
"}",
"if",
"(",
"!",
"otherBP",
")",
"{",
"otherBP",
"=",
"this",
".",
"__loadedBeans",
"[",
"packageName",
"]",
";",
"if",
"(",
"!",
"otherBP",
")",
"{",
"this",
".",
"_logError",
"(",
"this",
".",
"MISSING_BEANSPACKAGE",
",",
"[",
"packageName",
",",
"this",
".",
"_currentBeanName",
"]",
")",
";",
"return",
"this",
".",
"_typeRefError",
";",
"}",
"}",
"typeRef",
"=",
"this",
".",
"__findTypeInBP",
"(",
"otherBP",
",",
"typeName",
")",
";",
"if",
"(",
"typeRef",
"!=",
"this",
".",
"_typeError",
"&&",
"!",
"typeRef",
"[",
"this",
".",
"_MD_TYPENAME",
"]",
")",
"{",
"typeRef",
"[",
"this",
".",
"_MD_TYPENAME",
"]",
"=",
"fullName",
";",
"}",
"return",
"typeRef",
";",
"}"
]
| Find a bean definition by its type name. It relies on the bean package currently being processed.
@param {String} typeName A string composed of two parts: 'namespace:value' where the namespace is
optional if the value refers a type defined in the package currently being processed.
@param {aria.core.BaseTypes:Package} packageDef reference package
@return {aria.core.BaseTypes:Bean} definition of the requested bean, or this._typeRefError if it could
not be found | [
"Find",
"a",
"bean",
"definition",
"by",
"its",
"type",
"name",
".",
"It",
"relies",
"on",
"the",
"bean",
"package",
"currently",
"being",
"processed",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/core/JsonValidator.js#L326-L368 | train |
|
ariatemplates/ariatemplates | src/aria/core/JsonValidator.js | function (def) {
// prepare error stack
this._errors = [];
var beans = def.$beans;
for (var beanName in beans) {
if (!beans.hasOwnProperty(beanName) || beanName.indexOf(':') != -1) {
continue;
}
// check that keys for beans are valid
if (!Aria.checkJsVarName(beanName)) {
this._logError(this.INVALID_NAME, [beanName, this._currentBeanName]);
}
this._preprocessBean(beans[beanName], def.$package + "." + beanName, def);
}
// Generate fast normalization functions at the end:
var toGenerateFastNorm = this.__toGenerateFastNorm;
while (toGenerateFastNorm.length > 0) {
var beanDef = toGenerateFastNorm.shift();
var baseType = beanDef[this._MD_BASETYPE];
if (baseType.makeFastNorm) {
// generate fast normalizer
baseType.makeFastNorm(beanDef);
}
}
return this._errors;
} | javascript | function (def) {
// prepare error stack
this._errors = [];
var beans = def.$beans;
for (var beanName in beans) {
if (!beans.hasOwnProperty(beanName) || beanName.indexOf(':') != -1) {
continue;
}
// check that keys for beans are valid
if (!Aria.checkJsVarName(beanName)) {
this._logError(this.INVALID_NAME, [beanName, this._currentBeanName]);
}
this._preprocessBean(beans[beanName], def.$package + "." + beanName, def);
}
// Generate fast normalization functions at the end:
var toGenerateFastNorm = this.__toGenerateFastNorm;
while (toGenerateFastNorm.length > 0) {
var beanDef = toGenerateFastNorm.shift();
var baseType = beanDef[this._MD_BASETYPE];
if (baseType.makeFastNorm) {
// generate fast normalizer
baseType.makeFastNorm(beanDef);
}
}
return this._errors;
} | [
"function",
"(",
"def",
")",
"{",
"this",
".",
"_errors",
"=",
"[",
"]",
";",
"var",
"beans",
"=",
"def",
".",
"$beans",
";",
"for",
"(",
"var",
"beanName",
"in",
"beans",
")",
"{",
"if",
"(",
"!",
"beans",
".",
"hasOwnProperty",
"(",
"beanName",
")",
"||",
"beanName",
".",
"indexOf",
"(",
"':'",
")",
"!=",
"-",
"1",
")",
"{",
"continue",
";",
"}",
"if",
"(",
"!",
"Aria",
".",
"checkJsVarName",
"(",
"beanName",
")",
")",
"{",
"this",
".",
"_logError",
"(",
"this",
".",
"INVALID_NAME",
",",
"[",
"beanName",
",",
"this",
".",
"_currentBeanName",
"]",
")",
";",
"}",
"this",
".",
"_preprocessBean",
"(",
"beans",
"[",
"beanName",
"]",
",",
"def",
".",
"$package",
"+",
"\".\"",
"+",
"beanName",
",",
"def",
")",
";",
"}",
"var",
"toGenerateFastNorm",
"=",
"this",
".",
"__toGenerateFastNorm",
";",
"while",
"(",
"toGenerateFastNorm",
".",
"length",
">",
"0",
")",
"{",
"var",
"beanDef",
"=",
"toGenerateFastNorm",
".",
"shift",
"(",
")",
";",
"var",
"baseType",
"=",
"beanDef",
"[",
"this",
".",
"_MD_BASETYPE",
"]",
";",
"if",
"(",
"baseType",
".",
"makeFastNorm",
")",
"{",
"baseType",
".",
"makeFastNorm",
"(",
"beanDef",
")",
";",
"}",
"}",
"return",
"this",
".",
"_errors",
";",
"}"
]
| Main function to preprocess a bean package definition. All dependencies should have already bean loaded.
@param {aria.core.BaseTypes:Package} def | [
"Main",
"function",
"to",
"preprocess",
"a",
"bean",
"package",
"definition",
".",
"All",
"dependencies",
"should",
"have",
"already",
"bean",
"loaded",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/core/JsonValidator.js#L539-L569 | train |
|
ariatemplates/ariatemplates | src/aria/core/JsonValidator.js | function (beanDef) {
var typeDef = this.__baseTypes[beanDef.$type];
this.$assert(298, typeDef != null);
beanDef[this._MD_BUILTIN] = true;
beanDef[this._MD_BASETYPE] = typeDef;
var beanName = beanDef[this._MD_TYPENAME] = [this._BASE_TYPES_PACKAGE, typeDef.typeName].join('.');
this.__processedBeans[beanName] = beanDef;
return typeDef;
} | javascript | function (beanDef) {
var typeDef = this.__baseTypes[beanDef.$type];
this.$assert(298, typeDef != null);
beanDef[this._MD_BUILTIN] = true;
beanDef[this._MD_BASETYPE] = typeDef;
var beanName = beanDef[this._MD_TYPENAME] = [this._BASE_TYPES_PACKAGE, typeDef.typeName].join('.');
this.__processedBeans[beanName] = beanDef;
return typeDef;
} | [
"function",
"(",
"beanDef",
")",
"{",
"var",
"typeDef",
"=",
"this",
".",
"__baseTypes",
"[",
"beanDef",
".",
"$type",
"]",
";",
"this",
".",
"$assert",
"(",
"298",
",",
"typeDef",
"!=",
"null",
")",
";",
"beanDef",
"[",
"this",
".",
"_MD_BUILTIN",
"]",
"=",
"true",
";",
"beanDef",
"[",
"this",
".",
"_MD_BASETYPE",
"]",
"=",
"typeDef",
";",
"var",
"beanName",
"=",
"beanDef",
"[",
"this",
".",
"_MD_TYPENAME",
"]",
"=",
"[",
"this",
".",
"_BASE_TYPES_PACKAGE",
",",
"typeDef",
".",
"typeName",
"]",
".",
"join",
"(",
"'.'",
")",
";",
"this",
".",
"__processedBeans",
"[",
"beanName",
"]",
"=",
"beanDef",
";",
"return",
"typeDef",
";",
"}"
]
| Preprocessing function for base types of package aria.core.JsonTypes
@param {aria.core.BaseTypes:Bean} beanDef | [
"Preprocessing",
"function",
"for",
"base",
"types",
"of",
"package",
"aria",
".",
"core",
".",
"JsonTypes"
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/core/JsonValidator.js#L575-L583 | train |
|
ariatemplates/ariatemplates | src/aria/core/JsonValidator.js | function (typeDef) {
this.__baseTypes[typeDef.typeName] = typeDef;
if (!(typeDef.dontSkip || this._options.checkEnabled)) {
typeDef.process = null;
typeDef.preprocess = null;
}
} | javascript | function (typeDef) {
this.__baseTypes[typeDef.typeName] = typeDef;
if (!(typeDef.dontSkip || this._options.checkEnabled)) {
typeDef.process = null;
typeDef.preprocess = null;
}
} | [
"function",
"(",
"typeDef",
")",
"{",
"this",
".",
"__baseTypes",
"[",
"typeDef",
".",
"typeName",
"]",
"=",
"typeDef",
";",
"if",
"(",
"!",
"(",
"typeDef",
".",
"dontSkip",
"||",
"this",
".",
"_options",
".",
"checkEnabled",
")",
")",
"{",
"typeDef",
".",
"process",
"=",
"null",
";",
"typeDef",
".",
"preprocess",
"=",
"null",
";",
"}",
"}"
]
| Add the given base type to the list of errors. It is called from JsonTypesCheck.js.
@param {Object} typeDef [typeDef] { typeName: {String} name of the base type preprocess(beanDef):
(Function) executed during preprocessing process(args): (Function) executed during processing dontSkip:
{Boolean} if true, preprocess and process will still be called even when check is disabled | [
"Add",
"the",
"given",
"base",
"type",
"to",
"the",
"list",
"of",
"errors",
".",
"It",
"is",
"called",
"from",
"JsonTypesCheck",
".",
"js",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/core/JsonValidator.js#L591-L597 | train |
|
ariatemplates/ariatemplates | src/aria/core/JsonValidator.js | function (args) {
var beanDef = (args.beanDef ? args.beanDef : this._getBean(args.beanName));
if (!beanDef) {
this._errors = [];
this._logError(this.BEAN_NOT_FOUND, args.beanName);
return this._errors;
}
this._errors = [];
// launching the validation process
this._checkType({
dataHolder : args,
dataName : 'json',
path : 'ROOT',
value : args.json,
beanDef : beanDef
});
return this._errors;
} | javascript | function (args) {
var beanDef = (args.beanDef ? args.beanDef : this._getBean(args.beanName));
if (!beanDef) {
this._errors = [];
this._logError(this.BEAN_NOT_FOUND, args.beanName);
return this._errors;
}
this._errors = [];
// launching the validation process
this._checkType({
dataHolder : args,
dataName : 'json',
path : 'ROOT',
value : args.json,
beanDef : beanDef
});
return this._errors;
} | [
"function",
"(",
"args",
")",
"{",
"var",
"beanDef",
"=",
"(",
"args",
".",
"beanDef",
"?",
"args",
".",
"beanDef",
":",
"this",
".",
"_getBean",
"(",
"args",
".",
"beanName",
")",
")",
";",
"if",
"(",
"!",
"beanDef",
")",
"{",
"this",
".",
"_errors",
"=",
"[",
"]",
";",
"this",
".",
"_logError",
"(",
"this",
".",
"BEAN_NOT_FOUND",
",",
"args",
".",
"beanName",
")",
";",
"return",
"this",
".",
"_errors",
";",
"}",
"this",
".",
"_errors",
"=",
"[",
"]",
";",
"this",
".",
"_checkType",
"(",
"{",
"dataHolder",
":",
"args",
",",
"dataName",
":",
"'json'",
",",
"path",
":",
"'ROOT'",
",",
"value",
":",
"args",
".",
"json",
",",
"beanDef",
":",
"beanDef",
"}",
")",
";",
"return",
"this",
".",
"_errors",
";",
"}"
]
| Process the validation of a Json object with the given bean definition.
@param args [args] { beanName/beanDef: beanName or beanDef json: structure to validate } Return the array
of errors. | [
"Process",
"the",
"validation",
"of",
"a",
"Json",
"object",
"with",
"the",
"given",
"bean",
"definition",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/core/JsonValidator.js#L654-L672 | train |
|
ariatemplates/ariatemplates | src/aria/core/JsonValidator.js | function (beanDef) {
if (this._options.checkBeans && (!this._options.checkMultiTypes)
&& this.__loadedBeans[this._BEANS_SCHEMA_PACKAGE]) {
var baseType = beanDef[this._MD_BASETYPE];
if (baseType == this._typeError) {
return false;
}
var beanChecker = this._getBean(this._BEANS_SCHEMA_PACKAGE + '.' + baseType.typeName);
this.$assert(402, beanChecker != null); // every type must be defined in the schema
// make a copy of current errors as normalization will erase them
var currentErrors = this._errors;
var errors = this._processJsonValidation({
beanDef : beanChecker,
json : beanDef
});
// restaure errors
this._errors = currentErrors;
if (errors.length > 0) {
this._logError(this.BEANCHECK_FAILED, [this._currentBeanName, errors]);
return false;
}
}
return true;
} | javascript | function (beanDef) {
if (this._options.checkBeans && (!this._options.checkMultiTypes)
&& this.__loadedBeans[this._BEANS_SCHEMA_PACKAGE]) {
var baseType = beanDef[this._MD_BASETYPE];
if (baseType == this._typeError) {
return false;
}
var beanChecker = this._getBean(this._BEANS_SCHEMA_PACKAGE + '.' + baseType.typeName);
this.$assert(402, beanChecker != null); // every type must be defined in the schema
// make a copy of current errors as normalization will erase them
var currentErrors = this._errors;
var errors = this._processJsonValidation({
beanDef : beanChecker,
json : beanDef
});
// restaure errors
this._errors = currentErrors;
if (errors.length > 0) {
this._logError(this.BEANCHECK_FAILED, [this._currentBeanName, errors]);
return false;
}
}
return true;
} | [
"function",
"(",
"beanDef",
")",
"{",
"if",
"(",
"this",
".",
"_options",
".",
"checkBeans",
"&&",
"(",
"!",
"this",
".",
"_options",
".",
"checkMultiTypes",
")",
"&&",
"this",
".",
"__loadedBeans",
"[",
"this",
".",
"_BEANS_SCHEMA_PACKAGE",
"]",
")",
"{",
"var",
"baseType",
"=",
"beanDef",
"[",
"this",
".",
"_MD_BASETYPE",
"]",
";",
"if",
"(",
"baseType",
"==",
"this",
".",
"_typeError",
")",
"{",
"return",
"false",
";",
"}",
"var",
"beanChecker",
"=",
"this",
".",
"_getBean",
"(",
"this",
".",
"_BEANS_SCHEMA_PACKAGE",
"+",
"'.'",
"+",
"baseType",
".",
"typeName",
")",
";",
"this",
".",
"$assert",
"(",
"402",
",",
"beanChecker",
"!=",
"null",
")",
";",
"var",
"currentErrors",
"=",
"this",
".",
"_errors",
";",
"var",
"errors",
"=",
"this",
".",
"_processJsonValidation",
"(",
"{",
"beanDef",
":",
"beanChecker",
",",
"json",
":",
"beanDef",
"}",
")",
";",
"this",
".",
"_errors",
"=",
"currentErrors",
";",
"if",
"(",
"errors",
".",
"length",
">",
"0",
")",
"{",
"this",
".",
"_logError",
"(",
"this",
".",
"BEANCHECK_FAILED",
",",
"[",
"this",
".",
"_currentBeanName",
",",
"errors",
"]",
")",
";",
"return",
"false",
";",
"}",
"}",
"return",
"true",
";",
"}"
]
| Called when preprocessing, just after having determined the type of bean. If beans check is enabled and
multitypes check is disabled, it checks that the bean is valid according to the corresponding schema in
aria.core.BaseTypes
@param {aria.core.BaseTypes:Bean} bean to check | [
"Called",
"when",
"preprocessing",
"just",
"after",
"having",
"determined",
"the",
"type",
"of",
"bean",
".",
"If",
"beans",
"check",
"is",
"enabled",
"and",
"multitypes",
"check",
"is",
"disabled",
"it",
"checks",
"that",
"the",
"bean",
"is",
"valid",
"according",
"to",
"the",
"corresponding",
"schema",
"in",
"aria",
".",
"core",
".",
"BaseTypes"
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/core/JsonValidator.js#L680-L706 | train |
|
ariatemplates/ariatemplates | src/aria/core/JsonValidator.js | function (bp) {
var noerrors = true;
// bean definition will be available in the waiting beans
var def = this.__waitingBeans[bp];
delete this.__waitingBeans[bp];
this.$assert(58, def);
var compiled = def.$compiled;
if (compiled) {
def.$beans = compiled(registerBean(def.$package), getBean, require("./JsonTypesCheck").fastNormalizers);
} else {
// validate incoming definition
if (this._options.checkBeans && this.__loadedBeans[this._BEANS_SCHEMA_PACKAGE]) {
var bean = this._getBean(this._BEANS_SCHEMA_PACKAGE + '.Package');
this.$assert(428, bean != null);
noerrors = noerrors && this.__logAllErrors(this._processJsonValidation({
beanDef : bean,
json : def
}));
}
// do not add defaults to default values (to be consistent with fast normalization)
this._options.addDefaults = false;
noerrors = noerrors && this.__logAllErrors(this.__preprocessBP(def));
}
if (noerrors) {
this.__loadedBeans[bp] = def;
return def;
} else {
throw new Error("Error while loading " + bp);
}
} | javascript | function (bp) {
var noerrors = true;
// bean definition will be available in the waiting beans
var def = this.__waitingBeans[bp];
delete this.__waitingBeans[bp];
this.$assert(58, def);
var compiled = def.$compiled;
if (compiled) {
def.$beans = compiled(registerBean(def.$package), getBean, require("./JsonTypesCheck").fastNormalizers);
} else {
// validate incoming definition
if (this._options.checkBeans && this.__loadedBeans[this._BEANS_SCHEMA_PACKAGE]) {
var bean = this._getBean(this._BEANS_SCHEMA_PACKAGE + '.Package');
this.$assert(428, bean != null);
noerrors = noerrors && this.__logAllErrors(this._processJsonValidation({
beanDef : bean,
json : def
}));
}
// do not add defaults to default values (to be consistent with fast normalization)
this._options.addDefaults = false;
noerrors = noerrors && this.__logAllErrors(this.__preprocessBP(def));
}
if (noerrors) {
this.__loadedBeans[bp] = def;
return def;
} else {
throw new Error("Error while loading " + bp);
}
} | [
"function",
"(",
"bp",
")",
"{",
"var",
"noerrors",
"=",
"true",
";",
"var",
"def",
"=",
"this",
".",
"__waitingBeans",
"[",
"bp",
"]",
";",
"delete",
"this",
".",
"__waitingBeans",
"[",
"bp",
"]",
";",
"this",
".",
"$assert",
"(",
"58",
",",
"def",
")",
";",
"var",
"compiled",
"=",
"def",
".",
"$compiled",
";",
"if",
"(",
"compiled",
")",
"{",
"def",
".",
"$beans",
"=",
"compiled",
"(",
"registerBean",
"(",
"def",
".",
"$package",
")",
",",
"getBean",
",",
"require",
"(",
"\"./JsonTypesCheck\"",
")",
".",
"fastNormalizers",
")",
";",
"}",
"else",
"{",
"if",
"(",
"this",
".",
"_options",
".",
"checkBeans",
"&&",
"this",
".",
"__loadedBeans",
"[",
"this",
".",
"_BEANS_SCHEMA_PACKAGE",
"]",
")",
"{",
"var",
"bean",
"=",
"this",
".",
"_getBean",
"(",
"this",
".",
"_BEANS_SCHEMA_PACKAGE",
"+",
"'.Package'",
")",
";",
"this",
".",
"$assert",
"(",
"428",
",",
"bean",
"!=",
"null",
")",
";",
"noerrors",
"=",
"noerrors",
"&&",
"this",
".",
"__logAllErrors",
"(",
"this",
".",
"_processJsonValidation",
"(",
"{",
"beanDef",
":",
"bean",
",",
"json",
":",
"def",
"}",
")",
")",
";",
"}",
"this",
".",
"_options",
".",
"addDefaults",
"=",
"false",
";",
"noerrors",
"=",
"noerrors",
"&&",
"this",
".",
"__logAllErrors",
"(",
"this",
".",
"__preprocessBP",
"(",
"def",
")",
")",
";",
"}",
"if",
"(",
"noerrors",
")",
"{",
"this",
".",
"__loadedBeans",
"[",
"bp",
"]",
"=",
"def",
";",
"return",
"def",
";",
"}",
"else",
"{",
"throw",
"new",
"Error",
"(",
"\"Error while loading \"",
"+",
"bp",
")",
";",
"}",
"}"
]
| Load the specified beans package.
@param {String} bp beans package | [
"Load",
"the",
"specified",
"beans",
"package",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/core/JsonValidator.js#L712-L745 | train |
|
ariatemplates/ariatemplates | src/aria/core/JsonValidator.js | function (def) {
var bp = def.$package; // beans package
Aria.$classes.push({
$classpath : bp
});
this.__waitingBeans[bp] = def;
var dep = [];
// load missing dependencies
// add $dependencies
var dependencies = def.$dependencies || [];
if (dependencies.length) {
dep = dep.concat(dependencies);
}
// add bean definition from namespaces
for (var key in def.$namespaces) {
if (def.$namespaces.hasOwnProperty(key)) {
dep.push(def.$namespaces[key]);
}
}
return Aria.loadOldDependencies({
classpaths : {
"JS" : dep
},
classDefinition : def,
complete : {
scope : this,
fn : this.__loadBeans,
args : [bp]
}
});
} | javascript | function (def) {
var bp = def.$package; // beans package
Aria.$classes.push({
$classpath : bp
});
this.__waitingBeans[bp] = def;
var dep = [];
// load missing dependencies
// add $dependencies
var dependencies = def.$dependencies || [];
if (dependencies.length) {
dep = dep.concat(dependencies);
}
// add bean definition from namespaces
for (var key in def.$namespaces) {
if (def.$namespaces.hasOwnProperty(key)) {
dep.push(def.$namespaces[key]);
}
}
return Aria.loadOldDependencies({
classpaths : {
"JS" : dep
},
classDefinition : def,
complete : {
scope : this,
fn : this.__loadBeans,
args : [bp]
}
});
} | [
"function",
"(",
"def",
")",
"{",
"var",
"bp",
"=",
"def",
".",
"$package",
";",
"Aria",
".",
"$classes",
".",
"push",
"(",
"{",
"$classpath",
":",
"bp",
"}",
")",
";",
"this",
".",
"__waitingBeans",
"[",
"bp",
"]",
"=",
"def",
";",
"var",
"dep",
"=",
"[",
"]",
";",
"var",
"dependencies",
"=",
"def",
".",
"$dependencies",
"||",
"[",
"]",
";",
"if",
"(",
"dependencies",
".",
"length",
")",
"{",
"dep",
"=",
"dep",
".",
"concat",
"(",
"dependencies",
")",
";",
"}",
"for",
"(",
"var",
"key",
"in",
"def",
".",
"$namespaces",
")",
"{",
"if",
"(",
"def",
".",
"$namespaces",
".",
"hasOwnProperty",
"(",
"key",
")",
")",
"{",
"dep",
".",
"push",
"(",
"def",
".",
"$namespaces",
"[",
"key",
"]",
")",
";",
"}",
"}",
"return",
"Aria",
".",
"loadOldDependencies",
"(",
"{",
"classpaths",
":",
"{",
"\"JS\"",
":",
"dep",
"}",
",",
"classDefinition",
":",
"def",
",",
"complete",
":",
"{",
"scope",
":",
"this",
",",
"fn",
":",
"this",
".",
"__loadBeans",
",",
"args",
":",
"[",
"bp",
"]",
"}",
"}",
")",
";",
"}"
]
| PUBLIC API
Base method used to declare beans. You should use Aria. beanDefinitions instead of this method.
@param {aria.core.BaseTypes:Package} beans beans package to declare | [
"PUBLIC",
"API",
"Base",
"method",
"used",
"to",
"declare",
"beans",
".",
"You",
"should",
"use",
"Aria",
".",
"beanDefinitions",
"instead",
"of",
"this",
"method",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/core/JsonValidator.js#L753-L787 | train |
|
ariatemplates/ariatemplates | src/aria/core/JsonValidator.js | function (json, beanName, throwsErrors) {
if (!this._options.checkEnabled) {
return true;
}
this._options.addDefaults = false;
return this.__logAllErrors(this._processJsonValidation({
json : json,
beanName : beanName
}), throwsErrors);
} | javascript | function (json, beanName, throwsErrors) {
if (!this._options.checkEnabled) {
return true;
}
this._options.addDefaults = false;
return this.__logAllErrors(this._processJsonValidation({
json : json,
beanName : beanName
}), throwsErrors);
} | [
"function",
"(",
"json",
",",
"beanName",
",",
"throwsErrors",
")",
"{",
"if",
"(",
"!",
"this",
".",
"_options",
".",
"checkEnabled",
")",
"{",
"return",
"true",
";",
"}",
"this",
".",
"_options",
".",
"addDefaults",
"=",
"false",
";",
"return",
"this",
".",
"__logAllErrors",
"(",
"this",
".",
"_processJsonValidation",
"(",
"{",
"json",
":",
"json",
",",
"beanName",
":",
"beanName",
"}",
")",
",",
"throwsErrors",
")",
";",
"}"
]
| Check that the json structure complies with the given bean. All errors are logged.
@param {Object} json json to check;
@param {String} bean bean to use
@param {Boolean} throwsErrors (default false)
@return {Boolean} true if the json structure complies with the given bean, false otherwise | [
"Check",
"that",
"the",
"json",
"structure",
"complies",
"with",
"the",
"given",
"bean",
".",
"All",
"errors",
"are",
"logged",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/core/JsonValidator.js#L818-L827 | train |
|
ariatemplates/ariatemplates | src/aria/utils/ClassList.js | function (domElt) {
this.setClassName = function (className) {
domElt.className = className;
};
this.getClassName = function () {
return domElt.className;
};
this._dispose = function () {
domElt = null;
this._dispose = null;
};
} | javascript | function (domElt) {
this.setClassName = function (className) {
domElt.className = className;
};
this.getClassName = function () {
return domElt.className;
};
this._dispose = function () {
domElt = null;
this._dispose = null;
};
} | [
"function",
"(",
"domElt",
")",
"{",
"this",
".",
"setClassName",
"=",
"function",
"(",
"className",
")",
"{",
"domElt",
".",
"className",
"=",
"className",
";",
"}",
";",
"this",
".",
"getClassName",
"=",
"function",
"(",
")",
"{",
"return",
"domElt",
".",
"className",
";",
"}",
";",
"this",
".",
"_dispose",
"=",
"function",
"(",
")",
"{",
"domElt",
"=",
"null",
";",
"this",
".",
"_dispose",
"=",
"null",
";",
"}",
";",
"}"
]
| Create a DOM Wrapper object to allow safe changes in the DOM classes without giving direct access to the DOM.
Note that a closure is used to prevent access to the domElt object from the template.
@param {HTMLElement} domElt DOM element which is wrapped | [
"Create",
"a",
"DOM",
"Wrapper",
"object",
"to",
"allow",
"safe",
"changes",
"in",
"the",
"DOM",
"classes",
"without",
"giving",
"direct",
"access",
"to",
"the",
"DOM",
".",
"Note",
"that",
"a",
"closure",
"is",
"used",
"to",
"prevent",
"access",
"to",
"the",
"domElt",
"object",
"from",
"the",
"template",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/utils/ClassList.js#L29-L42 | train |
|
ariatemplates/ariatemplates | src/aria/utils/ClassList.js | function (className) {
var classes = this.getClassName().split(" ");
for (var i = 0, ii = classes.length; i < ii; i++) {
if (classes[i] == className) {
return true;
}
}
return false;
} | javascript | function (className) {
var classes = this.getClassName().split(" ");
for (var i = 0, ii = classes.length; i < ii; i++) {
if (classes[i] == className) {
return true;
}
}
return false;
} | [
"function",
"(",
"className",
")",
"{",
"var",
"classes",
"=",
"this",
".",
"getClassName",
"(",
")",
".",
"split",
"(",
"\" \"",
")",
";",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"ii",
"=",
"classes",
".",
"length",
";",
"i",
"<",
"ii",
";",
"i",
"++",
")",
"{",
"if",
"(",
"classes",
"[",
"i",
"]",
"==",
"className",
")",
"{",
"return",
"true",
";",
"}",
"}",
"return",
"false",
";",
"}"
]
| Returns true if the class name is in the class attribute
@param {String} className The class name to test
@return {Boolean} | [
"Returns",
"true",
"if",
"the",
"class",
"name",
"is",
"in",
"the",
"class",
"attribute"
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/utils/ClassList.js#L81-L89 | train |
|
ariatemplates/ariatemplates | src/aria/utils/ClassList.js | function (oldClassName, newClassName) {
var rem = [], add = [];
if (!!oldClassName) {
rem = (typeof oldClassName == "string") ? oldClassName.split(" ") : oldClassName;
}
if (!!newClassName) {
add = (typeof newClassName == "string") ? newClassName.split(" ") : newClassName;
}
var classString = this.getClassName(), found = false;
var classes = !!classString ? classString.split(" ") : [];
// Remove oldClassNames
for (var j = classes.length - 1; j >= 0; j -= 1) {
if (!classes[j]) {
classes.splice(j, 1);
continue;
}
// Remove duplicates
for (var d = add.length - 1; d >= 0; d -= 1) {
if (classes[j] == add[d]) {
// Remove it from classes as I'm going to add it again
classes.splice(j, 1);
}
}
for (var k = rem.length - 1; k >= 0; k -= 1) {
if (classes[j] == rem[k]) {
classes.splice(j, 1);
found = true; // Iterate for multiple classes
}
}
}
if (!found && add.length === 0) {
return;
}
classes.push.apply(classes, add);
this.setClassName(classes.join(" "));
} | javascript | function (oldClassName, newClassName) {
var rem = [], add = [];
if (!!oldClassName) {
rem = (typeof oldClassName == "string") ? oldClassName.split(" ") : oldClassName;
}
if (!!newClassName) {
add = (typeof newClassName == "string") ? newClassName.split(" ") : newClassName;
}
var classString = this.getClassName(), found = false;
var classes = !!classString ? classString.split(" ") : [];
// Remove oldClassNames
for (var j = classes.length - 1; j >= 0; j -= 1) {
if (!classes[j]) {
classes.splice(j, 1);
continue;
}
// Remove duplicates
for (var d = add.length - 1; d >= 0; d -= 1) {
if (classes[j] == add[d]) {
// Remove it from classes as I'm going to add it again
classes.splice(j, 1);
}
}
for (var k = rem.length - 1; k >= 0; k -= 1) {
if (classes[j] == rem[k]) {
classes.splice(j, 1);
found = true; // Iterate for multiple classes
}
}
}
if (!found && add.length === 0) {
return;
}
classes.push.apply(classes, add);
this.setClassName(classes.join(" "));
} | [
"function",
"(",
"oldClassName",
",",
"newClassName",
")",
"{",
"var",
"rem",
"=",
"[",
"]",
",",
"add",
"=",
"[",
"]",
";",
"if",
"(",
"!",
"!",
"oldClassName",
")",
"{",
"rem",
"=",
"(",
"typeof",
"oldClassName",
"==",
"\"string\"",
")",
"?",
"oldClassName",
".",
"split",
"(",
"\" \"",
")",
":",
"oldClassName",
";",
"}",
"if",
"(",
"!",
"!",
"newClassName",
")",
"{",
"add",
"=",
"(",
"typeof",
"newClassName",
"==",
"\"string\"",
")",
"?",
"newClassName",
".",
"split",
"(",
"\" \"",
")",
":",
"newClassName",
";",
"}",
"var",
"classString",
"=",
"this",
".",
"getClassName",
"(",
")",
",",
"found",
"=",
"false",
";",
"var",
"classes",
"=",
"!",
"!",
"classString",
"?",
"classString",
".",
"split",
"(",
"\" \"",
")",
":",
"[",
"]",
";",
"for",
"(",
"var",
"j",
"=",
"classes",
".",
"length",
"-",
"1",
";",
"j",
">=",
"0",
";",
"j",
"-=",
"1",
")",
"{",
"if",
"(",
"!",
"classes",
"[",
"j",
"]",
")",
"{",
"classes",
".",
"splice",
"(",
"j",
",",
"1",
")",
";",
"continue",
";",
"}",
"for",
"(",
"var",
"d",
"=",
"add",
".",
"length",
"-",
"1",
";",
"d",
">=",
"0",
";",
"d",
"-=",
"1",
")",
"{",
"if",
"(",
"classes",
"[",
"j",
"]",
"==",
"add",
"[",
"d",
"]",
")",
"{",
"classes",
".",
"splice",
"(",
"j",
",",
"1",
")",
";",
"}",
"}",
"for",
"(",
"var",
"k",
"=",
"rem",
".",
"length",
"-",
"1",
";",
"k",
">=",
"0",
";",
"k",
"-=",
"1",
")",
"{",
"if",
"(",
"classes",
"[",
"j",
"]",
"==",
"rem",
"[",
"k",
"]",
")",
"{",
"classes",
".",
"splice",
"(",
"j",
",",
"1",
")",
";",
"found",
"=",
"true",
";",
"}",
"}",
"}",
"if",
"(",
"!",
"found",
"&&",
"add",
".",
"length",
"===",
"0",
")",
"{",
"return",
";",
"}",
"classes",
".",
"push",
".",
"apply",
"(",
"classes",
",",
"add",
")",
";",
"this",
".",
"setClassName",
"(",
"classes",
".",
"join",
"(",
"\" \"",
")",
")",
";",
"}"
]
| Replaces a class with another class. If no oldClassName is present, the newClassName is simply added.
@param {String|Array} oldClassName The class name or an array of class names to be replaced
@param {String|Array} newClassName The class name or an array of class names that will be replacing the old
class name | [
"Replaces",
"a",
"class",
"with",
"another",
"class",
".",
"If",
"no",
"oldClassName",
"is",
"present",
"the",
"newClassName",
"is",
"simply",
"added",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/utils/ClassList.js#L96-L139 | train |
|
ariatemplates/ariatemplates | src/aria/touch/Pinch.js | function () {
return [{
evt : this.touchEventMap.touchmove,
cb : {
fn : this._pinchMove,
scope : this
}
}, {
evt : this.touchEventMap.touchend,
cb : {
fn : this._pinchEnd,
scope : this
}
}];
} | javascript | function () {
return [{
evt : this.touchEventMap.touchmove,
cb : {
fn : this._pinchMove,
scope : this
}
}, {
evt : this.touchEventMap.touchend,
cb : {
fn : this._pinchEnd,
scope : this
}
}];
} | [
"function",
"(",
")",
"{",
"return",
"[",
"{",
"evt",
":",
"this",
".",
"touchEventMap",
".",
"touchmove",
",",
"cb",
":",
"{",
"fn",
":",
"this",
".",
"_pinchMove",
",",
"scope",
":",
"this",
"}",
"}",
",",
"{",
"evt",
":",
"this",
".",
"touchEventMap",
".",
"touchend",
",",
"cb",
":",
"{",
"fn",
":",
"this",
".",
"_pinchEnd",
",",
"scope",
":",
"this",
"}",
"}",
"]",
";",
"}"
]
| Additional listeners for the Pinch gesture.
@protected | [
"Additional",
"listeners",
"for",
"the",
"Pinch",
"gesture",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/touch/Pinch.js#L107-L121 | train |
|
ariatemplates/ariatemplates | src/aria/touch/Pinch.js | function (x1, y1, x2, y2) {
return Math.atan2(y2 - y1, x2 - x1) * 180 / Math.PI;
} | javascript | function (x1, y1, x2, y2) {
return Math.atan2(y2 - y1, x2 - x1) * 180 / Math.PI;
} | [
"function",
"(",
"x1",
",",
"y1",
",",
"x2",
",",
"y2",
")",
"{",
"return",
"Math",
".",
"atan2",
"(",
"y2",
"-",
"y1",
",",
"x2",
"-",
"x1",
")",
"*",
"180",
"/",
"Math",
".",
"PI",
";",
"}"
]
| Returns the angle of the line defined by two points, and the x axes.
@param {Integer} x1 x of the first point
@param {Integer} y1 y of the first point
@param {Integer} x2 x of the second point
@param {Integer} y2 y of the second point
@private
@return {Number} the angle in degrees ]-180; 180] | [
"Returns",
"the",
"angle",
"of",
"the",
"line",
"defined",
"by",
"two",
"points",
"and",
"the",
"x",
"axes",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/touch/Pinch.js#L285-L287 | train |
|
ariatemplates/ariatemplates | src/aria/touch/widgets/Popup.js | function (cfg, context, lineNumber) {
this.$BindableWidget.constructor.apply(this, arguments);
this._cfgOk = ariaCoreJsonValidator.validateCfg(this.WIDGET_CFG, cfg);
if (!this._cfgOk) {
return;
}
this._registerBindings();
/**
* Id generated for the button DOM element of the slider.
* @type String
* @protected
*/
this._domId = cfg.id ? context.$getId(cfg.id) : this._createDynamicId();
} | javascript | function (cfg, context, lineNumber) {
this.$BindableWidget.constructor.apply(this, arguments);
this._cfgOk = ariaCoreJsonValidator.validateCfg(this.WIDGET_CFG, cfg);
if (!this._cfgOk) {
return;
}
this._registerBindings();
/**
* Id generated for the button DOM element of the slider.
* @type String
* @protected
*/
this._domId = cfg.id ? context.$getId(cfg.id) : this._createDynamicId();
} | [
"function",
"(",
"cfg",
",",
"context",
",",
"lineNumber",
")",
"{",
"this",
".",
"$BindableWidget",
".",
"constructor",
".",
"apply",
"(",
"this",
",",
"arguments",
")",
";",
"this",
".",
"_cfgOk",
"=",
"ariaCoreJsonValidator",
".",
"validateCfg",
"(",
"this",
".",
"WIDGET_CFG",
",",
"cfg",
")",
";",
"if",
"(",
"!",
"this",
".",
"_cfgOk",
")",
"{",
"return",
";",
"}",
"this",
".",
"_registerBindings",
"(",
")",
";",
"this",
".",
"_domId",
"=",
"cfg",
".",
"id",
"?",
"context",
".",
"$getId",
"(",
"cfg",
".",
"id",
")",
":",
"this",
".",
"_createDynamicId",
"(",
")",
";",
"}"
]
| Popup Constructor.
@param {aria.touch.widgets.PopupCfgBeans:PopupCfg} cfg popup configuration
@param {aria.templates.TemplateCtxt} context template context
@param {Number} lineNumber line number in the template | [
"Popup",
"Constructor",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/touch/widgets/Popup.js#L43-L61 | train |
|
ariatemplates/ariatemplates | src/aria/touch/widgets/Popup.js | function (out) {
out.write("<div class=\"" + this.CSS_CLASS + "\">");
if (this._cfg.contentMacro) {
out.callMacro(this._cfg.contentMacro);
}
out.write("</div>");
} | javascript | function (out) {
out.write("<div class=\"" + this.CSS_CLASS + "\">");
if (this._cfg.contentMacro) {
out.callMacro(this._cfg.contentMacro);
}
out.write("</div>");
} | [
"function",
"(",
"out",
")",
"{",
"out",
".",
"write",
"(",
"\"<div class=\\\"\"",
"+",
"\\\"",
"+",
"this",
".",
"CSS_CLASS",
")",
";",
"\"\\\">\"",
"\\\"",
"}"
]
| Callback called when the popup's main section is refreshed
@param {aria.templates.MarkupWriter} out the writer Object to use to output markup
@private | [
"Callback",
"called",
"when",
"the",
"popup",
"s",
"main",
"section",
"is",
"refreshed"
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/touch/widgets/Popup.js#L119-L127 | train |
|
ariatemplates/ariatemplates | src/aria/touch/widgets/Popup.js | function () {
var cfg = this._cfg;
var refreshParams = {
section : "__popup_" + this._domId,
writerCallback : {
fn : this._writerCallback,
scope : this
}
};
var section = this._context.getRefreshedSection(refreshParams);
var popup = new aria.popups.Popup();
this._popup = popup;
popup.$on({
"onAfterClose" : this.disposePopup,
scope : this
});
// default the position to 0,0 if nothing is defined
if (cfg.domReference === null && cfg.referenceId === null && cfg.absolutePosition === null
&& cfg.center === false) {
cfg.absolutePosition = {
top : 0,
left : 0
};
}
var domReference = null;
if (cfg.domReference) {
domReference = cfg.domReference;
} else if (cfg.referenceId) {
domReference = ariaUtilsDom.getElementById(this._context.$getId(cfg.referenceId));
}
popup.open({
section : section,
keepSection : true,
modal : cfg.modal,
maskCssClass : cfg.maskCssClass,
domReference : domReference,
absolutePosition : cfg.absolutePosition,
center : cfg.center,
maximized : cfg.maximized,
closeOnMouseClick : cfg.closeOnMouseClick,
closeOnMouseScroll : cfg.closeOnMouseScroll,
closeOnMouseOut : cfg.closeOnMouseOut,
closeOnMouseOutDelay : cfg.closeOnMouseOutDelay,
preferredPositions : cfg.preferredPositions,
offset : cfg.offset,
ignoreClicksOn : cfg.ignoreClicksOn,
parentDialog : cfg.parentDialog,
zIndexKeepOpenOrder : cfg.zIndexKeepOpenOrder,
preferredWidth : cfg.preferredWidth,
animateOut : cfg.animateOut,
animateIn : cfg.animateIn
});
} | javascript | function () {
var cfg = this._cfg;
var refreshParams = {
section : "__popup_" + this._domId,
writerCallback : {
fn : this._writerCallback,
scope : this
}
};
var section = this._context.getRefreshedSection(refreshParams);
var popup = new aria.popups.Popup();
this._popup = popup;
popup.$on({
"onAfterClose" : this.disposePopup,
scope : this
});
// default the position to 0,0 if nothing is defined
if (cfg.domReference === null && cfg.referenceId === null && cfg.absolutePosition === null
&& cfg.center === false) {
cfg.absolutePosition = {
top : 0,
left : 0
};
}
var domReference = null;
if (cfg.domReference) {
domReference = cfg.domReference;
} else if (cfg.referenceId) {
domReference = ariaUtilsDom.getElementById(this._context.$getId(cfg.referenceId));
}
popup.open({
section : section,
keepSection : true,
modal : cfg.modal,
maskCssClass : cfg.maskCssClass,
domReference : domReference,
absolutePosition : cfg.absolutePosition,
center : cfg.center,
maximized : cfg.maximized,
closeOnMouseClick : cfg.closeOnMouseClick,
closeOnMouseScroll : cfg.closeOnMouseScroll,
closeOnMouseOut : cfg.closeOnMouseOut,
closeOnMouseOutDelay : cfg.closeOnMouseOutDelay,
preferredPositions : cfg.preferredPositions,
offset : cfg.offset,
ignoreClicksOn : cfg.ignoreClicksOn,
parentDialog : cfg.parentDialog,
zIndexKeepOpenOrder : cfg.zIndexKeepOpenOrder,
preferredWidth : cfg.preferredWidth,
animateOut : cfg.animateOut,
animateIn : cfg.animateIn
});
} | [
"function",
"(",
")",
"{",
"var",
"cfg",
"=",
"this",
".",
"_cfg",
";",
"var",
"refreshParams",
"=",
"{",
"section",
":",
"\"__popup_\"",
"+",
"this",
".",
"_domId",
",",
"writerCallback",
":",
"{",
"fn",
":",
"this",
".",
"_writerCallback",
",",
"scope",
":",
"this",
"}",
"}",
";",
"var",
"section",
"=",
"this",
".",
"_context",
".",
"getRefreshedSection",
"(",
"refreshParams",
")",
";",
"var",
"popup",
"=",
"new",
"aria",
".",
"popups",
".",
"Popup",
"(",
")",
";",
"this",
".",
"_popup",
"=",
"popup",
";",
"popup",
".",
"$on",
"(",
"{",
"\"onAfterClose\"",
":",
"this",
".",
"disposePopup",
",",
"scope",
":",
"this",
"}",
")",
";",
"if",
"(",
"cfg",
".",
"domReference",
"===",
"null",
"&&",
"cfg",
".",
"referenceId",
"===",
"null",
"&&",
"cfg",
".",
"absolutePosition",
"===",
"null",
"&&",
"cfg",
".",
"center",
"===",
"false",
")",
"{",
"cfg",
".",
"absolutePosition",
"=",
"{",
"top",
":",
"0",
",",
"left",
":",
"0",
"}",
";",
"}",
"var",
"domReference",
"=",
"null",
";",
"if",
"(",
"cfg",
".",
"domReference",
")",
"{",
"domReference",
"=",
"cfg",
".",
"domReference",
";",
"}",
"else",
"if",
"(",
"cfg",
".",
"referenceId",
")",
"{",
"domReference",
"=",
"ariaUtilsDom",
".",
"getElementById",
"(",
"this",
".",
"_context",
".",
"$getId",
"(",
"cfg",
".",
"referenceId",
")",
")",
";",
"}",
"popup",
".",
"open",
"(",
"{",
"section",
":",
"section",
",",
"keepSection",
":",
"true",
",",
"modal",
":",
"cfg",
".",
"modal",
",",
"maskCssClass",
":",
"cfg",
".",
"maskCssClass",
",",
"domReference",
":",
"domReference",
",",
"absolutePosition",
":",
"cfg",
".",
"absolutePosition",
",",
"center",
":",
"cfg",
".",
"center",
",",
"maximized",
":",
"cfg",
".",
"maximized",
",",
"closeOnMouseClick",
":",
"cfg",
".",
"closeOnMouseClick",
",",
"closeOnMouseScroll",
":",
"cfg",
".",
"closeOnMouseScroll",
",",
"closeOnMouseOut",
":",
"cfg",
".",
"closeOnMouseOut",
",",
"closeOnMouseOutDelay",
":",
"cfg",
".",
"closeOnMouseOutDelay",
",",
"preferredPositions",
":",
"cfg",
".",
"preferredPositions",
",",
"offset",
":",
"cfg",
".",
"offset",
",",
"ignoreClicksOn",
":",
"cfg",
".",
"ignoreClicksOn",
",",
"parentDialog",
":",
"cfg",
".",
"parentDialog",
",",
"zIndexKeepOpenOrder",
":",
"cfg",
".",
"zIndexKeepOpenOrder",
",",
"preferredWidth",
":",
"cfg",
".",
"preferredWidth",
",",
"animateOut",
":",
"cfg",
".",
"animateOut",
",",
"animateIn",
":",
"cfg",
".",
"animateIn",
"}",
")",
";",
"}"
]
| Shows the popup | [
"Shows",
"the",
"popup"
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/touch/widgets/Popup.js#L163-L220 | train |
|
ariatemplates/ariatemplates | src/aria/popups/PopupManager.js | function () {
for (var i = this.openedPopups.length - 1; i >= 0; i--) {
var popup = this.openedPopups[i];
popup.close();
}
} | javascript | function () {
for (var i = this.openedPopups.length - 1; i >= 0; i--) {
var popup = this.openedPopups[i];
popup.close();
}
} | [
"function",
"(",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"this",
".",
"openedPopups",
".",
"length",
"-",
"1",
";",
"i",
">=",
"0",
";",
"i",
"--",
")",
"{",
"var",
"popup",
"=",
"this",
".",
"openedPopups",
"[",
"i",
"]",
";",
"popup",
".",
"close",
"(",
")",
";",
"}",
"}"
]
| Close all opened popups
@protected | [
"Close",
"all",
"opened",
"popups"
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/popups/PopupManager.js#L145-L150 | train |
|
ariatemplates/ariatemplates | src/aria/popups/PopupManager.js | function (domEvent, popup) {
var documentScroll = ariaUtilsDom._getDocumentScroll();
var clickPosition = {
'top' : domEvent.clientY + documentScroll.scrollTop,
'left' : domEvent.clientX + documentScroll.scrollLeft
};
var popupPosition = {
'top' : popup.computedStyle.top,
'left' : popup.computedStyle.left
};
var popupSize = {
'width' : popup.computedStyle.width,
'height' : popup.computedStyle.height
};
return (clickPosition.top >= popupPosition.top && clickPosition.left >= popupPosition.left
&& clickPosition.top <= popupPosition.top + popupSize.height && clickPosition.left <= popupPosition.left
+ popupSize.width);
} | javascript | function (domEvent, popup) {
var documentScroll = ariaUtilsDom._getDocumentScroll();
var clickPosition = {
'top' : domEvent.clientY + documentScroll.scrollTop,
'left' : domEvent.clientX + documentScroll.scrollLeft
};
var popupPosition = {
'top' : popup.computedStyle.top,
'left' : popup.computedStyle.left
};
var popupSize = {
'width' : popup.computedStyle.width,
'height' : popup.computedStyle.height
};
return (clickPosition.top >= popupPosition.top && clickPosition.left >= popupPosition.left
&& clickPosition.top <= popupPosition.top + popupSize.height && clickPosition.left <= popupPosition.left
+ popupSize.width);
} | [
"function",
"(",
"domEvent",
",",
"popup",
")",
"{",
"var",
"documentScroll",
"=",
"ariaUtilsDom",
".",
"_getDocumentScroll",
"(",
")",
";",
"var",
"clickPosition",
"=",
"{",
"'top'",
":",
"domEvent",
".",
"clientY",
"+",
"documentScroll",
".",
"scrollTop",
",",
"'left'",
":",
"domEvent",
".",
"clientX",
"+",
"documentScroll",
".",
"scrollLeft",
"}",
";",
"var",
"popupPosition",
"=",
"{",
"'top'",
":",
"popup",
".",
"computedStyle",
".",
"top",
",",
"'left'",
":",
"popup",
".",
"computedStyle",
".",
"left",
"}",
";",
"var",
"popupSize",
"=",
"{",
"'width'",
":",
"popup",
".",
"computedStyle",
".",
"width",
",",
"'height'",
":",
"popup",
".",
"computedStyle",
".",
"height",
"}",
";",
"return",
"(",
"clickPosition",
".",
"top",
">=",
"popupPosition",
".",
"top",
"&&",
"clickPosition",
".",
"left",
">=",
"popupPosition",
".",
"left",
"&&",
"clickPosition",
".",
"top",
"<=",
"popupPosition",
".",
"top",
"+",
"popupSize",
".",
"height",
"&&",
"clickPosition",
".",
"left",
"<=",
"popupPosition",
".",
"left",
"+",
"popupSize",
".",
"width",
")",
";",
"}"
]
| Check if an event happen in the box a a popup
@protected
@param {aria.DomEvent} domEvent
@param {aria.popups.Popup} popup
@return {Boolean} | [
"Check",
"if",
"an",
"event",
"happen",
"in",
"the",
"box",
"a",
"a",
"popup"
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/popups/PopupManager.js#L159-L178 | train |
|
ariatemplates/ariatemplates | src/aria/popups/PopupManager.js | function () {
for (var i = this.popups.length - 1; i >= 0; i--) {
var popup = this.popups[i];
this.unregisterPopup(popup);
}
} | javascript | function () {
for (var i = this.popups.length - 1; i >= 0; i--) {
var popup = this.popups[i];
this.unregisterPopup(popup);
}
} | [
"function",
"(",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"this",
".",
"popups",
".",
"length",
"-",
"1",
";",
"i",
">=",
"0",
";",
"i",
"--",
")",
"{",
"var",
"popup",
"=",
"this",
".",
"popups",
"[",
"i",
"]",
";",
"this",
".",
"unregisterPopup",
"(",
"popup",
")",
";",
"}",
"}"
]
| Unregister all popups
@protected | [
"Unregister",
"all",
"popups"
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/popups/PopupManager.js#L184-L189 | train |
|
ariatemplates/ariatemplates | src/aria/popups/PopupManager.js | function () {
this.disconnectEvents();
ariaUtilsAriaWindow.attachWindow();
this._document = Aria.$window.document;
utilsEvent.addListener(this._document, "mousedown", {
fn : this.onDocumentClick,
scope : this
}, true);
utilsEvent.addListener(this._document, "touchend", {
fn : this.onDocumentClick,
scope : this
}, true);
utilsEvent.addListener(this._document, "mouseout", {
fn : this.onDocumentMouseOut,
scope : this
}, true);
utilsEvent.addListener(this._document, "mousewheel", {
fn : this.onDocumentMouseScroll,
scope : this
}, true);
utilsEvent.addListener(this._document.body, "focusin", {
fn : this.onDocumentFocusIn,
scope : this
});
if (ariaCoreBrowser.isOldIE) {
// IE does not support scroll event on the document until IE9
ariaUtilsEvent.addListener(Aria.$window, "mousewheel", {
fn : this._onScroll,
scope : this
}, true);
} else {
// All other browsers support scroll event on the document
ariaUtilsEvent.addListener(Aria.$window, "scroll", {
fn : this._onScroll,
scope : this
}, true);
}
} | javascript | function () {
this.disconnectEvents();
ariaUtilsAriaWindow.attachWindow();
this._document = Aria.$window.document;
utilsEvent.addListener(this._document, "mousedown", {
fn : this.onDocumentClick,
scope : this
}, true);
utilsEvent.addListener(this._document, "touchend", {
fn : this.onDocumentClick,
scope : this
}, true);
utilsEvent.addListener(this._document, "mouseout", {
fn : this.onDocumentMouseOut,
scope : this
}, true);
utilsEvent.addListener(this._document, "mousewheel", {
fn : this.onDocumentMouseScroll,
scope : this
}, true);
utilsEvent.addListener(this._document.body, "focusin", {
fn : this.onDocumentFocusIn,
scope : this
});
if (ariaCoreBrowser.isOldIE) {
// IE does not support scroll event on the document until IE9
ariaUtilsEvent.addListener(Aria.$window, "mousewheel", {
fn : this._onScroll,
scope : this
}, true);
} else {
// All other browsers support scroll event on the document
ariaUtilsEvent.addListener(Aria.$window, "scroll", {
fn : this._onScroll,
scope : this
}, true);
}
} | [
"function",
"(",
")",
"{",
"this",
".",
"disconnectEvents",
"(",
")",
";",
"ariaUtilsAriaWindow",
".",
"attachWindow",
"(",
")",
";",
"this",
".",
"_document",
"=",
"Aria",
".",
"$window",
".",
"document",
";",
"utilsEvent",
".",
"addListener",
"(",
"this",
".",
"_document",
",",
"\"mousedown\"",
",",
"{",
"fn",
":",
"this",
".",
"onDocumentClick",
",",
"scope",
":",
"this",
"}",
",",
"true",
")",
";",
"utilsEvent",
".",
"addListener",
"(",
"this",
".",
"_document",
",",
"\"touchend\"",
",",
"{",
"fn",
":",
"this",
".",
"onDocumentClick",
",",
"scope",
":",
"this",
"}",
",",
"true",
")",
";",
"utilsEvent",
".",
"addListener",
"(",
"this",
".",
"_document",
",",
"\"mouseout\"",
",",
"{",
"fn",
":",
"this",
".",
"onDocumentMouseOut",
",",
"scope",
":",
"this",
"}",
",",
"true",
")",
";",
"utilsEvent",
".",
"addListener",
"(",
"this",
".",
"_document",
",",
"\"mousewheel\"",
",",
"{",
"fn",
":",
"this",
".",
"onDocumentMouseScroll",
",",
"scope",
":",
"this",
"}",
",",
"true",
")",
";",
"utilsEvent",
".",
"addListener",
"(",
"this",
".",
"_document",
".",
"body",
",",
"\"focusin\"",
",",
"{",
"fn",
":",
"this",
".",
"onDocumentFocusIn",
",",
"scope",
":",
"this",
"}",
")",
";",
"if",
"(",
"ariaCoreBrowser",
".",
"isOldIE",
")",
"{",
"ariaUtilsEvent",
".",
"addListener",
"(",
"Aria",
".",
"$window",
",",
"\"mousewheel\"",
",",
"{",
"fn",
":",
"this",
".",
"_onScroll",
",",
"scope",
":",
"this",
"}",
",",
"true",
")",
";",
"}",
"else",
"{",
"ariaUtilsEvent",
".",
"addListener",
"(",
"Aria",
".",
"$window",
",",
"\"scroll\"",
",",
"{",
"fn",
":",
"this",
".",
"_onScroll",
",",
"scope",
":",
"this",
"}",
",",
"true",
")",
";",
"}",
"}"
]
| Connect or reconnect global events on the document | [
"Connect",
"or",
"reconnect",
"global",
"events",
"on",
"the",
"document"
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/popups/PopupManager.js#L194-L234 | train |
|
ariatemplates/ariatemplates | src/aria/popups/PopupManager.js | function () {
if (this._document) {
utilsEvent.removeListener(this._document, "mousedown", {
fn : this.onDocumentClick
});
utilsEvent.removeListener(this._document, "touchend", {
fn : this.onDocumentClick
});
utilsEvent.removeListener(this._document, "mouseout", {
fn : this.onDocumentMouseOut
});
utilsEvent.removeListener(this._document, "mousewheel", {
fn : this.onDocumentMouseScroll
});
utilsEvent.removeListener(this._document.body, "focusin", {
fn : this.onDocumentFocusIn
});
ariaUtilsAriaWindow.detachWindow();
this._document = null;
if (ariaCoreBrowser.isOldIE) {
ariaUtilsEvent.removeListener(Aria.$window, "mousewheel", {
fn : this._onScroll
});
} else {
ariaUtilsEvent.removeListener(Aria.$window, "scroll", {
fn : this._onScroll
});
}
}
} | javascript | function () {
if (this._document) {
utilsEvent.removeListener(this._document, "mousedown", {
fn : this.onDocumentClick
});
utilsEvent.removeListener(this._document, "touchend", {
fn : this.onDocumentClick
});
utilsEvent.removeListener(this._document, "mouseout", {
fn : this.onDocumentMouseOut
});
utilsEvent.removeListener(this._document, "mousewheel", {
fn : this.onDocumentMouseScroll
});
utilsEvent.removeListener(this._document.body, "focusin", {
fn : this.onDocumentFocusIn
});
ariaUtilsAriaWindow.detachWindow();
this._document = null;
if (ariaCoreBrowser.isOldIE) {
ariaUtilsEvent.removeListener(Aria.$window, "mousewheel", {
fn : this._onScroll
});
} else {
ariaUtilsEvent.removeListener(Aria.$window, "scroll", {
fn : this._onScroll
});
}
}
} | [
"function",
"(",
")",
"{",
"if",
"(",
"this",
".",
"_document",
")",
"{",
"utilsEvent",
".",
"removeListener",
"(",
"this",
".",
"_document",
",",
"\"mousedown\"",
",",
"{",
"fn",
":",
"this",
".",
"onDocumentClick",
"}",
")",
";",
"utilsEvent",
".",
"removeListener",
"(",
"this",
".",
"_document",
",",
"\"touchend\"",
",",
"{",
"fn",
":",
"this",
".",
"onDocumentClick",
"}",
")",
";",
"utilsEvent",
".",
"removeListener",
"(",
"this",
".",
"_document",
",",
"\"mouseout\"",
",",
"{",
"fn",
":",
"this",
".",
"onDocumentMouseOut",
"}",
")",
";",
"utilsEvent",
".",
"removeListener",
"(",
"this",
".",
"_document",
",",
"\"mousewheel\"",
",",
"{",
"fn",
":",
"this",
".",
"onDocumentMouseScroll",
"}",
")",
";",
"utilsEvent",
".",
"removeListener",
"(",
"this",
".",
"_document",
".",
"body",
",",
"\"focusin\"",
",",
"{",
"fn",
":",
"this",
".",
"onDocumentFocusIn",
"}",
")",
";",
"ariaUtilsAriaWindow",
".",
"detachWindow",
"(",
")",
";",
"this",
".",
"_document",
"=",
"null",
";",
"if",
"(",
"ariaCoreBrowser",
".",
"isOldIE",
")",
"{",
"ariaUtilsEvent",
".",
"removeListener",
"(",
"Aria",
".",
"$window",
",",
"\"mousewheel\"",
",",
"{",
"fn",
":",
"this",
".",
"_onScroll",
"}",
")",
";",
"}",
"else",
"{",
"ariaUtilsEvent",
".",
"removeListener",
"(",
"Aria",
".",
"$window",
",",
"\"scroll\"",
",",
"{",
"fn",
":",
"this",
".",
"_onScroll",
"}",
")",
";",
"}",
"}",
"}"
]
| Disconnect global events on the document | [
"Disconnect",
"global",
"events",
"on",
"the",
"document"
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/popups/PopupManager.js#L239-L268 | train |
|
ariatemplates/ariatemplates | src/aria/popups/PopupManager.js | function () {
var navManager = ariaTemplatesNavigationManager;
navManager.addGlobalKeyMap({
key : "ESCAPE",
modal : true,
callback : {
fn : this._raiseOnEscapeEvent,
scope : this
}
});
// global navigation is disabled in case of a modal popup
navManager.setModalBehaviour(true);
} | javascript | function () {
var navManager = ariaTemplatesNavigationManager;
navManager.addGlobalKeyMap({
key : "ESCAPE",
modal : true,
callback : {
fn : this._raiseOnEscapeEvent,
scope : this
}
});
// global navigation is disabled in case of a modal popup
navManager.setModalBehaviour(true);
} | [
"function",
"(",
")",
"{",
"var",
"navManager",
"=",
"ariaTemplatesNavigationManager",
";",
"navManager",
".",
"addGlobalKeyMap",
"(",
"{",
"key",
":",
"\"ESCAPE\"",
",",
"modal",
":",
"true",
",",
"callback",
":",
"{",
"fn",
":",
"this",
".",
"_raiseOnEscapeEvent",
",",
"scope",
":",
"this",
"}",
"}",
")",
";",
"navManager",
".",
"setModalBehaviour",
"(",
"true",
")",
";",
"}"
]
| Connect events specific to modal popups. | [
"Connect",
"events",
"specific",
"to",
"modal",
"popups",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/popups/PopupManager.js#L273-L285 | train |
|
ariatemplates/ariatemplates | src/aria/popups/PopupManager.js | function () {
var navManager = ariaTemplatesNavigationManager;
navManager.removeGlobalKeyMap({
key : "ESCAPE",
modal : true,
callback : {
fn : this._raiseOnEscapeEvent,
scope : this
}
});
// restore globalKeyMap
navManager.setModalBehaviour(false);
} | javascript | function () {
var navManager = ariaTemplatesNavigationManager;
navManager.removeGlobalKeyMap({
key : "ESCAPE",
modal : true,
callback : {
fn : this._raiseOnEscapeEvent,
scope : this
}
});
// restore globalKeyMap
navManager.setModalBehaviour(false);
} | [
"function",
"(",
")",
"{",
"var",
"navManager",
"=",
"ariaTemplatesNavigationManager",
";",
"navManager",
".",
"removeGlobalKeyMap",
"(",
"{",
"key",
":",
"\"ESCAPE\"",
",",
"modal",
":",
"true",
",",
"callback",
":",
"{",
"fn",
":",
"this",
".",
"_raiseOnEscapeEvent",
",",
"scope",
":",
"this",
"}",
"}",
")",
";",
"navManager",
".",
"setModalBehaviour",
"(",
"false",
")",
";",
"}"
]
| Disconnect events specific to modal popups. | [
"Disconnect",
"events",
"specific",
"to",
"modal",
"popups",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/popups/PopupManager.js#L290-L302 | train |
|
ariatemplates/ariatemplates | src/aria/popups/PopupManager.js | function () {
for (var i = this.openedPopups.length - 1; i >= 0; i--) {
var popup = this.openedPopups[i];
popup.updatePosition();
}
} | javascript | function () {
for (var i = this.openedPopups.length - 1; i >= 0; i--) {
var popup = this.openedPopups[i];
popup.updatePosition();
}
} | [
"function",
"(",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"this",
".",
"openedPopups",
".",
"length",
"-",
"1",
";",
"i",
">=",
"0",
";",
"i",
"--",
")",
"{",
"var",
"popup",
"=",
"this",
".",
"openedPopups",
"[",
"i",
"]",
";",
"popup",
".",
"updatePosition",
"(",
")",
";",
"}",
"}"
]
| Updates the position of all opened popups. | [
"Updates",
"the",
"position",
"of",
"all",
"opened",
"popups",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/popups/PopupManager.js#L307-L312 | train |
|
ariatemplates/ariatemplates | src/aria/popups/PopupManager.js | function (event) {
if (event.type === "mousewheel") {
ariaCoreTimer.addCallback({
fn : this.updatePositions,
scope : this
});
} else if (event.type === "scroll") {
this.updatePositions();
}
} | javascript | function (event) {
if (event.type === "mousewheel") {
ariaCoreTimer.addCallback({
fn : this.updatePositions,
scope : this
});
} else if (event.type === "scroll") {
this.updatePositions();
}
} | [
"function",
"(",
"event",
")",
"{",
"if",
"(",
"event",
".",
"type",
"===",
"\"mousewheel\"",
")",
"{",
"ariaCoreTimer",
".",
"addCallback",
"(",
"{",
"fn",
":",
"this",
".",
"updatePositions",
",",
"scope",
":",
"this",
"}",
")",
";",
"}",
"else",
"if",
"(",
"event",
".",
"type",
"===",
"\"scroll\"",
")",
"{",
"this",
".",
"updatePositions",
"(",
")",
";",
"}",
"}"
]
| handles the scroll for the popup
@param {Object} Event that triggered the scroll. | [
"handles",
"the",
"scroll",
"for",
"the",
"popup"
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/popups/PopupManager.js#L318-L327 | train |
|
ariatemplates/ariatemplates | src/aria/popups/PopupManager.js | function (target, notifyTargetBehindModalPopup) {
var searchPopup = this._document && target !== this._document.body;
if (searchPopup) {
for (var i = this.openedPopups.length - 1; i >= 0; i--) {
var popup = this.openedPopups[i];
if (utilsDom.isAncestor(target, popup.getDomElement())) {
// the element is in the modal popup, it is fine to focus it
return popup;
}
if (popup.modalMaskDomElement && utilsDom.isAncestor(target, popup.popupContainer.getContainerElt())) {
// the element is inside the container for which there is a modal mask
if (notifyTargetBehindModalPopup) {
return notifyTargetBehindModalPopup(popup);
}
return;
}
}
}
} | javascript | function (target, notifyTargetBehindModalPopup) {
var searchPopup = this._document && target !== this._document.body;
if (searchPopup) {
for (var i = this.openedPopups.length - 1; i >= 0; i--) {
var popup = this.openedPopups[i];
if (utilsDom.isAncestor(target, popup.getDomElement())) {
// the element is in the modal popup, it is fine to focus it
return popup;
}
if (popup.modalMaskDomElement && utilsDom.isAncestor(target, popup.popupContainer.getContainerElt())) {
// the element is inside the container for which there is a modal mask
if (notifyTargetBehindModalPopup) {
return notifyTargetBehindModalPopup(popup);
}
return;
}
}
}
} | [
"function",
"(",
"target",
",",
"notifyTargetBehindModalPopup",
")",
"{",
"var",
"searchPopup",
"=",
"this",
".",
"_document",
"&&",
"target",
"!==",
"this",
".",
"_document",
".",
"body",
";",
"if",
"(",
"searchPopup",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"this",
".",
"openedPopups",
".",
"length",
"-",
"1",
";",
"i",
">=",
"0",
";",
"i",
"--",
")",
"{",
"var",
"popup",
"=",
"this",
".",
"openedPopups",
"[",
"i",
"]",
";",
"if",
"(",
"utilsDom",
".",
"isAncestor",
"(",
"target",
",",
"popup",
".",
"getDomElement",
"(",
")",
")",
")",
"{",
"return",
"popup",
";",
"}",
"if",
"(",
"popup",
".",
"modalMaskDomElement",
"&&",
"utilsDom",
".",
"isAncestor",
"(",
"target",
",",
"popup",
".",
"popupContainer",
".",
"getContainerElt",
"(",
")",
")",
")",
"{",
"if",
"(",
"notifyTargetBehindModalPopup",
")",
"{",
"return",
"notifyTargetBehindModalPopup",
"(",
"popup",
")",
";",
"}",
"return",
";",
"}",
"}",
"}",
"}"
]
| Returns the popup which contains the given target DOM element, if the DOM element is not hidden
behind a modal popup.
@param {HTMLElement} target DOM element for which the containing popup has to be found
@param {Function} notifyTargetBehindModalPopup function which is called in case the target is behind
a modal popup. The function receives the modal popup as a parameter and its return value becomes
the return value of findParentPopup. | [
"Returns",
"the",
"popup",
"which",
"contains",
"the",
"given",
"target",
"DOM",
"element",
"if",
"the",
"DOM",
"element",
"is",
"not",
"hidden",
"behind",
"a",
"modal",
"popup",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/popups/PopupManager.js#L356-L374 | train |
|
ariatemplates/ariatemplates | src/aria/popups/PopupManager.js | function (event) {
var domEvent = new ariaDomEvent(event);
var target = domEvent.target;
var self = this;
var popup = this.findParentPopup(target, function (popup) {
var navigation;
navigation = self._viewportNavigationInterceptor.getNavigationInformation(target);
if (navigation == null) {
navigation = popup.getNavigationInformation(target);
}
var eventObject = {
name: "beforePreventingFocus",
event: domEvent,
modalPopup: popup,
cancel: false,
navigation: navigation
};
self.$raiseEvent(eventObject);
if (!eventObject.cancel) {
var direction;
if (navigation != null) {
direction = navigation.direction;
}
if (direction == null) {
direction = 'forward';
}
var reverse = !!(direction === 'backward');
ariaTemplatesNavigationManager.focusFirst(popup.domElement, reverse);
return popup;
}
// if the focus is allowed, don't return any popup to bring to the front
});
if (popup) {
this.bringToFront(popup);
}
domEvent.$dispose();
} | javascript | function (event) {
var domEvent = new ariaDomEvent(event);
var target = domEvent.target;
var self = this;
var popup = this.findParentPopup(target, function (popup) {
var navigation;
navigation = self._viewportNavigationInterceptor.getNavigationInformation(target);
if (navigation == null) {
navigation = popup.getNavigationInformation(target);
}
var eventObject = {
name: "beforePreventingFocus",
event: domEvent,
modalPopup: popup,
cancel: false,
navigation: navigation
};
self.$raiseEvent(eventObject);
if (!eventObject.cancel) {
var direction;
if (navigation != null) {
direction = navigation.direction;
}
if (direction == null) {
direction = 'forward';
}
var reverse = !!(direction === 'backward');
ariaTemplatesNavigationManager.focusFirst(popup.domElement, reverse);
return popup;
}
// if the focus is allowed, don't return any popup to bring to the front
});
if (popup) {
this.bringToFront(popup);
}
domEvent.$dispose();
} | [
"function",
"(",
"event",
")",
"{",
"var",
"domEvent",
"=",
"new",
"ariaDomEvent",
"(",
"event",
")",
";",
"var",
"target",
"=",
"domEvent",
".",
"target",
";",
"var",
"self",
"=",
"this",
";",
"var",
"popup",
"=",
"this",
".",
"findParentPopup",
"(",
"target",
",",
"function",
"(",
"popup",
")",
"{",
"var",
"navigation",
";",
"navigation",
"=",
"self",
".",
"_viewportNavigationInterceptor",
".",
"getNavigationInformation",
"(",
"target",
")",
";",
"if",
"(",
"navigation",
"==",
"null",
")",
"{",
"navigation",
"=",
"popup",
".",
"getNavigationInformation",
"(",
"target",
")",
";",
"}",
"var",
"eventObject",
"=",
"{",
"name",
":",
"\"beforePreventingFocus\"",
",",
"event",
":",
"domEvent",
",",
"modalPopup",
":",
"popup",
",",
"cancel",
":",
"false",
",",
"navigation",
":",
"navigation",
"}",
";",
"self",
".",
"$raiseEvent",
"(",
"eventObject",
")",
";",
"if",
"(",
"!",
"eventObject",
".",
"cancel",
")",
"{",
"var",
"direction",
";",
"if",
"(",
"navigation",
"!=",
"null",
")",
"{",
"direction",
"=",
"navigation",
".",
"direction",
";",
"}",
"if",
"(",
"direction",
"==",
"null",
")",
"{",
"direction",
"=",
"'forward'",
";",
"}",
"var",
"reverse",
"=",
"!",
"!",
"(",
"direction",
"===",
"'backward'",
")",
";",
"ariaTemplatesNavigationManager",
".",
"focusFirst",
"(",
"popup",
".",
"domElement",
",",
"reverse",
")",
";",
"return",
"popup",
";",
"}",
"}",
")",
";",
"if",
"(",
"popup",
")",
"{",
"this",
".",
"bringToFront",
"(",
"popup",
")",
";",
"}",
"domEvent",
".",
"$dispose",
"(",
")",
";",
"}"
]
| Callback after the focus is put on an element in the document, when a modal popup is displayed.
@param {Object} event The DOM focusin event triggering the callback | [
"Callback",
"after",
"the",
"focus",
"is",
"put",
"on",
"an",
"element",
"in",
"the",
"document",
"when",
"a",
"modal",
"popup",
"is",
"displayed",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/popups/PopupManager.js#L380-L418 | train |
|
ariatemplates/ariatemplates | src/aria/popups/PopupManager.js | function () {
var openedPopups = this.openedPopups;
var topPopup = null;
if (openedPopups.length > 0) {
topPopup = openedPopups[openedPopups.length - 1];
var topZIndex = topPopup.getZIndex();
for (var i = openedPopups.length - 2; i >= 0; i--) {
var curPopup = openedPopups[i];
var curZIndex = curPopup.getZIndex();
if (curZIndex > topZIndex) {
topPopup = curPopup;
topZIndex = curZIndex;
}
}
}
return topPopup;
} | javascript | function () {
var openedPopups = this.openedPopups;
var topPopup = null;
if (openedPopups.length > 0) {
topPopup = openedPopups[openedPopups.length - 1];
var topZIndex = topPopup.getZIndex();
for (var i = openedPopups.length - 2; i >= 0; i--) {
var curPopup = openedPopups[i];
var curZIndex = curPopup.getZIndex();
if (curZIndex > topZIndex) {
topPopup = curPopup;
topZIndex = curZIndex;
}
}
}
return topPopup;
} | [
"function",
"(",
")",
"{",
"var",
"openedPopups",
"=",
"this",
".",
"openedPopups",
";",
"var",
"topPopup",
"=",
"null",
";",
"if",
"(",
"openedPopups",
".",
"length",
">",
"0",
")",
"{",
"topPopup",
"=",
"openedPopups",
"[",
"openedPopups",
".",
"length",
"-",
"1",
"]",
";",
"var",
"topZIndex",
"=",
"topPopup",
".",
"getZIndex",
"(",
")",
";",
"for",
"(",
"var",
"i",
"=",
"openedPopups",
".",
"length",
"-",
"2",
";",
"i",
">=",
"0",
";",
"i",
"--",
")",
"{",
"var",
"curPopup",
"=",
"openedPopups",
"[",
"i",
"]",
";",
"var",
"curZIndex",
"=",
"curPopup",
".",
"getZIndex",
"(",
")",
";",
"if",
"(",
"curZIndex",
">",
"topZIndex",
")",
"{",
"topPopup",
"=",
"curPopup",
";",
"topZIndex",
"=",
"curZIndex",
";",
"}",
"}",
"}",
"return",
"topPopup",
";",
"}"
]
| Returns the popup with the highest zIndex. | [
"Returns",
"the",
"popup",
"with",
"the",
"highest",
"zIndex",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/popups/PopupManager.js#L423-L439 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.